@antv/g6 5.0.33 → 5.0.35

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 (107) hide show
  1. package/dist/g6.min.js +3 -3
  2. package/dist/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
  3. package/dist/lib/elements/edges/base-edge.d.ts +5 -5
  4. package/dist/lib/elements/nodes/base-node.d.ts +2 -0
  5. package/dist/lib/elements/shapes/base-shape.d.ts +2 -2
  6. package/dist/lib/exports.d.ts +2 -2
  7. package/dist/lib/layouts/fishbone.d.ts +2 -1
  8. package/dist/lib/layouts/index.d.ts +2 -0
  9. package/dist/lib/layouts/snake.d.ts +80 -0
  10. package/dist/lib/layouts/types.d.ts +3 -1
  11. package/dist/lib/plugins/minimap/index.d.ts +1 -1
  12. package/dist/lib/plugins/tooltip.d.ts +6 -0
  13. package/dist/lib/spec/canvas.d.ts +26 -2
  14. package/dist/lib/spec/graph.d.ts +60 -12
  15. package/dist/lib/spec/viewport.d.ts +4 -0
  16. package/dist/lib/utils/cache.d.ts +5 -5
  17. package/dist/lib/utils/style.d.ts +5 -5
  18. package/dist/lib/version.d.ts +1 -1
  19. package/esm/behaviors/optimize-viewport-transform.d.ts +1 -1
  20. package/esm/elements/edges/base-edge.d.ts +5 -5
  21. package/esm/elements/nodes/base-node.d.ts +2 -0
  22. package/esm/elements/nodes/base-node.js +2 -2
  23. package/esm/elements/nodes/base-node.js.map +1 -1
  24. package/esm/elements/shapes/base-shape.d.ts +2 -2
  25. package/esm/elements/shapes/base-shape.js +2 -2
  26. package/esm/exports.d.ts +2 -2
  27. package/esm/exports.js +1 -1
  28. package/esm/exports.js.map +1 -1
  29. package/esm/layouts/fishbone.d.ts +2 -1
  30. package/esm/layouts/fishbone.js +1 -1
  31. package/esm/layouts/fishbone.js.map +1 -1
  32. package/esm/layouts/index.d.ts +2 -0
  33. package/esm/layouts/index.js +1 -0
  34. package/esm/layouts/index.js.map +1 -1
  35. package/esm/layouts/snake.d.ts +80 -0
  36. package/esm/layouts/snake.js +162 -0
  37. package/esm/layouts/snake.js.map +1 -0
  38. package/esm/layouts/types.d.ts +3 -1
  39. package/esm/plugins/minimap/index.d.ts +1 -1
  40. package/esm/plugins/tooltip.d.ts +6 -0
  41. package/esm/plugins/tooltip.js +8 -6
  42. package/esm/plugins/tooltip.js.map +1 -1
  43. package/esm/registry/build-in.js +2 -1
  44. package/esm/registry/build-in.js.map +1 -1
  45. package/esm/spec/canvas.d.ts +26 -2
  46. package/esm/spec/graph.d.ts +60 -12
  47. package/esm/spec/viewport.d.ts +4 -0
  48. package/esm/utils/cache.d.ts +5 -5
  49. package/esm/utils/cache.js +5 -5
  50. package/esm/utils/style.d.ts +5 -5
  51. package/esm/utils/style.js +5 -5
  52. package/esm/version.d.ts +1 -1
  53. package/esm/version.js +1 -1
  54. package/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
  55. package/lib/elements/edges/base-edge.d.ts +5 -5
  56. package/lib/elements/nodes/base-node.d.ts +2 -0
  57. package/lib/elements/nodes/base-node.js +2 -2
  58. package/lib/elements/nodes/base-node.js.map +1 -1
  59. package/lib/elements/shapes/base-shape.d.ts +2 -2
  60. package/lib/elements/shapes/base-shape.js +2 -2
  61. package/lib/exports.d.ts +2 -2
  62. package/lib/exports.js +3 -2
  63. package/lib/exports.js.map +1 -1
  64. package/lib/layouts/fishbone.d.ts +2 -1
  65. package/lib/layouts/fishbone.js +2 -2
  66. package/lib/layouts/fishbone.js.map +1 -1
  67. package/lib/layouts/index.d.ts +2 -0
  68. package/lib/layouts/index.js +3 -1
  69. package/lib/layouts/index.js.map +1 -1
  70. package/lib/layouts/snake.d.ts +80 -0
  71. package/lib/layouts/snake.js +166 -0
  72. package/lib/layouts/snake.js.map +1 -0
  73. package/lib/layouts/types.d.ts +3 -1
  74. package/lib/plugins/minimap/index.d.ts +1 -1
  75. package/lib/plugins/tooltip.d.ts +6 -0
  76. package/lib/plugins/tooltip.js +8 -6
  77. package/lib/plugins/tooltip.js.map +1 -1
  78. package/lib/registry/build-in.js +1 -0
  79. package/lib/registry/build-in.js.map +1 -1
  80. package/lib/spec/canvas.d.ts +26 -2
  81. package/lib/spec/graph.d.ts +60 -12
  82. package/lib/spec/viewport.d.ts +4 -0
  83. package/lib/utils/cache.d.ts +5 -5
  84. package/lib/utils/cache.js +5 -5
  85. package/lib/utils/style.d.ts +5 -5
  86. package/lib/utils/style.js +5 -5
  87. package/lib/version.d.ts +1 -1
  88. package/lib/version.js +1 -1
  89. package/package.json +1 -1
  90. package/src/behaviors/optimize-viewport-transform.ts +1 -1
  91. package/src/elements/edges/base-edge.ts +5 -5
  92. package/src/elements/nodes/base-node.ts +4 -2
  93. package/src/elements/shapes/base-shape.ts +2 -2
  94. package/src/exports.ts +2 -1
  95. package/src/layouts/fishbone.ts +3 -2
  96. package/src/layouts/index.ts +3 -0
  97. package/src/layouts/snake.ts +235 -0
  98. package/src/layouts/types.ts +5 -1
  99. package/src/plugins/minimap/index.ts +1 -1
  100. package/src/plugins/tooltip.ts +11 -4
  101. package/src/registry/build-in.ts +2 -0
  102. package/src/spec/canvas.ts +26 -2
  103. package/src/spec/graph.ts +60 -12
  104. package/src/spec/viewport.ts +4 -0
  105. package/src/utils/cache.ts +5 -5
  106. package/src/utils/style.ts +5 -5
  107. package/src/version.ts +1 -1
package/dist/g6.min.js CHANGED
@@ -15,7 +15,7 @@
15
15
  * @author AntVis
16
16
  * @docs https://g.antv.antgroup.com/
17
17
  */
18
- var pu=function(t){function e(t,n,r,i){var o;return s(this,e),(o=v(this,e,[t])).currentTime=r,o.timelineTime=i,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=r,o.timelineTime=i,o}return y(e,t),u(e)}(Cs),gu=0,vu=function(){return u((function t(e,n){var r;s(this,t),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=e,e.animation=this,this.timeline=n,this.id="".concat(gu++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null===(r=this.effect)||void 0===r?void 0:r.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}),[{key:"pending",get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var t=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise((function(e,n){t.resolveReadyPromise=function(){e(t)},t.rejectReadyPromise=function(){n(new Error)}})),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var t=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise((function(e,n){t.resolveFinishedPromise=function(){e(t)},t.rejectFinishedPromise=function(){n(new Error)}})),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){if(t=Number(t),!isNaN(t)){var e;if(this.timeline.restart(),!this._paused&&null!==this._startTime)this._startTime=Number(null===(e=this.timeline)||void 0===e?void 0:e.currentTime)-t/this.playbackRate;this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(t){if(null!==t){if(this.updatePromises(),t=Number(t),isNaN(t))return;if(this._paused||this._idle)return;this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){if(t!==this._playbackRate){this.updatePromises();var e=this.currentTime;this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||"running"===this.playState||!this._finishedFlag}},{key:"updatePromises",value:function(){var t=this.oldPlayState,e=this.pending?"pending":this.playState;return this.readyPromise&&e!==t&&("idle"===e?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===t?this.resolveReadyPromise():"pending"===e&&(this.readyPromise=void 0)),this.finishedPromise&&e!==t&&("idle"===e?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===e?this.resolveFinishedPromise():"finished"===t&&(this.finishedPromise=void 0)),this.oldPlayState=e,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var t=this;if(this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var e=new pu(null,this,this.currentTime,null);setTimeout((function(){t.oncancel(e)}))}}},{key:"reverse",value:function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()}},{key:"updatePlaybackRate",value:function(t){this.playbackRate=t}},{key:"targetAnimations",value:function(){var t;return(null===(t=this.effect)||void 0===t?void 0:t.target).getAnimations()}},{key:"markTarget",value:function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)}},{key:"unmarkTarget",value:function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)}},{key:"tick",value:function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}}},{key:"persist",value:function(){throw new Error(Qr)}},{key:"addEventListener",value:function(t,e,n){throw new Error(Qr)}},{key:"removeEventListener",value:function(t,e,n){throw new Error(Qr)}},{key:"dispatchEvent",value:function(t){throw new Error(Qr)}},{key:"commitStyles",value:function(){throw new Error(Qr)}},{key:"ensureAlive",value:function(){var t,e;this.playbackRate<0&&0===this.currentTime?this._inEffect=!(null===(t=this.effect)||void 0===t||!t.update(-1)):this._inEffect=!(null===(e=this.effect)||void 0===e||!e.update(this.currentTime));this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(t){var e=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new pu(null,this,this.currentTime,t);setTimeout((function(){e.onfinish&&e.onfinish(n)}))}this._finishedFlag=!0}}else{if(this.onframe&&"running"===this.playState){var r=new pu(null,this,this.currentTime,t);this.onframe(r)}this._finishedFlag=!1}}}])}(),mu=.1,yu="function"==typeof Float32Array,bu=function(t,e){return 1-3*e+3*t},xu=function(t,e){return 3*e-6*t},Eu=function(t){return 3*t},wu=function(t,e,n){return((bu(e,n)*t+xu(e,n))*t+Eu(e))*t},ku=function(t,e,n){return 3*bu(e,n)*t*t+2*xu(e,n)*t+Eu(e)},Mu=function(t,e,n,r){if(!(t>=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===r)return function(t){return t};for(var i=yu?new Float32Array(11):new Array(11),o=0;o<11;++o)i[o]=wu(o*mu,t,n);var a=function(e){for(var r=0,o=1;10!==o&&i[o]<=e;++o)r+=mu;--o;var a=r+(e-i[o])/(i[o+1]-i[o])*mu,s=ku(a,t,n);return s>=.001?function(t,e,n,r){for(var i=0;i<4;++i){var o=ku(e,n,r);if(0===o)return e;e-=(wu(e,n,r)-t)/o}return e}(e,a,t,n):0===s?a:function(t,e,n,r,i){var o,a,s=0;do{(o=wu(a=e+(n-e)/2,r,i)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++s<10);return a}(e,r,r+mu,t,n)};return function(t){return 0===t||1===t?t:wu(a(t),e,r)}},Su=function(t){return Math.pow(t,2)},Nu=function(t){return Math.pow(t,3)},Ou=function(t){return Math.pow(t,4)},Tu=function(t){return Math.pow(t,5)},Cu=function(t){return Math.pow(t,6)},Au=function(t){return 1-Math.cos(t*Math.PI/2)},Pu=function(t){return 1-Math.sqrt(1-t*t)},Ru=function(t){return t*t*(3*t-2)},Du=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)},Lu=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?.5:i,a=oe(Number(r),1,10),s=oe(Number(o),.1,2);return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-s/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/s)},_u=function(t){var e=arguments.length>2?arguments[2]:void 0,n=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),r=n[0],i=void 0===r?1:r,o=n[1],a=void 0===o?100:o,s=n[2],l=void 0===s?10:s,u=n[3],c=void 0===u?0:u;i=oe(i,.1,1e3),a=oe(a,.1,1e3),l=oe(l,.1,1e3),c=oe(c,.1,1e3);var h=Math.sqrt(a/i),d=l/(2*Math.sqrt(a*i)),f=d<1?h*Math.sqrt(1-d*d):0,p=d<1?(d*h-c)/f:-c+h,g=e?e*t/1e3:t;return g=d<1?Math.exp(-g*d*h)*(1*Math.cos(f*g)+p*Math.sin(f*g)):(1+p*g)*Math.exp(-g*h),0===t||1===t?t:1-g},Iu=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?10:n;return("start"===e[1]?Math.ceil:Math.floor)(oe(t,0,1)*r)/r},ju=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),n=e[0],r=e[1],i=e[2],o=e[3];return Mu(n,r,i,o)(t)},Bu=Mu(.42,0,1,1),Fu=function(t){return function(e){return 1-t(1-e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],arguments.length>2?arguments[2]:void 0)}},zu=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?t(2*e,n,r)/2:1-t(-2*e+2,n,r)/2}},Gu=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-2*e,n,r))/2:(t(2*e-1,n,r)+1)/2}},Vu={steps:Iu,"step-start":function(t){return Iu(t,[1,"start"])},"step-end":function(t){return Iu(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":ju,ease:function(t){return ju(t,[.25,.1,.25,1])},in:Bu,out:Fu(Bu),"in-out":zu(Bu),"out-in":Gu(Bu),"in-quad":Su,"out-quad":Fu(Su),"in-out-quad":zu(Su),"out-in-quad":Gu(Su),"in-cubic":Nu,"out-cubic":Fu(Nu),"in-out-cubic":zu(Nu),"out-in-cubic":Gu(Nu),"in-quart":Ou,"out-quart":Fu(Ou),"in-out-quart":zu(Ou),"out-in-quart":Gu(Ou),"in-quint":Tu,"out-quint":Fu(Tu),"in-out-quint":zu(Tu),"out-in-quint":Gu(Tu),"in-expo":Cu,"out-expo":Fu(Cu),"in-out-expo":zu(Cu),"out-in-expo":Gu(Cu),"in-sine":Au,"out-sine":Fu(Au),"in-out-sine":zu(Au),"out-in-sine":Gu(Au),"in-circ":Pu,"out-circ":Fu(Pu),"in-out-circ":zu(Pu),"out-in-circ":Gu(Pu),"in-back":Ru,"out-back":Fu(Ru),"in-out-back":zu(Ru),"out-in-back":Gu(Ru),"in-bounce":Du,"out-bounce":Fu(Du),"in-out-bounce":zu(Du),"out-in-bounce":Gu(Du),"in-elastic":Lu,"out-elastic":Fu(Lu),"in-out-elastic":zu(Lu),"out-in-elastic":Gu(Lu),spring:_u,"spring-in":_u,"spring-out":Fu(_u),"spring-in-out":zu(_u),"spring-out-in":Gu(_u)},Wu=function(t){return t};function Hu(t,e){return function(n){if(n>=1)return 1;var r=1/t;return(n+=e*r)-n%r}}var Uu="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",Yu=new RegExp("cubic-bezier\\(".concat(Uu,",").concat(Uu,",").concat(Uu,",").concat(Uu,"\\)")),$u=/steps\(\s*(\d+)\s*\)/,qu=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Xu(t){var e=Yu.exec(t);if(e)return Mu.apply(void 0,d(e.slice(1).map(Number)));var n=$u.exec(t);if(n)return Hu(Number(n[1]),0);var r=qu.exec(t);return r?Hu(Number(r[1]),{start:1,middle:.5,end:0}[r[2]]):Vu[function(t){return function(t){return"-"===(t=t.replace(/([A-Z])/g,(function(t){return"-".concat(t.toLowerCase())}))).charAt(0)?t.substring(1):t}(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()}(t)]||Vu.linear}function Ku(t){return Math.abs(function(t){var e;if(0===t.duration||0===t.iterations)return 0;return("auto"===t.duration?0:Number(t.duration))*(null!==(e=t.iterations)&&void 0!==e?e:1)}(t)/(t.playbackRate||1))}function Zu(t,e,n){var r=function(t,e,n){if(null===e)return 0;var r=n.endTime;return e<Math.min(n.delay,r)?1:e>=Math.min(n.delay+t+n.endDelay,r)?2:3}(t,e,n),i=function(t,e,n,r,i){switch(r){case 1:return"backwards"===e||"both"===e?0:null;case 3:return n-i;case 2:return"forwards"===e||"both"===e?t:null;case 0:return null}}(t,n.fill,e,r,n.delay);if(null===i)return null;var o="auto"===n.duration?0:n.duration,a=function(t,e,n,r,i){var o=i;return 0===t?1!==e&&(o+=n):o+=r/t,o}(o,r,n.iterations,i,n.iterationStart),s=function(t,e,n,r,i,o){var a=t===1/0?e%1:t%1;return 0!==a||2!==n||0===r||0===i&&0!==o||(a=1),a}(a,n.iterationStart,r,n.iterations,i,o),l=function(t,e,n,r){return 2===t&&e===1/0?1/0:1===n?Math.floor(r)-1:Math.floor(r)}(r,n.iterations,s,a),u=function(t,e,n){var r=t;if("normal"!==t&&"reverse"!==t){var i=e;"alternate-reverse"===t&&(i+=1),r="normal",i!==1/0&&i%2!=0&&(r="reverse")}return"normal"===r?n:1-n}(n.direction,l,s);return n.currentIteration=l,n.progress=u,n.easingFunction(u)}function Qu(t,e,n){var r=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r])if(Ju(i)){var o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:Xu(t[r].easing)||e.easingFunction,value:t[r][i]};n[i]=n[i]||[],n[i].push(o)}return n}(t,e),i=function(t,e){var n=[];for(var r in t)for(var i=t[r],o=0;o<i.length-1;o++){var a=o,s=o+1,l=i[a].computedOffset,u=i[s].computedOffset,c=l,h=u;0===o&&(c=-1/0,0===u&&(s=a)),o===i.length-2&&(h=1/0,1===l&&(a=s)),n.push({applyFrom:c,applyTo:h,startOffset:i[a].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[a].easingFunction,property:r,interpolation:ec(r,i[a].value,i[s].value,e)})}return n.sort((function(t,e){return t.startOffset-e.startOffset})),n}(r,n);return function(t,e){if(null!==e)i.filter((function(t){return e>=t.applyFrom&&e<t.applyTo})).forEach((function(n){var r=e-n.startOffset,i=n.endOffset-n.startOffset,o=0===i?0:r/i;t.setAttribute(n.property,n.interpolation(o),!1,!1)}));else for(var n in r)Ju(n)&&t.setAttribute(n,null)}}function Ju(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var tc=function(t,e,n){return function(r){var i=nc(t,e,r);return ae(i)?i:n(i)}};function ec(t,e,n,r){var i=ga[t];if(i&&i.syntax&&i.int){var o=xl.styleValueRegistry.getPropertySyntax(i.syntax);if(o){var a=o.parser,s=a?a(e,r):e,l=a?a(n,r):n,u=o.mixer(s,l,r);if(u){var c=tc.apply(void 0,d(u));return function(t){return 0===t?e:1===t?n:c(t)}}}}return tc(!1,!0,(function(t){return t?n:e}))}function nc(t,e,n){if("number"==typeof t&&"number"==typeof e)return t*(1-n)+e*n;if("boolean"==typeof t&&"boolean"==typeof e||"string"==typeof t&&"string"==typeof e)return n<.5?t:e;if(Array.isArray(t)&&Array.isArray(e)){for(var r=t.length,i=e.length,o=Math.max(r,i),a=[],s=0;s<o;s++)a.push(nc(t[s<r?s:r-1],e[s<i?s:i-1],n));return a}throw new Error("Mismatched interpolation arguments ".concat(t,":").concat(e))}var rc=function(){return u((function t(){s(this,t),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=Wu,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}),[{key:"easing",get:function(){return this._easing},set:function(t){this.easingFunction=Xu(t),this._easing=t}}])}();function ic(t,e){if(null===t)return[];Array.isArray(t)||(t=function(t){var e=[];for(var n in t)if(!(n in["easing","offset","composite"])){var r=t[n];Array.isArray(r)||(r=[r]);for(var i=r.length,o=0;o<i;o++){if(!e[o]){var a={};"offset"in t&&(a.offset=Number(t.offset)),"easing"in t&&(a.easing=t.easing),"composite"in t&&(a.composite=t.composite),e[o]=a}void 0!==r[o]&&null!==r[o]&&(e[o][n]=r[o])}}return e.sort((function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)})),e}(t));for(var n=t.map((function(t){var n={};for(var r in null!=e&&e.composite&&(n.composite="auto"),t){var i=t[r];if("offset"===r){if(null!==i){if(i=Number(i),!isFinite(i))throw new Error("Keyframe offsets must be numbers.");if(i<0||i>1)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=i}}else if("composite"===r&&-1===["replace","add","accumulate","auto"].indexOf(i))throw new Error("".concat(i," compositing is not supported"));n[r]=i}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==e?void 0:e.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n})),r=!0,i=-1/0,o=0;o<n.length;o++){var a=n[o].offset;if(Yt(a))r=!1;else{if(a<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=a}}return n=n.filter((function(t){return Number(t.offset)>=0&&Number(t.offset)<=1})),r||function(){var t,e,r=n.length;n[r-1].computedOffset=Number(null!==(t=n[r-1].offset)&&void 0!==t?t:1),r>1&&(n[0].computedOffset=Number(null!==(e=n[0].offset)&&void 0!==e?e:0));for(var i=0,o=Number(n[0].computedOffset),a=1;a<r;a++){var s=n[a].computedOffset;if(!Yt(s)&&!Yt(o)){for(var l=1;l<a-i;l++)n[i+l].computedOffset=o+(Number(s)-o)*l/(a-i);i=a,o=Number(s)}}}(),n}var oc="backwards|forwards|both|none".split("|"),ac="reverse|alternate|alternate-reverse".split("|");function sc(t,e){var n;return function(t){var e=new rc;return"number"!=typeof t||isNaN(t)?void 0!==t&&Object.keys(t).forEach((function(n){if(void 0!==t[n]&&null!==t[n]&&"auto"!==t[n]){if(("number"==typeof e[n]||"duration"===n)&&("number"!=typeof t[n]||isNaN(t[n])))return;if("fill"===n&&-1===oc.indexOf(t[n]))return;if("direction"===n&&-1===ac.indexOf(t[n]))return;e[n]=t[n]}})):e.duration=t,e}(t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!==(n=t)&&void 0!==n?n:{duration:"auto"}))}var lc=function(){return u((function t(e,n,r){var i=this;s(this,t),this.composite="replace",this.iterationComposite="replace",this.target=e,this.timing=sc(r),this.timing.effect=this,this.timing.activeDuration=Ku(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=ic(n,this.timing),this.interpolations=Qu(this.normalizedKeyframes,this.timing,this.target);var o=xl.globalThis.Proxy;this.computedTiming=o?new o(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?i.animation&&i.animation.currentTime||null:"currentIteration"===e?i.animation&&"running"===i.animation.playState?t.currentIteration||0:null:"progress"===e?i.animation&&"running"===i.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing}),[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(t){return null!==t&&(this.timeFraction=Zu(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(t){this.normalizedKeyframes=ic(t)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(t){var e=this;Object.keys(t||{}).forEach((function(n){e.timing[n]=t[n]}))}}])}();function uc(t,e){return Number(t.id)-Number(e.id)}var cc=function(){return u((function t(e){var n=this;s(this,t),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(t){n.currentTime=t,n.discardAnimations(),0===n.animations.length?n.timelineTicking=!1:n.requestAnimationFrame(n.webAnimationsNextTick)},this.processRafCallbacks=function(t){var e=n.rafCallbacks;n.rafCallbacks=[],t<Number(n.currentTime)&&(t=Number(n.currentTime)),n.animations.sort(uc),n.animations=n.tick(t,!0,n.animations)[0],e.forEach((function(e){e[1](t)})),n.applyPendingEffects()},this.document=e}),[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(t,e,n){var r=new lc(t,e,n),i=new vu(r,this);return this.animations.push(i),this.restartWebAnimationsNextTick(),i.updatePromises(),i.play(),i.updatePromises(),i}},{key:"applyDirtiedAnimation",value:function(t){var e=this;if(!this.inTick){t.markTarget();var n=t.targetAnimations();n.sort(uc),this.tick(Number(this.currentTime),!1,n.slice())[1].forEach((function(t){var n=e.animations.indexOf(t);-1!==n&&e.animations.splice(n,1)})),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame((function(){})),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach((function(t){null==t||t.applyInterpolations()})),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter((function(t){return t.updatePromises()}))}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter((function(t){return"finished"!==t.playState&&"idle"!==t.playState}))}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e}},{key:"requestAnimationFrame",value:function(t){var e=this;return this.rAF((function(n){e.updateAnimationsPromises(),t(n),e.updateAnimationsPromises()}))}},{key:"tick",value:function(t,e,n){var r,i,o=this;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=t,this.ticking=!1;var a=[],s=[],l=[],u=[];return n.forEach((function(n){n.tick(t,e),n._inEffect?(s.push(n.effect),n.markTarget()):(a.push(n.effect),n.unmarkTarget()),n._needsTick&&(o.ticking=!0);var r=n._inEffect||n._needsTick;n._inTimeline=r,r?l.push(n):u.push(n)})),(r=this.pendingEffects).push.apply(r,a),(i=this.pendingEffects).push.apply(i,s),this.ticking&&this.requestAnimationFrame((function(){})),this.inTick=!1,[l,u]}}])}();xl.EasingFunction=Xu,xl.AnimationTimeline=cc;const hc={duration:500},dc={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var fc,pc,gc,vc,mc,yc,bc,xc,Ec;!function(t){t.NodeAdded="NodeAdded",t.NodeUpdated="NodeUpdated",t.NodeRemoved="NodeRemoved",t.EdgeAdded="EdgeAdded",t.EdgeUpdated="EdgeUpdated",t.EdgeRemoved="EdgeRemoved",t.ComboAdded="ComboAdded",t.ComboUpdated="ComboUpdated",t.ComboRemoved="ComboRemoved"}(fc||(fc={})),function(t){t.DRAW="draw",t.COLLAPSE="collapse",t.EXPAND="expand",t.TRANSFORM="transform"}(pc||(pc={})),t.CanvasEvent=void 0,function(t){t.CLICK="canvas:click",t.DBLCLICK="canvas:dblclick",t.POINTER_OVER="canvas:pointerover",t.POINTER_LEAVE="canvas:pointerleave",t.POINTER_ENTER="canvas:pointerenter",t.POINTER_MOVE="canvas:pointermove",t.POINTER_OUT="canvas:pointerout",t.POINTER_DOWN="canvas:pointerdown",t.POINTER_UP="canvas:pointerup",t.CONTEXT_MENU="canvas:contextmenu",t.DRAG_START="canvas:dragstart",t.DRAG="canvas:drag",t.DRAG_END="canvas:dragend",t.DRAG_ENTER="canvas:dragenter",t.DRAG_OVER="canvas:dragover",t.DRAG_LEAVE="canvas:dragleave",t.DROP="canvas:drop",t.WHEEL="canvas:wheel"}(t.CanvasEvent||(t.CanvasEvent={})),t.ComboEvent=void 0,(gc=t.ComboEvent||(t.ComboEvent={})).CLICK="combo:click",gc.DBLCLICK="combo:dblclick",gc.POINTER_OVER="combo:pointerover",gc.POINTER_LEAVE="combo:pointerleave",gc.POINTER_ENTER="combo:pointerenter",gc.POINTER_MOVE="combo:pointermove",gc.POINTER_OUT="combo:pointerout",gc.POINTER_DOWN="combo:pointerdown",gc.POINTER_UP="combo:pointerup",gc.CONTEXT_MENU="combo:contextmenu",gc.DRAG_START="combo:dragstart",gc.DRAG="combo:drag",gc.DRAG_END="combo:dragend",gc.DRAG_ENTER="combo:dragenter",gc.DRAG_OVER="combo:dragover",gc.DRAG_LEAVE="combo:dragleave",gc.DROP="combo:drop",t.CommonEvent=void 0,(vc=t.CommonEvent||(t.CommonEvent={})).CLICK="click",vc.DBLCLICK="dblclick",vc.POINTER_OVER="pointerover",vc.POINTER_LEAVE="pointerleave",vc.POINTER_ENTER="pointerenter",vc.POINTER_MOVE="pointermove",vc.POINTER_OUT="pointerout",vc.POINTER_DOWN="pointerdown",vc.POINTER_UP="pointerup",vc.CONTEXT_MENU="contextmenu",vc.DRAG_START="dragstart",vc.DRAG="drag",vc.DRAG_END="dragend",vc.DRAG_ENTER="dragenter",vc.DRAG_OVER="dragover",vc.DRAG_LEAVE="dragleave",vc.DROP="drop",vc.KEY_DOWN="keydown",vc.KEY_UP="keyup",vc.WHEEL="wheel",t.ContainerEvent=void 0,(mc=t.ContainerEvent||(t.ContainerEvent={})).KEY_DOWN="keydown",mc.KEY_UP="keyup",t.EdgeEvent=void 0,(yc=t.EdgeEvent||(t.EdgeEvent={})).CLICK="edge:click",yc.DBLCLICK="edge:dblclick",yc.POINTER_OVER="edge:pointerover",yc.POINTER_LEAVE="edge:pointerleave",yc.POINTER_ENTER="edge:pointerenter",yc.POINTER_MOVE="edge:pointermove",yc.POINTER_OUT="edge:pointerout",yc.POINTER_DOWN="edge:pointerdown",yc.POINTER_UP="edge:pointerup",yc.CONTEXT_MENU="edge:contextmenu",yc.DRAG_ENTER="edge:dragenter",yc.DRAG_OVER="edge:dragover",yc.DRAG_LEAVE="edge:dragleave",yc.DROP="edge:drop",t.GraphEvent=void 0,(bc=t.GraphEvent||(t.GraphEvent={})).BEFORE_CANVAS_INIT="beforecanvasinit",bc.AFTER_CANVAS_INIT="aftercanvasinit",bc.BEFORE_SIZE_CHANGE="beforesizechange",bc.AFTER_SIZE_CHANGE="aftersizechange",bc.BEFORE_ELEMENT_CREATE="beforeelementcreate",bc.AFTER_ELEMENT_CREATE="afterelementcreate",bc.BEFORE_ELEMENT_UPDATE="beforeelementupdate",bc.AFTER_ELEMENT_UPDATE="afterelementupdate",bc.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",bc.AFTER_ELEMENT_DESTROY="afterelementdestroy",bc.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",bc.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",bc.BEFORE_DRAW="beforedraw",bc.AFTER_DRAW="afterdraw",bc.BEFORE_RENDER="beforerender",bc.AFTER_RENDER="afterrender",bc.BEFORE_ANIMATE="beforeanimate",bc.AFTER_ANIMATE="afteranimate",bc.BEFORE_LAYOUT="beforelayout",bc.AFTER_LAYOUT="afterlayout",bc.BEFORE_STAGE_LAYOUT="beforestagelayout",bc.AFTER_STAGE_LAYOUT="afterstagelayout",bc.BEFORE_TRANSFORM="beforetransform",bc.AFTER_TRANSFORM="aftertransform",bc.BATCH_START="batchstart",bc.BATCH_END="batchend",bc.BEFORE_DESTROY="beforedestroy",bc.AFTER_DESTROY="afterdestroy",bc.BEFORE_RENDERER_CHANGE="beforerendererchange",bc.AFTER_RENDERER_CHANGE="afterrendererchange",t.HistoryEvent=void 0,(xc=t.HistoryEvent||(t.HistoryEvent={})).UNDO="undo",xc.REDO="redo",xc.CANCEL="cancel",xc.ADD="add",xc.CLEAR="clear",xc.CHANGE="change",t.NodeEvent=void 0,(Ec=t.NodeEvent||(t.NodeEvent={})).CLICK="node:click",Ec.DBLCLICK="node:dblclick",Ec.POINTER_OVER="node:pointerover",Ec.POINTER_LEAVE="node:pointerleave",Ec.POINTER_ENTER="node:pointerenter",Ec.POINTER_MOVE="node:pointermove",Ec.POINTER_OUT="node:pointerout",Ec.POINTER_DOWN="node:pointerdown",Ec.POINTER_UP="node:pointerup",Ec.CONTEXT_MENU="node:contextmenu",Ec.DRAG_START="node:dragstart",Ec.DRAG="node:drag",Ec.DRAG_END="node:dragend",Ec.DRAG_ENTER="node:dragenter",Ec.DRAG_OVER="node:dragover",Ec.DRAG_LEAVE="node:dragleave",Ec.DROP="node:drop";const wc="combo",kc="tree";var Mc;t.ExtensionCategory=void 0,(Mc=t.ExtensionCategory||(t.ExtensionCategory={})).NODE="node",Mc.EDGE="edge",Mc.COMBO="combo",Mc.THEME="theme",Mc.PALETTE="palette",Mc.LAYOUT="layout",Mc.BEHAVIOR="behavior",Mc.PLUGIN="plugin",Mc.ANIMATION="animation",Mc.TRANSFORM="transform",Mc.SHAPE="shape";const Sc={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function Nc(t,e){var n;const r=null===(n=Sc[t])||void 0===n?void 0:n[e];if(r)return r}const Oc="5.0.33";function Tc(t){return`[G6 v${Oc}] ${t}`}const Cc=t=>{console.warn(Tc(t))};function Ac(e){const{theme:n}=e;if(!n)return{};const r=Nc(t.ExtensionCategory.THEME,n);return r||(Cc(`The theme of ${n} is not registered.`),{})}function Pc(t,e){if(Array.isArray(t)&&0===t.length)return null;const n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t.slice(1):e||[];return new Proxy(n,{get:(t,e)=>"function"!=typeof t[e]||["onframe","onfinish"].includes(e)?"finished"===e?Promise.all([n.finished,...r.map((t=>t.finished))]):Reflect.get(t,e):(...n)=>{t[e](...n),r.forEach((t=>{var r;return null===(r=t[e])||void 0===r?void 0:r.call(t,...n)}))},set:(t,e,n)=>(["onframe","onfinish"].includes(e)||r.forEach((t=>{t[e]=n})),Reflect.set(t,e,n))})}function Rc(t){const e=t.reduce(((t,e)=>(Object.entries(e).forEach((([e,n])=>{void 0===t[e]?t[e]=[n]:t[e].push(n)})),t)),{});Object.entries(e).forEach((([n,r])=>{(r.length!==t.length||r.some((t=>Yt(t)))||r.every((t=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Ne(t,r[0]))))&&delete e[n]}));const n=Object.entries(e).reduce(((t,[e,n])=>(n.forEach(((n,r)=>{t[r]?t[r][e]=n:t[r]={[e]:n}})),t)),[]);return 0!==t.length&&0===n.length&&n.push({_:0},{_:0}),n}function Dc(t){switch(t){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function Lc(t,e){const{animation:n}=t;if(!1===n||!1===e)return!1;const r=Object.assign({},hc);return qt(n)&&Object.assign(r,n),qt(e)&&Object.assign(r,e),r}function _c(e,n,r,i){var o,a;const{animation:s}=e,l=null===(o=null==e?void 0:e[n])||void 0===o?void 0:o.animation;if(!1===l)return[];const u=null==l?void 0:l[r];if(!1===u)return[];if(!1===s||!1===i)return[];const c=null===(a=Ac(e)[n])||void 0===a?void 0:a.animation,h=(e=[])=>function(e){if("string"==typeof e){return Nc(t.ExtensionCategory.ANIMATION,e)||(Cc(`The animation of ${e} is not registered.`),[])}return e}(e).map((t=>Object.assign(Object.assign(Object.assign(Object.assign({},dc),qt(s)&&s),t),qt(i)&&i)));if(u)return h(u);if(!c)return[];const d=c[r];return!1===d?[]:h(d)}function Ic(t,e,n,r){if(Array.isArray(r)){let i=!1;const o=[];for(let a=0;a<r.length;a++){const s=r[a];if("translate"===s[0]){if(s[1]===t&&s[2]===e)return null;i=!0,o.push(["translate",t,e])}else if("translate3d"===s[0]){if(s[1]===t&&s[2]===e&&s[3]===n)return null;i=!0,o.push(["translate3d",t,e,n])}else o.push(s)}return i||o.splice(0,0,0===n?["translate",t,e]:["translate3d",t,e,n]),o}const i=r?r.replace(/translate(3d)?\([^)]*\)/g,""):"";return 0===n?`translate(${t}, ${e})${i}`:`translate3d(${t}, ${e}, ${n})${i}`}const jc=(t,e,n)=>{if(!n.length)return null;const[r,i]=e;let o;const a=n.map((e=>{var{fields:n,shape:a,states:s}=e,l=Fe(e,["fields","shape","states"]);const u=(e=>{var n;if(e){const o=t.getShape(e);if(!o)return null;const a=`get${de(e)}Style`,s=(null===(n=null==t?void 0:t[a])||void 0===n?void 0:n.bind(t))||(t=>t);return{shape:o,fromStyle:(null==s?void 0:s(r))||{},toStyle:(null==s?void 0:s(i))||{}}}return{shape:t,fromStyle:r,toStyle:i}})(a);if(!u)return null;const{shape:c,fromStyle:h,toStyle:d}=u,f=[{},{}];if(n.forEach((t=>{var e,n;Object.assign(f[0],{[t]:null!==(e=h[t])&&void 0!==e?e:Dc(t)}),Object.assign(f[1],{[t]:null!==(n=d[t])&&void 0!==n?n:Dc(t)})})),f.some((t=>Object.keys(t).some((t=>["x","y","z"].includes(t)))))){const{x:t=0,y:e=0,z:n=0,transform:r=""}=c.attributes||{};f.forEach((i=>{i.transform=Ic(i.x||t,i.y||e,i.z||n,r)}))}const p=c.animate(Rc(f),l);return void 0===a&&(o=p),p})).filter(Boolean),s=o||(null==a?void 0:a[0]);return s?Pc(s,a.filter((t=>t!=t))):null},Bc=[{fields:["x","y"]}],Fc=Bc,zc=[{fields:["sourceNode","targetNode"]}],Gc=zc,Vc=[{fields:["childrenNode","x","y"]}],Wc=Vc;function Hc(t){return t instanceof Float32Array||!(!Array.isArray(t)||2!==t.length&&3!==t.length)&&t.every((t=>"number"==typeof t))}function Uc(t,e,n){return t>=e&&t<=n}function Yc(t=0){if(Array.isArray(t)){const[e=0,n=e,r=e,i=n]=t;return[e,n,r,i]}return[t,t,t,t]}function $c(t=0){const e=Yc(t);return e[0]+e[2]}function qc(t){return t.max[0]-t.min[0]}function Xc(t){return t.max[1]-t.min[1]}function Kc(t){return[qc(t),Xc(t)]}function Zc(t,e){const n=Hc(t)?Qc(t):t.getShape("key").getBounds();return e?Jc(n,e):n}function Qc(t){const[e,n,r=0]=t,i=new Yr;return i.setMinMax([e,n,r],[e,n,r]),i}function Jc(t,e){const[n,r,i,o]=Yc(e),[a,s,l]=t.min,[u,c,h]=t.max,d=new Yr;return d.setMinMax([a-o,s-n,l],[u+r,c+i,h]),d}function th(t){if(0===t.length)return new Yr;if(1===t.length)return t[0];const e=new Yr;e.setMinMax(t[0].min,t[0].max);for(let n=1;n<t.length;n++){const r=t[n];e.setMinMax([Math.min(e.min[0],r.min[0]),Math.min(e.min[1],r.min[1]),Math.min(e.min[2],r.min[2])],[Math.max(e.max[0],r.max[0]),Math.max(e.max[1],r.max[1]),Math.max(e.max[2],r.max[2])])}return e}function eh(t,e){return Uc(t[0],e.min[0],e.max[0])&&Uc(t[1],e.min[1],e.max[1])}function nh(t,e,n=!1){const{min:[r,i],max:[o,a]}=e,s=(t[1]===i||t[1]===a)&&(n||Uc(t[0],r,o)),l=(t[0]===r||t[0]===o)&&(n||Uc(t[1],i,a));return s||l}function rh(t,e){const{center:n}=e;return t[0]===n[0]&&t[1]===n[1]}function ih(t,e){const[n,r]=t,[i,o]=e.min,[a,s]=e.max,l=n-i,u=a-n,c=r-o,h=s-r,d=Math.min(l,u,c,h);return d===l?"left":d===u?"right":d===c?"top":d===h?"bottom":"left"}function oh(t,e){const n=me(t);if(eh(t,e)){switch(ih(t,e)){case"left":n[0]=e.min[0];break;case"right":n[0]=e.max[0];break;case"top":n[1]=e.min[1];break;case"bottom":n[1]=e.max[1]}}else{const[r,i]=t,[o,a]=e.min,[s,l]=e.max;n[0]=Uc(r,o,s)?r:r<o?o:s,n[1]=Uc(i,a,l)?i:i<a?a:l}return n}var ah=function(t,e){return t===e},sh=function(){function t(t,e){void 0===e&&(e=null),this.value=t,this.next=e}return t.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},t}(),lh=function(){function t(t){void 0===t&&(t=ah),this.head=null,this.tail=null,this.compare=t}return t.prototype.prepend=function(t){var e=new sh(t,this.head);return this.head=e,this.tail||(this.tail=e),this},t.prototype.append=function(t){var e=new sh(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},t.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(null!==n)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},t.prototype.find=function(t){var e=t.value,n=void 0===e?void 0:e,r=t.callback,i=void 0===r?void 0:r;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value))return o;if(void 0!==n&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},t.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},t.prototype.fromArray=function(t){var e=this;return t.forEach((function(t){return e.append(t)})),this},t.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},t.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},t.prototype.toString=function(t){return void 0===t&&(t=void 0),this.toArray().map((function(e){return e.toString(t)})).toString()},t}(),uh=function(t,e,n){void 0===e&&(e=[]);var r=e.filter((function(e){return e.source===t||e.target===t}));if("target"===n){return r.filter((function(e){return e.source===t})).map((function(t){return t.target}))}if("source"===n){return r.filter((function(e){return e.target===t})).map((function(t){return t.source}))}return r.map((function(e){return e.source===t?e.target:e.source}))},ch={}.toString,hh=function(t,e){return ch.call(t)==="[object "+e+"]"},dh=function(t){return hh(t,"Function")},fh=function(t){return Array.isArray?Array.isArray(t):hh(t,"Array")};var ph,gh=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return function(t,e){var n,r;if(t)if(fh(t))for(var i=0,o=t.length;i<o&&!1!==e(t[i],i);i++);else if(r=typeof(n=t),null!==n&&"object"===r||"function"===r)for(var a in t)if(t.hasOwnProperty(a)&&!1===e(t[a],a))break}(t,(function(n,r){dh(t)&&"prototype"===r||e.push(n)})),e};!function(t,e){if(!dh(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var s=t.apply(this,r);return a.set(o,s),s};n.cache=new Map}((function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return ph||(ph=document.createElement("canvas").getContext("2d")),ph.font=[o,a,i,n+"px",r].join(" "),ph.measureText(function(t){return hh(t,"String")}(t)?t:"").width}),(function(t,e){return void 0===e&&(e={}),function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}([t],gh(e)).join("")}));function vh(t,e,n,r){if(t===e)return[t];if(r[e])return r[e];for(var i=[],o=0,a=n[e];o<a.length;o++){var s=vh(t,a[o],n,r);if(!s)return;for(var l=0,u=s;l<u.length;l++){var c=u[l];fh(c)?i.push(We(We([],c,!0),[e],!1)):i.push([c,e])}}return r[e]=i,r[e]}var mh,yh=function(t,e,n,r,i){var o=function(t,e,n,r){var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,l={},u={},c={};o.forEach((function(t,n){var r=t.id;u[r]=1/0,r===e&&(u[r]=0)}));for(var h=o.length,d=function(t){var e=function(t,e,n){for(var r,i=1/0,o=0;o<e.length;o++){var a=e[o].id;!n[a]&&t[a]<=i&&(i=t[a],r=e[o])}return r}(u,o,l),i=e.id;if(l[i]=!0,u[i]===1/0)return"continue";var a=[];a=n?function(t,e){return e.filter((function(e){return e.source===t}))}(i,s):function(t,e){return e.filter((function(e){return e.source===t||e.target===t}))}(i,s),a.forEach((function(t){var n=t.target,o=t.source,a=n===i?o:n,s=r&&t[r]?t[r]:1;u[a]>u[e.id]+s?(u[a]=u[e.id]+s,c[a]=[e.id]):u[a]===u[e.id]+s&&c[a].push(e.id)}))},f=0;f<h;f++)d();c[e]=[e];var p={};for(var g in u)u[g]!==1/0&&vh(e,g,c,p);var v={};for(var g in p)v[g]=p[g][0];return{length:u,path:v,allPath:p}}(t,e,r,i),a=o.length,s=o.path,l=o.allPath;return{length:a[n],path:s[n],allPath:l[n]}};!function(t){t.EuclideanDistance="euclideanDistance"}(mh||(mh={}));function bh(t){if(void 0!==t.id)return t.id;if(void 0!==t.source&&void 0!==t.target)return`${t.source}-${t.target}`;throw new Error(Tc("The datum does not have available id."))}function xh(t){return t.combo}function Eh(t,e){const n={nodes:(t.nodes||[]).map(bh),edges:(t.edges||[]).map(bh),combos:(t.combos||[]).map(bh)};return e?Object.values(n).flat():n}!function(){function t(t){void 0===t&&(t=10),this.linkedList=new lh,this.maxStep=t}Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map((function(t){return t.value}))},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()}}();const wh=(t,e,n)=>{var r;switch(n.type){case"degree":{const i=new Map;return null===(r=t.nodes)||void 0===r||r.forEach((t=>{const r=e(bh(t),n.direction).length;i.set(bh(t),r)})),i}case"betweenness":return Mh(t,n.directed,n.weightPropertyName);case"closeness":return Sh(t,n.directed,n.weightPropertyName);case"eigenvector":return Oh(t,n.directed);case"pagerank":return Nh(t,n.epsilon,n.linkProb);default:return kh(t)}},kh=t=>{var e;const n=new Map;return null===(e=t.nodes)||void 0===e||e.forEach((t=>{n.set(bh(t),0)})),n},Mh=(t,e,n)=>{const r=kh(t),{nodes:i=[]}=t;return i.forEach((o=>{i.forEach((i=>{if(o!==i){const{allPath:a}=yh(t,bh(o),bh(i),e,n),s=a.length;a.flat().forEach((t=>{t!==bh(o)&&t!==bh(i)&&r.set(t,r.get(t)+1/s)}))}}))})),r},Sh=(t,e,n)=>{const r=new Map,{nodes:i=[]}=t;return i.forEach((o=>{const a=i.reduce(((r,i)=>{if(o!==i){const{length:a}=yh(t,bh(o),bh(i),e,n);r+=a}return r}),0);r.set(bh(o),1/a)})),r},Nh=(t,e,n)=>{var r;const i=new Map,o=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,i=1,o=0,a=1e3,s=t.nodes,l=void 0===s?[]:s,u=t.edges,c=void 0===u?[]:u,h=l.length,d={},f={},p=0;p<h;++p)d[v=(E=l[p]).id]=1/h,f[v]=1/h;for(var g=function(t){var e={},n=t.nodes,r=void 0===n?[]:n,i=t.edges,o=void 0===i?[]:i;return r.forEach((function(t){e[t.id]={degree:0,inDegree:0,outDegree:0}})),o.forEach((function(t){e[t.source].degree++,e[t.source].outDegree++,e[t.target].degree++,e[t.target].inDegree++})),e}(t);a>0&&i>e;){for(o=0,p=0;p<h;++p){var v=(E=l[p]).id;if(r=0,0===g[E.id].inDegree)d[v]=0;else{for(var m=uh(v,c,"source"),y=0;y<m.length;++y){var b=m[y],x=g[b].outDegree;x>0&&(r+=f[b]/x)}d[v]=n*r,o+=d[v]}}for(o=(1-o)/h,i=0,p=0;p<h;++p){var E;r=d[v=(E=l[p]).id]+o,i+=Math.abs(r-f[v]),f[v]=r}a-=1}return f}(t,e,n);return null===(r=t.nodes)||void 0===r||r.forEach((t=>{i.set(bh(t),o[bh(t)])})),i},Oh=(t,e)=>{const{nodes:n=[]}=t,r=Th(t,e),i=Ch(r,n.length),o=new Map;return n.forEach(((t,e)=>{o.set(bh(t),i[e])})),o},Th=(t,e)=>{const{nodes:n=[],edges:r=[]}=t,i=Array(n.length).fill(null).map((()=>Array(n.length).fill(0)));return r.forEach((({source:t,target:r})=>{const o=n.findIndex((e=>bh(e)===t)),a=n.findIndex((t=>bh(t)===r));e?i[o][a]=1:(i[o][a]=1,i[a][o]=1)})),i},Ch=(t,e,n=100,r=1e-6)=>{let i=Array(e).fill(1),o=1/0;for(let a=0;a<n&&o>r;a++){const n=Array(e).fill(0);for(let r=0;r<e;r++)for(let o=0;o<e;o++)n[r]+=t[r][o]*i[o];const r=Math.sqrt(n.reduce(((t,e)=>t+e*e),0));for(let t=0;t<e;t++)n[t]/=r;o=Math.sqrt(n.reduce(((t,e,n)=>t+(e-i[n])*e),0)),i=n}return i};function Ah(t,e,n,r=Ne){const i=new Map(t.map((t=>[n(t),t]))),o=new Map(e.map((t=>[n(t),t]))),a=new Set(i.keys()),s=new Set(o.keys()),l=[],u=[],c=[],h=[];return s.forEach((t=>{a.has(t)?r(i.get(t),o.get(t))?h.push(o.get(t)):u.push(o.get(t)):l.push(o.get(t))})),a.forEach((t=>{s.has(t)||c.push(i.get(t))})),{enter:l,exit:c,keep:h,update:u}}function Ph(t,e,n){t.forEach((t=>{(t=>{n&&!n(t)||(t.style.visibility=e)})(t)}))}class Rh{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=function(t,e,n){const r={},i=t=>(t in r||(r[t]=0),`${e}-${t}-${r[t]++}`);return n.map((e=>"string"==typeof e?{type:e,key:i(e)}:"function"==typeof e?e.call(t):e.key?e:Object.assign(Object.assign({},e),{key:i(e.type)})))}(this.context.graph,this.category,t),{enter:n,update:r,exit:i,keep:o}=Ah(this.extensions,e,(t=>t.key));this.createExtensions(n),this.updateExtensions([...r,...o]),this.destroyExtensions(i),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:r}=t,i=Nc(e,r);if(!i)return Cc(`The extension ${r} of ${e} is not registered.`);const o=new i(this.context,t);this.extensionMap[n]=o}createExtensions(t){t.forEach((t=>this.createExtension(t)))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach((t=>this.updateExtension(t)))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach((({key:t})=>this.destroyExtension(t)))}destroy(){Object.values(this.extensionMap).forEach((t=>t.destroy())),this.context={},this.extensions=[],this.extensionMap={}}}class Dh{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 Lh extends Dh{}class _h extends Lh{constructor(t,e){super(t,Object.assign({},_h.defaultOptions,e)),this.isOverlapping=(t,e)=>e.some((e=>t.intersects(e))),this.occupiedBounds=[],this.detectLabelCollision=t=>{const e=this.context.viewport,n={show:[],hide:[]};return this.occupiedBounds=[],t.forEach((t=>{const r=t.getShape("label").getRenderBounds();e.isInViewport(r,!0)&&!this.isOverlapping(r,this.occupiedBounds)?(n.show.push(t),this.occupiedBounds.push(Jc(r,this.options.padding))):n.hide.push(t)})),n},this.hideLabelIfExceedViewport=(t,e)=>{const{exit:n}=Ah(t,e,(t=>t.id));null==n||n.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(t,e)=>{const{model:n}=this.context,r=n.getData(),i=n.getRelatedEdgesData.bind(n);return t.map((t=>(this.nodeCentralities.has(t.id)||(this.nodeCentralities=wh(r,i,e)),{node:t,centrality:this.nodeCentralities.get(t.id)}))).sort(((t,e)=>e.centrality-t.centrality)).map((t=>t.node))},this.sortLabelElementsInView=t=>{const{sort:e,sortNode:n,sortCombo:r,sortEdge:i}=this.options,{model:o}=this.context;if(Ut(e))return t.sort(((t,n)=>e(o.getElementDataById(t.id),o.getElementDataById(n.id))));const{node:a=[],edge:s=[],combo:l=[]}=ie(t,(t=>t.type)),u=Ut(r)?l.sort(((t,e)=>r(...o.getComboData([t.id,e.id])))):l,c=Ut(n)?a.sort(((t,e)=>n(...o.getNodeData([t.id,e.id])))):this.sortNodesByCentrality(a,n),h=Ut(i)?s.sort(((t,e)=>i(...o.getEdgeData([t.id,e.id])))):s;return[...u,...c,...h]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=t=>{var e;if("zIndex"===(null===(e=t.data)||void 0===e?void 0:e.stage))return;if(!this.validate(t))return void(this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear()));const n=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,n),this.labelElementsInView=n;const r=this.sortLabelElementsInView(this.labelElementsInView),{show:i,hide:o}=this.detectLabelCollision(r);for(let t=i.length-1;t>=0;t--)this.showLabel(i[t]);o.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=t=>{const e=t.getShape("label");e&&Ph(e,"hidden"),this.hiddenElements.set(t.id,t)},this.showLabel=t=>{const e=t.getShape("label");e&&Ph(e,"visible"),t.toFront(),this.hiddenElements.delete(t.id)},this.onTransform=Re(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=t=>{this.enableToggle&&this.onToggleVisibility(t)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=t=>{this.onToggleVisibility(t),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const r=t[n];r.isVisible()&&r.getShape("label")&&e.push(r)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter((e=>t.isInViewport(e.getShape("key").getRenderBounds())))}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.on(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.on(t.GraphEvent.AFTER_DRAW,this.toggle),e.on(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.off(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.off(t.GraphEvent.AFTER_DRAW,this.toggle),e.off(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}_h.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const Ih=[0,0,0];function jh(t,e){return t.map(((t,n)=>t+e[n]))}function Bh(t,e){return t.map(((t,n)=>t-e[n]))}function Fh(t,e){return"number"==typeof e?t.map((t=>t*e)):t.map(((t,n)=>t*e[n]))}function zh(t,e){return"number"==typeof e?t.map((t=>t/e)):t.map(((t,n)=>t/e[n]))}function Gh(t,e){return t.map((t=>t*e))}function Vh(t,e){return Math.sqrt(t.reduce(((t,n,r)=>t+Math.pow(n-e[r]||0,2)),0))}function Wh(t,e){return t.reduce(((t,n,r)=>t+Math.abs(n-e[r])),0)}function Hh(t){const e=t.reduce(((t,e)=>t+Math.pow(e,2)),0);return t.map((t=>t/Math.sqrt(e)))}function Uh(t,e,n=!1){const r=t[0]*e[1]-t[1]*e[0];let i=Math.acos(Fh(t,e).reduce(((t,e)=>t+e),0)/(Vh(t,Ih)*Vh(e,Ih)));return n&&r<0&&(i=2*Math.PI-i),i}function Yh(t,e=!0){return e?[-t[1],t[0]]:[t[1],-t[0]]}function $h(t){return[t[0],t[1]]}function qh(t){return 2===t.length?[t[0],t[1],0]:t}function Xh(t){const[e,n]=t;return e||n?Math.atan2(n,e):0}function Kh(t,e){const[n,r]=t,[i,o]=e;return function(t,e){const n=qh(t),r=qh(e);return[n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]}(Bh(n,r),Bh(i,o)).every((t=>0===t))}function Zh(t,e,n=!1){if(Kh(t,e))return;const[r,i]=t,[o,a]=e,s=((r[0]-o[0])*(o[1]-a[1])-(r[1]-o[1])*(o[0]-a[0]))/((r[0]-i[0])*(o[1]-a[1])-(r[1]-i[1])*(o[0]-a[0])),l=a[0]-o[0]?(r[0]-o[0]+s*(i[0]-r[0]))/(a[0]-o[0]):(r[1]-o[1]+s*(i[1]-r[1]))/(a[1]-o[1]);return n||Uc(s,0,1)&&Uc(l,0,1)?[r[0]+s*(i[0]-r[0]),r[1]+s*(i[1]-r[1])]:void 0}function Qh(t){if(Array.isArray(t))return Uc(t[0],0,1)&&Uc(t[1],0,1)?t:[.5,.5];const e=t.split("-");return[e.includes("left")?0:e.includes("right")?1:.5,e.includes("top")?0:e.includes("bottom")?1:.5]}function Jh(t){const{x:e=0,y:n=0,z:r=0}=t.style||{};return[+e,+n,+r]}function td(t){const{x:e,y:n,z:r}=t.style||{};return void 0!==e||void 0!==n||void 0!==r}function ed(t,e="center"){return function(t,e){const[n,r]=e,{min:i,max:o}=t;return[i[0]+n*(o[0]-i[0]),i[1]+r*(o[1]-i[1])]}(t,Qh(e))}function nd(t){var e;return[t.x,t.y,null!==(e=t.z)&&void 0!==e?e:0]}function rd(t){var e;return{x:t[0],y:t[1],z:null!==(e=t[2])&&void 0!==e?e:0}}function id(t,e=0){return t.map((t=>parseFloat(t.toFixed(e))))}function od(t,e,n,r=!1){if(Ne(t,e))return t;const i=Hh(r?Bh(t,e):Bh(e,t)),o=[i[0]*n,i[1]*n];return jh($h(t),o)}function ad(t,e){return t[1]===e[1]}function sd(t,e,n){return Kh([t,e],[e,n])}function ld(t,e){return[2*e[0]-t[0],2*e[1]-t[1]]}function ud(t,e,n,r=!0,i=!1){for(let o=0;o<n.length;o++){let a=n[o],s=n[(o+1)%n.length];r&&(a=jh(e,a),s=jh(e,s));const l=Zh([e,i?ld(t,e):t],[a,s]);if(l)return{point:l,line:[a,s]}}return{point:e,line:void 0}}function cd(t,e,n=!1){const r=e.center,i=Bh(n?ld(t,r):t,e.center),o=Math.atan2(i[1],i[0]);if(isNaN(o))return r;const a=qc(e)/2,s=Xc(e)/2;return[r[0]+a*Math.cos(o),r[1]+s*Math.sin(o)]}function hd(t,e){let n=1/0,r=[[0,0],[0,0]];return e.forEach((e=>{const i=function(t,e){const n=dd(t,e);return Vh(t,n)}(t,e);i<n&&(n=i,r=e)})),r}function dd(t,e){const[n,r]=e[0],[i,o]=e[1],[a,s]=t,l=i-n,u=o-r;if(0===l&&0===u)return[n,r];let c=((a-n)*l+(s-r)*u)/(l*l+u*u);c>1?c=1:c<0&&(c=0);return[n+c*l,r+c*u]}function fd(t,e=!0){const n=function(t){return zh(t.reduce(((t,e)=>jh(t,e)),[0,0]),t.length)}(t);return t.sort((([t,r],[i,o])=>{const a=Math.atan2(r-n[1],t-n[0]),s=Math.atan2(o-n[1],i-n[0]);return e?s-a:a-s}))}function pd(t,e){return[t,[t[0],e[1]],e,[e[0],t[1]]]}const gd=t=>t.map((t=>ne(t)?t.toLocaleLowerCase():t));class vd{constructor(e){this.map=new Map,this.recordKey=new Set,this.onKeyDown=t=>{(null==t?void 0:t.key)&&(this.recordKey.add(t.key),this.trigger(t))},this.onKeyUp=t=>{(null==t?void 0:t.key)&&this.recordKey.delete(t.key)},this.onWheel=e=>{this.triggerExtendKey(t.CommonEvent.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(t.CommonEvent.DRAG,e)},this.onFocus=()=>{this.recordKey.clear()},this.emitter=e,this.bindEvents()}bind(t,e){0!==t.length&&this.map.set(t,e)}unbind(t,e){this.map.forEach(((n,r)=>{Ne(r,t)&&(e&&e!==n||this.map.delete(r))}))}unbindAll(){this.map.clear()}match(t){const e=gd(Array.from(this.recordKey)).sort(),n=gd(t).sort();return Ne(e,n)}bindEvents(){var e;const{emitter:n}=this;n.on(t.CommonEvent.KEY_DOWN,this.onKeyDown),n.on(t.CommonEvent.KEY_UP,this.onKeyUp),n.on(t.CommonEvent.WHEEL,this.onWheel),n.on(t.CommonEvent.DRAG,this.onDrag),null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach(((e,n)=>{this.match(n)&&e(t)}))}triggerExtendKey(t,e){this.map.forEach(((n,r)=>{r.includes(t)&&Ne(Array.from(this.recordKey),r.filter((e=>e!==t)))&&n(e)}))}destroy(){var e;this.unbindAll(),this.emitter.off(t.CommonEvent.KEY_DOWN,this.onKeyDown),this.emitter.off(t.CommonEvent.KEY_UP,this.onKeyUp),this.emitter.off(t.CommonEvent.WHEEL,this.onWheel),this.emitter.off(t.CommonEvent.DRAG,this.onDrag),null===(e=globalThis.removeEventListener)||void 0===e||e.call(globalThis,"blur",this.onFocus)}}class md extends Lh{constructor(t,e){super(t,ke({},md.defaultOptions,e)),this.shortcut=new vd(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,r=Object.assign({},this.options.style);this.options.style.lineWidth&&(r.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new Kl({id:"g6-brush-select",style:r}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:r}=this.options;this.endPoint=yd(t),null===(e=this.rectShape)||void 0===e||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&"default"===r&&this.updateElementsStates(pd(this.startPoint,this.endPoint))}onPointerUp(t){this.startPoint&&(this.endPoint?(this.endPoint=yd(t),this.updateElementsStates(pd(this.startPoint,this.endPoint)),this.clearBrush()):this.clearBrush())}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce(((t,e)=>Object.assign({},t,e.reduce(((t,e)=>(t[bh(e)]=[],t)),{}))),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:r,mode:i,onSelect:o}=this.options,a=this.selector(e,t,n);let s={};switch(i){case"union":a.forEach((t=>{s[t]=[...e.getElementState(t),r]}));break;case"diff":a.forEach((t=>{const n=e.getElementState(t);s[t]=n.includes(r)?n.filter((t=>t!==r)):[...n,r]}));break;case"intersect":a.forEach((t=>{const n=e.getElementState(t);s[t]=n.includes(r)?[r]:[]}));break;default:a.forEach((t=>{s[t]=[r]}))}Ut(o)&&(s=o(s)),e.setElementState(s,this.options.animation)}selector(t,e,n){if(!n||0===n.length)return[];const r=[],i=t.getData();if(n.forEach((n=>{i[`${n}s`].forEach((n=>{const i=bh(n);"hidden"!==t.getElementVisibility(i)&&function(t,e,n,r){const i=t[0],o=t[1];let a=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);const s=r-n;for(let t=0,r=s-1;t<s;r=t++){const s=e[t+n][0],l=e[t+n][1],u=e[r+n][0],c=e[r+n][1];l>o!=c>o&&i<(u-s)*(o-l)/(c-l)+s&&(a=!a)}return a}(t.getElementPosition(i),e)&&r.push(i)}))})),n.includes("edge")){const t=i.edges;null==t||t.forEach((t=>{const{source:e,target:n}=t;r.includes(e)&&r.includes(n)&&r.push(bh(t))}))}return r}clearBrush(){var t;null===(t=this.rectShape)||void 0===t||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter((t=>"drag"!==t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}bindEvents(){const{graph:e}=this.context;e.on(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.on(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.on(t.CommonEvent.POINTER_UP,this.onPointerUp),e.on(t.CanvasEvent.CLICK,this.clearStates)}unbindEvents(){const{graph:e}=this.context;e.off(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.off(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.off(t.CommonEvent.POINTER_UP,this.onPointerUp),e.off(t.CanvasEvent.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=ke(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}md.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 yd=t=>[t.canvas.x,t.canvas.y],bd=.8,xd=["node","edge","combo"];function Ed(t,e,n,r,i=0){"TB"===r&&e(t,i);const o=n(t);if(o)for(const t of o)Ed(t,e,n,r,i+1);"BT"===r&&e(t,i)}function wd(t,e,n,r,i="both"){if("combo"===e||"node"===e)return kd(t,n,r,i);const o=t.getEdgeData(n);if(!o)return[];const a=kd(t,o.source,r-1,i),s=kd(t,o.target,r-1,i);return Array.from(new Set([...a,...s,n]))}function kd(t,e,n,r="both"){const i=new Set,o=new Set,a=new Set;return function(t,e,n){const r=[[t,0]];for(;r.length;){const[t,i]=r.shift();e(t,i);const o=n(t);if(o)for(const t of o)r.push([t,i+1])}}(e,((e,i)=>{i>n||(a.add(e),t.getRelatedEdgesData(e,r).forEach((t=>{const e=bh(t);!o.has(e)&&i<n&&(a.add(e),o.add(e))})))}),(e=>t.getRelatedEdgesData(e,r).map((t=>t.source===e?t.target:t.source)).filter((t=>!i.has(t)&&(i.add(t),!0))))),Array.from(a)}function Md(t){return t.states||[]}class Sd extends Lh{constructor(t,e){super(t,Object.assign({},Sd.defaultOptions,e)),this.onClickSelect=t=>ze(this,void 0,void 0,(function*(){var e,n;this.validate(t)&&(yield this.updateState(t),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))})),this.onClickCanvas=t=>ze(this,void 0,void 0,(function*(){var e,n;this.validate(t)&&(yield this.clearState(),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))})),this.shortcut=new vd(t.graph),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),xd.forEach((n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)})),e.on(t.CanvasEvent.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:r}=this.context,{degree:i}=this.options;return wd(r,n,e.id,"function"==typeof i?i(t):i).filter((t=>t!==e.id))}updateState(t){return ze(this,void 0,void 0,(function*(){const{state:e,unselectedState:n,neighborState:r,animation:i}=this.options;if(!e&&!r&&!n)return;const{target:o}=t,{graph:a}=this.context,s=Md(a.getElementData(o.id)).includes(e)?"unselect":"select",l={},u=this.isMultipleSelect,c=[o.id],h=this.getNeighborIds(t);if(u)if(Object.assign(l,this.getDataStates()),"select"===s){const t=(t,e)=>{t.forEach((t=>{const r=new Set(a.getElementState(t));r.add(e),r.delete(n),l[t]=Array.from(r)}))};t(c,e),t(h,r),n&&Object.keys(l).forEach((t=>{const i=l[t];i.includes(e)||i.includes(r)||i.includes(n)||l[t].push(n)}))}else{const t=l[o.id];l[o.id]=t.filter((t=>t!==e&&t!==r)),t.includes(n)||l[o.id].push(n),h.forEach((t=>{l[t]=l[t].filter((t=>t!==r)),l[t].includes(e)||l[t].push(n)}))}else if("select"===s){Object.assign(l,this.getClearStates(!!n));const t=(t,e)=>{t.forEach((t=>{l[t]||(l[t]=a.getElementState(t)),l[t].push(e)}))};t(c,e),t(h,r),n&&Object.keys(l).forEach((t=>{c.includes(t)||h.includes(t)||l[t].push(n)}))}else Object.assign(l,this.getClearStates());yield a.setElementState(l,i)}))}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:r}=t.getData(),i={};return[...e,...n,...r].forEach((t=>{i[bh(t)]=Md(t)})),i}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:r,neighborState:i}=this.options,o=new Set([n,r,i]),{nodes:a,edges:s,combos:l}=e.getData(),u={};return[...a,...s,...l].forEach((e=>{const n=Md(e),r=n.filter((t=>!o.has(t)));(t||r.length!==n.length)&&(u[bh(e)]=r)})),u}clearState(){return ze(this,void 0,void 0,(function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)}))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;xd.forEach((n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)})),e.off(t.CanvasEvent.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}function Nd(t){var e;return!!(null===(e=t.style)||void 0===e?void 0:e.collapsed)}function Od(t,e){if(!t.startsWith(e))return!1;const n=t[e.length];return n>="A"&&n<="Z"}function Td(t,e,n=!0){if(!e)return t;if(!Od(t,e))return t;const r=t.slice(e.length);return n?function(t){var e=he(t);return e.charAt(0).toLowerCase()+e.substring(1)}(r):r}function Cd(t,e){const n=Object.entries(t).reduce(((t,[n,r])=>("className"===n||"class"===n||Od(n,e)&&Object.assign(t,{[Td(n,e)]:r}),t)),{});if("opacity"in t){const r=function(t,e){return`${e}${de(t)}`}("opacity",e),i=t.opacity;if(r in t){const e=t[r];Object.assign(n,{opacity:i*e})}else Object.assign(n,{opacity:i})}return n}function Ad(t,e){const n=e.length;return Object.keys(t).reduce(((r,i)=>{if(i.startsWith(e)){r[i.slice(n)]=t[i]}return r}),{})}function Pd(t,e){const n="string"==typeof e?[e]:e,r={};return Object.keys(t).forEach((e=>{n.find((t=>e.startsWith(t)))||(r[e]=t[e])})),r}function Rd(t=0){if("number"==typeof t)return[t,t,t];const[e,n=e,r=e]=t;return[e,n,r]}function Dd(t,e){const{datum:n,graph:r}=e;return"function"==typeof t?t.call(r,n):Object.fromEntries(Object.entries(t).map((([t,e])=>"function"==typeof e?[t,e.call(r,n)]:[t,e])))}function Ld(t,e){const n=(null==t?void 0:t.style)||{},r=(null==e?void 0:e.style)||{};return Object.assign({},t,e,{style:(null==t?void 0:t.style)?Object.assign({},n,r):r})}Sd.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};const _d=new WeakMap;function Id(t,e,n){_d.has(t)||_d.set(t,{});const r=_d.get(t);if(!r[e])return r[e]=n,!0;const i=r[e];return!jd(i,n)&&(r[e]=n,!0)}const jd=(t,e,n=2)=>{if("object"!=typeof t||"object"!=typeof e)return t===e;const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const i of r){const r=t[i],o=e[i];if(n>1&&"object"==typeof r&&"object"==typeof o){if(!jd(r,o,n-1))return!1}else if(r!==o)return!1}return!0};function Bd(t){if(t)return"string"==typeof t||"function"==typeof t||Array.isArray(t)?{type:"group",field:t=>t.id,color:t,invert:!1}:t}function Fd(t){const e="string"==typeof t?Nc("palette",t):t;if("function"!=typeof e)return e}function zd(t,e){let n=2*t;return"string"==typeof e?n=t*Number(e.replace("%",""))/100:"number"==typeof e&&(n=e),isNaN(n)&&(n=2*t),n}function Gd(t,e,n=1,r=!1){const i=r?n:1;return zd((t.max[0]-t.min[0])*i,e)}class Vd extends Il{constructor(t){super(t),this.shapeMap={},this.animateMap={},this.transformPosition(this.attributes),this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(e,n,r,i,o){var a,s,l,u,c,h,d,f;const p=this.shapeMap[e];if(!1===r)return void(p&&(null===(a=null==o?void 0:o.beforeDestroy)||void 0===a||a.call(o,p),i.removeChild(p),delete this.shapeMap[e],null===(s=null==o?void 0:o.afterDestroy)||void 0===s||s.call(o,p)));const g="string"==typeof n?Nc(t.ExtensionCategory.SHAPE,n):n;if(!g)throw new Error(Tc(`Shape ${n} not found`));if(!p||p.destroyed||!(p instanceof g)){p&&(null===(l=null==o?void 0:o.beforeDestroy)||void 0===l||l.call(o,p),null==p||p.destroy(),null===(u=null==o?void 0:o.afterDestroy)||void 0===u||u.call(o,p)),null===(c=null==o?void 0:o.beforeCreate)||void 0===c||c.call(o);const t=new g({className:e,style:r});return i.appendChild(t),this.shapeMap[e]=t,null===(h=null==o?void 0:o.afterCreate)||void 0===h||h.call(o,t),t}return null===(d=null==o?void 0:o.beforeUpdate)||void 0===d||d.call(o,p),Ig(p,r),null===(f=null==o?void 0:o.afterUpdate)||void 0===f||f.call(o,p),p}transformPosition(t){if("x"in t||"y"in t||"z"in t){const{x:e=0,y:n=0,z:r=0,transform:i}=t,o=Ic(+e,+n,+r,i);o&&(this.style.transform=o)}}update(t={}){const e=Object.assign({},this.attributes,t);this.attr(e),this.render(e,this),this.transformPosition(e),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return function(t){return Fe(t,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(0===t.length)return null;const n=[];if(void 0!==t[0].x||void 0!==t[0].y||void 0!==t[0].z){const{x:e=0,y:n=0,z:r=0}=this.attributes;t.forEach((t=>{const{x:i=e,y:o=n,z:a=r}=t;Object.assign(t,{transform:a?[["translate3d",i,o,a]]:[["translate",i,o]]})}))}const r=super.animate(t,e);if(r&&(Wd(this,r),n.push(r)),Array.isArray(t)&&t.length>0){const r=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some((t=>!r.includes(t)))){Object.entries(this.shapeMap).forEach((([r,i])=>{const o=this[`get${de(r)}Style`];if(Ut(o)){const r=t.map((t=>o.call(this,Object.assign(Object.assign({},this.attributes),t)))),a=i.animate(Rc(r),e);a&&(Wd(i,a),n.push(a))}}));const r=(r,i)=>{if(!Se(r)){const o=this[`get${de(i)}Style`];if(Ut(o)){const i=t.map((t=>o.call(this,Object.assign(Object.assign({},this.attributes),t))));Object.entries(i[0]).map((([t])=>{const o=i.map((e=>e[t])),a=r[t];if(a){const t=a.animate(Rc(o),e);t&&(Wd(a,t),n.push(t))}}))}}};this.compositeShapes.forEach((([t,e])=>{const n=Ad(this.shapeMap,e);r(n,t)}))}}return Pc(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Ph(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function Wd(t,e){null==e||e.finished.then((()=>{const n=t.activeAnimations.findIndex((t=>t===e));n>-1&&t.activeAnimations.splice(n,1)}))}class Hd extends Vd{constructor(t){super(Ld({style:Hd.defaultStyleProps},t))}isTextStyle(t){return Od(t,"label")}isBackgroundStyle(t){return Od(t,"background")}getTextStyle(t){return Pd(Fe(this.getGraphicStyle(t),["padding"]),"background")}getBackgroundStyle(t){if(!1===t.background)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:r,padding:i}=e,o=Cd(e,"background"),{min:[a,s],center:[l,u],halfExtents:[c,h]}=this.shapeMap.text.getGeometryBounds(),[d,f,p,g]=Yc(i),v=2*c+g+f,{width:m,height:y}=o;m&&y?Object.assign(o,{x:l-Number(m)/2,y:u-Number(y)/2}):Object.assign(o,{x:a-g,y:s-d,width:n?Math.min(v,r+g+f):v,height:2*h+d+p});const{radius:b}=o;if("string"==typeof b&&b.endsWith("%")){const t=Number(b.replace("%",""))/100;o.radius=Math.min(+o.width,+o.height)*t}return o}render(t=this.parsedAttributes,e=this){this.upsert("text",Ql,this.getTextStyle(t),e),this.upsert("background",Kl,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}Hd.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 Ud extends Vd{constructor(t){super(Ld({style:Ud.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",Hd,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}Ud.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};const Yd={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 $d(t){const e=[],n="string"==typeof t?function(t){const e=t.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),n=[];let r="",i={};for(;e.length>0;){let t=e.shift();t in Yd?r=t:e.unshift(t),i={type:r},Yd[r].forEach((n=>{t=e.shift(),i[n]=t})),"M"===r?r="L":"m"===r&&(r="l");const[o,...a]=Object.values(i);n.push([o,...a.map(Number)])}return n}(t):t;return n.forEach((t=>{const n=t[0];if("Z"!==n)if("A"!==n)for(let n=1;n<t.length;n+=2)e.push([t[n],t[n+1],0]);else{const n=t.length;e.push([t[n-2],t[n-1],0])}else e.push(e[0])})),e}const qd=t=>{if(t.length<2)return[["M",0,0],["L",0,0]];const e=t[0],n=t[1],r=t[t.length-1],i=t[t.length-2];t.unshift(i,r),t.push(e,n);const o=[["M",r[0],r[1]]];for(let e=1;e<t.length-2;e+=1){const[n,r]=t[e-1],[i,a]=t[e],[s,l]=t[e+1],[u,c]=e!==t.length-2?t[e+2]:[s,l],h=i+(s-n)/6,d=a+(l-r)/6,f=s-(u-i)/6,p=l-(c-a)/6;o.push(["C",h,d,f,p,s,l])}return o};class Xd extends Vd{constructor(t){super(Ld({style:Xd.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||0===t.d.length)return!1;const e=Cd(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:r,offsetY:i,autoRotate:o,placement:a,closeToPath:s}=e,l=Fe(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),u=this.shapeMap.key,c=null==u?void 0:u.getRenderBounds();return Object.assign(function(t,e,n,r,i,o,a){const[s,l]=ed(t,e),u={textAlign:"left"===e?"right":"right"===e?"left":"center",textBaseline:"top"===e?"bottom":"bottom"===e?"top":"middle",transform:[["translate",s+n,l+r]]};if("center"===e||!i)return u;const c=$d(o);if(!c||c.length<=3)return u;const h=c.map(((t,e)=>{const n=t,r=c[(e+1)%c.length];return Ne(n,r)?null:[n,r]})).filter(Boolean),d=hd([s,l],h),f=dd([s,l],d);if(f&&d&&(u.transform=[["translate",f[0]+n,f[1]+r]],a)){const t=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));u.transform.push(["rotate",t/Math.PI*180]),u.textAlign="center","right"!==e&&"left"!==e||(u.textBaseline=t>0?"right"===e?"bottom":"top":"right"===e?"top":"bottom")}return u}(c,a,r,i,s,t.d,o),{wordWrapWidth:Gd(c,n)},l)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",Ul,this.getKeyStyle(t),e),this.upsert("label",Hd,this.getLabelStyle(t),e)}}Xd.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};let Kd=class extends Gl{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Qd=this,this.isMutationObserved=!0,this.addEventListener(Ws.MOUNTED,this.onMounted),this.addEventListener(Ws.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:r=0}=this.attributes;if(t&&n&&r){const[i,o]=this.getBounds().min,a={x:i,y:o,radius:t,width:n,height:r};if(e)Object.assign(this.parsedStyle.clipPath.style,a);else{const t=new Kl({style:a});this.style.clipPath=t}}else e&&(this.style.clipPath=null)}};const Zd=new WeakMap;let Qd=null;const Jd=t=>{if(Qd&&function(t){const e=[];let n=t.parentNode;for(;n;)e.push(n),n=n.parentNode;return e}(Qd).includes(t)){const e=Zd.get(t);e?e.includes(Qd)||e.push(Qd):Zd.set(t,[Qd])}},tf=t=>{const e=Zd.get(t);e&&e.forEach((t=>t.handleRadius()))};class ef extends Vd{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,r=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},r):Object.assign({textBaseline:"middle",textAlign:"center"},r)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?Kd:Ql,this.getIconStyle(t),e)}}class nf extends Vd{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then((()=>this.onframe()))),n}}class rf extends nf{constructor(t){super(Ld({style:rf.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return Rd(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(Pd(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(!1===t.label||!t.labelText)return!1;const e=Cd(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:r,offsetX:i,offsetY:o}=e,a=Fe(e,["placement","maxWidth","offsetX","offsetY"]),s=this.getShape("key").getLocalBounds();return Object.assign(_g(s,n,i,o),{wordWrapWidth:Gd(s,r)},a)}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getKeyStyle(t),{fill:n}=e,r=Fe(e,["fill"]),i=Cd(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},r),{stroke:n}),i)}getIconStyle(t){if(!1===t.icon||!t.iconText&&!t.iconSrc)return!1;const e=Cd(this.getGraphicStyle(t),"icon");return Object.assign(function(t,e){const n=Rd(t);let r={};return e.text&&!e.fontSize&&(r={fontSize:.5*Math.min(...n)}),!e.src||e.width&&e.height||(r={width:.5*n[0],height:.5*n[1]}),r}(t.size,e),e)}getBadgesStyle(t){var e;const n=Ad(this.shapeMap,"badge-"),r={};if(Object.keys(n).forEach((t=>{r[t]=!1})),!1===t.badge||!(null===(e=t.badges)||void 0===e?void 0:e.length))return r;const{badges:i=[],badgePalette:o,opacity:a=1}=t,s=Fe(t,["badges","badgePalette","opacity"]),l=Fd(o),u=Cd(this.getGraphicStyle(s),"badge");return i.forEach(((t,e)=>{r[e]=Object.assign(Object.assign({backgroundFill:l?l[e%(null==l?void 0:l.length)]:void 0,opacity:a},u),this.getBadgeStyle(t))})),r}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:r,offsetY:i}=t,o=Fe(t,["placement","offsetX","offsetY"]),a=_g(e.getLocalBounds(),n,r,i,!0);return Object.assign(Object.assign({},a),o)}getPortsStyle(t){var e;const n=this.getPorts(),r={};if(Object.keys(n).forEach((t=>{r[t]=!1})),!1===t.port||!(null===(e=t.ports)||void 0===e?void 0:e.length))return r;const i=Cd(this.getGraphicStyle(t),"port"),{ports:o=[]}=t;return o.forEach(((e,n)=>{const o=e.key||n,a=Object.assign(Object.assign({},i),e);if(Cg(a))r[o]=!1;else{const[n,i]=this.getPortXY(t,e);r[o]=Object.assign({transform:[["translate",n,i]]},a)}})),r}getPortXY(t,e){const{placement:n="left"}=e,r=this.getShape("key");return Og(function(t,e){if(!t)return e.getLocalBounds();const n=t.canvas.getLayer(),r=e.cloneNode();Ph(r,"hidden"),n.appendChild(r);const i=r.getLocalBounds();return r.destroy(),i}(this.context,r),n)}getPorts(){return Ad(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){return function(t,e,n=!1){return ud(t,ed(e,"center"),[ed(e,"left-top"),ed(e,"right-top"),ed(e,"right-bottom"),ed(e,"left-bottom")],!1,n).point}(t,this.getShape("key").getBounds(),e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);if(!Id(this,"halo",n))return;const r=this.getShape("key");this.upsert("halo",r.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);Id(this,"icon",n)&&(this.upsert("icon",ef,n,e),Jd(this))}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach((t=>{const r=n[t];Id(this,`badge-${t}`,r)&&this.upsert(`badge-${t}`,Ud,r,e)}))}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach((t=>{const r=n[t],i=`port-${t}`;Id(this,i,r)&&this.upsert(i,Ll,r,e)}))}drawLabelShape(t,e){const n=this.getLabelStyle(t);Id(this,"label",n)&&this.upsert("label",Hd,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)&&tf(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}rf.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};let of=class t extends rf{constructor(e){super(Ld({style:t.defaultStyleProps},e))}drawKeyShape(t,e){return this.upsert("key",Ll,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,r=2*n*bd;return!!e&&Object.assign({width:r,height:r},e)}getIntersectPoint(t,e=!1){return cd(t,this.getShape("key").getBounds(),e)}};of.defaultStyleProps={size:32};class af extends rf{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",$l,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,r;const{points:i}=this.getShape("key").attributes;return ud(t,[+((null===(n=this.attributes)||void 0===n?void 0:n.x)||0),+((null===(r=this.attributes)||void 0===r?void 0:r.y)||0)],i,!0,e).point}}class sf extends af{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return function(t,e){return[[0,-e/2],[t/2,0],[0,e/2],[-t/2,0]]}(e,n)}}class lf extends of{constructor(t){super(Ld({style:lf.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...Rd(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return ne(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(null==n?void 0:n.length))return;const r=n.map((t=>ae(t)?{value:t}:t)),i=Cd(this.getGraphicStyle(t),"donut"),o=Fd(t.donutPalette);if(!o)return;const a=r.reduce(((t,e)=>{var n;return t+(null!==(n=e.value)&&void 0!==n?n:0)}),0),s=this.parseOuterR(),l=this.parseInnerR();let u=0;r.forEach(((t,n)=>{const{value:c=0,color:h=o[n%o.length]}=t,d=Fe(t,["value","color"]),f=360*(0===a?1/r.length:c/a);this.upsert(`round${n}`,Ul,Object.assign(Object.assign(Object.assign({},i),{d:cf(s,l,u,u+f),fill:h}),d),e),u+=f}))}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}lf.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const uf=(t,e,n,r)=>[t+Math.sin(r)*n,e-Math.cos(r)*n],cf=(t=0,e=0,n,r)=>{const[i,o]=[0,0];return Math.abs(n-r)%360<1e-6?((t,e,n,r)=>r<=0||n<=r?[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"]]:[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"],["M",t+r,e],["A",r,r,0,1,0,t-r,e],["A",r,r,0,1,0,t+r,e],["Z"]])(i,o,t,e):((t,e,n,r,i,o)=>{const[a,s]=[i/360*2*Math.PI,o/360*2*Math.PI],l=[uf(t,e,r,a),uf(t,e,n,a),uf(t,e,n,s),uf(t,e,r,s)],u=s-a>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",n,n,0,u,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",r,r,0,u,0,l[0][0],l[0][1]],["Z"]]})(i,o,t,e,n,r)};class hf extends rf{constructor(t){super(Ld({style:hf.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",jl,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:r/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:r}=this.getShape("key").attributes,i=2*Math.min(+n,+r)*bd;return!!e&&Object.assign({width:i,height:i},e)}getIntersectPoint(t,e=!1){return cd(t,this.getShape("key").getBounds(),e)}}hf.defaultStyleProps={size:[45,35]};class df extends af{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return[[0,e=this.getOuterR(t)],[e*Math.sqrt(3)/2,e/2],[e*Math.sqrt(3)/2,-e/2],[0,-e],[-e*Math.sqrt(3)/2,-e/2],[-e*Math.sqrt(3)/2,e/2]];var e}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*bd;return!!e&&Object.assign({width:n,height:n},e)}}
18
+ var pu=function(t){function e(t,n,r,i){var o;return s(this,e),(o=v(this,e,[t])).currentTime=r,o.timelineTime=i,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=r,o.timelineTime=i,o}return y(e,t),u(e)}(Cs),gu=0,vu=function(){return u((function t(e,n){var r;s(this,t),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=e,e.animation=this,this.timeline=n,this.id="".concat(gu++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null===(r=this.effect)||void 0===r?void 0:r.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}),[{key:"pending",get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var t=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise((function(e,n){t.resolveReadyPromise=function(){e(t)},t.rejectReadyPromise=function(){n(new Error)}})),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var t=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise((function(e,n){t.resolveFinishedPromise=function(){e(t)},t.rejectFinishedPromise=function(){n(new Error)}})),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){if(t=Number(t),!isNaN(t)){var e;if(this.timeline.restart(),!this._paused&&null!==this._startTime)this._startTime=Number(null===(e=this.timeline)||void 0===e?void 0:e.currentTime)-t/this.playbackRate;this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(t){if(null!==t){if(this.updatePromises(),t=Number(t),isNaN(t))return;if(this._paused||this._idle)return;this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){if(t!==this._playbackRate){this.updatePromises();var e=this.currentTime;this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||"running"===this.playState||!this._finishedFlag}},{key:"updatePromises",value:function(){var t=this.oldPlayState,e=this.pending?"pending":this.playState;return this.readyPromise&&e!==t&&("idle"===e?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===t?this.resolveReadyPromise():"pending"===e&&(this.readyPromise=void 0)),this.finishedPromise&&e!==t&&("idle"===e?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===e?this.resolveFinishedPromise():"finished"===t&&(this.finishedPromise=void 0)),this.oldPlayState=e,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var t=this;if(this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var e=new pu(null,this,this.currentTime,null);setTimeout((function(){t.oncancel(e)}))}}},{key:"reverse",value:function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()}},{key:"updatePlaybackRate",value:function(t){this.playbackRate=t}},{key:"targetAnimations",value:function(){var t;return(null===(t=this.effect)||void 0===t?void 0:t.target).getAnimations()}},{key:"markTarget",value:function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)}},{key:"unmarkTarget",value:function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)}},{key:"tick",value:function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}}},{key:"persist",value:function(){throw new Error(Qr)}},{key:"addEventListener",value:function(t,e,n){throw new Error(Qr)}},{key:"removeEventListener",value:function(t,e,n){throw new Error(Qr)}},{key:"dispatchEvent",value:function(t){throw new Error(Qr)}},{key:"commitStyles",value:function(){throw new Error(Qr)}},{key:"ensureAlive",value:function(){var t,e;this.playbackRate<0&&0===this.currentTime?this._inEffect=!(null===(t=this.effect)||void 0===t||!t.update(-1)):this._inEffect=!(null===(e=this.effect)||void 0===e||!e.update(this.currentTime));this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(t){var e=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new pu(null,this,this.currentTime,t);setTimeout((function(){e.onfinish&&e.onfinish(n)}))}this._finishedFlag=!0}}else{if(this.onframe&&"running"===this.playState){var r=new pu(null,this,this.currentTime,t);this.onframe(r)}this._finishedFlag=!1}}}])}(),mu=.1,yu="function"==typeof Float32Array,bu=function(t,e){return 1-3*e+3*t},xu=function(t,e){return 3*e-6*t},Eu=function(t){return 3*t},wu=function(t,e,n){return((bu(e,n)*t+xu(e,n))*t+Eu(e))*t},ku=function(t,e,n){return 3*bu(e,n)*t*t+2*xu(e,n)*t+Eu(e)},Mu=function(t,e,n,r){if(!(t>=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===r)return function(t){return t};for(var i=yu?new Float32Array(11):new Array(11),o=0;o<11;++o)i[o]=wu(o*mu,t,n);var a=function(e){for(var r=0,o=1;10!==o&&i[o]<=e;++o)r+=mu;--o;var a=r+(e-i[o])/(i[o+1]-i[o])*mu,s=ku(a,t,n);return s>=.001?function(t,e,n,r){for(var i=0;i<4;++i){var o=ku(e,n,r);if(0===o)return e;e-=(wu(e,n,r)-t)/o}return e}(e,a,t,n):0===s?a:function(t,e,n,r,i){var o,a,s=0;do{(o=wu(a=e+(n-e)/2,r,i)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++s<10);return a}(e,r,r+mu,t,n)};return function(t){return 0===t||1===t?t:wu(a(t),e,r)}},Su=function(t){return Math.pow(t,2)},Nu=function(t){return Math.pow(t,3)},Ou=function(t){return Math.pow(t,4)},Tu=function(t){return Math.pow(t,5)},Cu=function(t){return Math.pow(t,6)},Au=function(t){return 1-Math.cos(t*Math.PI/2)},Pu=function(t){return 1-Math.sqrt(1-t*t)},Ru=function(t){return t*t*(3*t-2)},Du=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)},Lu=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?.5:i,a=oe(Number(r),1,10),s=oe(Number(o),.1,2);return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-s/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/s)},_u=function(t){var e=arguments.length>2?arguments[2]:void 0,n=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),r=n[0],i=void 0===r?1:r,o=n[1],a=void 0===o?100:o,s=n[2],l=void 0===s?10:s,u=n[3],c=void 0===u?0:u;i=oe(i,.1,1e3),a=oe(a,.1,1e3),l=oe(l,.1,1e3),c=oe(c,.1,1e3);var h=Math.sqrt(a/i),d=l/(2*Math.sqrt(a*i)),f=d<1?h*Math.sqrt(1-d*d):0,p=d<1?(d*h-c)/f:-c+h,g=e?e*t/1e3:t;return g=d<1?Math.exp(-g*d*h)*(1*Math.cos(f*g)+p*Math.sin(f*g)):(1+p*g)*Math.exp(-g*h),0===t||1===t?t:1-g},Iu=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?10:n;return("start"===e[1]?Math.ceil:Math.floor)(oe(t,0,1)*r)/r},ju=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),n=e[0],r=e[1],i=e[2],o=e[3];return Mu(n,r,i,o)(t)},Bu=Mu(.42,0,1,1),Fu=function(t){return function(e){return 1-t(1-e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],arguments.length>2?arguments[2]:void 0)}},zu=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?t(2*e,n,r)/2:1-t(-2*e+2,n,r)/2}},Gu=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-2*e,n,r))/2:(t(2*e-1,n,r)+1)/2}},Vu={steps:Iu,"step-start":function(t){return Iu(t,[1,"start"])},"step-end":function(t){return Iu(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":ju,ease:function(t){return ju(t,[.25,.1,.25,1])},in:Bu,out:Fu(Bu),"in-out":zu(Bu),"out-in":Gu(Bu),"in-quad":Su,"out-quad":Fu(Su),"in-out-quad":zu(Su),"out-in-quad":Gu(Su),"in-cubic":Nu,"out-cubic":Fu(Nu),"in-out-cubic":zu(Nu),"out-in-cubic":Gu(Nu),"in-quart":Ou,"out-quart":Fu(Ou),"in-out-quart":zu(Ou),"out-in-quart":Gu(Ou),"in-quint":Tu,"out-quint":Fu(Tu),"in-out-quint":zu(Tu),"out-in-quint":Gu(Tu),"in-expo":Cu,"out-expo":Fu(Cu),"in-out-expo":zu(Cu),"out-in-expo":Gu(Cu),"in-sine":Au,"out-sine":Fu(Au),"in-out-sine":zu(Au),"out-in-sine":Gu(Au),"in-circ":Pu,"out-circ":Fu(Pu),"in-out-circ":zu(Pu),"out-in-circ":Gu(Pu),"in-back":Ru,"out-back":Fu(Ru),"in-out-back":zu(Ru),"out-in-back":Gu(Ru),"in-bounce":Du,"out-bounce":Fu(Du),"in-out-bounce":zu(Du),"out-in-bounce":Gu(Du),"in-elastic":Lu,"out-elastic":Fu(Lu),"in-out-elastic":zu(Lu),"out-in-elastic":Gu(Lu),spring:_u,"spring-in":_u,"spring-out":Fu(_u),"spring-in-out":zu(_u),"spring-out-in":Gu(_u)},Wu=function(t){return t};function Hu(t,e){return function(n){if(n>=1)return 1;var r=1/t;return(n+=e*r)-n%r}}var Uu="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",Yu=new RegExp("cubic-bezier\\(".concat(Uu,",").concat(Uu,",").concat(Uu,",").concat(Uu,"\\)")),$u=/steps\(\s*(\d+)\s*\)/,qu=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Xu(t){var e=Yu.exec(t);if(e)return Mu.apply(void 0,d(e.slice(1).map(Number)));var n=$u.exec(t);if(n)return Hu(Number(n[1]),0);var r=qu.exec(t);return r?Hu(Number(r[1]),{start:1,middle:.5,end:0}[r[2]]):Vu[function(t){return function(t){return"-"===(t=t.replace(/([A-Z])/g,(function(t){return"-".concat(t.toLowerCase())}))).charAt(0)?t.substring(1):t}(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()}(t)]||Vu.linear}function Ku(t){return Math.abs(function(t){var e;if(0===t.duration||0===t.iterations)return 0;return("auto"===t.duration?0:Number(t.duration))*(null!==(e=t.iterations)&&void 0!==e?e:1)}(t)/(t.playbackRate||1))}function Zu(t,e,n){var r=function(t,e,n){if(null===e)return 0;var r=n.endTime;return e<Math.min(n.delay,r)?1:e>=Math.min(n.delay+t+n.endDelay,r)?2:3}(t,e,n),i=function(t,e,n,r,i){switch(r){case 1:return"backwards"===e||"both"===e?0:null;case 3:return n-i;case 2:return"forwards"===e||"both"===e?t:null;case 0:return null}}(t,n.fill,e,r,n.delay);if(null===i)return null;var o="auto"===n.duration?0:n.duration,a=function(t,e,n,r,i){var o=i;return 0===t?1!==e&&(o+=n):o+=r/t,o}(o,r,n.iterations,i,n.iterationStart),s=function(t,e,n,r,i,o){var a=t===1/0?e%1:t%1;return 0!==a||2!==n||0===r||0===i&&0!==o||(a=1),a}(a,n.iterationStart,r,n.iterations,i,o),l=function(t,e,n,r){return 2===t&&e===1/0?1/0:1===n?Math.floor(r)-1:Math.floor(r)}(r,n.iterations,s,a),u=function(t,e,n){var r=t;if("normal"!==t&&"reverse"!==t){var i=e;"alternate-reverse"===t&&(i+=1),r="normal",i!==1/0&&i%2!=0&&(r="reverse")}return"normal"===r?n:1-n}(n.direction,l,s);return n.currentIteration=l,n.progress=u,n.easingFunction(u)}function Qu(t,e,n){var r=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r])if(Ju(i)){var o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:Xu(t[r].easing)||e.easingFunction,value:t[r][i]};n[i]=n[i]||[],n[i].push(o)}return n}(t,e),i=function(t,e){var n=[];for(var r in t)for(var i=t[r],o=0;o<i.length-1;o++){var a=o,s=o+1,l=i[a].computedOffset,u=i[s].computedOffset,c=l,h=u;0===o&&(c=-1/0,0===u&&(s=a)),o===i.length-2&&(h=1/0,1===l&&(a=s)),n.push({applyFrom:c,applyTo:h,startOffset:i[a].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[a].easingFunction,property:r,interpolation:ec(r,i[a].value,i[s].value,e)})}return n.sort((function(t,e){return t.startOffset-e.startOffset})),n}(r,n);return function(t,e){if(null!==e)i.filter((function(t){return e>=t.applyFrom&&e<t.applyTo})).forEach((function(n){var r=e-n.startOffset,i=n.endOffset-n.startOffset,o=0===i?0:r/i;t.setAttribute(n.property,n.interpolation(o),!1,!1)}));else for(var n in r)Ju(n)&&t.setAttribute(n,null)}}function Ju(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var tc=function(t,e,n){return function(r){var i=nc(t,e,r);return ae(i)?i:n(i)}};function ec(t,e,n,r){var i=ga[t];if(i&&i.syntax&&i.int){var o=xl.styleValueRegistry.getPropertySyntax(i.syntax);if(o){var a=o.parser,s=a?a(e,r):e,l=a?a(n,r):n,u=o.mixer(s,l,r);if(u){var c=tc.apply(void 0,d(u));return function(t){return 0===t?e:1===t?n:c(t)}}}}return tc(!1,!0,(function(t){return t?n:e}))}function nc(t,e,n){if("number"==typeof t&&"number"==typeof e)return t*(1-n)+e*n;if("boolean"==typeof t&&"boolean"==typeof e||"string"==typeof t&&"string"==typeof e)return n<.5?t:e;if(Array.isArray(t)&&Array.isArray(e)){for(var r=t.length,i=e.length,o=Math.max(r,i),a=[],s=0;s<o;s++)a.push(nc(t[s<r?s:r-1],e[s<i?s:i-1],n));return a}throw new Error("Mismatched interpolation arguments ".concat(t,":").concat(e))}var rc=function(){return u((function t(){s(this,t),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=Wu,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}),[{key:"easing",get:function(){return this._easing},set:function(t){this.easingFunction=Xu(t),this._easing=t}}])}();function ic(t,e){if(null===t)return[];Array.isArray(t)||(t=function(t){var e=[];for(var n in t)if(!(n in["easing","offset","composite"])){var r=t[n];Array.isArray(r)||(r=[r]);for(var i=r.length,o=0;o<i;o++){if(!e[o]){var a={};"offset"in t&&(a.offset=Number(t.offset)),"easing"in t&&(a.easing=t.easing),"composite"in t&&(a.composite=t.composite),e[o]=a}void 0!==r[o]&&null!==r[o]&&(e[o][n]=r[o])}}return e.sort((function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)})),e}(t));for(var n=t.map((function(t){var n={};for(var r in null!=e&&e.composite&&(n.composite="auto"),t){var i=t[r];if("offset"===r){if(null!==i){if(i=Number(i),!isFinite(i))throw new Error("Keyframe offsets must be numbers.");if(i<0||i>1)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=i}}else if("composite"===r&&-1===["replace","add","accumulate","auto"].indexOf(i))throw new Error("".concat(i," compositing is not supported"));n[r]=i}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==e?void 0:e.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n})),r=!0,i=-1/0,o=0;o<n.length;o++){var a=n[o].offset;if(Yt(a))r=!1;else{if(a<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=a}}return n=n.filter((function(t){return Number(t.offset)>=0&&Number(t.offset)<=1})),r||function(){var t,e,r=n.length;n[r-1].computedOffset=Number(null!==(t=n[r-1].offset)&&void 0!==t?t:1),r>1&&(n[0].computedOffset=Number(null!==(e=n[0].offset)&&void 0!==e?e:0));for(var i=0,o=Number(n[0].computedOffset),a=1;a<r;a++){var s=n[a].computedOffset;if(!Yt(s)&&!Yt(o)){for(var l=1;l<a-i;l++)n[i+l].computedOffset=o+(Number(s)-o)*l/(a-i);i=a,o=Number(s)}}}(),n}var oc="backwards|forwards|both|none".split("|"),ac="reverse|alternate|alternate-reverse".split("|");function sc(t,e){var n;return function(t){var e=new rc;return"number"!=typeof t||isNaN(t)?void 0!==t&&Object.keys(t).forEach((function(n){if(void 0!==t[n]&&null!==t[n]&&"auto"!==t[n]){if(("number"==typeof e[n]||"duration"===n)&&("number"!=typeof t[n]||isNaN(t[n])))return;if("fill"===n&&-1===oc.indexOf(t[n]))return;if("direction"===n&&-1===ac.indexOf(t[n]))return;e[n]=t[n]}})):e.duration=t,e}(t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!==(n=t)&&void 0!==n?n:{duration:"auto"}))}var lc=function(){return u((function t(e,n,r){var i=this;s(this,t),this.composite="replace",this.iterationComposite="replace",this.target=e,this.timing=sc(r),this.timing.effect=this,this.timing.activeDuration=Ku(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=ic(n,this.timing),this.interpolations=Qu(this.normalizedKeyframes,this.timing,this.target);var o=xl.globalThis.Proxy;this.computedTiming=o?new o(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?i.animation&&i.animation.currentTime||null:"currentIteration"===e?i.animation&&"running"===i.animation.playState?t.currentIteration||0:null:"progress"===e?i.animation&&"running"===i.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing}),[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(t){return null!==t&&(this.timeFraction=Zu(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(t){this.normalizedKeyframes=ic(t)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(t){var e=this;Object.keys(t||{}).forEach((function(n){e.timing[n]=t[n]}))}}])}();function uc(t,e){return Number(t.id)-Number(e.id)}var cc=function(){return u((function t(e){var n=this;s(this,t),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(t){n.currentTime=t,n.discardAnimations(),0===n.animations.length?n.timelineTicking=!1:n.requestAnimationFrame(n.webAnimationsNextTick)},this.processRafCallbacks=function(t){var e=n.rafCallbacks;n.rafCallbacks=[],t<Number(n.currentTime)&&(t=Number(n.currentTime)),n.animations.sort(uc),n.animations=n.tick(t,!0,n.animations)[0],e.forEach((function(e){e[1](t)})),n.applyPendingEffects()},this.document=e}),[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(t,e,n){var r=new lc(t,e,n),i=new vu(r,this);return this.animations.push(i),this.restartWebAnimationsNextTick(),i.updatePromises(),i.play(),i.updatePromises(),i}},{key:"applyDirtiedAnimation",value:function(t){var e=this;if(!this.inTick){t.markTarget();var n=t.targetAnimations();n.sort(uc),this.tick(Number(this.currentTime),!1,n.slice())[1].forEach((function(t){var n=e.animations.indexOf(t);-1!==n&&e.animations.splice(n,1)})),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame((function(){})),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach((function(t){null==t||t.applyInterpolations()})),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter((function(t){return t.updatePromises()}))}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter((function(t){return"finished"!==t.playState&&"idle"!==t.playState}))}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e}},{key:"requestAnimationFrame",value:function(t){var e=this;return this.rAF((function(n){e.updateAnimationsPromises(),t(n),e.updateAnimationsPromises()}))}},{key:"tick",value:function(t,e,n){var r,i,o=this;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=t,this.ticking=!1;var a=[],s=[],l=[],u=[];return n.forEach((function(n){n.tick(t,e),n._inEffect?(s.push(n.effect),n.markTarget()):(a.push(n.effect),n.unmarkTarget()),n._needsTick&&(o.ticking=!0);var r=n._inEffect||n._needsTick;n._inTimeline=r,r?l.push(n):u.push(n)})),(r=this.pendingEffects).push.apply(r,a),(i=this.pendingEffects).push.apply(i,s),this.ticking&&this.requestAnimationFrame((function(){})),this.inTick=!1,[l,u]}}])}();xl.EasingFunction=Xu,xl.AnimationTimeline=cc;const hc={duration:500},dc={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var fc,pc,gc,vc,mc,yc,bc,xc,Ec;!function(t){t.NodeAdded="NodeAdded",t.NodeUpdated="NodeUpdated",t.NodeRemoved="NodeRemoved",t.EdgeAdded="EdgeAdded",t.EdgeUpdated="EdgeUpdated",t.EdgeRemoved="EdgeRemoved",t.ComboAdded="ComboAdded",t.ComboUpdated="ComboUpdated",t.ComboRemoved="ComboRemoved"}(fc||(fc={})),function(t){t.DRAW="draw",t.COLLAPSE="collapse",t.EXPAND="expand",t.TRANSFORM="transform"}(pc||(pc={})),t.CanvasEvent=void 0,function(t){t.CLICK="canvas:click",t.DBLCLICK="canvas:dblclick",t.POINTER_OVER="canvas:pointerover",t.POINTER_LEAVE="canvas:pointerleave",t.POINTER_ENTER="canvas:pointerenter",t.POINTER_MOVE="canvas:pointermove",t.POINTER_OUT="canvas:pointerout",t.POINTER_DOWN="canvas:pointerdown",t.POINTER_UP="canvas:pointerup",t.CONTEXT_MENU="canvas:contextmenu",t.DRAG_START="canvas:dragstart",t.DRAG="canvas:drag",t.DRAG_END="canvas:dragend",t.DRAG_ENTER="canvas:dragenter",t.DRAG_OVER="canvas:dragover",t.DRAG_LEAVE="canvas:dragleave",t.DROP="canvas:drop",t.WHEEL="canvas:wheel"}(t.CanvasEvent||(t.CanvasEvent={})),t.ComboEvent=void 0,(gc=t.ComboEvent||(t.ComboEvent={})).CLICK="combo:click",gc.DBLCLICK="combo:dblclick",gc.POINTER_OVER="combo:pointerover",gc.POINTER_LEAVE="combo:pointerleave",gc.POINTER_ENTER="combo:pointerenter",gc.POINTER_MOVE="combo:pointermove",gc.POINTER_OUT="combo:pointerout",gc.POINTER_DOWN="combo:pointerdown",gc.POINTER_UP="combo:pointerup",gc.CONTEXT_MENU="combo:contextmenu",gc.DRAG_START="combo:dragstart",gc.DRAG="combo:drag",gc.DRAG_END="combo:dragend",gc.DRAG_ENTER="combo:dragenter",gc.DRAG_OVER="combo:dragover",gc.DRAG_LEAVE="combo:dragleave",gc.DROP="combo:drop",t.CommonEvent=void 0,(vc=t.CommonEvent||(t.CommonEvent={})).CLICK="click",vc.DBLCLICK="dblclick",vc.POINTER_OVER="pointerover",vc.POINTER_LEAVE="pointerleave",vc.POINTER_ENTER="pointerenter",vc.POINTER_MOVE="pointermove",vc.POINTER_OUT="pointerout",vc.POINTER_DOWN="pointerdown",vc.POINTER_UP="pointerup",vc.CONTEXT_MENU="contextmenu",vc.DRAG_START="dragstart",vc.DRAG="drag",vc.DRAG_END="dragend",vc.DRAG_ENTER="dragenter",vc.DRAG_OVER="dragover",vc.DRAG_LEAVE="dragleave",vc.DROP="drop",vc.KEY_DOWN="keydown",vc.KEY_UP="keyup",vc.WHEEL="wheel",t.ContainerEvent=void 0,(mc=t.ContainerEvent||(t.ContainerEvent={})).KEY_DOWN="keydown",mc.KEY_UP="keyup",t.EdgeEvent=void 0,(yc=t.EdgeEvent||(t.EdgeEvent={})).CLICK="edge:click",yc.DBLCLICK="edge:dblclick",yc.POINTER_OVER="edge:pointerover",yc.POINTER_LEAVE="edge:pointerleave",yc.POINTER_ENTER="edge:pointerenter",yc.POINTER_MOVE="edge:pointermove",yc.POINTER_OUT="edge:pointerout",yc.POINTER_DOWN="edge:pointerdown",yc.POINTER_UP="edge:pointerup",yc.CONTEXT_MENU="edge:contextmenu",yc.DRAG_ENTER="edge:dragenter",yc.DRAG_OVER="edge:dragover",yc.DRAG_LEAVE="edge:dragleave",yc.DROP="edge:drop",t.GraphEvent=void 0,(bc=t.GraphEvent||(t.GraphEvent={})).BEFORE_CANVAS_INIT="beforecanvasinit",bc.AFTER_CANVAS_INIT="aftercanvasinit",bc.BEFORE_SIZE_CHANGE="beforesizechange",bc.AFTER_SIZE_CHANGE="aftersizechange",bc.BEFORE_ELEMENT_CREATE="beforeelementcreate",bc.AFTER_ELEMENT_CREATE="afterelementcreate",bc.BEFORE_ELEMENT_UPDATE="beforeelementupdate",bc.AFTER_ELEMENT_UPDATE="afterelementupdate",bc.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",bc.AFTER_ELEMENT_DESTROY="afterelementdestroy",bc.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",bc.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",bc.BEFORE_DRAW="beforedraw",bc.AFTER_DRAW="afterdraw",bc.BEFORE_RENDER="beforerender",bc.AFTER_RENDER="afterrender",bc.BEFORE_ANIMATE="beforeanimate",bc.AFTER_ANIMATE="afteranimate",bc.BEFORE_LAYOUT="beforelayout",bc.AFTER_LAYOUT="afterlayout",bc.BEFORE_STAGE_LAYOUT="beforestagelayout",bc.AFTER_STAGE_LAYOUT="afterstagelayout",bc.BEFORE_TRANSFORM="beforetransform",bc.AFTER_TRANSFORM="aftertransform",bc.BATCH_START="batchstart",bc.BATCH_END="batchend",bc.BEFORE_DESTROY="beforedestroy",bc.AFTER_DESTROY="afterdestroy",bc.BEFORE_RENDERER_CHANGE="beforerendererchange",bc.AFTER_RENDERER_CHANGE="afterrendererchange",t.HistoryEvent=void 0,(xc=t.HistoryEvent||(t.HistoryEvent={})).UNDO="undo",xc.REDO="redo",xc.CANCEL="cancel",xc.ADD="add",xc.CLEAR="clear",xc.CHANGE="change",t.NodeEvent=void 0,(Ec=t.NodeEvent||(t.NodeEvent={})).CLICK="node:click",Ec.DBLCLICK="node:dblclick",Ec.POINTER_OVER="node:pointerover",Ec.POINTER_LEAVE="node:pointerleave",Ec.POINTER_ENTER="node:pointerenter",Ec.POINTER_MOVE="node:pointermove",Ec.POINTER_OUT="node:pointerout",Ec.POINTER_DOWN="node:pointerdown",Ec.POINTER_UP="node:pointerup",Ec.CONTEXT_MENU="node:contextmenu",Ec.DRAG_START="node:dragstart",Ec.DRAG="node:drag",Ec.DRAG_END="node:dragend",Ec.DRAG_ENTER="node:dragenter",Ec.DRAG_OVER="node:dragover",Ec.DRAG_LEAVE="node:dragleave",Ec.DROP="node:drop";const wc="combo",kc="tree";var Mc;t.ExtensionCategory=void 0,(Mc=t.ExtensionCategory||(t.ExtensionCategory={})).NODE="node",Mc.EDGE="edge",Mc.COMBO="combo",Mc.THEME="theme",Mc.PALETTE="palette",Mc.LAYOUT="layout",Mc.BEHAVIOR="behavior",Mc.PLUGIN="plugin",Mc.ANIMATION="animation",Mc.TRANSFORM="transform",Mc.SHAPE="shape";const Sc={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function Nc(t,e){var n;const r=null===(n=Sc[t])||void 0===n?void 0:n[e];if(r)return r}const Oc="5.0.35";function Tc(t){return`[G6 v${Oc}] ${t}`}const Cc=t=>{console.warn(Tc(t))};function Ac(e){const{theme:n}=e;if(!n)return{};const r=Nc(t.ExtensionCategory.THEME,n);return r||(Cc(`The theme of ${n} is not registered.`),{})}function Pc(t,e){if(Array.isArray(t)&&0===t.length)return null;const n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t.slice(1):e||[];return new Proxy(n,{get:(t,e)=>"function"!=typeof t[e]||["onframe","onfinish"].includes(e)?"finished"===e?Promise.all([n.finished,...r.map((t=>t.finished))]):Reflect.get(t,e):(...n)=>{t[e](...n),r.forEach((t=>{var r;return null===(r=t[e])||void 0===r?void 0:r.call(t,...n)}))},set:(t,e,n)=>(["onframe","onfinish"].includes(e)||r.forEach((t=>{t[e]=n})),Reflect.set(t,e,n))})}function Rc(t){const e=t.reduce(((t,e)=>(Object.entries(e).forEach((([e,n])=>{void 0===t[e]?t[e]=[n]:t[e].push(n)})),t)),{});Object.entries(e).forEach((([n,r])=>{(r.length!==t.length||r.some((t=>Yt(t)))||r.every((t=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Ne(t,r[0]))))&&delete e[n]}));const n=Object.entries(e).reduce(((t,[e,n])=>(n.forEach(((n,r)=>{t[r]?t[r][e]=n:t[r]={[e]:n}})),t)),[]);return 0!==t.length&&0===n.length&&n.push({_:0},{_:0}),n}function Dc(t){switch(t){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function Lc(t,e){const{animation:n}=t;if(!1===n||!1===e)return!1;const r=Object.assign({},hc);return qt(n)&&Object.assign(r,n),qt(e)&&Object.assign(r,e),r}function _c(e,n,r,i){var o,a;const{animation:s}=e,l=null===(o=null==e?void 0:e[n])||void 0===o?void 0:o.animation;if(!1===l)return[];const u=null==l?void 0:l[r];if(!1===u)return[];if(!1===s||!1===i)return[];const c=null===(a=Ac(e)[n])||void 0===a?void 0:a.animation,h=(e=[])=>function(e){if("string"==typeof e){return Nc(t.ExtensionCategory.ANIMATION,e)||(Cc(`The animation of ${e} is not registered.`),[])}return e}(e).map((t=>Object.assign(Object.assign(Object.assign(Object.assign({},dc),qt(s)&&s),t),qt(i)&&i)));if(u)return h(u);if(!c)return[];const d=c[r];return!1===d?[]:h(d)}function Ic(t,e,n,r){if(Array.isArray(r)){let i=!1;const o=[];for(let a=0;a<r.length;a++){const s=r[a];if("translate"===s[0]){if(s[1]===t&&s[2]===e)return null;i=!0,o.push(["translate",t,e])}else if("translate3d"===s[0]){if(s[1]===t&&s[2]===e&&s[3]===n)return null;i=!0,o.push(["translate3d",t,e,n])}else o.push(s)}return i||o.splice(0,0,0===n?["translate",t,e]:["translate3d",t,e,n]),o}const i=r?r.replace(/translate(3d)?\([^)]*\)/g,""):"";return 0===n?`translate(${t}, ${e})${i}`:`translate3d(${t}, ${e}, ${n})${i}`}const jc=(t,e,n)=>{if(!n.length)return null;const[r,i]=e;let o;const a=n.map((e=>{var{fields:n,shape:a,states:s}=e,l=Fe(e,["fields","shape","states"]);const u=(e=>{var n;if(e){const o=t.getShape(e);if(!o)return null;const a=`get${de(e)}Style`,s=(null===(n=null==t?void 0:t[a])||void 0===n?void 0:n.bind(t))||(t=>t);return{shape:o,fromStyle:(null==s?void 0:s(r))||{},toStyle:(null==s?void 0:s(i))||{}}}return{shape:t,fromStyle:r,toStyle:i}})(a);if(!u)return null;const{shape:c,fromStyle:h,toStyle:d}=u,f=[{},{}];if(n.forEach((t=>{var e,n;Object.assign(f[0],{[t]:null!==(e=h[t])&&void 0!==e?e:Dc(t)}),Object.assign(f[1],{[t]:null!==(n=d[t])&&void 0!==n?n:Dc(t)})})),f.some((t=>Object.keys(t).some((t=>["x","y","z"].includes(t)))))){const{x:t=0,y:e=0,z:n=0,transform:r=""}=c.attributes||{};f.forEach((i=>{i.transform=Ic(i.x||t,i.y||e,i.z||n,r)}))}const p=c.animate(Rc(f),l);return void 0===a&&(o=p),p})).filter(Boolean),s=o||(null==a?void 0:a[0]);return s?Pc(s,a.filter((t=>t!=t))):null},Bc=[{fields:["x","y"]}],Fc=Bc,zc=[{fields:["sourceNode","targetNode"]}],Gc=zc,Vc=[{fields:["childrenNode","x","y"]}],Wc=Vc;function Hc(t){return t instanceof Float32Array||!(!Array.isArray(t)||2!==t.length&&3!==t.length)&&t.every((t=>"number"==typeof t))}function Uc(t,e,n){return t>=e&&t<=n}function Yc(t=0){if(Array.isArray(t)){const[e=0,n=e,r=e,i=n]=t;return[e,n,r,i]}return[t,t,t,t]}function $c(t=0){const e=Yc(t);return e[0]+e[2]}function qc(t){return t.max[0]-t.min[0]}function Xc(t){return t.max[1]-t.min[1]}function Kc(t){return[qc(t),Xc(t)]}function Zc(t,e){const n=Hc(t)?Qc(t):t.getShape("key").getBounds();return e?Jc(n,e):n}function Qc(t){const[e,n,r=0]=t,i=new Yr;return i.setMinMax([e,n,r],[e,n,r]),i}function Jc(t,e){const[n,r,i,o]=Yc(e),[a,s,l]=t.min,[u,c,h]=t.max,d=new Yr;return d.setMinMax([a-o,s-n,l],[u+r,c+i,h]),d}function th(t){if(0===t.length)return new Yr;if(1===t.length)return t[0];const e=new Yr;e.setMinMax(t[0].min,t[0].max);for(let n=1;n<t.length;n++){const r=t[n];e.setMinMax([Math.min(e.min[0],r.min[0]),Math.min(e.min[1],r.min[1]),Math.min(e.min[2],r.min[2])],[Math.max(e.max[0],r.max[0]),Math.max(e.max[1],r.max[1]),Math.max(e.max[2],r.max[2])])}return e}function eh(t,e){return Uc(t[0],e.min[0],e.max[0])&&Uc(t[1],e.min[1],e.max[1])}function nh(t,e,n=!1){const{min:[r,i],max:[o,a]}=e,s=(t[1]===i||t[1]===a)&&(n||Uc(t[0],r,o)),l=(t[0]===r||t[0]===o)&&(n||Uc(t[1],i,a));return s||l}function rh(t,e){const{center:n}=e;return t[0]===n[0]&&t[1]===n[1]}function ih(t,e){const[n,r]=t,[i,o]=e.min,[a,s]=e.max,l=n-i,u=a-n,c=r-o,h=s-r,d=Math.min(l,u,c,h);return d===l?"left":d===u?"right":d===c?"top":d===h?"bottom":"left"}function oh(t,e){const n=me(t);if(eh(t,e)){switch(ih(t,e)){case"left":n[0]=e.min[0];break;case"right":n[0]=e.max[0];break;case"top":n[1]=e.min[1];break;case"bottom":n[1]=e.max[1]}}else{const[r,i]=t,[o,a]=e.min,[s,l]=e.max;n[0]=Uc(r,o,s)?r:r<o?o:s,n[1]=Uc(i,a,l)?i:i<a?a:l}return n}var ah=function(t,e){return t===e},sh=function(){function t(t,e){void 0===e&&(e=null),this.value=t,this.next=e}return t.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},t}(),lh=function(){function t(t){void 0===t&&(t=ah),this.head=null,this.tail=null,this.compare=t}return t.prototype.prepend=function(t){var e=new sh(t,this.head);return this.head=e,this.tail||(this.tail=e),this},t.prototype.append=function(t){var e=new sh(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},t.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(null!==n)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},t.prototype.find=function(t){var e=t.value,n=void 0===e?void 0:e,r=t.callback,i=void 0===r?void 0:r;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value))return o;if(void 0!==n&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},t.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},t.prototype.fromArray=function(t){var e=this;return t.forEach((function(t){return e.append(t)})),this},t.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},t.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},t.prototype.toString=function(t){return void 0===t&&(t=void 0),this.toArray().map((function(e){return e.toString(t)})).toString()},t}(),uh=function(t,e,n){void 0===e&&(e=[]);var r=e.filter((function(e){return e.source===t||e.target===t}));if("target"===n){return r.filter((function(e){return e.source===t})).map((function(t){return t.target}))}if("source"===n){return r.filter((function(e){return e.target===t})).map((function(t){return t.source}))}return r.map((function(e){return e.source===t?e.target:e.source}))},ch={}.toString,hh=function(t,e){return ch.call(t)==="[object "+e+"]"},dh=function(t){return hh(t,"Function")},fh=function(t){return Array.isArray?Array.isArray(t):hh(t,"Array")};var ph,gh=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return function(t,e){var n,r;if(t)if(fh(t))for(var i=0,o=t.length;i<o&&!1!==e(t[i],i);i++);else if(r=typeof(n=t),null!==n&&"object"===r||"function"===r)for(var a in t)if(t.hasOwnProperty(a)&&!1===e(t[a],a))break}(t,(function(n,r){dh(t)&&"prototype"===r||e.push(n)})),e};!function(t,e){if(!dh(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var s=t.apply(this,r);return a.set(o,s),s};n.cache=new Map}((function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return ph||(ph=document.createElement("canvas").getContext("2d")),ph.font=[o,a,i,n+"px",r].join(" "),ph.measureText(function(t){return hh(t,"String")}(t)?t:"").width}),(function(t,e){return void 0===e&&(e={}),function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}([t],gh(e)).join("")}));function vh(t,e,n,r){if(t===e)return[t];if(r[e])return r[e];for(var i=[],o=0,a=n[e];o<a.length;o++){var s=vh(t,a[o],n,r);if(!s)return;for(var l=0,u=s;l<u.length;l++){var c=u[l];fh(c)?i.push(We(We([],c,!0),[e],!1)):i.push([c,e])}}return r[e]=i,r[e]}var mh,yh=function(t,e,n,r,i){var o=function(t,e,n,r){var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,l={},u={},c={};o.forEach((function(t,n){var r=t.id;u[r]=1/0,r===e&&(u[r]=0)}));for(var h=o.length,d=function(t){var e=function(t,e,n){for(var r,i=1/0,o=0;o<e.length;o++){var a=e[o].id;!n[a]&&t[a]<=i&&(i=t[a],r=e[o])}return r}(u,o,l),i=e.id;if(l[i]=!0,u[i]===1/0)return"continue";var a=[];a=n?function(t,e){return e.filter((function(e){return e.source===t}))}(i,s):function(t,e){return e.filter((function(e){return e.source===t||e.target===t}))}(i,s),a.forEach((function(t){var n=t.target,o=t.source,a=n===i?o:n,s=r&&t[r]?t[r]:1;u[a]>u[e.id]+s?(u[a]=u[e.id]+s,c[a]=[e.id]):u[a]===u[e.id]+s&&c[a].push(e.id)}))},f=0;f<h;f++)d();c[e]=[e];var p={};for(var g in u)u[g]!==1/0&&vh(e,g,c,p);var v={};for(var g in p)v[g]=p[g][0];return{length:u,path:v,allPath:p}}(t,e,r,i),a=o.length,s=o.path,l=o.allPath;return{length:a[n],path:s[n],allPath:l[n]}};!function(t){t.EuclideanDistance="euclideanDistance"}(mh||(mh={}));function bh(t){if(void 0!==t.id)return t.id;if(void 0!==t.source&&void 0!==t.target)return`${t.source}-${t.target}`;throw new Error(Tc("The datum does not have available id."))}function xh(t){return t.combo}function Eh(t,e){const n={nodes:(t.nodes||[]).map(bh),edges:(t.edges||[]).map(bh),combos:(t.combos||[]).map(bh)};return e?Object.values(n).flat():n}!function(){function t(t){void 0===t&&(t=10),this.linkedList=new lh,this.maxStep=t}Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map((function(t){return t.value}))},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()}}();const wh=(t,e,n)=>{var r;switch(n.type){case"degree":{const i=new Map;return null===(r=t.nodes)||void 0===r||r.forEach((t=>{const r=e(bh(t),n.direction).length;i.set(bh(t),r)})),i}case"betweenness":return Mh(t,n.directed,n.weightPropertyName);case"closeness":return Sh(t,n.directed,n.weightPropertyName);case"eigenvector":return Oh(t,n.directed);case"pagerank":return Nh(t,n.epsilon,n.linkProb);default:return kh(t)}},kh=t=>{var e;const n=new Map;return null===(e=t.nodes)||void 0===e||e.forEach((t=>{n.set(bh(t),0)})),n},Mh=(t,e,n)=>{const r=kh(t),{nodes:i=[]}=t;return i.forEach((o=>{i.forEach((i=>{if(o!==i){const{allPath:a}=yh(t,bh(o),bh(i),e,n),s=a.length;a.flat().forEach((t=>{t!==bh(o)&&t!==bh(i)&&r.set(t,r.get(t)+1/s)}))}}))})),r},Sh=(t,e,n)=>{const r=new Map,{nodes:i=[]}=t;return i.forEach((o=>{const a=i.reduce(((r,i)=>{if(o!==i){const{length:a}=yh(t,bh(o),bh(i),e,n);r+=a}return r}),0);r.set(bh(o),1/a)})),r},Nh=(t,e,n)=>{var r;const i=new Map,o=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,i=1,o=0,a=1e3,s=t.nodes,l=void 0===s?[]:s,u=t.edges,c=void 0===u?[]:u,h=l.length,d={},f={},p=0;p<h;++p)d[v=(E=l[p]).id]=1/h,f[v]=1/h;for(var g=function(t){var e={},n=t.nodes,r=void 0===n?[]:n,i=t.edges,o=void 0===i?[]:i;return r.forEach((function(t){e[t.id]={degree:0,inDegree:0,outDegree:0}})),o.forEach((function(t){e[t.source].degree++,e[t.source].outDegree++,e[t.target].degree++,e[t.target].inDegree++})),e}(t);a>0&&i>e;){for(o=0,p=0;p<h;++p){var v=(E=l[p]).id;if(r=0,0===g[E.id].inDegree)d[v]=0;else{for(var m=uh(v,c,"source"),y=0;y<m.length;++y){var b=m[y],x=g[b].outDegree;x>0&&(r+=f[b]/x)}d[v]=n*r,o+=d[v]}}for(o=(1-o)/h,i=0,p=0;p<h;++p){var E;r=d[v=(E=l[p]).id]+o,i+=Math.abs(r-f[v]),f[v]=r}a-=1}return f}(t,e,n);return null===(r=t.nodes)||void 0===r||r.forEach((t=>{i.set(bh(t),o[bh(t)])})),i},Oh=(t,e)=>{const{nodes:n=[]}=t,r=Th(t,e),i=Ch(r,n.length),o=new Map;return n.forEach(((t,e)=>{o.set(bh(t),i[e])})),o},Th=(t,e)=>{const{nodes:n=[],edges:r=[]}=t,i=Array(n.length).fill(null).map((()=>Array(n.length).fill(0)));return r.forEach((({source:t,target:r})=>{const o=n.findIndex((e=>bh(e)===t)),a=n.findIndex((t=>bh(t)===r));e?i[o][a]=1:(i[o][a]=1,i[a][o]=1)})),i},Ch=(t,e,n=100,r=1e-6)=>{let i=Array(e).fill(1),o=1/0;for(let a=0;a<n&&o>r;a++){const n=Array(e).fill(0);for(let r=0;r<e;r++)for(let o=0;o<e;o++)n[r]+=t[r][o]*i[o];const r=Math.sqrt(n.reduce(((t,e)=>t+e*e),0));for(let t=0;t<e;t++)n[t]/=r;o=Math.sqrt(n.reduce(((t,e,n)=>t+(e-i[n])*e),0)),i=n}return i};function Ah(t,e,n,r=Ne){const i=new Map(t.map((t=>[n(t),t]))),o=new Map(e.map((t=>[n(t),t]))),a=new Set(i.keys()),s=new Set(o.keys()),l=[],u=[],c=[],h=[];return s.forEach((t=>{a.has(t)?r(i.get(t),o.get(t))?h.push(o.get(t)):u.push(o.get(t)):l.push(o.get(t))})),a.forEach((t=>{s.has(t)||c.push(i.get(t))})),{enter:l,exit:c,keep:h,update:u}}function Ph(t,e,n){t.forEach((t=>{(t=>{n&&!n(t)||(t.style.visibility=e)})(t)}))}class Rh{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=function(t,e,n){const r={},i=t=>(t in r||(r[t]=0),`${e}-${t}-${r[t]++}`);return n.map((e=>"string"==typeof e?{type:e,key:i(e)}:"function"==typeof e?e.call(t):e.key?e:Object.assign(Object.assign({},e),{key:i(e.type)})))}(this.context.graph,this.category,t),{enter:n,update:r,exit:i,keep:o}=Ah(this.extensions,e,(t=>t.key));this.createExtensions(n),this.updateExtensions([...r,...o]),this.destroyExtensions(i),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:r}=t,i=Nc(e,r);if(!i)return Cc(`The extension ${r} of ${e} is not registered.`);const o=new i(this.context,t);this.extensionMap[n]=o}createExtensions(t){t.forEach((t=>this.createExtension(t)))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach((t=>this.updateExtension(t)))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach((({key:t})=>this.destroyExtension(t)))}destroy(){Object.values(this.extensionMap).forEach((t=>t.destroy())),this.context={},this.extensions=[],this.extensionMap={}}}class Dh{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 Lh extends Dh{}class _h extends Lh{constructor(t,e){super(t,Object.assign({},_h.defaultOptions,e)),this.isOverlapping=(t,e)=>e.some((e=>t.intersects(e))),this.occupiedBounds=[],this.detectLabelCollision=t=>{const e=this.context.viewport,n={show:[],hide:[]};return this.occupiedBounds=[],t.forEach((t=>{const r=t.getShape("label").getRenderBounds();e.isInViewport(r,!0)&&!this.isOverlapping(r,this.occupiedBounds)?(n.show.push(t),this.occupiedBounds.push(Jc(r,this.options.padding))):n.hide.push(t)})),n},this.hideLabelIfExceedViewport=(t,e)=>{const{exit:n}=Ah(t,e,(t=>t.id));null==n||n.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(t,e)=>{const{model:n}=this.context,r=n.getData(),i=n.getRelatedEdgesData.bind(n);return t.map((t=>(this.nodeCentralities.has(t.id)||(this.nodeCentralities=wh(r,i,e)),{node:t,centrality:this.nodeCentralities.get(t.id)}))).sort(((t,e)=>e.centrality-t.centrality)).map((t=>t.node))},this.sortLabelElementsInView=t=>{const{sort:e,sortNode:n,sortCombo:r,sortEdge:i}=this.options,{model:o}=this.context;if(Ut(e))return t.sort(((t,n)=>e(o.getElementDataById(t.id),o.getElementDataById(n.id))));const{node:a=[],edge:s=[],combo:l=[]}=ie(t,(t=>t.type)),u=Ut(r)?l.sort(((t,e)=>r(...o.getComboData([t.id,e.id])))):l,c=Ut(n)?a.sort(((t,e)=>n(...o.getNodeData([t.id,e.id])))):this.sortNodesByCentrality(a,n),h=Ut(i)?s.sort(((t,e)=>i(...o.getEdgeData([t.id,e.id])))):s;return[...u,...c,...h]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=t=>{var e;if("zIndex"===(null===(e=t.data)||void 0===e?void 0:e.stage))return;if(!this.validate(t))return void(this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear()));const n=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,n),this.labelElementsInView=n;const r=this.sortLabelElementsInView(this.labelElementsInView),{show:i,hide:o}=this.detectLabelCollision(r);for(let t=i.length-1;t>=0;t--)this.showLabel(i[t]);o.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=t=>{const e=t.getShape("label");e&&Ph(e,"hidden"),this.hiddenElements.set(t.id,t)},this.showLabel=t=>{const e=t.getShape("label");e&&Ph(e,"visible"),t.toFront(),this.hiddenElements.delete(t.id)},this.onTransform=Re(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=t=>{this.enableToggle&&this.onToggleVisibility(t)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=t=>{this.onToggleVisibility(t),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const r=t[n];r.isVisible()&&r.getShape("label")&&e.push(r)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter((e=>t.isInViewport(e.getShape("key").getRenderBounds())))}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.on(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.on(t.GraphEvent.AFTER_DRAW,this.toggle),e.on(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.off(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.off(t.GraphEvent.AFTER_DRAW,this.toggle),e.off(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}_h.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const Ih=[0,0,0];function jh(t,e){return t.map(((t,n)=>t+e[n]))}function Bh(t,e){return t.map(((t,n)=>t-e[n]))}function Fh(t,e){return"number"==typeof e?t.map((t=>t*e)):t.map(((t,n)=>t*e[n]))}function zh(t,e){return"number"==typeof e?t.map((t=>t/e)):t.map(((t,n)=>t/e[n]))}function Gh(t,e){return t.map((t=>t*e))}function Vh(t,e){return Math.sqrt(t.reduce(((t,n,r)=>t+Math.pow(n-e[r]||0,2)),0))}function Wh(t,e){return t.reduce(((t,n,r)=>t+Math.abs(n-e[r])),0)}function Hh(t){const e=t.reduce(((t,e)=>t+Math.pow(e,2)),0);return t.map((t=>t/Math.sqrt(e)))}function Uh(t,e,n=!1){const r=t[0]*e[1]-t[1]*e[0];let i=Math.acos(Fh(t,e).reduce(((t,e)=>t+e),0)/(Vh(t,Ih)*Vh(e,Ih)));return n&&r<0&&(i=2*Math.PI-i),i}function Yh(t,e=!0){return e?[-t[1],t[0]]:[t[1],-t[0]]}function $h(t){return[t[0],t[1]]}function qh(t){return 2===t.length?[t[0],t[1],0]:t}function Xh(t){const[e,n]=t;return e||n?Math.atan2(n,e):0}function Kh(t,e){const[n,r]=t,[i,o]=e;return function(t,e){const n=qh(t),r=qh(e);return[n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]}(Bh(n,r),Bh(i,o)).every((t=>0===t))}function Zh(t,e,n=!1){if(Kh(t,e))return;const[r,i]=t,[o,a]=e,s=((r[0]-o[0])*(o[1]-a[1])-(r[1]-o[1])*(o[0]-a[0]))/((r[0]-i[0])*(o[1]-a[1])-(r[1]-i[1])*(o[0]-a[0])),l=a[0]-o[0]?(r[0]-o[0]+s*(i[0]-r[0]))/(a[0]-o[0]):(r[1]-o[1]+s*(i[1]-r[1]))/(a[1]-o[1]);return n||Uc(s,0,1)&&Uc(l,0,1)?[r[0]+s*(i[0]-r[0]),r[1]+s*(i[1]-r[1])]:void 0}function Qh(t){if(Array.isArray(t))return Uc(t[0],0,1)&&Uc(t[1],0,1)?t:[.5,.5];const e=t.split("-");return[e.includes("left")?0:e.includes("right")?1:.5,e.includes("top")?0:e.includes("bottom")?1:.5]}function Jh(t){const{x:e=0,y:n=0,z:r=0}=t.style||{};return[+e,+n,+r]}function td(t){const{x:e,y:n,z:r}=t.style||{};return void 0!==e||void 0!==n||void 0!==r}function ed(t,e="center"){return function(t,e){const[n,r]=e,{min:i,max:o}=t;return[i[0]+n*(o[0]-i[0]),i[1]+r*(o[1]-i[1])]}(t,Qh(e))}function nd(t){var e;return[t.x,t.y,null!==(e=t.z)&&void 0!==e?e:0]}function rd(t){var e;return{x:t[0],y:t[1],z:null!==(e=t[2])&&void 0!==e?e:0}}function id(t,e=0){return t.map((t=>parseFloat(t.toFixed(e))))}function od(t,e,n,r=!1){if(Ne(t,e))return t;const i=Hh(r?Bh(t,e):Bh(e,t)),o=[i[0]*n,i[1]*n];return jh($h(t),o)}function ad(t,e){return t[1]===e[1]}function sd(t,e,n){return Kh([t,e],[e,n])}function ld(t,e){return[2*e[0]-t[0],2*e[1]-t[1]]}function ud(t,e,n,r=!0,i=!1){for(let o=0;o<n.length;o++){let a=n[o],s=n[(o+1)%n.length];r&&(a=jh(e,a),s=jh(e,s));const l=Zh([e,i?ld(t,e):t],[a,s]);if(l)return{point:l,line:[a,s]}}return{point:e,line:void 0}}function cd(t,e,n=!1){const r=e.center,i=Bh(n?ld(t,r):t,e.center),o=Math.atan2(i[1],i[0]);if(isNaN(o))return r;const a=qc(e)/2,s=Xc(e)/2;return[r[0]+a*Math.cos(o),r[1]+s*Math.sin(o)]}function hd(t,e){let n=1/0,r=[[0,0],[0,0]];return e.forEach((e=>{const i=function(t,e){const n=dd(t,e);return Vh(t,n)}(t,e);i<n&&(n=i,r=e)})),r}function dd(t,e){const[n,r]=e[0],[i,o]=e[1],[a,s]=t,l=i-n,u=o-r;if(0===l&&0===u)return[n,r];let c=((a-n)*l+(s-r)*u)/(l*l+u*u);c>1?c=1:c<0&&(c=0);return[n+c*l,r+c*u]}function fd(t,e=!0){const n=function(t){return zh(t.reduce(((t,e)=>jh(t,e)),[0,0]),t.length)}(t);return t.sort((([t,r],[i,o])=>{const a=Math.atan2(r-n[1],t-n[0]),s=Math.atan2(o-n[1],i-n[0]);return e?s-a:a-s}))}function pd(t,e){return[t,[t[0],e[1]],e,[e[0],t[1]]]}const gd=t=>t.map((t=>ne(t)?t.toLocaleLowerCase():t));class vd{constructor(e){this.map=new Map,this.recordKey=new Set,this.onKeyDown=t=>{(null==t?void 0:t.key)&&(this.recordKey.add(t.key),this.trigger(t))},this.onKeyUp=t=>{(null==t?void 0:t.key)&&this.recordKey.delete(t.key)},this.onWheel=e=>{this.triggerExtendKey(t.CommonEvent.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(t.CommonEvent.DRAG,e)},this.onFocus=()=>{this.recordKey.clear()},this.emitter=e,this.bindEvents()}bind(t,e){0!==t.length&&this.map.set(t,e)}unbind(t,e){this.map.forEach(((n,r)=>{Ne(r,t)&&(e&&e!==n||this.map.delete(r))}))}unbindAll(){this.map.clear()}match(t){const e=gd(Array.from(this.recordKey)).sort(),n=gd(t).sort();return Ne(e,n)}bindEvents(){var e;const{emitter:n}=this;n.on(t.CommonEvent.KEY_DOWN,this.onKeyDown),n.on(t.CommonEvent.KEY_UP,this.onKeyUp),n.on(t.CommonEvent.WHEEL,this.onWheel),n.on(t.CommonEvent.DRAG,this.onDrag),null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach(((e,n)=>{this.match(n)&&e(t)}))}triggerExtendKey(t,e){this.map.forEach(((n,r)=>{r.includes(t)&&Ne(Array.from(this.recordKey),r.filter((e=>e!==t)))&&n(e)}))}destroy(){var e;this.unbindAll(),this.emitter.off(t.CommonEvent.KEY_DOWN,this.onKeyDown),this.emitter.off(t.CommonEvent.KEY_UP,this.onKeyUp),this.emitter.off(t.CommonEvent.WHEEL,this.onWheel),this.emitter.off(t.CommonEvent.DRAG,this.onDrag),null===(e=globalThis.removeEventListener)||void 0===e||e.call(globalThis,"blur",this.onFocus)}}class md extends Lh{constructor(t,e){super(t,ke({},md.defaultOptions,e)),this.shortcut=new vd(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,r=Object.assign({},this.options.style);this.options.style.lineWidth&&(r.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new Kl({id:"g6-brush-select",style:r}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:r}=this.options;this.endPoint=yd(t),null===(e=this.rectShape)||void 0===e||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&"default"===r&&this.updateElementsStates(pd(this.startPoint,this.endPoint))}onPointerUp(t){this.startPoint&&(this.endPoint?(this.endPoint=yd(t),this.updateElementsStates(pd(this.startPoint,this.endPoint)),this.clearBrush()):this.clearBrush())}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce(((t,e)=>Object.assign({},t,e.reduce(((t,e)=>(t[bh(e)]=[],t)),{}))),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:r,mode:i,onSelect:o}=this.options,a=this.selector(e,t,n);let s={};switch(i){case"union":a.forEach((t=>{s[t]=[...e.getElementState(t),r]}));break;case"diff":a.forEach((t=>{const n=e.getElementState(t);s[t]=n.includes(r)?n.filter((t=>t!==r)):[...n,r]}));break;case"intersect":a.forEach((t=>{const n=e.getElementState(t);s[t]=n.includes(r)?[r]:[]}));break;default:a.forEach((t=>{s[t]=[r]}))}Ut(o)&&(s=o(s)),e.setElementState(s,this.options.animation)}selector(t,e,n){if(!n||0===n.length)return[];const r=[],i=t.getData();if(n.forEach((n=>{i[`${n}s`].forEach((n=>{const i=bh(n);"hidden"!==t.getElementVisibility(i)&&function(t,e,n,r){const i=t[0],o=t[1];let a=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);const s=r-n;for(let t=0,r=s-1;t<s;r=t++){const s=e[t+n][0],l=e[t+n][1],u=e[r+n][0],c=e[r+n][1];l>o!=c>o&&i<(u-s)*(o-l)/(c-l)+s&&(a=!a)}return a}(t.getElementPosition(i),e)&&r.push(i)}))})),n.includes("edge")){const t=i.edges;null==t||t.forEach((t=>{const{source:e,target:n}=t;r.includes(e)&&r.includes(n)&&r.push(bh(t))}))}return r}clearBrush(){var t;null===(t=this.rectShape)||void 0===t||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter((t=>"drag"!==t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}bindEvents(){const{graph:e}=this.context;e.on(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.on(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.on(t.CommonEvent.POINTER_UP,this.onPointerUp),e.on(t.CanvasEvent.CLICK,this.clearStates)}unbindEvents(){const{graph:e}=this.context;e.off(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.off(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.off(t.CommonEvent.POINTER_UP,this.onPointerUp),e.off(t.CanvasEvent.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=ke(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}md.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 yd=t=>[t.canvas.x,t.canvas.y],bd=.8,xd=["node","edge","combo"];function Ed(t,e,n,r,i=0){"TB"===r&&e(t,i);const o=n(t);if(o)for(const t of o)Ed(t,e,n,r,i+1);"BT"===r&&e(t,i)}function wd(t,e,n,r,i="both"){if("combo"===e||"node"===e)return kd(t,n,r,i);const o=t.getEdgeData(n);if(!o)return[];const a=kd(t,o.source,r-1,i),s=kd(t,o.target,r-1,i);return Array.from(new Set([...a,...s,n]))}function kd(t,e,n,r="both"){const i=new Set,o=new Set,a=new Set;return function(t,e,n){const r=[[t,0]];for(;r.length;){const[t,i]=r.shift();e(t,i);const o=n(t);if(o)for(const t of o)r.push([t,i+1])}}(e,((e,i)=>{i>n||(a.add(e),t.getRelatedEdgesData(e,r).forEach((t=>{const e=bh(t);!o.has(e)&&i<n&&(a.add(e),o.add(e))})))}),(e=>t.getRelatedEdgesData(e,r).map((t=>t.source===e?t.target:t.source)).filter((t=>!i.has(t)&&(i.add(t),!0))))),Array.from(a)}function Md(t){return t.states||[]}class Sd extends Lh{constructor(t,e){super(t,Object.assign({},Sd.defaultOptions,e)),this.onClickSelect=t=>ze(this,void 0,void 0,(function*(){var e,n;this.validate(t)&&(yield this.updateState(t),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))})),this.onClickCanvas=t=>ze(this,void 0,void 0,(function*(){var e,n;this.validate(t)&&(yield this.clearState(),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))})),this.shortcut=new vd(t.graph),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),xd.forEach((n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)})),e.on(t.CanvasEvent.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:r}=this.context,{degree:i}=this.options;return wd(r,n,e.id,"function"==typeof i?i(t):i).filter((t=>t!==e.id))}updateState(t){return ze(this,void 0,void 0,(function*(){const{state:e,unselectedState:n,neighborState:r,animation:i}=this.options;if(!e&&!r&&!n)return;const{target:o}=t,{graph:a}=this.context,s=Md(a.getElementData(o.id)).includes(e)?"unselect":"select",l={},u=this.isMultipleSelect,c=[o.id],h=this.getNeighborIds(t);if(u)if(Object.assign(l,this.getDataStates()),"select"===s){const t=(t,e)=>{t.forEach((t=>{const r=new Set(a.getElementState(t));r.add(e),r.delete(n),l[t]=Array.from(r)}))};t(c,e),t(h,r),n&&Object.keys(l).forEach((t=>{const i=l[t];i.includes(e)||i.includes(r)||i.includes(n)||l[t].push(n)}))}else{const t=l[o.id];l[o.id]=t.filter((t=>t!==e&&t!==r)),t.includes(n)||l[o.id].push(n),h.forEach((t=>{l[t]=l[t].filter((t=>t!==r)),l[t].includes(e)||l[t].push(n)}))}else if("select"===s){Object.assign(l,this.getClearStates(!!n));const t=(t,e)=>{t.forEach((t=>{l[t]||(l[t]=a.getElementState(t)),l[t].push(e)}))};t(c,e),t(h,r),n&&Object.keys(l).forEach((t=>{c.includes(t)||h.includes(t)||l[t].push(n)}))}else Object.assign(l,this.getClearStates());yield a.setElementState(l,i)}))}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:r}=t.getData(),i={};return[...e,...n,...r].forEach((t=>{i[bh(t)]=Md(t)})),i}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:r,neighborState:i}=this.options,o=new Set([n,r,i]),{nodes:a,edges:s,combos:l}=e.getData(),u={};return[...a,...s,...l].forEach((e=>{const n=Md(e),r=n.filter((t=>!o.has(t)));(t||r.length!==n.length)&&(u[bh(e)]=r)})),u}clearState(){return ze(this,void 0,void 0,(function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)}))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;xd.forEach((n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)})),e.off(t.CanvasEvent.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}function Nd(t){var e;return!!(null===(e=t.style)||void 0===e?void 0:e.collapsed)}function Od(t,e){if(!t.startsWith(e))return!1;const n=t[e.length];return n>="A"&&n<="Z"}function Td(t,e,n=!0){if(!e)return t;if(!Od(t,e))return t;const r=t.slice(e.length);return n?function(t){var e=he(t);return e.charAt(0).toLowerCase()+e.substring(1)}(r):r}function Cd(t,e){const n=Object.entries(t).reduce(((t,[n,r])=>("className"===n||"class"===n||Od(n,e)&&Object.assign(t,{[Td(n,e)]:r}),t)),{});if("opacity"in t){const r=function(t,e){return`${e}${de(t)}`}("opacity",e),i=t.opacity;if(r in t){const e=t[r];Object.assign(n,{opacity:i*e})}else Object.assign(n,{opacity:i})}return n}function Ad(t,e){const n=e.length;return Object.keys(t).reduce(((r,i)=>{if(i.startsWith(e)){r[i.slice(n)]=t[i]}return r}),{})}function Pd(t,e){const n="string"==typeof e?[e]:e,r={};return Object.keys(t).forEach((e=>{n.find((t=>e.startsWith(t)))||(r[e]=t[e])})),r}function Rd(t=0){if("number"==typeof t)return[t,t,t];const[e,n=e,r=e]=t;return[e,n,r]}function Dd(t,e){const{datum:n,graph:r}=e;return"function"==typeof t?t.call(r,n):Object.fromEntries(Object.entries(t).map((([t,e])=>"function"==typeof e?[t,e.call(r,n)]:[t,e])))}function Ld(t,e){const n=(null==t?void 0:t.style)||{},r=(null==e?void 0:e.style)||{};return Object.assign({},t,e,{style:(null==t?void 0:t.style)?Object.assign({},n,r):r})}Sd.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};const _d=new WeakMap;function Id(t,e,n){_d.has(t)||_d.set(t,{});const r=_d.get(t);if(!r[e])return r[e]=n,!0;const i=r[e];return!jd(i,n)&&(r[e]=n,!0)}const jd=(t,e,n=2)=>{if("object"!=typeof t||"object"!=typeof e)return t===e;const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const i of r){const r=t[i],o=e[i];if(n>1&&"object"==typeof r&&"object"==typeof o){if(!jd(r,o,n-1))return!1}else if(r!==o)return!1}return!0};function Bd(t){if(t)return"string"==typeof t||"function"==typeof t||Array.isArray(t)?{type:"group",field:t=>t.id,color:t,invert:!1}:t}function Fd(t){const e="string"==typeof t?Nc("palette",t):t;if("function"!=typeof e)return e}function zd(t,e){let n=2*t;return"string"==typeof e?n=t*Number(e.replace("%",""))/100:"number"==typeof e&&(n=e),isNaN(n)&&(n=2*t),n}function Gd(t,e,n=1,r=!1){const i=r?n:1;return zd((t.max[0]-t.min[0])*i,e)}class Vd extends Il{constructor(t){super(t),this.shapeMap={},this.animateMap={},this.transformPosition(this.attributes),this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(e,n,r,i,o){var a,s,l,u,c,h,d,f;const p=this.shapeMap[e];if(!1===r)return void(p&&(null===(a=null==o?void 0:o.beforeDestroy)||void 0===a||a.call(o,p),i.removeChild(p),delete this.shapeMap[e],null===(s=null==o?void 0:o.afterDestroy)||void 0===s||s.call(o,p)));const g="string"==typeof n?Nc(t.ExtensionCategory.SHAPE,n):n;if(!g)throw new Error(Tc(`Shape ${n} not found`));if(!p||p.destroyed||!(p instanceof g)){p&&(null===(l=null==o?void 0:o.beforeDestroy)||void 0===l||l.call(o,p),null==p||p.destroy(),null===(u=null==o?void 0:o.afterDestroy)||void 0===u||u.call(o,p)),null===(c=null==o?void 0:o.beforeCreate)||void 0===c||c.call(o);const t=new g({className:e,style:r});return i.appendChild(t),this.shapeMap[e]=t,null===(h=null==o?void 0:o.afterCreate)||void 0===h||h.call(o,t),t}return null===(d=null==o?void 0:o.beforeUpdate)||void 0===d||d.call(o,p),Ig(p,r),null===(f=null==o?void 0:o.afterUpdate)||void 0===f||f.call(o,p),p}transformPosition(t){if("x"in t||"y"in t||"z"in t){const{x:e=0,y:n=0,z:r=0,transform:i}=t,o=Ic(+e,+n,+r,i);o&&(this.style.transform=o)}}update(t={}){const e=Object.assign({},this.attributes,t);this.attr(e),this.render(e,this),this.transformPosition(e),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return function(t){return Fe(t,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(0===t.length)return null;const n=[];if(void 0!==t[0].x||void 0!==t[0].y||void 0!==t[0].z){const{x:e=0,y:n=0,z:r=0}=this.attributes;t.forEach((t=>{const{x:i=e,y:o=n,z:a=r}=t;Object.assign(t,{transform:a?[["translate3d",i,o,a]]:[["translate",i,o]]})}))}const r=super.animate(t,e);if(r&&(Wd(this,r),n.push(r)),Array.isArray(t)&&t.length>0){const r=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some((t=>!r.includes(t)))){Object.entries(this.shapeMap).forEach((([r,i])=>{const o=this[`get${de(r)}Style`];if(Ut(o)){const r=t.map((t=>o.call(this,Object.assign(Object.assign({},this.attributes),t)))),a=i.animate(Rc(r),e);a&&(Wd(i,a),n.push(a))}}));const r=(r,i)=>{if(!Se(r)){const o=this[`get${de(i)}Style`];if(Ut(o)){const i=t.map((t=>o.call(this,Object.assign(Object.assign({},this.attributes),t))));Object.entries(i[0]).map((([t])=>{const o=i.map((e=>e[t])),a=r[t];if(a){const t=a.animate(Rc(o),e);t&&(Wd(a,t),n.push(t))}}))}}};this.compositeShapes.forEach((([t,e])=>{const n=Ad(this.shapeMap,e);r(n,t)}))}}return Pc(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Ph(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function Wd(t,e){null==e||e.finished.then((()=>{const n=t.activeAnimations.findIndex((t=>t===e));n>-1&&t.activeAnimations.splice(n,1)}))}class Hd extends Vd{constructor(t){super(Ld({style:Hd.defaultStyleProps},t))}isTextStyle(t){return Od(t,"label")}isBackgroundStyle(t){return Od(t,"background")}getTextStyle(t){return Pd(Fe(this.getGraphicStyle(t),["padding"]),"background")}getBackgroundStyle(t){if(!1===t.background)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:r,padding:i}=e,o=Cd(e,"background"),{min:[a,s],center:[l,u],halfExtents:[c,h]}=this.shapeMap.text.getGeometryBounds(),[d,f,p,g]=Yc(i),v=2*c+g+f,{width:m,height:y}=o;m&&y?Object.assign(o,{x:l-Number(m)/2,y:u-Number(y)/2}):Object.assign(o,{x:a-g,y:s-d,width:n?Math.min(v,r+g+f):v,height:2*h+d+p});const{radius:b}=o;if("string"==typeof b&&b.endsWith("%")){const t=Number(b.replace("%",""))/100;o.radius=Math.min(+o.width,+o.height)*t}return o}render(t=this.parsedAttributes,e=this){this.upsert("text",Ql,this.getTextStyle(t),e),this.upsert("background",Kl,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}Hd.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 Ud extends Vd{constructor(t){super(Ld({style:Ud.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",Hd,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}Ud.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};const Yd={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 $d(t){const e=[],n="string"==typeof t?function(t){const e=t.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),n=[];let r="",i={};for(;e.length>0;){let t=e.shift();t in Yd?r=t:e.unshift(t),i={type:r},Yd[r].forEach((n=>{t=e.shift(),i[n]=t})),"M"===r?r="L":"m"===r&&(r="l");const[o,...a]=Object.values(i);n.push([o,...a.map(Number)])}return n}(t):t;return n.forEach((t=>{const n=t[0];if("Z"!==n)if("A"!==n)for(let n=1;n<t.length;n+=2)e.push([t[n],t[n+1],0]);else{const n=t.length;e.push([t[n-2],t[n-1],0])}else e.push(e[0])})),e}const qd=t=>{if(t.length<2)return[["M",0,0],["L",0,0]];const e=t[0],n=t[1],r=t[t.length-1],i=t[t.length-2];t.unshift(i,r),t.push(e,n);const o=[["M",r[0],r[1]]];for(let e=1;e<t.length-2;e+=1){const[n,r]=t[e-1],[i,a]=t[e],[s,l]=t[e+1],[u,c]=e!==t.length-2?t[e+2]:[s,l],h=i+(s-n)/6,d=a+(l-r)/6,f=s-(u-i)/6,p=l-(c-a)/6;o.push(["C",h,d,f,p,s,l])}return o};class Xd extends Vd{constructor(t){super(Ld({style:Xd.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||0===t.d.length)return!1;const e=Cd(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:r,offsetY:i,autoRotate:o,placement:a,closeToPath:s}=e,l=Fe(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),u=this.shapeMap.key,c=null==u?void 0:u.getRenderBounds();return Object.assign(function(t,e,n,r,i,o,a){const[s,l]=ed(t,e),u={textAlign:"left"===e?"right":"right"===e?"left":"center",textBaseline:"top"===e?"bottom":"bottom"===e?"top":"middle",transform:[["translate",s+n,l+r]]};if("center"===e||!i)return u;const c=$d(o);if(!c||c.length<=3)return u;const h=c.map(((t,e)=>{const n=t,r=c[(e+1)%c.length];return Ne(n,r)?null:[n,r]})).filter(Boolean),d=hd([s,l],h),f=dd([s,l],d);if(f&&d&&(u.transform=[["translate",f[0]+n,f[1]+r]],a)){const t=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));u.transform.push(["rotate",t/Math.PI*180]),u.textAlign="center","right"!==e&&"left"!==e||(u.textBaseline=t>0?"right"===e?"bottom":"top":"right"===e?"top":"bottom")}return u}(c,a,r,i,s,t.d,o),{wordWrapWidth:Gd(c,n)},l)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",Ul,this.getKeyStyle(t),e),this.upsert("label",Hd,this.getLabelStyle(t),e)}}Xd.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};let Kd=class extends Gl{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Qd=this,this.isMutationObserved=!0,this.addEventListener(Ws.MOUNTED,this.onMounted),this.addEventListener(Ws.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:r=0}=this.attributes;if(t&&n&&r){const[i,o]=this.getBounds().min,a={x:i,y:o,radius:t,width:n,height:r};if(e)Object.assign(this.parsedStyle.clipPath.style,a);else{const t=new Kl({style:a});this.style.clipPath=t}}else e&&(this.style.clipPath=null)}};const Zd=new WeakMap;let Qd=null;const Jd=t=>{if(Qd&&function(t){const e=[];let n=t.parentNode;for(;n;)e.push(n),n=n.parentNode;return e}(Qd).includes(t)){const e=Zd.get(t);e?e.includes(Qd)||e.push(Qd):Zd.set(t,[Qd])}},tf=t=>{const e=Zd.get(t);e&&e.forEach((t=>t.handleRadius()))};class ef extends Vd{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,r=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},r):Object.assign({textBaseline:"middle",textAlign:"center"},r)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?Kd:Ql,this.getIconStyle(t),e)}}class nf extends Vd{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then((()=>this.onframe()))),n}}class rf extends nf{constructor(t){super(Ld({style:rf.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return Rd(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(Pd(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(!1===t.label||!t.labelText)return!1;const e=Cd(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:r,offsetX:i,offsetY:o}=e,a=Fe(e,["placement","maxWidth","offsetX","offsetY"]),s=this.getShape("key").getLocalBounds();return Object.assign(_g(s,n,i,o),{wordWrapWidth:Gd(s,r)},a)}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getKeyStyle(t),{fill:n}=e,r=Fe(e,["fill"]),i=Cd(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},r),{stroke:n}),i)}getIconStyle(t){if(!1===t.icon||!t.iconText&&!t.iconSrc)return!1;const e=Cd(this.getGraphicStyle(t),"icon");return Object.assign(function(t,e){const n=Rd(t);let r={};return e.text&&!e.fontSize&&(r={fontSize:.5*Math.min(...n)}),!e.src||e.width&&e.height||(r={width:.5*n[0],height:.5*n[1]}),r}(t.size,e),e)}getBadgesStyle(t){var e;const n=Ad(this.shapeMap,"badge-"),r={};if(Object.keys(n).forEach((t=>{r[t]=!1})),!1===t.badge||!(null===(e=t.badges)||void 0===e?void 0:e.length))return r;const{badges:i=[],badgePalette:o,opacity:a=1}=t,s=Fe(t,["badges","badgePalette","opacity"]),l=Fd(o),u=Cd(this.getGraphicStyle(s),"badge");return i.forEach(((t,e)=>{r[e]=Object.assign(Object.assign({backgroundFill:l?l[e%(null==l?void 0:l.length)]:void 0,opacity:a},u),this.getBadgeStyle(t))})),r}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:r,offsetY:i}=t,o=Fe(t,["placement","offsetX","offsetY"]),a=_g(e.getLocalBounds(),n,r,i,!0);return Object.assign(Object.assign({},a),o)}getPortsStyle(t){var e;const n=this.getPorts(),r={};if(Object.keys(n).forEach((t=>{r[t]=!1})),!1===t.port||!(null===(e=t.ports)||void 0===e?void 0:e.length))return r;const i=Cd(this.getGraphicStyle(t),"port"),{ports:o=[]}=t;return o.forEach(((e,n)=>{const o=e.key||n,a=Object.assign(Object.assign({},i),e);if(Cg(a))r[o]=!1;else{const[n,i]=this.getPortXY(t,e);r[o]=Object.assign({transform:[["translate",n,i]]},a)}})),r}getPortXY(t,e){const{placement:n="left"}=e,r=this.getShape("key");return Og(function(t,e){if(!t)return e.getLocalBounds();const n=t.canvas.getLayer(),r=e.cloneNode();Ph(r,"hidden"),n.appendChild(r);const i=r.getLocalBounds();return r.destroy(),i}(this.context,r),n)}getPorts(){return Ad(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){return function(t,e,n=!1){return ud(t,ed(e,"center"),[ed(e,"left-top"),ed(e,"right-top"),ed(e,"right-bottom"),ed(e,"left-bottom")],!1,n).point}(t,this.getShape("key").getBounds(),e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);if(!Id(this,"halo",n))return;const r=this.getShape("key");this.upsert("halo",r.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);Id(this,"icon",n)&&(this.upsert("icon",ef,n,e),Jd(this))}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach((t=>{const r=n[t];Id(this,`badge-${t}`,r)&&this.upsert(`badge-${t}`,Ud,r,e)}))}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach((t=>{const r=n[t],i=`port-${t}`;Id(this,i,r)&&this.upsert(i,Ll,r,e)}))}drawLabelShape(t,e){const n=this.getLabelStyle(t);Id(this,"label",n)&&this.upsert("label",Hd,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)&&tf(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}rf.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};let of=class t extends rf{constructor(e){super(Ld({style:t.defaultStyleProps},e))}drawKeyShape(t,e){return this.upsert("key",Ll,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,r=2*n*bd;return!!e&&Object.assign({width:r,height:r},e)}getIntersectPoint(t,e=!1){return cd(t,this.getShape("key").getBounds(),e)}};of.defaultStyleProps={size:32};class af extends rf{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",$l,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,r;const{points:i}=this.getShape("key").attributes;return ud(t,[+((null===(n=this.attributes)||void 0===n?void 0:n.x)||0),+((null===(r=this.attributes)||void 0===r?void 0:r.y)||0)],i,!0,e).point}}class sf extends af{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return function(t,e){return[[0,-e/2],[t/2,0],[0,e/2],[-t/2,0]]}(e,n)}}class lf extends of{constructor(t){super(Ld({style:lf.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...Rd(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return ne(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(null==n?void 0:n.length))return;const r=n.map((t=>ae(t)?{value:t}:t)),i=Cd(this.getGraphicStyle(t),"donut"),o=Fd(t.donutPalette);if(!o)return;const a=r.reduce(((t,e)=>{var n;return t+(null!==(n=e.value)&&void 0!==n?n:0)}),0),s=this.parseOuterR(),l=this.parseInnerR();let u=0;r.forEach(((t,n)=>{const{value:c=0,color:h=o[n%o.length]}=t,d=Fe(t,["value","color"]),f=360*(0===a?1/r.length:c/a);this.upsert(`round${n}`,Ul,Object.assign(Object.assign(Object.assign({},i),{d:cf(s,l,u,u+f),fill:h}),d),e),u+=f}))}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}lf.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const uf=(t,e,n,r)=>[t+Math.sin(r)*n,e-Math.cos(r)*n],cf=(t=0,e=0,n,r)=>{const[i,o]=[0,0];return Math.abs(n-r)%360<1e-6?((t,e,n,r)=>r<=0||n<=r?[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"]]:[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"],["M",t+r,e],["A",r,r,0,1,0,t-r,e],["A",r,r,0,1,0,t+r,e],["Z"]])(i,o,t,e):((t,e,n,r,i,o)=>{const[a,s]=[i/360*2*Math.PI,o/360*2*Math.PI],l=[uf(t,e,r,a),uf(t,e,n,a),uf(t,e,n,s),uf(t,e,r,s)],u=s-a>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",n,n,0,u,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",r,r,0,u,0,l[0][0],l[0][1]],["Z"]]})(i,o,t,e,n,r)};class hf extends rf{constructor(t){super(Ld({style:hf.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",jl,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:r/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:r}=this.getShape("key").attributes,i=2*Math.min(+n,+r)*bd;return!!e&&Object.assign({width:i,height:i},e)}getIntersectPoint(t,e=!1){return cd(t,this.getShape("key").getBounds(),e)}}hf.defaultStyleProps={size:[45,35]};class df extends af{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return[[0,e=this.getOuterR(t)],[e*Math.sqrt(3)/2,e/2],[e*Math.sqrt(3)/2,-e/2],[0,-e],[-e*Math.sqrt(3)/2,-e/2],[-e*Math.sqrt(3)/2,e/2]];var e}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*bd;return!!e&&Object.assign({width:n,height:n},e)}}
19
19
  /*!
20
20
  * @antv/g-plugin-canvas-path-generator
21
21
  * @description A G plugin of path generator with Canvas2D API
@@ -68,7 +68,7 @@ var pu=function(t){function e(t,n,r,i){var o;return s(this,e),(o=v(this,e,[t])).
68
68
  * @license
69
69
  * Copyright 2019 Google LLC
70
70
  * SPDX-License-Identifier: Apache-2.0
71
- */const Aj=Symbol("Comlink.proxy"),Pj=Symbol("Comlink.endpoint"),Rj=Symbol("Comlink.releaseProxy"),Dj=Symbol("Comlink.finalizer"),Lj=Symbol("Comlink.thrown"),_j=t=>"object"==typeof t&&null!==t||"function"==typeof t,Ij=new Map([["proxy",{canHandle:t=>_j(t)&&t[Aj],serialize(t){const{port1:e,port2:n}=new MessageChannel;return jj(t,e),[n,[n]]},deserialize:t=>(t.start(),Fj(t))}],["throw",{canHandle:t=>_j(t)&&Lj in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function jj(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(qj);let u;try{const e=s.slice(0,-1).reduce(((t,e)=>t[e]),t),n=s.reduce(((t,e)=>t[e]),t);switch(a){case"GET":u=n;break;case"SET":e[s.slice(-1)[0]]=qj(i.data.value),u=!0;break;case"APPLY":u=n.apply(e,l);break;case"CONSTRUCT":u=function(t){return Object.assign(t,{[Aj]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;jj(t,n),u=function(t,e){return Yj.set(t,e),t}(e,[e])}break;case"RELEASE":u=void 0;break;default:return}}catch(t){u={value:t,[Lj]:0}}Promise.resolve(u).catch((t=>({value:t,[Lj]:0}))).then((n=>{const[i,s]=$j(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),Bj(e),Dj in t&&"function"==typeof t[Dj]&&t[Dj]())})).catch((t=>{const[n,r]=$j({value:new TypeError("Unserializable return value"),[Lj]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function Bj(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function Fj(t,e){const n=new Map;return t.addEventListener("message",(function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}})),Hj(t,n,[],e)}function zj(t){if(t)throw new Error("Proxy has been released and is not useable")}function Gj(t){return Xj(t,new Map,{type:"RELEASE"}).then((()=>{Bj(t)}))}const Vj=new WeakMap,Wj="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(Vj.get(t)||0)-1;Vj.set(t,e),0===e&&Gj(t)}));function Hj(t,e,n=[],r=function(){}){let i=!1;const o=new Proxy(r,{get(r,a){if(zj(i),a===Rj)return()=>{!function(t){Wj&&Wj.unregister(t)}(o),Gj(t),e.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const r=Xj(t,e,{type:"GET",path:n.map((t=>t.toString()))}).then(qj);return r.then.bind(r)}return Hj(t,e,[...n,a])},set(r,o,a){zj(i);const[s,l]=$j(a);return Xj(t,e,{type:"SET",path:[...n,o].map((t=>t.toString())),value:s},l).then(qj)},apply(r,o,a){zj(i);const s=n[n.length-1];if(s===Pj)return Xj(t,e,{type:"ENDPOINT"}).then(qj);if("bind"===s)return Hj(t,e,n.slice(0,-1));const[l,u]=Uj(a);return Xj(t,e,{type:"APPLY",path:n.map((t=>t.toString())),argumentList:l},u).then(qj)},construct(r,o){zj(i);const[a,s]=Uj(o);return Xj(t,e,{type:"CONSTRUCT",path:n.map((t=>t.toString())),argumentList:a},s).then(qj)}});return function(t,e){const n=(Vj.get(e)||0)+1;Vj.set(e,n),Wj&&Wj.register(t,e,t)}(o,t),o}function Uj(t){const e=t.map($j);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const Yj=new WeakMap;function $j(t){for(const[e,n]of Ij)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},Yj.get(t)||[]]}function qj(t){switch(t.type){case"HANDLER":return Ij.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Xj(t,e,n,r){return new Promise((i=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.set(o,i),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)}))}class Kj extends Wg{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=Fj(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return ze(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=Fe(this.layout.options,["onTick"]),n={};Object.keys(e).forEach((t=>{Ut(e[t])||(n[t]=e[t])}));const r={layout:{id:this.layout.id,options:n,iterations:null===(t=this.options)||void 0===t?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},i=new Float32Array([0]),[o]=yield this.proxy.calculateLayout(r,[i]);return o}))}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[Rj]()}isRunning(){return this.running}}class Zj extends Dh{}function Qj(t,e=!0,n){const r=document.createElement("div");return r.setAttribute("class",`g6-${t}`),Object.assign(r.style,{position:"absolute",display:"block"}),e&&Object.assign(r.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),n&&Object.assign(r.style,n),r}function Jj(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const a=document.createElement(e);return a.innerHTML=r,a.id=t,Object.assign(a.style,n),i.appendChild(a),a}class tB extends Zj{constructor(t,e){super(t,Object.assign({},tB.defaultOptions,e)),this.$element=Qj("background");this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return ze(this,void 0,void 0,(function*(){e.update.call(this,t),Object.assign(this.$element.style,Pe(this.options,["key","type"]))}))}destroy(){super.destroy(),this.$element.remove()}}function eB(t,e,n,r,i,o){const a=n-t,s=r-e;let l=i-t,u=o-e,c=l*a+u*s,h=0;c<=0?h=0:(l=a-l,u=s-u,c=l*a+u*s,h=c<=0?0:c*c/(a*a+s*s));const d=l*l+u*u-h;return d<0?0:d}function nB(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)}function rB(t,e,n,r,i){return nB(t,e,n,r)<i*i}function iB(t){const e=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2);return{x:e,y:r,x2:n,y2:i,width:n-e,height:i-r}}tB.defaultOptions={transition:"background 0.5s",backgroundSize:"cover"};class oB{constructor(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new oB(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2)return!1;if(e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2)return!1;if(t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;return t<=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1)}distSquare(t,e){return eB(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 aB,sB;!function(t){t[t.POINT=1]="POINT",t[t.PARALLEL=2]="PARALLEL",t[t.COINCIDENT=3]="COINCIDENT",t[t.NONE=4]="NONE"}(aB||(aB={}));class lB{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function uB(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const e=n/i,o=r/i;return 0<=e&&e<=1&&0<=o&&o<=1?new lB(aB.POINT,t.x1+e*(t.x2-t.x1),t.y1+e*(t.y2-t.y1)):new lB(aB.NONE)}return new lB(0===n||0===r?aB.COINCIDENT:aB.PARALLEL)}function cB(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const t=n/i,e=r/i;if(0<=t&&t<=1&&0<=e&&e<=1)return t}return Number.POSITIVE_INFINITY}function hB(t,e,n){const r=new Set;return t.width<=0?(r.add(sB.LEFT),r.add(sB.RIGHT)):e<t.x?r.add(sB.LEFT):e>t.x+t.width&&r.add(sB.RIGHT),t.height<=0?(r.add(sB.TOP),r.add(sB.BOTTOM)):n<t.y?r.add(sB.TOP):n>t.y+t.height&&r.add(sB.BOTTOM),r}function dB(t,e){let n=e.x1,r=e.y1;const i=e.x2,o=e.y2,a=Array.from(hB(t,i,o));if(0===a.length)return!0;let s=hB(t,n,r);for(;0!==s.size;){for(const t of a)if(s.has(t))return!1;if(s.has(sB.RIGHT)||s.has(sB.LEFT)){let e=t.x;s.has(sB.RIGHT)&&(e+=t.width),r+=(e-n)*(o-r)/(i-n),n=e}else{let e=t.y;s.has(sB.BOTTOM)&&(e+=t.height),n+=(e-r)*(i-n)/(o-r),r=e}s=hB(t,n,r)}return!0}function fB(t,e){let n=Number.POSITIVE_INFINITY,r=0;function i(t,i,o,a){let s=cB(e,new oB(t,i,o,a));s=Math.abs(s-.5),s>=0&&s<=1&&(r++,s<n&&(n=s))}return i(t.x,t.y,t.x2,t.y),i(t.x,t.y,t.x,t.y2),r>1?n:(i(t.x,t.y2,t.x2,t.y2),r>1?n:(i(t.x2,t.y,t.x2,t.y2),0===r?-1:n))}function pB(t,e){let n=0;const r=uB(t,new oB(e.x,e.y,e.x2,e.y));n+=r.state===aB.POINT?1:0;const i=uB(t,new oB(e.x,e.y,e.x,e.y2));n+=i.state===aB.POINT?1:0;const o=uB(t,new oB(e.x,e.y2,e.x2,e.y2));n+=o.state===aB.POINT?1:0;const a=uB(t,new oB(e.x2,e.y,e.x2,e.y2));return n+=a.state===aB.POINT?1:0,{top:r,left:i,bottom:o,right:a,count:n}}!function(t){t[t.LEFT=0]="LEFT",t[t.TOP=1]="TOP",t[t.RIGHT=2]="RIGHT",t[t.BOTTOM=3]="BOTTOM"}(sB||(sB={}));class gB{constructor(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new gB(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 gB(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x+t.width),i=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=r-e,this.height=i-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x),i=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=r-e,this.height=i-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return!(this.area<=0||t.width<=0||t.height<=0)&&(t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2)}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=hB(this,t,e);return n.has(sB.TOP)?n.has(sB.LEFT)?nB(t,e,this.x,this.y):n.has(sB.RIGHT)?nB(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(sB.BOTTOM)?n.has(sB.LEFT)?nB(t,e,this.x,this.y2):n.has(sB.RIGHT)?nB(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(sB.LEFT)?(this.x-t)*(this.x-t):n.has(sB.RIGHT)?(t-this.x2)*(t-this.x2):0}}class vB{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return 2*this.radius}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return 2*this.radius}static from(t){return new vB(t.cx,t.cy,t.radius)}containsPt(t,e){return nB(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=nB(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const r=Math.sqrt(n)-this.radius;return r*r}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,2*Math.PI)}}class mB{constructor(t,e=0,n=0,r=0,i=0,o=10,a=10,s=new Float32Array(Math.max(0,o*a)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=r,this.pixelY=i,this.width=o,this.height=a,this.area=s}createSub(t,e){return new mB(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new mB(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new mB(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),r=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),i=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup));return new gB(e,n,r-e,i-n)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),r=this.boundX(t.x-n),i=this.boundY(t.y-n),o=this.boundX(t.x2+n),a=this.boundY(t.y2+n);return new gB(r,i,o-r,a-i)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||0===e)return;const n=this.width,r=t.width,i=Math.max(0,t.i),o=Math.max(0,t.j),a=Math.min(t.i+t.width,n),s=Math.min(t.j+t.height,this.height);if(!(s<=0||a<=0||i>=n||s>=this.height))for(let l=o;l<s;l++){const o=(l-t.j)*r,s=l*n;for(let n=i;n<a;n++){const r=t.area[n-t.i+o];0!==r&&(this.area[n+s]+=e*r)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let r=0;r<t.height;r++){const i=n+r*this.width;this.area.fill(e,i,i+t.width)}}fillHorizontalLine(t,e,n,r){const i=t+e*this.width;this.area.fill(r,i,i+n)}fillVerticalLine(t,e,n,r){const i=t+e*this.width;for(let t=0;t<n;t++)this.area[i+t*this.width]=r}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let e=0;e<this.width;e++){t+=this.area[n+e].toFixed(1).padStart(6),t+=" "}t+="\n"}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce(((t,e)=>Math.min(t,e)),Number.POSITIVE_INFINITY),r=this.area.reduce(((t,e)=>Math.max(t,e)),Number.NEGATIVE_INFINITY),i=t=>(t-n)/(r-n);t.scale(this.pixelGroup,this.pixelGroup);for(let e=0;e<this.width;e++)for(let n=0;n<this.height;n++){const r=this.area[e+n*this.width];t.fillStyle=`rgba(0, 0, 0, ${i(r)})`,t.fillRect(e,n,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let n=0;n<this.width;n++)for(let r=0;r<this.height;r++){const i=this.area[n+r*this.width];t.fillStyle=i>e?"black":"white",t.fillRect(n,r,1,1)}t.restore()}}}function yB(t,e){const n=t=>({x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e});return Array.isArray(t)?t.map(n):n(t)}function bB(t,e,n){return xB(Object.assign(iB(t),{distSquare:(e,n)=>eB(t.x1,t.y1,t.x2,t.y2,e,n)}),e,n)}function xB(t,e,n){const r=yB(t,n),i=e.scale(r),o=e.createSub(i,r);return function(t,e,n,r){const i=n*n;for(let o=0;o<t.height;o++)for(let a=0;a<t.width;a++){const s=r(e.invertScaleX(t.i+a),e.invertScaleY(t.j+o));if(0!==s){if(s<i){const e=n-Math.sqrt(s);t.set(a,o,e*e)}}else t.set(a,o,i)}}(o,e,n,((e,n)=>t.distSquare(e,n))),o}function EB(t,e){return{x:t,y:e}}function wB(t,e,n,r){if(0===t.length)return[];const i=function(t){if(t.length<2)return t;let e=0,n=0;return t.forEach((t=>{e+=t.cx,n+=t.cy})),e/=t.length,n/=t.length,t.map((t=>{const r=e-t.cx,i=n-t.cy;return[t,r*r+i*i]})).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]))}(t);return i.map(((t,o)=>{const a=i.slice(0,o);return function(t,e,n,r,i){const o=EB(e.cx,e.cy),a=function(t,e,n){let r=Number.POSITIVE_INFINITY;return e.reduce(((e,i)=>{const o=nB(t.x,t.y,i.cx,i.cy);if(o>r)return e;const a=new oB(t.x,t.y,i.cx,i.cy),s=function(t,e){return t.reduce(((t,n)=>dB(n,e)&&function(t,e){function n(t,n,r,i){let o=cB(e,new oB(t,n,r,i));return o=Math.abs(o-.5),o>=0&&o<=1?1:0}let r=n(t.x,t.y,t.x2,t.y);return r+=n(t.x,t.y,t.x,t.y2),r>1||(r+=n(t.x,t.y2,t.x2,t.y2),r>1||(r+=n(t.x2,t.y,t.x2,t.y2),r>0))}(n,e)?t+1:t),0)}(n,a);return o*(s+1)*(s+1)<r&&(e=i,r=o*(s+1)*(s+1)),e}),null)}(o,n,t);if(null==a)return[];const s=function(t,e,n,r){const i=[],o=[];o.push(t);let a=!0;for(let t=0;t<n&&a;t++)for(a=!1;!a&&o.length>0;){const t=o.pop(),n=SB(e,t),s=n?pB(t,n):null;if(!n||!s||2!==s.count){a||i.push(t);continue}let l=r,u=NB(n,l,s,!0),c=MB(u,o)||MB(u,i),h=kB(u,e);for(;!c&&h&&l>=1;)l/=1.5,u=NB(n,l,s,!0),c=MB(u,o)||MB(u,i),h=kB(u,e);if(!u||c||h||(o.push(new oB(t.x1,t.y1,u.x,u.y)),o.push(new oB(u.x,u.y,t.x2,t.y2)),a=!0),a)continue;l=r,u=NB(n,l,s,!1);let d=MB(u,o)||MB(u,i);for(h=kB(u,e);!d&&h&&l>=1;)l/=1.5,u=NB(n,l,s,!1),d=MB(u,o)||MB(u,i),h=kB(u,e);u&&!d&&(o.push(new oB(t.x1,t.y1,u.x,u.y)),o.push(new oB(u.x,u.y,t.x2,t.y2)),a=!0),a||i.push(t)}for(;o.length>0;)i.push(o.pop());return i}(new oB(o.x,o.y,a.cx,a.cy),t,r,i);return function(t,e){const n=[];for(;t.length>0;){const r=t.pop();if(0===t.length){n.push(r);break}const i=t.pop(),o=new oB(r.x1,r.y1,i.x2,i.y2);SB(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(s,t)}(e,t,a,n,r)})).flat()}function kB(t,e){return e.some((e=>e.containsPt(t.x,t.y)))}function MB(t,e){return e.some((e=>!!rB(e.x1,e.y1,t.x,t.y,.001)||!!rB(e.x2,e.y2,t.x,t.y,.001)))}function SB(t,e){let n=Number.POSITIVE_INFINITY,r=null;for(const i of t){if(!dB(i,e))continue;const t=fB(i,e);t>=0&&t<n&&(r=i,n=t)}return r}function NB(t,e,n,r){const i=n.top,o=n.left,a=n.bottom,s=n.right;if(r){if(o.state===aB.POINT){if(i.state===aB.POINT)return EB(t.x-e,t.y-e);if(a.state===aB.POINT)return EB(t.x-e,t.y2+e);const n=t.width*t.height;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?EB(t.x-e,t.y-e):EB(t.x2+e,t.y-e):o.y<s.y?EB(t.x-e,t.y2+e):EB(t.x2+e,t.y2+e)}if(s.state===aB.POINT){if(i.state===aB.POINT)return EB(t.x2+e,t.y-e);if(a.state===aB.POINT)return EB(t.x2+e,t.y2+e)}const n=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*n?i.x>a.x?EB(t.x-e,t.y-e):EB(t.x-e,t.y2+e):i.x<a.x?EB(t.x2+e,t.y-e):EB(t.x2+e,t.y2+e)}if(o.state===aB.POINT){if(i.state===aB.POINT)return EB(t.x2+e,t.y2+e);if(a.state===aB.POINT)return EB(t.x2+e,t.y-e);const n=t.height*t.width;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?EB(t.x2+e,t.y2+e):EB(t.x-e,t.y2+e):o.y<s.y?EB(t.x2+e,t.y-e):EB(t.x-e,t.y-e)}if(s.state===aB.POINT){if(i.state===aB.POINT)return EB(t.x-e,t.y2+e);if(a.state===aB.POINT)return EB(t.x-e,t.y-e)}const l=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*l?i.x>a.x?EB(t.x2+e,t.y2+e):EB(t.x2+e,t.y-e):i.x<a.x?EB(t.x-e,t.y2+e):EB(t.x-e,t.y-e)}function OB(t,e,n,r){if(!(t.closed?n<t.length:n<t.length-1))return!1;const i=t.get(e),o=t.get(n+1);for(let a=e+1;a<=n;a++){const e=t.get(a);if(eB(i.x,i.y,o.x,o.y,e.x,e.y)>r)return!1}return!0}function TB(t,e){switch(t){case-2:return(((3-e)*e-3)*e+1)/6;case-1:return((3*e-6)*e*e+4)/6;case 0:return(((-3*e+3)*e+3)*e+1)/6;case 1:return e*e*e/6;default:throw new Error("unknown error")}}class CB{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(0===e.length)return"";const n="function"==typeof t?t:function(t){if(!Number.isFinite(t))return t=>t;if(0===t)return Math.round;const e=Math.pow(10,t);return t=>Math.round(t*e)/e}(t);let r="M";for(const t of e)r+=`${n(t.x)},${n(t.y)} L`;return r=r.slice(0,-1),this.closed&&(r+=" Z"),r}draw(t){const e=this.points;if(0!==e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return function(t=8){return e=>{let n=t,r=e.length;if(n>1)for(r=Math.floor(e.length/n);r<3&&n>1;)n-=1,r=Math.floor(e.length/n);const i=[];for(let t=0,o=0;o<r;o++,t+=n)i.push(e.get(t));return new CB(i)}}(t)(this)}simplify(t){return function(t=0){return e=>{if(t<0||e.length<3)return e;const n=[];let r=0;const i=t*t;for(;r<e.length;){let t=r+1;for(;OB(e,r,t,i);)t++;n.push(e.get(r)),r=t}return new CB(n)}}(t)(this)}bSplines(t){return function(t=6){function e(t,e,n){let r=0,i=0;for(let o=-2;o<=1;o++){const a=t.get(e+o),s=TB(o,n);r+=s*a.x,i+=s*a.y}return{x:r,y:i}}return n=>{if(n.length<3)return n;const r=[],i=n.closed,o=n.length+3-1+(i?0:2);r.push(e(n,2-(i?0:2),0));for(let a=2-(i?0:2);a<o;a++)for(let i=1;i<=t;i++)r.push(e(n,a,i/t));return new CB(r)}}(t)(this)}apply(t){return t(this)}containsElements(t){const e=function(t){if(0===t.length)return null;const e=t[0],n=new gB(e.x,e.y,0,0);for(const e of t)n.addPoint(e);return n}(this.points);return!!e&&t.every((t=>e.containsPt(t.cx,t.cy)&&this.withinArea(t.cx,t.cy)))}withinArea(t,e){if(0===this.length)return!1;let n=0;const r=this.points[0],i=new oB(r.x,r.y,r.x,r.y);for(let r=1;r<this.points.length;r++){const o=this.points[r];i.x1=i.x2,i.y1=i.y2,i.x2=o.x,i.y2=o.y,i.cuts(t,e)&&n++}return i.x1=i.x2,i.y1=i.y2,i.x2=r.x,i.y2=r.y,i.cuts(t,e)&&n++,n%2==1}}class AB{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(0===this.count)return!1;const e=this.arr[0];return null!=e&&e.x===t.x&&e.y===t.y}path(){return new CB(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}function PB(t,e){const n=2*(Math.floor(t.width)+Math.floor(t.height)),r=new AB(n);function i(n,r,i,o){const a=t.get(n,r);return Number.isNaN(a)?Number.NaN:a>e?i+o:i}function o(t,e){let n=0;return n=i(t,e,n,1),n=i(t+1,e,n,2),n=i(t,e+1,n,4),n=i(t+1,e+1,n,8),Number.isNaN(n)?-1:n}let a=1;function s(e,n){let i=e,s=n,l=t.invertScaleX(i),u=t.invertScaleY(s);for(let e=0;e<t.width*t.height;e++){const e={x:l,y:u};if(r.contains(e)){if(r.isFirst(e))return!0}else r.add(e);const n=o(i,s);switch(n){case-1:return!0;case 0:case 3:case 2:case 7:a=2;break;case 12:case 14:case 4:a=3;break;case 6:a=0===a?3:2;break;case 1:case 13:case 5:a=0;break;case 9:a=2===a?0:1;break;case 10:case 8:case 11:a=1;break;default:return console.warn("Marching squares invalid state: "+n),!0}switch(a){case 0:s--,u-=t.pixelGroup;break;case 1:s++,u+=t.pixelGroup;break;case 3:i--,l-=t.pixelGroup;break;case 2:i++,l+=t.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+n),!0}}return!0}for(let n=0;n<t.width;n++)for(let i=0;i<t.height;i++){if(t.get(n,i)<=e)continue;const a=o(n,i);if(!(a<0||15===a)&&s(n,i))return r.path()}return null}const RB={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 DB(t){return null!=t&&"number"==typeof t.radius}function LB(t,e){if(DB(t)!==DB(e))return!1;if(DB(t)){const n=e;return t.cx===n.cx&&t.cy===n.cy&&t.radius===n.radius}const n=e;return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}var _B;!function(t){t[t.MEMBERS=0]="MEMBERS",t[t.NON_MEMBERS=1]="NON_MEMBERS",t[t.EDGES=2]="EDGES"}(_B||(_B={}));let IB=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new gB(0,0,0,0),this.potentialArea=new mB(1,0,0,0,0,0,0),this.o=Object.assign({},RB,t)}pushMember(...t){if(0!==t.length){this.dirty.add(_B.MEMBERS);for(const e of t)this.members.push({raw:e,obj:DB(e)?vB.from(e):gB.from(e),area:null})}}removeMember(t){const e=this.members.findIndex((e=>LB(e.raw,t)));return!(e<0)&&(this.members.splice(e,1),this.dirty.add(_B.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex((e=>LB(e.raw,t)));return!(e<0)&&(this.nonMembers.splice(e,1),this.dirty.add(_B.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex((e=>e.obj.equals(t)));return!(e<0)&&(this.edges.splice(e,1),this.dirty.add(_B.NON_MEMBERS),!0)}pushNonMember(...t){if(0!==t.length){this.dirty.add(_B.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:DB(e)?vB.from(e):gB.from(e),area:null})}}pushEdge(...t){if(0!==t.length){this.dirty.add(_B.EDGES);for(const e of t)this.edges.push({raw:e,obj:oB.from(e),area:null})}}update(){const t=this.dirty.has(_B.MEMBERS),e=this.dirty.has(_B.NON_MEMBERS);let n=this.dirty.has(_B.EDGES);this.dirty.clear();const r=this.members.map((t=>t.obj));if(this.o.virtualEdges&&(t||e)){const t=wB(r,this.nonMembers.map((t=>t.obj)),this.o.maxRoutingIterations,this.o.morphBuffer),e=new Map(this.virtualEdges.map((t=>[t.obj.toString(),t.area])));this.virtualEdges=t.map((t=>{var n;return{raw:t,obj:t,area:null!==(n=e.get(t.toString()))&&void 0!==n?n:null}})),n=!0}let i=!1;if(t||n){const t=function(t,e){if(0===t.length)return new gB(0,0,0,0);const n=gB.from(t[0]);for(const e of t)n.add(e);for(const t of e)n.add(iB(t));return n}(r,this.virtualEdges.concat(this.edges).map((t=>t.obj))),e=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,n=gB.from(yB(t,e));n.equals(this.activeRegion)||(i=!0,this.activeRegion=n)}if(i){const t=Math.ceil(this.activeRegion.width/this.o.pixelGroup),e=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=mB.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach((t=>t.area=null)),this.nonMembers.forEach((t=>t.area=null)),this.edges.forEach((t=>t.area=null)),this.virtualEdges.forEach((t=>t.area=null))):t===this.potentialArea.width&&e===this.potentialArea.height||(this.potentialArea=mB.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const o=new Map,a=t=>{if(t.area){const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof gB?"R":"C"}`;o.set(e,t.area)}},s=t=>{if(t.area)return;const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof gB?"R":"C"}`;if(o.has(e)){const n=o.get(e);return void(t.area=this.potentialArea.copy(n,{x:t.obj.x-this.o.nodeR1,y:t.obj.y-this.o.nodeR1}))}const n=t.obj instanceof gB?function(t,e,n){const r=e.scale(t),i=e.addPadding(r,n),o=e.createSub(i,{x:t.x-n,y:t.y-n}),a=r.x-i.x,s=r.y-i.y,l=i.x2-r.x2,u=i.y2-r.y2,c=i.width-a-l,h=i.height-s-u,d=n*n;o.fillArea({x:a,y:s,width:c+1,height:h+1},d);const f=[0],p=Math.max(s,a,l,u);{const i=e.invertScaleX(r.x+r.width/2);for(let o=1;o<p;o++){const a=e.invertScaleY(r.y-o),s=t.distSquare(i,a);if(!(s<d))break;{const t=n-Math.sqrt(s);f.push(t*t)}}}const g=[],v=Math.max(a,l),m=Math.max(s,l);for(let i=1;i<v;i++){const o=e.invertScaleX(r.x-i),a=[];for(let i=1;i<m;i++){const s=e.invertScaleY(r.y-i),l=t.distSquare(o,s);if(l<d){const t=n-Math.sqrt(l);a.push(t*t)}else a.push(0)}g.push(a)}for(let t=1;t<Math.min(s,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s-t,c+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s+h+t,c+1,e)}for(let t=1;t<Math.min(a,f.length);t++){const e=f[t];o.fillVerticalLine(a-t,s,h+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillVerticalLine(a+c+t,s,h+1,e)}for(let t=1;t<a;t++){const e=g[t-1],n=a-t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}for(let t=1;t<l;t++){const e=g[t-1],n=a+c+t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}return o}(t.obj,this.potentialArea,this.o.nodeR1):xB(t.obj,this.potentialArea,this.o.nodeR1);t.area=n,o.set(e,n)};this.members.forEach(a),this.nonMembers.forEach(a),this.members.forEach(s),this.nonMembers.forEach((t=>{this.activeRegion.intersects(t.obj)?s(t):t.area=null})),this.edges.forEach((t=>{t.area||(t.area=bB(t.obj,this.potentialArea,this.o.edgeR1))})),this.virtualEdges.forEach((t=>{t.area||(t.area=bB(t.obj,this.potentialArea,this.o.edgeR1))}))}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(0===this.members.length)return new CB([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map((t=>t.area)),r=this.virtualEdges.concat(this.edges).map((t=>t.area)),i=this.nonMembers.filter((t=>null!=t.area)).map((t=>t.area)),o=this.members.map((t=>t.obj));return function(t,e,n,r,i,o={}){const a=Object.assign({},RB,o);let s=a.threshold,l=a.memberInfluenceFactor,u=a.edgeInfluenceFactor,c=a.nonMemberInfluenceFactor;const h=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),d=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1);for(let o=0;o<a.maxMarchingIterations;o++){if(t.clear(),0!==l){const n=l/h;for(const r of e)t.incArea(r,n)}if(0!==u){const e=u/d;for(const r of n)t.incArea(r,e)}if(0!==c){const e=c/h;for(const n of r)t.incArea(n,e)}const f=PB(t,s);if(f&&i(f))return f;if(s*=.95,o<=.5*a.maxMarchingIterations)l*=1.2,u*=1.2;else{if(!(0!==c&&r.length>0))break;c*=.8}}return new CB([])}(e,n,r,i,(t=>t.containsElements(o)),t)}};class jB extends Zj{constructor(t,e){super(t,ke({},jB.defaultOptions,e)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:t,bubbleSetOptions:e}=this.parseOptions();Ne(this.bubbleSetOptions,e)||this.init(),this.bubbleSetOptions=Object.assign({},e);const n=Object.assign(Object.assign({},t),{d:this.getPath()});this.shape?this.shape.update(n):(this.shape=new Xd({style:n}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=t=>{if(!this.shape)return;const e=bh(t.data);[...this.options.members,...this.options.avoidMembers].includes(e)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(e)}))},this.getPath=t=>{const{graph:e}=this.context,n=this.options.members,r=[...this.members.keys()],i=this.options.avoidMembers,o=[...this.avoidMembers.keys()];if(!t&&Ne(n,r)&&Ne(i,o))return this.path;const{enter:a=[],exit:s=[]}=Ah(r,n,(t=>t)),{enter:l=[],exit:u=[]}=Ah(o,i,(t=>t));t&&(s.push(t),a.push(t));const c=(t,n,r)=>{t.forEach((t=>{const i=r?this.members:this.avoidMembers,o=r?"pushMember":"pushNonMember",a=r?"removeMember":"removeNonMember";if(n){let n;"edge"===e.getElementType(t)?([n]=FB(e,t),this.bubbleSets.pushEdge(n)):([n]=BB(e,t),this.bubbleSets[o](n)),i.set(t,n)}else{const n=i.get(t);n&&("edge"===e.getElementType(t)?this.bubbleSets.removeEdge(n):this.bubbleSets[a](n),i.delete(t))}}))};c(s,!1,!0),c(a,!0,!0),c(u,!1,!1),c(l,!0,!1);const h=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=qd(h.points.map(nd)),this.path},this.bindEvents(),this.bubbleSets=new IB(this.options)}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new IB(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const t=this.options,{type:e,key:n,members:r,avoidMembers:i}=t,o=Fe(t,["type","key","members","avoidMembers"]),a=Object.keys(o).reduce(((t,e)=>(e in RB?t.bubbleSetOptions[e]=o[e]:t.style[e]=o[e],t)),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:r,avoidMembers:i},a)}addMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.avoidMembers.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t)))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),this.drawBubbleSets()}updateMember(t){this.options.members=Ut(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.members.includes(t)))&&(this.options.members=this.options.members.filter((t=>!e.includes(t)))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some((t=>e.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t))),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}jB.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},RB);const BB=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getElementRenderBounds(e);return new gB(n.min[0],n.min[1],qc(n),Xc(n))})),FB=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getEdgeData(e),r=t.getElementPosition(n.source),i=t.getElementPosition(n.target);return oB.from({x1:r[0],y1:r[1],x2:i[0],y2:i[1]})}));class zB extends Zj{constructor(t,e){super(t,Object.assign({},zB.defaultOptions,e)),this.targetElement=null,this.onTriggerEvent=t=>{var e;null===(e=t.preventDefault)||void 0===e||e.call(t),this.show(t)},this.onMenuItemClick=t=>{const{onClick:e,trigger:n}=this.options;if(t.target instanceof HTMLElement&&t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");null==e||e(n,t.target,this.targetElement),this.hide()}"click"!==n&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=Qj("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t);this.context.canvas.getContainer().appendChild(this.$element),Jj("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow: hidden;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head)}show(t){return ze(this,void 0,void 0,(function*(){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hide();const r=yield this.getDOMContent(t);r instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(r)):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-i.left+n[0]}px`,this.$element.style.top=`${t.client.y-i.top+n[1]}px`,this.$element.style.display="block",this.targetElement=t.target}))}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return ze(this,void 0,void 0,(function*(){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(yield n(t)).map((t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`)).join("")}\n </ul>\n `:yield e(t)}))}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}}zB.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class GB extends Zj{constructor(t,e){super(t,Object.assign({},GB.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:t,element:e}=this.context,n=t.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:r,iterRate:i,divRate:o}=this.options;let{lambda:a,divisions:s,iterations:l}=this.options;for(let t=0;t<r;t++){for(let t=0;t<l;t++){const t={};n.forEach((e=>{var n;if(e.source===e.target)return;const r=bh(e);t[r]=this.getEdgeForces(e,s,a);for(let e=0;e<s+1;e++)(n=this.edgePoints)[r]||(n[r]=[]),this.edgePoints[r][e]=jh(this.edgePoints[r][e],t[r][e])}))}a/=2,s*=o,l*=i,this.divideEdges(s)}n.forEach((t=>{const n=bh(t),r=e.getElement(n);null==r||r.update({d:Zp(this.edgePoints[n])})}))},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map((t=>[bh(t),$h(Jh(t))])))}divideEdges(t){this.context.model.getEdgeData().forEach((e=>{var n;const r=bh(e);(n=this.edgePoints)[r]||(n[r]=[]);const i=this.nodeMap[e.source],o=this.nodeMap[e.target];if(1===t)this.edgePoints[r].push(i),this.edgePoints[r].push(zh(jh(i,o),2)),this.edgePoints[r].push(o);else{const e=(0===this.edgePoints[r].length?Vh(i,o):qB(this.edgePoints[r]))/(t+1);let n=e;const a=[i];for(let t=1;t<this.edgePoints[r].length;t++){const i=this.edgePoints[r][t-1],o=this.edgePoints[r][t];let s=Vh(o,i);for(;s>n;){const t=n/s,r=jh(i,Fh(Bh(o,i),t));a.push(r),s-=n,n=e}n-=s}a.push(o),this.edgePoints[r]=a}}))}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[r,i]=Bh(n,e);return{source:e,target:n,vx:r,vy:i,length:Vh(e,n)}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),r=this.getVectorPosition(e);return VB(n,r)*WB(n,r)*HB(n,r)*$B(n,r)}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach(((r,i)=>{n.forEach(((n,o)=>{var a,s;if(o<=i)return;this.measureEdgeCompatibility(r,n)>=e&&(t[a=bh(r)]||(t[a]=[]),t[bh(r)].push(n),t[s=bh(n)]||(t[s]=[]),t[bh(n)].push(r))}))})),t}getSpringForce(t,e){const{pre:n,cur:r,next:i}=t;return Fh(Bh(jh(n,i),Fh(r,2)),e)}getElectrostaticForce(t,e){Se(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[bh(e)];let r=[0,0];return null==n||n.forEach((n=>{const i=this.edgePoints[bh(n)][t],o=this.edgePoints[bh(e)][t],a=Bh(i,o),s=Vh(i,o);r=jh(r,Fh(a,1/s))})),r}getEdgeForces(t,e,n){const r=this.nodeMap[t.source],i=this.nodeMap[t.target],o=this.options.K/(Vh(r,i)*(e+1)),a=[[0,0]],s=bh(t);for(let r=1;r<e;r++){const e=this.getSpringForce({pre:this.edgePoints[s][r-1],cur:this.edgePoints[s][r],next:this.edgePoints[s][r+1]||[0,0]},o),i=this.getElectrostaticForce(r,t);a.push(Fh(jh(e,i),n))}return a.push([0,0]),a}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}GB.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const VB=(t,e)=>Math.abs(function(t,e){return t.reduce(((t,n,r)=>t+n*e[r]),0)}([t.vx,t.vy],[e.vx,e.vy])/(t.length*e.length)),WB=(t,e)=>{const n=(t.length+e.length)/2;return 2/(n/Math.min(t.length,e.length)+Math.max(t.length,e.length)/n)},HB=(t,e)=>{const n=(t.length+e.length)/2;return n/(n+Vh(zh(jh(t.source,t.target),2),zh(jh(e.source,e.target),2)))},UB=(t,e)=>{if(e.source[0]===e.target[0])return[e.source[0],t[1]];if(e.source[1]===e.target[1])return[t[0],e.source[1]];const n=(e.source[1]-e.target[1])/(e.source[0]-e.target[0]),r=(n*n*e.source[0]+n*(t[1]-e.source[1])+t[0])/(n*n+1);return[r,n*(r-e.source[0])+e.source[1]]},YB=(t,e)=>{const n=UB(e.source,t),r=UB(e.target,t),i=zh(jh(n,r),2),o=zh(jh(t.source,t.target),2);return 0===Vh(n,r)?0:Math.max(0,1-2*Vh(o,i)/Vh(n,r))},$B=(t,e)=>Math.min(YB(t,e),YB(e,t)),qB=t=>{let e=0;for(let n=1;n<t.length;n++)e+=Vh(t[n],t[n-1]);return e},XB={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0};class KB extends Zj{constructor(t,e){super(t,Object.assign({},KB.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=nd(t.canvas);this.renderLens(e),this.renderFocusElements()},this.renderLens=t=>{const e=Object.assign({},XB,this.options.style);this.isLensOn||(this.lens=new of({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,rd(t),{size:2*this.r}),this.lens.update(e)},this.getFilterData=()=>{const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:r,edges:i,combos:o}=n;return{nodes:r.filter((e=>t(bh(e),"node"))),edges:i.filter((e=>t(bh(e),"edge"))),combos:o.filter((e=>t(bh(e),"combo")))}},this.getFocusElements=t=>{const{nodes:e,edges:n}=this.getFilterData(),r=e.filter((e=>Vh(Jh(e),t)<this.r)),i=r.map((t=>bh(t)));return{nodes:r,edges:n.filter((t=>{const{source:e,target:n}=t,r=i.includes(e),o=i.includes(n);switch(this.options.nodeType){case"both":return r&&o;case"either":return r!==o;case"source":return r&&!o;case"target":return!r&&o;default:return!1}}))}},this.renderFocusElements=()=>{const{element:t,graph:e}=this.context;if(!this.isLensOn)return;const n=this.lens.getCenter(),{nodes:r,edges:i}=this.getFocusElements(n),o=new Set,a=n=>{const r=bh(n);o.add(r);const i=t.getElement(r);if(!i)return;const a=this.shapes.get(r)||i.cloneNode();a.setPosition(i.getPosition()),a.id=i.id,this.shapes.has(r)?Object.entries(i.attributes).forEach((([t,e])=>{a.style[t]!==e&&(a.style[t]=e)})):(this.canvas.appendChild(a),this.shapes.set(r,a));const s=e.getElementType(r),l=this.getElementStyle(s,n);a.update(l)};r.forEach(a),i.forEach(a),this.shapes.forEach(((t,e)=>{o.has(e)||(t.destroy(),this.shapes.delete(e))}))},this.scaleRByWheel=t=>{var e;this.options.preventDefault&&t.preventDefault();const{clientX:n,clientY:r,deltaX:i,deltaY:o}=t,{graph:a,canvas:s}=this.context,l=a.getCanvasByClient([n,r]),u=null===(e=this.lens)||void 0===e?void 0:e.getCenter();if(!this.isLensOn||Vh(l,u)>this.r)return;const{maxR:c,minR:h}=this.options,d=i+o>0?1/.95:.95,f=Math.min(...s.getSize())/2;this.r=Math.max(h||0,Math.min(c||f,this.r*d)),this.renderLens(u),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=t=>{var e;const n=nd(t.canvas),r=null===(e=this.lens)||void 0===e?void 0:e.getCenter();!this.isLensOn||Vh(n,r)>this.r||(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=nd(t.canvas);this.renderLens(e),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n="node"===t?this.options.nodeStyle:this.options.edgeStyle;return"function"==typeof n?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.addEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.addEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.addEventListener(t.CommonEvent.DRAG,this.onDrag),o.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.removeEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.removeEventListener(t.CommonEvent.DRAG,this.onDrag),o.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel))}update(t){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()}}KB.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const ZB={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12};class QB extends Zj{constructor(t,e){super(t,Object.assign({},QB.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=nd(t.canvas);this.onMagnify(e)},this.onMagnify=t=>{t.some(isNaN)||(this.renderLens(t),this.renderFocusElements())},this.renderLens=t=>{const e=Object.assign({},ZB,this.options.style);this.isLensOn||(this.lens=new of({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,rd(t),{size:2*this.r,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(e)},this.getDPercent=()=>{const{minD:t,maxD:e}=this.options;return`${Math.round((this.d-t)/(e-t)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:t}=this.context,e=this.lens.getCenter(),n=(this.d+1)*this.r,r=new Map,i=new Map;t.getNodeData().forEach((o=>{const a=Jh(o),s=Vh(a,e);if(s>this.r)return;const l=n*s/(this.d*s+this.r),[u,c]=a,[h,d]=e,f=[h+l*((u-h)/s),d+l*((c-d)/s)],p=bh(o),g=this.getNodeStyle(o),v=Ae(t.getElementRenderStyle(p),Object.keys(g));r.set(p,Object.assign(Object.assign({},rd(f)),g)),i.set(p,Object.assign(Object.assign({},rd(a)),v))})),this.updateStyle(r,i)},this.getNodeStyle=t=>{const{nodeStyle:e}=this.options;return"function"==typeof e?e(t):e},this.updateStyle=(t,e)=>{const{graph:n,element:r}=this.context,{enter:i,exit:o,keep:a}=Ah(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(t.keys()),(t=>t)),s=new Set,l=(t,e)=>{const i=r.getElement(t);null==i||i.update(e),n.getRelatedEdgesData(t).forEach((t=>{s.add(bh(t))}))};[...i,...a].forEach((e=>{l(e,t.get(e))})),o.forEach((t=>{l(t,this.prevOriginStyleMap.get(t)),this.prevOriginStyleMap.delete(t)})),s.forEach((t=>{const e=r.getElement(t);null==e||e.update({})})),this.prevMagnifiedStyleMap=t,e.forEach(((t,e)=>{this.prevOriginStyleMap.has(e)||this.prevOriginStyleMap.set(e,t)}))},this.isWheelValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;const{clientX:e,clientY:n}=t;return!(Vh(this.context.graph.getCanvasByClient([e,n]),this.lens.getCenter())>this.r)},this.scaleR=t=>{const{maxR:e,minR:n}=this.options,r=t?1/.95:.95,i=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(n||0,Math.min(e||i,this.r*r))},this.scaleD=t=>{const{maxD:e,minD:n}=this.options,r=t?this.d+.1:this.d-.1;this.d=Math.max(n,Math.min(e,r))},this.scaleRByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleR(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleD(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.isDragValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;return!(Vh(nd(t.canvas),this.lens.getCenter())>this.r)},this.isLensDragging=!1,this.onDragStart=t=>{this.isDragValid(t)&&(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=nd(t.canvas);this.onMagnify(e)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleR(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleD(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,a=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&a.addEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&a.addEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){a.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),a.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;a.addEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,n,{passive:!1})}}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,a=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&a.removeEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&a.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){a.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),a.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;a.removeEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,n)}}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&(null===(t=this.lens)||void 0===t||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}QB.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class JB extends Zj{constructor(t,e){super(t,Object.assign({},JB.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var t,e,n,r;const i=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(i),i?null===(e=(t=this.options).onEnter)||void 0===e||e.call(t):null===(r=(n=this.options).onExit)||void 0===r||r.call(n)},this.shortcut=new vd(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML="\n :not(:root):fullscreen::backdrop {\n background: transparent;\n }\n "}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit);["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.addEventListener(t,this.onFullscreenChange,!1)}))}unbindEvents(){this.shortcut.unbindAll();["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.removeEventListener(t,this.onFullscreenChange,!1)}))}setGraphSize(t=!0){var e,n;let r,i;t?(r=(null===(e=globalThis.screen)||void 0===e?void 0:e.width)||0,i=(null===(n=globalThis.screen)||void 0===n?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[r,i]=this.graphSize,this.context.graph.setSize(r,i),this.context.graph.render()}request(){!document.fullscreenElement&&(document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled"))&&this.$el.requestFullscreen().catch((t=>{Cc(`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()}}JB.defaultOptions={trigger:{},autoFit:!0};class tF extends Zj{constructor(t,e){super(t,Object.assign({},tF.defaultOptions,e)),this.$element=Qj("grid-line",!0),this.offset=[0,0],this.onTransform=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)};this.context.canvas.getContainer().prepend(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:r,borderLineWidth:i,borderStroke:o,borderStyle:a}=this.options;Object.assign(this.$element.style,{border:r?`${i}px ${a} ${o}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`})}updateOffset(t){this.offset=function(t,e){return t.map((t=>t%e))}(jh(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}function eF(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach((t=>{const{type:n,value:r}=t,i=bh(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Removed.has(i)||e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)?e.Added.delete(i):e.Updated.has(i)?(e.Updated.delete(i),e.Removed.set(i,t)):e.Removed.set(i,t))})),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}function nF(t){const{NodeAdded:e=[],NodeUpdated:n=[],NodeRemoved:r=[],EdgeAdded:i=[],EdgeUpdated:o=[],EdgeRemoved:a=[],ComboAdded:s=[],ComboUpdated:l=[],ComboRemoved:u=[]}=ie(t,(t=>t.type));return{add:{nodes:e,edges:i,combos:s},update:{nodes:n,edges:o,combos:l},remove:{nodes:r,edges:a,combos:u}}}function rF(t,e){for(const n in t)qt(t[n])&&!Array.isArray(t[n])&&null!==t[n]?(e[n]||(e[n]={}),rF(t[n],e[n])):void 0===e[n]&&(e[n]=Dc(n))}function iF(t,e=!1,n){const r={animation:e,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:o,remove:a}=nF(eF(t));return["nodes","edges","combos"].forEach((t=>{o[t]&&o[t].forEach((e=>{var i,o;const a=Object.assign({},e.value);let s=Object.assign({},e.original);if(n){const t=n.graph.getElementType(bh(e.original)),r="edge"===t?"stroke":"fill",i=n.element.getElementComputedStyle(t,e.original);s=Object.assign(Object.assign({},e.original),{style:Object.assign({[r]:i[r]},e.original.style)})}rF(a,s),(i=r.current.update)[t]||(i[t]=[]),r.current.update[t].push(a),(o=r.original.update)[t]||(o[t]=[]),r.original.update[t].push(s)})),i[t]&&i[t].forEach((e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.add)[t]||(n[t]=[]),r.current.add[t].push(o),(i=r.original.remove)[t]||(i[t]=[]),r.original.remove[t].push(o)})),a[t]&&a[t].forEach((e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.remove)[t]||(n[t]=[]),r.current.remove[t].push(o),(i=r.original.add)[t]||(i[t]=[]),r.original.add[t].push(o)}))})),r}tF.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};class oF extends Zj{constructor(e,n){super(e,Object.assign({},oF.defaultOptions,n)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(t,e=!0)=>{var n,r,i;this.freezed=!0,null===(r=(n=this.options).executeCommand)||void 0===r||r.call(n,t);const o=e?t.original:t.current;this.context.graph.addData(o.add),this.context.graph.updateData(o.update),this.context.graph.removeData(Eh(o.remove,!1)),null===(i=this.context.element)||void 0===i||i.draw({silence:!0,animation:t.animation}),this.freezed=!1},this.addCommand=e=>{var n;if(!this.freezed){if(e.type===t.GraphEvent.AFTER_DRAW){const{dataChanges:t=[],animation:r=!0}=e.data;if(null===(n=this.context.batch)||void 0===n?void 0:n.isBatching){if(!this.batchChanges)return;return this.batchChanges.push(t),void(this.batchAnimation&&(this.batchAnimation=r))}this.batchChanges=[t],this.batchAnimation=r}this.undoStackPush(iF(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(t.HistoryEvent.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=t=>{const{initiate:e}=t.data;if(this.batchAnimation=!1,e)this.batchChanges=[];else{this.undoStack.pop()||(this.batchChanges=null)}},this.emitter=new Wg;const{graph:r}=this.context;r.on(t.GraphEvent.AFTER_DRAW,this.addCommand),r.on(t.GraphEvent.BATCH_START,this.initBatchCommand),r.on(t.GraphEvent.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var e,n,r,i;const o=this.undoStack.pop();if(o){this.executeCommand(o);if(!1===(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,o,!1)))return;this.redoStack.push(o),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,o,!1),this.notify(t.HistoryEvent.UNDO,o)}return this}redo(){const e=this.redoStack.pop();return e&&(this.executeCommand(e,!1),this.undoStackPush(e),this.notify(t.HistoryEvent.REDO,e)),this}undoAndCancel(){const e=this.undoStack.pop();return e&&(this.executeCommand(e,!1),this.redoStack=[],this.notify(t.HistoryEvent.CANCEL,e)),this}undoStackPush(t){var e,n,r,i;const{stackSize:o}=this.options;0!==o&&this.undoStack.length>=o&&this.undoStack.shift();!1!==(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,t,!0))&&(this.undoStack.push(t),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(t.HistoryEvent.CLEAR,null)}notify(e,n){this.emitter.emit(e,{cmd:n}),this.emitter.emit(t.HistoryEvent.CHANGE,{cmd:n})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.addCommand),e.off(t.GraphEvent.BATCH_START,this.initBatchCommand),e.off(t.GraphEvent.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}function aF(t,e,n,r,i,o){const a=(o-e)*(n-t)-(r-e)*(i-t);return a>0||!(a<0)}oF.defaultOptions={stackSize:0};var sF=function(t,e){const n=t[0][0],r=t[0][1],i=t[1][0],o=t[1][1],a=e[0][0],s=e[0][1],l=e[1][0],u=e[1][1];return aF(n,r,a,s,l,u)!==aF(i,o,a,s,l,u)&&aF(n,r,i,o,a,s)!==aF(n,r,i,o,l,u)};function lF(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(let e=0;e<t.length;e++){const n=t[e],r=this.coordToCellNum(n[0]),i=this.coordToCellNum(n[1]);if(this._cells[r])this._cells[r][i]?this._cells[r][i].push(n):this._cells[r][i]=[n];else{const t=[];t[i]=[n],this._cells[r]=t}}}function uF(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}lF.prototype={cellPoints:function(t,e){return void 0!==this._cells[t]&&void 0!==this._cells[t][e]?this._cells[t][e]:[]},rangePoints:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this.coordToCellNum(t[2]),i=this.coordToCellNum(t[3]),o=[];for(let t=e;t<=r;t++)for(let e=n;e<=i;e++)for(let n=0;n<this.cellPoints(t,e).length;n++)o.push(this.cellPoints(t,e)[n]);return o},removePoint:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this._cells[e][n];let i;for(let e=0;e<r.length;e++)if(r[e][0]===t[0]&&r[e][1]===t[1]){i=e;break}return r.splice(i,1),r},trunc:Math.trunc||function(t){return t-t%1},coordToCellNum:function(t){return this.trunc(t*this._reverseCellSize)},extendBbox:function(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}};var cF=function(t){const e=function(t){const e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&uF(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}(t),n=function(t){const e=t.reverse(),n=[];for(let t=0;t<e.length;t++){for(;n.length>=2&&uF(n[n.length-2],n[n.length-1],e[t])<=0;)n.pop();n.push(e[t])}return n.pop(),n}(t),r=n.concat(e);return r.push(t[0]),r};const hF=sF,dF=function(t,e){return new lF(t,e)},fF={toXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","return [pt"+e[0]+",pt"+e[1]+"];")(t)}))},fromXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","const o = {}; o"+e[0]+"= pt[0]; o"+e[1]+"= pt[1]; return o;")(t)}))}},pF=cF;function gF(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function vF(t,e,n){const r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],o=gF(t,e),a=gF(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(o*a)}function mF(t,e){for(let n=0;n<e.length-1;n++){const r=[e[n],e[n+1]];if(!(t[0][0]===r[0][0]&&t[0][1]===r[0][1]||t[0][0]===r[1][0]&&t[0][1]===r[1][1])&&hF(t,r))return!0}return!1}function yF(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function bF(t,e,n){let r,i,o=null,a=EF,s=EF;for(let l=0;l<e.length;l++)r=vF(t[0],t[1],e[l]),i=vF(t[1],t[0],e[l]),r>a&&i>s&&!mF([t[0],e[l]],n)&&!mF([t[1],e[l]],n)&&(a=r,s=i,o=e[l]);return o}function xF(t,e,n,r,i){let o=!1;for(let a=0;a<t.length-1;a++){const s=[t[a],t[a+1]],l=s[0][0]+","+s[0][1]+","+s[1][0]+","+s[1][1];if(gF(s[0],s[1])<e||i.has(l))continue;let u,c,h,d=0,f=yF(s);do{f=r.extendBbox(f,d),u=f[2]-f[0],c=f[3]-f[1],h=bF(s,r.rangePoints(f),t),d++}while(null===h&&(n[0]>u||n[1]>c));u>=n[0]&&c>=n[1]&&i.add(l),null!==h&&(t.splice(a+1,0,h),r.removePoint(h),o=!0)}return o?xF(t,e,n,r,i):t}const EF=Math.cos(90/(180/Math.PI)),wF=.6;var kF=function(t,e,n){let r=e||20;const i=function(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];n[0]===i[0]&&n[1]===i[1]||e.push(i),n=i}return e}(function(t){return t.sort((function(t,e){return t[0]-e[0]||t[1]-e[1]}))}(fF.toXy(t,n)));if(i.length<4){const t=i.concat([i[0]]);return n?fF.fromXy(t,n):t}const o=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<n&&(n=t[o][1]),t[o][0]>r&&(r=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[r-e,i-n]}(i),a=[o[0]*wF,o[1]*wF],s=pF(i),l=i.filter((function(t){return s.indexOf(t)<0})),u=Math.ceil(1/(i.length/(o[0]*o[1]))),c=xF(s,Math.pow(r,2),a,dF(l,u),new Set);return n?fF.fromXy(c,n):c},MF=E(kF);const SF=(t,e,n)=>{if("sharp"===n)return[["M",t[0]-e,t[1]-e],["L",t[0]+e,t[1]-e],["L",t[0]+e,t[1]+e],["L",t[0]-e,t[1]+e],["Z"]];const r=[e,e,0,0,0];return[["M",t[0],t[1]-e],["A",...r,t[0],t[1]+e],["A",...r,t[0],t[1]-e]]},NF=(t,e,n)=>{const r=[e,e,0,0,0],i="sharp"===n?jh(t[0],Gh(Hh(Bh(t[0],t[1])),e)):t[0],o="sharp"===n?jh(t[1],Gh(Hh(Bh(t[1],t[0])),e)):t[1],a=Gh(Hh(Yh(Bh(i,o),!1)),e),s=Gh(a,-1),l=jh(i,a),u=jh(o,a),c=jh(o,s),h=jh(i,s);return"sharp"===n?[["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",...r,c[0],c[1]],["L",h[0],h[1]],["A",...r,l[0],l[1]]]},OF=(t,e)=>{const n=fd(t).map(((n,r)=>{const i=(r-2+t.length)%t.length,o=(r-1+t.length)%t.length,a=(r+1)%t.length,s=t[i],l=t[o],u=t[a],c=Bh(s,l),h=Bh(l,n),d=Bh(n,u),f=(t,e)=>Uh(t,e,!0)<Math.PI,p=f(c,h),g=f(h,d),v=t=>Gh(Hh(Yh(t,!1)),e),m=v(h);return[{p:$h(jh(l,p?v(c):m)),concave:p&&l},{p:$h(jh(n,g?v(d):m)),concave:g&&n}]})),r=[e,e,0,0,0],i=n.findIndex(((t,e)=>!(n[(e-1+n.length)%n.length][0].concave||n[(e-1+n.length)%n.length][1].concave||t[0].concave||t[0].concave||t[1].concave))),o=n.slice(i).concat(n.slice(0,i));let a=[];return o.flatMap(((t,e)=>{const i=[],s=o[n.length-1];return 0===e&&i.push(["M",...s[1].p]),t[0].concave?a.push(t[0].p,t[1].p):i.push(["A",...r,...t[0].p]),t[1].concave?a.unshift(t[1].p):i.push(["L",...t[1].p]),3===a.length&&(i.pop(),i.push(["C",...a.flat()]),a=[]),i}))},TF=(t,e)=>{const n=fd(t).map(((e,n)=>({p:e,v:Hh(Bh(t[(n+1)%t.length],e))})));return n.forEach(((r,i)=>{const o=i>0?i-1:t.length-1,a=n[o].v,s=Hh(jh(a,Gh(r.v,Uh(a,r.v,!0)<Math.PI?1:-1)));r.p=jh(r.p,Gh(s,e))})),qd(n.map((t=>t.p)))},CF=(t,e)=>{const n=t.map(((n,r)=>{const i=t[0===r?t.length-1:r-1],o=qh(Gh(Hh(Yh(Bh(i,n),!1)),e));return[jh(i,o),jh(n,o)]})),r=n.flat();return r.map(((t,e)=>{if(e%2==0)return null;return Zh([r[(e-1)%r.length],r[e%r.length]],[r[(e+1)%r.length],r[(e+2)%r.length]],!0)})).filter(Boolean).map(((t,e)=>[0===e?"M":"L",t[0],t[1]])).concat([["Z"]])};class AF extends Zj{constructor(t,e){super(t,Object.assign({},AF.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(this.shape){const t=!Ne(this.optionsCache,this.options);this.shape.update(this.getHullStyle(t))}else this.shape=new Xd({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);this.optionsCache=Object.assign({},this.options)},this.updateHullPath=t=>{this.shape&&this.options.members.includes(bh(t.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(t=!1)=>{const{graph:e}=this.context,n=this.getMember();if(0===n.length)return"";const r=n.map((t=>e.getNodeData(t))),i=MF(r.map(Jh),this.options.concavity).slice(1).reverse(),o=i.flatMap((t=>r.filter((e=>Ne(Jh(e),t))).map(bh)));return Ne(o,this.hullMemberIds)&&!t||(this.hullMemberIds=o,this.path=function(t,e,n){if(1===t.length)return SF(t[0],e,n);if(2===t.length)return NF(t,e,n);if(3===t.length){const[r,i,o]=fd(t);if(sd(r,i,o))return NF([r,o],e,n)}switch(n){case"smooth":return TF(t,e);case"sharp":return CF(t,e);default:return OF(t,e)}}(i,this.getPadding(),this.options.corner)),this.path},this.bindEvents()}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=Fe(this.options,["members","padding","corner"]);return Object.assign(Object.assign({},e),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context,e=this.hullMemberIds.reduce(((e,n)=>{const{halfExtents:r}=t.getElementRenderBounds(n),i=Math.max(r[0],r[1]);return Math.max(e,i)}),0);return e+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),e.some((t=>this.hullMemberIds.includes(t)))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Ut(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}function PF(t,e){e(t),t.children&&t.children.forEach((function(t){t&&PF(t,e)}))}function RF(t){LF(t,!0)}function DF(t){LF(t,!1)}function LF(t,e){var n=e?"visible":"hidden";PF(t,(function(t){t.attr("visibility",n)}))}AF.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};var _F=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,We([],Ve(e),!1))||this;return r.isMutationObserved=!0,r.addEventListener(Ws.INSERTED,(function(){DF(r)})),r}return je(e,t),e}(Bl);function IF(t){var e=t.appendChild(new _F({class:"offscreen"}));return DF(e),e}var jF=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=Fe(e,["style"]);return t.call(this,Be({style:Be({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return je(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=IF(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(Ql);function BF(t){return t*Math.PI/180}function FF(t){return Number((180*t/Math.PI).toPrecision(5))}var zF=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();function GF(t,e){return Ut(t)?t.apply(void 0,We([],Ve(e),!1)):t}var VF,WF=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map((function(t){var e=Ve(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]})));return Object.assign(r,{prefix:n}),r},HF=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach((function(i){var o=Ve(i,2),a=o[0],s=o[1],l=t;Object.prototype.hasOwnProperty.call(e,a)&&(s?Jt(s)?(Jt(t[a])||(l[a]={}),n<r?HF(t[a],s,n+1,r):l[a]=e[a]):$t(s)?(l[a]=[],l[a]=l[a].concat(s)):l[a]=s:l[a]=s)}))},UF=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)HF(t,e[r]);return t},YF=function(t){return void 0!==t&&null!=t&&!Number.isNaN(t)},$F=xe((function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return VF||(VF=xl.offscreenCanvasCreator.getOrCreateContext(void 0)),VF.font=[o,a,i,"".concat(n,"px"),r].join(" "),VF.measureText(t).width}),(function(t,e){return[t,Object.values(e||qF(t)).join()].join("")}),4096),qF=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function XF(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}function KF(t,e){var n=XF(t);n&&n.attr(e)}function ZF(t,e,n){void 0===n&&(n="..."),KF(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function QF(t){var e=t.canvas,n=t.touches,r=t.offsetX,i=t.offsetY;if(e)return[e.x,e.y];if(n){var o=n[0];return[o.clientX,o.clientY]}return r&&i?[r,i]:[0,0]}function JF(t){return"function"==typeof t?t():ne(t)||ae(t)?new jF({style:{text:String(t)}}):t}function tz(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function ez(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=!1),!!(r&&t===e||i&&t===n)||t>e&&t<n}function nz(t,e){return"number"==typeof t&&"number"==typeof e?function(t,e){return function(n){return t*(1-n)+e*n}}(t,e):Array.isArray(t)&&Array.isArray(e)?function(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0;return function(i){var o=new Array(r),a=new Array(n),s=0;for(s=0;s<r;++s)o[s]=nz(t[s],e[s]);for(;s<n;++s)a[s]=e[s];for(s=0;s<r;++s)a[s]=o[s](i);return a}}(t,e):"object"==typeof t&&"object"==typeof e?function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n={},r={};return Object.entries(e).forEach((function(e){var i=Ve(e,2),o=i[0],a=i[1];o in t?n[o]=nz(t[o],a):r[o]=a})),function(t){return Object.entries(n).forEach((function(e){var n=Ve(e,2),i=n[0],o=n[1];return r[i]=o(t)})),r}}(t,e):function(e){return t}}function rz(t,e){return[t[0]*e,t[1]*e]}function iz(t,e){return[t[0]+e[0],t[1]+e[1]]}function oz(t,e){return[t[0]-e[0],t[1]-e[1]]}function az(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1])]}function sz(t,e){return[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}function lz(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function uz(t){if(0===t[0]&&0===t[1])return[0,0];var e=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2));return[t[0]/e,t[1]/e]}function cz(t,e){return+t.toPrecision(e)}function hz(t,e){var n={},r=Array.isArray(e)?e:[e];for(var i in t)r.includes(i)||(n[i]=t[i]);return n}function dz(t,e,n){void 0===n&&(n=[[0,0],[1,1]]);for(var r=!!e,i=[],o=0,a=t.length;o<a;o+=2)i.push([t[o],t[o+1]]);var s,l,u,c=function(t,e,n,r){var i,o,a,s,l,u,c=[],h=!!r,d=[1/0,1/0],f=[-1/0,-1/0];if(h){d=(i=Ve(r,2))[0],f=i[1];for(var p=0,g=t.length;p<g;p+=1)d=az(d,m=t[p]),f=sz(f,m)}p=0;for(var v=t.length;p<v;p+=1){var m=t[p];if(0!==p||n)if(p!==v-1||n){o=t[p-1];var y=[0,0];y=rz(y=oz(a=t[p+1],o),e);var b=lz(m,o),x=lz(m,a),E=b+x;0!==E&&(b/=E,x/=E);var w=rz(y,-b),k=rz(y,x);l=iz(m,w),s=az(s=iz(m,k),sz(a,m)),s=sz(s,az(a,m)),l=az(l=iz(m,w=rz(w=oz(s,m),-b/x)),sz(o,m)),s=iz(m,k=rz(k=oz(m,l=sz(l,az(o,m))),x/b)),h&&(l=az(l=sz(l,d),f),s=az(s=sz(s,d),f)),c.push(u),c.push(l),u=s}else l=m,c.push(u),c.push(l);else u=m}return c}(i,.4,r,n),h=i.length,d=[];for(o=0;o<h-1;o+=1)s=c[2*o],l=c[2*o+1],u=i[o+1],d.push(["C",s[0],s[1],l[0],l[1],u[0],u[1]]);return d}var fz=["$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 pz(t){return fz.includes(t)}function gz(t){var e={};for(var n in t)pz(n)&&(e[n]=t[n]);return e}function vz(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=e/Math.max(i,o);return t.style.transform="scale(".concat(a,")"),a}var mz=function(){function t(t,n,r,i,o,a,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===a&&(a=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=a,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var a=this._data[o],s=Ve(Array.isArray(a)?a:[a,null],2),l=s[0],u=s[1];(h=r(l,o)).__data__=l,null!==u&&(h.__fromElements__=u),this._parent.appendChild(h),i.push(h)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var c=this._elements[o],h=r(l=c.__data__,o);c.appendChild(h),i.push(h)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=He(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=He(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=He(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var a,s,l,u=[],c=[],h=new Set(this._elements),d=[],f=new Set,p=new Map(this._elements.map((function(t,n){return[e(t.__data__,n),t]}))),g=new Map(this._facetElements.map((function(t,n){return[e(t.__data__,n),t]}))),v=(a=this._elements,s=function(t){return r(t.__data__)},l=new Map,a.forEach((function(t){var e=s(t);l.has(e)||l.set(e,[]),l.get(e).push(t)})),l),m=0;m<t.length;m++){var y=t[m],b=e(y,m),x=r(y,m);if(p.has(b))(M=p.get(b)).__data__=y,M.__facet__=!1,c.push(M),h.delete(M),p.delete(b);else if(g.has(b)){(M=g.get(b)).__data__=y,M.__facet__=!0,c.push(M),g.delete(b)}else if(v.has(b)){var E=v.get(b);d.push([y,E]);try{for(var w=(i=void 0,Ge(E)),k=w.next();!k.done;k=w.next()){var M=k.value;h.delete(M)}}catch(t){i={error:t}}finally{try{k&&!k.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}v.delete(b)}else if(p.has(x)){(M=p.get(x)).__toData__?M.__toData__.push(y):M.__toData__=[y],f.add(M),h.delete(M)}else u.push(y)}var S=[new n([],u,this._parent,this._document),new n(c,null,this._parent,this._document),new n(h,null,this._parent,this._document),new n([],d,this._parent,this._document),new n(f,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,S)},t.prototype.merge=function(t){var e=We(We([],Ve(this._elements),!1),Ve(t._elements),!1),r=We(We([],Ve(this._transitions),!1),Ve(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),a=e(this._update),s=n(this._exit),l=r(this._merge),u=i(this._split);return a.merge(o).merge(s).merge(l).merge(u)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then((function(){return n.remove()})):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each((function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))}))},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each((function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))}))},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each((function(n,r){var i=this;Object.entries(t).forEach((function(t){var o=Ve(t,2),a=o[0],s=o[1],l="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(a,l.call(i,n,r))}))}))},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.transition=function(t){var e=this._transitions;return this.each((function(n,r){e[r]=t.call(this,n,r)}))},t.prototype.on=function(t,e){return this.each((function(){this.addEventListener(t,e)})),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,We([this._parent,this],Ve(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter((function(t){return!!t}))},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:Bl,rect:Kl,circle:Ll,path:Ul,text:jF,ellipse:jl,image:Gl,line:Wl,polygon:$l,polyline:Xl,html:zl},t}();function yz(t){return new mz([t],null,t,t.ownerDocument)}function bz(t){if(ae(t))return[t,t,t,t];if($t(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function xz(t){var e=t.getLocalBounds(),n=Ve([e.min,e.max],2),r=Ve(n[0],2),i=r[0],o=r[1],a=Ve(n[1],2),s=a[0],l=a[1];return{x:i,y:o,width:s-i,height:l-o,left:i,bottom:l,top:o,right:s}}function Ez(t,e){var n=Ve(t,2),r=n[0],i=n[1],o=Ve(e,2),a=o[0],s=o[1];return r!==a&&i===s}function wz(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function kz(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var Mz=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function Sz(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach((function(t){var i=Ve(t,2),o=i[0],a=i[1];if("className"===o||"class"===o);else if(Mz(o,"show")&&Mz(kz(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(wz(t))}(e,"show")?r[o]=a:r[o.replace(new RegExp(wz(e)),"")]=a;else if(!Mz(o,"show")&&Mz(o,e)!==n){var s=kz(o,e);"filter"===s&&"function"==typeof a||(r[s]=a)}})),r}function Nz(t,e){return Object.entries(t).reduce((function(t,n){var r=Ve(n,2),i=r[0],o=r[1];return i.startsWith("show")?t["show".concat(e).concat(i.slice(4))]=o:t["".concat(e).concat(wz(i))]=o,t}),{})}function Oz(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach((function(t){var o=Ve(t,2),a=o[0],s=o[1];e.includes(a)||(-1!==n.indexOf(a)?i[a]=s:r[a]=s)})),[r,i]}function Tz(t,e){var n={YYYY:t.getFullYear(),MM:t.getMonth()+1,DD:t.getDate(),HH:t.getHours(),mm:t.getMinutes(),ss:t.getSeconds()},r=e;return Object.keys(n).forEach((function(t){var e=n[t];r=r.replace(t,"YYYY"===t?"".concat(e):"".concat(e).padStart(2,"0"))})),r}function Cz(t,e){if(e)try{var n=e.replace(/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,(function(e,n,r){return"translate(".concat(function(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=Ve([e,n].map((function(t,e){var n;return t.includes("%")?parseFloat((null===(n=t.match(/[+-]?([0-9]*[.])?[0-9]+/))||void 0===n?void 0:n[0])||"0")/100*(0===e?i:o):t})),2);return[a[0],a[1]]}(t,n,r),")")}));t.attr("transform",n)}catch(t){}}var Az=function(t,e){null!=e?t.replaceChildren?Array.isArray(e)?t.replaceChildren.apply(t,We([],Ve(e),!1)):t.replaceChildren(e):(t.innerHTML="",Array.isArray(e)?e.forEach((function(e){return t.appendChild(e)})):t.appendChild(e)):t.innerHTML=""};function Pz(){LF(this,"hidden"!==this.attributes.visibility)}var Rz=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,UF({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return je(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=IF(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&Pz.call(this)},e.prototype.update=function(t,e){var n;return this.attr(UF({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,Fe(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}(Il),Dz=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},Lz=Dz,_z=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},Iz=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},jz=Iz;var Bz=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function Fz(t){var e=function(t){var e="default";if(qt(t)&&t instanceof Image)e="image";else if(Ut(t))e="symbol";else if(ne(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var zz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.render=function(t,n){var r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o,s=this.getSubShapeStyle(t),l=s.symbol,u=s.size,c=void 0===u?16:u,h=Fe(s,["symbol","size"]),d=Fz(l);tz(!!d,yz(n),(function(t){t.maybeAppendByClassName("marker",d).attr("className","marker ".concat(d,"-marker")).call((function(t){if("image"===d){var n=2*c;t.styles({img:l,width:n,height:n,x:i-c,y:a-c})}else{n=c/2;var r=Ut(l)?l:e.getSymbol(l);t.styles(Be({d:null==r?void 0:r(i,a,n)},h))}}))}))},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(Rz);function Gz(t,...e){return e.reduce(((t,e)=>n=>t(e(n))),t)}function Vz(t,e){return e-t?n=>(n-t)/(e-t):t=>.5}zz.registerSymbol("cross",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]})),zz.registerSymbol("hyphen",(function(t,e,n){return[["M",t-n,e],["L",t+n,e]]})),zz.registerSymbol("line",_z),zz.registerSymbol("plus",(function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]})),zz.registerSymbol("tick",(function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]})),zz.registerSymbol("circle",Dz),zz.registerSymbol("point",Lz),zz.registerSymbol("bowtie",(function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]})),zz.registerSymbol("hexagon",(function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]})),zz.registerSymbol("square",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]})),zz.registerSymbol("diamond",(function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]})),zz.registerSymbol("triangle",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]})),zz.registerSymbol("triangle-down",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]})),zz.registerSymbol("line",_z),zz.registerSymbol("dot",Iz),zz.registerSymbol("dash",jz),zz.registerSymbol("smooth",(function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]})),zz.registerSymbol("hv",(function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]})),zz.registerSymbol("vh",(function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]})),zz.registerSymbol("hvh",(function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]})),zz.registerSymbol("vhv",(function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}));const Wz=Math.sqrt(50),Hz=Math.sqrt(10),Uz=Math.sqrt(2);function Yz(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/10**i;return i>=0?(o>=Wz?10:o>=Hz?5:o>=Uz?2:1)*10**i:-(10**-i)/(o>=Wz?10:o>=Hz?5:o>=Uz?2:1)}const $z=(t,e,n=5)=>{const r=[t,e];let i,o=0,a=r.length-1,s=r[o],l=r[a];return l<s&&([s,l]=[l,s],[o,a]=[a,o]),i=Yz(s,l,n),i>0?(s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i,i=Yz(s,l,n)):i<0&&(s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i,i=Yz(s,l,n)),i>0?(r[o]=Math.floor(s/i)*i,r[a]=Math.ceil(l/i)*i):i<0&&(r[o]=Math.ceil(s*i)/i,r[a]=Math.floor(l*i)/i),r};function qz(t){return!(ve(t)||(e=t,null===e)||Number.isNaN(t));var e}var Xz={exports:{}},Kz={exports:{}},Zz=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},Qz=Array.prototype.concat,Jz=Array.prototype.slice,tG=Kz.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];Zz(i)?e=Qz.call(e,Jz.call(i)):e.push(i)}return e};tG.wrap=function(t){return function(){return t(tG(arguments))}};var eG=Kz.exports,nG={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},rG=eG,iG=Object.hasOwnProperty,oG=Object.create(null);for(var aG in nG)iG.call(nG,aG)&&(oG[nG[aG]]=aG);var sG=Xz.exports={to:{},get:{}};function lG(t,e,n){return Math.min(Math.max(e,t),n)}function uG(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}sG.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=sG.get.hsl(t),n="hsl";break;case"hwb":e=sG.get.hwb(t),n="hwb";break;default:e=sG.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},sG.get.rgb=function(t){if(!t)return null;var e,n,r,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var o=2*n;i[n]=parseInt(e.slice(o,o+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)i[n]=parseInt(e[n]+e[n],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)i[n]=parseInt(e[n+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:iG.call(nG,e[1])?((i=nG[e[1]])[3]=1,i):null:null;for(n=0;n<3;n++)i[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(n=0;n<3;n++)i[n]=lG(i[n],0,255);return i[3]=lG(i[3],0,1),i},sG.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,lG(parseFloat(e[2]),0,100),lG(parseFloat(e[3]),0,100),lG(isNaN(n)?1:n,0,1)]}return null},sG.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,lG(parseFloat(e[2]),0,100),lG(parseFloat(e[3]),0,100),lG(isNaN(n)?1:n,0,1)]}return null},sG.to.hex=function(){var t=rG(arguments);return"#"+uG(t[0])+uG(t[1])+uG(t[2])+(t[3]<1?uG(Math.round(255*t[3])):"")},sG.to.rgb=function(){var t=rG(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},sG.to.rgb.percent=function(){var t=rG(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},sG.to.hsl=function(){var t=rG(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},sG.to.hwb=function(){var t=rG(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},sG.to.keyword=function(t){return oG[t.slice(0,3)]};var cG=E(Xz.exports);function hG(t,e,n){let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function dG(t){const e=cG.get(t);if(!e)return null;const{model:n,value:r}=e;return"rgb"===n?r:"hsl"===n?function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100,i=t[3];if(0===n)return[255*r,255*r,255*r,i];const o=r<.5?r*(1+n):r+n-r*n,a=2*r-o;return[255*hG(a,o,e+1/3),255*hG(a,o,e),255*hG(a,o,e-1/3),i]}(r):null}const fG=(t,e)=>n=>t*(1-n)+e*n,pG=(t,e)=>"number"==typeof t&&"number"==typeof e?fG(t,e):"string"==typeof t&&"string"==typeof e?((t,e)=>{const n=dG(t),r=dG(e);return null===n||null===r?n?()=>t:()=>e:t=>{const e=new Array(4);for(let i=0;i<4;i+=1){const o=n[i],a=r[i];e[i]=o*(1-t)+a*t}const[i,o,a,s]=e;return`rgba(${Math.round(i)}, ${Math.round(o)}, ${Math.round(a)}, ${s})`}})(t,e):()=>t,gG=(t,e)=>{const n=fG(t,e);return t=>Math.round(n(t))};function vG({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):n}function mG(t){return"object"==typeof t?t.valueOf():t}class yG extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=mG,null!==t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(vG({map:this.map,initKey:this.initKey},t))}has(t){return super.has(vG({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(function({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(function({map:t,initKey:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}({map:this.map,initKey:this.initKey},t))}}class bG{constructor(t){this.options=ke({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=ke({},this.options,t),this.rescale(t)}rescale(t){}}const xG=Symbol("defaultUnknown");function EG(t,e,n){for(let r=0;r<e.length;r+=1)t.has(e[r])||t.set(n(e[r]),r)}function wG(t){const{value:e,from:n,to:r,mapper:i,notFoundReturn:o}=t;let a=i.get(e);if(void 0===a){if(o!==xG)return o;a=n.push(e)-1,i.set(e,a)}return r[a%r.length]}function kG(t){return t instanceof Date?t=>`${t}`:"object"==typeof t?t=>JSON.stringify(t):t=>t}class MG extends bG{getDefaultOptions(){return{domain:[],range:[],unknown:xG}}constructor(t){super(t)}map(t){return 0===this.domainIndexMap.size&&EG(this.domainIndexMap,this.getDomain(),this.domainKey),wG({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&EG(this.rangeIndexMap,this.getRange(),this.rangeKey),wG({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=kG(e),this.rangeKey=kG(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new MG(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 SG(t){return Math.round(1e12*t)/1e12}function NG(t){const{domain:e,range:n,paddingOuter:r,paddingInner:i,flex:o,round:a,align:s}=t,l=e.length,u=function(t,e){const n=e-t.length;return n>0?[...t,...new Array(n).fill(1)]:n<0?t.slice(0,e):t}(o,l),[c,h]=n,d=h-c,f=d/(2/l*r+1-1/l*i),p=f*i/l,g=f-l*p,v=function(t){const e=Math.min(...t);return t.map((t=>t/e))}(u),m=g/v.reduce(((t,e)=>t+e)),y=new yG(e.map(((t,e)=>{const n=v[e]*m;return[t,a?Math.floor(n):n]}))),b=new yG(e.map(((t,e)=>{const n=v[e]*m+p;return[t,a?Math.floor(n):n]}))),x=Array.from(b.values()).reduce(((t,e)=>t+e)),E=c+(d-(x-x/l*i))*s;let w=a?Math.round(E):E;const k=new Array(l);for(let t=0;t<l;t+=1){k[t]=SG(w);const n=e[t];w+=b.get(n)}return{valueBandWidth:y,valueStep:b,adjustedRange:k}}class OG extends MG{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:xG,flex:[]}}constructor(t){super(t)}clone(){return new OG(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:r,flex:i}=this.options,{adjustedRange:o,valueBandWidth:a,valueStep:s}=function(t){var e;const{domain:n}=t,r=n.length;if(0===r)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(null===(e=t.flex)||void 0===e?void 0:e.length)return NG(t);const{range:i,paddingOuter:o,paddingInner:a,round:s,align:l}=t;let u,c,h=i[0];const d=i[1]-h,f=2*o,p=r-a;u=d/Math.max(1,f+p),s&&(u=Math.floor(u)),h+=(d-u*(r-a))*l,c=u*(1-a),s&&(h=Math.round(h),c=Math.round(c));const g=new Array(r).fill(0).map(((t,e)=>h+e*u));return{valueStep:u,valueBandWidth:c,adjustedRange:g}}({align:t,range:n,round:r,flex:i,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=s,this.valueBandWidth=a,this.adjustedRange=o}}const TG=(t,e,n)=>{let r,i,o=t,a=e;if(o===a&&n>0)return[o];let s=Yz(o,a,n);if(0===s||!Number.isFinite(s))return[];if(s>0){o=Math.ceil(o/s),a=Math.floor(a/s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)*s}else{s=-s,o=Math.ceil(o*s),a=Math.floor(a*s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)/s}return i},CG=(t,e,n)=>{const[r,i]=t,[o,a]=e;let s,l;return r<i?(s=Vz(r,i),l=n(o,a)):(s=Vz(i,r),l=n(a,o)),Gz(l,s)},AG=(t,e,n)=>{const r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=t[0]>t[r],s=a?[...t].reverse():t,l=a?[...e].reverse():e;for(let t=0;t<r;t+=1)i[t]=Vz(s[t],s[t+1]),o[t]=n(l[t],l[t+1]);return e=>{const n=function(t,e,n,r){let i=n||0,o=r||t.length;for(;i<o;){const n=Math.floor((i+o)/2);t[n]>e?o=n:i=n+1}return i}(t,e,1,r)-1,a=i[n];return Gz(o[n],a)(e)}},PG=(t,e,n,r)=>(Math.min(t.length,e.length)>2?AG:CG)(t,e,r?gG:n);class RG extends bG{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:fG,tickCount:5}}map(t){return qz(t)?this.output(t):this.options.unknown}invert(t){return qz(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...r]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...r)}getTicks(){const{tickMethod:t}=this.options,[e,n,r,...i]=this.getTickMethodOptions();return t(e,n,r,...i)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return $z}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,r=this.options.domain.map(t),i=Math.min(r.length,n.length);return e?function(t,e){const n=e<t?e:t,r=t>e?t:e;return t=>Math.min(Math.max(n,t),r)}(r[0],r[i-1]):_e}composeOutput(t,e){const{domain:n,range:r,round:i,interpolate:o}=this.options,a=PG(n.map(t),r,o,i);this.output=Gz(a,e,t)}composeInput(t,e,n){const{domain:r,range:i}=this.options,o=PG(i,r.map(t),fG);this.input=Gz(e,n,o)}}class DG extends RG{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:pG,tickMethod:TG,tickCount:5}}chooseTransforms(){return[_e,_e]}clone(){return new DG(this.options)}}var LG=function(t){function e(e){var n=this,r=e.style,i=Fe(e,["style"]);return(n=t.call(this,ke({},{type:"column"},Be({style:r},i)))||this).columnsGroup=new Bl({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return je(e,t),e.prototype.render=function(){var t=this.attributes,e=t.columns,n=t.x,r=t.y;this.columnsGroup.style.transform="translate(".concat(n,", ").concat(r,")"),yz(this.columnsGroup).selectAll(".column").data(e.flat()).join((function(t){return t.append("rect").attr("className","column").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.update=function(t){this.attr(UF({},this.attributes,t)),this.render()},e.prototype.clear=function(){this.removeChildren()},e}(Dl),_G=function(t){function e(e){var n=this,r=e.style,i=Fe(e,["style"]);return(n=t.call(this,ke({},{type:"lines"},Be({style:r},i)))||this).linesGroup=n.appendChild(new Bl),n.areasGroup=n.appendChild(new Bl),n.render(),n}return je(e,t),e.prototype.render=function(){var t=this.attributes,e=t.lines,n=t.areas,r=t.x,i=t.y;this.style.transform="translate(".concat(r,", ").concat(i,")"),e&&this.renderLines(e),n&&this.renderAreas(n)},e.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},e.prototype.update=function(t){this.attr(UF({},this.attributes,t)),this.render()},e.prototype.renderLines=function(t){yz(this.linesGroup).selectAll(".line").data(t).join((function(t){return t.append("path").attr("className","line").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.renderAreas=function(t){yz(this.linesGroup).selectAll(".area").data(t).join((function(t){return t.append("path").attr("className","area").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.style(t)}))}),(function(t){return t.remove()}))},e}(Dl);function IG(t,e){void 0===e&&(e=!1);var n=e?t.length-1:0,r=t.map((function(t,e){return We([e===n?"M":"L"],Ve(t),!1)}));return e?r.reverse():r}function jG(t,e){if(void 0===e&&(e=!1),t.length<=2)return IG(t);for(var n=[],r=t.length,i=0;i<r;i+=1){var o=e?t[r-i-1]:t[i];Ne(o,n.slice(-2))||n.push.apply(n,We([],Ve(o),!1))}var a=dz(n,!1);return e?a.unshift(We(["M"],Ve(t[r-1]),!1)):a.unshift(We(["M"],Ve(t[0]),!1)),a}function BG(t,e,n){var r=me(t);return r.push(["L",e,n],["L",0,n],["Z"]),r}function FG(t){return 0===t.length?[0,0]:[ee(ue(t,(function(t){return ee(t)||0}))),te(le(t,(function(t){return te(t)||0})))]}function zG(t){for(var e=me(t),n=e[0].length,r=Ve([Array(n).fill(0),Array(n).fill(0)],2),i=r[0],o=r[1],a=0;a<e.length;a+=1)for(var s=e[a],l=0;l<n;l+=1)s[l]>=0?(s[l]+=i[l],i[l]=s[l]):(s[l]+=o[l],o[l]=s[l]);return e}var GG=function(t){function e(e){return t.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return je(e,t),Object.defineProperty(e.prototype,"rawData",{get:function(){var t=this.attributes.data;if(!t||0===(null==t?void 0:t.length))return[[]];var e=me(t);return ae(e[0])?[e]:e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.isStack?zG(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){var t=this.scales.y,e=Ve(t.getOptions().domain||[0,0],2),n=e[0],r=e[1];return r<0?t.map(r):t.map(n<0?0:n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"containerShape",{get:function(){var t=this.attributes;return{width:t.width,height:t.height}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linesStyle",{get:function(){var t=this,e=this.attributes,n=e.type,r=e.isStack,i=e.smooth;if("line"!==n)throw new Error("linesStyle can only be used in line type");var o=Sz(this.attributes,"area"),a=Sz(this.attributes,"line"),s=this.containerShape.width,l=this.data;if(0===l[0].length)return{lines:[],areas:[]};var u=this.scales,c=function(t,e){var n,r=e.x,i=e.y,o=Ve(i.getOptions().range||[0,0],2),a=o[0],s=o[1];return s>a&&(n=Ve([a,s],2),s=n[0],a=n[1]),t.map((function(t){return t.map((function(t,e){return[r.map(e),oe(i.map(t),s,a)]}))}))}(l,{type:"line",x:u.x,y:u.y}),h=[];if(o){var d=this.baseline;h=r?i?function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=t[i],a=jG(o),s=void 0;if(0===i)s=BG(a,e,n);else{var l=jG(t[i-1],!0),u=o[0];l[0][0]="L",s=We(We(We([],Ve(a),!1),Ve(l),!1),[We(["M"],Ve(u),!1),["Z"]],!1)}r.push(s)}return r}(c,s,d):function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=IG(t[i]),a=void 0;if(0===i)a=BG(o,e,n);else{var s=IG(t[i-1],!0);s[0][0]="L",a=We(We(We([],Ve(o),!1),Ve(s),!1),[["Z"]],!1)}r.push(a)}return r}(c,s,d):function(t,e,n,r){return t.map((function(t){return BG(e?jG(t):IG(t),n,r)}))}(c,i,s,d)}return{lines:c.map((function(e,n){return Be({stroke:t.getColor(n),d:i?jG(e):IG(e)},a)})),areas:h.map((function(e,n){return Be({d:e,fill:t.getColor(n)},o)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnsStyle",{get:function(){var t=this,e=Sz(this.attributes,"column"),n=this.attributes,r=n.isStack,i=n.type,o=n.scale;if("column"!==i)throw new Error("columnsStyle can only be used in column type");var a=this.containerShape.height,s=this.rawData;if(!s)return{columns:[]};r&&(s=zG(s));var l=this.createScales(s),u=l.x,c=l.y,h=Ve(FG(s),2),d=h[0],f=h[1],p=new DG({domain:[0,f-(d>0?0:d)],range:[0,a*o]}),g=u.getBandWidth(),v=this.rawData;return{columns:s.map((function(n,i){return n.map((function(n,o){var a=g/s.length;return Be(Be({fill:t.getColor(i)},e),r?{x:u.map(o),y:c.map(n),width:g,height:p.map(v[i][o])}:{x:u.map(o)+a*i,y:n>=0?c.map(n):c.map(0),width:a,height:p.map(Math.abs(n))})}))}))}},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){var n,r,i;(n=e,r=".container",i="rect",n.querySelector(r)?yz(n).select(r):yz(n).append(i)).attr("className","container").node();var o=t.type,a=t.x,s=t.y,l="spark".concat(o),u=Be({x:a,y:s},"line"===o?this.linesStyle:this.columnsStyle);yz(e).selectAll(".spark").data([o]).join((function(t){return t.append((function(t){return"line"===t?new _G({className:l,style:u}):new LG({className:l,style:u})})).attr("className","spark ".concat(l))}),(function(t){return t.update(u)}),(function(t){return t.remove()}))},e.prototype.getColor=function(t){var e=this.attributes.color;return $t(e)?e[t%e.length]:Ut(e)?e.call(null,t):e},e.prototype.createScales=function(t){var e,n,r=this.attributes,i=r.type,o=r.scale,a=r.range,s=void 0===a?[]:a,l=r.spacing,u=this.containerShape,c=u.width,h=u.height,d=Ve(FG(t),2),f=d[0],p=d[1],g=new DG({domain:[null!==(e=s[0])&&void 0!==e?e:f,null!==(n=s[1])&&void 0!==n?n:p],range:[h,h*(1-o)]});return"line"===i?{type:i,x:new DG({domain:[0,t[0].length-1],range:[0,c]}),y:g}:{type:i,x:new OG({domain:t[0].map((function(t,e){return e})),range:[0,c],paddingInner:l,paddingOuter:l/2,align:.5}),y:g}},e.tag="sparkline",e}(Rz);function VG(t){if(!t)return{enter:!1,update:!1,exit:!1};var e=["enter","update","exit"],n=Object.fromEntries(Object.entries(t).filter((function(t){var n=Ve(t,1)[0];return!e.includes(n)})));return Object.fromEntries(e.map((function(e){return function(t){return"boolean"!=typeof t&&"enter"in t&&"update"in t&&"exit"in t}(t)?!1===t[e]?[e,!1]:[e,Be(Be({},t[e]),n)]:[e,n]})))}function WG(t,e){t?t.finished.then(e):e()}function HG(t,e){"update"in t?t.update(e):t.attr(e)}function UG(t,e,n){return 0===e.length?null:n?t.animate(e,n):(HG(t,{style:e.slice(-1)[0]}),null)}function YG(t,e,n){var r={},i={};return Object.entries(e).forEach((function(e){var n=Ve(e,2),o=n[0],a=n[1];if(!Yt(a)){var s=t.style[o]||t.parsedStyle[o]||0;s!==a&&(r[o]=s,i[o]=a)}})),n?UG(t,[r,i],Be({fill:"both"},n)):(HG(t,i),null)}function $G(t,e){return t.style.opacity||(t.style.opacity=1),YG(t,{opacity:0},e)}var qG={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},XG={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},KG={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},ZG=WF({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),QG=WF({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),JG=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.render=function(t,e){var n=t.x,r=t.y,i=t.size,o=void 0===i?10:i,a=t.radius,s=void 0===a?o/4:a,l=t.orientation,u=Fe(t,["x","y","size","radius","orientation"]),c=o,h=2.4*c,d=yz(e).maybeAppendByClassName(QG.iconRect,"rect").styles(Be(Be({},u),{width:c,height:h,radius:s,x:n-c/2,y:r-h/2,transformOrigin:"center"})),f=n+1/3*c-c/2,p=n+2/3*c-c/2,g=r+1/4*h-h/2,v=r+3/4*h-h/2;d.maybeAppendByClassName("".concat(QG.iconLine,"-1"),"line").styles(Be({x1:f,x2:f,y1:g,y2:v},u)),d.maybeAppendByClassName("".concat(QG.iconLine,"-2"),"line").styles(Be({x1:p,x2:p,y1:g,y2:v},u)),"vertical"===l&&(d.node().style.transform="rotate(90)")},e}(Rz),tV=function(t){function e(e){return t.call(this,e,KG)||this}return je(e,t),e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.x,i=n.y,o=n.showLabel,a=Sz(this.attributes,"label"),s=a.x,l=void 0===s?0:s,u=a.y,c=void 0===u?0:u,h=a.transform,d=a.transformOrigin,f=Ve(Oz(Fe(a,["x","y","transform","transformOrigin"]),[]),2),p=f[0],g=f[1],v=yz(t).maybeAppendByClassName(QG.labelGroup,"g").styles(g),m=Be(Be({},XG),p),y=m.text,b=Fe(m,["text"]);tz(!!o,v,(function(t){e.label=t.maybeAppendByClassName(QG.label,"text").styles(Be(Be({},b),{x:r+l,y:i+c,transform:h,transformOrigin:d,text:"".concat(y)})),e.label.on("mousedown",(function(t){t.stopPropagation()})),e.label.on("touchstart",(function(t){t.stopPropagation()}))}))},e.prototype.renderIcon=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.orientation,o=e.type,a=Be(Be({x:n,y:r,orientation:i},qG),Sz(this.attributes,"icon")),s=this.attributes.iconShape,l=void 0===s?function(){return new JG({style:a})}:s;yz(t).maybeAppendByClassName(QG.iconGroup,"g").selectAll(QG.icon.class).data([l]).join((function(t){return t.append("string"==typeof l?l:function(){return l(o)}).attr("className",QG.icon.name)}),(function(t){return t.update(a)}),(function(t){return t.remove()}))},e.prototype.render=function(t,e){this.renderIcon(e),this.renderLabel(e)},e}(Rz),eV=function(t){function e(e){var n=t.call(this,e,Be(Be(Be({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(t){return t.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},Nz(KG,"handle")),Nz(qG,"handleIcon")),Nz(XG,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(t){return function(e){e.stopPropagation(),n.target=t,n.prevPos=n.getOrientVal(QF(e));var r=n.availableSpace,i=r.x,o=r.y,a=n.getBBox(),s=a.x,l=a.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([i,o])-n.getOrientVal([+s,+l])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(t){var e=n.attributes,r=e.slidable,i=e.brushable,o=e.type;t.stopPropagation();var a=n.getOrientVal(QF(t)),s=a-n.prevPos;if(s){var l=n.getRatio(s);switch(n.target){case"start":r&&n.setValuesOffset(l);break;case"end":r&&n.setValuesOffset(0,l);break;case"selection":r&&n.setValuesOffset(l,l);break;case"track":if(!i)return;n.selectionWidth+=l,"range"===o?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0)}n.prevPos=a}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(t){var e=n.attributes,r=e.onChange,i=e.type,o="range"===i?t:t[1],a="range"===i?n.getValues():n.getValues()[1],s=new Ds("valuechange",{detail:{oldValue:o,value:a}});n.dispatchEvent(s),null==r||r(a)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return je(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return this.attributes.values},set:function(t){this.attributes.values=this.clampValues(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sparklineStyle",{get:function(){if("horizontal"!==this.attributes.orientation)return null;var t=Sz(this.attributes,"sparkline");return Be(Be({zIndex:0},this.availableSpace),t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t=this.attributes,e=t.trackLength,n=t.trackSize,r=Ve(this.getOrientVal([[e,n],[n,e]]),2);return{width:r[0],height:r[1]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes;t.x,t.y;var e=Ve(bz(t.padding),4),n=e[0],r=e[1],i=e[2],o=e[3],a=this.shape;return{x:o,y:n,width:a.width-(o+r),height:a.height-(n+i)}},enumerable:!1,configurable:!0}),e.prototype.getValues=function(){return this.values},e.prototype.setValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1),this.attributes.values=t;var n=!1!==e&&this.attributes.animate;this.updateSelectionArea(n),this.updateHandlesPosition(n)},e.prototype.updateSelectionArea=function(t){var e=this.calcSelectionArea();this.foregroundGroup.selectAll(ZG.selection.class).each((function(n,r){YG(this,e[r],t)}))},e.prototype.updateHandlesPosition=function(t){this.attributes.showHandle&&(this.startHandle&&YG(this.startHandle,this.getHandleStyle("start"),t),this.endHandle&&YG(this.endHandle,this.getHandleStyle("end"),t))},e.prototype.innerSetValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1);var n=this.values,r=this.clampValues(t);this.attributes.values=r,this.setValues(r),e&&this.onValueChange(n)},e.prototype.renderTrack=function(t){var e=this.attributes,n=e.x,r=e.y,i=Sz(this.attributes,"track");this.trackShape=yz(t).maybeAppendByClassName(ZG.track,"rect").styles(Be(Be({x:n,y:r},this.shape),i))},e.prototype.renderBrushArea=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.brushable;this.brushArea=yz(t).maybeAppendByClassName(ZG.brushArea,"rect").styles(Be({x:n,y:r,fill:"transparent",cursor:i?"crosshair":"default"},this.shape))},e.prototype.renderSparkline=function(t){var e=this,n=this.attributes,r=n.x,i=n.y;tz("horizontal"===n.orientation,yz(t).maybeAppendByClassName(ZG.sparklineGroup,"g"),(function(t){var n=Be(Be({},e.sparklineStyle),{x:r,y:i});t.maybeAppendByClassName(ZG.sparkline,(function(){return new GG({style:n})})).update(n)}))},e.prototype.renderHandles=function(){var t,e=this,n=this.attributes,r=n.showHandle,i=n.type,o=r?"range"===i?["start","end"]:["end"]:[],a=this;null===(t=this.foregroundGroup)||void 0===t||t.selectAll(ZG.handle.class).data(o.map((function(t){return{type:t}})),(function(t){return t.type})).join((function(t){return t.append((function(t){var n=t.type;return new tV({style:e.getHandleStyle(n)})})).each((function(t){var e=t.type;this.attr("class","".concat(ZG.handle.name," ").concat(e,"-handle"));var n="".concat(e,"Handle");a[n]=this,this.addEventListener("pointerdown",a.onDragStart(e))}))}),(function(t){return t.each((function(t){var e=t.type;this.update(a.getHandleStyle(e))}))}),(function(t){return t.each((function(t){var e=t.type,n="".concat(e,"Handle");a[n]=void 0})).remove()}))},e.prototype.renderSelection=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.type,o=e.selectionType;this.foregroundGroup=yz(t).maybeAppendByClassName(ZG.foreground,"g");var a=Sz(this.attributes,"selection"),s=function(t){return t.style("visibility",(function(t){return t.show?"visible":"hidden"})).style("cursor",(function(t){return"select"===o?"grab":"invert"===o?"crosshair":"default"})).styles(Be(Be({},a),{transform:"translate(".concat(n,", ").concat(r,")")}))},l=this;this.foregroundGroup.selectAll(ZG.selection.class).data("value"===i?[]:this.calcSelectionArea().map((function(t,e){return{style:Be({},t),index:e,show:"select"===o?1===e:1!==e}})),(function(t){return t.index})).join((function(t){return t.append("rect").attr("className",ZG.selection.name).call(s).each((function(t,e){var n=this;1===e?(l.selectionShape=yz(this),this.on("pointerdown",(function(t){n.attr("cursor","grabbing"),l.onDragStart("selection")(t)})),l.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),l.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),l.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",(function(){n.attr("cursor","grabbing")})),this.addEventListener("pointerup",(function(){n.attr("cursor","pointer")})),this.addEventListener("pointerover",(function(){n.attr("cursor","pointer")}))):this.on("pointerdown",l.onDragStart("track"))}))}),(function(t){return t.call(s)}),(function(t){return t.remove()})),this.updateSelectionArea(!1),this.renderHandles()},e.prototype.render=function(t,e){this.renderTrack(e),this.renderSparkline(e),this.renderBrushArea(e),this.renderSelection(e)},e.prototype.clampValues=function(t,e){var n;void 0===e&&(e=4);var r=Ve(this.range,2),i=r[0],o=r[1],a=Ve(this.getValues().map((function(t){return cz(t,e)})),2),s=a[0],l=a[1],u=Ve(((Array.isArray(t)?t:[s,null!=t?t:l])||[s,l]).map((function(t){return cz(t,e)})),2),c=u[0],h=u[1];if("value"===this.attributes.type)return[0,oe(h,i,o)];c>h&&(c=(n=Ve([h,c],2))[0],h=n[1]);var d=h-c;return d>o-i?[i,o]:c<i?s===i&&l===h?[i,h]:[i,d+i]:h>o?l===o&&s===c?[c,o]:[o-d,o]:[c,h]},e.prototype.calcSelectionArea=function(t){var e=Ve(this.clampValues(t),2),n=e[0],r=e[1],i=this.availableSpace,o=i.x,a=i.y,s=i.width,l=i.height;return this.getOrientVal([[{y:a,height:l,x:o,width:n*s},{y:a,height:l,x:n*s+o,width:(r-n)*s},{y:a,height:l,x:r*s,width:(1-r)*s}],[{x:o,width:s,y:a,height:n*l},{x:o,width:s,y:n*l+a,height:(r-n)*l},{x:o,width:s,y:r*l,height:(1-r)*l}]])},e.prototype.calcHandlePosition=function(t){var e=this.attributes.handleIconOffset,n=this.availableSpace,r=n.x,i=n.y,o=n.width,a=n.height,s=Ve(this.clampValues(),2),l=s[0],u=s[1],c="start"===t?-e:e,h=("start"===t?l:u)*this.getOrientVal([o,a])+c;return{x:r+this.getOrientVal([h,o/2]),y:i+this.getOrientVal([a/2,h])}},e.prototype.inferTextStyle=function(t){return"horizontal"===this.attributes.orientation?{}:"start"===t?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:"end"===t?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},e.prototype.calcHandleText=function(t){var e,n=this.attributes,r=n.type,i=n.orientation,o=n.formatter,a=n.autoFitLabel,s=Sz(this.attributes,"handle"),l=Sz(s,"label"),u=s.spacing,c=this.getHandleSize(),h=this.clampValues(),d=o("start"===t?h[0]:h[1]),f=new jF({style:Be(Be(Be({},l),this.inferTextStyle(t)),{text:d})}),p=f.getBBox(),g=p.width,v=p.height;if(f.destroy(),!a){if("value"===r)return{text:d,x:0,y:-v-u};var m=u+c+("horizontal"===i?g/2:0);return(e={text:d})["horizontal"===i?"x":"y"]="start"===t?-m:m,e}var y=0,b=0,x=this.availableSpace,E=x.width,w=x.height,k=this.calcSelectionArea()[1],M=k.x,S=k.y,N=k.width,O=k.height,T=u+c;if("horizontal"===i){var C=T+g/2;if("start"===t)y=M-T-g>0?-C:C;else y=E-M-N-T>g?C:-C}else{var A=v+T;b="start"===t?S-c>v?-A:T:w-(S+O)-c>v?A:-T}return{x:y,y:b,text:d}},e.prototype.getHandleLabelStyle=function(t){var e=Sz(this.attributes,"handleLabel");return Be(Be(Be({},e),this.calcHandleText(t)),this.inferTextStyle(t))},e.prototype.getHandleIconStyle=function(){var t=this.attributes.handleIconShape,e=Sz(this.attributes,"handleIcon"),n=this.getOrientVal(["ew-resize","ns-resize"]),r=this.getHandleSize();return Be({cursor:n,shape:t,size:r},e)},e.prototype.getHandleStyle=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.showLabel,o=e.showLabelOnInteraction,a=e.orientation,s=this.calcHandlePosition(t),l=s.x,u=s.y,c=this.calcHandleText(t),h=i;return!i&&o&&(h=!!this.target),Be(Be(Be({},Nz(this.getHandleIconStyle(),"icon")),Nz(Be(Be({},this.getHandleLabelStyle(t)),c),"label")),{transform:"translate(".concat(l+n,", ").concat(u+r,")"),orientation:a,showLabel:h,type:t,zIndex:3})},e.prototype.getHandleSize=function(){var t=this.attributes,e=t.handleIconSize,n=t.width,r=t.height;return e||Math.floor((this.getOrientVal([+r,+n])+4)/2.4)},e.prototype.getOrientVal=function(t){var e=Ve(t,2),n=e[0],r=e[1];return"horizontal"===this.attributes.orientation?n:r},e.prototype.setValuesOffset=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=!1);var r=this.attributes.type,i=Ve(this.getValues(),2),o=[i[0]+("range"===r?t:0),i[1]+e].sort();n?this.setValues(o):this.innerSetValues(o,!0)},e.prototype.getRatio=function(t){var e=this.availableSpace,n=e.width,r=e.height;return t/this.getOrientVal([n,r])},e.prototype.dispatchCustomEvent=function(t,e,n){var r=this;t.on(e,(function(t){t.stopPropagation(),r.dispatchEvent(new Ds(n,{detail:t}))}))},e.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var t=this.brushArea;this.dispatchCustomEvent(t,"click","trackClick"),this.dispatchCustomEvent(t,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(t,"pointerleave","trackMouseleave"),t.on("pointerdown",this.onDragStart("track"))},e.prototype.onScroll=function(t){if(this.attributes.scrollable){var e=t.deltaX,n=t.deltaY||e,r=this.getRatio(n);this.setValuesOffset(r,r,!0)}},e.tag="slider",e}(Rz),nV={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 Ul({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:[]};ke({},nV,{style:{type:"arc"}}),ke({},nV,{style:{}});var rV=WF({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"),iV=WF({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function oV(t){return t.reduce((function(t,e,n){return t.push(We([0===n?"M":"L"],Ve(e),!1)),t}),[])}function aV(t,e,n){return"surround"===e.type?function(t,e,n){var r=e.connect,i=void 0===r?"line":r,o=e.center;if("line"===i)return oV(t);if(!o)return[];var a=lz(t[0],o),s=n?0:1;return t.reduce((function(t,e,n){return 0===n?t.push(We(["M"],Ve(e),!1)):t.push(We(["A",a,a,0,0,s],Ve(e),!1)),t}),[])}(t,e,n):oV(t)}function sV(t,e,n){var r=n.type,i=n.connect,o=n.center,a=n.closed?[["Z"]]:[],s=Ve([aV(t,n),aV(e.slice().reverse(),n,!0)],2),l=s[0],u=s[1],c=Ve([t[0],e.slice(-1)[0]],2),h=c[0],d=c[1],f=function(t,e){return[l,t,u,e,a].flat()};if("line"===i||"surround"===r)return f([We(["L"],Ve(d),!1)],[We(["L"],Ve(h),!1)]);if(!o)throw new Error("Arc grid need to specified center");var p=Ve([lz(d,o),lz(h,o)],2),g=p[0],v=p[1];return f([We(["A",g,g,0,0,1],Ve(d),!1),We(["L"],Ve(d),!1)],[We(["A",v,v,0,0,0],Ve(h),!1),We(["L"],Ve(h),!1)])}var lV=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.render=function(t,e){t.type,t.center,t.areaFill,t.closed;var n=Fe(t,["type","center","areaFill","closed"]),r=function(t){var e=t.data,n=void 0===e?[]:e;return t.closed?n.map((function(t){var e=t.points,n=Ve(e,1)[0];return Be(Be({},t),{points:We(We([],Ve(e),!1),[n],!1)})})):n}(t),i=yz(e).maybeAppendByClassName(iV.lineGroup,"g"),o=yz(e).maybeAppendByClassName(iV.regionGroup,"g"),a=function(t,e,n,r){var i=n.animate,o=n.isBillboard,a=e.map((function(t,e){return{id:t.id||"grid-line-".concat(e),d:aV(t.points,n)}}));return t.selectAll(iV.line.class).data(a,(function(t){return t.id})).join((function(t){return t.append("path").each((function(t,e){var n=GF(gz(Be({d:t.d},r)),[t,e,a]);this.attr(Be({class:iV.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:o},n))}))}),(function(t){return t.transition((function(t,e){return YG(this,GF(gz(Be({d:t.d},r)),[t,e,a]),i.update)}))}),(function(t){return t.transition((function(){var t=this,e=$G(this,i.exit);return WG(e,(function(){return t.remove()})),e}))})).transitions()}(i,r,t,n),s=function(t,e,n){var r=n.animate,i=n.connect,o=n.areaFill;if(e.length<2||!o||!i)return[];for(var a=Array.isArray(o)?o:[o,"transparent"],s=function(t){return a[t%a.length]},l=[],u=0;u<e.length-1;u++){var c=Ve([e[u].points,e[u+1].points],2),h=sV(c[0],c[1],n);l.push({d:h,fill:s(u)})}return t.selectAll(iV.region.class).data(l,(function(t,e){return e})).join((function(t){return t.append("path").each((function(t,e){var n=GF(t,[t,e,l]);this.attr(n)})).attr("className",iV.region.name)}),(function(t){return t.transition((function(t,e){return YG(this,GF(t,[t,e,l]),r.update)}))}),(function(t){return t.transition((function(){var t=this,e=$G(this,r.exit);return WG(e,(function(){return t.remove()})),e}))})).transitions()}(o,r,t);return We(We([],Ve(a),!1),Ve(s),!1)},e}(Rz);function uV(t,e){return Object.fromEntries(Object.entries(t).map((function(t){var n=Ve(t,2);return[n[0],GF(n[1],e)]})))}function cV(t,e){return e&&Ut(e)?t.filter(e):t}function hV(t,e){var n=e.startAngle;return(e.endAngle-n)*t+n}function dV(t,e){if("linear"===e.type){var n=Ve(e.startPos,2),r=n[0],i=n[1],o=Ve(e.endPos,2),a=Ve([o[0]-r,o[1]-i],2);return uz([a[0],a[1]])}var s=BF(hV(t,e));return[-Math.sin(s),Math.cos(s)]}function fV(t,e,n){return function(t,e){return e?[t[1],-t[0]]:[-t[1],t[0]]}(dV(t,n),"positive"!==e)}function pV(t,e){return fV(t,e.labelDirection,e)}function gV(t,e){return"linear"===e.type?function(t,e){var n=Ve(e.startPos,2),r=n[0],i=n[1],o=Ve(e.endPos,2),a=Ve([o[0]-r,o[1]-i],2);return[r+a[0]*t,i+a[1]*t]}(t,e):function(t,e){var n=e.radius,r=Ve(e.center,2),i=r[0],o=r[1],a=BF(hV(t,e));return[i+n*Math.cos(a),o+n*Math.sin(a)]}(t,e)}function vV(t){return 0===dV(0,t)[1]}function mV(t){return 0===dV(0,t)[0]}function yV(t,e){return e-t==360}function bV(t,e,n,r,i){var o=e-t,a=Ve([i,i],2),s=a[0],l=a[1],u=Ve([BF(t),BF(e)],2),c=u[0],h=u[1],d=function(t){return[n+i*Math.cos(t),r+i*Math.sin(t)]},f=Ve(d(c),2),p=f[0],g=f[1],v=Ve(d(h),2),m=v[0],y=v[1];if(yV(t,e)){var b=Ve(d((h+c)/2),2);return[["M",p,g],["A",s,l,0,1,0,b[0],b[1]],["A",s,l,0,1,0,m,y]]}var x=o>180?1:0,E=t>e?0:1;return"M".concat(p,",").concat(g,",A").concat(s,",").concat(l,",0,").concat(x,",").concat(E,",").concat(m,",").concat(y)}function xV(t,e,n,r){var i=e.startAngle,o=e.endAngle,a=e.center,s=e.radius;return t.selectAll(rV.line.class).data([{d:bV.apply(void 0,We(We([i,o],Ve(a),!1),[s],!1))}],(function(t,e){return e})).join((function(t){return t.append("path").attr("className",rV.line.name).styles(e).styles({d:function(t){return t.d}})}),(function(t){return t.transition((function(){var t=this,e=function(t,e,n,r){if(!r)return t.attr("__keyframe_data__",n),null;var i=r.duration,o=void 0===i?0:i,a=nz(e,n),s=Math.ceil(+o/16),l=new Array(s).fill(0).map((function(t,e,n){return{__keyframe_data__:a(e/(n.length-1))}}));return t.animate(l,Be({fill:"both"},r))}(this,function(t){var e=t.attributes,n=e.startAngle,r=e.endAngle,i=e.center,o=e.radius;return We(We([n,r],Ve(i),!1),[o],!1)}(this),We(We([i,o],Ve(a),!1),[s],!1),r.update);if(e){var n=function(){var e=Oe(t.attributes,"__keyframe_data__");t.style.d=bV.apply(void 0,We([],Ve(e),!1))};e.onframe=n,e.onfinish=n}return e})).styles(e)}),(function(t){return t.remove()})).styles(n).transitions()}function EV(t){var e=Ve(t,2),n=Ve(e[0],2),r=n[0],i=n[1],o=Ve(e[1],2);return{x1:r,y1:i,x2:o[0],y2:o[1]}}function wV(t,e,n,r){var i=e.showTrunc,o=e.startPos,a=e.endPos,s=e.truncRange,l=e.lineExtension,u=Ve([o,a],2),c=Ve(u[0],2),h=c[0],d=c[1],f=Ve(u[1],2),p=f[0],g=f[1],v=Ve(l?function(t,e,n){void 0===n&&(n=[0,0]);var r=Ve([t,e,n],3),i=Ve(r[0],2),o=i[0],a=i[1],s=Ve(r[1],2),l=s[0],u=s[1],c=Ve(r[2],2),h=c[0],d=c[1],f=Ve([l-o,u-a],2),p=f[0],g=f[1],v=Math.sqrt(Math.pow(p,2)+Math.pow(g,2)),m=Ve([-h/v,d/v],2),y=m[0],b=m[1];return[y*p,y*g,b*p,b*g]}(o,a,l):new Array(4).fill(0),4),m=v[0],y=v[1],b=v[2],x=v[3],E=function(e){return t.selectAll(rV.line.class).data(e,(function(t,e){return e})).join((function(t){return t.append("line").attr("className",(function(t){return"".concat(rV.line.name," ").concat(t.className)})).styles(n).transition((function(t){return YG(this,EV(t.line),!1)}))}),(function(t){return t.styles(n).transition((function(t){return YG(this,EV(t.line),r.update)}))}),(function(t){return t.remove()})).transitions()};if(!i||!s)return E([{line:[[h+m,d+y],[p+b,g+x]],className:rV.line.name}]);var w=Ve(s,2),k=w[0],M=w[1],S=p-h,N=g-d,O=Ve([h+S*k,d+N*k],2),T=O[0],C=O[1],A=Ve([h+S*M,d+N*M],2),P=A[0],R=A[1],D=E([{line:[[h+m,d+y],[T,C]],className:rV.lineFirst.name},{line:[[P,R],[p+b,g+x]],className:rV.lineSecond.name}]);return function(t,e){e.truncRange,e.truncShape,e.lineExtension}(0,e),D}function kV(t,e,n){var r,i=e.type,o=Sz(e,"line");return r="linear"===i?wV(t,e,hz(o,"arrow"),n):xV(t,e,hz(o,"arrow"),n),function(t,e,n,r){var i,o=n.showArrow,a=n.showTrunc,s=n.lineArrow,l=n.lineArrowOffset,u=n.lineArrowSize;if(i="arc"===e?t.select(rV.line.class):a?t.select(rV.lineSecond.class):t.select(rV.line.class),!o||!s||"arc"===n.type&&yV(n.startAngle,n.endAngle)){var c=i.node();c&&(c.style.markerEnd=void 0)}else{var h=JF(s);h.attr(r),vz(h,u),i.style("markerEnd",h).style("markerEndOffset",-l)}}(t,i,e,o),r}function MV(t){var e=t.type,n=t.gridCenter;return"linear"===e?n:n||t.center}function SV(t,e){var n=e.gridLength;return t.map((function(t,r){var i=t.value,o=Ve(gV(i,e),2),a=o[0],s=o[1],l=Ve(rz(function(t,e){return fV(t,e.gridDirection,e)}(i,e),n),2);return{id:r,points:[[a,s],[a+l[0],s+l[1]]]}}))}function NV(t,e,n,r){var i=Sz(n,"grid"),o=i.type,a=i.areaFill,s=MV(n),l=cV(e,n.gridFilter),u="segment"===o?SV(l,n):function(t,e){var n=e.gridControlAngles,r=MV(e);if(!r)throw new Error("grid center is not provide");if(t.length<2)throw new Error("Invalid grid data");if(!n||0===n.length)throw new Error("Invalid gridControlAngles");var i=Ve(r,2),o=i[0],a=i[1];return t.map((function(t,r){var i=Ve(gV(t.value,e),2),s=i[0],l=i[1],u=Ve([s-o,l-a],2),c=u[0],h=u[1],d=[];return n.forEach((function(t){var e=BF(t),n=Ve([Math.cos(e),Math.sin(e)],2),r=n[0],i=n[1],s=c*r-h*i+o,l=c*i+h*r+a;d.push([s,l])})),{points:d,id:r}}))}(l,n),c=Be(Be({},i),{center:s,areaFill:Ut(a)?l.map((function(t,e){return GF(a,[t,e,l])})):a,animate:r,data:u});return t.selectAll(rV.grid.class).data([1]).join((function(t){return t.append((function(){return new lV({style:c})})).attr("className",rV.grid.name)}),(function(t){return t.transition((function(){return this.update(c)}))}),(function(t){return t.remove()})).transitions()}var OV=function(){function t(t,e,n,r){this.set(t,e,n,r)}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),t.prototype.rotatedPoints=function(t,e,n){var r=this,i=r.x1,o=r.y1,a=r.x2,s=r.y2,l=Math.cos(t),u=Math.sin(t),c=e-e*l+n*u,h=n-e*u-n*l;return[[l*i-u*s+c,u*i+l*s+h],[l*a-u*s+c,u*a+l*s+h],[l*i-u*o+c,u*i+l*o+h],[l*a-u*o+c,u*a+l*o+h]]},t.prototype.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},t.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},t}();function TV(t,e){var n=t.getEulerAngles()||0;t.setEulerAngles(0);var r=t.getBounds(),i=Ve(r.min,2),o=i[0],a=i[1],s=Ve(r.max,2),l=s[0],u=s[1],c=t.getBBox(),h=c.width,d=c.height,f=0,p=0,g=o,v=a,m=XF(t);if(m){d-=1.5;var y=m.style.textAlign,b=m.style.textBaseline;"center"===y?g=(o+l)/2:"right"!==y&&"end"!==y||(g=l),"middle"===b?v=(a+u)/2:"bottom"===b&&(v=u)}var x=Ve(bz(e),4),E=x[0],w=void 0===E?0:E,k=x[1],M=void 0===k?0:k,S=x[2],N=void 0===S?w:S,O=x[3],T=new OV((f+=o)-(void 0===O?M:O),(p+=a)-w,f+h+M,p+d+N);return t.setEulerAngles(n),T.rotatedPoints(BF(n),g,v)}function CV(t,e){return e[0]<=Math.max(t[0][0],t[1][0])&&e[0]<=Math.min(t[0][0],t[1][0])&&e[1]<=Math.max(t[0][1],t[1][1])&&e[1]<=Math.min(t[0][1],t[1][1])}function AV(t,e,n){var r=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return 0===r?0:r<0?2:1}function PV(t,e){return e.every((function(e){return function(t,e){var n=t.length;if(n<3)return!1;var r,i,o,a,s,l,u=[e,[9999,e[1]]],c=0,h=0;do{var d=[t[h],t[(h+1)%n]];if(i=u,o=void 0,a=void 0,s=void 0,l=void 0,o=AV((r=d)[0],r[1],i[0]),a=AV(r[0],r[1],i[1]),s=AV(i[0],i[1],r[0]),l=AV(i[0],i[1],r[1]),o!==a&&s!==l||0===o&&CV(r,i[0])||0===a&&CV(r,i[1])||0===s&&CV(i,r[0])||0===l&&CV(i,r[1])){if(0===AV(d[0],e,d[1]))return CV(d,e);c++}h=(h+1)%n}while(0!==h);return!!(1&c)}(t,e)}))}function RV(t,e){return[[t[0],t[1],t[2],t[3]],[t[2],t[3],t[4],t[5]],[t[4],t[5],t[6],t[7]],[t[6],t[7],t[0],t[1]]].some((function(t){return function(t,e){var n=Ve(t,4),r=n[0],i=n[1],o=n[2],a=n[3],s=Ve(e,4),l=s[0],u=s[1],c=o-r,h=a-i,d=s[2]-l,f=s[3]-u,p=c*f-d*h;if(0===p)return!1;var g=p>0,v=r-l,m=i-u,y=c*m-h*v;if(y<0===g)return!1;var b=d*m-f*v;return b<0!==g&&y>p!==g&&b>p!==g}(e,t)}))}function DV(t,e,n){var r,i,o=e.crossPadding,a=new Set,s=null,l=function(t,e){var n=t.type,r=t.labelDirection,i=t.crossSize;if(!i)return!1;if("arc"===n){var o=t.center,a=t.radius,s=Ve(o,2),l=s[0],u=s[1],c="negative"===r?0:i,h=-a-c,d=a+c,f=Ve(bz(e),4),p=f[0],g=f[1],v=f[2],m=f[3];return new OV(l+h-m,u+h-p,l+d+g,u+d+v)}var y=Ve(t.startPos,2),b=y[0],x=y[1],E=Ve(t.endPos,2),w=E[0],k=E[1],M=Ve(mV(t)?[-e,0,e,0]:[0,e,0,-e],4),S=M[0],N=M[1],O=M[2],T=M[3],C=rz(pV(0,t),i),A=new OV(b,x,w,k);return A.x1+=T,A.y1+=S,A.x2+=N+C[0],A.y2+=O+C[1],A}(e,o),u=function(t){return!l||function(t,e,n){var r=t.x1,i=t.x2,o=t.y1,a=t.y2;return PV([[r,o],[i,o],[i,a],[r,a]],TV(e,n))}(l,t)},c=function(t,e){return!t||!t.firstChild||!function(t,e,n){var r,i,o=TV(t,n).flat(1),a=TV(e,n).flat(1),s=[[o[0],o[1],o[2],o[3]],[o[0],o[1],o[4],o[5]],[o[4],o[5],o[6],o[7]],[o[2],o[3],o[6],o[7]]];try{for(var l=Ge(s),u=l.next();!u.done;u=l.next())if(RV(a,u.value))return!0}catch(t){r={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}return!1}(t.firstChild,e.firstChild,bz(n))};try{for(var h=Ge(t),d=h.next();!d.done;d=h.next()){var f=d.value;u(f)?!s||c(s,f)?s=f:(a.add(s),a.add(f)):a.add(f)}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return Array.from(a)}function LV(t,e){return void 0===e&&(e={}),Yt(t)?0:"number"==typeof t?t:Math.floor($F(t,e))}var _V=function(t,e){var n=e.seq,r=void 0===n?2:n;return t.filter((function(t,e){return!(e%r)||(DF(t),!1)}))};var IV=new Map([["hide",function(t,e,n,r){var i=t.length,o=e.keepHeader,a=e.keepTail;if(!(i<=1||2===i&&o&&a)){var s,l,u,c=_V,h=function(t){return t.forEach(r.show),t},d=2,f=t.slice(),p=t.slice(),g=Math.min.apply(Math,We([1],Ve(t.map((function(t){return t.getBBox().width}))),!1));if("linear"===n.type&&(vV(n)||mV(n))){var v=xz(t[0]).left,m=xz(t[i-1]).right,y=Math.abs(m-v)||1;d=Math.max(Math.floor(i*g/y),d)}for(o&&(s=f.splice(0,1)[0]),a&&(l=f.splice(-1,1)[0],f.reverse()),h(f);d<t.length&&DV((u=l?We(We([l],Ve(p),!1),[s],!1):We([s],Ve(p),!1),u.filter(YF)),n,null==e?void 0:e.margin).length;){if(l&&!s&&d%2==0)f.splice(0,1).forEach(r.hide);else if(l&&s){f.splice(0,1).forEach(r.hide)}p=c(h(f),{seq:d}),d++}}}],["rotate",function(t,e,n,r){var i,o,a=e.optionalAngles,s=void 0===a?[0,45,90]:a,l=e.margin,u=e.recoverWhenFailed,c=void 0===u||u,h=t.map((function(t){return t.getLocalEulerAngles()})),d=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.rotate(t,+i)}))};try{for(var f=Ge(s),p=f.next();!p.done;p=f.next()){if(d(p.value),DV(t,n,l).length<1)return}}catch(t){i={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}c&&d(h)}],["ellipsis",function(t,e,n,r){if(!(t.length<=1)){var i=e.suffix,o=void 0===i?"...":i,a=e.minLength,s=e.maxLength,l=void 0===s?1/0:s,u=e.step,c=void 0===u?" ":u,h=e.margin,d=void 0===h?[0,0,0,0]:h,f=qF(r.getTextShape(t[0])),p=LV(c,f),g=a?LV(a,f):p,v=LV(l,f);(Yt(v)||v===1/0)&&(v=Math.max.apply(null,t.map((function(t){return t.getBBox().width}))));var m=t.slice(),y=Ve(d,4);y[0],y[1],y[2],y[3];for(var b=function(e){if(m.forEach((function(t){r.ellipsis(r.getTextShape(t),e,o)})),(m=DV(t,n,d)).length<1)return{value:void 0}},x=v;x>g+p;x-=p){var E=b(x);if("object"==typeof E)return E.value}}}],["wrap",function(t,e,n,r){var i=e.wordWrapWidth,o=void 0===i?50:i,a=e.maxLines,s=void 0===a?3:a,l=e.recoverWhenFailed,u=void 0===l||l,c=e.margin,h=void 0===c?[0,0,0,0]:c,d=t.map((function(t){return t.attr("maxLines")||1})),f=Math.min.apply(Math,We([],Ve(d),!1)),p=function(t){var e=t.type,n=t.labelDirection;return"linear"===e&&vV(t)?"negative"===n?"bottom":"top":"middle"}(n),g=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.wrap(t,o,i,p)}))};if(!(f>s)){for(var v=f;v<=s;v++)if(g(v),DV(t,n,h).length<1)return;u&&g(d)}}]]);function jV(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t*function(t){return"positive"===t?-1:1}(e)}),1)}function BV(t){for(var e=t;e<0;)e+=360;return Math.round(e%360)}function FV(t,e){var n=Ve(t,2),r=n[0],i=n[1],o=Ve(e,2),a=o[0],s=o[1],l=Ve([r*a+i*s,r*s-i*a],2),u=l[0],c=l[1];return Math.atan2(c,u)}function zV(t,e,n){var r,i=n.labelAlign;if(null===(r=e.style.transform)||void 0===r?void 0:r.includes("rotate"))return e.getLocalEulerAngles();var o=pV(t.value,n),a=dV(t.value,n);return"horizontal"===i?0:function(t){var e=(t+360)%180;return ez(e,-90,90)||(e+=180),e}(FF("perpendicular"===i?FV([1,0],o):FV([a[0]<0?-1:1,0],a)))}function GV(t,e,n){var r=n.type,i=n.labelAlign,o=pV(t,n),a=BV(e),s=BV(FF(FV([1,0],o))),l="center",u="middle";return"linear"===r?[90,270].includes(s)&&0===a?(l="center",u=1===o[1]?"top":"bottom"):s%180||![90,270].includes(a)?0===s?(ez(a,0,90,!1,!0)||ez(a,0,90)||ez(a,270,360))&&(l="start"):90===s?ez(a,0,90,!1,!0)?l="start":(ez(a,90,180)||ez(a,270,360))&&(l="end"):270===s?ez(a,0,90,!1,!0)?l="end":(ez(a,90,180)||ez(a,270,360))&&(l="start"):180===s&&(90===a?l="start":(ez(a,0,90)||ez(a,270,360))&&(l="end")):l="center":"parallel"===i?u=ez(s,0,180,!0)?"top":"bottom":"horizontal"===i?ez(s,90,270,!1)?l="end":(ez(s,270,360,!1)||ez(s,0,90))&&(l="start"):"perpendicular"===i&&(l=ez(s,90,270)?"end":"start"),{textAlign:l,textBaseline:u}}function VV(t,e,n){var r=n.showTick,i=n.tickLength,o=n.tickDirection,a=n.labelDirection,s=n.labelSpacing,l=e.indexOf(t),u=GF(s,[t,l,e]),c=Ve([pV(t.value,n),jV(a,o)],2),h=Ve(iz(rz(c[0],u+(1===c[1]?GF(r?i:0,[t,l,e]):0)),gV(t.value,n)),2);return{x:h[0],y:h[1]}}function WV(t,e){"text"===t.nodeName&&t.attr(e)}function HV(t){!function(t,e,n){var r=e.labelOverlap,i=void 0===r?[]:r;i.length&&i.forEach((function(r){var i=r.type,o=IV.get(i);(function(t,e,n){return!(e.labelOverlap.length<1)&&("hide"===n?!function(t){for(var e=t;e;){if("offscreen"===e.className)return!0;e=e.parent}return!1}(t[0]):"rotate"===n?!t.some((function(t){var e;return!!(null===(e=t.attr("transform"))||void 0===e?void 0:e.includes("rotate"))})):"ellipsis"!==n&&"wrap"!==n||t.filter((function(t){return t.querySelector("text")})).length>1)})(t,e,i)&&(null==o||o(t,r,e,n))}))}(this.node().childNodes,t,{hide:DF,show:RF,rotate:function(e,n){!function(t,e,n){e.setLocalEulerAngles(t);var r=GV(e.__data__.value,t,n),i=e.querySelector(rV.labelItem.class);i&&WV(i,r)}(+n,e,t)},ellipsis:function(t,e,n){t&&ZF(t,e||1/0,n)},wrap:function(t,e,n){var r,i;t&&(void 0===(r=n)&&(r=2),void 0===i&&(i="top"),KF(t,{wordWrap:!0,wordWrapWidth:e,maxLines:r,textBaseline:i}))},getTextShape:function(t){return t.querySelector("text")}})}function UV(t,e,n,r,i){var o=n.indexOf(e),a=yz(t).append(function(t,e,n,r){var i=r.labelFormatter;return Ut(i)?function(){return JF(GF(i,[t,e,n,pV(t.value,r)]))}:function(){return JF(t.label||"")}}(e,o,n,i)).attr("className",rV.labelItem.name).node(),s=Ve(Oz(uV(r,[e,o,n])),2),l=s[0],u=s[1],c=u.transform,h=Fe(u,["transform"]);Cz(a,c);var d=zV(e,a,i);return a.getLocalEulerAngles()||a.setLocalEulerAngles(d),WV(a,Be(Be({},GV(e.value,d,i)),l)),t.attr(h),a}function YV(t,e,n,r){var i=cV(e,n.labelFilter),o=Sz(n,"label");return t.selectAll(rV.label.class).data(i,(function(t,e){return e})).join((function(r){return r.append("g").attr("className",rV.label.name).transition((function(t){UV(this,t,e,o,n);var r=VV(t,e,n),i=r.x,a=r.y;return this.style.transform="translate(".concat(i,", ").concat(a,")"),null})).call((function(){HV.call(t,n)}))}),(function(i){return i.transition((function(t){var i=function(t,e,n,r){if(void 0===r&&(r="destroy"),function(t,e){return"text"===t.nodeName&&"text"===e.nodeName&&t.attributes.text===e.attributes.text}(t,e))return t.remove(),[null];var i=function(){"destroy"===r?t.destroy():"hide"===r&&DF(t),e.isVisible()&&RF(e)};if(!n)return i(),[null];var o=n.duration,a=void 0===o?0:o,s=n.delay,l=void 0===s?0:s,u=Math.ceil(+a/2),c=+a/4,h=Ve(t.getGeometryBounds().center,2),d=h[0],f=h[1],p=Ve(e.getGeometryBounds().center,2),g=Ve([(d+p[0])/2-d,(f+p[1])/2-f],2),v=g[0],m=g[1],y=t.style.opacity,b=void 0===y?1:y,x=e.style.opacity,E=void 0===x?1:x,w=t.style.transform||"",k=e.style.transform||"",M=t.animate([{opacity:b,transform:"translate(0, 0) ".concat(w)},{opacity:0,transform:"translate(".concat(v,", ").concat(m,") ").concat(w)}],Be(Be({fill:"both"},n),{duration:l+u+c})),S=e.animate([{opacity:0,transform:"translate(".concat(-v,", ").concat(-m,") ").concat(k),offset:.01},{opacity:E,transform:"translate(0, 0) ".concat(k)}],Be(Be({fill:"both"},n),{duration:u+c,delay:l+u-c}));return WG(S,i),[M,S]}(this.querySelector(rV.labelItem.class),UV(this,t,e,o,n),r.update),a=VV(t,e,n),s=a.x,l=a.y,u=YG(this,{transform:"translate(".concat(s,", ").concat(l,")")},r.update);return We(We([],Ve(i),!1),[u],!1)})).call((function(e){var r,i,o=Oe(e,"_transitions").flat().filter(YF);i=function(){HV.call(t,n)},0===(r=o).length?i():Promise.all(r.map((function(t){return null==t?void 0:t.finished}))).then(i)}))}),(function(t){return t.transition((function(){var t=this,e=$G(this.childNodes[0],r.exit);return WG(e,(function(){return yz(t).remove()})),e}))})).transitions()}function $V(t,e){return fV(t,e.tickDirection,e)}function qV(t,e,n,r,i){var o=Ve(function(t,e){var n=Ve(t,2);return[[0,0],[n[0]*e,n[1]*e]]}(r,GF(i.tickLength,[t,e,n])),2),a=Ve(o[0],2),s=a[0],l=a[1],u=Ve(o[1],2);return{x1:s,x2:u[0],y1:l,y2:u[1]}}function XV(t,e,n,r,i,o){var a=function(t,e,n,r,i){var o=i.tickFormatter,a=$V(e.value,i),s="line";return Ut(o)&&(s=function(){return GF(o,[e,n,r,a])}),t.append(s).attr("className",rV.tickItem.name)}(yz(this),t,e,n,r);!function(t,e,n,r,i,o,a){var s=$V(t.value,o),l=qV(t,e,n,s,o),u=l.x1,c=l.x2,h=l.y1,d=l.y2,f=Ve(Oz(uV(a,[t,e,n,s])),2),p=f[0],g=f[1];"line"===r.node().nodeName&&r.styles(Be({x1:u,x2:c,y1:h,y2:d},p)),i.attr(g),r.styles(p)}(t,e,n,a,this,r,i);var s=Ve(gV(t.value,r),2),l=s[0],u=s[1];return YG(this,{transform:"translate(".concat(l,", ").concat(u,")")},o)}var KV=WF({text:"text"},"title");function ZV(t){return/\S+-\S+/g.test(t)?t.split("-").map((function(t){return t[0]})):t.length>2?[t[0]]:t.split("")}function QV(t,e){var n=Object.entries(e).reduce((function(e,n){var r=Ve(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e}),{});t.styles(n)}var JV=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return je(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,a=this.querySelector(KV.text.class);if(!a)return new zF(0,0,+e,+n);var s=a.getBBox(),l=s.width,u=s.height,c=Ve(bz(i),4),h=c[0],d=c[1],f=c[2],p=c[3],g=Ve([0,0,+e,+n],4),v=g[0],m=g[1],y=g[2],b=g[3],x=ZV(r);if(x.includes("i"))return new zF(v,m,y,b);x.forEach((function(t,r){var i,o,a,s;"t"===t&&(i=Ve(0===r?[u+f,+n-u-f]:[0,+n],2),m=i[0],b=i[1]),"r"===t&&(o=Ve([+e-l-p],1),y=o[0]),"b"===t&&(a=Ve([+n-u-h],1),b=a[0]),"l"===t&&(s=Ve(0===r?[l+d,+e-l-d]:[0,+e],2),v=s[0],y=s[1])}));var E=Ve(bz(o),4),w=E[0],k=E[1],M=E[2],S=E[3],N=Ve([S+k,w+M],2),O=N[0],T=N[1];return new zF(v+S,m+w,y-O,b-T)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new zF(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=Fe(t,["width","height","position","spacing"]),i=Ve(Oz(r),1)[0],o=function(t){var e,n,r,i,o=t,a=o.width,s=o.height,l=o.position,u=Ve([+a/2,+s/2],2),c=Ve([+u[0],+u[1],"center","middle"],4),h=c[0],d=c[1],f=c[2],p=c[3],g=ZV(l);return g.includes("l")&&(h=(e=Ve([0,"start"],2))[0],f=e[1]),g.includes("r")&&(h=(n=Ve([+a,"end"],2))[0],f=n[1]),g.includes("t")&&(d=(r=Ve([0,"top"],2))[0],p=r[1]),g.includes("b")&&(d=(i=Ve([+s,"bottom"],2))[0],p=i[1]),{x:h,y:d,textAlign:f,textBaseline:p}}(t),a=o.x,s=o.y,l=o.textAlign,u=o.textBaseline;tz(!!r.text,yz(e),(function(t){n.title=t.maybeAppendByClassName(KV.text,"text").styles(i).call(QV,{x:a,y:s,textAlign:l,textBaseline:u}).node()}))},e}(Rz);function tW(t,e,n,r,i){var o=Ve(Oz(Sz(r,"title")),2),a=o[0],s=o[1],l=s.transform,u=s.transformOrigin,c=Fe(s,["transform","transformOrigin"]);e.styles(c);var h=l||function(t,e,n){var r=2*t.getGeometryBounds().halfExtents[1];if("vertical"===e){if("left"===n)return"rotate(-90) translate(0, ".concat(r/2,")");if("right"===n)return"rotate(-90) translate(0, -".concat(r/2,")")}return""}(t.node(),a.direction,a.position);t.styles(Be(Be({},a),{transformOrigin:u})),Cz(t.node(),h);var d=function(t,e,n){var r=n.titlePosition,i=void 0===r?"lb":r,o=n.titleSpacing,a=ZV(i),s=t.node().getLocalBounds(),l=Ve(s.min,2),u=l[0],c=l[1],h=Ve(s.halfExtents,2),d=h[0],f=h[1],p=Ve(e.node().getLocalBounds().halfExtents,2),g=p[0],v=p[1],m=Ve([u+d,c+f],2),y=m[0],b=m[1],x=Ve(bz(o),4),E=x[0],w=x[1],k=x[2],M=x[3];if(["start","end"].includes(i)&&"linear"===n.type){var S=n.startPos,N=n.endPos,O=Ve("start"===i?[S,N]:[N,S],2),T=O[0],C=O[1],A=Ve(rz(uz([-C[0]+T[0],-C[1]+T[1]]),E),2),P=A[0],R=A[1];return{x:T[0]+P,y:T[1]+R}}return a.includes("t")&&(b-=f+v+E),a.includes("r")&&(y+=d+g+w),a.includes("l")&&(y-=d+g+M),a.includes("b")&&(b+=f+v+k),{x:y,y:b}}(yz(n._offscreen||n.querySelector(rV.mainGroup.class)),e,r),f=d.x,p=d.y;return YG(e.node(),{transform:"translate(".concat(f,", ").concat(p,")")},i)}function eW(t,e,n,r){var i=t.showLine,o=t.showTick,a=t.showLabel,s=tz(i,e.maybeAppendByClassName(rV.lineGroup,"g"),(function(e){return kV(e,t,r)}))||[],l=tz(o,e.maybeAppendByClassName(rV.tickGroup,"g"),(function(e){return function(t,e,n,r){var i=cV(e,n.tickFilter),o=Sz(n,"tick");return t.selectAll(rV.tick.class).data(i,(function(t){return t.id||t.label})).join((function(t){return t.append("g").attr("className",rV.tick.name).transition((function(t,e){return XV.call(this,t,e,i,n,o,!1)}))}),(function(t){return t.transition((function(t,e){return this.removeChildren(),XV.call(this,t,e,i,n,o,r.update)}))}),(function(t){return t.transition((function(){var t=this,e=$G(this.childNodes[0],r.exit);return WG(e,(function(){return t.remove()})),e}))})).transitions()}(e,n,t,r)}))||[],u=tz(a,e.maybeAppendByClassName(rV.labelGroup,"g"),(function(e){return YV(e,n,t,r)}))||[];return We(We(We([],Ve(s),!1),Ve(l),!1),Ve(u),!1).filter((function(t){return!!t}))}var nW=function(t){function e(e){return t.call(this,e,nV)||this}return je(e,t),e.prototype.render=function(t,e,n){var r=this,i=t.titleText,o=t.data,a=t.animate,s=t.showTitle,l=t.showGrid,u=t.dataThreshold,c=t.truncRange,h=function(t,e){if(t.length<=e)return t;for(var n=Math.floor(t.length/e),r=[],i=0;i<t.length;i+=n)r.push(t[i]);return r}(o,u).filter((function(t){var e=t.value;return!(c&&e>c[0]&&e<c[1])})),d=VG(void 0===n?a:n),f=tz(l,yz(e).maybeAppendByClassName(rV.gridGroup,"g"),(function(e){return NV(e,h,t,d)}))||[],p=yz(e).maybeAppendByClassName(rV.mainGroup,"g");i&&(!this.initialized&&d.enter||this.initialized&&d.update)&&eW(t,yz(this.offscreenGroup),h,VG(!1));var g=eW(t,yz(p.node()),h,d),v=tz(s,yz(e).maybeAppendByClassName(rV.titleGroup,"g"),(function(e){return function(t,e,n,r){var i=n.titleText;return t.selectAll(rV.title.class).data([{title:i}].filter((function(t){return!!t.title})),(function(t,e){return t.title})).join((function(o){return o.append((function(){return JF(i)})).attr("className",rV.title.name).transition((function(){return tW(yz(this),t,e,n,r.enter)}))}),(function(i){return i.transition((function(){return tW(yz(this),t,e,n,r.update)}))}),(function(t){return t.remove()})).transitions()}(e,r,t,d)}))||[];return We(We(We([],Ve(f),!1),Ve(g),!1),Ve(v),!1).flat().filter((function(t){return!!t}))},e}(Rz),rW=WF({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"),iW=function(t){function e(e){var n=t.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:Bz(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new Bl({class:rW.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Bl({class:rW.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return je(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return oe(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=Ve(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map((function(e,n){return t.map((function(t){return t[n]}))})))||[]}(this.pageViews.map((function(t){var e=t.getBBox();return[e.width,e.height]}))).map((function(t){return Math.max.apply(Math,We([],Ve(t),!1))})),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,a=r.pageHeight;return{pageWidth:o,pageHeight:void 0===a?n:a}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,a=o.pageWidth,s=o.pageHeight;return new zF(n,r,a+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,a=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var l=Ve(this.getFollowingPageDiff(t),2),u=l[0],c=l[1];this.playState="running";var h=UG(a,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-u,", ").concat(-c,")")}],n);return WG(h,(function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()})),h},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:oe(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:oe(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(rW.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach((function(e,n){t.includes(n)?RF(e):DF(e)}))},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,a=i.controllerPadding,s=r.getBBox(),l=s.width;s.height;var u=Ve("horizontal"===o?[-180,0]:[-90,90],2),c=u[0],h=u[1];e.setLocalEulerAngles(c),n.setLocalEulerAngles(h);var d=e.getBBox(),f=d.width,p=d.height,g=n.getBBox(),v=g.width,m=g.height,y=Math.max(f,l,v),b="horizontal"===o?{offset:[[0,0],[f/2+a,0],[f+l+2*a,0]],textAlign:"start"}:{offset:[[y/2,-p-a],[y/2,0],[y/2,m+a]],textAlign:"center"},x=Ve(b.offset,3),E=Ve(x[0],2),w=E[0],k=E[1],M=Ve(x[1],2),S=M[0],N=M[1],O=Ve(x[2],2),T=O[0],C=O[1],A=b.textAlign,P=r.querySelector("text");P&&(P.style.textAlign=A),e.setLocalPosition(w,k),r.setLocalPosition(S,N),n.setLocalPosition(T,C)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(rW.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=t<e?-1:1;return"horizontal"===n?[a*i,0]:[0,a*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=Ve(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes.controllerSpacing,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=this.pageViews.length>=2,s=t.maybeAppendByClassName(rW.controller,"g");if(LF(s.node(),a),a){var l=Sz(this.attributes,"button"),u=Sz(this.attributes,"pageNum"),c=Ve(Oz(l),2),h=c[0],d=c[1],f=h.size,p=Fe(h,["size"]),g=!s.select(rW.prevBtnGroup.class).node(),v=s.maybeAppendByClassName(rW.prevBtnGroup,"g").styles(d);this.prevBtnGroup=v.node();var m=v.maybeAppendByClassName(rW.prevBtn,"path"),y=s.maybeAppendByClassName(rW.nextBtnGroup,"g").styles(d);this.nextBtnGroup=y.node(),[m,y.maybeAppendByClassName(rW.nextBtn,"path")].forEach((function(t){t.styles(Be(Be({},p),{transformOrigin:"center"})),vz(t.node(),f)}));var b=s.maybeAppendByClassName(rW.pageInfoGroup,"g");this.pageInfoGroup=b.node(),b.maybeAppendByClassName(rW.pageInfo,"text").styles(u),this.updatePageInfo(),s.node().setLocalPosition(i+n,o/2),g&&(this.prevBtnGroup.addEventListener("click",(function(){e.prev()})),this.nextBtnGroup.addEventListener("click",(function(){e.next()})))}},e.prototype.render=function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i;this.attr("transform","translate(".concat(r,", ").concat(o,")"));var a=yz(e);this.renderClipPath(a),this.renderController(a),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=ye((function(){return t.render(t.attributes,t)}),50);this.playWindow.addEventListener(Ws.INSERTED,e),this.playWindow.addEventListener(Ws.REMOVED,e)},e}(Rz);function oW(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}zz.registerSymbol("hiddenHandle",(function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]})),zz.registerSymbol("verticalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=t+.4*r;return[["M",t,e],["L",a,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",a,e-i],["Z"],["M",a,e+o],["L",t+r-2,e+o],["M",a,e-o],["L",t+r-2,e-o]]})),zz.registerSymbol("horizontalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=e+.4*r;return[["M",t,e],["L",t-i,a],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,a],["Z"],["M",t-o,a],["L",t-o,e+r-2],["M",t+o,a],["L",t+o,e+r-2]]}));var aW=WF({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");var sW=function(t){function e(e){return t.call(this,e,{span:[1,1],marker:function(){return new Ll({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return je(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes.markerSize,r=t.node().getBBox(),i=r.width,o=r.height,a=e.node().getBBox(),s=a.width,l=a.height;return{markerWidth:n,labelWidth:i,valueWidth:s,height:Math.max(n,o,l)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=Ve(bz(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,a=i.height,s=this.actualSpace,l=s.labelWidth,u=s.valueWidth,c=Ve(this.spacing,2),h=c[0],d=c[1];if(r){var f=r-n-h-d,p=Ve(this.span,2);l=(t=Ve([p[0]*f,p[1]*f],2))[0],u=t[1]}return{width:o+l+u+h+d,height:a,markerWidth:o,labelWidth:l,valueWidth:u}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes.spacing;if(!t)return[0,0];var e=Ve(bz(t),2),n=e[0],r=e[1];return this.showValue?[n,r]:[n,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.width,o=t.height,a=Ve(this.spacing,2),s=a[0];return{height:o,width:i,markerWidth:e,labelWidth:n,valueWidth:r,position:[e/2,e+s,e+n+s+a[1]]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(aW.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,a=void 0===o?t.lineWidth:o,s=e.markerStroke,l=void 0===s?t.stroke:s,u=+(i||a||(l?1:0))*Math.sqrt(2),c=this.markerGroup.node().getBBox(),h=c.width,d=c.height;return(1-u/Math.max(h,d))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes.marker,r=Sz(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(aW.markerGroup,"g").style("zIndex",0),tz(!!n,this.markerGroup,(function(){var t,i=e.markerGroup.node(),o=null===(t=i.childNodes)||void 0===t?void 0:t[0],a="string"==typeof n?new zz({style:{symbol:n},className:aW.marker.name}):n();o?a.nodeName===o.nodeName?o instanceof zz?o.update(Be(Be({},r),{symbol:n})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=Ge(Object.entries(i)),a=o.next();!a.done;a=o.next()){var s=Ve(a.value,2),l=s[0],u=s[1];"id"!==l&&"className"!==l&&t.attr(l,u)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(o,a),yz(o).styles(r)):(o.remove(),yz(a).attr("className",aW.marker.name).styles(r),i.appendChild(a)):(a instanceof zz||yz(a).attr("className",aW.marker.name).styles(r),i.appendChild(a)),e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]);var s=vz(e.markerGroup.node(),e.scaleSize);e.markerGroup.node().style._transform="scale(".concat(s,")")}))},e.prototype.renderLabel=function(t){var e=Sz(this.attributes,"label"),n=e.text,r=Fe(e,["text"]);this.labelGroup=t.maybeAppendByClassName(aW.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(aW.label,(function(){return JF(n)})).styles(r)},e.prototype.renderValue=function(t){var e=this,n=Sz(this.attributes,"value"),r=n.text,i=Fe(n,["text"]);this.valueGroup=t.maybeAppendByClassName(aW.valueGroup,"g").style("zIndex",0),tz(this.showValue,this.valueGroup,(function(){e.valueGroup.maybeAppendByClassName(aW.value,(function(){return JF(r)})).styles(i)}))},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,i=Sz(this.attributes,"background");this.background=t.maybeAppendByClassName(aW.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(aW.background,"rect").styles(Be({width:n,height:r},i))},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=Ve(t.position,3),o=i[0],a=i[1],s=i[2],l=r/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(l,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(a,", ").concat(l,")")}),ZF(this.labelGroup.select(aW.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(s,", ").concat(l,")")}),ZF(this.valueGroup.select(aW.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=yz(e),r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o;n.styles({transform:"translate(".concat(i,", ").concat(a,")")}),this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.adjustLayout()},e}(Rz),lW=WF({page:"item-page",navigator:"navigator",item:"item"},"items"),uW=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},cW=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:Le,mouseenter:Le,mouseleave:Le})||this;return n.navigatorShape=[0,0],n}return je(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=Sz(this.attributes,"item"),i=e.map((function(t,i){var o=t.id,a=void 0===o?i:o,s=t.label,l=t.value;return{id:"".concat(a),index:i,style:Be({layout:n,labelText:s,valueText:l},Object.fromEntries(Object.entries(r).map((function(n){var r=Ve(n,2);return[r[0],GF(r[1],[t,i,e])]}))))}}));return i},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,a=Ve(this.navigatorShape,1)[0],s=Ve(this.grid,2),l=s[0],u=s[1],c=u*l,h=0;return this.pageViews.children.map((function(e,s){var d,f,p=Math.floor(s/c),g=s%c,v=t.ifHorizontal(u,l),m=[Math.floor(g/v),g%v];"vertical"===n&&m.reverse();var y=Ve(m,2),b=y[0],x=y[1],E=(r-a-(u-1)*o)/u,w=e.getBBox().height,k=Ve([0,0],2),M=k[0],S=k[1];return"horizontal"===n?(M=(d=Ve([h,b*(w+i)],2))[0],S=d[1],h=x===u-1?0:h+E+o):(M=(f=Ve([x*(E+o),h],2))[0],S=f[1],h=b===l-1?0:h+w+i),{page:p,index:s,row:b,col:x,pageIndex:g,width:E,height:w,x:M,y:S}}))},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=Ve(this.navigatorShape,1)[0],a=Ve(this.grid,2),s=a[0],l=a[1],u=Ve([e-o,n],2),c=u[0],h=u[1],d=Ve([0,0,0,0,0,0,0,0],8),f=d[0],p=d[1],g=d[2],v=d[3],m=d[4],y=d[5],b=d[6],x=d[7];return this.pageViews.children.map((function(t,e){var n,o,a,u,d=t.getBBox(),E=d.width,w=d.height,k=0===b?0:i,M=b+k+E;return M<=c&&uW(m,(function(t){return t<l}))?(n=Ve([b+k,x,M],3),f=n[0],p=n[1],b=n[2],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}):(o=Ve([y+1,0,0,x+w+r],4),y=o[0],m=o[1],b=o[2],(x=o[3])+w<=h&&uW(y,(function(t){return t<s}))?(a=Ve([b,x,E],3),f=a[0],p=a[1],b=a[2],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}):(u=Ve([0,0,E,0,g+1,0,0,0],8),f=u[0],p=u[1],b=u[2],x=u[3],g=u[4],v=u[5],y=u[6],m=u[7],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}))}))},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return oW(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(lW.item.class).forEach((function(e){t.appendChild(e)})),t.querySelectorAll(lW.page.class).forEach((function(e){t.removeChild(e).destroy()}))},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave;this.flattenPage(t);var o=this.dispatchCustomEvent.bind(this);yz(t).selectAll(lW.item.class).data(this.renderData,(function(t){return t.id})).join((function(t){return t.append((function(t){var e=t.style;return new sW({style:e})})).attr("className",lW.item.name).on("click",(function(){null==n||n(this),o("itemClick",{item:this})})).on("pointerenter",(function(){null==r||r(this),o("itemMouseenter",{item:this})})).on("pointerleave",(function(){null==i||i(this),o("itemMouseleave",{item:this})}))}),(function(t){return t.each((function(t){var e=t.style;this.update(e)}))}),(function(t){return t.remove()}))},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=Ve(this.navigatorShape,2),a=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-a,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{}))).map((function(t){var e=Ve(t,2);return{page:e[0],layouts:e[1]}})),i=We([],Ve(this.navigator.getContainer().children),!1);r.forEach((function(t){var e=t.layouts,r=n.pageViews.appendChild(new Bl({className:lW.page.name}));e.forEach((function(t){var e=t.x,n=t.y,o=t.index,a=t.width,s=t.height,l=i[o];r.appendChild(l),Te(l,"__layout__",t),l.update({x:e,y:n,width:a,height:s})}))})),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes.orientation,n=Sz(this.attributes,"nav"),r=UF({orientation:e},n),i=this;return t.selectAll(lW.navigator.class).data(["nav"]).join((function(t){return t.append((function(){return new iW({style:r})})).attr("className",lW.navigator.name).each((function(){i.navigator=this}))}),(function(t){return t.each((function(){this.update(r)}))}),(function(t){return t.remove()})),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator(yz(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new Ds(t,{detail:e});this.dispatchEvent(n)},e}(Rz),hW=WF({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),dW={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,dW)||this}je(e,t),e.prototype.render=function(t,e){var n=yz(e).maybeAppendByClassName(hW.markerGroup,"g");this.renderMarker(n);var r=yz(e).maybeAppendByClassName(hW.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,i=n.markerSymbol,o=void 0===i?oW(r,"horizontalHandle","verticalHandle"):i;tz(!!o,t,(function(t){var n=Sz(e.attributes,"marker"),r=Be({symbol:o},n);e.marker=t.maybeAppendByClassName(hW.marker,(function(){return new zz({style:r})})).update(r)}))},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,i=n.orientation,o=n.spacing,a=void 0===o?0:o,s=n.formatter;tz(r,t,(function(t){var n,r=Sz(e.attributes,"label"),o=r.text,l=Fe(r,["text"]),u=(null===(n=t.select(hW.marker.class))||void 0===n?void 0:n.node().getBBox())||{},c=u.width,h=void 0===c?0:c,d=u.height,f=Ve(oW(i,[0,(void 0===d?0:d)+a,"center","top"],[h+a,0,"start","middle"]),4),p=f[0],g=f[1],v=f[2],m=f[3];t.maybeAppendByClassName(hW.label,"text").styles(Be(Be({},l),{x:p,y:g,text:s(o).toString(),textAlign:v,textBaseline:m}))}))}}(Rz);var fW={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},pW=UF({},fW,{});UF({},fW,Nz(dW,"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 gW=WF({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"),vW=function(t){function e(e){return t.call(this,e,pW)||this}return je(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,i=r.showTitle,o=r.titleText,a=Ve(Oz(Sz(this.attributes,"title")),2),s=a[0],l=a[1];this.titleGroup=t.maybeAppendByClassName(gW.titleGroup,"g").styles(l);var u=Be(Be({width:e,height:n},s),{text:i?o:""});this.title=this.titleGroup.maybeAppendByClassName(gW.title,(function(){return new JV({style:u})})).update(u)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,i=e.width,o=e.height,a=Ve(Oz(Sz(this.attributes,"title",!0)),2),s=a[0],l=a[1],u=Be(Be({},s),{width:i,height:o,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName(gW.itemsGroup,"g").styles(Be(Be({},l),{transform:"translate(".concat(n,", ").concat(r,")")}));var c=this;this.itemsGroup.selectAll(gW.items.class).data(["items"]).join((function(t){return t.append((function(){return new cW({style:u})})).attr("className",gW.items.name).each((function(){c.items=yz(this)}))}),(function(t){return t.update(u)}),(function(t){return t.remove()}))},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().style.transform="translate(".concat(e,", ").concat(n,")")}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new zF(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,a=n.text,s=t.getBBox(),l=e.getBBox(),u=ZV(r),c=Ve(bz(a?i:0),4),h=c[0],d=c[1],f=c[2],p=c[3],g=Ve(bz(o),4),v=g[0],m=g[1],y=g[2],b=g[3],x=Ve([p+d,h+f],2),E=x[0],w=x[1],k=Ve([b+m,v+y],2),M=k[0],S=k[1];if("l"===u[0])return new zF(s.x,s.y,l.width+s.width+E+M,Math.max(l.height+S,s.height));if("t"===u[0])return new zF(s.x,s.y,Math.max(l.width+M,s.width),l.height+s.height+w+S);var N=Ve([e.attributes.width||l.width,e.attributes.height||l.height],2),O=N[0],T=N[1];return new zF(l.x,l.y,O+s.width+E+M,T+s.height+w+S)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=this.attributes,r=n.width,i=n.height,o=n.x,a=void 0===o?0:o,s=n.y,l=void 0===s?0:s,u=yz(e);e.style.transform="translate(".concat(a,", ").concat(l,")"),this.renderTitle(u,r,i),this.renderItems(u,this.availableSpace),this.adjustLayout()},e}(Rz),mW={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(t){return t.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},yW=WF({background:"background",labelGroup:"label-group",label:"label"},"indicator"),bW=function(t){function e(e){var n=t.call(this,e,mW)||this;return n.point=[0,0],n.group=n.appendChild(new Bl({})),n.isMutationObserved=!0,n}return je(e,t),e.prototype.renderBackground=function(){if(this.label){var t=this.attributes,e=t.position,n=Ve(bz(t.padding),4),r=n[0],i=n[1],o=n[2],a=n[3],s=this.label.node().getLocalBounds(),l=s.min,u=s.max,c=new zF(l[0]-a,l[1]-r,u[0]+i-l[0]+a,u[1]+o-l[1]+r),h=this.getPath(e,c),d=Sz(this.attributes,"background");this.background=yz(this.group).maybeAppendByClassName(yW.background,"path").styles(Be(Be({},d),{d:h})),this.group.appendChild(this.label.node())}},e.prototype.renderLabel=function(){var t=this.attributes,e=t.formatter,n=t.labelText,r=Ve(Oz(Sz(this.attributes,"label")),2),i=r[0],o=r[1];i.text;var a=Fe(i,["text"]);(this.label=yz(this.group).maybeAppendByClassName(yW.labelGroup,"g").styles(o),n)&&this.label.maybeAppendByClassName(yW.label,(function(){return JF(e(n))})).style("text",e(n).toString()).selectAll("text").styles(a)},e.prototype.adjustLayout=function(){var t=Ve(this.point,2),e=t[0],n=t[1],r=this.attributes,i=r.x,o=r.y;this.group.attr("transform","translate(".concat(i-e,", ").concat(o-n,")"))},e.prototype.getPath=function(t,e){var n=this.attributes.radius,r=e.x,i=e.y,o=e.width,a=e.height,s=[["M",r+n,i],["L",r+o-n,i],["A",n,n,0,0,1,r+o,i+n],["L",r+o,i+a-n],["A",n,n,0,0,1,r+o-n,i+a],["L",r+n,i+a],["A",n,n,0,0,1,r,i+a-n],["L",r,i+n],["A",n,n,0,0,1,r+n,i],["Z"]],l={top:4,right:6,bottom:0,left:2}[t],u=this.createCorner([s[l].slice(-2),s[l+1].slice(-2)]);return s.splice.apply(s,We([l+1,1],Ve(u),!1)),s[0][0]="M",s},e.prototype.createCorner=function(t,e){void 0===e&&(e=10);var n=Ez.apply(void 0,We([],Ve(t),!1)),r=Ve(t,2),i=Ve(r[0],2),o=i[0],a=i[1],s=Ve(r[1],2),l=s[0],u=s[1],c=Ve(n?[l-o,[o,l]]:[u-a,[a,u]],2),h=c[0],d=Ve(c[1],2),f=d[0],p=d[1],g=h/2,v=e*(h/Math.abs(h)),m=v/2,y=v*Math.sqrt(3)/2*.8,b=Ve([f,f+g-m,f+g,f+g+m,p],5),x=b[0],E=b[1],w=b[2],k=b[3],M=b[4];return n?(this.point=[w,a-y],[["L",x,a],["L",E,a],["L",w,a-y],["L",k,a],["L",M,a]]):(this.point=[o+y,w],[["L",o,x],["L",o,E],["L",o+y,w],["L",o,k],["L",o,M]])},e.prototype.applyVisibility=function(){"hidden"===this.attributes.visibility?DF(this):RF(this)},e.prototype.bindEvents=function(){this.label.on(Ws.BOUNDS_CHANGED,this.renderBackground)},e.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},e}(Rz);function xW(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var EW={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function wW(t){var e;void 0===t&&(t="");var n=xW(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=Be({flex:1},EW),e[".".concat(n.VALUE)]=Be({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},EW),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var kW=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,a=xW(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(a.CONTAINER,'"></div>'),title:'<div class="'.concat(a.TITLE,'"></div>'),item:'<li class="'.concat(a.LIST_ITEM,'" data-index={index}>\n <span class="').concat(a.NAME,'">\n <span class="').concat(a.MARKER,'" style="background:{color}"></span>\n <span class="').concat(a.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(a.VALUE,'" title="{value}">{value}</span>\n </li>')},style:wW(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return je(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map((function(t,e){var r=t.name,i=void 0===r?"":r,o=t.color,a=void 0===o?"black":o,s=t.index,l=Fe(t,["name","color","index"]),u=Be({name:i,color:a,index:null!=s?s:e},l);return Cn(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t}(n.item,u))}))},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=Cn(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:Az(this.element,t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,a=n.style,s=n.content,l=xW(r.prefixCls),u=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(u.innerHTML=r.title,u.getElementsByClassName(l.TITLE)[0].innerHTML=i):null===(e=null===(t=u.getElementsByClassName(l.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var c=this.HTMLTooltipItemsElements,h=document.createElement("ul");h.className=l.LIST,Az(h,c);var d=this.element.querySelector(".".concat(l.LIST));d?d.replaceWith(h):u.appendChild(h)}!function(t,e){Object.entries(e).forEach((function(e){var n=Ve(e,2),r=n[0],i=n[1];We([t],Ve(t.querySelectorAll(r)),!1).filter((function(t){return t.matches(r)})).forEach((function(t){t&&(t.style.cssText+=Object.entries(i).reduce((function(t,e){return"".concat(t).concat(e.join(":"),";")}),""))}))}))}(u,a)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},a=this.elementSize,s=a.width,l=a.height,u=[-s/2,-l/2];return i.forEach((function(t){var e=Ve(u,2),n=e[0],i=e[1],a=Ve(o[t],2),c=a[0],h=a[1];u=[n+(s/2+r[0])*c,i+(l/2+r[1])*h]})),u},e.prototype.setOffsetPosition=function(t){var e=Ve(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=void 0===o?0:o,s=i.y,l=void 0===s?0:s,u=i.container,c=u.x,h=u.y;this.element.style.left="".concat(+a+c+n,"px"),this.element.style.top="".concat(+l+h+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=Ve(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=i.y,s=i.bounding,l=i.position;if(!s)return[n,r];var u=this.element,c=u.offsetWidth,h=u.offsetHeight,d=Ve([+o+n,+a+r],2),f=d[0],p=d[1],g={left:"right",right:"left",top:"bottom",bottom:"top"},v=s.x,m=s.y,y={left:f<v,right:f+c>v+s.width,top:p<m,bottom:p+h>m+s.height},b=[];l.split("-").forEach((function(t){y[t]?b.push(g[t]):b.push(t)}));var x=b.join("-");return this.getRelativeOffsetFromCursor(x)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height;return new zF(r,i,o,a).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout((function(){e.element.style.transition=n}),10)},e.tag="tooltip",e}(Rz),MW=function(t){function e(n){var r=t.call(this,UF({},e.defaultOptions,n))||this;return r.hoverColor="#f5f5f5",r.selectedColor="#e6f7ff",r.background=r.appendChild(new Kl({})),r.label=r.background.appendChild(new Bl({})),r}return je(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return bz(this.style.padding)},enumerable:!1,configurable:!0}),e.prototype.renderLabel=function(){var t=this.style,e=t.label,n=t.value,r=Sz(this.attributes,"label");yz(this.label).maybeAppend(".label",(function(){return JF(e)})).attr("className","label").styles(r),this.label.attr("__data__",n)},e.prototype.renderBackground=function(){var t=this.label.getBBox(),e=Ve(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3],a=t.width,s=t.height,l=a+o+r,u=s+n+i,c=Sz(this.attributes,"background"),h=this.style,d=h.width,f=void 0===d?0:d,p=h.height,g=void 0===p?0:p,v=h.selected;this.background.attr(Be(Be({},c),{width:Math.max(l,f),height:Math.max(u,g),fill:v?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((u-s)/2,")")})},e.prototype.render=function(){this.renderLabel(),this.renderBackground()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("pointerenter",(function(){t.style.selected||t.background.attr("fill",t.hoverColor)})),this.addEventListener("pointerleave",(function(){t.style.selected||t.background.attr("fill",t.style.backgroundFill)}));var e=this;this.addEventListener("click",(function(){var n=t.style,r=n.label,i=n.value,o=n.onClick;null==o||o(i,{label:r,value:i},e)}))},e.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},e}(Rz),SW=function(t){function e(n){var r,i,o=t.call(this,UF({},e.defaultOptions,n))||this;o.currentValue=null===(r=e.defaultOptions.style)||void 0===r?void 0:r.defaultValue,o.isPointerInSelect=!1,o.select=o.appendChild(new Kl({className:"select",style:{cursor:"pointer",width:0,height:0}})),o.dropdown=o.appendChild(new Kl({className:"dropdown"}));var a=o.style.defaultValue;return a&&(null===(i=o.style.options)||void 0===i?void 0:i.some((function(t){return t.value===a})))&&(o.currentValue=a),o}return je(e,t),e.prototype.setValue=function(t){this.currentValue=t,this.render()},e.prototype.getValue=function(){return this.currentValue},Object.defineProperty(e.prototype,"dropdownPadding",{get:function(){return bz(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),e.prototype.renderSelect=function(){var t,e=this,n=this.style,r=n.x,i=n.y,o=n.width,a=n.height,s=n.bordered,l=n.showDropdownIcon,u=Sz(this.attributes,"select"),c=Sz(this.attributes,"placeholder");this.select.attr(Be(Be({x:r,y:i,width:o,height:a},u),{fill:"#fff",strokeWidth:s?1:0}));var h=this.dropdownPadding;l&&yz(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(r+o-10-h[1]-h[3],", ").concat(i+a/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var d=null===(t=this.style.options)||void 0===t?void 0:t.find((function(t){return t.value===e.currentValue})),f=Be({x:r+h[3]},c);yz(this.select).selectAll(".placeholder").data(d?[]:[1]).join((function(t){return t.append("text").attr("className","placeholder").styles(f).style("y",(function(){var t=this.getBBox();return i+(a-t.height)/2}))}),(function(t){return t.styles(f)}),(function(t){return t.remove()}));var p=Sz(this.attributes,"optionLabel"),g=Be({x:r+h[3]},p);yz(this.select).selectAll(".value").data(d?[d]:[]).join((function(t){return t.append((function(t){return JF(t.label)})).attr("className","value").styles(g).style("y",(function(){var t=this.getBBox();return i+(a-t.height)/2}))}),(function(t){return t.styles(g)}),(function(t){return t.remove()}))},e.prototype.renderDropdown=function(){var t,e,n=this,r=this.style,i=r.x,o=r.y,a=r.width,s=r.height,l=r.options,u=r.onSelect,c=r.open,h=Sz(this.attributes,"dropdown"),d=Sz(this.attributes,"option"),f=this.dropdownPadding;yz(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(l,(function(t){return t.value})).join((function(t){return t.append((function(t){return new MW({className:"dropdown-item",style:Be(Be(Be({},t),d),{width:a-f[1]-f[3],selected:t.value===n.currentValue,onClick:function(t,e,r){n.setValue(t),null==u||u(t,e,r),n.dispatchEvent(new Ds("change",{detail:{value:t,option:e,item:r}})),DF(n.dropdown)}})})})).each((function(t,e){var n,r=(null===(n=this.parentNode)||void 0===n?void 0:n.children).reduce((function(t,n,r){return r<e&&(t+=n.getBBox().height),t}),0);this.attr("transform","translate(".concat(f[3],", ").concat(f[0]+r,")"))}))}),(function(t){return t.update((function(t){return{selected:t.value===n.currentValue}}))}),(function(t){return t.remove()}));var p=null===(e=null===(t=this.dropdown.getElementsByClassName("dropdown-container"))||void 0===t?void 0:t[0])||void 0===e?void 0:e.getBBox(),g=h.spacing;this.dropdown.attr(Be({transform:"translate(".concat(i,", ").concat(o+s+g,")"),width:p.width+f[1]+f[3],height:p.height+f[0]+f[2]},h)),!c&&DF(this.dropdown)},e.prototype.render=function(){this.renderSelect(),this.renderDropdown()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("click",(function(t){t.stopPropagation()})),this.select.addEventListener("click",(function(){"visible"===t.dropdown.style.visibility?DF(t.dropdown):RF(t.dropdown)})),this.addEventListener("pointerenter",(function(){t.isPointerInSelect=!0})),this.addEventListener("pointerleave",(function(){t.isPointerInSelect=!1})),null===document||void 0===document||document.addEventListener("click",(function(){t.isPointerInSelect||DF(t.dropdown)}))},e.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},e}(Rz),NW=function(t){function e(n){var r=t.call(this,UF({},{style:{backgroundOpacity:e.backgroundOpacities.default}},e.defaultOptions,n))||this;return r.showBackground=!0,r.background=r.appendChild(new Kl({})),r.icon=r.appendChild(new Bl({})),r}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return bz(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"iconSize",{get:function(){var t=this.attributes.size,e=Ve(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3];return Math.max(t-Math.max(o+r,n+i),2*this.lineWidth+1)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.size,i=r/2,o=Sz(this.attributes,"background");this.background.attr(Be({x:e-i,y:n-i,width:r,height:r},o))},e.prototype.showIndicator=function(){if(this.label){var t=this.attributes.size,e=this.background.getBBox(),n=e.x,r=e.y;this.indicator.update({x:n+t/2,y:r-5,labelText:this.label,visibility:"visible"})}},e.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},e.prototype.connectedCallback=function(){var e;t.prototype.connectedCallback.call(this);var n=this.attributes.size,r=this.background.getBBox(),i=r.x,o=r.y,a=null===(e=this.ownerDocument)||void 0===e?void 0:e.defaultView;a&&(this.indicator=a.appendChild(new bW({style:{x:i+n/2,y:o-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},e.prototype.disconnectedCallback=function(){this.indicator.destroy()},e.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},e.prototype.bindEvents=function(){var t=this,n=this.attributes.onClick;if(this.addEventListener("click",(function(){null==n||n(t)})),this.showBackground){var r=function(){return t.background.attr({opacity:e.backgroundOpacities.default})};this.addEventListener("pointerenter",(function(){t.background.attr({opacity:e.backgroundOpacities.hover}),t.showIndicator()})),this.addEventListener("pointerleave",(function(){r(),t.hideIndicator()})),this.addEventListener("pointerdown",(function(){t.background.attr({opacity:e.backgroundOpacities.active})})),this.addEventListener("pointerup",(function(){r()}))}},e.tag="IconBase",e.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},e.backgroundOpacities={default:0,hover:.8,active:1},e}(Rz),OW=function(t,e){return void 0===e&&(e="#565758"),new Ul({style:{fill:e,d:"M ".concat(t,",").concat(t," L -").concat(t,",0 L ").concat(t,",-").concat(t," Z"),transformOrigin:"center"}})},TW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.arcPath=function(t,e,n){var r=Ve([n,n],2),i=r[0],o=r[1],a=function(r){return[t+n*Math.cos(r),e+n*Math.sin(r)]},s=Ve(a(-5/4*Math.PI),2),l=s[0],u=s[1],c=Ve(a(1/4*Math.PI),2),h=c[0],d=c[1];return"M".concat(l,",").concat(u,",A").concat(i,",").concat(o,",0,1,1,").concat(h,",").concat(d)},Object.defineProperty(e.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o+.5;yz(this.icon).maybeAppend(".reset","path").styles({stroke:r,lineWidth:o,d:this.arcPath(e,n,i/2-o),markerStart:OW(a,r)})},e}(NW),CW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e-o,n],[e,n+a],[e,n],[e+o,n-a],[e+o,n+a],[e,n]];yz(this.icon).maybeAppend(".backward","polygon").styles({points:s,fill:r})},e}(NW),AW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e+o,n],[e,n+a],[e,n],[e-o,n-a],[e-o,n+a],[e,n]];yz(this.icon).maybeAppend(".forward","polygon").styles({points:s,fill:r})},e}(NW),PW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3*Math.pow(3,.5)*.8,a=[[e+o,n],[e-o/2,n-i/2*.8],[e-o/2,n+i/2*.8],[e+o,n]];yz(this.icon).maybeAppend(".play","polygon").styles({points:a,fill:r})},e}(NW),RW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3,a=[[e-o,n-i/2],[e-o,n+i/2],[e-o/2,n+i/2],[e-o/2,n-i/2],[e-o,n-i/2],[e+o/2,n-i/2],[e+o/2,n+i/2],[e+o,n+i/2],[e+o,n-i/2]];yz(this.icon).maybeAppend(".pause","polygon").styles({points:a,fill:r})},e}(NW),DW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o;yz(this.icon).maybeAppend(".left-line","line").styles({x1:e-i/2,y1:n-i/2,x2:e-i/2,y2:n+i/2,stroke:r,lineWidth:o}),yz(this.icon).maybeAppend(".right-line","line").styles({x1:e+i/2,y1:n-i/2,x2:e+i/2,y2:n+i/2,stroke:r,lineWidth:o}),yz(this.icon).maybeAppend(".left-arrow","line").styles({x1:e,y1:n,x2:e-i/2+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:OW(2*o,r)}),yz(this.icon).maybeAppend(".right-arrow","line").styles({x1:e,y1:n,x2:e+i/2-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:OW(2*o,r)})},e}(NW),LW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;yz(this.icon).maybeAppend(".line","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o});var a=o;yz(this.icon).maybeAppend(".left-arrow","line").styles({x1:e-i/2-2*a,y1:n,x2:e-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:OW(2*o,r)}),yz(this.icon).maybeAppend(".right-arrow","line").styles({x1:e+i/2+2*a,y1:n,x2:e+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:OW(2*o,r)})},e}(NW),_W=function(t){return[[-t/2,-t/2],[-t/2,t/2],[t/2,t/2]]},IW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=(i-2*o-o)/4,s=(i-2*o-o)/2,l=Ve([e-i/2+o,n+i/2-2*o],2),u=l[0],c=l[1];yz(this.icon).maybeAppend(".coordinate","polyline").styles({points:_W(i).map((function(t){var r=Ve(t,2),i=r[0],o=r[1];return[i+e,o+n]})),stroke:r,lineWidth:o}),yz(this.icon).maybeAppend(".line","polyline").styles({points:[[u,c],[u+a,c-s],[u+2*a,c],[u+4*a,c-2*s]],stroke:r,lineWidth:o})},e}(NW),jW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.data,e=this.attributes,n=e.x,r=e.y,i=e.color,o=this.iconSize,a=this.lineWidth,s=a,l=(o-s)/t.length,u=(o-2*s)/4,c=Ve([n-o/2+2*s,r+o/2-s],2),h=c[0],d=c[1];yz(this.icon).maybeAppend(".coordinate","polyline").styles({points:_W(o).map((function(t){var e=Ve(t,2),i=e[0],o=e[1];return[i+n,o+r]})),stroke:i,lineWidth:a}),yz(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map((function(t,e){return{value:t,index:e}}))).join((function(t){return t.append("line").attr("className","column").style("x1",(function(t){var e=t.index;return h+l*e})).style("y1",d).style("x2",(function(t){var e=t.index;return h+l*e})).style("y2",(function(t){var e=t.value;return d-u*e})).styles({y1:d,stroke:i,lineWidth:a})}))},e}(NW),BW=function(t){function e(e){var n=t.call(this,UF({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return je(e,t),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;yz(this.icon).maybeAppend(".split","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o})},e}(NW),FW=function(t){function e(){var e=t.apply(this,We([],Ve(arguments),!1))||this;return e.showBackground=!1,e}return je(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return bz(0)},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.iconSize,e=this.attributes,n=e.x,r=e.y,i=e.speed,o=void 0===i?1:i,a=Pe(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),s=oe(t,20,1/0),l=Be(Be({},a),{x:n-s/2,y:r-10,width:s,height:20,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:t/5,placeholderFontSize:t/2,optionPadding:0,optionLabelFontSize:t/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});yz(this.icon).maybeAppend(".speed",(function(){return new SW({style:l})})).attr("className","speed").each((function(){this.update(l)}))},e.tag="SpeedSelect",e}(NW),zW=function(t){function e(e){var n=t.call(this,e)||this;return n.icon=n.appendChild(new Bl({})),n.currentType=n.attributes.type,n}return je(e,t),e.prototype.getType=function(){return this.currentType},e.prototype.render=function(){var t=this,e=this.attributes;e.onChange;var n=Fe(e,["onChange"]);yz(this.icon).selectAll(".icon").data([this.currentType]).join((function(e){return e.append((function(e){var n,r=null===(n=t.toggles.find((function(t){return Ve(t,1)[0]===e})))||void 0===n?void 0:n[1];if(!r)throw new Error("Invalid type: ".concat(e));return new r({})})).attr("className","icon").styles(n,!1).update({})}),(function(t){return t.styles({restStyles:n}).update({})}),(function(t){return t.remove()}))},e.prototype.bindEvents=function(){var t=this,e=this.attributes.onChange;this.addEventListener("click",(function(n){n.preventDefault(),n.stopPropagation();var r=(t.toggles.findIndex((function(e){return Ve(e,1)[0]===t.currentType}))+1)%t.toggles.length,i=t.toggles[r][0];null==e||e(t.currentType),t.currentType=i,t.render()}))},e.tag="ToggleIcon",e}(Rz),GW=function(t){function e(e){var n=t.call(this,UF({},{style:{type:"play"}},e))||this;return n.toggles=[["play",PW],["pause",RW]],n}return je(e,t),e}(zW),VW=function(t){function e(e){var n=t.call(this,UF({},{style:{type:"range"}},e))||this;return n.toggles=[["range",DW],["value",LW]],n}return je(e,t),e}(zW),WW=function(t){function e(e){var n=t.call(this,UF({},{style:{type:"column"}},e))||this;return n.toggles=[["line",IW],["column",jW]],n}return je(e,t),e}(zW),HW={reset:TW,speed:FW,backward:CW,playPause:GW,forward:AW,selectionType:VW,chartType:WW,split:BW},UW=function(t){function e(n){var r=t.call(this,UF({},e.defaultOptions,n))||this;return r.background=r.appendChild(new Kl({})),r.functions=r.appendChild(new Bl({})),r}return je(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return bz(this.attributes.padding)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.style,e=t.x,n=t.y,r=t.width,i=t.height,o=Sz(this.attributes,"background");this.background.attr(Be({x:e,y:n,width:r,height:i},o))},e.prototype.renderFunctions=function(){var t,e=this,n=this.attributes,r=n.functions,i=n.iconSize,o=n.iconSpacing,a=n.x,s=n.y,l=n.width,u=n.height,c=n.align,h=Ve(this.padding,4),d=h[1],f=h[3],p=r.reduce((function(t,e){return t.length&&e.length?t.concat.apply(t,We(["split"],Ve(e),!1)):t.concat.apply(t,We([],Ve(e),!1))}),[]),g=p.length*(i+o)-o,v={left:f+i/2,center:(l-g)/2+i/2,right:l-g-f-d+i/2}[c]||0;null===(t=this.speedSelect)||void 0===t||t.destroy(),this.functions.removeChildren(),p.forEach((function(t,n){var r,l=HW[t],c={x:a+n*(i+o)+v,y:s+u/2,size:i};if(l===FW?(c.speed=e.attributes.speed,c.onSelect=function(n){return e.handleFunctionChange(t,{value:n})}):[GW,VW,WW].includes(l)?(c.onChange=function(n){return e.handleFunctionChange(t,{value:n})},l===GW&&(c.type="play"===e.attributes.state?"pause":"play"),l===VW&&(c.type="range"===e.attributes.selectionType?"value":"range"),l===WW&&(c.type="line"===e.attributes.chartType?"column":"line")):c.onClick=function(){return e.handleFunctionChange(t,{value:t})},l===FW){var h=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView;h&&(e.speedSelect=new l({style:Be(Be({},c),{zIndex:100})}),h.appendChild(e.speedSelect))}else e.functions.appendChild(new l({style:c}))}))},e.prototype.disconnectedCallback=function(){var e;t.prototype.disconnectedCallback.call(this),null===(e=this.speedSelect)||void 0===e||e.destroy()},e.prototype.render=function(){this.renderBackground(),this.renderFunctions()},e.prototype.handleFunctionChange=function(t,e){var n=this.attributes.onChange;null==n||n(t,e)},e.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},e}(Rz),YW=function(t){function e(n){var r=t.call(this,UF({},e.defaultOptions,n))||this;return r.bindEvents(),r}return je(e,t),e.prototype.bindEvents=function(){var t=this;this.addEventListener("mouseenter",(function(){t.attr("lineWidth",Math.ceil(+(t.style.r||0)/2))})),this.addEventListener("mouseleave",(function(){t.attr("lineWidth",0)}))},e.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},e}(Ll),$W=function(t){function e(n){return t.call(this,UF({},e.defaultOptions,n))||this}return je(e,t),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=Sz(this.attributes,"background");yz(this).maybeAppend("background","rect").attr("className","background").styles(Be({x:e-r/2,y:n-i/2,width:r,height:i},o))},e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.iconSize,i=Sz(this.attributes,"icon"),o=r/2;yz(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(Be({x1:e-1,y1:n-o,x2:e-1,y2:n+o},i)),yz(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(Be({x1:e+1,y1:n-o,x2:e+1,y2:n+o},i))},e.prototype.renderBorder=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=Sz(this.attributes,"border"),s="start"===o?+r/2:-r/2;yz(this).maybeAppend("border","line").attr("className","border").styles(Be({x1:s+e,y1:n-i/2,x2:s+e,y2:n+i/2},a))},e.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},e.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},e}(Rz);function qW(t,e){return"number"==typeof t?XW(t):function(t,e){var n=new Date(t);switch(e){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(n.getHours())&&0===n.getMinutes()?Tz(n,"HH:mm\nYYYY-MM-DD"):Tz(n,"HH:mm");case"half-day":return n.getHours()<12?"AM\n".concat(Tz(n,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(n.getDate())?Tz(n,"DD\nYYYY-MM"):Tz(n,"DD");case"week":return n.getDate()<=7?Tz(n,"DD\nYYYY-MM"):Tz(n,"DD");case"month":return[0,6].includes(n.getMonth())?Tz(n,"MM月\nYYYY"):Tz(n,"MM月");case"season":return[0].includes(n.getMonth())?Tz(n,"MM月\nYYYY"):Tz(n,"MM月");case"year":return Tz(n,"YYYY");default:return Tz(n,"YYYY-MM-DD HH:mm")}}(t,e)}function XW(t){var e=String(Math.floor(t/3600)).padStart(2,"0"),n=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(Math.floor(t%60)).padStart(2,"0");return t<3600?"".concat(n,":").concat(r):"".concat(e,":").concat(n,":").concat(r)}var KW=function(t){function e(n){var r=t.call(this,UF({},e.defaultOptions,n))||this;r.axis=r.appendChild(new nW({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),r.timeline=r.appendChild(new eV({style:{onChange:function(t){r.handleSliderChange(t)}}})),r.controller=r.appendChild(new UW({})),r.states={},r.handleSliderChange=function(t){var e,n=(e=r.states.values,Array.isArray(e)?We([],Ve(e),!1):e);r.setBySliderValues(t),r.dispatchOnChange(n)};var i=r.attributes,o=i.selectionType,a=i.chartType,s=i.speed,l=i.state,u=i.playMode,c=i.values;return r.states={chartType:a,playMode:u,selectionType:o,speed:s,state:l},r.setByTimebarValues(c),r}return je(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.data.sort((function(t,e){return t.time<e.time?-1:t.time>e.time?1:0}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"space",{get:function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=t.controllerHeight,s=oe(+i-a,0,+i),l=new zF(e,n+ +i-a,+r,a),u=0,c="time"===o?10:s;return{axisBBox:"chart"===o?new zF(e,n+s-(u=35),+r,u):new zF,controllerBBox:l,timelineBBox:new zF(e,n+("time"===o?s:s-c),+r,c-u)}},enumerable:!1,configurable:!0}),e.prototype.setBySliderValues=function(t){var e,n,r=this.data,i=Ve(Array.isArray(t)?t:[0,t],2),o=i[0],a=i[1],s=r.length,l=r[Math.floor(o*s)],u=r[Math.ceil(a*s)-(Array.isArray(t)?0:1)];this.states.values=[null!==(e=null==l?void 0:l.time)&&void 0!==e?e:r[0].time,null!==(n=null==u?void 0:u.time)&&void 0!==n?n:1/0]},e.prototype.setByTimebarValues=function(t){var e,n,r,i=this.data,o=Ve(Array.isArray(t)?t:[void 0,t],2),a=o[0],s=o[1],l=i.find((function(t){return t.time===a})),u=i.find((function(t){return t.time===s}));this.states.values=[null!==(e=null==l?void 0:l.time)&&void 0!==e?e:null===(n=i[0])||void 0===n?void 0:n.time,null!==(r=null==u?void 0:u.time)&&void 0!==r?r:1/0]},e.prototype.setByIndex=function(t){var e,n,r,i,o=this.data,a=Ve(t,2),s=a[0],l=a[1];this.states.values=[null!==(n=null===(e=o[s])||void 0===e?void 0:e.time)&&void 0!==n?n:o[0].time,null!==(i=null===(r=this.data[l])||void 0===r?void 0:r.time)&&void 0!==i?i:1/0]},Object.defineProperty(e.prototype,"sliderValues",{get:function(){var t,e=this.states,n=e.values,r=e.selectionType,i=Ve(Array.isArray(n)?n:[void 0,n],2),o=i[0],a=i[1],s=this.data,l=s.length,u="value"===r;return[(t=s.findIndex((function(t){return t.time===o})),u?0:t>-1?t/l:0),function(){if(a===1/0)return 1;var t=s.findIndex((function(t){return t.time===a}));return t>-1?t/l:u?.5:1}()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){var t=this.states,e=t.values,n=t.selectionType,r=Ve(Array.isArray(e)?e:[this.data[0].time,e],2),i=r[0],o=r[1];return"value"===n?o:[i,o]},enumerable:!1,configurable:!0}),e.prototype.getDatumByRatio=function(t){var e=this.data,n=e.length;return e[Math.floor(t*(n-1))]},Object.defineProperty(e.prototype,"chartHandleIconShape",{get:function(){var t=this.states.selectionType,e=this.space.timelineBBox.height;return"range"===t?function(t){return new $W({style:{type:t,height:e,iconSize:e/6}})}:function(){return new Wl({style:{x1:0,y1:-e/2,x2:0,y2:e/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),e.prototype.getChartStyle=function(t){var e=this,n=t.x,r=t.y,i=t.width,o=t.height,a=this.states,s=a.selectionType,l=a.chartType,u=this.data,c=this.attributes,h=c.type,d=c.labelFormatter,f=Sz(this.attributes,"chart");f.type;var p=Fe(f,["type"]),g="range"===s;if("time"===h)return Be({handleIconShape:function(){return new YW({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:g?-15:0,autoFitLabel:g,handleSpacing:g?-15:0,trackFill:"#edeeef",trackLength:i,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:s,values:this.sliderValues,formatter:function(t){if(d)return d(t);var n=e.getDatumByRatio(t).time;return"number"==typeof n?XW(n):Tz(n,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},p);var v="range"===s?5:0,m=u.map((function(t){return t.value}));return Be({handleIconOffset:v,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:m,sparklineType:l,sparklineScale:.8,trackLength:i,trackSize:o,type:s,values:this.sliderValues,transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},p)},e.prototype.renderChart=function(t){void 0===t&&(t=this.space.timelineBBox),this.timeline.update(this.getChartStyle(t))},e.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},e.prototype.getAxisStyle=function(t){var e=this.data,n=this.attributes,r=n.interval,i=n.labelFormatter,o=Sz(this.attributes,"axis"),a=t.x,s=t.y,l=t.width,u=We(We([],Ve(e),!1),[{time:0}],!1).map((function(t,e,n){var r=t.time;return{label:"".concat(r),value:e/(n.length-1),time:r}})),c=Be({startPos:[a,s],endPos:[a+l,s],data:u,labelFilter:function(t,e){return e<u.length-1},labelFormatter:function(t){var e=t.time;return i?i(e):qW(e,r)}},o);return c},e.prototype.renderAxis=function(t){void 0===t&&(t=this.space.axisBBox),"chart"===this.attributes.type&&this.axis.update(this.getAxisStyle(t))},e.prototype.renderController=function(t){void 0===t&&(t=this.space.controllerBBox);var e=this.attributes.type,n=this.states,r=n.state,i=n.speed,o=n.selectionType,a=n.chartType,s=Sz(this.attributes,"controller"),l=this,u=Be(Be(Be({},t),{iconSize:20,speed:i,state:r,selectionType:o,chartType:a,onChange:function(t,e){var n=e.value;switch(t){case"reset":l.internalReset();break;case"speed":l.handleSpeedChange(n);break;case"backward":l.internalBackward();break;case"playPause":"play"===n?l.internalPlay():l.internalPause();break;case"forward":l.internalForward();break;case"selectionType":l.handleSelectionTypeChange(n);break;case"chartType":l.handleChartTypeChange(n)}}}),s);"time"===e&&(u.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(u)},e.prototype.dispatchOnChange=function(t){var e=this.data,n=this.attributes.onChange,r=this.states,i=r.values,o=r.selectionType,a=Ve(i,2),s=a[0],l=a[1],u=l===1/0?e.at(-1).time:l;t&&function(t,e){if(Array.isArray(t)){if(!Array.isArray(e))return!1;if(t[0]===e[0]){if(t[1]===e[1])return!0;if(t[1]===1/0||e[1]===1/0)return!0}return!1}return!Array.isArray(e)&&t===e}(t,"range"===o?[s,u]:u)||null==n||n("range"===o?[s,u]:u)},e.prototype.internalReset=function(t){var e,n,r=this.states.selectionType;this.internalPause(),this.setBySliderValues("range"===r?[0,1]:[0,0]),this.renderController(),this.updateSelection(),t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onReset)||void 0===n||n.call(e),this.dispatchOnChange())},e.prototype.reset=function(){this.internalReset()},e.prototype.moveSelection=function(t,e){var n=this.data,r=n.length,i=this.states,o=i.values,a=i.selectionType,s=i.playMode,l=Ve(o,2),u=l[0],c=l[1],h=n.findIndex((function(t){return t.time===u})),d=n.findIndex((function(t){return t.time===c}));-1===d&&(d=r);var f,p="backward"===t?-1:1;"range"===a?"acc"===s?(f=[h,d+p],-1===p&&h===d&&(f=[h,r])):f=[h+p,d+p]:f=[h,d+p];var g=function(t){var e=Ve(t.sort((function(t,e){return t-e})),2),n=e[0],i=e[1],o=function(t){return oe(t,0,r)};return i>r?"value"===a?[0,0]:"acc"===s?[o(n),o(n)]:[0,o(i-n)]:n<0?"acc"===s?[0,o(i)]:[o(n+r-i),r]:[o(n),o(i)]}(f);return this.setByIndex(g),this.updateSelection(),g},e.prototype.internalBackward=function(t){var e,n,r=this.moveSelection("backward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onBackward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.backward=function(){this.internalBackward()},e.prototype.internalPlay=function(t){var e,n,r=this,i=this.data,o=this.attributes.loop,a=this.states.speed,s=void 0===a?1:a;this.playInterval=window.setInterval((function(){r.internalForward()[1]!==i.length||o||(r.internalPause(),r.renderController())}),1e3/s),this.states.state="play",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPlay)||void 0===n||n.call(e))},e.prototype.play=function(){this.internalPlay()},e.prototype.internalPause=function(t){var e,n;clearInterval(this.playInterval),this.states.state="pause",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPause)||void 0===n||n.call(e))},e.prototype.pause=function(){this.internalPause()},e.prototype.internalForward=function(t){var e,n,r=this.moveSelection("forward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onForward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.forward=function(){this.internalForward()},e.prototype.handleSpeedChange=function(t){var e,n;this.states.speed=t,"play"===this.states.state&&(this.internalPause(!0),this.internalPlay(!0)),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSpeedChange)||void 0===n||n.call(e,t)},e.prototype.handleSelectionTypeChange=function(t){var e,n;this.states.selectionType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSelectionTypeChange)||void 0===n||n.call(e,t)},e.prototype.handleChartTypeChange=function(t){var e,n;this.states.chartType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onChartTypeChange)||void 0===n||n.call(e,t)},e.prototype.render=function(){var t=this.space,e=t.axisBBox,n=t.controllerBBox,r=t.timelineBBox;this.renderController(n),this.renderAxis(e),this.renderChart(r),"play"===this.states.state&&this.internalPlay()},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.internalPause(!0)},e.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},e}(Rz);function ZW(t){const{width:e,height:n,renderer:r,containerStyle:i}=t,o=function(t){var e;const{container:n,className:r,graphCanvas:i}=t;if(n)return"string"==typeof n?document.getElementById(n):n;const o=Qj(r,!1);return null===(e=i.getContainer())||void 0===e||e.appendChild(o),o}(t),[a,s]=function(t){const{width:e,height:n,placement:r,graphCanvas:i}=t,[o,a]=i.getSize(),[s,l]=Qh(r);return[s*(o-e),l*(a-n)]}(t);Object.assign(o.style,Object.assign({position:"absolute",left:a+"px",top:s+"px",width:e+"px",height:n+"px"},i));return[o,new du({width:e,height:n,container:o,renderer:r||new Np})]}class QW extends Zj{constructor(e,n){super(e,Object.assign({},QW.defaultOptions,n)),this.typePrefix="__data__",this.draw=!1,this.fieldMap={node:new Map,edge:new Map,combo:new Map},this.selectedItems=[],this.bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)},this.changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=Oe(t,[r,"id"]),o=Oe(t,[r,"style","labelText"]),[a]=i.split("__"),s=this.fieldMap[a].get(o)||[];n.setElementState(Object.fromEntries(null==s?void 0:s.map((t=>[t,e]))))},this.click=t=>{if("hover"===this.options.trigger)return;const e=Oe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter((t=>t!==e)),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))},this.mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))},this.mouseenter=t=>{if("click"===this.options.trigger)return;const e=Oe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter((t=>t!==e)):(this.selectedItems.push(e),this.changeState(t,"active"))},this.setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r}=this.context,{nodes:i,edges:o,combos:a}=n.getData(),s={},l=e=>Ut(t)?t(e):t,u={node:"circle",edge:"line",combo:"rect"},c={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},h=(t,e)=>{t.forEach((t=>{const{id:n}=t,i=Oe(t,["data",l(t)]),o=(null==r?void 0:r.getElementType(e,t))||"circle",a=((t,e)=>null==r?void 0:r.getElementComputedStyle(t,e))(e,t),h=("edge"===e?null==a?void 0:a.stroke:null==a?void 0:a.fill)||"#1783ff";n&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),s[i]||(s[i]={id:`${e}__${n}`,label:i,marker:c[o]||u[e],elementType:e,lineWidth:1,stroke:h,fill:h}))}))};switch(e){case"node":h(i,"node");break;case"edge":h(o,"edge");break;case"combo":h(a,"combo");break;default:return[]}return Object.values(s)},this.createElement=()=>{if(this.draw)return void this.updateElement();const t=this.options,{width:e,height:n,nodeField:r,edgeField:i,comboField:o,trigger:a,position:s,container:l,containerStyle:u,className:c}=t,h=Fe(t,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),d=this.getMarkerData(r,"node"),f=this.getMarkerData(i,"edge"),p=this.getMarkerData(o,"combo"),g=[...d,...p,...f],v=Object.assign({width:e,height:n,data:g,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:d.length},h,this.getEvents()),m=new vW({className:"legend",style:v});this.category=m;this.upsertCanvas().appendChild(m),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.container)||void 0===e||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:r=e,height:i=n,position:o,container:a,containerStyle:s,className:l}=this.options,[u,c]=ZW({width:r,height:i,graphCanvas:t,container:a,containerStyle:s,placement:o,className:"legend"});return this.container=u,l&&u.classList.add(l),this.canvas=c,this.canvas}destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}QW.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class JW extends Zj{constructor(t,e){super(t,Object.assign({},JW.defaultOptions,e)),this.onDraw=t=>{var e;(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.render)||this.onRender()},this.shapes=new Map,this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=t=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(t.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=t=>{if(!this.mask||!this.isMaskDragging)return;const{size:[e,n]}=this.options,{movementX:r,movementY:i}=t,{left:o,top:a,width:s,height:l}=this.mask.style,[,,u,c]=this.maskBBox;let h=parseInt(o)+r,d=parseInt(a)+i,f=parseInt(s),p=parseInt(l);h<0&&(h=0),d<0&&(d=0),h+f>e&&(h=eH(e-f,0)),d+p>n&&(d=eH(n-p,0)),f<u&&(r>0?(h=eH(h-r,0),f=tH(f+r,e)):r<0&&(f=tH(f-r,e))),p<c&&(i>0?(d=eH(d-i,0),p=tH(p+i,n)):i<0&&(p=tH(p-i,n))),Object.assign(this.mask.style,{left:h+"px",top:d+"px",width:f+"px",height:p+"px"});const g=parseInt(o)-h,v=parseInt(a)-d;if(0===g&&0===v)return;const m=this.context.canvas.getCamera().getZoom()/this.canvas.getCamera().getZoom();this.context.graph.translateBy([g*m,v*m],!1)},this.onMaskDragEnd=t=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(t.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=Re((()=>{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=ye((()=>{this.renderMinimap(),this.renderMask()}),this.options.delay,!0)}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.onDraw),e.on(t.GraphEvent.AFTER_RENDER,this.onRender),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.onDraw),e.off(t.GraphEvent.AFTER_RENDER,this.onRender),e.off(t.GraphEvent.AFTER_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:r,edges:i,combos:o}=n;return{nodes:r.filter((e=>t(bh(e),"node"))),edges:i.filter((e=>t(bh(e),"edge"))),combos:o.filter((e=>t(bh(e),"combo")))}}setShapes(t,e){const{nodes:n,edges:r,combos:i}=e,{shape:o}=this.options,{element:a}=this.context;if("key"===o){const e=new Set,o=n=>{const r=bh(n);e.add(r);const i=a.getElement(r);if(!i)return;const o=i.getShape("key"),s=this.shapes.get(r)||o.cloneNode();s.setPosition(o.getPosition()),i.style.zIndex&&(s.style.zIndex=i.style.zIndex),s.id=i.id,this.shapes.has(r)?Object.entries(o.attributes).forEach((([t,e])=>{s.style[t]!==e&&(s.style[t]=e)})):(t.appendChild(s),this.shapes.set(r,s))};return r.forEach(o),i.forEach(o),n.forEach(o),void this.shapes.forEach(((n,r)=>{e.has(r)||(t.removeChild(n),this.shapes.delete(r))}))}const s=(t,e)=>{const n=a.getElement(t).getPosition();return e.setPosition(n),e};t.removeChildren(),r.forEach((e=>t.appendChild(o(bh(e),"edge")))),i.forEach((e=>{t.appendChild(s(bh(e),o(bh(e),"combo")))})),n.forEach((e=>{t.appendChild(s(bh(e),o(bh(e),"node")))}))}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:r,height:i}=this.canvas.getConfig();e===r&&n===i||this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:r,position:i,container:o,containerStyle:a}=this.options,[s,l]=ZW({renderer:t,width:e,height:n,placement:i,className:"minimap",container:o,containerStyle:a,graphCanvas:this.context.canvas});r&&s.classList.add(r),this.container=s,this.canvas=l}return this.setCamera(),this.canvas}createLandmark(t,e,n){const r=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(r))return this.landmarkMap.get(r);const i=this.canvas.getCamera().createLandmark(r,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(r,i),i}setCamera(){var t;const{canvas:e}=this.context,n=null===(t=this.canvas)||void 0===t?void 0:t.getCamera();if(!n)return;const{size:[r,i],padding:o}=this.options,[a,s,l,u]=Yc(o),{min:c,max:h,center:d}=e.getBounds("elements"),f=(r-u-s)/(h[0]-c[0]),p=(i-a-l)/(h[1]-c[1]),g=Math.min(f,p),v=this.createLandmark(d,d,g);n.gotoLandmark(v,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),r=t.getCanvasByViewport(e),i=this.canvas.canvas2Viewport(rd(n)),o=this.canvas.canvas2Viewport(rd(r)),a=o.x-i.x,s=o.y-i.y;return[i.x,i.y,a,s]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,r,i,o]=this.maskBBox;return n<0&&(i=tH(i+n,t),n=0),r<0&&(o=tH(o+r,e),r=0),n+i>t&&(i=eH(t-n,0)),r+o>e&&(o=eH(e-r,0)),[tH(n,t),tH(r,e),eH(i,0),eH(o,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,r]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:r+"px"})}destroy(){var t;this.unbindEvents(),this.canvas.destroy(),null===(t=this.mask)||void 0===t||t.remove(),super.destroy()}}JW.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 tH=(t,e)=>Math.min(t,e),eH=(t,e)=>Math.max(t,e),nH={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class rH extends Zj{constructor(t,e){super(t,Object.assign({},rH.defaultOptions,e)),this.initSnapline=()=>{const t=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=t.appendChild(new Wl({style:Object.assign(Object.assign({},nH),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=t.appendChild(new Wl({style:Object.assign(Object.assign({},nH),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(t,e,n)=>ze(this,void 0,void 0,(function*(){const{verticalX:r,horizontalY:i}=n,{tolerance:o}=this.options,{min:[a,s],max:[l,u],center:[c,h]}=e;let d=0,f=0;null!==r&&(iH(l,r)<o&&(d=r-l),iH(a,r)<o&&(d=r-a),iH(c,r)<o&&(d=r-c),0!==d&&(this.isVerticalSticking=!0)),null!==i&&(iH(u,i)<o&&(f=i-u),iH(s,i)<o&&(f=i-s),iH(h,i)<o&&(f=i-h),0!==f&&(this.isHorizontalSticking=!0)),0===d&&0===f||(yield this.context.graph.translateElementBy({[t]:[d,f]},!1))})),this.enableSnap=t=>{const{target:e}=t,n=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[r,i]=this.getDelta(t);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(r)<=n&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,-i]},!1),!1;if(this.isHorizontalSticking&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[0,-i]},!1),!1;if(this.isVerticalSticking&&Math.abs(r)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout((()=>{this.enableStick=!0}),200)}return this.enableStick},this.calcSnaplineMetadata=(t,e)=>{const{tolerance:n,shape:r}=this.options,{min:[i,o],max:[a,s],center:[l,u]}=e;let c=null,h=null,d=null,f=null,p=null,g=null;return this.getNodes().some((e=>{if(Ne(t.id,e.id))return!1;const v=oH(e,r).getRenderBounds(),{min:[m,y],max:[b,x],center:[E,w]}=v;return null===c&&(iH(E,l)<n?c=E:iH(m,i)<n||iH(m,a)<n?c=m:(iH(b,a)<n||iH(b,i)<n)&&(c=b),null!==c&&(h=Math.min(y,o),d=Math.max(x,s))),null===f&&(iH(w,u)<n?f=w:iH(y,o)<n||iH(y,s)<n?f=y:(iH(x,s)<n||iH(x,o)<n)&&(f=x),null!==f&&(p=Math.min(m,i),g=Math.max(b,a))),null!==c&&null!==f})),{verticalX:c,verticalMinY:h,verticalMaxY:d,horizontalY:f,horizontalMinX:p,horizontalMaxX:g}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=t=>ze(this,void 0,void 0,(function*(){const{target:e}=t;if(this.options.autoSnap){if(!this.enableSnap(t))return}const n=oH(e,this.options.shape).getRenderBounds(),r=this.calcSnaplineMetadata(e,n);this.hideSnapline(),null===r.verticalX&&null===r.horizontalY||this.updateSnapline(r),this.options.autoSnap&&(yield this.autoSnapToLine(e.id,n,r))})),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,n=((null===(t=this.context.element)||void 0===t?void 0:t.getNodes())||[]).filter((t=>{var e;return"hidden"!==Oe(t,["style","visibility"])&&(null===(e=this.context.viewport)||void 0===e?void 0:e.isInViewport(t.getRenderBounds()))}));return e?n.filter((t=>e(t))):n}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||nH.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:r,horizontalY:i,horizontalMinX:o,horizontalMaxX:a}=t,[s,l]=this.context.canvas.getSize(),{offset:u}=this.options;null!==i?Object.assign(this.horizontalLine.style,{x1:u===1/0?0:o-u,y1:i,x2:u===1/0?s:a+u,y2:i,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",null!==e?Object.assign(this.verticalLine.style,{x1:e,y1:u===1/0?0:n-u,x2:e,y2:u===1/0?l:r+u,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return zh([t.dx,t.dy],e)}bindEvents(){return ze(this,void 0,void 0,(function*(){const{graph:e}=this.context;e.on(t.NodeEvent.DRAG_START,this.onDragStart),e.on(t.NodeEvent.DRAG,this.onDrag),e.on(t.NodeEvent.DRAG_END,this.onDragEnd)}))}unbindEvents(){const{graph:e}=this.context;e.off(t.NodeEvent.DRAG_START,this.onDragStart),e.off(t.NodeEvent.DRAG,this.onDrag),e.off(t.NodeEvent.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;null===(t=this.horizontalLine)||void 0===t||t.destroy(),null===(e=this.verticalLine)||void 0===e||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}rH.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const iH=(t,e)=>Math.abs(t-e),oH=(t,e)=>"function"==typeof e?e(t):t.getShape(e),aH=["timestamp","time","date","datetime"];class sH extends Zj{get padding(){return Yc(this.options.padding)}constructor(t,e){super(t,Object.assign({},sH.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){var t;null===(t=this.timebar)||void 0===t||t.play()}pause(){var t;null===(t=this.timebar)||void 0===t||t.pause()}forward(){var t;null===(t=this.timebar)||void 0===t||t.forward()}backward(){var t;null===(t=this.timebar)||void 0===t||t.backward()}reset(){var t;null===(t=this.timebar)||void 0===t||t.reset()}update(t){super.update(t),this.backup(),this.upsertTimebar()}backup(){this.originalData=lH(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:r,data:i,x:o,y:a,width:s,height:l,mode:u}=e,c=Fe(e,["onChange","timebarType","data","x","y","width","height","mode"]),h=t.getSize(),[d]=this.padding;this.upsertCanvas().ready.then((()=>{var t;const e=Object.assign(Object.assign({x:h[0]/2-s/2,y:d,onChange:t=>{const e=($t(t)?t:[t,t]).map((t=>function(t){return t instanceof Date}(t)?t.getTime():t));"modify"===this.options.mode?this.filterElements(e):this.hiddenElements(e),null==n||n(e)}},c),{data:i.map((t=>ae(t)?{time:t,value:0}:t)),width:s,height:l,type:r});this.timebar?this.timebar.update(e):(this.timebar=new KW({style:e}),null===(t=this.canvas)||void 0===t||t.appendChild(this.timebar))}))}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,r=this.context.canvas,[i]=r.getSize(),[o,,a]=this.padding,[s,l]=ZW({width:i,height:e+o+a,graphCanvas:r,className:"timebar",placement:n});return this.container=s,t&&s.classList.add(t),this.canvas=l,this.canvas}filterElements(t){return ze(this,void 0,void 0,(function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:r}=this.options,{graph:i,element:o}=this.context,a=lH(this.originalData);n.forEach((e=>{const n=`${e}s`;a[n]=(this.originalData[n]||[]).filter((e=>{const n=r(e);return!!uH(n,t)}))}));const s=[...a.nodes,...a.combos].map((t=>bh(t)));a.edges=a.edges.filter((t=>{const e=t.source,n=t.target;return s.includes(e)&&s.includes(n)})),i.setData(a),yield null===(e=o.draw({animation:!1,silence:!0}))||void 0===e?void 0:e.finished}))}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:r}=this.options,i=[],o=[];n.forEach((e=>{var n;const a=`${e}s`;((null===(n=this.originalData)||void 0===n?void 0:n[a])||[]).forEach((e=>{const n=bh(e),a=r(e);uH(a,t)?o.push(n):i.push(n)}))})),e.hideElement(i,!1),e.showElement(o,!1)}destroy(){var t,e,n;const{graph:r}=this.context;this.originalData&&r.setData(Object.assign({},this.originalData)),null===(t=this.timebar)||void 0===t||t.destroy(),null===(e=this.canvas)||void 0===e||e.destroy(),null===(n=this.container)||void 0===n||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}sH.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:t=>cH(t,aH,void 0),loop:!1};const lH=t=>{const{nodes:e=[],edges:n=[],combos:r=[]}=t;return{nodes:[...e],edges:[...n],combos:[...r]}},uH=(t,e)=>{if(ae(e))return t===e;const[n,r]=e;return t>=n&&t<=r},cH=(t,e,n)=>{var r;for(let n=0;n<e.length;n++){const i=e[n],o=null===(r=t.data)||void 0===r?void 0:r[i];if(o)return o}return n};class hH extends Zj{constructor(t,e){super(t,Object.assign({},hH.defaultOptions,e)),this.$element=Qj("toolbar",!1),this.onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");null==e||e(n,t.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),Jj("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n }\n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),Jj("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">\n <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>\n <symbol id="request-fullscreen" viewBox="0 0 1024 1024">\n <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return ze(this,void 0,void 0,(function*(){e.update.call(this,t);const{className:n,position:r,style:i}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,i,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach((t=>{e[t]="8px"})),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(r)),this.$element.innerHTML=yield this.getDOMContent()}))}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return ze(this,void 0,void 0,(function*(){return(yield this.options.getItems()).map((t=>`\n <div class="g6-toolbar-item" value="${t.value}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`)).join("")}))}}hH.defaultOptions={position:"top-left"};class dH extends Zj{constructor(t,e){super(t,Object.assign({},dH.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=t=>{const{enable:e}=this.options;return"function"==typeof e?e(t):e},this.onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?(this.hide(t),this.currentTarget=null):(this.currentTarget=e,this.show(t))},this.onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.show(t)},this.onPointerLeave=t=>{this.hide(t),this.currentTarget=null},this.onCanvasMove=t=>{this.hide(t),this.currentTarget=null},this.onPointerEnter=t=>{this.show(t)},this.showById=t=>{const e={target:{id:t}};this.show(e)},this.getElementData=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}},this.show=t=>{const{client:e,target:{id:n}}=t;if(jg(t.target))return;if(!this.tooltipElement||!this.isEnable(t))return;const r=this.context.graph.getElementType(n),{getContent:i,title:o}=this.options;this.currentTarget=n;const a=this.getElementData(n,r);let s,l;if(e)s=e.x,l=e.y;else{const t=Oe(a,"0.style",{x:0,y:0});s=t.x,l=t.y}let u={};if(i)u.content=i(t,a);else{const t=this.context.graph.getElementRenderStyle(n),e="node"===r?t.fill:t.stroke;u={title:o||r,data:a.map((t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:e})))}}this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:s,y:l,style:{".tooltip":{visibility:"visible"}}}),u))},this.hide=t=>{var e;if(!t)return void(null===(e=this.tooltipElement)||void 0===e||e.hide());if(!this.tooltipElement)return;if(!this.currentTarget)return;const{client:{x:n,y:r}}=t;this.tooltipElement.hide(n,r)},this.initTooltip=()=>{var t;const e=new kW({className:"tooltip",style:this.tooltipStyleProps});return null===(t=this.container)||void 0===t||t.appendChild(e.HTMLTooltipElement),e},this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node: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&&(null===(e=this.container)||void 0===e||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.off(n,e[n])}))}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.on(n,e[n])}))}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:a,enterable:s,container:l={x:-i,y:-r},title:u,offset:c}=this.options,[h,d]=e,[f,p]=t.getSize();return{x:h,y:d,container:l,title:u,bounding:{x:0,y:0,width:f,height:p},position:a,enterable:s,offset:c,style:o}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&(null===(t=this.container)||void 0===t||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}let fH;function pH(t,e){fH||(fH=document.createElement("canvas")),fH.width=t,fH.height=e;return fH.getContext("2d").clearRect(0,0,t,e),fH}dH.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};class gH extends Zj{constructor(t,e){super(t,Object.assign({},gH.defaultOptions,e)),this.$element=Qj("watermark");this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return ze(this,void 0,void 0,(function*(){e.update.call(this,t);const n=this.options,{width:r,height:i,text:o,imageURL:a}=n,s=Fe(n,["width","height","text","imageURL"]);Object.keys(s).forEach((e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])}));const l=a?yield function(t,e,n,r){return ze(this,void 0,void 0,(function*(){const i=pH(t,e),o=i.getContext("2d"),{rotate:a,opacity:s}=r;a&&o.rotate(a),s&&(o.globalAlpha=s);const l=new Image;return l.crossOrigin="anonymous",l.src=n,new Promise((n=>{l.onload=function(){const r=t>l.width?(t-l.width)/2:0,a=e>l.height?(e-l.height)/2:0;o.drawImage(l,0,0,l.width,l.height,r,a,t-2*r,e-2*a),n(i.toDataURL())}}))}))}(r,i,a,s):yield function(t,e,n,r){return ze(this,void 0,void 0,(function*(){const i=pH(t,e),o=i.getContext("2d"),{rotate:a,opacity:s,textFill:l,textFontSize:u,textFontFamily:c,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:p}=r;return o.textAlign=f,o.textBaseline=p,o.translate(t/2,e/2),o.font=`${u}px ${c} ${h} ${d}`,a&&o.rotate(a),s&&(o.globalAlpha=s),l&&(o.fillStyle=l,o.fillText(`${n}`,0,0)),i.toDataURL()}))}(r,i,o,s);this.$element.style.backgroundImage=`url(${l})`}))}destroy(){super.destroy(),this.$element.remove()}}function vH(t,e,n,r=!1){const i=Sc[t][e];!r&&i?i!==n&&Cc(`The extension ${e} of ${t} has been registered before.`):Object.assign(Sc[t],{[e]:n})}
71
+ */const Aj=Symbol("Comlink.proxy"),Pj=Symbol("Comlink.endpoint"),Rj=Symbol("Comlink.releaseProxy"),Dj=Symbol("Comlink.finalizer"),Lj=Symbol("Comlink.thrown"),_j=t=>"object"==typeof t&&null!==t||"function"==typeof t,Ij=new Map([["proxy",{canHandle:t=>_j(t)&&t[Aj],serialize(t){const{port1:e,port2:n}=new MessageChannel;return jj(t,e),[n,[n]]},deserialize:t=>(t.start(),Fj(t))}],["throw",{canHandle:t=>_j(t)&&Lj in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function jj(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(qj);let u;try{const e=s.slice(0,-1).reduce(((t,e)=>t[e]),t),n=s.reduce(((t,e)=>t[e]),t);switch(a){case"GET":u=n;break;case"SET":e[s.slice(-1)[0]]=qj(i.data.value),u=!0;break;case"APPLY":u=n.apply(e,l);break;case"CONSTRUCT":u=function(t){return Object.assign(t,{[Aj]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;jj(t,n),u=function(t,e){return Yj.set(t,e),t}(e,[e])}break;case"RELEASE":u=void 0;break;default:return}}catch(t){u={value:t,[Lj]:0}}Promise.resolve(u).catch((t=>({value:t,[Lj]:0}))).then((n=>{const[i,s]=$j(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),Bj(e),Dj in t&&"function"==typeof t[Dj]&&t[Dj]())})).catch((t=>{const[n,r]=$j({value:new TypeError("Unserializable return value"),[Lj]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function Bj(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function Fj(t,e){const n=new Map;return t.addEventListener("message",(function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}})),Hj(t,n,[],e)}function zj(t){if(t)throw new Error("Proxy has been released and is not useable")}function Gj(t){return Xj(t,new Map,{type:"RELEASE"}).then((()=>{Bj(t)}))}const Vj=new WeakMap,Wj="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(Vj.get(t)||0)-1;Vj.set(t,e),0===e&&Gj(t)}));function Hj(t,e,n=[],r=function(){}){let i=!1;const o=new Proxy(r,{get(r,a){if(zj(i),a===Rj)return()=>{!function(t){Wj&&Wj.unregister(t)}(o),Gj(t),e.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const r=Xj(t,e,{type:"GET",path:n.map((t=>t.toString()))}).then(qj);return r.then.bind(r)}return Hj(t,e,[...n,a])},set(r,o,a){zj(i);const[s,l]=$j(a);return Xj(t,e,{type:"SET",path:[...n,o].map((t=>t.toString())),value:s},l).then(qj)},apply(r,o,a){zj(i);const s=n[n.length-1];if(s===Pj)return Xj(t,e,{type:"ENDPOINT"}).then(qj);if("bind"===s)return Hj(t,e,n.slice(0,-1));const[l,u]=Uj(a);return Xj(t,e,{type:"APPLY",path:n.map((t=>t.toString())),argumentList:l},u).then(qj)},construct(r,o){zj(i);const[a,s]=Uj(o);return Xj(t,e,{type:"CONSTRUCT",path:n.map((t=>t.toString())),argumentList:a},s).then(qj)}});return function(t,e){const n=(Vj.get(e)||0)+1;Vj.set(e,n),Wj&&Wj.register(t,e,t)}(o,t),o}function Uj(t){const e=t.map($j);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const Yj=new WeakMap;function $j(t){for(const[e,n]of Ij)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},Yj.get(t)||[]]}function qj(t){switch(t.type){case"HANDLER":return Ij.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Xj(t,e,n,r){return new Promise((i=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.set(o,i),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)}))}class Kj extends Wg{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=Fj(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return ze(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=Fe(this.layout.options,["onTick"]),n={};Object.keys(e).forEach((t=>{Ut(e[t])||(n[t]=e[t])}));const r={layout:{id:this.layout.id,options:n,iterations:null===(t=this.options)||void 0===t?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},i=new Float32Array([0]),[o]=yield this.proxy.calculateLayout(r,[i]);return o}))}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[Rj]()}isRunning(){return this.running}}class Zj extends Xg{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Se(t)||t.length>2))return t[0]}formatSize(t){const e="function"==typeof t?t:()=>t;return t=>Rd(e(t))}doLayout(t,e){const{hGap:n,getRibSep:r,vGap:i,nodeSize:o,height:a}=e,{model:s}=this.context,l=this.formatSize(o);let u=l(t)[0]+r(t);const c=(t,e=0)=>{var r;return e+=n*((t.children||[]).length+1),null===(r=t.children)||void 0===r||r.forEach((t=>{var n;null===(n=s.getNodeLikeDatum(t).children)||void 0===n||n.forEach((t=>{const n=s.getNodeLikeDatum(t);e=c(n,e)}))})),e},h=t=>{if(1===t.depth)return u;const e=s.getParentData(t.id,"tree");if(tB(t)){const r=s.getParentData(e.id,"tree"),o=p(t)-p(r);return h(e)+o*n/i}{const n=(e.children||[]).indexOf(t.id),r=s.getNodeData((e.children||[]).slice(n));return d(e)-r.reduce(((t,e)=>t+c(e)),0)-l(e)[0]/2}},d=xe((t=>{if(Jj(t))return l(t)[0]/2;const e=s.getParentData(t.id,"tree");if(tB(t))return h(t)+c(t)+l(t)[0]/2;{const r=p(t)-p(e),o=n/i;return h(t)+r*o}}),(t=>t.id)),f=t=>p(s.getParentData(t,"tree")),p=xe((t=>{if(Jj(t))return a/2;if(tB(t)){const e=s.getParentData(t.id,"tree"),n=e.children.indexOf(t.id);if(0===n)return f(e.id)+i;const r=s.getNodeLikeDatum(e.children[n-1]);if(Se(r.children))return p(r)+i;const o=s.getDescendantsData(r.id);return Math.max(...o.map((t=>tB(t)?f(t.id):p(t))))+i}{if(Se(t.children))return f(t.id)+i;const e=s.getNodeLikeDatum(t.children.slice(-1)[0]);if(Se(e.children))return p(e)+i;const n=s.getDescendantsData(t.id).slice(-1)[0];return(tB(n)?f(n.id):p(n))+i}}),(t=>t.id));let g=0;const v={nodes:[],edges:[]},m=t=>{var e;null===(e=t.children)||void 0===e||e.forEach((t=>m(s.getNodeLikeDatum(t))));const n=p(t),i=d(t);if(v.nodes.push({id:t.id,x:i,y:n}),Jj(t))return;const o=s.getRelatedEdgesData(t.id,"in")[0],a=[h(t),tB(t)?n:f(t.id)];v.edges.push({id:bh(o),controlPoints:[a],relatedNodeId:t.id}),g=Math.max(g,i+r(t)),1===t.depth&&(u=g)};return m(t),v}placeAlterative(t,e){const n=(e.children||[]).filter(((t,e)=>e%2!=0));if(0===n.length)return t;const{model:r}=this.context,i=t.nodes.find((t=>t.id===e.id)).y,o=t=>{const e=r.getAncestorsData(t,"tree");if(Se(e))return!1;const i=1===e.length?t:e[e.length-2].id;return n.includes(i)};t.nodes.forEach((t=>{o(t.id)&&(t.y=2*i-t.y)})),t.edges.forEach((t=>{o(t.relatedNodeId)&&(t.controlPoints=t.controlPoints.map((t=>[t[0],2*i-t[1]])))}))}rightToLeft(t,e){return t.nodes.forEach((t=>t.x=e.width-t.x)),t.edges.forEach((t=>{t.controlPoints=t.controlPoints.map((t=>[e.width-t[0],t[1]]))})),t}execute(t,e){return ze(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign(Object.assign({},Zj.defaultOptions),this.options),e),{direction:r,nodeSize:i}=n,o=this.getRoot();if(!o)return t;const a=this.formatSize(i);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map((t=>a(t)[1])))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map((t=>a(t)[0]))));let s=this.doLayout(o,n);this.placeAlterative(s,o),"RL"===r&&(s=this.rightToLeft(s,n));const{model:l}=this.context,u=[],c=[];return s.nodes.forEach((t=>{const{id:e,x:n,y:r}=t,i=l.getNodeLikeDatum(e);u.push(Qj(i,{x:n,y:r}))})),s.edges.forEach((t=>{const{id:e,controlPoints:n}=t,r=l.getEdgeDatum(e);c.push(Qj(r,{controlPoints:n}))})),{nodes:u,edges:c}}))}}Zj.defaultOptions={direction:"RL",getRibSep:()=>60};const Qj=(t,e)=>Object.assign(Object.assign({},t),{style:Object.assign(Object.assign({},t.style||{}),e)}),Jj=t=>0===t.depth,tB=t=>(t.depth||(t.depth=0))%2==0;class eB extends Xg{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n="function"==typeof e?e:()=>e;return t.reduce(((t,e)=>{const[r,i]=Rd(n(e))||[0,0];return[Math.max(t[0],r),Math.max(t[1],i)]}),[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,r={},i={},o={};e.forEach((t=>{r[t.id]=0,i[t.id]=0,o[t.id]=[]})),n.forEach((t=>{r[t.target]++,i[t.source]++,o[t.source].push(t.target)}));const a=new Set,s=t=>{a.has(t)||(a.add(t),o[t].forEach(s))};if(s(e[0].id),a.size!==e.length)return!1;const l=e.filter((t=>0===r[t.id])),u=e.filter((t=>0===i[t.id]));if(1!==l.length||1!==u.length)return!1;return e.filter((t=>1===r[t.id]&&1===i[t.id])).length===e.length-2}execute(t,e){return ze(this,void 0,void 0,(function*(){var n;if(!this.validate(t))return t;const{nodeSize:r,padding:i,sortBy:o,cols:a,colGap:s,rowGap:l,clockwise:u,width:c,height:h}=Object.assign({},eB.defaultOptions,this.options,e),[d,f,p,g]=Yc(i),v=this.formatSize(t.nodes||[],r),m=Math.ceil((t.nodes||[]).length/a);let y=s||(c-g-f-a*v[0])/(a-1),b=l||(h-d-p-m*v[1])/(m-1);(b===1/0||b<0)&&(b=0),(y===1/0||y<0)&&(y=0);const x=o?null===(n=t.nodes)||void 0===n?void 0:n.sort(o):function(t){const{nodes:e=[],edges:n=[]}=t,r={},i={};e.forEach((t=>{r[t.id]=0,i[t.id]=[]})),n.forEach((t=>{r[t.target]++,i[t.source].push(t.target)}));const o=[],a=[];e.forEach((t=>{0===r[t.id]&&o.push(t.id)}));for(;o.length>0;){const t=o.shift(),n=e.find((e=>e.id===t));a.push(n),i[t].forEach((t=>{r[t]--,0===r[t]&&o.push(t)}))}return a}(t),E=(x||[]).map(((t,e)=>{const n=Math.floor(e/a),r=e%a,i=g+(u?n%2==0?r:a-1-r:n%2==0?a-1-r:r)*(v[0]+y)+v[0]/2,o=d+n*(v[1]+b)+v[1]/2;return{id:t.id,style:{x:i,y:o}}}));return{nodes:E}}))}}eB.defaultOptions={padding:0,cols:5,clockwise:!0};class nB extends Dh{}function rB(t,e=!0,n){const r=document.createElement("div");return r.setAttribute("class",`g6-${t}`),Object.assign(r.style,{position:"absolute",display:"block"}),e&&Object.assign(r.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),n&&Object.assign(r.style,n),r}function iB(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const a=document.createElement(e);return a.innerHTML=r,a.id=t,Object.assign(a.style,n),i.appendChild(a),a}class oB extends nB{constructor(t,e){super(t,Object.assign({},oB.defaultOptions,e)),this.$element=rB("background");this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return ze(this,void 0,void 0,(function*(){e.update.call(this,t),Object.assign(this.$element.style,Pe(this.options,["key","type"]))}))}destroy(){super.destroy(),this.$element.remove()}}function aB(t,e,n,r,i,o){const a=n-t,s=r-e;let l=i-t,u=o-e,c=l*a+u*s,h=0;c<=0?h=0:(l=a-l,u=s-u,c=l*a+u*s,h=c<=0?0:c*c/(a*a+s*s));const d=l*l+u*u-h;return d<0?0:d}function sB(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)}function lB(t,e,n,r,i){return sB(t,e,n,r)<i*i}function uB(t){const e=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2);return{x:e,y:r,x2:n,y2:i,width:n-e,height:i-r}}oB.defaultOptions={transition:"background 0.5s",backgroundSize:"cover"};class cB{constructor(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new cB(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2)return!1;if(e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2)return!1;if(t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;return t<=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1)}distSquare(t,e){return aB(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 hB,dB;!function(t){t[t.POINT=1]="POINT",t[t.PARALLEL=2]="PARALLEL",t[t.COINCIDENT=3]="COINCIDENT",t[t.NONE=4]="NONE"}(hB||(hB={}));class fB{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function pB(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const e=n/i,o=r/i;return 0<=e&&e<=1&&0<=o&&o<=1?new fB(hB.POINT,t.x1+e*(t.x2-t.x1),t.y1+e*(t.y2-t.y1)):new fB(hB.NONE)}return new fB(0===n||0===r?hB.COINCIDENT:hB.PARALLEL)}function gB(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const t=n/i,e=r/i;if(0<=t&&t<=1&&0<=e&&e<=1)return t}return Number.POSITIVE_INFINITY}function vB(t,e,n){const r=new Set;return t.width<=0?(r.add(dB.LEFT),r.add(dB.RIGHT)):e<t.x?r.add(dB.LEFT):e>t.x+t.width&&r.add(dB.RIGHT),t.height<=0?(r.add(dB.TOP),r.add(dB.BOTTOM)):n<t.y?r.add(dB.TOP):n>t.y+t.height&&r.add(dB.BOTTOM),r}function mB(t,e){let n=e.x1,r=e.y1;const i=e.x2,o=e.y2,a=Array.from(vB(t,i,o));if(0===a.length)return!0;let s=vB(t,n,r);for(;0!==s.size;){for(const t of a)if(s.has(t))return!1;if(s.has(dB.RIGHT)||s.has(dB.LEFT)){let e=t.x;s.has(dB.RIGHT)&&(e+=t.width),r+=(e-n)*(o-r)/(i-n),n=e}else{let e=t.y;s.has(dB.BOTTOM)&&(e+=t.height),n+=(e-r)*(i-n)/(o-r),r=e}s=vB(t,n,r)}return!0}function yB(t,e){let n=Number.POSITIVE_INFINITY,r=0;function i(t,i,o,a){let s=gB(e,new cB(t,i,o,a));s=Math.abs(s-.5),s>=0&&s<=1&&(r++,s<n&&(n=s))}return i(t.x,t.y,t.x2,t.y),i(t.x,t.y,t.x,t.y2),r>1?n:(i(t.x,t.y2,t.x2,t.y2),r>1?n:(i(t.x2,t.y,t.x2,t.y2),0===r?-1:n))}function bB(t,e){let n=0;const r=pB(t,new cB(e.x,e.y,e.x2,e.y));n+=r.state===hB.POINT?1:0;const i=pB(t,new cB(e.x,e.y,e.x,e.y2));n+=i.state===hB.POINT?1:0;const o=pB(t,new cB(e.x,e.y2,e.x2,e.y2));n+=o.state===hB.POINT?1:0;const a=pB(t,new cB(e.x2,e.y,e.x2,e.y2));return n+=a.state===hB.POINT?1:0,{top:r,left:i,bottom:o,right:a,count:n}}!function(t){t[t.LEFT=0]="LEFT",t[t.TOP=1]="TOP",t[t.RIGHT=2]="RIGHT",t[t.BOTTOM=3]="BOTTOM"}(dB||(dB={}));class xB{constructor(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new xB(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 xB(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x+t.width),i=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=r-e,this.height=i-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x),i=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=r-e,this.height=i-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return!(this.area<=0||t.width<=0||t.height<=0)&&(t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2)}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=vB(this,t,e);return n.has(dB.TOP)?n.has(dB.LEFT)?sB(t,e,this.x,this.y):n.has(dB.RIGHT)?sB(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(dB.BOTTOM)?n.has(dB.LEFT)?sB(t,e,this.x,this.y2):n.has(dB.RIGHT)?sB(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(dB.LEFT)?(this.x-t)*(this.x-t):n.has(dB.RIGHT)?(t-this.x2)*(t-this.x2):0}}class EB{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return 2*this.radius}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return 2*this.radius}static from(t){return new EB(t.cx,t.cy,t.radius)}containsPt(t,e){return sB(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=sB(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const r=Math.sqrt(n)-this.radius;return r*r}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,2*Math.PI)}}class wB{constructor(t,e=0,n=0,r=0,i=0,o=10,a=10,s=new Float32Array(Math.max(0,o*a)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=r,this.pixelY=i,this.width=o,this.height=a,this.area=s}createSub(t,e){return new wB(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new wB(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new wB(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),r=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),i=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup));return new xB(e,n,r-e,i-n)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),r=this.boundX(t.x-n),i=this.boundY(t.y-n),o=this.boundX(t.x2+n),a=this.boundY(t.y2+n);return new xB(r,i,o-r,a-i)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||0===e)return;const n=this.width,r=t.width,i=Math.max(0,t.i),o=Math.max(0,t.j),a=Math.min(t.i+t.width,n),s=Math.min(t.j+t.height,this.height);if(!(s<=0||a<=0||i>=n||s>=this.height))for(let l=o;l<s;l++){const o=(l-t.j)*r,s=l*n;for(let n=i;n<a;n++){const r=t.area[n-t.i+o];0!==r&&(this.area[n+s]+=e*r)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let r=0;r<t.height;r++){const i=n+r*this.width;this.area.fill(e,i,i+t.width)}}fillHorizontalLine(t,e,n,r){const i=t+e*this.width;this.area.fill(r,i,i+n)}fillVerticalLine(t,e,n,r){const i=t+e*this.width;for(let t=0;t<n;t++)this.area[i+t*this.width]=r}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let e=0;e<this.width;e++){t+=this.area[n+e].toFixed(1).padStart(6),t+=" "}t+="\n"}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce(((t,e)=>Math.min(t,e)),Number.POSITIVE_INFINITY),r=this.area.reduce(((t,e)=>Math.max(t,e)),Number.NEGATIVE_INFINITY),i=t=>(t-n)/(r-n);t.scale(this.pixelGroup,this.pixelGroup);for(let e=0;e<this.width;e++)for(let n=0;n<this.height;n++){const r=this.area[e+n*this.width];t.fillStyle=`rgba(0, 0, 0, ${i(r)})`,t.fillRect(e,n,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let n=0;n<this.width;n++)for(let r=0;r<this.height;r++){const i=this.area[n+r*this.width];t.fillStyle=i>e?"black":"white",t.fillRect(n,r,1,1)}t.restore()}}}function kB(t,e){const n=t=>({x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e});return Array.isArray(t)?t.map(n):n(t)}function MB(t,e,n){return SB(Object.assign(uB(t),{distSquare:(e,n)=>aB(t.x1,t.y1,t.x2,t.y2,e,n)}),e,n)}function SB(t,e,n){const r=kB(t,n),i=e.scale(r),o=e.createSub(i,r);return function(t,e,n,r){const i=n*n;for(let o=0;o<t.height;o++)for(let a=0;a<t.width;a++){const s=r(e.invertScaleX(t.i+a),e.invertScaleY(t.j+o));if(0!==s){if(s<i){const e=n-Math.sqrt(s);t.set(a,o,e*e)}}else t.set(a,o,i)}}(o,e,n,((e,n)=>t.distSquare(e,n))),o}function NB(t,e){return{x:t,y:e}}function OB(t,e,n,r){if(0===t.length)return[];const i=function(t){if(t.length<2)return t;let e=0,n=0;return t.forEach((t=>{e+=t.cx,n+=t.cy})),e/=t.length,n/=t.length,t.map((t=>{const r=e-t.cx,i=n-t.cy;return[t,r*r+i*i]})).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]))}(t);return i.map(((t,o)=>{const a=i.slice(0,o);return function(t,e,n,r,i){const o=NB(e.cx,e.cy),a=function(t,e,n){let r=Number.POSITIVE_INFINITY;return e.reduce(((e,i)=>{const o=sB(t.x,t.y,i.cx,i.cy);if(o>r)return e;const a=new cB(t.x,t.y,i.cx,i.cy),s=function(t,e){return t.reduce(((t,n)=>mB(n,e)&&function(t,e){function n(t,n,r,i){let o=gB(e,new cB(t,n,r,i));return o=Math.abs(o-.5),o>=0&&o<=1?1:0}let r=n(t.x,t.y,t.x2,t.y);return r+=n(t.x,t.y,t.x,t.y2),r>1||(r+=n(t.x,t.y2,t.x2,t.y2),r>1||(r+=n(t.x2,t.y,t.x2,t.y2),r>0))}(n,e)?t+1:t),0)}(n,a);return o*(s+1)*(s+1)<r&&(e=i,r=o*(s+1)*(s+1)),e}),null)}(o,n,t);if(null==a)return[];const s=function(t,e,n,r){const i=[],o=[];o.push(t);let a=!0;for(let t=0;t<n&&a;t++)for(a=!1;!a&&o.length>0;){const t=o.pop(),n=AB(e,t),s=n?bB(t,n):null;if(!n||!s||2!==s.count){a||i.push(t);continue}let l=r,u=PB(n,l,s,!0),c=CB(u,o)||CB(u,i),h=TB(u,e);for(;!c&&h&&l>=1;)l/=1.5,u=PB(n,l,s,!0),c=CB(u,o)||CB(u,i),h=TB(u,e);if(!u||c||h||(o.push(new cB(t.x1,t.y1,u.x,u.y)),o.push(new cB(u.x,u.y,t.x2,t.y2)),a=!0),a)continue;l=r,u=PB(n,l,s,!1);let d=CB(u,o)||CB(u,i);for(h=TB(u,e);!d&&h&&l>=1;)l/=1.5,u=PB(n,l,s,!1),d=CB(u,o)||CB(u,i),h=TB(u,e);u&&!d&&(o.push(new cB(t.x1,t.y1,u.x,u.y)),o.push(new cB(u.x,u.y,t.x2,t.y2)),a=!0),a||i.push(t)}for(;o.length>0;)i.push(o.pop());return i}(new cB(o.x,o.y,a.cx,a.cy),t,r,i);return function(t,e){const n=[];for(;t.length>0;){const r=t.pop();if(0===t.length){n.push(r);break}const i=t.pop(),o=new cB(r.x1,r.y1,i.x2,i.y2);AB(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(s,t)}(e,t,a,n,r)})).flat()}function TB(t,e){return e.some((e=>e.containsPt(t.x,t.y)))}function CB(t,e){return e.some((e=>!!lB(e.x1,e.y1,t.x,t.y,.001)||!!lB(e.x2,e.y2,t.x,t.y,.001)))}function AB(t,e){let n=Number.POSITIVE_INFINITY,r=null;for(const i of t){if(!mB(i,e))continue;const t=yB(i,e);t>=0&&t<n&&(r=i,n=t)}return r}function PB(t,e,n,r){const i=n.top,o=n.left,a=n.bottom,s=n.right;if(r){if(o.state===hB.POINT){if(i.state===hB.POINT)return NB(t.x-e,t.y-e);if(a.state===hB.POINT)return NB(t.x-e,t.y2+e);const n=t.width*t.height;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?NB(t.x-e,t.y-e):NB(t.x2+e,t.y-e):o.y<s.y?NB(t.x-e,t.y2+e):NB(t.x2+e,t.y2+e)}if(s.state===hB.POINT){if(i.state===hB.POINT)return NB(t.x2+e,t.y-e);if(a.state===hB.POINT)return NB(t.x2+e,t.y2+e)}const n=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*n?i.x>a.x?NB(t.x-e,t.y-e):NB(t.x-e,t.y2+e):i.x<a.x?NB(t.x2+e,t.y-e):NB(t.x2+e,t.y2+e)}if(o.state===hB.POINT){if(i.state===hB.POINT)return NB(t.x2+e,t.y2+e);if(a.state===hB.POINT)return NB(t.x2+e,t.y-e);const n=t.height*t.width;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?NB(t.x2+e,t.y2+e):NB(t.x-e,t.y2+e):o.y<s.y?NB(t.x2+e,t.y-e):NB(t.x-e,t.y-e)}if(s.state===hB.POINT){if(i.state===hB.POINT)return NB(t.x-e,t.y2+e);if(a.state===hB.POINT)return NB(t.x-e,t.y-e)}const l=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*l?i.x>a.x?NB(t.x2+e,t.y2+e):NB(t.x2+e,t.y-e):i.x<a.x?NB(t.x-e,t.y2+e):NB(t.x-e,t.y-e)}function RB(t,e,n,r){if(!(t.closed?n<t.length:n<t.length-1))return!1;const i=t.get(e),o=t.get(n+1);for(let a=e+1;a<=n;a++){const e=t.get(a);if(aB(i.x,i.y,o.x,o.y,e.x,e.y)>r)return!1}return!0}function DB(t,e){switch(t){case-2:return(((3-e)*e-3)*e+1)/6;case-1:return((3*e-6)*e*e+4)/6;case 0:return(((-3*e+3)*e+3)*e+1)/6;case 1:return e*e*e/6;default:throw new Error("unknown error")}}class LB{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(0===e.length)return"";const n="function"==typeof t?t:function(t){if(!Number.isFinite(t))return t=>t;if(0===t)return Math.round;const e=Math.pow(10,t);return t=>Math.round(t*e)/e}(t);let r="M";for(const t of e)r+=`${n(t.x)},${n(t.y)} L`;return r=r.slice(0,-1),this.closed&&(r+=" Z"),r}draw(t){const e=this.points;if(0!==e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return function(t=8){return e=>{let n=t,r=e.length;if(n>1)for(r=Math.floor(e.length/n);r<3&&n>1;)n-=1,r=Math.floor(e.length/n);const i=[];for(let t=0,o=0;o<r;o++,t+=n)i.push(e.get(t));return new LB(i)}}(t)(this)}simplify(t){return function(t=0){return e=>{if(t<0||e.length<3)return e;const n=[];let r=0;const i=t*t;for(;r<e.length;){let t=r+1;for(;RB(e,r,t,i);)t++;n.push(e.get(r)),r=t}return new LB(n)}}(t)(this)}bSplines(t){return function(t=6){function e(t,e,n){let r=0,i=0;for(let o=-2;o<=1;o++){const a=t.get(e+o),s=DB(o,n);r+=s*a.x,i+=s*a.y}return{x:r,y:i}}return n=>{if(n.length<3)return n;const r=[],i=n.closed,o=n.length+3-1+(i?0:2);r.push(e(n,2-(i?0:2),0));for(let a=2-(i?0:2);a<o;a++)for(let i=1;i<=t;i++)r.push(e(n,a,i/t));return new LB(r)}}(t)(this)}apply(t){return t(this)}containsElements(t){const e=function(t){if(0===t.length)return null;const e=t[0],n=new xB(e.x,e.y,0,0);for(const e of t)n.addPoint(e);return n}(this.points);return!!e&&t.every((t=>e.containsPt(t.cx,t.cy)&&this.withinArea(t.cx,t.cy)))}withinArea(t,e){if(0===this.length)return!1;let n=0;const r=this.points[0],i=new cB(r.x,r.y,r.x,r.y);for(let r=1;r<this.points.length;r++){const o=this.points[r];i.x1=i.x2,i.y1=i.y2,i.x2=o.x,i.y2=o.y,i.cuts(t,e)&&n++}return i.x1=i.x2,i.y1=i.y2,i.x2=r.x,i.y2=r.y,i.cuts(t,e)&&n++,n%2==1}}class _B{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(0===this.count)return!1;const e=this.arr[0];return null!=e&&e.x===t.x&&e.y===t.y}path(){return new LB(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}function IB(t,e){const n=2*(Math.floor(t.width)+Math.floor(t.height)),r=new _B(n);function i(n,r,i,o){const a=t.get(n,r);return Number.isNaN(a)?Number.NaN:a>e?i+o:i}function o(t,e){let n=0;return n=i(t,e,n,1),n=i(t+1,e,n,2),n=i(t,e+1,n,4),n=i(t+1,e+1,n,8),Number.isNaN(n)?-1:n}let a=1;function s(e,n){let i=e,s=n,l=t.invertScaleX(i),u=t.invertScaleY(s);for(let e=0;e<t.width*t.height;e++){const e={x:l,y:u};if(r.contains(e)){if(r.isFirst(e))return!0}else r.add(e);const n=o(i,s);switch(n){case-1:return!0;case 0:case 3:case 2:case 7:a=2;break;case 12:case 14:case 4:a=3;break;case 6:a=0===a?3:2;break;case 1:case 13:case 5:a=0;break;case 9:a=2===a?0:1;break;case 10:case 8:case 11:a=1;break;default:return console.warn("Marching squares invalid state: "+n),!0}switch(a){case 0:s--,u-=t.pixelGroup;break;case 1:s++,u+=t.pixelGroup;break;case 3:i--,l-=t.pixelGroup;break;case 2:i++,l+=t.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+n),!0}}return!0}for(let n=0;n<t.width;n++)for(let i=0;i<t.height;i++){if(t.get(n,i)<=e)continue;const a=o(n,i);if(!(a<0||15===a)&&s(n,i))return r.path()}return null}const jB={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 BB(t){return null!=t&&"number"==typeof t.radius}function FB(t,e){if(BB(t)!==BB(e))return!1;if(BB(t)){const n=e;return t.cx===n.cx&&t.cy===n.cy&&t.radius===n.radius}const n=e;return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}var zB;!function(t){t[t.MEMBERS=0]="MEMBERS",t[t.NON_MEMBERS=1]="NON_MEMBERS",t[t.EDGES=2]="EDGES"}(zB||(zB={}));let GB=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new xB(0,0,0,0),this.potentialArea=new wB(1,0,0,0,0,0,0),this.o=Object.assign({},jB,t)}pushMember(...t){if(0!==t.length){this.dirty.add(zB.MEMBERS);for(const e of t)this.members.push({raw:e,obj:BB(e)?EB.from(e):xB.from(e),area:null})}}removeMember(t){const e=this.members.findIndex((e=>FB(e.raw,t)));return!(e<0)&&(this.members.splice(e,1),this.dirty.add(zB.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex((e=>FB(e.raw,t)));return!(e<0)&&(this.nonMembers.splice(e,1),this.dirty.add(zB.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex((e=>e.obj.equals(t)));return!(e<0)&&(this.edges.splice(e,1),this.dirty.add(zB.NON_MEMBERS),!0)}pushNonMember(...t){if(0!==t.length){this.dirty.add(zB.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:BB(e)?EB.from(e):xB.from(e),area:null})}}pushEdge(...t){if(0!==t.length){this.dirty.add(zB.EDGES);for(const e of t)this.edges.push({raw:e,obj:cB.from(e),area:null})}}update(){const t=this.dirty.has(zB.MEMBERS),e=this.dirty.has(zB.NON_MEMBERS);let n=this.dirty.has(zB.EDGES);this.dirty.clear();const r=this.members.map((t=>t.obj));if(this.o.virtualEdges&&(t||e)){const t=OB(r,this.nonMembers.map((t=>t.obj)),this.o.maxRoutingIterations,this.o.morphBuffer),e=new Map(this.virtualEdges.map((t=>[t.obj.toString(),t.area])));this.virtualEdges=t.map((t=>{var n;return{raw:t,obj:t,area:null!==(n=e.get(t.toString()))&&void 0!==n?n:null}})),n=!0}let i=!1;if(t||n){const t=function(t,e){if(0===t.length)return new xB(0,0,0,0);const n=xB.from(t[0]);for(const e of t)n.add(e);for(const t of e)n.add(uB(t));return n}(r,this.virtualEdges.concat(this.edges).map((t=>t.obj))),e=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,n=xB.from(kB(t,e));n.equals(this.activeRegion)||(i=!0,this.activeRegion=n)}if(i){const t=Math.ceil(this.activeRegion.width/this.o.pixelGroup),e=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=wB.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach((t=>t.area=null)),this.nonMembers.forEach((t=>t.area=null)),this.edges.forEach((t=>t.area=null)),this.virtualEdges.forEach((t=>t.area=null))):t===this.potentialArea.width&&e===this.potentialArea.height||(this.potentialArea=wB.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const o=new Map,a=t=>{if(t.area){const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof xB?"R":"C"}`;o.set(e,t.area)}},s=t=>{if(t.area)return;const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof xB?"R":"C"}`;if(o.has(e)){const n=o.get(e);return void(t.area=this.potentialArea.copy(n,{x:t.obj.x-this.o.nodeR1,y:t.obj.y-this.o.nodeR1}))}const n=t.obj instanceof xB?function(t,e,n){const r=e.scale(t),i=e.addPadding(r,n),o=e.createSub(i,{x:t.x-n,y:t.y-n}),a=r.x-i.x,s=r.y-i.y,l=i.x2-r.x2,u=i.y2-r.y2,c=i.width-a-l,h=i.height-s-u,d=n*n;o.fillArea({x:a,y:s,width:c+1,height:h+1},d);const f=[0],p=Math.max(s,a,l,u);{const i=e.invertScaleX(r.x+r.width/2);for(let o=1;o<p;o++){const a=e.invertScaleY(r.y-o),s=t.distSquare(i,a);if(!(s<d))break;{const t=n-Math.sqrt(s);f.push(t*t)}}}const g=[],v=Math.max(a,l),m=Math.max(s,l);for(let i=1;i<v;i++){const o=e.invertScaleX(r.x-i),a=[];for(let i=1;i<m;i++){const s=e.invertScaleY(r.y-i),l=t.distSquare(o,s);if(l<d){const t=n-Math.sqrt(l);a.push(t*t)}else a.push(0)}g.push(a)}for(let t=1;t<Math.min(s,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s-t,c+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s+h+t,c+1,e)}for(let t=1;t<Math.min(a,f.length);t++){const e=f[t];o.fillVerticalLine(a-t,s,h+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillVerticalLine(a+c+t,s,h+1,e)}for(let t=1;t<a;t++){const e=g[t-1],n=a-t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}for(let t=1;t<l;t++){const e=g[t-1],n=a+c+t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}return o}(t.obj,this.potentialArea,this.o.nodeR1):SB(t.obj,this.potentialArea,this.o.nodeR1);t.area=n,o.set(e,n)};this.members.forEach(a),this.nonMembers.forEach(a),this.members.forEach(s),this.nonMembers.forEach((t=>{this.activeRegion.intersects(t.obj)?s(t):t.area=null})),this.edges.forEach((t=>{t.area||(t.area=MB(t.obj,this.potentialArea,this.o.edgeR1))})),this.virtualEdges.forEach((t=>{t.area||(t.area=MB(t.obj,this.potentialArea,this.o.edgeR1))}))}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(0===this.members.length)return new LB([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map((t=>t.area)),r=this.virtualEdges.concat(this.edges).map((t=>t.area)),i=this.nonMembers.filter((t=>null!=t.area)).map((t=>t.area)),o=this.members.map((t=>t.obj));return function(t,e,n,r,i,o={}){const a=Object.assign({},jB,o);let s=a.threshold,l=a.memberInfluenceFactor,u=a.edgeInfluenceFactor,c=a.nonMemberInfluenceFactor;const h=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),d=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1);for(let o=0;o<a.maxMarchingIterations;o++){if(t.clear(),0!==l){const n=l/h;for(const r of e)t.incArea(r,n)}if(0!==u){const e=u/d;for(const r of n)t.incArea(r,e)}if(0!==c){const e=c/h;for(const n of r)t.incArea(n,e)}const f=IB(t,s);if(f&&i(f))return f;if(s*=.95,o<=.5*a.maxMarchingIterations)l*=1.2,u*=1.2;else{if(!(0!==c&&r.length>0))break;c*=.8}}return new LB([])}(e,n,r,i,(t=>t.containsElements(o)),t)}};class VB extends nB{constructor(t,e){super(t,ke({},VB.defaultOptions,e)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:t,bubbleSetOptions:e}=this.parseOptions();Ne(this.bubbleSetOptions,e)||this.init(),this.bubbleSetOptions=Object.assign({},e);const n=Object.assign(Object.assign({},t),{d:this.getPath()});this.shape?this.shape.update(n):(this.shape=new Xd({style:n}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=t=>{if(!this.shape)return;const e=bh(t.data);[...this.options.members,...this.options.avoidMembers].includes(e)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(e)}))},this.getPath=t=>{const{graph:e}=this.context,n=this.options.members,r=[...this.members.keys()],i=this.options.avoidMembers,o=[...this.avoidMembers.keys()];if(!t&&Ne(n,r)&&Ne(i,o))return this.path;const{enter:a=[],exit:s=[]}=Ah(r,n,(t=>t)),{enter:l=[],exit:u=[]}=Ah(o,i,(t=>t));t&&(s.push(t),a.push(t));const c=(t,n,r)=>{t.forEach((t=>{const i=r?this.members:this.avoidMembers,o=r?"pushMember":"pushNonMember",a=r?"removeMember":"removeNonMember";if(n){let n;"edge"===e.getElementType(t)?([n]=HB(e,t),this.bubbleSets.pushEdge(n)):([n]=WB(e,t),this.bubbleSets[o](n)),i.set(t,n)}else{const n=i.get(t);n&&("edge"===e.getElementType(t)?this.bubbleSets.removeEdge(n):this.bubbleSets[a](n),i.delete(t))}}))};c(s,!1,!0),c(a,!0,!0),c(u,!1,!1),c(l,!0,!1);const h=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=qd(h.points.map(nd)),this.path},this.bindEvents(),this.bubbleSets=new GB(this.options)}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new GB(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const t=this.options,{type:e,key:n,members:r,avoidMembers:i}=t,o=Fe(t,["type","key","members","avoidMembers"]),a=Object.keys(o).reduce(((t,e)=>(e in jB?t.bubbleSetOptions[e]=o[e]:t.style[e]=o[e],t)),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:r,avoidMembers:i},a)}addMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.avoidMembers.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t)))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),this.drawBubbleSets()}updateMember(t){this.options.members=Ut(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.members.includes(t)))&&(this.options.members=this.options.members.filter((t=>!e.includes(t)))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some((t=>e.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t))),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}VB.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},jB);const WB=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getElementRenderBounds(e);return new xB(n.min[0],n.min[1],qc(n),Xc(n))})),HB=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getEdgeData(e),r=t.getElementPosition(n.source),i=t.getElementPosition(n.target);return cB.from({x1:r[0],y1:r[1],x2:i[0],y2:i[1]})}));class UB extends nB{constructor(t,e){super(t,Object.assign({},UB.defaultOptions,e)),this.targetElement=null,this.onTriggerEvent=t=>{var e;null===(e=t.preventDefault)||void 0===e||e.call(t),this.show(t)},this.onMenuItemClick=t=>{const{onClick:e,trigger:n}=this.options;if(t.target instanceof HTMLElement&&t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");null==e||e(n,t.target,this.targetElement),this.hide()}"click"!==n&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=rB("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t);this.context.canvas.getContainer().appendChild(this.$element),iB("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow: hidden;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head)}show(t){return ze(this,void 0,void 0,(function*(){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hide();const r=yield this.getDOMContent(t);r instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(r)):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-i.left+n[0]}px`,this.$element.style.top=`${t.client.y-i.top+n[1]}px`,this.$element.style.display="block",this.targetElement=t.target}))}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return ze(this,void 0,void 0,(function*(){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(yield n(t)).map((t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`)).join("")}\n </ul>\n `:yield e(t)}))}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}}UB.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class YB extends nB{constructor(t,e){super(t,Object.assign({},YB.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:t,element:e}=this.context,n=t.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:r,iterRate:i,divRate:o}=this.options;let{lambda:a,divisions:s,iterations:l}=this.options;for(let t=0;t<r;t++){for(let t=0;t<l;t++){const t={};n.forEach((e=>{var n;if(e.source===e.target)return;const r=bh(e);t[r]=this.getEdgeForces(e,s,a);for(let e=0;e<s+1;e++)(n=this.edgePoints)[r]||(n[r]=[]),this.edgePoints[r][e]=jh(this.edgePoints[r][e],t[r][e])}))}a/=2,s*=o,l*=i,this.divideEdges(s)}n.forEach((t=>{const n=bh(t),r=e.getElement(n);null==r||r.update({d:Zp(this.edgePoints[n])})}))},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map((t=>[bh(t),$h(Jh(t))])))}divideEdges(t){this.context.model.getEdgeData().forEach((e=>{var n;const r=bh(e);(n=this.edgePoints)[r]||(n[r]=[]);const i=this.nodeMap[e.source],o=this.nodeMap[e.target];if(1===t)this.edgePoints[r].push(i),this.edgePoints[r].push(zh(jh(i,o),2)),this.edgePoints[r].push(o);else{const e=(0===this.edgePoints[r].length?Vh(i,o):JB(this.edgePoints[r]))/(t+1);let n=e;const a=[i];for(let t=1;t<this.edgePoints[r].length;t++){const i=this.edgePoints[r][t-1],o=this.edgePoints[r][t];let s=Vh(o,i);for(;s>n;){const t=n/s,r=jh(i,Fh(Bh(o,i),t));a.push(r),s-=n,n=e}n-=s}a.push(o),this.edgePoints[r]=a}}))}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[r,i]=Bh(n,e);return{source:e,target:n,vx:r,vy:i,length:Vh(e,n)}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),r=this.getVectorPosition(e);return $B(n,r)*qB(n,r)*XB(n,r)*QB(n,r)}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach(((r,i)=>{n.forEach(((n,o)=>{var a,s;if(o<=i)return;this.measureEdgeCompatibility(r,n)>=e&&(t[a=bh(r)]||(t[a]=[]),t[bh(r)].push(n),t[s=bh(n)]||(t[s]=[]),t[bh(n)].push(r))}))})),t}getSpringForce(t,e){const{pre:n,cur:r,next:i}=t;return Fh(Bh(jh(n,i),Fh(r,2)),e)}getElectrostaticForce(t,e){Se(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[bh(e)];let r=[0,0];return null==n||n.forEach((n=>{const i=this.edgePoints[bh(n)][t],o=this.edgePoints[bh(e)][t],a=Bh(i,o),s=Vh(i,o);r=jh(r,Fh(a,1/s))})),r}getEdgeForces(t,e,n){const r=this.nodeMap[t.source],i=this.nodeMap[t.target],o=this.options.K/(Vh(r,i)*(e+1)),a=[[0,0]],s=bh(t);for(let r=1;r<e;r++){const e=this.getSpringForce({pre:this.edgePoints[s][r-1],cur:this.edgePoints[s][r],next:this.edgePoints[s][r+1]||[0,0]},o),i=this.getElectrostaticForce(r,t);a.push(Fh(jh(e,i),n))}return a.push([0,0]),a}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}YB.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const $B=(t,e)=>Math.abs(function(t,e){return t.reduce(((t,n,r)=>t+n*e[r]),0)}([t.vx,t.vy],[e.vx,e.vy])/(t.length*e.length)),qB=(t,e)=>{const n=(t.length+e.length)/2;return 2/(n/Math.min(t.length,e.length)+Math.max(t.length,e.length)/n)},XB=(t,e)=>{const n=(t.length+e.length)/2;return n/(n+Vh(zh(jh(t.source,t.target),2),zh(jh(e.source,e.target),2)))},KB=(t,e)=>{if(e.source[0]===e.target[0])return[e.source[0],t[1]];if(e.source[1]===e.target[1])return[t[0],e.source[1]];const n=(e.source[1]-e.target[1])/(e.source[0]-e.target[0]),r=(n*n*e.source[0]+n*(t[1]-e.source[1])+t[0])/(n*n+1);return[r,n*(r-e.source[0])+e.source[1]]},ZB=(t,e)=>{const n=KB(e.source,t),r=KB(e.target,t),i=zh(jh(n,r),2),o=zh(jh(t.source,t.target),2);return 0===Vh(n,r)?0:Math.max(0,1-2*Vh(o,i)/Vh(n,r))},QB=(t,e)=>Math.min(ZB(t,e),ZB(e,t)),JB=t=>{let e=0;for(let n=1;n<t.length;n++)e+=Vh(t[n],t[n-1]);return e},tF={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0};class eF extends nB{constructor(t,e){super(t,Object.assign({},eF.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=nd(t.canvas);this.renderLens(e),this.renderFocusElements()},this.renderLens=t=>{const e=Object.assign({},tF,this.options.style);this.isLensOn||(this.lens=new of({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,rd(t),{size:2*this.r}),this.lens.update(e)},this.getFilterData=()=>{const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:r,edges:i,combos:o}=n;return{nodes:r.filter((e=>t(bh(e),"node"))),edges:i.filter((e=>t(bh(e),"edge"))),combos:o.filter((e=>t(bh(e),"combo")))}},this.getFocusElements=t=>{const{nodes:e,edges:n}=this.getFilterData(),r=e.filter((e=>Vh(Jh(e),t)<this.r)),i=r.map((t=>bh(t)));return{nodes:r,edges:n.filter((t=>{const{source:e,target:n}=t,r=i.includes(e),o=i.includes(n);switch(this.options.nodeType){case"both":return r&&o;case"either":return r!==o;case"source":return r&&!o;case"target":return!r&&o;default:return!1}}))}},this.renderFocusElements=()=>{const{element:t,graph:e}=this.context;if(!this.isLensOn)return;const n=this.lens.getCenter(),{nodes:r,edges:i}=this.getFocusElements(n),o=new Set,a=n=>{const r=bh(n);o.add(r);const i=t.getElement(r);if(!i)return;const a=this.shapes.get(r)||i.cloneNode();a.setPosition(i.getPosition()),a.id=i.id,this.shapes.has(r)?Object.entries(i.attributes).forEach((([t,e])=>{a.style[t]!==e&&(a.style[t]=e)})):(this.canvas.appendChild(a),this.shapes.set(r,a));const s=e.getElementType(r),l=this.getElementStyle(s,n);a.update(l)};r.forEach(a),i.forEach(a),this.shapes.forEach(((t,e)=>{o.has(e)||(t.destroy(),this.shapes.delete(e))}))},this.scaleRByWheel=t=>{var e;this.options.preventDefault&&t.preventDefault();const{clientX:n,clientY:r,deltaX:i,deltaY:o}=t,{graph:a,canvas:s}=this.context,l=a.getCanvasByClient([n,r]),u=null===(e=this.lens)||void 0===e?void 0:e.getCenter();if(!this.isLensOn||Vh(l,u)>this.r)return;const{maxR:c,minR:h}=this.options,d=i+o>0?1/.95:.95,f=Math.min(...s.getSize())/2;this.r=Math.max(h||0,Math.min(c||f,this.r*d)),this.renderLens(u),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=t=>{var e;const n=nd(t.canvas),r=null===(e=this.lens)||void 0===e?void 0:e.getCenter();!this.isLensOn||Vh(n,r)>this.r||(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=nd(t.canvas);this.renderLens(e),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n="node"===t?this.options.nodeStyle:this.options.edgeStyle;return"function"==typeof n?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.addEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.addEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.addEventListener(t.CommonEvent.DRAG,this.onDrag),o.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.removeEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.removeEventListener(t.CommonEvent.DRAG,this.onDrag),o.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel))}update(t){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()}}eF.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const nF={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12};class rF extends nB{constructor(t,e){super(t,Object.assign({},rF.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=nd(t.canvas);this.onMagnify(e)},this.onMagnify=t=>{t.some(isNaN)||(this.renderLens(t),this.renderFocusElements())},this.renderLens=t=>{const e=Object.assign({},nF,this.options.style);this.isLensOn||(this.lens=new of({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,rd(t),{size:2*this.r,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(e)},this.getDPercent=()=>{const{minD:t,maxD:e}=this.options;return`${Math.round((this.d-t)/(e-t)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:t}=this.context,e=this.lens.getCenter(),n=(this.d+1)*this.r,r=new Map,i=new Map;t.getNodeData().forEach((o=>{const a=Jh(o),s=Vh(a,e);if(s>this.r)return;const l=n*s/(this.d*s+this.r),[u,c]=a,[h,d]=e,f=[h+l*((u-h)/s),d+l*((c-d)/s)],p=bh(o),g=this.getNodeStyle(o),v=Ae(t.getElementRenderStyle(p),Object.keys(g));r.set(p,Object.assign(Object.assign({},rd(f)),g)),i.set(p,Object.assign(Object.assign({},rd(a)),v))})),this.updateStyle(r,i)},this.getNodeStyle=t=>{const{nodeStyle:e}=this.options;return"function"==typeof e?e(t):e},this.updateStyle=(t,e)=>{const{graph:n,element:r}=this.context,{enter:i,exit:o,keep:a}=Ah(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(t.keys()),(t=>t)),s=new Set,l=(t,e)=>{const i=r.getElement(t);null==i||i.update(e),n.getRelatedEdgesData(t).forEach((t=>{s.add(bh(t))}))};[...i,...a].forEach((e=>{l(e,t.get(e))})),o.forEach((t=>{l(t,this.prevOriginStyleMap.get(t)),this.prevOriginStyleMap.delete(t)})),s.forEach((t=>{const e=r.getElement(t);null==e||e.update({})})),this.prevMagnifiedStyleMap=t,e.forEach(((t,e)=>{this.prevOriginStyleMap.has(e)||this.prevOriginStyleMap.set(e,t)}))},this.isWheelValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;const{clientX:e,clientY:n}=t;return!(Vh(this.context.graph.getCanvasByClient([e,n]),this.lens.getCenter())>this.r)},this.scaleR=t=>{const{maxR:e,minR:n}=this.options,r=t?1/.95:.95,i=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(n||0,Math.min(e||i,this.r*r))},this.scaleD=t=>{const{maxD:e,minD:n}=this.options,r=t?this.d+.1:this.d-.1;this.d=Math.max(n,Math.min(e,r))},this.scaleRByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleR(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleD(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.isDragValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;return!(Vh(nd(t.canvas),this.lens.getCenter())>this.r)},this.isLensDragging=!1,this.onDragStart=t=>{this.isDragValid(t)&&(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=nd(t.canvas);this.onMagnify(e)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleR(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleD(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,a=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&a.addEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&a.addEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){a.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),a.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;a.addEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,n,{passive:!1})}}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,a=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&a.removeEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&a.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){a.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),a.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;a.removeEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,n)}}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&(null===(t=this.lens)||void 0===t||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}rF.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class iF extends nB{constructor(t,e){super(t,Object.assign({},iF.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var t,e,n,r;const i=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(i),i?null===(e=(t=this.options).onEnter)||void 0===e||e.call(t):null===(r=(n=this.options).onExit)||void 0===r||r.call(n)},this.shortcut=new vd(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML="\n :not(:root):fullscreen::backdrop {\n background: transparent;\n }\n "}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit);["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.addEventListener(t,this.onFullscreenChange,!1)}))}unbindEvents(){this.shortcut.unbindAll();["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.removeEventListener(t,this.onFullscreenChange,!1)}))}setGraphSize(t=!0){var e,n;let r,i;t?(r=(null===(e=globalThis.screen)||void 0===e?void 0:e.width)||0,i=(null===(n=globalThis.screen)||void 0===n?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[r,i]=this.graphSize,this.context.graph.setSize(r,i),this.context.graph.render()}request(){!document.fullscreenElement&&(document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled"))&&this.$el.requestFullscreen().catch((t=>{Cc(`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()}}iF.defaultOptions={trigger:{},autoFit:!0};class oF extends nB{constructor(t,e){super(t,Object.assign({},oF.defaultOptions,e)),this.$element=rB("grid-line",!0),this.offset=[0,0],this.onTransform=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)};this.context.canvas.getContainer().prepend(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:r,borderLineWidth:i,borderStroke:o,borderStyle:a}=this.options;Object.assign(this.$element.style,{border:r?`${i}px ${a} ${o}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`})}updateOffset(t){this.offset=function(t,e){return t.map((t=>t%e))}(jh(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}function aF(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach((t=>{const{type:n,value:r}=t,i=bh(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Removed.has(i)||e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)?e.Added.delete(i):e.Updated.has(i)?(e.Updated.delete(i),e.Removed.set(i,t)):e.Removed.set(i,t))})),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}function sF(t){const{NodeAdded:e=[],NodeUpdated:n=[],NodeRemoved:r=[],EdgeAdded:i=[],EdgeUpdated:o=[],EdgeRemoved:a=[],ComboAdded:s=[],ComboUpdated:l=[],ComboRemoved:u=[]}=ie(t,(t=>t.type));return{add:{nodes:e,edges:i,combos:s},update:{nodes:n,edges:o,combos:l},remove:{nodes:r,edges:a,combos:u}}}function lF(t,e){for(const n in t)qt(t[n])&&!Array.isArray(t[n])&&null!==t[n]?(e[n]||(e[n]={}),lF(t[n],e[n])):void 0===e[n]&&(e[n]=Dc(n))}function uF(t,e=!1,n){const r={animation:e,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:o,remove:a}=sF(aF(t));return["nodes","edges","combos"].forEach((t=>{o[t]&&o[t].forEach((e=>{var i,o;const a=Object.assign({},e.value);let s=Object.assign({},e.original);if(n){const t=n.graph.getElementType(bh(e.original)),r="edge"===t?"stroke":"fill",i=n.element.getElementComputedStyle(t,e.original);s=Object.assign(Object.assign({},e.original),{style:Object.assign({[r]:i[r]},e.original.style)})}lF(a,s),(i=r.current.update)[t]||(i[t]=[]),r.current.update[t].push(a),(o=r.original.update)[t]||(o[t]=[]),r.original.update[t].push(s)})),i[t]&&i[t].forEach((e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.add)[t]||(n[t]=[]),r.current.add[t].push(o),(i=r.original.remove)[t]||(i[t]=[]),r.original.remove[t].push(o)})),a[t]&&a[t].forEach((e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.remove)[t]||(n[t]=[]),r.current.remove[t].push(o),(i=r.original.add)[t]||(i[t]=[]),r.original.add[t].push(o)}))})),r}oF.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};class cF extends nB{constructor(e,n){super(e,Object.assign({},cF.defaultOptions,n)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(t,e=!0)=>{var n,r,i;this.freezed=!0,null===(r=(n=this.options).executeCommand)||void 0===r||r.call(n,t);const o=e?t.original:t.current;this.context.graph.addData(o.add),this.context.graph.updateData(o.update),this.context.graph.removeData(Eh(o.remove,!1)),null===(i=this.context.element)||void 0===i||i.draw({silence:!0,animation:t.animation}),this.freezed=!1},this.addCommand=e=>{var n;if(!this.freezed){if(e.type===t.GraphEvent.AFTER_DRAW){const{dataChanges:t=[],animation:r=!0}=e.data;if(null===(n=this.context.batch)||void 0===n?void 0:n.isBatching){if(!this.batchChanges)return;return this.batchChanges.push(t),void(this.batchAnimation&&(this.batchAnimation=r))}this.batchChanges=[t],this.batchAnimation=r}this.undoStackPush(uF(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(t.HistoryEvent.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=t=>{const{initiate:e}=t.data;if(this.batchAnimation=!1,e)this.batchChanges=[];else{this.undoStack.pop()||(this.batchChanges=null)}},this.emitter=new Wg;const{graph:r}=this.context;r.on(t.GraphEvent.AFTER_DRAW,this.addCommand),r.on(t.GraphEvent.BATCH_START,this.initBatchCommand),r.on(t.GraphEvent.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var e,n,r,i;const o=this.undoStack.pop();if(o){this.executeCommand(o);if(!1===(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,o,!1)))return;this.redoStack.push(o),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,o,!1),this.notify(t.HistoryEvent.UNDO,o)}return this}redo(){const e=this.redoStack.pop();return e&&(this.executeCommand(e,!1),this.undoStackPush(e),this.notify(t.HistoryEvent.REDO,e)),this}undoAndCancel(){const e=this.undoStack.pop();return e&&(this.executeCommand(e,!1),this.redoStack=[],this.notify(t.HistoryEvent.CANCEL,e)),this}undoStackPush(t){var e,n,r,i;const{stackSize:o}=this.options;0!==o&&this.undoStack.length>=o&&this.undoStack.shift();!1!==(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,t,!0))&&(this.undoStack.push(t),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(t.HistoryEvent.CLEAR,null)}notify(e,n){this.emitter.emit(e,{cmd:n}),this.emitter.emit(t.HistoryEvent.CHANGE,{cmd:n})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.addCommand),e.off(t.GraphEvent.BATCH_START,this.initBatchCommand),e.off(t.GraphEvent.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}function hF(t,e,n,r,i,o){const a=(o-e)*(n-t)-(r-e)*(i-t);return a>0||!(a<0)}cF.defaultOptions={stackSize:0};var dF=function(t,e){const n=t[0][0],r=t[0][1],i=t[1][0],o=t[1][1],a=e[0][0],s=e[0][1],l=e[1][0],u=e[1][1];return hF(n,r,a,s,l,u)!==hF(i,o,a,s,l,u)&&hF(n,r,i,o,a,s)!==hF(n,r,i,o,l,u)};function fF(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(let e=0;e<t.length;e++){const n=t[e],r=this.coordToCellNum(n[0]),i=this.coordToCellNum(n[1]);if(this._cells[r])this._cells[r][i]?this._cells[r][i].push(n):this._cells[r][i]=[n];else{const t=[];t[i]=[n],this._cells[r]=t}}}function pF(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}fF.prototype={cellPoints:function(t,e){return void 0!==this._cells[t]&&void 0!==this._cells[t][e]?this._cells[t][e]:[]},rangePoints:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this.coordToCellNum(t[2]),i=this.coordToCellNum(t[3]),o=[];for(let t=e;t<=r;t++)for(let e=n;e<=i;e++)for(let n=0;n<this.cellPoints(t,e).length;n++)o.push(this.cellPoints(t,e)[n]);return o},removePoint:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this._cells[e][n];let i;for(let e=0;e<r.length;e++)if(r[e][0]===t[0]&&r[e][1]===t[1]){i=e;break}return r.splice(i,1),r},trunc:Math.trunc||function(t){return t-t%1},coordToCellNum:function(t){return this.trunc(t*this._reverseCellSize)},extendBbox:function(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}};var gF=function(t){const e=function(t){const e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&pF(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}(t),n=function(t){const e=t.reverse(),n=[];for(let t=0;t<e.length;t++){for(;n.length>=2&&pF(n[n.length-2],n[n.length-1],e[t])<=0;)n.pop();n.push(e[t])}return n.pop(),n}(t),r=n.concat(e);return r.push(t[0]),r};const vF=dF,mF=function(t,e){return new fF(t,e)},yF={toXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","return [pt"+e[0]+",pt"+e[1]+"];")(t)}))},fromXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","const o = {}; o"+e[0]+"= pt[0]; o"+e[1]+"= pt[1]; return o;")(t)}))}},bF=gF;function xF(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function EF(t,e,n){const r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],o=xF(t,e),a=xF(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(o*a)}function wF(t,e){for(let n=0;n<e.length-1;n++){const r=[e[n],e[n+1]];if(!(t[0][0]===r[0][0]&&t[0][1]===r[0][1]||t[0][0]===r[1][0]&&t[0][1]===r[1][1])&&vF(t,r))return!0}return!1}function kF(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function MF(t,e,n){let r,i,o=null,a=NF,s=NF;for(let l=0;l<e.length;l++)r=EF(t[0],t[1],e[l]),i=EF(t[1],t[0],e[l]),r>a&&i>s&&!wF([t[0],e[l]],n)&&!wF([t[1],e[l]],n)&&(a=r,s=i,o=e[l]);return o}function SF(t,e,n,r,i){let o=!1;for(let a=0;a<t.length-1;a++){const s=[t[a],t[a+1]],l=s[0][0]+","+s[0][1]+","+s[1][0]+","+s[1][1];if(xF(s[0],s[1])<e||i.has(l))continue;let u,c,h,d=0,f=kF(s);do{f=r.extendBbox(f,d),u=f[2]-f[0],c=f[3]-f[1],h=MF(s,r.rangePoints(f),t),d++}while(null===h&&(n[0]>u||n[1]>c));u>=n[0]&&c>=n[1]&&i.add(l),null!==h&&(t.splice(a+1,0,h),r.removePoint(h),o=!0)}return o?SF(t,e,n,r,i):t}const NF=Math.cos(90/(180/Math.PI)),OF=.6;var TF=function(t,e,n){let r=e||20;const i=function(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];n[0]===i[0]&&n[1]===i[1]||e.push(i),n=i}return e}(function(t){return t.sort((function(t,e){return t[0]-e[0]||t[1]-e[1]}))}(yF.toXy(t,n)));if(i.length<4){const t=i.concat([i[0]]);return n?yF.fromXy(t,n):t}const o=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<n&&(n=t[o][1]),t[o][0]>r&&(r=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[r-e,i-n]}(i),a=[o[0]*OF,o[1]*OF],s=bF(i),l=i.filter((function(t){return s.indexOf(t)<0})),u=Math.ceil(1/(i.length/(o[0]*o[1]))),c=SF(s,Math.pow(r,2),a,mF(l,u),new Set);return n?yF.fromXy(c,n):c},CF=E(TF);const AF=(t,e,n)=>{if("sharp"===n)return[["M",t[0]-e,t[1]-e],["L",t[0]+e,t[1]-e],["L",t[0]+e,t[1]+e],["L",t[0]-e,t[1]+e],["Z"]];const r=[e,e,0,0,0];return[["M",t[0],t[1]-e],["A",...r,t[0],t[1]+e],["A",...r,t[0],t[1]-e]]},PF=(t,e,n)=>{const r=[e,e,0,0,0],i="sharp"===n?jh(t[0],Gh(Hh(Bh(t[0],t[1])),e)):t[0],o="sharp"===n?jh(t[1],Gh(Hh(Bh(t[1],t[0])),e)):t[1],a=Gh(Hh(Yh(Bh(i,o),!1)),e),s=Gh(a,-1),l=jh(i,a),u=jh(o,a),c=jh(o,s),h=jh(i,s);return"sharp"===n?[["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",...r,c[0],c[1]],["L",h[0],h[1]],["A",...r,l[0],l[1]]]},RF=(t,e)=>{const n=fd(t).map(((n,r)=>{const i=(r-2+t.length)%t.length,o=(r-1+t.length)%t.length,a=(r+1)%t.length,s=t[i],l=t[o],u=t[a],c=Bh(s,l),h=Bh(l,n),d=Bh(n,u),f=(t,e)=>Uh(t,e,!0)<Math.PI,p=f(c,h),g=f(h,d),v=t=>Gh(Hh(Yh(t,!1)),e),m=v(h);return[{p:$h(jh(l,p?v(c):m)),concave:p&&l},{p:$h(jh(n,g?v(d):m)),concave:g&&n}]})),r=[e,e,0,0,0],i=n.findIndex(((t,e)=>!(n[(e-1+n.length)%n.length][0].concave||n[(e-1+n.length)%n.length][1].concave||t[0].concave||t[0].concave||t[1].concave))),o=n.slice(i).concat(n.slice(0,i));let a=[];return o.flatMap(((t,e)=>{const i=[],s=o[n.length-1];return 0===e&&i.push(["M",...s[1].p]),t[0].concave?a.push(t[0].p,t[1].p):i.push(["A",...r,...t[0].p]),t[1].concave?a.unshift(t[1].p):i.push(["L",...t[1].p]),3===a.length&&(i.pop(),i.push(["C",...a.flat()]),a=[]),i}))},DF=(t,e)=>{const n=fd(t).map(((e,n)=>({p:e,v:Hh(Bh(t[(n+1)%t.length],e))})));return n.forEach(((r,i)=>{const o=i>0?i-1:t.length-1,a=n[o].v,s=Hh(jh(a,Gh(r.v,Uh(a,r.v,!0)<Math.PI?1:-1)));r.p=jh(r.p,Gh(s,e))})),qd(n.map((t=>t.p)))},LF=(t,e)=>{const n=t.map(((n,r)=>{const i=t[0===r?t.length-1:r-1],o=qh(Gh(Hh(Yh(Bh(i,n),!1)),e));return[jh(i,o),jh(n,o)]})),r=n.flat();return r.map(((t,e)=>{if(e%2==0)return null;return Zh([r[(e-1)%r.length],r[e%r.length]],[r[(e+1)%r.length],r[(e+2)%r.length]],!0)})).filter(Boolean).map(((t,e)=>[0===e?"M":"L",t[0],t[1]])).concat([["Z"]])};class _F extends nB{constructor(t,e){super(t,Object.assign({},_F.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(this.shape){const t=!Ne(this.optionsCache,this.options);this.shape.update(this.getHullStyle(t))}else this.shape=new Xd({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);this.optionsCache=Object.assign({},this.options)},this.updateHullPath=t=>{this.shape&&this.options.members.includes(bh(t.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(t=!1)=>{const{graph:e}=this.context,n=this.getMember();if(0===n.length)return"";const r=n.map((t=>e.getNodeData(t))),i=CF(r.map(Jh),this.options.concavity).slice(1).reverse(),o=i.flatMap((t=>r.filter((e=>Ne(Jh(e),t))).map(bh)));return Ne(o,this.hullMemberIds)&&!t||(this.hullMemberIds=o,this.path=function(t,e,n){if(1===t.length)return AF(t[0],e,n);if(2===t.length)return PF(t,e,n);if(3===t.length){const[r,i,o]=fd(t);if(sd(r,i,o))return PF([r,o],e,n)}switch(n){case"smooth":return DF(t,e);case"sharp":return LF(t,e);default:return RF(t,e)}}(i,this.getPadding(),this.options.corner)),this.path},this.bindEvents()}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=Fe(this.options,["members","padding","corner"]);return Object.assign(Object.assign({},e),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context,e=this.hullMemberIds.reduce(((e,n)=>{const{halfExtents:r}=t.getElementRenderBounds(n),i=Math.max(r[0],r[1]);return Math.max(e,i)}),0);return e+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),e.some((t=>this.hullMemberIds.includes(t)))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Ut(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}function IF(t,e){e(t),t.children&&t.children.forEach((function(t){t&&IF(t,e)}))}function jF(t){FF(t,!0)}function BF(t){FF(t,!1)}function FF(t,e){var n=e?"visible":"hidden";IF(t,(function(t){t.attr("visibility",n)}))}_F.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};var zF=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,We([],Ve(e),!1))||this;return r.isMutationObserved=!0,r.addEventListener(Ws.INSERTED,(function(){BF(r)})),r}return je(e,t),e}(Bl);function GF(t){var e=t.appendChild(new zF({class:"offscreen"}));return BF(e),e}var VF=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=Fe(e,["style"]);return t.call(this,Be({style:Be({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return je(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=GF(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(Ql);function WF(t){return t*Math.PI/180}function HF(t){return Number((180*t/Math.PI).toPrecision(5))}var UF=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();function YF(t,e){return Ut(t)?t.apply(void 0,We([],Ve(e),!1)):t}var $F,qF=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map((function(t){var e=Ve(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]})));return Object.assign(r,{prefix:n}),r},XF=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach((function(i){var o=Ve(i,2),a=o[0],s=o[1],l=t;Object.prototype.hasOwnProperty.call(e,a)&&(s?Jt(s)?(Jt(t[a])||(l[a]={}),n<r?XF(t[a],s,n+1,r):l[a]=e[a]):$t(s)?(l[a]=[],l[a]=l[a].concat(s)):l[a]=s:l[a]=s)}))},KF=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)XF(t,e[r]);return t},ZF=function(t){return void 0!==t&&null!=t&&!Number.isNaN(t)},QF=xe((function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return $F||($F=xl.offscreenCanvasCreator.getOrCreateContext(void 0)),$F.font=[o,a,i,"".concat(n,"px"),r].join(" "),$F.measureText(t).width}),(function(t,e){return[t,Object.values(e||JF(t)).join()].join("")}),4096),JF=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function tz(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}function ez(t,e){var n=tz(t);n&&n.attr(e)}function nz(t,e,n){void 0===n&&(n="..."),ez(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function rz(t){var e=t.canvas,n=t.touches,r=t.offsetX,i=t.offsetY;if(e)return[e.x,e.y];if(n){var o=n[0];return[o.clientX,o.clientY]}return r&&i?[r,i]:[0,0]}function iz(t){return"function"==typeof t?t():ne(t)||ae(t)?new VF({style:{text:String(t)}}):t}function oz(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function az(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=!1),!!(r&&t===e||i&&t===n)||t>e&&t<n}function sz(t,e){return"number"==typeof t&&"number"==typeof e?function(t,e){return function(n){return t*(1-n)+e*n}}(t,e):Array.isArray(t)&&Array.isArray(e)?function(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0;return function(i){var o=new Array(r),a=new Array(n),s=0;for(s=0;s<r;++s)o[s]=sz(t[s],e[s]);for(;s<n;++s)a[s]=e[s];for(s=0;s<r;++s)a[s]=o[s](i);return a}}(t,e):"object"==typeof t&&"object"==typeof e?function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n={},r={};return Object.entries(e).forEach((function(e){var i=Ve(e,2),o=i[0],a=i[1];o in t?n[o]=sz(t[o],a):r[o]=a})),function(t){return Object.entries(n).forEach((function(e){var n=Ve(e,2),i=n[0],o=n[1];return r[i]=o(t)})),r}}(t,e):function(e){return t}}function lz(t,e){return[t[0]*e,t[1]*e]}function uz(t,e){return[t[0]+e[0],t[1]+e[1]]}function cz(t,e){return[t[0]-e[0],t[1]-e[1]]}function hz(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1])]}function dz(t,e){return[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}function fz(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function pz(t){if(0===t[0]&&0===t[1])return[0,0];var e=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2));return[t[0]/e,t[1]/e]}function gz(t,e){return+t.toPrecision(e)}function vz(t,e){var n={},r=Array.isArray(e)?e:[e];for(var i in t)r.includes(i)||(n[i]=t[i]);return n}function mz(t,e,n){void 0===n&&(n=[[0,0],[1,1]]);for(var r=!!e,i=[],o=0,a=t.length;o<a;o+=2)i.push([t[o],t[o+1]]);var s,l,u,c=function(t,e,n,r){var i,o,a,s,l,u,c=[],h=!!r,d=[1/0,1/0],f=[-1/0,-1/0];if(h){d=(i=Ve(r,2))[0],f=i[1];for(var p=0,g=t.length;p<g;p+=1)d=hz(d,m=t[p]),f=dz(f,m)}p=0;for(var v=t.length;p<v;p+=1){var m=t[p];if(0!==p||n)if(p!==v-1||n){o=t[p-1];var y=[0,0];y=lz(y=cz(a=t[p+1],o),e);var b=fz(m,o),x=fz(m,a),E=b+x;0!==E&&(b/=E,x/=E);var w=lz(y,-b),k=lz(y,x);l=uz(m,w),s=hz(s=uz(m,k),dz(a,m)),s=dz(s,hz(a,m)),l=hz(l=uz(m,w=lz(w=cz(s,m),-b/x)),dz(o,m)),s=uz(m,k=lz(k=cz(m,l=dz(l,hz(o,m))),x/b)),h&&(l=hz(l=dz(l,d),f),s=hz(s=dz(s,d),f)),c.push(u),c.push(l),u=s}else l=m,c.push(u),c.push(l);else u=m}return c}(i,.4,r,n),h=i.length,d=[];for(o=0;o<h-1;o+=1)s=c[2*o],l=c[2*o+1],u=i[o+1],d.push(["C",s[0],s[1],l[0],l[1],u[0],u[1]]);return d}var yz=["$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 bz(t){return yz.includes(t)}function xz(t){var e={};for(var n in t)bz(n)&&(e[n]=t[n]);return e}function Ez(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=e/Math.max(i,o);return t.style.transform="scale(".concat(a,")"),a}var wz=function(){function t(t,n,r,i,o,a,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===a&&(a=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=a,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var a=this._data[o],s=Ve(Array.isArray(a)?a:[a,null],2),l=s[0],u=s[1];(h=r(l,o)).__data__=l,null!==u&&(h.__fromElements__=u),this._parent.appendChild(h),i.push(h)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var c=this._elements[o],h=r(l=c.__data__,o);c.appendChild(h),i.push(h)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=He(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=He(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=He(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var a,s,l,u=[],c=[],h=new Set(this._elements),d=[],f=new Set,p=new Map(this._elements.map((function(t,n){return[e(t.__data__,n),t]}))),g=new Map(this._facetElements.map((function(t,n){return[e(t.__data__,n),t]}))),v=(a=this._elements,s=function(t){return r(t.__data__)},l=new Map,a.forEach((function(t){var e=s(t);l.has(e)||l.set(e,[]),l.get(e).push(t)})),l),m=0;m<t.length;m++){var y=t[m],b=e(y,m),x=r(y,m);if(p.has(b))(M=p.get(b)).__data__=y,M.__facet__=!1,c.push(M),h.delete(M),p.delete(b);else if(g.has(b)){(M=g.get(b)).__data__=y,M.__facet__=!0,c.push(M),g.delete(b)}else if(v.has(b)){var E=v.get(b);d.push([y,E]);try{for(var w=(i=void 0,Ge(E)),k=w.next();!k.done;k=w.next()){var M=k.value;h.delete(M)}}catch(t){i={error:t}}finally{try{k&&!k.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}v.delete(b)}else if(p.has(x)){(M=p.get(x)).__toData__?M.__toData__.push(y):M.__toData__=[y],f.add(M),h.delete(M)}else u.push(y)}var S=[new n([],u,this._parent,this._document),new n(c,null,this._parent,this._document),new n(h,null,this._parent,this._document),new n([],d,this._parent,this._document),new n(f,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,S)},t.prototype.merge=function(t){var e=We(We([],Ve(this._elements),!1),Ve(t._elements),!1),r=We(We([],Ve(this._transitions),!1),Ve(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),a=e(this._update),s=n(this._exit),l=r(this._merge),u=i(this._split);return a.merge(o).merge(s).merge(l).merge(u)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then((function(){return n.remove()})):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each((function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))}))},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each((function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))}))},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each((function(n,r){var i=this;Object.entries(t).forEach((function(t){var o=Ve(t,2),a=o[0],s=o[1],l="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(a,l.call(i,n,r))}))}))},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.transition=function(t){var e=this._transitions;return this.each((function(n,r){e[r]=t.call(this,n,r)}))},t.prototype.on=function(t,e){return this.each((function(){this.addEventListener(t,e)})),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,We([this._parent,this],Ve(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter((function(t){return!!t}))},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:Bl,rect:Kl,circle:Ll,path:Ul,text:VF,ellipse:jl,image:Gl,line:Wl,polygon:$l,polyline:Xl,html:zl},t}();function kz(t){return new wz([t],null,t,t.ownerDocument)}function Mz(t){if(ae(t))return[t,t,t,t];if($t(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function Sz(t){var e=t.getLocalBounds(),n=Ve([e.min,e.max],2),r=Ve(n[0],2),i=r[0],o=r[1],a=Ve(n[1],2),s=a[0],l=a[1];return{x:i,y:o,width:s-i,height:l-o,left:i,bottom:l,top:o,right:s}}function Nz(t,e){var n=Ve(t,2),r=n[0],i=n[1],o=Ve(e,2),a=o[0],s=o[1];return r!==a&&i===s}function Oz(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Tz(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var Cz=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function Az(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach((function(t){var i=Ve(t,2),o=i[0],a=i[1];if("className"===o||"class"===o);else if(Cz(o,"show")&&Cz(Tz(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(Oz(t))}(e,"show")?r[o]=a:r[o.replace(new RegExp(Oz(e)),"")]=a;else if(!Cz(o,"show")&&Cz(o,e)!==n){var s=Tz(o,e);"filter"===s&&"function"==typeof a||(r[s]=a)}})),r}function Pz(t,e){return Object.entries(t).reduce((function(t,n){var r=Ve(n,2),i=r[0],o=r[1];return i.startsWith("show")?t["show".concat(e).concat(i.slice(4))]=o:t["".concat(e).concat(Oz(i))]=o,t}),{})}function Rz(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach((function(t){var o=Ve(t,2),a=o[0],s=o[1];e.includes(a)||(-1!==n.indexOf(a)?i[a]=s:r[a]=s)})),[r,i]}function Dz(t,e){var n={YYYY:t.getFullYear(),MM:t.getMonth()+1,DD:t.getDate(),HH:t.getHours(),mm:t.getMinutes(),ss:t.getSeconds()},r=e;return Object.keys(n).forEach((function(t){var e=n[t];r=r.replace(t,"YYYY"===t?"".concat(e):"".concat(e).padStart(2,"0"))})),r}function Lz(t,e){if(e)try{var n=e.replace(/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,(function(e,n,r){return"translate(".concat(function(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=Ve([e,n].map((function(t,e){var n;return t.includes("%")?parseFloat((null===(n=t.match(/[+-]?([0-9]*[.])?[0-9]+/))||void 0===n?void 0:n[0])||"0")/100*(0===e?i:o):t})),2);return[a[0],a[1]]}(t,n,r),")")}));t.attr("transform",n)}catch(t){}}var _z=function(t,e){null!=e?t.replaceChildren?Array.isArray(e)?t.replaceChildren.apply(t,We([],Ve(e),!1)):t.replaceChildren(e):(t.innerHTML="",Array.isArray(e)?e.forEach((function(e){return t.appendChild(e)})):t.appendChild(e)):t.innerHTML=""};function Iz(){FF(this,"hidden"!==this.attributes.visibility)}var jz=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,KF({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return je(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=GF(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&Iz.call(this)},e.prototype.update=function(t,e){var n;return this.attr(KF({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,Fe(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}(Il),Bz=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},Fz=Bz,zz=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},Gz=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},Vz=Gz;var Wz=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function Hz(t){var e=function(t){var e="default";if(qt(t)&&t instanceof Image)e="image";else if(Ut(t))e="symbol";else if(ne(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var Uz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.render=function(t,n){var r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o,s=this.getSubShapeStyle(t),l=s.symbol,u=s.size,c=void 0===u?16:u,h=Fe(s,["symbol","size"]),d=Hz(l);oz(!!d,kz(n),(function(t){t.maybeAppendByClassName("marker",d).attr("className","marker ".concat(d,"-marker")).call((function(t){if("image"===d){var n=2*c;t.styles({img:l,width:n,height:n,x:i-c,y:a-c})}else{n=c/2;var r=Ut(l)?l:e.getSymbol(l);t.styles(Be({d:null==r?void 0:r(i,a,n)},h))}}))}))},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(jz);function Yz(t,...e){return e.reduce(((t,e)=>n=>t(e(n))),t)}function $z(t,e){return e-t?n=>(n-t)/(e-t):t=>.5}Uz.registerSymbol("cross",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]})),Uz.registerSymbol("hyphen",(function(t,e,n){return[["M",t-n,e],["L",t+n,e]]})),Uz.registerSymbol("line",zz),Uz.registerSymbol("plus",(function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]})),Uz.registerSymbol("tick",(function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]})),Uz.registerSymbol("circle",Bz),Uz.registerSymbol("point",Fz),Uz.registerSymbol("bowtie",(function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]})),Uz.registerSymbol("hexagon",(function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]})),Uz.registerSymbol("square",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]})),Uz.registerSymbol("diamond",(function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]})),Uz.registerSymbol("triangle",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]})),Uz.registerSymbol("triangle-down",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]})),Uz.registerSymbol("line",zz),Uz.registerSymbol("dot",Gz),Uz.registerSymbol("dash",Vz),Uz.registerSymbol("smooth",(function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]})),Uz.registerSymbol("hv",(function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]})),Uz.registerSymbol("vh",(function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]})),Uz.registerSymbol("hvh",(function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]})),Uz.registerSymbol("vhv",(function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}));const qz=Math.sqrt(50),Xz=Math.sqrt(10),Kz=Math.sqrt(2);function Zz(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/10**i;return i>=0?(o>=qz?10:o>=Xz?5:o>=Kz?2:1)*10**i:-(10**-i)/(o>=qz?10:o>=Xz?5:o>=Kz?2:1)}const Qz=(t,e,n=5)=>{const r=[t,e];let i,o=0,a=r.length-1,s=r[o],l=r[a];return l<s&&([s,l]=[l,s],[o,a]=[a,o]),i=Zz(s,l,n),i>0?(s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i,i=Zz(s,l,n)):i<0&&(s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i,i=Zz(s,l,n)),i>0?(r[o]=Math.floor(s/i)*i,r[a]=Math.ceil(l/i)*i):i<0&&(r[o]=Math.ceil(s*i)/i,r[a]=Math.floor(l*i)/i),r};function Jz(t){return!(ve(t)||(e=t,null===e)||Number.isNaN(t));var e}var tG={exports:{}},eG={exports:{}},nG=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},rG=Array.prototype.concat,iG=Array.prototype.slice,oG=eG.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];nG(i)?e=rG.call(e,iG.call(i)):e.push(i)}return e};oG.wrap=function(t){return function(){return t(oG(arguments))}};var aG=eG.exports,sG={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]},lG=aG,uG=Object.hasOwnProperty,cG=Object.create(null);for(var hG in sG)uG.call(sG,hG)&&(cG[sG[hG]]=hG);var dG=tG.exports={to:{},get:{}};function fG(t,e,n){return Math.min(Math.max(e,t),n)}function pG(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}dG.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=dG.get.hsl(t),n="hsl";break;case"hwb":e=dG.get.hwb(t),n="hwb";break;default:e=dG.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},dG.get.rgb=function(t){if(!t)return null;var e,n,r,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var o=2*n;i[n]=parseInt(e.slice(o,o+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)i[n]=parseInt(e[n]+e[n],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)i[n]=parseInt(e[n+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:uG.call(sG,e[1])?((i=sG[e[1]])[3]=1,i):null:null;for(n=0;n<3;n++)i[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(n=0;n<3;n++)i[n]=fG(i[n],0,255);return i[3]=fG(i[3],0,1),i},dG.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,fG(parseFloat(e[2]),0,100),fG(parseFloat(e[3]),0,100),fG(isNaN(n)?1:n,0,1)]}return null},dG.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,fG(parseFloat(e[2]),0,100),fG(parseFloat(e[3]),0,100),fG(isNaN(n)?1:n,0,1)]}return null},dG.to.hex=function(){var t=lG(arguments);return"#"+pG(t[0])+pG(t[1])+pG(t[2])+(t[3]<1?pG(Math.round(255*t[3])):"")},dG.to.rgb=function(){var t=lG(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},dG.to.rgb.percent=function(){var t=lG(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},dG.to.hsl=function(){var t=lG(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},dG.to.hwb=function(){var t=lG(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},dG.to.keyword=function(t){return cG[t.slice(0,3)]};var gG=E(tG.exports);function vG(t,e,n){let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function mG(t){const e=gG.get(t);if(!e)return null;const{model:n,value:r}=e;return"rgb"===n?r:"hsl"===n?function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100,i=t[3];if(0===n)return[255*r,255*r,255*r,i];const o=r<.5?r*(1+n):r+n-r*n,a=2*r-o;return[255*vG(a,o,e+1/3),255*vG(a,o,e),255*vG(a,o,e-1/3),i]}(r):null}const yG=(t,e)=>n=>t*(1-n)+e*n,bG=(t,e)=>"number"==typeof t&&"number"==typeof e?yG(t,e):"string"==typeof t&&"string"==typeof e?((t,e)=>{const n=mG(t),r=mG(e);return null===n||null===r?n?()=>t:()=>e:t=>{const e=new Array(4);for(let i=0;i<4;i+=1){const o=n[i],a=r[i];e[i]=o*(1-t)+a*t}const[i,o,a,s]=e;return`rgba(${Math.round(i)}, ${Math.round(o)}, ${Math.round(a)}, ${s})`}})(t,e):()=>t,xG=(t,e)=>{const n=yG(t,e);return t=>Math.round(n(t))};function EG({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):n}function wG(t){return"object"==typeof t?t.valueOf():t}class kG extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=wG,null!==t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(EG({map:this.map,initKey:this.initKey},t))}has(t){return super.has(EG({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(function({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(function({map:t,initKey:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}({map:this.map,initKey:this.initKey},t))}}class MG{constructor(t){this.options=ke({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=ke({},this.options,t),this.rescale(t)}rescale(t){}}const SG=Symbol("defaultUnknown");function NG(t,e,n){for(let r=0;r<e.length;r+=1)t.has(e[r])||t.set(n(e[r]),r)}function OG(t){const{value:e,from:n,to:r,mapper:i,notFoundReturn:o}=t;let a=i.get(e);if(void 0===a){if(o!==SG)return o;a=n.push(e)-1,i.set(e,a)}return r[a%r.length]}function TG(t){return t instanceof Date?t=>`${t}`:"object"==typeof t?t=>JSON.stringify(t):t=>t}class CG extends MG{getDefaultOptions(){return{domain:[],range:[],unknown:SG}}constructor(t){super(t)}map(t){return 0===this.domainIndexMap.size&&NG(this.domainIndexMap,this.getDomain(),this.domainKey),OG({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&NG(this.rangeIndexMap,this.getRange(),this.rangeKey),OG({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=TG(e),this.rangeKey=TG(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new CG(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 AG(t){return Math.round(1e12*t)/1e12}function PG(t){const{domain:e,range:n,paddingOuter:r,paddingInner:i,flex:o,round:a,align:s}=t,l=e.length,u=function(t,e){const n=e-t.length;return n>0?[...t,...new Array(n).fill(1)]:n<0?t.slice(0,e):t}(o,l),[c,h]=n,d=h-c,f=d/(2/l*r+1-1/l*i),p=f*i/l,g=f-l*p,v=function(t){const e=Math.min(...t);return t.map((t=>t/e))}(u),m=g/v.reduce(((t,e)=>t+e)),y=new kG(e.map(((t,e)=>{const n=v[e]*m;return[t,a?Math.floor(n):n]}))),b=new kG(e.map(((t,e)=>{const n=v[e]*m+p;return[t,a?Math.floor(n):n]}))),x=Array.from(b.values()).reduce(((t,e)=>t+e)),E=c+(d-(x-x/l*i))*s;let w=a?Math.round(E):E;const k=new Array(l);for(let t=0;t<l;t+=1){k[t]=AG(w);const n=e[t];w+=b.get(n)}return{valueBandWidth:y,valueStep:b,adjustedRange:k}}class RG extends CG{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:SG,flex:[]}}constructor(t){super(t)}clone(){return new RG(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:r,flex:i}=this.options,{adjustedRange:o,valueBandWidth:a,valueStep:s}=function(t){var e;const{domain:n}=t,r=n.length;if(0===r)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(null===(e=t.flex)||void 0===e?void 0:e.length)return PG(t);const{range:i,paddingOuter:o,paddingInner:a,round:s,align:l}=t;let u,c,h=i[0];const d=i[1]-h,f=2*o,p=r-a;u=d/Math.max(1,f+p),s&&(u=Math.floor(u)),h+=(d-u*(r-a))*l,c=u*(1-a),s&&(h=Math.round(h),c=Math.round(c));const g=new Array(r).fill(0).map(((t,e)=>h+e*u));return{valueStep:u,valueBandWidth:c,adjustedRange:g}}({align:t,range:n,round:r,flex:i,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=s,this.valueBandWidth=a,this.adjustedRange=o}}const DG=(t,e,n)=>{let r,i,o=t,a=e;if(o===a&&n>0)return[o];let s=Zz(o,a,n);if(0===s||!Number.isFinite(s))return[];if(s>0){o=Math.ceil(o/s),a=Math.floor(a/s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)*s}else{s=-s,o=Math.ceil(o*s),a=Math.floor(a*s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)/s}return i},LG=(t,e,n)=>{const[r,i]=t,[o,a]=e;let s,l;return r<i?(s=$z(r,i),l=n(o,a)):(s=$z(i,r),l=n(a,o)),Yz(l,s)},_G=(t,e,n)=>{const r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=t[0]>t[r],s=a?[...t].reverse():t,l=a?[...e].reverse():e;for(let t=0;t<r;t+=1)i[t]=$z(s[t],s[t+1]),o[t]=n(l[t],l[t+1]);return e=>{const n=function(t,e,n,r){let i=n||0,o=r||t.length;for(;i<o;){const n=Math.floor((i+o)/2);t[n]>e?o=n:i=n+1}return i}(t,e,1,r)-1,a=i[n];return Yz(o[n],a)(e)}},IG=(t,e,n,r)=>(Math.min(t.length,e.length)>2?_G:LG)(t,e,r?xG:n);class jG extends MG{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:yG,tickCount:5}}map(t){return Jz(t)?this.output(t):this.options.unknown}invert(t){return Jz(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...r]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...r)}getTicks(){const{tickMethod:t}=this.options,[e,n,r,...i]=this.getTickMethodOptions();return t(e,n,r,...i)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return Qz}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,r=this.options.domain.map(t),i=Math.min(r.length,n.length);return e?function(t,e){const n=e<t?e:t,r=t>e?t:e;return t=>Math.min(Math.max(n,t),r)}(r[0],r[i-1]):_e}composeOutput(t,e){const{domain:n,range:r,round:i,interpolate:o}=this.options,a=IG(n.map(t),r,o,i);this.output=Yz(a,e,t)}composeInput(t,e,n){const{domain:r,range:i}=this.options,o=IG(i,r.map(t),yG);this.input=Yz(e,n,o)}}class BG extends jG{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:bG,tickMethod:DG,tickCount:5}}chooseTransforms(){return[_e,_e]}clone(){return new BG(this.options)}}var FG=function(t){function e(e){var n=this,r=e.style,i=Fe(e,["style"]);return(n=t.call(this,ke({},{type:"column"},Be({style:r},i)))||this).columnsGroup=new Bl({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return je(e,t),e.prototype.render=function(){var t=this.attributes,e=t.columns,n=t.x,r=t.y;this.columnsGroup.style.transform="translate(".concat(n,", ").concat(r,")"),kz(this.columnsGroup).selectAll(".column").data(e.flat()).join((function(t){return t.append("rect").attr("className","column").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.update=function(t){this.attr(KF({},this.attributes,t)),this.render()},e.prototype.clear=function(){this.removeChildren()},e}(Dl),zG=function(t){function e(e){var n=this,r=e.style,i=Fe(e,["style"]);return(n=t.call(this,ke({},{type:"lines"},Be({style:r},i)))||this).linesGroup=n.appendChild(new Bl),n.areasGroup=n.appendChild(new Bl),n.render(),n}return je(e,t),e.prototype.render=function(){var t=this.attributes,e=t.lines,n=t.areas,r=t.x,i=t.y;this.style.transform="translate(".concat(r,", ").concat(i,")"),e&&this.renderLines(e),n&&this.renderAreas(n)},e.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},e.prototype.update=function(t){this.attr(KF({},this.attributes,t)),this.render()},e.prototype.renderLines=function(t){kz(this.linesGroup).selectAll(".line").data(t).join((function(t){return t.append("path").attr("className","line").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.renderAreas=function(t){kz(this.linesGroup).selectAll(".area").data(t).join((function(t){return t.append("path").attr("className","area").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.style(t)}))}),(function(t){return t.remove()}))},e}(Dl);function GG(t,e){void 0===e&&(e=!1);var n=e?t.length-1:0,r=t.map((function(t,e){return We([e===n?"M":"L"],Ve(t),!1)}));return e?r.reverse():r}function VG(t,e){if(void 0===e&&(e=!1),t.length<=2)return GG(t);for(var n=[],r=t.length,i=0;i<r;i+=1){var o=e?t[r-i-1]:t[i];Ne(o,n.slice(-2))||n.push.apply(n,We([],Ve(o),!1))}var a=mz(n,!1);return e?a.unshift(We(["M"],Ve(t[r-1]),!1)):a.unshift(We(["M"],Ve(t[0]),!1)),a}function WG(t,e,n){var r=me(t);return r.push(["L",e,n],["L",0,n],["Z"]),r}function HG(t){return 0===t.length?[0,0]:[ee(ue(t,(function(t){return ee(t)||0}))),te(le(t,(function(t){return te(t)||0})))]}function UG(t){for(var e=me(t),n=e[0].length,r=Ve([Array(n).fill(0),Array(n).fill(0)],2),i=r[0],o=r[1],a=0;a<e.length;a+=1)for(var s=e[a],l=0;l<n;l+=1)s[l]>=0?(s[l]+=i[l],i[l]=s[l]):(s[l]+=o[l],o[l]=s[l]);return e}var YG=function(t){function e(e){return t.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return je(e,t),Object.defineProperty(e.prototype,"rawData",{get:function(){var t=this.attributes.data;if(!t||0===(null==t?void 0:t.length))return[[]];var e=me(t);return ae(e[0])?[e]:e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.isStack?UG(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){var t=this.scales.y,e=Ve(t.getOptions().domain||[0,0],2),n=e[0],r=e[1];return r<0?t.map(r):t.map(n<0?0:n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"containerShape",{get:function(){var t=this.attributes;return{width:t.width,height:t.height}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linesStyle",{get:function(){var t=this,e=this.attributes,n=e.type,r=e.isStack,i=e.smooth;if("line"!==n)throw new Error("linesStyle can only be used in line type");var o=Az(this.attributes,"area"),a=Az(this.attributes,"line"),s=this.containerShape.width,l=this.data;if(0===l[0].length)return{lines:[],areas:[]};var u=this.scales,c=function(t,e){var n,r=e.x,i=e.y,o=Ve(i.getOptions().range||[0,0],2),a=o[0],s=o[1];return s>a&&(n=Ve([a,s],2),s=n[0],a=n[1]),t.map((function(t){return t.map((function(t,e){return[r.map(e),oe(i.map(t),s,a)]}))}))}(l,{type:"line",x:u.x,y:u.y}),h=[];if(o){var d=this.baseline;h=r?i?function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=t[i],a=VG(o),s=void 0;if(0===i)s=WG(a,e,n);else{var l=VG(t[i-1],!0),u=o[0];l[0][0]="L",s=We(We(We([],Ve(a),!1),Ve(l),!1),[We(["M"],Ve(u),!1),["Z"]],!1)}r.push(s)}return r}(c,s,d):function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=GG(t[i]),a=void 0;if(0===i)a=WG(o,e,n);else{var s=GG(t[i-1],!0);s[0][0]="L",a=We(We(We([],Ve(o),!1),Ve(s),!1),[["Z"]],!1)}r.push(a)}return r}(c,s,d):function(t,e,n,r){return t.map((function(t){return WG(e?VG(t):GG(t),n,r)}))}(c,i,s,d)}return{lines:c.map((function(e,n){return Be({stroke:t.getColor(n),d:i?VG(e):GG(e)},a)})),areas:h.map((function(e,n){return Be({d:e,fill:t.getColor(n)},o)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnsStyle",{get:function(){var t=this,e=Az(this.attributes,"column"),n=this.attributes,r=n.isStack,i=n.type,o=n.scale;if("column"!==i)throw new Error("columnsStyle can only be used in column type");var a=this.containerShape.height,s=this.rawData;if(!s)return{columns:[]};r&&(s=UG(s));var l=this.createScales(s),u=l.x,c=l.y,h=Ve(HG(s),2),d=h[0],f=h[1],p=new BG({domain:[0,f-(d>0?0:d)],range:[0,a*o]}),g=u.getBandWidth(),v=this.rawData;return{columns:s.map((function(n,i){return n.map((function(n,o){var a=g/s.length;return Be(Be({fill:t.getColor(i)},e),r?{x:u.map(o),y:c.map(n),width:g,height:p.map(v[i][o])}:{x:u.map(o)+a*i,y:n>=0?c.map(n):c.map(0),width:a,height:p.map(Math.abs(n))})}))}))}},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){var n,r,i;(n=e,r=".container",i="rect",n.querySelector(r)?kz(n).select(r):kz(n).append(i)).attr("className","container").node();var o=t.type,a=t.x,s=t.y,l="spark".concat(o),u=Be({x:a,y:s},"line"===o?this.linesStyle:this.columnsStyle);kz(e).selectAll(".spark").data([o]).join((function(t){return t.append((function(t){return"line"===t?new zG({className:l,style:u}):new FG({className:l,style:u})})).attr("className","spark ".concat(l))}),(function(t){return t.update(u)}),(function(t){return t.remove()}))},e.prototype.getColor=function(t){var e=this.attributes.color;return $t(e)?e[t%e.length]:Ut(e)?e.call(null,t):e},e.prototype.createScales=function(t){var e,n,r=this.attributes,i=r.type,o=r.scale,a=r.range,s=void 0===a?[]:a,l=r.spacing,u=this.containerShape,c=u.width,h=u.height,d=Ve(HG(t),2),f=d[0],p=d[1],g=new BG({domain:[null!==(e=s[0])&&void 0!==e?e:f,null!==(n=s[1])&&void 0!==n?n:p],range:[h,h*(1-o)]});return"line"===i?{type:i,x:new BG({domain:[0,t[0].length-1],range:[0,c]}),y:g}:{type:i,x:new RG({domain:t[0].map((function(t,e){return e})),range:[0,c],paddingInner:l,paddingOuter:l/2,align:.5}),y:g}},e.tag="sparkline",e}(jz);function $G(t){if(!t)return{enter:!1,update:!1,exit:!1};var e=["enter","update","exit"],n=Object.fromEntries(Object.entries(t).filter((function(t){var n=Ve(t,1)[0];return!e.includes(n)})));return Object.fromEntries(e.map((function(e){return function(t){return"boolean"!=typeof t&&"enter"in t&&"update"in t&&"exit"in t}(t)?!1===t[e]?[e,!1]:[e,Be(Be({},t[e]),n)]:[e,n]})))}function qG(t,e){t?t.finished.then(e):e()}function XG(t,e){"update"in t?t.update(e):t.attr(e)}function KG(t,e,n){return 0===e.length?null:n?t.animate(e,n):(XG(t,{style:e.slice(-1)[0]}),null)}function ZG(t,e,n){var r={},i={};return Object.entries(e).forEach((function(e){var n=Ve(e,2),o=n[0],a=n[1];if(!Yt(a)){var s=t.style[o]||t.parsedStyle[o]||0;s!==a&&(r[o]=s,i[o]=a)}})),n?KG(t,[r,i],Be({fill:"both"},n)):(XG(t,i),null)}function QG(t,e){return t.style.opacity||(t.style.opacity=1),ZG(t,{opacity:0},e)}var JG={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},tV={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},eV={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},nV=qF({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),rV=qF({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),iV=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.render=function(t,e){var n=t.x,r=t.y,i=t.size,o=void 0===i?10:i,a=t.radius,s=void 0===a?o/4:a,l=t.orientation,u=Fe(t,["x","y","size","radius","orientation"]),c=o,h=2.4*c,d=kz(e).maybeAppendByClassName(rV.iconRect,"rect").styles(Be(Be({},u),{width:c,height:h,radius:s,x:n-c/2,y:r-h/2,transformOrigin:"center"})),f=n+1/3*c-c/2,p=n+2/3*c-c/2,g=r+1/4*h-h/2,v=r+3/4*h-h/2;d.maybeAppendByClassName("".concat(rV.iconLine,"-1"),"line").styles(Be({x1:f,x2:f,y1:g,y2:v},u)),d.maybeAppendByClassName("".concat(rV.iconLine,"-2"),"line").styles(Be({x1:p,x2:p,y1:g,y2:v},u)),"vertical"===l&&(d.node().style.transform="rotate(90)")},e}(jz),oV=function(t){function e(e){return t.call(this,e,eV)||this}return je(e,t),e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.x,i=n.y,o=n.showLabel,a=Az(this.attributes,"label"),s=a.x,l=void 0===s?0:s,u=a.y,c=void 0===u?0:u,h=a.transform,d=a.transformOrigin,f=Ve(Rz(Fe(a,["x","y","transform","transformOrigin"]),[]),2),p=f[0],g=f[1],v=kz(t).maybeAppendByClassName(rV.labelGroup,"g").styles(g),m=Be(Be({},tV),p),y=m.text,b=Fe(m,["text"]);oz(!!o,v,(function(t){e.label=t.maybeAppendByClassName(rV.label,"text").styles(Be(Be({},b),{x:r+l,y:i+c,transform:h,transformOrigin:d,text:"".concat(y)})),e.label.on("mousedown",(function(t){t.stopPropagation()})),e.label.on("touchstart",(function(t){t.stopPropagation()}))}))},e.prototype.renderIcon=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.orientation,o=e.type,a=Be(Be({x:n,y:r,orientation:i},JG),Az(this.attributes,"icon")),s=this.attributes.iconShape,l=void 0===s?function(){return new iV({style:a})}:s;kz(t).maybeAppendByClassName(rV.iconGroup,"g").selectAll(rV.icon.class).data([l]).join((function(t){return t.append("string"==typeof l?l:function(){return l(o)}).attr("className",rV.icon.name)}),(function(t){return t.update(a)}),(function(t){return t.remove()}))},e.prototype.render=function(t,e){this.renderIcon(e),this.renderLabel(e)},e}(jz),aV=function(t){function e(e){var n=t.call(this,e,Be(Be(Be({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(t){return t.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},Pz(eV,"handle")),Pz(JG,"handleIcon")),Pz(tV,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(t){return function(e){e.stopPropagation(),n.target=t,n.prevPos=n.getOrientVal(rz(e));var r=n.availableSpace,i=r.x,o=r.y,a=n.getBBox(),s=a.x,l=a.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([i,o])-n.getOrientVal([+s,+l])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(t){var e=n.attributes,r=e.slidable,i=e.brushable,o=e.type;t.stopPropagation();var a=n.getOrientVal(rz(t)),s=a-n.prevPos;if(s){var l=n.getRatio(s);switch(n.target){case"start":r&&n.setValuesOffset(l);break;case"end":r&&n.setValuesOffset(0,l);break;case"selection":r&&n.setValuesOffset(l,l);break;case"track":if(!i)return;n.selectionWidth+=l,"range"===o?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0)}n.prevPos=a}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(t){var e=n.attributes,r=e.onChange,i=e.type,o="range"===i?t:t[1],a="range"===i?n.getValues():n.getValues()[1],s=new Ds("valuechange",{detail:{oldValue:o,value:a}});n.dispatchEvent(s),null==r||r(a)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return je(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return this.attributes.values},set:function(t){this.attributes.values=this.clampValues(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sparklineStyle",{get:function(){if("horizontal"!==this.attributes.orientation)return null;var t=Az(this.attributes,"sparkline");return Be(Be({zIndex:0},this.availableSpace),t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t=this.attributes,e=t.trackLength,n=t.trackSize,r=Ve(this.getOrientVal([[e,n],[n,e]]),2);return{width:r[0],height:r[1]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes;t.x,t.y;var e=Ve(Mz(t.padding),4),n=e[0],r=e[1],i=e[2],o=e[3],a=this.shape;return{x:o,y:n,width:a.width-(o+r),height:a.height-(n+i)}},enumerable:!1,configurable:!0}),e.prototype.getValues=function(){return this.values},e.prototype.setValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1),this.attributes.values=t;var n=!1!==e&&this.attributes.animate;this.updateSelectionArea(n),this.updateHandlesPosition(n)},e.prototype.updateSelectionArea=function(t){var e=this.calcSelectionArea();this.foregroundGroup.selectAll(nV.selection.class).each((function(n,r){ZG(this,e[r],t)}))},e.prototype.updateHandlesPosition=function(t){this.attributes.showHandle&&(this.startHandle&&ZG(this.startHandle,this.getHandleStyle("start"),t),this.endHandle&&ZG(this.endHandle,this.getHandleStyle("end"),t))},e.prototype.innerSetValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1);var n=this.values,r=this.clampValues(t);this.attributes.values=r,this.setValues(r),e&&this.onValueChange(n)},e.prototype.renderTrack=function(t){var e=this.attributes,n=e.x,r=e.y,i=Az(this.attributes,"track");this.trackShape=kz(t).maybeAppendByClassName(nV.track,"rect").styles(Be(Be({x:n,y:r},this.shape),i))},e.prototype.renderBrushArea=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.brushable;this.brushArea=kz(t).maybeAppendByClassName(nV.brushArea,"rect").styles(Be({x:n,y:r,fill:"transparent",cursor:i?"crosshair":"default"},this.shape))},e.prototype.renderSparkline=function(t){var e=this,n=this.attributes,r=n.x,i=n.y;oz("horizontal"===n.orientation,kz(t).maybeAppendByClassName(nV.sparklineGroup,"g"),(function(t){var n=Be(Be({},e.sparklineStyle),{x:r,y:i});t.maybeAppendByClassName(nV.sparkline,(function(){return new YG({style:n})})).update(n)}))},e.prototype.renderHandles=function(){var t,e=this,n=this.attributes,r=n.showHandle,i=n.type,o=r?"range"===i?["start","end"]:["end"]:[],a=this;null===(t=this.foregroundGroup)||void 0===t||t.selectAll(nV.handle.class).data(o.map((function(t){return{type:t}})),(function(t){return t.type})).join((function(t){return t.append((function(t){var n=t.type;return new oV({style:e.getHandleStyle(n)})})).each((function(t){var e=t.type;this.attr("class","".concat(nV.handle.name," ").concat(e,"-handle"));var n="".concat(e,"Handle");a[n]=this,this.addEventListener("pointerdown",a.onDragStart(e))}))}),(function(t){return t.each((function(t){var e=t.type;this.update(a.getHandleStyle(e))}))}),(function(t){return t.each((function(t){var e=t.type,n="".concat(e,"Handle");a[n]=void 0})).remove()}))},e.prototype.renderSelection=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.type,o=e.selectionType;this.foregroundGroup=kz(t).maybeAppendByClassName(nV.foreground,"g");var a=Az(this.attributes,"selection"),s=function(t){return t.style("visibility",(function(t){return t.show?"visible":"hidden"})).style("cursor",(function(t){return"select"===o?"grab":"invert"===o?"crosshair":"default"})).styles(Be(Be({},a),{transform:"translate(".concat(n,", ").concat(r,")")}))},l=this;this.foregroundGroup.selectAll(nV.selection.class).data("value"===i?[]:this.calcSelectionArea().map((function(t,e){return{style:Be({},t),index:e,show:"select"===o?1===e:1!==e}})),(function(t){return t.index})).join((function(t){return t.append("rect").attr("className",nV.selection.name).call(s).each((function(t,e){var n=this;1===e?(l.selectionShape=kz(this),this.on("pointerdown",(function(t){n.attr("cursor","grabbing"),l.onDragStart("selection")(t)})),l.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),l.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),l.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",(function(){n.attr("cursor","grabbing")})),this.addEventListener("pointerup",(function(){n.attr("cursor","pointer")})),this.addEventListener("pointerover",(function(){n.attr("cursor","pointer")}))):this.on("pointerdown",l.onDragStart("track"))}))}),(function(t){return t.call(s)}),(function(t){return t.remove()})),this.updateSelectionArea(!1),this.renderHandles()},e.prototype.render=function(t,e){this.renderTrack(e),this.renderSparkline(e),this.renderBrushArea(e),this.renderSelection(e)},e.prototype.clampValues=function(t,e){var n;void 0===e&&(e=4);var r=Ve(this.range,2),i=r[0],o=r[1],a=Ve(this.getValues().map((function(t){return gz(t,e)})),2),s=a[0],l=a[1],u=Ve(((Array.isArray(t)?t:[s,null!=t?t:l])||[s,l]).map((function(t){return gz(t,e)})),2),c=u[0],h=u[1];if("value"===this.attributes.type)return[0,oe(h,i,o)];c>h&&(c=(n=Ve([h,c],2))[0],h=n[1]);var d=h-c;return d>o-i?[i,o]:c<i?s===i&&l===h?[i,h]:[i,d+i]:h>o?l===o&&s===c?[c,o]:[o-d,o]:[c,h]},e.prototype.calcSelectionArea=function(t){var e=Ve(this.clampValues(t),2),n=e[0],r=e[1],i=this.availableSpace,o=i.x,a=i.y,s=i.width,l=i.height;return this.getOrientVal([[{y:a,height:l,x:o,width:n*s},{y:a,height:l,x:n*s+o,width:(r-n)*s},{y:a,height:l,x:r*s,width:(1-r)*s}],[{x:o,width:s,y:a,height:n*l},{x:o,width:s,y:n*l+a,height:(r-n)*l},{x:o,width:s,y:r*l,height:(1-r)*l}]])},e.prototype.calcHandlePosition=function(t){var e=this.attributes.handleIconOffset,n=this.availableSpace,r=n.x,i=n.y,o=n.width,a=n.height,s=Ve(this.clampValues(),2),l=s[0],u=s[1],c="start"===t?-e:e,h=("start"===t?l:u)*this.getOrientVal([o,a])+c;return{x:r+this.getOrientVal([h,o/2]),y:i+this.getOrientVal([a/2,h])}},e.prototype.inferTextStyle=function(t){return"horizontal"===this.attributes.orientation?{}:"start"===t?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:"end"===t?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},e.prototype.calcHandleText=function(t){var e,n=this.attributes,r=n.type,i=n.orientation,o=n.formatter,a=n.autoFitLabel,s=Az(this.attributes,"handle"),l=Az(s,"label"),u=s.spacing,c=this.getHandleSize(),h=this.clampValues(),d=o("start"===t?h[0]:h[1]),f=new VF({style:Be(Be(Be({},l),this.inferTextStyle(t)),{text:d})}),p=f.getBBox(),g=p.width,v=p.height;if(f.destroy(),!a){if("value"===r)return{text:d,x:0,y:-v-u};var m=u+c+("horizontal"===i?g/2:0);return(e={text:d})["horizontal"===i?"x":"y"]="start"===t?-m:m,e}var y=0,b=0,x=this.availableSpace,E=x.width,w=x.height,k=this.calcSelectionArea()[1],M=k.x,S=k.y,N=k.width,O=k.height,T=u+c;if("horizontal"===i){var C=T+g/2;if("start"===t)y=M-T-g>0?-C:C;else y=E-M-N-T>g?C:-C}else{var A=v+T;b="start"===t?S-c>v?-A:T:w-(S+O)-c>v?A:-T}return{x:y,y:b,text:d}},e.prototype.getHandleLabelStyle=function(t){var e=Az(this.attributes,"handleLabel");return Be(Be(Be({},e),this.calcHandleText(t)),this.inferTextStyle(t))},e.prototype.getHandleIconStyle=function(){var t=this.attributes.handleIconShape,e=Az(this.attributes,"handleIcon"),n=this.getOrientVal(["ew-resize","ns-resize"]),r=this.getHandleSize();return Be({cursor:n,shape:t,size:r},e)},e.prototype.getHandleStyle=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.showLabel,o=e.showLabelOnInteraction,a=e.orientation,s=this.calcHandlePosition(t),l=s.x,u=s.y,c=this.calcHandleText(t),h=i;return!i&&o&&(h=!!this.target),Be(Be(Be({},Pz(this.getHandleIconStyle(),"icon")),Pz(Be(Be({},this.getHandleLabelStyle(t)),c),"label")),{transform:"translate(".concat(l+n,", ").concat(u+r,")"),orientation:a,showLabel:h,type:t,zIndex:3})},e.prototype.getHandleSize=function(){var t=this.attributes,e=t.handleIconSize,n=t.width,r=t.height;return e||Math.floor((this.getOrientVal([+r,+n])+4)/2.4)},e.prototype.getOrientVal=function(t){var e=Ve(t,2),n=e[0],r=e[1];return"horizontal"===this.attributes.orientation?n:r},e.prototype.setValuesOffset=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=!1);var r=this.attributes.type,i=Ve(this.getValues(),2),o=[i[0]+("range"===r?t:0),i[1]+e].sort();n?this.setValues(o):this.innerSetValues(o,!0)},e.prototype.getRatio=function(t){var e=this.availableSpace,n=e.width,r=e.height;return t/this.getOrientVal([n,r])},e.prototype.dispatchCustomEvent=function(t,e,n){var r=this;t.on(e,(function(t){t.stopPropagation(),r.dispatchEvent(new Ds(n,{detail:t}))}))},e.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var t=this.brushArea;this.dispatchCustomEvent(t,"click","trackClick"),this.dispatchCustomEvent(t,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(t,"pointerleave","trackMouseleave"),t.on("pointerdown",this.onDragStart("track"))},e.prototype.onScroll=function(t){if(this.attributes.scrollable){var e=t.deltaX,n=t.deltaY||e,r=this.getRatio(n);this.setValuesOffset(r,r,!0)}},e.tag="slider",e}(jz),sV={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 Ul({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:[]};ke({},sV,{style:{type:"arc"}}),ke({},sV,{style:{}});var lV=qF({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"),uV=qF({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function cV(t){return t.reduce((function(t,e,n){return t.push(We([0===n?"M":"L"],Ve(e),!1)),t}),[])}function hV(t,e,n){return"surround"===e.type?function(t,e,n){var r=e.connect,i=void 0===r?"line":r,o=e.center;if("line"===i)return cV(t);if(!o)return[];var a=fz(t[0],o),s=n?0:1;return t.reduce((function(t,e,n){return 0===n?t.push(We(["M"],Ve(e),!1)):t.push(We(["A",a,a,0,0,s],Ve(e),!1)),t}),[])}(t,e,n):cV(t)}function dV(t,e,n){var r=n.type,i=n.connect,o=n.center,a=n.closed?[["Z"]]:[],s=Ve([hV(t,n),hV(e.slice().reverse(),n,!0)],2),l=s[0],u=s[1],c=Ve([t[0],e.slice(-1)[0]],2),h=c[0],d=c[1],f=function(t,e){return[l,t,u,e,a].flat()};if("line"===i||"surround"===r)return f([We(["L"],Ve(d),!1)],[We(["L"],Ve(h),!1)]);if(!o)throw new Error("Arc grid need to specified center");var p=Ve([fz(d,o),fz(h,o)],2),g=p[0],v=p[1];return f([We(["A",g,g,0,0,1],Ve(d),!1),We(["L"],Ve(d),!1)],[We(["A",v,v,0,0,0],Ve(h),!1),We(["L"],Ve(h),!1)])}var fV=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.render=function(t,e){t.type,t.center,t.areaFill,t.closed;var n=Fe(t,["type","center","areaFill","closed"]),r=function(t){var e=t.data,n=void 0===e?[]:e;return t.closed?n.map((function(t){var e=t.points,n=Ve(e,1)[0];return Be(Be({},t),{points:We(We([],Ve(e),!1),[n],!1)})})):n}(t),i=kz(e).maybeAppendByClassName(uV.lineGroup,"g"),o=kz(e).maybeAppendByClassName(uV.regionGroup,"g"),a=function(t,e,n,r){var i=n.animate,o=n.isBillboard,a=e.map((function(t,e){return{id:t.id||"grid-line-".concat(e),d:hV(t.points,n)}}));return t.selectAll(uV.line.class).data(a,(function(t){return t.id})).join((function(t){return t.append("path").each((function(t,e){var n=YF(xz(Be({d:t.d},r)),[t,e,a]);this.attr(Be({class:uV.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:o},n))}))}),(function(t){return t.transition((function(t,e){return ZG(this,YF(xz(Be({d:t.d},r)),[t,e,a]),i.update)}))}),(function(t){return t.transition((function(){var t=this,e=QG(this,i.exit);return qG(e,(function(){return t.remove()})),e}))})).transitions()}(i,r,t,n),s=function(t,e,n){var r=n.animate,i=n.connect,o=n.areaFill;if(e.length<2||!o||!i)return[];for(var a=Array.isArray(o)?o:[o,"transparent"],s=function(t){return a[t%a.length]},l=[],u=0;u<e.length-1;u++){var c=Ve([e[u].points,e[u+1].points],2),h=dV(c[0],c[1],n);l.push({d:h,fill:s(u)})}return t.selectAll(uV.region.class).data(l,(function(t,e){return e})).join((function(t){return t.append("path").each((function(t,e){var n=YF(t,[t,e,l]);this.attr(n)})).attr("className",uV.region.name)}),(function(t){return t.transition((function(t,e){return ZG(this,YF(t,[t,e,l]),r.update)}))}),(function(t){return t.transition((function(){var t=this,e=QG(this,r.exit);return qG(e,(function(){return t.remove()})),e}))})).transitions()}(o,r,t);return We(We([],Ve(a),!1),Ve(s),!1)},e}(jz);function pV(t,e){return Object.fromEntries(Object.entries(t).map((function(t){var n=Ve(t,2);return[n[0],YF(n[1],e)]})))}function gV(t,e){return e&&Ut(e)?t.filter(e):t}function vV(t,e){var n=e.startAngle;return(e.endAngle-n)*t+n}function mV(t,e){if("linear"===e.type){var n=Ve(e.startPos,2),r=n[0],i=n[1],o=Ve(e.endPos,2),a=Ve([o[0]-r,o[1]-i],2);return pz([a[0],a[1]])}var s=WF(vV(t,e));return[-Math.sin(s),Math.cos(s)]}function yV(t,e,n){return function(t,e){return e?[t[1],-t[0]]:[-t[1],t[0]]}(mV(t,n),"positive"!==e)}function bV(t,e){return yV(t,e.labelDirection,e)}function xV(t,e){return"linear"===e.type?function(t,e){var n=Ve(e.startPos,2),r=n[0],i=n[1],o=Ve(e.endPos,2),a=Ve([o[0]-r,o[1]-i],2);return[r+a[0]*t,i+a[1]*t]}(t,e):function(t,e){var n=e.radius,r=Ve(e.center,2),i=r[0],o=r[1],a=WF(vV(t,e));return[i+n*Math.cos(a),o+n*Math.sin(a)]}(t,e)}function EV(t){return 0===mV(0,t)[1]}function wV(t){return 0===mV(0,t)[0]}function kV(t,e){return e-t==360}function MV(t,e,n,r,i){var o=e-t,a=Ve([i,i],2),s=a[0],l=a[1],u=Ve([WF(t),WF(e)],2),c=u[0],h=u[1],d=function(t){return[n+i*Math.cos(t),r+i*Math.sin(t)]},f=Ve(d(c),2),p=f[0],g=f[1],v=Ve(d(h),2),m=v[0],y=v[1];if(kV(t,e)){var b=Ve(d((h+c)/2),2);return[["M",p,g],["A",s,l,0,1,0,b[0],b[1]],["A",s,l,0,1,0,m,y]]}var x=o>180?1:0,E=t>e?0:1;return"M".concat(p,",").concat(g,",A").concat(s,",").concat(l,",0,").concat(x,",").concat(E,",").concat(m,",").concat(y)}function SV(t,e,n,r){var i=e.startAngle,o=e.endAngle,a=e.center,s=e.radius;return t.selectAll(lV.line.class).data([{d:MV.apply(void 0,We(We([i,o],Ve(a),!1),[s],!1))}],(function(t,e){return e})).join((function(t){return t.append("path").attr("className",lV.line.name).styles(e).styles({d:function(t){return t.d}})}),(function(t){return t.transition((function(){var t=this,e=function(t,e,n,r){if(!r)return t.attr("__keyframe_data__",n),null;var i=r.duration,o=void 0===i?0:i,a=sz(e,n),s=Math.ceil(+o/16),l=new Array(s).fill(0).map((function(t,e,n){return{__keyframe_data__:a(e/(n.length-1))}}));return t.animate(l,Be({fill:"both"},r))}(this,function(t){var e=t.attributes,n=e.startAngle,r=e.endAngle,i=e.center,o=e.radius;return We(We([n,r],Ve(i),!1),[o],!1)}(this),We(We([i,o],Ve(a),!1),[s],!1),r.update);if(e){var n=function(){var e=Oe(t.attributes,"__keyframe_data__");t.style.d=MV.apply(void 0,We([],Ve(e),!1))};e.onframe=n,e.onfinish=n}return e})).styles(e)}),(function(t){return t.remove()})).styles(n).transitions()}function NV(t){var e=Ve(t,2),n=Ve(e[0],2),r=n[0],i=n[1],o=Ve(e[1],2);return{x1:r,y1:i,x2:o[0],y2:o[1]}}function OV(t,e,n,r){var i=e.showTrunc,o=e.startPos,a=e.endPos,s=e.truncRange,l=e.lineExtension,u=Ve([o,a],2),c=Ve(u[0],2),h=c[0],d=c[1],f=Ve(u[1],2),p=f[0],g=f[1],v=Ve(l?function(t,e,n){void 0===n&&(n=[0,0]);var r=Ve([t,e,n],3),i=Ve(r[0],2),o=i[0],a=i[1],s=Ve(r[1],2),l=s[0],u=s[1],c=Ve(r[2],2),h=c[0],d=c[1],f=Ve([l-o,u-a],2),p=f[0],g=f[1],v=Math.sqrt(Math.pow(p,2)+Math.pow(g,2)),m=Ve([-h/v,d/v],2),y=m[0],b=m[1];return[y*p,y*g,b*p,b*g]}(o,a,l):new Array(4).fill(0),4),m=v[0],y=v[1],b=v[2],x=v[3],E=function(e){return t.selectAll(lV.line.class).data(e,(function(t,e){return e})).join((function(t){return t.append("line").attr("className",(function(t){return"".concat(lV.line.name," ").concat(t.className)})).styles(n).transition((function(t){return ZG(this,NV(t.line),!1)}))}),(function(t){return t.styles(n).transition((function(t){return ZG(this,NV(t.line),r.update)}))}),(function(t){return t.remove()})).transitions()};if(!i||!s)return E([{line:[[h+m,d+y],[p+b,g+x]],className:lV.line.name}]);var w=Ve(s,2),k=w[0],M=w[1],S=p-h,N=g-d,O=Ve([h+S*k,d+N*k],2),T=O[0],C=O[1],A=Ve([h+S*M,d+N*M],2),P=A[0],R=A[1],D=E([{line:[[h+m,d+y],[T,C]],className:lV.lineFirst.name},{line:[[P,R],[p+b,g+x]],className:lV.lineSecond.name}]);return function(t,e){e.truncRange,e.truncShape,e.lineExtension}(0,e),D}function TV(t,e,n){var r,i=e.type,o=Az(e,"line");return r="linear"===i?OV(t,e,vz(o,"arrow"),n):SV(t,e,vz(o,"arrow"),n),function(t,e,n,r){var i,o=n.showArrow,a=n.showTrunc,s=n.lineArrow,l=n.lineArrowOffset,u=n.lineArrowSize;if(i="arc"===e?t.select(lV.line.class):a?t.select(lV.lineSecond.class):t.select(lV.line.class),!o||!s||"arc"===n.type&&kV(n.startAngle,n.endAngle)){var c=i.node();c&&(c.style.markerEnd=void 0)}else{var h=iz(s);h.attr(r),Ez(h,u),i.style("markerEnd",h).style("markerEndOffset",-l)}}(t,i,e,o),r}function CV(t){var e=t.type,n=t.gridCenter;return"linear"===e?n:n||t.center}function AV(t,e){var n=e.gridLength;return t.map((function(t,r){var i=t.value,o=Ve(xV(i,e),2),a=o[0],s=o[1],l=Ve(lz(function(t,e){return yV(t,e.gridDirection,e)}(i,e),n),2);return{id:r,points:[[a,s],[a+l[0],s+l[1]]]}}))}function PV(t,e,n,r){var i=Az(n,"grid"),o=i.type,a=i.areaFill,s=CV(n),l=gV(e,n.gridFilter),u="segment"===o?AV(l,n):function(t,e){var n=e.gridControlAngles,r=CV(e);if(!r)throw new Error("grid center is not provide");if(t.length<2)throw new Error("Invalid grid data");if(!n||0===n.length)throw new Error("Invalid gridControlAngles");var i=Ve(r,2),o=i[0],a=i[1];return t.map((function(t,r){var i=Ve(xV(t.value,e),2),s=i[0],l=i[1],u=Ve([s-o,l-a],2),c=u[0],h=u[1],d=[];return n.forEach((function(t){var e=WF(t),n=Ve([Math.cos(e),Math.sin(e)],2),r=n[0],i=n[1],s=c*r-h*i+o,l=c*i+h*r+a;d.push([s,l])})),{points:d,id:r}}))}(l,n),c=Be(Be({},i),{center:s,areaFill:Ut(a)?l.map((function(t,e){return YF(a,[t,e,l])})):a,animate:r,data:u});return t.selectAll(lV.grid.class).data([1]).join((function(t){return t.append((function(){return new fV({style:c})})).attr("className",lV.grid.name)}),(function(t){return t.transition((function(){return this.update(c)}))}),(function(t){return t.remove()})).transitions()}var RV=function(){function t(t,e,n,r){this.set(t,e,n,r)}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),t.prototype.rotatedPoints=function(t,e,n){var r=this,i=r.x1,o=r.y1,a=r.x2,s=r.y2,l=Math.cos(t),u=Math.sin(t),c=e-e*l+n*u,h=n-e*u-n*l;return[[l*i-u*s+c,u*i+l*s+h],[l*a-u*s+c,u*a+l*s+h],[l*i-u*o+c,u*i+l*o+h],[l*a-u*o+c,u*a+l*o+h]]},t.prototype.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},t.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},t}();function DV(t,e){var n=t.getEulerAngles()||0;t.setEulerAngles(0);var r=t.getBounds(),i=Ve(r.min,2),o=i[0],a=i[1],s=Ve(r.max,2),l=s[0],u=s[1],c=t.getBBox(),h=c.width,d=c.height,f=0,p=0,g=o,v=a,m=tz(t);if(m){d-=1.5;var y=m.style.textAlign,b=m.style.textBaseline;"center"===y?g=(o+l)/2:"right"!==y&&"end"!==y||(g=l),"middle"===b?v=(a+u)/2:"bottom"===b&&(v=u)}var x=Ve(Mz(e),4),E=x[0],w=void 0===E?0:E,k=x[1],M=void 0===k?0:k,S=x[2],N=void 0===S?w:S,O=x[3],T=new RV((f+=o)-(void 0===O?M:O),(p+=a)-w,f+h+M,p+d+N);return t.setEulerAngles(n),T.rotatedPoints(WF(n),g,v)}function LV(t,e){return e[0]<=Math.max(t[0][0],t[1][0])&&e[0]<=Math.min(t[0][0],t[1][0])&&e[1]<=Math.max(t[0][1],t[1][1])&&e[1]<=Math.min(t[0][1],t[1][1])}function _V(t,e,n){var r=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return 0===r?0:r<0?2:1}function IV(t,e){return e.every((function(e){return function(t,e){var n=t.length;if(n<3)return!1;var r,i,o,a,s,l,u=[e,[9999,e[1]]],c=0,h=0;do{var d=[t[h],t[(h+1)%n]];if(i=u,o=void 0,a=void 0,s=void 0,l=void 0,o=_V((r=d)[0],r[1],i[0]),a=_V(r[0],r[1],i[1]),s=_V(i[0],i[1],r[0]),l=_V(i[0],i[1],r[1]),o!==a&&s!==l||0===o&&LV(r,i[0])||0===a&&LV(r,i[1])||0===s&&LV(i,r[0])||0===l&&LV(i,r[1])){if(0===_V(d[0],e,d[1]))return LV(d,e);c++}h=(h+1)%n}while(0!==h);return!!(1&c)}(t,e)}))}function jV(t,e){return[[t[0],t[1],t[2],t[3]],[t[2],t[3],t[4],t[5]],[t[4],t[5],t[6],t[7]],[t[6],t[7],t[0],t[1]]].some((function(t){return function(t,e){var n=Ve(t,4),r=n[0],i=n[1],o=n[2],a=n[3],s=Ve(e,4),l=s[0],u=s[1],c=o-r,h=a-i,d=s[2]-l,f=s[3]-u,p=c*f-d*h;if(0===p)return!1;var g=p>0,v=r-l,m=i-u,y=c*m-h*v;if(y<0===g)return!1;var b=d*m-f*v;return b<0!==g&&y>p!==g&&b>p!==g}(e,t)}))}function BV(t,e,n){var r,i,o=e.crossPadding,a=new Set,s=null,l=function(t,e){var n=t.type,r=t.labelDirection,i=t.crossSize;if(!i)return!1;if("arc"===n){var o=t.center,a=t.radius,s=Ve(o,2),l=s[0],u=s[1],c="negative"===r?0:i,h=-a-c,d=a+c,f=Ve(Mz(e),4),p=f[0],g=f[1],v=f[2],m=f[3];return new RV(l+h-m,u+h-p,l+d+g,u+d+v)}var y=Ve(t.startPos,2),b=y[0],x=y[1],E=Ve(t.endPos,2),w=E[0],k=E[1],M=Ve(wV(t)?[-e,0,e,0]:[0,e,0,-e],4),S=M[0],N=M[1],O=M[2],T=M[3],C=lz(bV(0,t),i),A=new RV(b,x,w,k);return A.x1+=T,A.y1+=S,A.x2+=N+C[0],A.y2+=O+C[1],A}(e,o),u=function(t){return!l||function(t,e,n){var r=t.x1,i=t.x2,o=t.y1,a=t.y2;return IV([[r,o],[i,o],[i,a],[r,a]],DV(e,n))}(l,t)},c=function(t,e){return!t||!t.firstChild||!function(t,e,n){var r,i,o=DV(t,n).flat(1),a=DV(e,n).flat(1),s=[[o[0],o[1],o[2],o[3]],[o[0],o[1],o[4],o[5]],[o[4],o[5],o[6],o[7]],[o[2],o[3],o[6],o[7]]];try{for(var l=Ge(s),u=l.next();!u.done;u=l.next())if(jV(a,u.value))return!0}catch(t){r={error:t}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}return!1}(t.firstChild,e.firstChild,Mz(n))};try{for(var h=Ge(t),d=h.next();!d.done;d=h.next()){var f=d.value;u(f)?!s||c(s,f)?s=f:(a.add(s),a.add(f)):a.add(f)}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return Array.from(a)}function FV(t,e){return void 0===e&&(e={}),Yt(t)?0:"number"==typeof t?t:Math.floor(QF(t,e))}var zV=function(t,e){var n=e.seq,r=void 0===n?2:n;return t.filter((function(t,e){return!(e%r)||(BF(t),!1)}))};var GV=new Map([["hide",function(t,e,n,r){var i=t.length,o=e.keepHeader,a=e.keepTail;if(!(i<=1||2===i&&o&&a)){var s,l,u,c=zV,h=function(t){return t.forEach(r.show),t},d=2,f=t.slice(),p=t.slice(),g=Math.min.apply(Math,We([1],Ve(t.map((function(t){return t.getBBox().width}))),!1));if("linear"===n.type&&(EV(n)||wV(n))){var v=Sz(t[0]).left,m=Sz(t[i-1]).right,y=Math.abs(m-v)||1;d=Math.max(Math.floor(i*g/y),d)}for(o&&(s=f.splice(0,1)[0]),a&&(l=f.splice(-1,1)[0],f.reverse()),h(f);d<t.length&&BV((u=l?We(We([l],Ve(p),!1),[s],!1):We([s],Ve(p),!1),u.filter(ZF)),n,null==e?void 0:e.margin).length;){if(l&&!s&&d%2==0)f.splice(0,1).forEach(r.hide);else if(l&&s){f.splice(0,1).forEach(r.hide)}p=c(h(f),{seq:d}),d++}}}],["rotate",function(t,e,n,r){var i,o,a=e.optionalAngles,s=void 0===a?[0,45,90]:a,l=e.margin,u=e.recoverWhenFailed,c=void 0===u||u,h=t.map((function(t){return t.getLocalEulerAngles()})),d=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.rotate(t,+i)}))};try{for(var f=Ge(s),p=f.next();!p.done;p=f.next()){if(d(p.value),BV(t,n,l).length<1)return}}catch(t){i={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}c&&d(h)}],["ellipsis",function(t,e,n,r){if(!(t.length<=1)){var i=e.suffix,o=void 0===i?"...":i,a=e.minLength,s=e.maxLength,l=void 0===s?1/0:s,u=e.step,c=void 0===u?" ":u,h=e.margin,d=void 0===h?[0,0,0,0]:h,f=JF(r.getTextShape(t[0])),p=FV(c,f),g=a?FV(a,f):p,v=FV(l,f);(Yt(v)||v===1/0)&&(v=Math.max.apply(null,t.map((function(t){return t.getBBox().width}))));var m=t.slice(),y=Ve(d,4);y[0],y[1],y[2],y[3];for(var b=function(e){if(m.forEach((function(t){r.ellipsis(r.getTextShape(t),e,o)})),(m=BV(t,n,d)).length<1)return{value:void 0}},x=v;x>g+p;x-=p){var E=b(x);if("object"==typeof E)return E.value}}}],["wrap",function(t,e,n,r){var i=e.wordWrapWidth,o=void 0===i?50:i,a=e.maxLines,s=void 0===a?3:a,l=e.recoverWhenFailed,u=void 0===l||l,c=e.margin,h=void 0===c?[0,0,0,0]:c,d=t.map((function(t){return t.attr("maxLines")||1})),f=Math.min.apply(Math,We([],Ve(d),!1)),p=function(t){var e=t.type,n=t.labelDirection;return"linear"===e&&EV(t)?"negative"===n?"bottom":"top":"middle"}(n),g=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.wrap(t,o,i,p)}))};if(!(f>s)){for(var v=f;v<=s;v++)if(g(v),BV(t,n,h).length<1)return;u&&g(d)}}]]);function VV(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t*function(t){return"positive"===t?-1:1}(e)}),1)}function WV(t){for(var e=t;e<0;)e+=360;return Math.round(e%360)}function HV(t,e){var n=Ve(t,2),r=n[0],i=n[1],o=Ve(e,2),a=o[0],s=o[1],l=Ve([r*a+i*s,r*s-i*a],2),u=l[0],c=l[1];return Math.atan2(c,u)}function UV(t,e,n){var r,i=n.labelAlign;if(null===(r=e.style.transform)||void 0===r?void 0:r.includes("rotate"))return e.getLocalEulerAngles();var o=bV(t.value,n),a=mV(t.value,n);return"horizontal"===i?0:function(t){var e=(t+360)%180;return az(e,-90,90)||(e+=180),e}(HF("perpendicular"===i?HV([1,0],o):HV([a[0]<0?-1:1,0],a)))}function YV(t,e,n){var r=n.type,i=n.labelAlign,o=bV(t,n),a=WV(e),s=WV(HF(HV([1,0],o))),l="center",u="middle";return"linear"===r?[90,270].includes(s)&&0===a?(l="center",u=1===o[1]?"top":"bottom"):s%180||![90,270].includes(a)?0===s?(az(a,0,90,!1,!0)||az(a,0,90)||az(a,270,360))&&(l="start"):90===s?az(a,0,90,!1,!0)?l="start":(az(a,90,180)||az(a,270,360))&&(l="end"):270===s?az(a,0,90,!1,!0)?l="end":(az(a,90,180)||az(a,270,360))&&(l="start"):180===s&&(90===a?l="start":(az(a,0,90)||az(a,270,360))&&(l="end")):l="center":"parallel"===i?u=az(s,0,180,!0)?"top":"bottom":"horizontal"===i?az(s,90,270,!1)?l="end":(az(s,270,360,!1)||az(s,0,90))&&(l="start"):"perpendicular"===i&&(l=az(s,90,270)?"end":"start"),{textAlign:l,textBaseline:u}}function $V(t,e,n){var r=n.showTick,i=n.tickLength,o=n.tickDirection,a=n.labelDirection,s=n.labelSpacing,l=e.indexOf(t),u=YF(s,[t,l,e]),c=Ve([bV(t.value,n),VV(a,o)],2),h=Ve(uz(lz(c[0],u+(1===c[1]?YF(r?i:0,[t,l,e]):0)),xV(t.value,n)),2);return{x:h[0],y:h[1]}}function qV(t,e){"text"===t.nodeName&&t.attr(e)}function XV(t){!function(t,e,n){var r=e.labelOverlap,i=void 0===r?[]:r;i.length&&i.forEach((function(r){var i=r.type,o=GV.get(i);(function(t,e,n){return!(e.labelOverlap.length<1)&&("hide"===n?!function(t){for(var e=t;e;){if("offscreen"===e.className)return!0;e=e.parent}return!1}(t[0]):"rotate"===n?!t.some((function(t){var e;return!!(null===(e=t.attr("transform"))||void 0===e?void 0:e.includes("rotate"))})):"ellipsis"!==n&&"wrap"!==n||t.filter((function(t){return t.querySelector("text")})).length>1)})(t,e,i)&&(null==o||o(t,r,e,n))}))}(this.node().childNodes,t,{hide:BF,show:jF,rotate:function(e,n){!function(t,e,n){e.setLocalEulerAngles(t);var r=YV(e.__data__.value,t,n),i=e.querySelector(lV.labelItem.class);i&&qV(i,r)}(+n,e,t)},ellipsis:function(t,e,n){t&&nz(t,e||1/0,n)},wrap:function(t,e,n){var r,i;t&&(void 0===(r=n)&&(r=2),void 0===i&&(i="top"),ez(t,{wordWrap:!0,wordWrapWidth:e,maxLines:r,textBaseline:i}))},getTextShape:function(t){return t.querySelector("text")}})}function KV(t,e,n,r,i){var o=n.indexOf(e),a=kz(t).append(function(t,e,n,r){var i=r.labelFormatter;return Ut(i)?function(){return iz(YF(i,[t,e,n,bV(t.value,r)]))}:function(){return iz(t.label||"")}}(e,o,n,i)).attr("className",lV.labelItem.name).node(),s=Ve(Rz(pV(r,[e,o,n])),2),l=s[0],u=s[1],c=u.transform,h=Fe(u,["transform"]);Lz(a,c);var d=UV(e,a,i);return a.getLocalEulerAngles()||a.setLocalEulerAngles(d),qV(a,Be(Be({},YV(e.value,d,i)),l)),t.attr(h),a}function ZV(t,e,n,r){var i=gV(e,n.labelFilter),o=Az(n,"label");return t.selectAll(lV.label.class).data(i,(function(t,e){return e})).join((function(r){return r.append("g").attr("className",lV.label.name).transition((function(t){KV(this,t,e,o,n);var r=$V(t,e,n),i=r.x,a=r.y;return this.style.transform="translate(".concat(i,", ").concat(a,")"),null})).call((function(){XV.call(t,n)}))}),(function(i){return i.transition((function(t){var i=function(t,e,n,r){if(void 0===r&&(r="destroy"),function(t,e){return"text"===t.nodeName&&"text"===e.nodeName&&t.attributes.text===e.attributes.text}(t,e))return t.remove(),[null];var i=function(){"destroy"===r?t.destroy():"hide"===r&&BF(t),e.isVisible()&&jF(e)};if(!n)return i(),[null];var o=n.duration,a=void 0===o?0:o,s=n.delay,l=void 0===s?0:s,u=Math.ceil(+a/2),c=+a/4,h=Ve(t.getGeometryBounds().center,2),d=h[0],f=h[1],p=Ve(e.getGeometryBounds().center,2),g=Ve([(d+p[0])/2-d,(f+p[1])/2-f],2),v=g[0],m=g[1],y=t.style.opacity,b=void 0===y?1:y,x=e.style.opacity,E=void 0===x?1:x,w=t.style.transform||"",k=e.style.transform||"",M=t.animate([{opacity:b,transform:"translate(0, 0) ".concat(w)},{opacity:0,transform:"translate(".concat(v,", ").concat(m,") ").concat(w)}],Be(Be({fill:"both"},n),{duration:l+u+c})),S=e.animate([{opacity:0,transform:"translate(".concat(-v,", ").concat(-m,") ").concat(k),offset:.01},{opacity:E,transform:"translate(0, 0) ".concat(k)}],Be(Be({fill:"both"},n),{duration:u+c,delay:l+u-c}));return qG(S,i),[M,S]}(this.querySelector(lV.labelItem.class),KV(this,t,e,o,n),r.update),a=$V(t,e,n),s=a.x,l=a.y,u=ZG(this,{transform:"translate(".concat(s,", ").concat(l,")")},r.update);return We(We([],Ve(i),!1),[u],!1)})).call((function(e){var r,i,o=Oe(e,"_transitions").flat().filter(ZF);i=function(){XV.call(t,n)},0===(r=o).length?i():Promise.all(r.map((function(t){return null==t?void 0:t.finished}))).then(i)}))}),(function(t){return t.transition((function(){var t=this,e=QG(this.childNodes[0],r.exit);return qG(e,(function(){return kz(t).remove()})),e}))})).transitions()}function QV(t,e){return yV(t,e.tickDirection,e)}function JV(t,e,n,r,i){var o=Ve(function(t,e){var n=Ve(t,2);return[[0,0],[n[0]*e,n[1]*e]]}(r,YF(i.tickLength,[t,e,n])),2),a=Ve(o[0],2),s=a[0],l=a[1],u=Ve(o[1],2);return{x1:s,x2:u[0],y1:l,y2:u[1]}}function tW(t,e,n,r,i,o){var a=function(t,e,n,r,i){var o=i.tickFormatter,a=QV(e.value,i),s="line";return Ut(o)&&(s=function(){return YF(o,[e,n,r,a])}),t.append(s).attr("className",lV.tickItem.name)}(kz(this),t,e,n,r);!function(t,e,n,r,i,o,a){var s=QV(t.value,o),l=JV(t,e,n,s,o),u=l.x1,c=l.x2,h=l.y1,d=l.y2,f=Ve(Rz(pV(a,[t,e,n,s])),2),p=f[0],g=f[1];"line"===r.node().nodeName&&r.styles(Be({x1:u,x2:c,y1:h,y2:d},p)),i.attr(g),r.styles(p)}(t,e,n,a,this,r,i);var s=Ve(xV(t.value,r),2),l=s[0],u=s[1];return ZG(this,{transform:"translate(".concat(l,", ").concat(u,")")},o)}var eW=qF({text:"text"},"title");function nW(t){return/\S+-\S+/g.test(t)?t.split("-").map((function(t){return t[0]})):t.length>2?[t[0]]:t.split("")}function rW(t,e){var n=Object.entries(e).reduce((function(e,n){var r=Ve(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e}),{});t.styles(n)}var iW=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return je(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,a=this.querySelector(eW.text.class);if(!a)return new UF(0,0,+e,+n);var s=a.getBBox(),l=s.width,u=s.height,c=Ve(Mz(i),4),h=c[0],d=c[1],f=c[2],p=c[3],g=Ve([0,0,+e,+n],4),v=g[0],m=g[1],y=g[2],b=g[3],x=nW(r);if(x.includes("i"))return new UF(v,m,y,b);x.forEach((function(t,r){var i,o,a,s;"t"===t&&(i=Ve(0===r?[u+f,+n-u-f]:[0,+n],2),m=i[0],b=i[1]),"r"===t&&(o=Ve([+e-l-p],1),y=o[0]),"b"===t&&(a=Ve([+n-u-h],1),b=a[0]),"l"===t&&(s=Ve(0===r?[l+d,+e-l-d]:[0,+e],2),v=s[0],y=s[1])}));var E=Ve(Mz(o),4),w=E[0],k=E[1],M=E[2],S=E[3],N=Ve([S+k,w+M],2),O=N[0],T=N[1];return new UF(v+S,m+w,y-O,b-T)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new UF(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=Fe(t,["width","height","position","spacing"]),i=Ve(Rz(r),1)[0],o=function(t){var e,n,r,i,o=t,a=o.width,s=o.height,l=o.position,u=Ve([+a/2,+s/2],2),c=Ve([+u[0],+u[1],"center","middle"],4),h=c[0],d=c[1],f=c[2],p=c[3],g=nW(l);return g.includes("l")&&(h=(e=Ve([0,"start"],2))[0],f=e[1]),g.includes("r")&&(h=(n=Ve([+a,"end"],2))[0],f=n[1]),g.includes("t")&&(d=(r=Ve([0,"top"],2))[0],p=r[1]),g.includes("b")&&(d=(i=Ve([+s,"bottom"],2))[0],p=i[1]),{x:h,y:d,textAlign:f,textBaseline:p}}(t),a=o.x,s=o.y,l=o.textAlign,u=o.textBaseline;oz(!!r.text,kz(e),(function(t){n.title=t.maybeAppendByClassName(eW.text,"text").styles(i).call(rW,{x:a,y:s,textAlign:l,textBaseline:u}).node()}))},e}(jz);function oW(t,e,n,r,i){var o=Ve(Rz(Az(r,"title")),2),a=o[0],s=o[1],l=s.transform,u=s.transformOrigin,c=Fe(s,["transform","transformOrigin"]);e.styles(c);var h=l||function(t,e,n){var r=2*t.getGeometryBounds().halfExtents[1];if("vertical"===e){if("left"===n)return"rotate(-90) translate(0, ".concat(r/2,")");if("right"===n)return"rotate(-90) translate(0, -".concat(r/2,")")}return""}(t.node(),a.direction,a.position);t.styles(Be(Be({},a),{transformOrigin:u})),Lz(t.node(),h);var d=function(t,e,n){var r=n.titlePosition,i=void 0===r?"lb":r,o=n.titleSpacing,a=nW(i),s=t.node().getLocalBounds(),l=Ve(s.min,2),u=l[0],c=l[1],h=Ve(s.halfExtents,2),d=h[0],f=h[1],p=Ve(e.node().getLocalBounds().halfExtents,2),g=p[0],v=p[1],m=Ve([u+d,c+f],2),y=m[0],b=m[1],x=Ve(Mz(o),4),E=x[0],w=x[1],k=x[2],M=x[3];if(["start","end"].includes(i)&&"linear"===n.type){var S=n.startPos,N=n.endPos,O=Ve("start"===i?[S,N]:[N,S],2),T=O[0],C=O[1],A=Ve(lz(pz([-C[0]+T[0],-C[1]+T[1]]),E),2),P=A[0],R=A[1];return{x:T[0]+P,y:T[1]+R}}return a.includes("t")&&(b-=f+v+E),a.includes("r")&&(y+=d+g+w),a.includes("l")&&(y-=d+g+M),a.includes("b")&&(b+=f+v+k),{x:y,y:b}}(kz(n._offscreen||n.querySelector(lV.mainGroup.class)),e,r),f=d.x,p=d.y;return ZG(e.node(),{transform:"translate(".concat(f,", ").concat(p,")")},i)}function aW(t,e,n,r){var i=t.showLine,o=t.showTick,a=t.showLabel,s=oz(i,e.maybeAppendByClassName(lV.lineGroup,"g"),(function(e){return TV(e,t,r)}))||[],l=oz(o,e.maybeAppendByClassName(lV.tickGroup,"g"),(function(e){return function(t,e,n,r){var i=gV(e,n.tickFilter),o=Az(n,"tick");return t.selectAll(lV.tick.class).data(i,(function(t){return t.id||t.label})).join((function(t){return t.append("g").attr("className",lV.tick.name).transition((function(t,e){return tW.call(this,t,e,i,n,o,!1)}))}),(function(t){return t.transition((function(t,e){return this.removeChildren(),tW.call(this,t,e,i,n,o,r.update)}))}),(function(t){return t.transition((function(){var t=this,e=QG(this.childNodes[0],r.exit);return qG(e,(function(){return t.remove()})),e}))})).transitions()}(e,n,t,r)}))||[],u=oz(a,e.maybeAppendByClassName(lV.labelGroup,"g"),(function(e){return ZV(e,n,t,r)}))||[];return We(We(We([],Ve(s),!1),Ve(l),!1),Ve(u),!1).filter((function(t){return!!t}))}var sW=function(t){function e(e){return t.call(this,e,sV)||this}return je(e,t),e.prototype.render=function(t,e,n){var r=this,i=t.titleText,o=t.data,a=t.animate,s=t.showTitle,l=t.showGrid,u=t.dataThreshold,c=t.truncRange,h=function(t,e){if(t.length<=e)return t;for(var n=Math.floor(t.length/e),r=[],i=0;i<t.length;i+=n)r.push(t[i]);return r}(o,u).filter((function(t){var e=t.value;return!(c&&e>c[0]&&e<c[1])})),d=$G(void 0===n?a:n),f=oz(l,kz(e).maybeAppendByClassName(lV.gridGroup,"g"),(function(e){return PV(e,h,t,d)}))||[],p=kz(e).maybeAppendByClassName(lV.mainGroup,"g");i&&(!this.initialized&&d.enter||this.initialized&&d.update)&&aW(t,kz(this.offscreenGroup),h,$G(!1));var g=aW(t,kz(p.node()),h,d),v=oz(s,kz(e).maybeAppendByClassName(lV.titleGroup,"g"),(function(e){return function(t,e,n,r){var i=n.titleText;return t.selectAll(lV.title.class).data([{title:i}].filter((function(t){return!!t.title})),(function(t,e){return t.title})).join((function(o){return o.append((function(){return iz(i)})).attr("className",lV.title.name).transition((function(){return oW(kz(this),t,e,n,r.enter)}))}),(function(i){return i.transition((function(){return oW(kz(this),t,e,n,r.update)}))}),(function(t){return t.remove()})).transitions()}(e,r,t,d)}))||[];return We(We(We([],Ve(f),!1),Ve(g),!1),Ve(v),!1).flat().filter((function(t){return!!t}))},e}(jz),lW=qF({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"),uW=function(t){function e(e){var n=t.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:Wz(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new Bl({class:lW.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Bl({class:lW.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return je(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return oe(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=Ve(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map((function(e,n){return t.map((function(t){return t[n]}))})))||[]}(this.pageViews.map((function(t){var e=t.getBBox();return[e.width,e.height]}))).map((function(t){return Math.max.apply(Math,We([],Ve(t),!1))})),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,a=r.pageHeight;return{pageWidth:o,pageHeight:void 0===a?n:a}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,a=o.pageWidth,s=o.pageHeight;return new UF(n,r,a+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,a=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var l=Ve(this.getFollowingPageDiff(t),2),u=l[0],c=l[1];this.playState="running";var h=KG(a,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-u,", ").concat(-c,")")}],n);return qG(h,(function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()})),h},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:oe(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:oe(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(lW.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach((function(e,n){t.includes(n)?jF(e):BF(e)}))},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,a=i.controllerPadding,s=r.getBBox(),l=s.width;s.height;var u=Ve("horizontal"===o?[-180,0]:[-90,90],2),c=u[0],h=u[1];e.setLocalEulerAngles(c),n.setLocalEulerAngles(h);var d=e.getBBox(),f=d.width,p=d.height,g=n.getBBox(),v=g.width,m=g.height,y=Math.max(f,l,v),b="horizontal"===o?{offset:[[0,0],[f/2+a,0],[f+l+2*a,0]],textAlign:"start"}:{offset:[[y/2,-p-a],[y/2,0],[y/2,m+a]],textAlign:"center"},x=Ve(b.offset,3),E=Ve(x[0],2),w=E[0],k=E[1],M=Ve(x[1],2),S=M[0],N=M[1],O=Ve(x[2],2),T=O[0],C=O[1],A=b.textAlign,P=r.querySelector("text");P&&(P.style.textAlign=A),e.setLocalPosition(w,k),r.setLocalPosition(S,N),n.setLocalPosition(T,C)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(lW.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=t<e?-1:1;return"horizontal"===n?[a*i,0]:[0,a*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=Ve(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes.controllerSpacing,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=this.pageViews.length>=2,s=t.maybeAppendByClassName(lW.controller,"g");if(FF(s.node(),a),a){var l=Az(this.attributes,"button"),u=Az(this.attributes,"pageNum"),c=Ve(Rz(l),2),h=c[0],d=c[1],f=h.size,p=Fe(h,["size"]),g=!s.select(lW.prevBtnGroup.class).node(),v=s.maybeAppendByClassName(lW.prevBtnGroup,"g").styles(d);this.prevBtnGroup=v.node();var m=v.maybeAppendByClassName(lW.prevBtn,"path"),y=s.maybeAppendByClassName(lW.nextBtnGroup,"g").styles(d);this.nextBtnGroup=y.node(),[m,y.maybeAppendByClassName(lW.nextBtn,"path")].forEach((function(t){t.styles(Be(Be({},p),{transformOrigin:"center"})),Ez(t.node(),f)}));var b=s.maybeAppendByClassName(lW.pageInfoGroup,"g");this.pageInfoGroup=b.node(),b.maybeAppendByClassName(lW.pageInfo,"text").styles(u),this.updatePageInfo(),s.node().setLocalPosition(i+n,o/2),g&&(this.prevBtnGroup.addEventListener("click",(function(){e.prev()})),this.nextBtnGroup.addEventListener("click",(function(){e.next()})))}},e.prototype.render=function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i;this.attr("transform","translate(".concat(r,", ").concat(o,")"));var a=kz(e);this.renderClipPath(a),this.renderController(a),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=ye((function(){return t.render(t.attributes,t)}),50);this.playWindow.addEventListener(Ws.INSERTED,e),this.playWindow.addEventListener(Ws.REMOVED,e)},e}(jz);function cW(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}Uz.registerSymbol("hiddenHandle",(function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]})),Uz.registerSymbol("verticalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=t+.4*r;return[["M",t,e],["L",a,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",a,e-i],["Z"],["M",a,e+o],["L",t+r-2,e+o],["M",a,e-o],["L",t+r-2,e-o]]})),Uz.registerSymbol("horizontalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=e+.4*r;return[["M",t,e],["L",t-i,a],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,a],["Z"],["M",t-o,a],["L",t-o,e+r-2],["M",t+o,a],["L",t+o,e+r-2]]}));var hW=qF({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");var dW=function(t){function e(e){return t.call(this,e,{span:[1,1],marker:function(){return new Ll({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return je(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes.markerSize,r=t.node().getBBox(),i=r.width,o=r.height,a=e.node().getBBox(),s=a.width,l=a.height;return{markerWidth:n,labelWidth:i,valueWidth:s,height:Math.max(n,o,l)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=Ve(Mz(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,a=i.height,s=this.actualSpace,l=s.labelWidth,u=s.valueWidth,c=Ve(this.spacing,2),h=c[0],d=c[1];if(r){var f=r-n-h-d,p=Ve(this.span,2);l=(t=Ve([p[0]*f,p[1]*f],2))[0],u=t[1]}return{width:o+l+u+h+d,height:a,markerWidth:o,labelWidth:l,valueWidth:u}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes.spacing;if(!t)return[0,0];var e=Ve(Mz(t),2),n=e[0],r=e[1];return this.showValue?[n,r]:[n,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.width,o=t.height,a=Ve(this.spacing,2),s=a[0];return{height:o,width:i,markerWidth:e,labelWidth:n,valueWidth:r,position:[e/2,e+s,e+n+s+a[1]]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(hW.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,a=void 0===o?t.lineWidth:o,s=e.markerStroke,l=void 0===s?t.stroke:s,u=+(i||a||(l?1:0))*Math.sqrt(2),c=this.markerGroup.node().getBBox(),h=c.width,d=c.height;return(1-u/Math.max(h,d))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes.marker,r=Az(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(hW.markerGroup,"g").style("zIndex",0),oz(!!n,this.markerGroup,(function(){var t,i=e.markerGroup.node(),o=null===(t=i.childNodes)||void 0===t?void 0:t[0],a="string"==typeof n?new Uz({style:{symbol:n},className:hW.marker.name}):n();o?a.nodeName===o.nodeName?o instanceof Uz?o.update(Be(Be({},r),{symbol:n})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=Ge(Object.entries(i)),a=o.next();!a.done;a=o.next()){var s=Ve(a.value,2),l=s[0],u=s[1];"id"!==l&&"className"!==l&&t.attr(l,u)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(o,a),kz(o).styles(r)):(o.remove(),kz(a).attr("className",hW.marker.name).styles(r),i.appendChild(a)):(a instanceof Uz||kz(a).attr("className",hW.marker.name).styles(r),i.appendChild(a)),e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]);var s=Ez(e.markerGroup.node(),e.scaleSize);e.markerGroup.node().style._transform="scale(".concat(s,")")}))},e.prototype.renderLabel=function(t){var e=Az(this.attributes,"label"),n=e.text,r=Fe(e,["text"]);this.labelGroup=t.maybeAppendByClassName(hW.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(hW.label,(function(){return iz(n)})).styles(r)},e.prototype.renderValue=function(t){var e=this,n=Az(this.attributes,"value"),r=n.text,i=Fe(n,["text"]);this.valueGroup=t.maybeAppendByClassName(hW.valueGroup,"g").style("zIndex",0),oz(this.showValue,this.valueGroup,(function(){e.valueGroup.maybeAppendByClassName(hW.value,(function(){return iz(r)})).styles(i)}))},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,i=Az(this.attributes,"background");this.background=t.maybeAppendByClassName(hW.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(hW.background,"rect").styles(Be({width:n,height:r},i))},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=Ve(t.position,3),o=i[0],a=i[1],s=i[2],l=r/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(l,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(a,", ").concat(l,")")}),nz(this.labelGroup.select(hW.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(s,", ").concat(l,")")}),nz(this.valueGroup.select(hW.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=kz(e),r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o;n.styles({transform:"translate(".concat(i,", ").concat(a,")")}),this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.adjustLayout()},e}(jz),fW=qF({page:"item-page",navigator:"navigator",item:"item"},"items"),pW=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},gW=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:Le,mouseenter:Le,mouseleave:Le})||this;return n.navigatorShape=[0,0],n}return je(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=Az(this.attributes,"item"),i=e.map((function(t,i){var o=t.id,a=void 0===o?i:o,s=t.label,l=t.value;return{id:"".concat(a),index:i,style:Be({layout:n,labelText:s,valueText:l},Object.fromEntries(Object.entries(r).map((function(n){var r=Ve(n,2);return[r[0],YF(r[1],[t,i,e])]}))))}}));return i},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,a=Ve(this.navigatorShape,1)[0],s=Ve(this.grid,2),l=s[0],u=s[1],c=u*l,h=0;return this.pageViews.children.map((function(e,s){var d,f,p=Math.floor(s/c),g=s%c,v=t.ifHorizontal(u,l),m=[Math.floor(g/v),g%v];"vertical"===n&&m.reverse();var y=Ve(m,2),b=y[0],x=y[1],E=(r-a-(u-1)*o)/u,w=e.getBBox().height,k=Ve([0,0],2),M=k[0],S=k[1];return"horizontal"===n?(M=(d=Ve([h,b*(w+i)],2))[0],S=d[1],h=x===u-1?0:h+E+o):(M=(f=Ve([x*(E+o),h],2))[0],S=f[1],h=b===l-1?0:h+w+i),{page:p,index:s,row:b,col:x,pageIndex:g,width:E,height:w,x:M,y:S}}))},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=Ve(this.navigatorShape,1)[0],a=Ve(this.grid,2),s=a[0],l=a[1],u=Ve([e-o,n],2),c=u[0],h=u[1],d=Ve([0,0,0,0,0,0,0,0],8),f=d[0],p=d[1],g=d[2],v=d[3],m=d[4],y=d[5],b=d[6],x=d[7];return this.pageViews.children.map((function(t,e){var n,o,a,u,d=t.getBBox(),E=d.width,w=d.height,k=0===b?0:i,M=b+k+E;return M<=c&&pW(m,(function(t){return t<l}))?(n=Ve([b+k,x,M],3),f=n[0],p=n[1],b=n[2],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}):(o=Ve([y+1,0,0,x+w+r],4),y=o[0],m=o[1],b=o[2],(x=o[3])+w<=h&&pW(y,(function(t){return t<s}))?(a=Ve([b,x,E],3),f=a[0],p=a[1],b=a[2],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}):(u=Ve([0,0,E,0,g+1,0,0,0],8),f=u[0],p=u[1],b=u[2],x=u[3],g=u[4],v=u[5],y=u[6],m=u[7],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}))}))},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return cW(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(fW.item.class).forEach((function(e){t.appendChild(e)})),t.querySelectorAll(fW.page.class).forEach((function(e){t.removeChild(e).destroy()}))},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave;this.flattenPage(t);var o=this.dispatchCustomEvent.bind(this);kz(t).selectAll(fW.item.class).data(this.renderData,(function(t){return t.id})).join((function(t){return t.append((function(t){var e=t.style;return new dW({style:e})})).attr("className",fW.item.name).on("click",(function(){null==n||n(this),o("itemClick",{item:this})})).on("pointerenter",(function(){null==r||r(this),o("itemMouseenter",{item:this})})).on("pointerleave",(function(){null==i||i(this),o("itemMouseleave",{item:this})}))}),(function(t){return t.each((function(t){var e=t.style;this.update(e)}))}),(function(t){return t.remove()}))},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=Ve(this.navigatorShape,2),a=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-a,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{}))).map((function(t){var e=Ve(t,2);return{page:e[0],layouts:e[1]}})),i=We([],Ve(this.navigator.getContainer().children),!1);r.forEach((function(t){var e=t.layouts,r=n.pageViews.appendChild(new Bl({className:fW.page.name}));e.forEach((function(t){var e=t.x,n=t.y,o=t.index,a=t.width,s=t.height,l=i[o];r.appendChild(l),Te(l,"__layout__",t),l.update({x:e,y:n,width:a,height:s})}))})),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes.orientation,n=Az(this.attributes,"nav"),r=KF({orientation:e},n),i=this;return t.selectAll(fW.navigator.class).data(["nav"]).join((function(t){return t.append((function(){return new uW({style:r})})).attr("className",fW.navigator.name).each((function(){i.navigator=this}))}),(function(t){return t.each((function(){this.update(r)}))}),(function(t){return t.remove()})),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator(kz(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new Ds(t,{detail:e});this.dispatchEvent(n)},e}(jz),vW=qF({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),mW={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,mW)||this}je(e,t),e.prototype.render=function(t,e){var n=kz(e).maybeAppendByClassName(vW.markerGroup,"g");this.renderMarker(n);var r=kz(e).maybeAppendByClassName(vW.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,i=n.markerSymbol,o=void 0===i?cW(r,"horizontalHandle","verticalHandle"):i;oz(!!o,t,(function(t){var n=Az(e.attributes,"marker"),r=Be({symbol:o},n);e.marker=t.maybeAppendByClassName(vW.marker,(function(){return new Uz({style:r})})).update(r)}))},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,i=n.orientation,o=n.spacing,a=void 0===o?0:o,s=n.formatter;oz(r,t,(function(t){var n,r=Az(e.attributes,"label"),o=r.text,l=Fe(r,["text"]),u=(null===(n=t.select(vW.marker.class))||void 0===n?void 0:n.node().getBBox())||{},c=u.width,h=void 0===c?0:c,d=u.height,f=Ve(cW(i,[0,(void 0===d?0:d)+a,"center","top"],[h+a,0,"start","middle"]),4),p=f[0],g=f[1],v=f[2],m=f[3];t.maybeAppendByClassName(vW.label,"text").styles(Be(Be({},l),{x:p,y:g,text:s(o).toString(),textAlign:v,textBaseline:m}))}))}}(jz);var yW={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},bW=KF({},yW,{});KF({},yW,Pz(mW,"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 xW=qF({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"),EW=function(t){function e(e){return t.call(this,e,bW)||this}return je(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,i=r.showTitle,o=r.titleText,a=Ve(Rz(Az(this.attributes,"title")),2),s=a[0],l=a[1];this.titleGroup=t.maybeAppendByClassName(xW.titleGroup,"g").styles(l);var u=Be(Be({width:e,height:n},s),{text:i?o:""});this.title=this.titleGroup.maybeAppendByClassName(xW.title,(function(){return new iW({style:u})})).update(u)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,i=e.width,o=e.height,a=Ve(Rz(Az(this.attributes,"title",!0)),2),s=a[0],l=a[1],u=Be(Be({},s),{width:i,height:o,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName(xW.itemsGroup,"g").styles(Be(Be({},l),{transform:"translate(".concat(n,", ").concat(r,")")}));var c=this;this.itemsGroup.selectAll(xW.items.class).data(["items"]).join((function(t){return t.append((function(){return new gW({style:u})})).attr("className",xW.items.name).each((function(){c.items=kz(this)}))}),(function(t){return t.update(u)}),(function(t){return t.remove()}))},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().style.transform="translate(".concat(e,", ").concat(n,")")}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new UF(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,a=n.text,s=t.getBBox(),l=e.getBBox(),u=nW(r),c=Ve(Mz(a?i:0),4),h=c[0],d=c[1],f=c[2],p=c[3],g=Ve(Mz(o),4),v=g[0],m=g[1],y=g[2],b=g[3],x=Ve([p+d,h+f],2),E=x[0],w=x[1],k=Ve([b+m,v+y],2),M=k[0],S=k[1];if("l"===u[0])return new UF(s.x,s.y,l.width+s.width+E+M,Math.max(l.height+S,s.height));if("t"===u[0])return new UF(s.x,s.y,Math.max(l.width+M,s.width),l.height+s.height+w+S);var N=Ve([e.attributes.width||l.width,e.attributes.height||l.height],2),O=N[0],T=N[1];return new UF(l.x,l.y,O+s.width+E+M,T+s.height+w+S)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=this.attributes,r=n.width,i=n.height,o=n.x,a=void 0===o?0:o,s=n.y,l=void 0===s?0:s,u=kz(e);e.style.transform="translate(".concat(a,", ").concat(l,")"),this.renderTitle(u,r,i),this.renderItems(u,this.availableSpace),this.adjustLayout()},e}(jz),wW={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(t){return t.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},kW=qF({background:"background",labelGroup:"label-group",label:"label"},"indicator"),MW=function(t){function e(e){var n=t.call(this,e,wW)||this;return n.point=[0,0],n.group=n.appendChild(new Bl({})),n.isMutationObserved=!0,n}return je(e,t),e.prototype.renderBackground=function(){if(this.label){var t=this.attributes,e=t.position,n=Ve(Mz(t.padding),4),r=n[0],i=n[1],o=n[2],a=n[3],s=this.label.node().getLocalBounds(),l=s.min,u=s.max,c=new UF(l[0]-a,l[1]-r,u[0]+i-l[0]+a,u[1]+o-l[1]+r),h=this.getPath(e,c),d=Az(this.attributes,"background");this.background=kz(this.group).maybeAppendByClassName(kW.background,"path").styles(Be(Be({},d),{d:h})),this.group.appendChild(this.label.node())}},e.prototype.renderLabel=function(){var t=this.attributes,e=t.formatter,n=t.labelText,r=Ve(Rz(Az(this.attributes,"label")),2),i=r[0],o=r[1];i.text;var a=Fe(i,["text"]);(this.label=kz(this.group).maybeAppendByClassName(kW.labelGroup,"g").styles(o),n)&&this.label.maybeAppendByClassName(kW.label,(function(){return iz(e(n))})).style("text",e(n).toString()).selectAll("text").styles(a)},e.prototype.adjustLayout=function(){var t=Ve(this.point,2),e=t[0],n=t[1],r=this.attributes,i=r.x,o=r.y;this.group.attr("transform","translate(".concat(i-e,", ").concat(o-n,")"))},e.prototype.getPath=function(t,e){var n=this.attributes.radius,r=e.x,i=e.y,o=e.width,a=e.height,s=[["M",r+n,i],["L",r+o-n,i],["A",n,n,0,0,1,r+o,i+n],["L",r+o,i+a-n],["A",n,n,0,0,1,r+o-n,i+a],["L",r+n,i+a],["A",n,n,0,0,1,r,i+a-n],["L",r,i+n],["A",n,n,0,0,1,r+n,i],["Z"]],l={top:4,right:6,bottom:0,left:2}[t],u=this.createCorner([s[l].slice(-2),s[l+1].slice(-2)]);return s.splice.apply(s,We([l+1,1],Ve(u),!1)),s[0][0]="M",s},e.prototype.createCorner=function(t,e){void 0===e&&(e=10);var n=Nz.apply(void 0,We([],Ve(t),!1)),r=Ve(t,2),i=Ve(r[0],2),o=i[0],a=i[1],s=Ve(r[1],2),l=s[0],u=s[1],c=Ve(n?[l-o,[o,l]]:[u-a,[a,u]],2),h=c[0],d=Ve(c[1],2),f=d[0],p=d[1],g=h/2,v=e*(h/Math.abs(h)),m=v/2,y=v*Math.sqrt(3)/2*.8,b=Ve([f,f+g-m,f+g,f+g+m,p],5),x=b[0],E=b[1],w=b[2],k=b[3],M=b[4];return n?(this.point=[w,a-y],[["L",x,a],["L",E,a],["L",w,a-y],["L",k,a],["L",M,a]]):(this.point=[o+y,w],[["L",o,x],["L",o,E],["L",o+y,w],["L",o,k],["L",o,M]])},e.prototype.applyVisibility=function(){"hidden"===this.attributes.visibility?BF(this):jF(this)},e.prototype.bindEvents=function(){this.label.on(Ws.BOUNDS_CHANGED,this.renderBackground)},e.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},e}(jz);function SW(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var NW={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function OW(t){var e;void 0===t&&(t="");var n=SW(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=Be({flex:1},NW),e[".".concat(n.VALUE)]=Be({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},NW),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var TW=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,a=SW(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(a.CONTAINER,'"></div>'),title:'<div class="'.concat(a.TITLE,'"></div>'),item:'<li class="'.concat(a.LIST_ITEM,'" data-index={index}>\n <span class="').concat(a.NAME,'">\n <span class="').concat(a.MARKER,'" style="background:{color}"></span>\n <span class="').concat(a.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(a.VALUE,'" title="{value}">{value}</span>\n </li>')},style:OW(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return je(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map((function(t,e){var r=t.name,i=void 0===r?"":r,o=t.color,a=void 0===o?"black":o,s=t.index,l=Fe(t,["name","color","index"]),u=Be({name:i,color:a,index:null!=s?s:e},l);return Cn(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t}(n.item,u))}))},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=Cn(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:_z(this.element,t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,a=n.style,s=n.content,l=SW(r.prefixCls),u=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(u.innerHTML=r.title,u.getElementsByClassName(l.TITLE)[0].innerHTML=i):null===(e=null===(t=u.getElementsByClassName(l.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var c=this.HTMLTooltipItemsElements,h=document.createElement("ul");h.className=l.LIST,_z(h,c);var d=this.element.querySelector(".".concat(l.LIST));d?d.replaceWith(h):u.appendChild(h)}!function(t,e){Object.entries(e).forEach((function(e){var n=Ve(e,2),r=n[0],i=n[1];We([t],Ve(t.querySelectorAll(r)),!1).filter((function(t){return t.matches(r)})).forEach((function(t){t&&(t.style.cssText+=Object.entries(i).reduce((function(t,e){return"".concat(t).concat(e.join(":"),";")}),""))}))}))}(u,a)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},a=this.elementSize,s=a.width,l=a.height,u=[-s/2,-l/2];return i.forEach((function(t){var e=Ve(u,2),n=e[0],i=e[1],a=Ve(o[t],2),c=a[0],h=a[1];u=[n+(s/2+r[0])*c,i+(l/2+r[1])*h]})),u},e.prototype.setOffsetPosition=function(t){var e=Ve(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=void 0===o?0:o,s=i.y,l=void 0===s?0:s,u=i.container,c=u.x,h=u.y;this.element.style.left="".concat(+a+c+n,"px"),this.element.style.top="".concat(+l+h+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=Ve(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=i.y,s=i.bounding,l=i.position;if(!s)return[n,r];var u=this.element,c=u.offsetWidth,h=u.offsetHeight,d=Ve([+o+n,+a+r],2),f=d[0],p=d[1],g={left:"right",right:"left",top:"bottom",bottom:"top"},v=s.x,m=s.y,y={left:f<v,right:f+c>v+s.width,top:p<m,bottom:p+h>m+s.height},b=[];l.split("-").forEach((function(t){y[t]?b.push(g[t]):b.push(t)}));var x=b.join("-");return this.getRelativeOffsetFromCursor(x)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height;return new UF(r,i,o,a).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout((function(){e.element.style.transition=n}),10)},e.tag="tooltip",e}(jz),CW=function(t){function e(n){var r=t.call(this,KF({},e.defaultOptions,n))||this;return r.hoverColor="#f5f5f5",r.selectedColor="#e6f7ff",r.background=r.appendChild(new Kl({})),r.label=r.background.appendChild(new Bl({})),r}return je(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return Mz(this.style.padding)},enumerable:!1,configurable:!0}),e.prototype.renderLabel=function(){var t=this.style,e=t.label,n=t.value,r=Az(this.attributes,"label");kz(this.label).maybeAppend(".label",(function(){return iz(e)})).attr("className","label").styles(r),this.label.attr("__data__",n)},e.prototype.renderBackground=function(){var t=this.label.getBBox(),e=Ve(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3],a=t.width,s=t.height,l=a+o+r,u=s+n+i,c=Az(this.attributes,"background"),h=this.style,d=h.width,f=void 0===d?0:d,p=h.height,g=void 0===p?0:p,v=h.selected;this.background.attr(Be(Be({},c),{width:Math.max(l,f),height:Math.max(u,g),fill:v?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((u-s)/2,")")})},e.prototype.render=function(){this.renderLabel(),this.renderBackground()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("pointerenter",(function(){t.style.selected||t.background.attr("fill",t.hoverColor)})),this.addEventListener("pointerleave",(function(){t.style.selected||t.background.attr("fill",t.style.backgroundFill)}));var e=this;this.addEventListener("click",(function(){var n=t.style,r=n.label,i=n.value,o=n.onClick;null==o||o(i,{label:r,value:i},e)}))},e.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},e}(jz),AW=function(t){function e(n){var r,i,o=t.call(this,KF({},e.defaultOptions,n))||this;o.currentValue=null===(r=e.defaultOptions.style)||void 0===r?void 0:r.defaultValue,o.isPointerInSelect=!1,o.select=o.appendChild(new Kl({className:"select",style:{cursor:"pointer",width:0,height:0}})),o.dropdown=o.appendChild(new Kl({className:"dropdown"}));var a=o.style.defaultValue;return a&&(null===(i=o.style.options)||void 0===i?void 0:i.some((function(t){return t.value===a})))&&(o.currentValue=a),o}return je(e,t),e.prototype.setValue=function(t){this.currentValue=t,this.render()},e.prototype.getValue=function(){return this.currentValue},Object.defineProperty(e.prototype,"dropdownPadding",{get:function(){return Mz(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),e.prototype.renderSelect=function(){var t,e=this,n=this.style,r=n.x,i=n.y,o=n.width,a=n.height,s=n.bordered,l=n.showDropdownIcon,u=Az(this.attributes,"select"),c=Az(this.attributes,"placeholder");this.select.attr(Be(Be({x:r,y:i,width:o,height:a},u),{fill:"#fff",strokeWidth:s?1:0}));var h=this.dropdownPadding;l&&kz(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(r+o-10-h[1]-h[3],", ").concat(i+a/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var d=null===(t=this.style.options)||void 0===t?void 0:t.find((function(t){return t.value===e.currentValue})),f=Be({x:r+h[3]},c);kz(this.select).selectAll(".placeholder").data(d?[]:[1]).join((function(t){return t.append("text").attr("className","placeholder").styles(f).style("y",(function(){var t=this.getBBox();return i+(a-t.height)/2}))}),(function(t){return t.styles(f)}),(function(t){return t.remove()}));var p=Az(this.attributes,"optionLabel"),g=Be({x:r+h[3]},p);kz(this.select).selectAll(".value").data(d?[d]:[]).join((function(t){return t.append((function(t){return iz(t.label)})).attr("className","value").styles(g).style("y",(function(){var t=this.getBBox();return i+(a-t.height)/2}))}),(function(t){return t.styles(g)}),(function(t){return t.remove()}))},e.prototype.renderDropdown=function(){var t,e,n=this,r=this.style,i=r.x,o=r.y,a=r.width,s=r.height,l=r.options,u=r.onSelect,c=r.open,h=Az(this.attributes,"dropdown"),d=Az(this.attributes,"option"),f=this.dropdownPadding;kz(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(l,(function(t){return t.value})).join((function(t){return t.append((function(t){return new CW({className:"dropdown-item",style:Be(Be(Be({},t),d),{width:a-f[1]-f[3],selected:t.value===n.currentValue,onClick:function(t,e,r){n.setValue(t),null==u||u(t,e,r),n.dispatchEvent(new Ds("change",{detail:{value:t,option:e,item:r}})),BF(n.dropdown)}})})})).each((function(t,e){var n,r=(null===(n=this.parentNode)||void 0===n?void 0:n.children).reduce((function(t,n,r){return r<e&&(t+=n.getBBox().height),t}),0);this.attr("transform","translate(".concat(f[3],", ").concat(f[0]+r,")"))}))}),(function(t){return t.update((function(t){return{selected:t.value===n.currentValue}}))}),(function(t){return t.remove()}));var p=null===(e=null===(t=this.dropdown.getElementsByClassName("dropdown-container"))||void 0===t?void 0:t[0])||void 0===e?void 0:e.getBBox(),g=h.spacing;this.dropdown.attr(Be({transform:"translate(".concat(i,", ").concat(o+s+g,")"),width:p.width+f[1]+f[3],height:p.height+f[0]+f[2]},h)),!c&&BF(this.dropdown)},e.prototype.render=function(){this.renderSelect(),this.renderDropdown()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("click",(function(t){t.stopPropagation()})),this.select.addEventListener("click",(function(){"visible"===t.dropdown.style.visibility?BF(t.dropdown):jF(t.dropdown)})),this.addEventListener("pointerenter",(function(){t.isPointerInSelect=!0})),this.addEventListener("pointerleave",(function(){t.isPointerInSelect=!1})),null===document||void 0===document||document.addEventListener("click",(function(){t.isPointerInSelect||BF(t.dropdown)}))},e.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},e}(jz),PW=function(t){function e(n){var r=t.call(this,KF({},{style:{backgroundOpacity:e.backgroundOpacities.default}},e.defaultOptions,n))||this;return r.showBackground=!0,r.background=r.appendChild(new Kl({})),r.icon=r.appendChild(new Bl({})),r}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return Mz(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"iconSize",{get:function(){var t=this.attributes.size,e=Ve(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3];return Math.max(t-Math.max(o+r,n+i),2*this.lineWidth+1)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.size,i=r/2,o=Az(this.attributes,"background");this.background.attr(Be({x:e-i,y:n-i,width:r,height:r},o))},e.prototype.showIndicator=function(){if(this.label){var t=this.attributes.size,e=this.background.getBBox(),n=e.x,r=e.y;this.indicator.update({x:n+t/2,y:r-5,labelText:this.label,visibility:"visible"})}},e.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},e.prototype.connectedCallback=function(){var e;t.prototype.connectedCallback.call(this);var n=this.attributes.size,r=this.background.getBBox(),i=r.x,o=r.y,a=null===(e=this.ownerDocument)||void 0===e?void 0:e.defaultView;a&&(this.indicator=a.appendChild(new MW({style:{x:i+n/2,y:o-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},e.prototype.disconnectedCallback=function(){this.indicator.destroy()},e.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},e.prototype.bindEvents=function(){var t=this,n=this.attributes.onClick;if(this.addEventListener("click",(function(){null==n||n(t)})),this.showBackground){var r=function(){return t.background.attr({opacity:e.backgroundOpacities.default})};this.addEventListener("pointerenter",(function(){t.background.attr({opacity:e.backgroundOpacities.hover}),t.showIndicator()})),this.addEventListener("pointerleave",(function(){r(),t.hideIndicator()})),this.addEventListener("pointerdown",(function(){t.background.attr({opacity:e.backgroundOpacities.active})})),this.addEventListener("pointerup",(function(){r()}))}},e.tag="IconBase",e.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},e.backgroundOpacities={default:0,hover:.8,active:1},e}(jz),RW=function(t,e){return void 0===e&&(e="#565758"),new Ul({style:{fill:e,d:"M ".concat(t,",").concat(t," L -").concat(t,",0 L ").concat(t,",-").concat(t," Z"),transformOrigin:"center"}})},DW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),e.prototype.arcPath=function(t,e,n){var r=Ve([n,n],2),i=r[0],o=r[1],a=function(r){return[t+n*Math.cos(r),e+n*Math.sin(r)]},s=Ve(a(-5/4*Math.PI),2),l=s[0],u=s[1],c=Ve(a(1/4*Math.PI),2),h=c[0],d=c[1];return"M".concat(l,",").concat(u,",A").concat(i,",").concat(o,",0,1,1,").concat(h,",").concat(d)},Object.defineProperty(e.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o+.5;kz(this.icon).maybeAppend(".reset","path").styles({stroke:r,lineWidth:o,d:this.arcPath(e,n,i/2-o),markerStart:RW(a,r)})},e}(PW),LW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e-o,n],[e,n+a],[e,n],[e+o,n-a],[e+o,n+a],[e,n]];kz(this.icon).maybeAppend(".backward","polygon").styles({points:s,fill:r})},e}(PW),_W=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e+o,n],[e,n+a],[e,n],[e-o,n-a],[e-o,n+a],[e,n]];kz(this.icon).maybeAppend(".forward","polygon").styles({points:s,fill:r})},e}(PW),IW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3*Math.pow(3,.5)*.8,a=[[e+o,n],[e-o/2,n-i/2*.8],[e-o/2,n+i/2*.8],[e+o,n]];kz(this.icon).maybeAppend(".play","polygon").styles({points:a,fill:r})},e}(PW),jW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3,a=[[e-o,n-i/2],[e-o,n+i/2],[e-o/2,n+i/2],[e-o/2,n-i/2],[e-o,n-i/2],[e+o/2,n-i/2],[e+o/2,n+i/2],[e+o,n+i/2],[e+o,n-i/2]];kz(this.icon).maybeAppend(".pause","polygon").styles({points:a,fill:r})},e}(PW),BW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o;kz(this.icon).maybeAppend(".left-line","line").styles({x1:e-i/2,y1:n-i/2,x2:e-i/2,y2:n+i/2,stroke:r,lineWidth:o}),kz(this.icon).maybeAppend(".right-line","line").styles({x1:e+i/2,y1:n-i/2,x2:e+i/2,y2:n+i/2,stroke:r,lineWidth:o}),kz(this.icon).maybeAppend(".left-arrow","line").styles({x1:e,y1:n,x2:e-i/2+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:RW(2*o,r)}),kz(this.icon).maybeAppend(".right-arrow","line").styles({x1:e,y1:n,x2:e+i/2-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:RW(2*o,r)})},e}(PW),FW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;kz(this.icon).maybeAppend(".line","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o});var a=o;kz(this.icon).maybeAppend(".left-arrow","line").styles({x1:e-i/2-2*a,y1:n,x2:e-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:RW(2*o,r)}),kz(this.icon).maybeAppend(".right-arrow","line").styles({x1:e+i/2+2*a,y1:n,x2:e+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:RW(2*o,r)})},e}(PW),zW=function(t){return[[-t/2,-t/2],[-t/2,t/2],[t/2,t/2]]},GW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=(i-2*o-o)/4,s=(i-2*o-o)/2,l=Ve([e-i/2+o,n+i/2-2*o],2),u=l[0],c=l[1];kz(this.icon).maybeAppend(".coordinate","polyline").styles({points:zW(i).map((function(t){var r=Ve(t,2),i=r[0],o=r[1];return[i+e,o+n]})),stroke:r,lineWidth:o}),kz(this.icon).maybeAppend(".line","polyline").styles({points:[[u,c],[u+a,c-s],[u+2*a,c],[u+4*a,c-2*s]],stroke:r,lineWidth:o})},e}(PW),VW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return je(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.data,e=this.attributes,n=e.x,r=e.y,i=e.color,o=this.iconSize,a=this.lineWidth,s=a,l=(o-s)/t.length,u=(o-2*s)/4,c=Ve([n-o/2+2*s,r+o/2-s],2),h=c[0],d=c[1];kz(this.icon).maybeAppend(".coordinate","polyline").styles({points:zW(o).map((function(t){var e=Ve(t,2),i=e[0],o=e[1];return[i+n,o+r]})),stroke:i,lineWidth:a}),kz(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map((function(t,e){return{value:t,index:e}}))).join((function(t){return t.append("line").attr("className","column").style("x1",(function(t){var e=t.index;return h+l*e})).style("y1",d).style("x2",(function(t){var e=t.index;return h+l*e})).style("y2",(function(t){var e=t.value;return d-u*e})).styles({y1:d,stroke:i,lineWidth:a})}))},e}(PW),WW=function(t){function e(e){var n=t.call(this,KF({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return je(e,t),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;kz(this.icon).maybeAppend(".split","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o})},e}(PW),HW=function(t){function e(){var e=t.apply(this,We([],Ve(arguments),!1))||this;return e.showBackground=!1,e}return je(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return Mz(0)},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.iconSize,e=this.attributes,n=e.x,r=e.y,i=e.speed,o=void 0===i?1:i,a=Pe(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),s=oe(t,20,1/0),l=Be(Be({},a),{x:n-s/2,y:r-10,width:s,height:20,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:t/5,placeholderFontSize:t/2,optionPadding:0,optionLabelFontSize:t/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});kz(this.icon).maybeAppend(".speed",(function(){return new AW({style:l})})).attr("className","speed").each((function(){this.update(l)}))},e.tag="SpeedSelect",e}(PW),UW=function(t){function e(e){var n=t.call(this,e)||this;return n.icon=n.appendChild(new Bl({})),n.currentType=n.attributes.type,n}return je(e,t),e.prototype.getType=function(){return this.currentType},e.prototype.render=function(){var t=this,e=this.attributes;e.onChange;var n=Fe(e,["onChange"]);kz(this.icon).selectAll(".icon").data([this.currentType]).join((function(e){return e.append((function(e){var n,r=null===(n=t.toggles.find((function(t){return Ve(t,1)[0]===e})))||void 0===n?void 0:n[1];if(!r)throw new Error("Invalid type: ".concat(e));return new r({})})).attr("className","icon").styles(n,!1).update({})}),(function(t){return t.styles({restStyles:n}).update({})}),(function(t){return t.remove()}))},e.prototype.bindEvents=function(){var t=this,e=this.attributes.onChange;this.addEventListener("click",(function(n){n.preventDefault(),n.stopPropagation();var r=(t.toggles.findIndex((function(e){return Ve(e,1)[0]===t.currentType}))+1)%t.toggles.length,i=t.toggles[r][0];null==e||e(t.currentType),t.currentType=i,t.render()}))},e.tag="ToggleIcon",e}(jz),YW=function(t){function e(e){var n=t.call(this,KF({},{style:{type:"play"}},e))||this;return n.toggles=[["play",IW],["pause",jW]],n}return je(e,t),e}(UW),$W=function(t){function e(e){var n=t.call(this,KF({},{style:{type:"range"}},e))||this;return n.toggles=[["range",BW],["value",FW]],n}return je(e,t),e}(UW),qW=function(t){function e(e){var n=t.call(this,KF({},{style:{type:"column"}},e))||this;return n.toggles=[["line",GW],["column",VW]],n}return je(e,t),e}(UW),XW={reset:DW,speed:HW,backward:LW,playPause:YW,forward:_W,selectionType:$W,chartType:qW,split:WW},KW=function(t){function e(n){var r=t.call(this,KF({},e.defaultOptions,n))||this;return r.background=r.appendChild(new Kl({})),r.functions=r.appendChild(new Bl({})),r}return je(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return Mz(this.attributes.padding)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.style,e=t.x,n=t.y,r=t.width,i=t.height,o=Az(this.attributes,"background");this.background.attr(Be({x:e,y:n,width:r,height:i},o))},e.prototype.renderFunctions=function(){var t,e=this,n=this.attributes,r=n.functions,i=n.iconSize,o=n.iconSpacing,a=n.x,s=n.y,l=n.width,u=n.height,c=n.align,h=Ve(this.padding,4),d=h[1],f=h[3],p=r.reduce((function(t,e){return t.length&&e.length?t.concat.apply(t,We(["split"],Ve(e),!1)):t.concat.apply(t,We([],Ve(e),!1))}),[]),g=p.length*(i+o)-o,v={left:f+i/2,center:(l-g)/2+i/2,right:l-g-f-d+i/2}[c]||0;null===(t=this.speedSelect)||void 0===t||t.destroy(),this.functions.removeChildren(),p.forEach((function(t,n){var r,l=XW[t],c={x:a+n*(i+o)+v,y:s+u/2,size:i};if(l===HW?(c.speed=e.attributes.speed,c.onSelect=function(n){return e.handleFunctionChange(t,{value:n})}):[YW,$W,qW].includes(l)?(c.onChange=function(n){return e.handleFunctionChange(t,{value:n})},l===YW&&(c.type="play"===e.attributes.state?"pause":"play"),l===$W&&(c.type="range"===e.attributes.selectionType?"value":"range"),l===qW&&(c.type="line"===e.attributes.chartType?"column":"line")):c.onClick=function(){return e.handleFunctionChange(t,{value:t})},l===HW){var h=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView;h&&(e.speedSelect=new l({style:Be(Be({},c),{zIndex:100})}),h.appendChild(e.speedSelect))}else e.functions.appendChild(new l({style:c}))}))},e.prototype.disconnectedCallback=function(){var e;t.prototype.disconnectedCallback.call(this),null===(e=this.speedSelect)||void 0===e||e.destroy()},e.prototype.render=function(){this.renderBackground(),this.renderFunctions()},e.prototype.handleFunctionChange=function(t,e){var n=this.attributes.onChange;null==n||n(t,e)},e.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},e}(jz),ZW=function(t){function e(n){var r=t.call(this,KF({},e.defaultOptions,n))||this;return r.bindEvents(),r}return je(e,t),e.prototype.bindEvents=function(){var t=this;this.addEventListener("mouseenter",(function(){t.attr("lineWidth",Math.ceil(+(t.style.r||0)/2))})),this.addEventListener("mouseleave",(function(){t.attr("lineWidth",0)}))},e.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},e}(Ll),QW=function(t){function e(n){return t.call(this,KF({},e.defaultOptions,n))||this}return je(e,t),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=Az(this.attributes,"background");kz(this).maybeAppend("background","rect").attr("className","background").styles(Be({x:e-r/2,y:n-i/2,width:r,height:i},o))},e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.iconSize,i=Az(this.attributes,"icon"),o=r/2;kz(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(Be({x1:e-1,y1:n-o,x2:e-1,y2:n+o},i)),kz(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(Be({x1:e+1,y1:n-o,x2:e+1,y2:n+o},i))},e.prototype.renderBorder=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=Az(this.attributes,"border"),s="start"===o?+r/2:-r/2;kz(this).maybeAppend("border","line").attr("className","border").styles(Be({x1:s+e,y1:n-i/2,x2:s+e,y2:n+i/2},a))},e.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},e.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},e}(jz);function JW(t,e){return"number"==typeof t?tH(t):function(t,e){var n=new Date(t);switch(e){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(n.getHours())&&0===n.getMinutes()?Dz(n,"HH:mm\nYYYY-MM-DD"):Dz(n,"HH:mm");case"half-day":return n.getHours()<12?"AM\n".concat(Dz(n,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(n.getDate())?Dz(n,"DD\nYYYY-MM"):Dz(n,"DD");case"week":return n.getDate()<=7?Dz(n,"DD\nYYYY-MM"):Dz(n,"DD");case"month":return[0,6].includes(n.getMonth())?Dz(n,"MM月\nYYYY"):Dz(n,"MM月");case"season":return[0].includes(n.getMonth())?Dz(n,"MM月\nYYYY"):Dz(n,"MM月");case"year":return Dz(n,"YYYY");default:return Dz(n,"YYYY-MM-DD HH:mm")}}(t,e)}function tH(t){var e=String(Math.floor(t/3600)).padStart(2,"0"),n=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(Math.floor(t%60)).padStart(2,"0");return t<3600?"".concat(n,":").concat(r):"".concat(e,":").concat(n,":").concat(r)}var eH=function(t){function e(n){var r=t.call(this,KF({},e.defaultOptions,n))||this;r.axis=r.appendChild(new sW({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),r.timeline=r.appendChild(new aV({style:{onChange:function(t){r.handleSliderChange(t)}}})),r.controller=r.appendChild(new KW({})),r.states={},r.handleSliderChange=function(t){var e,n=(e=r.states.values,Array.isArray(e)?We([],Ve(e),!1):e);r.setBySliderValues(t),r.dispatchOnChange(n)};var i=r.attributes,o=i.selectionType,a=i.chartType,s=i.speed,l=i.state,u=i.playMode,c=i.values;return r.states={chartType:a,playMode:u,selectionType:o,speed:s,state:l},r.setByTimebarValues(c),r}return je(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.data.sort((function(t,e){return t.time<e.time?-1:t.time>e.time?1:0}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"space",{get:function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=t.controllerHeight,s=oe(+i-a,0,+i),l=new UF(e,n+ +i-a,+r,a),u=0,c="time"===o?10:s;return{axisBBox:"chart"===o?new UF(e,n+s-(u=35),+r,u):new UF,controllerBBox:l,timelineBBox:new UF(e,n+("time"===o?s:s-c),+r,c-u)}},enumerable:!1,configurable:!0}),e.prototype.setBySliderValues=function(t){var e,n,r=this.data,i=Ve(Array.isArray(t)?t:[0,t],2),o=i[0],a=i[1],s=r.length,l=r[Math.floor(o*s)],u=r[Math.ceil(a*s)-(Array.isArray(t)?0:1)];this.states.values=[null!==(e=null==l?void 0:l.time)&&void 0!==e?e:r[0].time,null!==(n=null==u?void 0:u.time)&&void 0!==n?n:1/0]},e.prototype.setByTimebarValues=function(t){var e,n,r,i=this.data,o=Ve(Array.isArray(t)?t:[void 0,t],2),a=o[0],s=o[1],l=i.find((function(t){return t.time===a})),u=i.find((function(t){return t.time===s}));this.states.values=[null!==(e=null==l?void 0:l.time)&&void 0!==e?e:null===(n=i[0])||void 0===n?void 0:n.time,null!==(r=null==u?void 0:u.time)&&void 0!==r?r:1/0]},e.prototype.setByIndex=function(t){var e,n,r,i,o=this.data,a=Ve(t,2),s=a[0],l=a[1];this.states.values=[null!==(n=null===(e=o[s])||void 0===e?void 0:e.time)&&void 0!==n?n:o[0].time,null!==(i=null===(r=this.data[l])||void 0===r?void 0:r.time)&&void 0!==i?i:1/0]},Object.defineProperty(e.prototype,"sliderValues",{get:function(){var t,e=this.states,n=e.values,r=e.selectionType,i=Ve(Array.isArray(n)?n:[void 0,n],2),o=i[0],a=i[1],s=this.data,l=s.length,u="value"===r;return[(t=s.findIndex((function(t){return t.time===o})),u?0:t>-1?t/l:0),function(){if(a===1/0)return 1;var t=s.findIndex((function(t){return t.time===a}));return t>-1?t/l:u?.5:1}()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){var t=this.states,e=t.values,n=t.selectionType,r=Ve(Array.isArray(e)?e:[this.data[0].time,e],2),i=r[0],o=r[1];return"value"===n?o:[i,o]},enumerable:!1,configurable:!0}),e.prototype.getDatumByRatio=function(t){var e=this.data,n=e.length;return e[Math.floor(t*(n-1))]},Object.defineProperty(e.prototype,"chartHandleIconShape",{get:function(){var t=this.states.selectionType,e=this.space.timelineBBox.height;return"range"===t?function(t){return new QW({style:{type:t,height:e,iconSize:e/6}})}:function(){return new Wl({style:{x1:0,y1:-e/2,x2:0,y2:e/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),e.prototype.getChartStyle=function(t){var e=this,n=t.x,r=t.y,i=t.width,o=t.height,a=this.states,s=a.selectionType,l=a.chartType,u=this.data,c=this.attributes,h=c.type,d=c.labelFormatter,f=Az(this.attributes,"chart");f.type;var p=Fe(f,["type"]),g="range"===s;if("time"===h)return Be({handleIconShape:function(){return new ZW({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:g?-15:0,autoFitLabel:g,handleSpacing:g?-15:0,trackFill:"#edeeef",trackLength:i,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:s,values:this.sliderValues,formatter:function(t){if(d)return d(t);var n=e.getDatumByRatio(t).time;return"number"==typeof n?tH(n):Dz(n,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},p);var v="range"===s?5:0,m=u.map((function(t){return t.value}));return Be({handleIconOffset:v,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:m,sparklineType:l,sparklineScale:.8,trackLength:i,trackSize:o,type:s,values:this.sliderValues,transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},p)},e.prototype.renderChart=function(t){void 0===t&&(t=this.space.timelineBBox),this.timeline.update(this.getChartStyle(t))},e.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},e.prototype.getAxisStyle=function(t){var e=this.data,n=this.attributes,r=n.interval,i=n.labelFormatter,o=Az(this.attributes,"axis"),a=t.x,s=t.y,l=t.width,u=We(We([],Ve(e),!1),[{time:0}],!1).map((function(t,e,n){var r=t.time;return{label:"".concat(r),value:e/(n.length-1),time:r}})),c=Be({startPos:[a,s],endPos:[a+l,s],data:u,labelFilter:function(t,e){return e<u.length-1},labelFormatter:function(t){var e=t.time;return i?i(e):JW(e,r)}},o);return c},e.prototype.renderAxis=function(t){void 0===t&&(t=this.space.axisBBox),"chart"===this.attributes.type&&this.axis.update(this.getAxisStyle(t))},e.prototype.renderController=function(t){void 0===t&&(t=this.space.controllerBBox);var e=this.attributes.type,n=this.states,r=n.state,i=n.speed,o=n.selectionType,a=n.chartType,s=Az(this.attributes,"controller"),l=this,u=Be(Be(Be({},t),{iconSize:20,speed:i,state:r,selectionType:o,chartType:a,onChange:function(t,e){var n=e.value;switch(t){case"reset":l.internalReset();break;case"speed":l.handleSpeedChange(n);break;case"backward":l.internalBackward();break;case"playPause":"play"===n?l.internalPlay():l.internalPause();break;case"forward":l.internalForward();break;case"selectionType":l.handleSelectionTypeChange(n);break;case"chartType":l.handleChartTypeChange(n)}}}),s);"time"===e&&(u.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(u)},e.prototype.dispatchOnChange=function(t){var e=this.data,n=this.attributes.onChange,r=this.states,i=r.values,o=r.selectionType,a=Ve(i,2),s=a[0],l=a[1],u=l===1/0?e.at(-1).time:l;t&&function(t,e){if(Array.isArray(t)){if(!Array.isArray(e))return!1;if(t[0]===e[0]){if(t[1]===e[1])return!0;if(t[1]===1/0||e[1]===1/0)return!0}return!1}return!Array.isArray(e)&&t===e}(t,"range"===o?[s,u]:u)||null==n||n("range"===o?[s,u]:u)},e.prototype.internalReset=function(t){var e,n,r=this.states.selectionType;this.internalPause(),this.setBySliderValues("range"===r?[0,1]:[0,0]),this.renderController(),this.updateSelection(),t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onReset)||void 0===n||n.call(e),this.dispatchOnChange())},e.prototype.reset=function(){this.internalReset()},e.prototype.moveSelection=function(t,e){var n=this.data,r=n.length,i=this.states,o=i.values,a=i.selectionType,s=i.playMode,l=Ve(o,2),u=l[0],c=l[1],h=n.findIndex((function(t){return t.time===u})),d=n.findIndex((function(t){return t.time===c}));-1===d&&(d=r);var f,p="backward"===t?-1:1;"range"===a?"acc"===s?(f=[h,d+p],-1===p&&h===d&&(f=[h,r])):f=[h+p,d+p]:f=[h,d+p];var g=function(t){var e=Ve(t.sort((function(t,e){return t-e})),2),n=e[0],i=e[1],o=function(t){return oe(t,0,r)};return i>r?"value"===a?[0,0]:"acc"===s?[o(n),o(n)]:[0,o(i-n)]:n<0?"acc"===s?[0,o(i)]:[o(n+r-i),r]:[o(n),o(i)]}(f);return this.setByIndex(g),this.updateSelection(),g},e.prototype.internalBackward=function(t){var e,n,r=this.moveSelection("backward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onBackward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.backward=function(){this.internalBackward()},e.prototype.internalPlay=function(t){var e,n,r=this,i=this.data,o=this.attributes.loop,a=this.states.speed,s=void 0===a?1:a;this.playInterval=window.setInterval((function(){r.internalForward()[1]!==i.length||o||(r.internalPause(),r.renderController())}),1e3/s),this.states.state="play",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPlay)||void 0===n||n.call(e))},e.prototype.play=function(){this.internalPlay()},e.prototype.internalPause=function(t){var e,n;clearInterval(this.playInterval),this.states.state="pause",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPause)||void 0===n||n.call(e))},e.prototype.pause=function(){this.internalPause()},e.prototype.internalForward=function(t){var e,n,r=this.moveSelection("forward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onForward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.forward=function(){this.internalForward()},e.prototype.handleSpeedChange=function(t){var e,n;this.states.speed=t,"play"===this.states.state&&(this.internalPause(!0),this.internalPlay(!0)),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSpeedChange)||void 0===n||n.call(e,t)},e.prototype.handleSelectionTypeChange=function(t){var e,n;this.states.selectionType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSelectionTypeChange)||void 0===n||n.call(e,t)},e.prototype.handleChartTypeChange=function(t){var e,n;this.states.chartType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onChartTypeChange)||void 0===n||n.call(e,t)},e.prototype.render=function(){var t=this.space,e=t.axisBBox,n=t.controllerBBox,r=t.timelineBBox;this.renderController(n),this.renderAxis(e),this.renderChart(r),"play"===this.states.state&&this.internalPlay()},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.internalPause(!0)},e.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},e}(jz);function nH(t){const{width:e,height:n,renderer:r,containerStyle:i}=t,o=function(t){var e;const{container:n,className:r,graphCanvas:i}=t;if(n)return"string"==typeof n?document.getElementById(n):n;const o=rB(r,!1);return null===(e=i.getContainer())||void 0===e||e.appendChild(o),o}(t),[a,s]=function(t){const{width:e,height:n,placement:r,graphCanvas:i}=t,[o,a]=i.getSize(),[s,l]=Qh(r);return[s*(o-e),l*(a-n)]}(t);Object.assign(o.style,Object.assign({position:"absolute",left:a+"px",top:s+"px",width:e+"px",height:n+"px"},i));return[o,new du({width:e,height:n,container:o,renderer:r||new Np})]}class rH extends nB{constructor(e,n){super(e,Object.assign({},rH.defaultOptions,n)),this.typePrefix="__data__",this.draw=!1,this.fieldMap={node:new Map,edge:new Map,combo:new Map},this.selectedItems=[],this.bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)},this.changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=Oe(t,[r,"id"]),o=Oe(t,[r,"style","labelText"]),[a]=i.split("__"),s=this.fieldMap[a].get(o)||[];n.setElementState(Object.fromEntries(null==s?void 0:s.map((t=>[t,e]))))},this.click=t=>{if("hover"===this.options.trigger)return;const e=Oe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter((t=>t!==e)),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))},this.mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))},this.mouseenter=t=>{if("click"===this.options.trigger)return;const e=Oe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter((t=>t!==e)):(this.selectedItems.push(e),this.changeState(t,"active"))},this.setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r}=this.context,{nodes:i,edges:o,combos:a}=n.getData(),s={},l=e=>Ut(t)?t(e):t,u={node:"circle",edge:"line",combo:"rect"},c={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},h=(t,e)=>{t.forEach((t=>{const{id:n}=t,i=Oe(t,["data",l(t)]),o=(null==r?void 0:r.getElementType(e,t))||"circle",a=((t,e)=>null==r?void 0:r.getElementComputedStyle(t,e))(e,t),h=("edge"===e?null==a?void 0:a.stroke:null==a?void 0:a.fill)||"#1783ff";n&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),s[i]||(s[i]={id:`${e}__${n}`,label:i,marker:c[o]||u[e],elementType:e,lineWidth:1,stroke:h,fill:h}))}))};switch(e){case"node":h(i,"node");break;case"edge":h(o,"edge");break;case"combo":h(a,"combo");break;default:return[]}return Object.values(s)},this.createElement=()=>{if(this.draw)return void this.updateElement();const t=this.options,{width:e,height:n,nodeField:r,edgeField:i,comboField:o,trigger:a,position:s,container:l,containerStyle:u,className:c}=t,h=Fe(t,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),d=this.getMarkerData(r,"node"),f=this.getMarkerData(i,"edge"),p=this.getMarkerData(o,"combo"),g=[...d,...p,...f],v=Object.assign({width:e,height:n,data:g,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:d.length},h,this.getEvents()),m=new EW({className:"legend",style:v});this.category=m;this.upsertCanvas().appendChild(m),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.container)||void 0===e||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:r=e,height:i=n,position:o,container:a,containerStyle:s,className:l}=this.options,[u,c]=nH({width:r,height:i,graphCanvas:t,container:a,containerStyle:s,placement:o,className:"legend"});return this.container=u,l&&u.classList.add(l),this.canvas=c,this.canvas}destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}rH.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class iH extends nB{constructor(t,e){super(t,Object.assign({},iH.defaultOptions,e)),this.onDraw=t=>{var e;(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.render)||this.onRender()},this.shapes=new Map,this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=t=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(t.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=t=>{if(!this.mask||!this.isMaskDragging)return;const{size:[e,n]}=this.options,{movementX:r,movementY:i}=t,{left:o,top:a,width:s,height:l}=this.mask.style,[,,u,c]=this.maskBBox;let h=parseInt(o)+r,d=parseInt(a)+i,f=parseInt(s),p=parseInt(l);h<0&&(h=0),d<0&&(d=0),h+f>e&&(h=aH(e-f,0)),d+p>n&&(d=aH(n-p,0)),f<u&&(r>0?(h=aH(h-r,0),f=oH(f+r,e)):r<0&&(f=oH(f-r,e))),p<c&&(i>0?(d=aH(d-i,0),p=oH(p+i,n)):i<0&&(p=oH(p-i,n))),Object.assign(this.mask.style,{left:h+"px",top:d+"px",width:f+"px",height:p+"px"});const g=parseInt(o)-h,v=parseInt(a)-d;if(0===g&&0===v)return;const m=this.context.canvas.getCamera().getZoom()/this.canvas.getCamera().getZoom();this.context.graph.translateBy([g*m,v*m],!1)},this.onMaskDragEnd=t=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(t.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=Re((()=>{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=ye((()=>{this.renderMinimap(),this.renderMask()}),this.options.delay,!0)}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.onDraw),e.on(t.GraphEvent.AFTER_RENDER,this.onRender),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.onDraw),e.off(t.GraphEvent.AFTER_RENDER,this.onRender),e.off(t.GraphEvent.AFTER_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:r,edges:i,combos:o}=n;return{nodes:r.filter((e=>t(bh(e),"node"))),edges:i.filter((e=>t(bh(e),"edge"))),combos:o.filter((e=>t(bh(e),"combo")))}}setShapes(t,e){const{nodes:n,edges:r,combos:i}=e,{shape:o}=this.options,{element:a}=this.context;if("key"===o){const e=new Set,o=n=>{const r=bh(n);e.add(r);const i=a.getElement(r);if(!i)return;const o=i.getShape("key"),s=this.shapes.get(r)||o.cloneNode();s.setPosition(o.getPosition()),i.style.zIndex&&(s.style.zIndex=i.style.zIndex),s.id=i.id,this.shapes.has(r)?Object.entries(o.attributes).forEach((([t,e])=>{s.style[t]!==e&&(s.style[t]=e)})):(t.appendChild(s),this.shapes.set(r,s))};return r.forEach(o),i.forEach(o),n.forEach(o),void this.shapes.forEach(((n,r)=>{e.has(r)||(t.removeChild(n),this.shapes.delete(r))}))}const s=(t,e)=>{const n=a.getElement(t).getPosition();return e.setPosition(n),e};t.removeChildren(),r.forEach((e=>t.appendChild(o(bh(e),"edge")))),i.forEach((e=>{t.appendChild(s(bh(e),o(bh(e),"combo")))})),n.forEach((e=>{t.appendChild(s(bh(e),o(bh(e),"node")))}))}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:r,height:i}=this.canvas.getConfig();e===r&&n===i||this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:r,position:i,container:o,containerStyle:a}=this.options,[s,l]=nH({renderer:t,width:e,height:n,placement:i,className:"minimap",container:o,containerStyle:a,graphCanvas:this.context.canvas});r&&s.classList.add(r),this.container=s,this.canvas=l}return this.setCamera(),this.canvas}createLandmark(t,e,n){const r=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(r))return this.landmarkMap.get(r);const i=this.canvas.getCamera().createLandmark(r,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(r,i),i}setCamera(){var t;const{canvas:e}=this.context,n=null===(t=this.canvas)||void 0===t?void 0:t.getCamera();if(!n)return;const{size:[r,i],padding:o}=this.options,[a,s,l,u]=Yc(o),{min:c,max:h,center:d}=e.getBounds("elements"),f=(r-u-s)/(h[0]-c[0]),p=(i-a-l)/(h[1]-c[1]),g=Math.min(f,p),v=this.createLandmark(d,d,g);n.gotoLandmark(v,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),r=t.getCanvasByViewport(e),i=this.canvas.canvas2Viewport(rd(n)),o=this.canvas.canvas2Viewport(rd(r)),a=o.x-i.x,s=o.y-i.y;return[i.x,i.y,a,s]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,r,i,o]=this.maskBBox;return n<0&&(i=oH(i+n,t),n=0),r<0&&(o=oH(o+r,e),r=0),n+i>t&&(i=aH(t-n,0)),r+o>e&&(o=aH(e-r,0)),[oH(n,t),oH(r,e),aH(i,0),aH(o,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,r]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:r+"px"})}destroy(){var t;this.unbindEvents(),this.canvas.destroy(),null===(t=this.mask)||void 0===t||t.remove(),super.destroy()}}iH.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 oH=(t,e)=>Math.min(t,e),aH=(t,e)=>Math.max(t,e),sH={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class lH extends nB{constructor(t,e){super(t,Object.assign({},lH.defaultOptions,e)),this.initSnapline=()=>{const t=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=t.appendChild(new Wl({style:Object.assign(Object.assign({},sH),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=t.appendChild(new Wl({style:Object.assign(Object.assign({},sH),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(t,e,n)=>ze(this,void 0,void 0,(function*(){const{verticalX:r,horizontalY:i}=n,{tolerance:o}=this.options,{min:[a,s],max:[l,u],center:[c,h]}=e;let d=0,f=0;null!==r&&(uH(l,r)<o&&(d=r-l),uH(a,r)<o&&(d=r-a),uH(c,r)<o&&(d=r-c),0!==d&&(this.isVerticalSticking=!0)),null!==i&&(uH(u,i)<o&&(f=i-u),uH(s,i)<o&&(f=i-s),uH(h,i)<o&&(f=i-h),0!==f&&(this.isHorizontalSticking=!0)),0===d&&0===f||(yield this.context.graph.translateElementBy({[t]:[d,f]},!1))})),this.enableSnap=t=>{const{target:e}=t,n=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[r,i]=this.getDelta(t);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(r)<=n&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,-i]},!1),!1;if(this.isHorizontalSticking&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[0,-i]},!1),!1;if(this.isVerticalSticking&&Math.abs(r)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout((()=>{this.enableStick=!0}),200)}return this.enableStick},this.calcSnaplineMetadata=(t,e)=>{const{tolerance:n,shape:r}=this.options,{min:[i,o],max:[a,s],center:[l,u]}=e;let c=null,h=null,d=null,f=null,p=null,g=null;return this.getNodes().some((e=>{if(Ne(t.id,e.id))return!1;const v=cH(e,r).getRenderBounds(),{min:[m,y],max:[b,x],center:[E,w]}=v;return null===c&&(uH(E,l)<n?c=E:uH(m,i)<n||uH(m,a)<n?c=m:(uH(b,a)<n||uH(b,i)<n)&&(c=b),null!==c&&(h=Math.min(y,o),d=Math.max(x,s))),null===f&&(uH(w,u)<n?f=w:uH(y,o)<n||uH(y,s)<n?f=y:(uH(x,s)<n||uH(x,o)<n)&&(f=x),null!==f&&(p=Math.min(m,i),g=Math.max(b,a))),null!==c&&null!==f})),{verticalX:c,verticalMinY:h,verticalMaxY:d,horizontalY:f,horizontalMinX:p,horizontalMaxX:g}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=t=>ze(this,void 0,void 0,(function*(){const{target:e}=t;if(this.options.autoSnap){if(!this.enableSnap(t))return}const n=cH(e,this.options.shape).getRenderBounds(),r=this.calcSnaplineMetadata(e,n);this.hideSnapline(),null===r.verticalX&&null===r.horizontalY||this.updateSnapline(r),this.options.autoSnap&&(yield this.autoSnapToLine(e.id,n,r))})),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,n=((null===(t=this.context.element)||void 0===t?void 0:t.getNodes())||[]).filter((t=>{var e;return"hidden"!==Oe(t,["style","visibility"])&&(null===(e=this.context.viewport)||void 0===e?void 0:e.isInViewport(t.getRenderBounds()))}));return e?n.filter((t=>e(t))):n}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||sH.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:r,horizontalY:i,horizontalMinX:o,horizontalMaxX:a}=t,[s,l]=this.context.canvas.getSize(),{offset:u}=this.options;null!==i?Object.assign(this.horizontalLine.style,{x1:u===1/0?0:o-u,y1:i,x2:u===1/0?s:a+u,y2:i,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",null!==e?Object.assign(this.verticalLine.style,{x1:e,y1:u===1/0?0:n-u,x2:e,y2:u===1/0?l:r+u,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return zh([t.dx,t.dy],e)}bindEvents(){return ze(this,void 0,void 0,(function*(){const{graph:e}=this.context;e.on(t.NodeEvent.DRAG_START,this.onDragStart),e.on(t.NodeEvent.DRAG,this.onDrag),e.on(t.NodeEvent.DRAG_END,this.onDragEnd)}))}unbindEvents(){const{graph:e}=this.context;e.off(t.NodeEvent.DRAG_START,this.onDragStart),e.off(t.NodeEvent.DRAG,this.onDrag),e.off(t.NodeEvent.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;null===(t=this.horizontalLine)||void 0===t||t.destroy(),null===(e=this.verticalLine)||void 0===e||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}lH.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const uH=(t,e)=>Math.abs(t-e),cH=(t,e)=>"function"==typeof e?e(t):t.getShape(e),hH=["timestamp","time","date","datetime"];class dH extends nB{get padding(){return Yc(this.options.padding)}constructor(t,e){super(t,Object.assign({},dH.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){var t;null===(t=this.timebar)||void 0===t||t.play()}pause(){var t;null===(t=this.timebar)||void 0===t||t.pause()}forward(){var t;null===(t=this.timebar)||void 0===t||t.forward()}backward(){var t;null===(t=this.timebar)||void 0===t||t.backward()}reset(){var t;null===(t=this.timebar)||void 0===t||t.reset()}update(t){super.update(t),this.backup(),this.upsertTimebar()}backup(){this.originalData=fH(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:r,data:i,x:o,y:a,width:s,height:l,mode:u}=e,c=Fe(e,["onChange","timebarType","data","x","y","width","height","mode"]),h=t.getSize(),[d]=this.padding;this.upsertCanvas().ready.then((()=>{var t;const e=Object.assign(Object.assign({x:h[0]/2-s/2,y:d,onChange:t=>{const e=($t(t)?t:[t,t]).map((t=>function(t){return t instanceof Date}(t)?t.getTime():t));"modify"===this.options.mode?this.filterElements(e):this.hiddenElements(e),null==n||n(e)}},c),{data:i.map((t=>ae(t)?{time:t,value:0}:t)),width:s,height:l,type:r});this.timebar?this.timebar.update(e):(this.timebar=new eH({style:e}),null===(t=this.canvas)||void 0===t||t.appendChild(this.timebar))}))}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,r=this.context.canvas,[i]=r.getSize(),[o,,a]=this.padding,[s,l]=nH({width:i,height:e+o+a,graphCanvas:r,className:"timebar",placement:n});return this.container=s,t&&s.classList.add(t),this.canvas=l,this.canvas}filterElements(t){return ze(this,void 0,void 0,(function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:r}=this.options,{graph:i,element:o}=this.context,a=fH(this.originalData);n.forEach((e=>{const n=`${e}s`;a[n]=(this.originalData[n]||[]).filter((e=>{const n=r(e);return!!pH(n,t)}))}));const s=[...a.nodes,...a.combos].map((t=>bh(t)));a.edges=a.edges.filter((t=>{const e=t.source,n=t.target;return s.includes(e)&&s.includes(n)})),i.setData(a),yield null===(e=o.draw({animation:!1,silence:!0}))||void 0===e?void 0:e.finished}))}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:r}=this.options,i=[],o=[];n.forEach((e=>{var n;const a=`${e}s`;((null===(n=this.originalData)||void 0===n?void 0:n[a])||[]).forEach((e=>{const n=bh(e),a=r(e);pH(a,t)?o.push(n):i.push(n)}))})),e.hideElement(i,!1),e.showElement(o,!1)}destroy(){var t,e,n;const{graph:r}=this.context;this.originalData&&r.setData(Object.assign({},this.originalData)),null===(t=this.timebar)||void 0===t||t.destroy(),null===(e=this.canvas)||void 0===e||e.destroy(),null===(n=this.container)||void 0===n||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}dH.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:t=>gH(t,hH,void 0),loop:!1};const fH=t=>{const{nodes:e=[],edges:n=[],combos:r=[]}=t;return{nodes:[...e],edges:[...n],combos:[...r]}},pH=(t,e)=>{if(ae(e))return t===e;const[n,r]=e;return t>=n&&t<=r},gH=(t,e,n)=>{var r;for(let n=0;n<e.length;n++){const i=e[n],o=null===(r=t.data)||void 0===r?void 0:r[i];if(o)return o}return n};class vH extends nB{constructor(t,e){super(t,Object.assign({},vH.defaultOptions,e)),this.$element=rB("toolbar",!1),this.onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");null==e||e(n,t.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),iB("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n }\n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),iB("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">\n <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>\n <symbol id="request-fullscreen" viewBox="0 0 1024 1024">\n <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return ze(this,void 0,void 0,(function*(){e.update.call(this,t);const{className:n,position:r,style:i}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,i,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach((t=>{e[t]="8px"})),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(r)),this.$element.innerHTML=yield this.getDOMContent()}))}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return ze(this,void 0,void 0,(function*(){return(yield this.options.getItems()).map((t=>`\n <div class="g6-toolbar-item" value="${t.value}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`)).join("")}))}}vH.defaultOptions={position:"top-left"};class mH extends nB{constructor(t,e){super(t,Object.assign({},mH.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=t=>{const{enable:e}=this.options;return"function"==typeof e?e(t):e},this.onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?this.hide(t):this.show(t)},this.onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.show(t)},this.onPointerLeave=t=>{this.hide(t)},this.onCanvasMove=t=>{this.hide(t)},this.onPointerEnter=t=>{this.show(t)},this.showById=t=>{const e={target:{id:t}};this.show(e)},this.getElementData=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}},this.show=t=>{var e,n;const{client:r,target:{id:i}}=t;if(jg(t.target))return;if(!this.tooltipElement||!this.isEnable(t))return;const o=this.context.graph.getElementType(i),{getContent:a,title:s}=this.options;this.currentTarget=i;const l=this.getElementData(i,o);let u,c;if(r)u=r.x,c=r.y;else{const t=Oe(l,"0.style",{x:0,y:0});u=t.x,c=t.y}let h={};if(a)h.content=a(t,l);else{const t=this.context.graph.getElementRenderStyle(i),e="node"===o?t.fill:t.stroke;h={title:s||o,data:l.map((t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:e})))}}null===(n=(e=this.options).onOpenChange)||void 0===n||n.call(e,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:u,y:c,style:{".tooltip":{visibility:"visible"}}}),h))},this.hide=t=>{var e,n,r,i,o;if(!t)return null===(n=(e=this.options).onOpenChange)||void 0===n||n.call(e,!1),null===(r=this.tooltipElement)||void 0===r||r.hide(),void(this.currentTarget=null);if(!this.tooltipElement)return;if(!this.currentTarget)return;const{client:{x:a,y:s}}=t;null===(o=(i=this.options).onOpenChange)||void 0===o||o.call(i,!1),this.tooltipElement.hide(a,s),this.currentTarget=null},this.initTooltip=()=>{var t;const e=new TW({className:"tooltip",style:this.tooltipStyleProps});return null===(t=this.container)||void 0===t||t.appendChild(e.HTMLTooltipElement),e},this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node: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&&(null===(e=this.container)||void 0===e||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.off(n,e[n])}))}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.on(n,e[n])}))}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:a,enterable:s,container:l={x:-i,y:-r},title:u,offset:c}=this.options,[h,d]=e,[f,p]=t.getSize();return{x:h,y:d,container:l,title:u,bounding:{x:0,y:0,width:f,height:p},position:a,enterable:s,offset:c,style:o}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&(null===(t=this.container)||void 0===t||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}let yH;function bH(t,e){yH||(yH=document.createElement("canvas")),yH.width=t,yH.height=e;return yH.getContext("2d").clearRect(0,0,t,e),yH}mH.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};class xH extends nB{constructor(t,e){super(t,Object.assign({},xH.defaultOptions,e)),this.$element=rB("watermark");this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return ze(this,void 0,void 0,(function*(){e.update.call(this,t);const n=this.options,{width:r,height:i,text:o,imageURL:a}=n,s=Fe(n,["width","height","text","imageURL"]);Object.keys(s).forEach((e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])}));const l=a?yield function(t,e,n,r){return ze(this,void 0,void 0,(function*(){const i=bH(t,e),o=i.getContext("2d"),{rotate:a,opacity:s}=r;a&&o.rotate(a),s&&(o.globalAlpha=s);const l=new Image;return l.crossOrigin="anonymous",l.src=n,new Promise((n=>{l.onload=function(){const r=t>l.width?(t-l.width)/2:0,a=e>l.height?(e-l.height)/2:0;o.drawImage(l,0,0,l.width,l.height,r,a,t-2*r,e-2*a),n(i.toDataURL())}}))}))}(r,i,a,s):yield function(t,e,n,r){return ze(this,void 0,void 0,(function*(){const i=bH(t,e),o=i.getContext("2d"),{rotate:a,opacity:s,textFill:l,textFontSize:u,textFontFamily:c,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:p}=r;return o.textAlign=f,o.textBaseline=p,o.translate(t/2,e/2),o.font=`${u}px ${c} ${h} ${d}`,a&&o.rotate(a),s&&(o.globalAlpha=s),l&&(o.fillStyle=l,o.fillText(`${n}`,0,0)),i.toDataURL()}))}(r,i,o,s);this.$element.style.backgroundImage=`url(${l})`}))}destroy(){super.destroy(),this.$element.remove()}}xH.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"],wH={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},kH={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function MH(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeHaloStrokeOpacityActive:a=.15,nodeHaloStrokeOpacitySelected:s=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:h=EH,nodePaletteOptions:d=wH,edgeColor:f,edgeColorDisabled:p,edgePaletteOptions:g=kH,comboColor:v,comboColorDisabled:m,comboStroke:y,comboStrokeDisabled:b,edgeColorInactive:x}=t;return{background:e,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:r,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:n,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65,size:32,stroke:o,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:s,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:o},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:a},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:o,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:u,labelFill:n,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:n,labelFillOpacity:.25,strokeOpacity:l}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:f,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:f,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:x,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:p,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:e,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:v,halo:!1,haloLineWidth:12,haloStroke:y,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:y},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:m,fillOpacity:.25,labelOpacity:.25,stroke:b,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const SH=MH({bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:{type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"}),NH=MH({bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"});class OH extends Dh{beforeDraw(t,e){return t}afterLayout(){}}function TH(t,e,n,r,i){const o=bh(r),a=`${n}s`,s=i?r:t.add[a].get(o)||t.update[a].get(o)||t.remove[a].get(o)||r;Object.entries(t).forEach((([t,n])=>{e===t?n[a].set(o,s):n[a].delete(o)}))}function CH(t,e){return Object.keys(t).every((n=>t[n]===e[n]))}const AH=(t,e,n,r)=>{const i=`${n}s`,o=bh(r);t.add[i].has(o)||t.update[i].has(o)||t[e][i].set(bh(r),r)};function PH(t,e,n,r=!1){const i=Sc[t][e];!r&&i?i!==n&&Cc(`The extension ${e} of ${t} has been registered before.`):Object.assign(Sc[t],{[e]:n})}
72
72
  /*!
73
73
  * @antv/g-plugin-dragndrop
74
74
  * @description A G plugin for Drag n Drop implemented with PointerEvents
@@ -76,4 +76,4 @@ var pu=function(t){function e(t,n,r,i){var o;return s(this,e),(o=v(this,e,[t])).
76
76
  * @date 11/27/2024, 2:17:21 PM
77
77
  * @author AntVis
78
78
  * @docs https://g.antv.antgroup.com/
79
- */gH.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};var mH=function(){function t(e){s(this,t),this.dragndropPluginOptions=e}return u(t,[{key:"apply",value:function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,a=function(t){var e=t.target,r=e===i,a=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(a){var s=!1,l=t.timeStamp,u=[t.clientX,t.clientY],c=null,h=[t.clientX,t.clientY],d=function(){var t=Pr(Cr().mark((function t(o){var d,f,p,g,v,m;return Cr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=8;break}if(d=o.timeStamp-l,f=gn([o.clientX,o.clientY],u),!(d<=n.dragndropPluginOptions.dragstartTimeThreshold||f<=n.dragndropPluginOptions.dragstartDistanceThreshold)){t.next=5;break}return t.abrupt("return");case 5:o.type="dragstart",a.dispatchEvent(o),s=!0;case 8:if(o.type="drag",o.dx=o.clientX-h[0],o.dy=o.clientY-h[1],a.dispatchEvent(o),h=[o.clientX,o.clientY],r){t.next=21;break}return p="pointer"===n.dragndropPluginOptions.overlap?[o.canvasX,o.canvasY]:e.getBounds().center,t.next=17,i.elementsFromPoint(p[0],p[1]);case 17:g=t.sent,v=g[g.indexOf(e)+1],m=(null==v?void 0:v.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?i:null),c!==m&&(c&&(o.type="dragleave",o.target=c,c.dispatchEvent(o)),m&&(o.type="dragenter",o.target=m,m.dispatchEvent(o)),(c=m)&&(o.type="dragover",o.target=c,c.dispatchEvent(o)));case 21:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();o.addEventListener("pointermove",d);var f=function(t){if(s){t.detail={preventClick:!0};var e=t.clone();c&&(e.type="drop",e.target=c,c.dispatchEvent(e)),e.type="dragend",a.dispatchEvent(e),s=!1}o.removeEventListener("pointermove",d)};e.addEventListener("pointerup",f,{once:!0}),e.addEventListener("pointerupoutside",f,{once:!0})}};r.hooks.init.tap(t.tag,(function(){o.addEventListener("pointerdown",a)})),r.hooks.destroy.tap(t.tag,(function(){o.removeEventListener("pointerdown",a)}))}}])}();mH.tag="Dragndrop";var yH=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),(t=v(this,e)).name="dragndrop",t.options=n,t}return y(e,t),u(e,[{key:"init",value:function(){this.addRenderingPlugin(new mH(a({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)}}])}(Br);const bH=["main"],xH=["background","main","label","transient"];class EH{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||this.getLayers().main}getLayers(){return this.extends.layers}getRenderer(t){return this.extends.renderers[t]}getCamera(t="main"){return this.getLayer(t).getCamera()}getRoot(t="main"){return this.getLayer(t).getRoot()}getContextService(t="main"){return this.getLayer(t).getContextService()}setCursor(t){this.config.cursor=t,this.getLayer().setCursor(t)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(t){this.config={enableMultiLayer:!0},Object.assign(this.config,t);const e=this.config,{renderer:n,background:r,cursor:i,enableMultiLayer:o}=e,a=Fe(e,["renderer","background","cursor","enableMultiLayer"]),s=o?xH:bH,l=wH(n,s),u=Object.fromEntries(s.map((t=>[t,new du(Object.assign(Object.assign({},a),{supportsMutipleCanvasesInOneContainer:o,renderer:l[t],background:o?"background"===t?r:void 0:r}))])));kH(u),this.extends={config:this.config,renderer:n,renderers:l,layers:u}}get ready(){return Promise.all(Object.entries(this.getLayers()).map((([,t])=>t.ready)))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach((n=>{const r=n.getCamera(),i=r.getPosition(),o=r.getFocalPoint();n.resize(t,e),r.setPosition(i),r.setFocalPoint(o)}))}getBounds(t){return th(Object.values(this.getLayers()).map((e=>t?e.getRoot().childNodes.find((e=>e.classList.includes(t))):e.getRoot())).filter((t=>(null==t?void 0:t.childNodes.length)>0)).map((t=>t.getBounds())))}getContainer(){const t=this.extends.config.container;return"string"==typeof t?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const r=(null===(n=t.style)||void 0===n?void 0:n.$layer)||"main";return this.getLayer(r).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=wH(t,this.config.enableMultiLayer?xH:bH);this.extends.renderers=e,Object.entries(e).forEach((([t,e])=>this.getLayer(t).setRenderer(e))),kH(this.getLayers())}getCanvasByViewport(t){return nd(this.getLayer().viewport2Canvas(rd(t)))}getViewportByCanvas(t){return nd(this.getLayer().canvas2Viewport(rd(t)))}getViewportByClient(t){return nd(this.getLayer().client2Viewport(rd(t)))}getClientByViewport(t){return nd(this.getLayer().viewport2Client(rd(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(rd(t));return nd(e.viewport2Canvas(n))}toDataURL(){return ze(this,arguments,void 0,(function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,r=Fe(t,["mode"]);let[i,o,a,s]=[0,0,0,0];if("viewport"===n)[a,s]=this.getSize();else if("overall"===n){const t=this.getBounds(),e=Kc(t);[i,o]=t.min,[a,s]=e}const l=Cn('<div id="virtual-image"></div>'),u=new du({width:a,height:s,renderer:new Np,devicePixelRatio:e,container:l,background:this.extends.config.background});yield u.ready,u.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),u.appendChild(this.getRoot().cloneNode(!0));const c=this.getLayer("label").getRoot().cloneNode(!0),h=u.viewport2Canvas({x:0,y:0}),d=this.getCanvasByViewport([0,0]);c.translate([d[0]-h.x,d[1]-h.y]),c.scale(1/this.getCamera().getZoom()),u.appendChild(c),u.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const f=this.getCamera(),p=u.getCamera();if("viewport"===n)p.setZoom(f.getZoom()),p.setPosition(f.getPosition()),p.setFocalPoint(f.getFocalPoint());else if("overall"===n){const[t,e,n]=p.getPosition(),[r,a,s]=p.getFocalPoint();p.setPosition([t+i,e+o,n]),p.setFocalPoint([r+i,a+o,s])}const g=u.getContextService();return new Promise((t=>{u.addEventListener(au.RERENDER,(()=>ze(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,300)));const e=yield g.toDataURL(r);t(e)}))))}))}))}destroy(){Object.values(this.getLayers()).forEach((t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()}))}}function wH(t,e){return Object.fromEntries(e.map((e=>{const n=(null==t?void 0:t(e))||new Np;return"main"===e?n.registerPlugin(new yH({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]})))}function kH(t){Object.entries(t).forEach((([t,e])=>{const n=e.getContextService().getDomElement();(null==n?void 0:n.style)&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")),(null==n?void 0:n.parentElement)&&(n.parentElement.style.display="grid")}))}const MH=t=>t?parseInt(t):0;function SH(t){if(!t)return[0,0];let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||MH(e.width),r=t.clientHeight||MH(e.height);return[n-(MH(e.paddingLeft)+MH(e.paddingRight)),r-(MH(e.paddingTop)+MH(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(ae(e)?e:1,1),Math.max(ae(n)?n:1,1)]}class NH{constructor(t){this.type=t}}class OH extends NH{constructor(t,e){super(t),this.data=e}}class TH extends NH{constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class CH extends NH{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class AH extends NH{constructor(t,e){super(t),this.data=e}}function PH(t,e){t.emit(e.type,e)}function RH(t){var e;return(null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0}const DH="cachedStyle",LH=t=>`__${t}__`;function _H(t,e){return Oe(t,[DH,LH(e)])}class IH{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var r,i,o;null===(r=null==e?void 0:e.before)||void 0===r||r.call(e);const a=this.getTasks().map((([e,r])=>{var i,o,a;const{element:s,elementType:l,stage:u}=e,c=_c(this.context.options,l,u,t);null===(i=null==r?void 0:r.before)||void 0===i||i.call(r);const h=c.length?jc(s,this.inferStyle(e,n),c):null;return h?(null===(o=null==r?void 0:r.beforeAnimate)||void 0===o||o.call(r,h),h.finished.then((()=>{var t,e;null===(t=null==r?void 0:r.afterAnimate)||void 0===t||t.call(r,h),null===(e=null==r?void 0:r.after)||void 0===e||e.call(r),this.animations.delete(h)}))):null===(a=null==r?void 0:r.after)||void 0===a||a.call(r),h})).filter(Boolean);a.forEach((t=>this.animations.add(t)));const s=Pc(a);return s?(null===(i=null==e?void 0:e.beforeAnimate)||void 0===i||i.call(e,s),s.finished.then((()=>{var t,n;null===(t=null==e?void 0:e.afterAnimate)||void 0===t||t.call(e,s),null===(n=null==e?void 0:e.after)||void 0===n||n.call(e),this.release()}))):null===(o=null==e?void 0:e.after)||void 0===o||o.call(e),s}inferStyle(t,e){var n,r;const{element:i,elementType:o,stage:a,originalStyle:s,updatedStyle:l={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},s),l));const{modifiedStyle:u}=t,c={},h={};if("enter"===a)Object.assign(c,{opacity:0});else if("exit"===a)Object.assign(h,{opacity:0});else if("show"===a)Object.assign(c,{opacity:0}),Object.assign(h,{opacity:null!==(n=_H(i,"opacity"))&&void 0!==n?n:Dc("opacity")});else if("hide"===a)Object.assign(c,{opacity:null!==(r=_H(i,"opacity"))&&void 0!==r?r:Dc("opacity")}),Object.assign(h,{opacity:0});else if("collapse"===a){const{collapse:t}=e||{},{target:n,descendants:r,position:a}=t;if("node"===o){if(r.includes(i.id)){const[t,e,n]=a;Object.assign(h,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e]=a;Object.assign(h,{x:t,y:e,childrenNode:s.childrenNode})}}else"edge"===o&&Object.assign(h,{sourceNode:u.sourceNode,targetNode:u.targetNode})}else if("expand"===a){const{expand:t}=e||{},{target:n,descendants:r,position:a}=t;if("node"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=a;Object.assign(c,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=a;Object.assign(c,{x:t,y:e,z:n,childrenNode:u.childrenNode})}}else"edge"===o&&Object.assign(c,{sourceNode:u.sourceNode,targetNode:u.targetNode})}return[Object.keys(c).length>0?Object.assign({},s,c):s,Object.keys(h).length>0?Object.assign({},u,h):u]}stop(){this.animations.forEach((t=>t.cancel()))}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,r=null===(e=null===(t=n.document)||void 0===t?void 0:t.timeline)||void 0===e?void 0:e.animationsWithPromises;r&&(n.document.timeline.animationsWithPromises=r.filter((t=>"finished"!==t.playState)))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class jH{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(e=!0){this.batchCount++,1===this.batchCount&&this.emit(new OH(t.GraphEvent.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,0===this.batchCount&&this.emit(new OH(t.GraphEvent.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class BH extends Rh{constructor(e){super(e),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof tu)return{type:"canvas",element:t};let e=t;for(;e;){if(kg(e))return{type:"node",element:e};if(Mg(e))return{type:"edge",element:e};if(Sg(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:a,element:s}=r;if("destroyed"in s&&(jg(s)||s.destroyed))return;const{type:l,detail:u,button:c}=e,h=Object.assign(Object.assign({},e),{target:s,targetType:a,originalTarget:n});l===t.CommonEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${this.currentTargetType}:${t.CommonEvent.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:t.CommonEvent.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),s&&(Object.assign(h,{type:t.CommonEvent.POINTER_ENTER}),i.emit(`${a}:${t.CommonEvent.POINTER_ENTER}`,h))),this.currentTarget=s,this.currentTargetType=a),l===t.CommonEvent.CLICK&&2===c||(i.emit(`${a}:${l}`,h),i.emit(l,h)),l===t.CommonEvent.CLICK&&2===u&&(Object.assign(h,{type:t.CommonEvent.DBLCLICK}),i.emit(`${a}:${t.CommonEvent.DBLCLICK}`,h),i.emit(t.CommonEvent.DBLCLICK,h)),l===t.CommonEvent.POINTER_DOWN&&2===c&&(Object.assign(h,{type:t.CommonEvent.CONTEXT_MENU,preventDefault:()=>{var e;null===(e=o.getContainer())||void 0===e||e.addEventListener(t.CommonEvent.CONTEXT_MENU,(t=>t.preventDefault()),{once:!0})}}),i.emit(`${a}:${t.CommonEvent.CONTEXT_MENU}`,h),i.emit(t.CommonEvent.CONTEXT_MENU,h))},this.forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.addEventListener(t,this.forwardContainerEvents)}));const n=this.context.canvas.document;n&&[t.CommonEvent.CLICK,t.CommonEvent.DBLCLICK,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE,t.CommonEvent.POINTER_ENTER,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_OUT,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_UP,t.CommonEvent.CONTEXT_MENU,t.CommonEvent.DRAG_START,t.CommonEvent.DRAG,t.CommonEvent.DRAG_END,t.CommonEvent.DRAG_ENTER,t.CommonEvent.DRAG_OVER,t.CommonEvent.DRAG_LEAVE,t.CommonEvent.DROP,t.CommonEvent.WHEEL].forEach((t=>{n.addEventListener(t,this.forwardCanvasEvents)}))}destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.removeEventListener(t,this.forwardContainerEvents)})),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function FH(t,e){const{data:n,style:r}=t,i=Fe(t,["data","style"]),{data:o,style:a}=e,s=Fe(e,["data","style"]),l=Object.assign(Object.assign({},i),s);return(n||o)&&Object.assign(l,{data:Object.assign(Object.assign({},n),o)}),(r||a)&&Object.assign(l,{style:Object.assign(Object.assign({},r),a)}),l}function zH(t){const{data:e,style:n}=t,r=Fe(t,["data","style"]);return e&&(r.data=Object.assign({},e)),n&&(r.style=Object.assign({},n)),r}function GH(t={},e={}){const{states:n=[],data:r={},style:i={},children:o=[]}=t,a=Fe(t,["states","data","style","children"]),{states:s=[],data:l={},style:u={},children:c=[]}=e,h=(t,e)=>t.length===e.length&&t.every(((t,n)=>t===e[n])),d=(t,e)=>{const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((n=>t[n]===e[n]))};return!!d(a,Fe(e,["states","data","style","children"]))&&(!!h(o,c)&&(!!h(n,s)&&(!!d(r,l)&&!!d(i,u))))}function VH(t){const{id:e=bh(t),style:n,data:r}=t,i=Fe(t,["id","style","data"]),o=Object.assign(Object.assign({},t),{style:Object.assign({},n),data:Object.assign({},r)});return function(t){return"source"in t&&"target"in t}(t)?Object.assign({id:e,data:o},i):{id:e,data:o}}function WH(t){return t.data}class HH{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new qg}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===fc.NodeUpdated||e===fc.EdgeUpdated||e===fc.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:zH(n),original:zH(r),type:e})}else this.changes.push({value:zH(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}isBatching(){return this.batchCount>0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=WH(n);return this.isCombo(bh(r))||(void 0===t||t.includes(bh(r)))&&e.push(r),e}),[])}getEdgeDatum(t){return WH(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce(((e,n)=>{const r=WH(n);return(void 0===t||t.includes(bh(r)))&&e.push(r),e}),[])}getComboData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=WH(n);return this.isCombo(bh(r))?((void 0===t||t.includes(bh(r)))&&e.push(r),e):e}),[])}getRootsData(t=kc){return this.model.getRoots(t).map(WH)}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(WH):[]}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Ed(e,(t=>{t!==e&&n.push(t)}),(t=>this.getChildrenData(bh(t))),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e)return void Cc("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?WH(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?kc:wc,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(WH):[]}getElementsDataByType(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementDataById(t){return"edge"===this.getElementType(t)?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){return WH(this.model.getNode(t))}getNodeLikeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=WH(n);return t?t.includes(bh(r))&&e.push(r):e.push(r),e}),[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter((t=>{var n;return null===(n=t.states)||void 0===n?void 0:n.includes(e)}))}getElementState(t){var e;return(null===(e=this.getElementDataById(t))||void 0===e?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(WH)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(WH)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i,edges:o,combos:a}=this.getData(),s=Ah(i,e,(t=>bh(t)),GH),l=Ah(o,n,(t=>bh(t)),GH),u=Ah(a,r,(t=>bh(t)),GH);this.batch((()=>{const t={nodes:s.enter,edges:l.enter,combos:u.enter};this.addData(t),this.computeZIndex(t,"add",!0);const e={nodes:s.update,edges:l.update,combos:u.update};this.updateData(e),this.computeZIndex(e,"update",!0);const n={nodes:s.exit.map(bh),edges:l.exit.map(bh),combos:u.exit.map(bh)};this.removeData(n)}))}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)})),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map((t=>(this.pushChange({value:t,type:fc.NodeAdded}),VH(t))))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map((t=>(this.pushChange({value:t,type:fc.EdgeAdded}),VH(t))))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(wc)||e.attachTreeStructure(wc),e.addNodes(t.map((t=>(this.comboIds.add(bh(t)),this.pushChange({value:t,type:fc.ComboAdded}),VH(t))))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),r=e.map(bh);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...r]}]),this.addEdgeData(r.map((e=>({source:t,target:e}))))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch((()=>{const{nodes:n=[],edges:r=[],combos:i=[]}=t;i.forEach((t=>{var n,r,i;const o=bh(t);if("add"===e&&ae(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t))return;const a=this.getParentData(o,wc),s=a?(null!==(i=null===(r=a.style)||void 0===r?void 0:r.zIndex)&&void 0!==i?i:0)+1:0;this.preventUpdateNodeLikeHierarchy((()=>{this.updateComboData([{id:o,style:{zIndex:s}}])}))})),n.forEach((t=>{var n,r,i;const o=bh(t);if("add"===e&&ae(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t)&&!("children"in t))return;let a=0;const s=this.getParentData(o,wc);if(s)a=((null===(r=s.style)||void 0===r?void 0:r.zIndex)||0)+1;else{const t=this.getParentData(o,kc);t&&(a=(null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.zIndex)||0)}this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:o,style:{zIndex:a}}])}))})),r.forEach((t=>{var e,n,r,i,o;if(ae(null===(e=t.style)||void 0===e?void 0:e.zIndex))return;let{id:a,source:s,target:l}=t;if(a){const t=this.getEdgeDatum(a);s=t.source,l=t.target}else a=bh(t);if(!s||!l)return;const u=(null===(r=null===(n=this.getNodeLikeDatum(s))||void 0===n?void 0:n.style)||void 0===r?void 0:r.zIndex)||0,c=(null===(o=null===(i=this.getNodeLikeDatum(l))||void 0===i?void 0:i.style)||void 0===o?void 0:o.zIndex)||0;this.updateEdgeData([{id:bh(t),style:{zIndex:Math.max(u,c)-1}}])}))}))}getFrontZIndex(t){var e;const n=this.getElementType(t),r=this.getElementDataById(t),i=this.getData();if(Object.assign(i,{[`${n}s`]:i[`${n}s`].filter((e=>bh(e)!==t))}),"combo"===n&&!Nd(r)){const e=new Set(this.getAncestorsData(t,wc).map(bh));i.nodes=i.nodes.filter((t=>!e.has(bh(t)))),i.combos=i.combos.filter((t=>!e.has(bh(t)))),i.edges=i.edges.filter((({source:t,target:n})=>!e.has(t)&&!e.has(n)))}return Math.max((null===(e=r.style)||void 0===e?void 0:e.zIndex)||0,0,...Object.values(i).flat().map((t=>{var e;return((null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0)+1})))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach((t=>{const n=bh(t),r=xh(t);void 0!==r&&(e.hasTreeStructure(wc)||e.attachTreeStructure(wc),null===r&&this.refreshComboData(n),this.setParent(n,xh(t),wc));const i=t.children||[];if(i.length){e.hasTreeStructure(kc)||e.attachTreeStructure(kc);const t=i.filter((t=>e.hasNode(t)));t.forEach((t=>this.setParent(t,n,kc))),t.length!==i.length&&this.updateNodeData([{id:n,children:t}])}}))}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)})),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{const n=[];t.forEach((t=>{const r=bh(t),i=WH(e.getNode(r));if(GH(i,t))return;const o=FH(i,t);this.pushChange({value:o,original:i,type:fc.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)})),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach((t=>{this.pushChange({value:t,original:t,type:fc.NodeUpdated})})),e.forEach((t=>{this.pushChange({value:t,original:t,type:fc.EdgeUpdated})})),n.forEach((t=>{this.pushChange({value:t,original:t,type:fc.ComboUpdated})}))}syncNodeDatum(t){const{model:e}=this,n=bh(t),r=FH(WH(e.getNode(n)),t);e.mergeNodeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{t.forEach((t=>{const n=bh(t),r=WH(e.getEdge(n));if(GH(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=FH(r,t);this.pushChange({value:i,original:r,type:fc.EdgeUpdated}),e.mergeEdgeData(n,i)}))})),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch((()=>{const n=[];t.forEach((t=>{const r=bh(t),i=WH(e.getNode(r));if(GH(i,t))return;const o=FH(i,t);this.pushChange({value:o,original:i,type:fc.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)})),this.computeZIndex({combos:t},"update")}setParent(t,e,n,r=!0){if(t===e)return;const i=xh(this.getNodeLikeDatum(t));if(i!==e&&n===wc){const n={id:t,combo:e};this.isCombo(t)?this.syncComboDatum(n):this.syncNodeDatum(n)}this.model.setParent(t,e,n),r&&n===wc&&function(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}([i,e]).forEach((t=>{void 0!==t&&this.refreshComboData(t)}))}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,wc);e&&this.pushChange({value:e,original:e,type:fc.ComboUpdated}),n.forEach((t=>{this.pushChange({value:t,original:t,type:fc.ComboUpdated})}))}syncComboDatum(t){const{model:e}=this,n=bh(t);if(!e.hasNode(n))return;const r=FH(WH(e.getNode(n)),t);e.mergeNodeData(n,r)}getElementPosition(t){return Jh(this.getElementDataById(t))}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=jh(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])}))}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every((t=>0===t)))return;const o=this.getComboData([t])[0];if(!o)return;const a=new Set;Ed(o,(t=>{const e=bh(t);if(a.has(e))return;a.add(e);const[o,s,l]=Jh(t),u=FH(t,{style:{x:o+n,y:s+r,z:l+i}});this.pushChange({value:u,original:t,type:this.isCombo(e)?fc.ComboUpdated:fc.NodeUpdated}),this.model.mergeNodeData(e,u)}),(t=>this.getChildrenData(bh(t))),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[r=0,i=0,o=0]=e,a=null===(n=this.getComboData([t]))||void 0===n?void 0:n[0];if(!a)return;const[s,l,u]=Jh(a),c=r-s,h=i-l,d=o-u;Ed(a,(t=>{const e=bh(t),[n,r,i]=Jh(t),o=FH(t,{style:{x:n+c,y:r+h,z:i+d}});this.pushChange({value:o,original:t,type:this.isCombo(e)?fc.ComboUpdated:fc.NodeUpdated}),this.model.mergeNodeData(e,o)}),(t=>this.getChildrenData(bh(t))),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)}))}removeNodeData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(bh)),this.pushChange({value:this.getNodeData([t])[0],type:fc.NodeRemoved}),this.removeNodeLikeHierarchy(t)})),this.model.removeNodes(t)}))}removeEdgeData(t=[]){t.length&&(t.forEach((t=>this.pushChange({value:this.getEdgeData([t])[0],type:fc.EdgeRemoved}))),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.pushChange({value:this.getComboData([t])[0],type:fc.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)})),this.model.removeNodes(t)}))}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(wc)){const e=xh(this.getNodeLikeDatum(t));this.setParent(t,void 0,wc,!1),this.model.getChildren(t,wc).forEach((t=>{const n=WH(t),r=bh(n);this.setParent(bh(n),e,wc,!1);const i=FH(n,{id:bh(n),combo:e});this.pushChange({value:i,original:n,type:this.isCombo(r)?fc.ComboUpdated:fc.NodeUpdated}),this.model.mergeNodeData(bh(n),i)})),Yt(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(Tc(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map((t=>t.id))),t.removeNodes(e.map((t=>t.id))),this.context={}}}class UH{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){if(!this.container){const{canvas:t}=this.context;this.container=t.appendChild(new Bl({className:"elements"}))}}emit(t,e){e.silence||PH(this.context.graph,t)}forEachElementData(t){xd.forEach((e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)}))}getElementType(t,e){var n;const{options:r,graph:i}=this.context,o=(null===(n=r[t])||void 0===n?void 0:n.type)||e.type;return o?"string"==typeof o?o:o.call(i,e):"edge"===t?"line":"circle"}getTheme(t){return Ac(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map((t=>n[t]||{})))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData(((e,n)=>{var r,i;const o=Object.assign({},Bd(null===(r=this.getTheme(e))||void 0===r?void 0:r.palette),Bd(null===(i=t[e])||void 0===i?void 0:i.palette));(null==o?void 0:o.field)&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,a=t=>{const e="string"==typeof r?Nc("palette",r):r;if("function"==typeof e){const n={};return t.forEach((([t,r])=>{n[t]=e(o?1-r:r)})),n}if(Array.isArray(e)){const n=o?[...e].reverse():e,r={};return t.forEach((([t,i])=>{r[t]=n[i%e.length]})),r}return{}},s=(t,e)=>{var n;return"string"==typeof t?null===(n=e.data)||void 0===n?void 0:n[t]:null==t?void 0:t(e)};if("group"===n){const e=ie(t,(t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"})),n=a(Object.keys(e).map(((t,e)=>[t,e]))),r={};return Object.entries(e).forEach((([t,e])=>{e.forEach((e=>{r[bh(e)]=n[t]}))})),r}if("value"===n){const[e,n]=t.reduce((([t,e],n)=>{const r=s(i,n);if("number"!=typeof r)throw new Error(Tc(`Palette field ${i} is not a number`));return[Math.min(t,r),Math.max(e,r)]}),[1/0,-1/0]),r=n-e;return a(t.map((t=>[t.id,(s(i,t)-e)/r])))}}(n,o))}))}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?"edge"===t?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:r}=this.context,i=(null===(n=r[t])||void 0===n?void 0:n.style)||{};"transform"in i&&Array.isArray(i.transform)&&(i.transform=[...i.transform]),this.defaultStyle[bh(e.datum)]=Dd(i,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];(void 0===t||t.includes(bh(i)))&&this.computeElementDefaultStyle(n,{datum:i,graph:e})}}))}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch(t){return[]}}getElementStateStyle(t,e,n){var r,i;const{options:o}=this.context;return Dd((null===(i=null===(r=o[t])||void 0===r?void 0:r.state)||void 0===i?void 0:i[e])||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[bh(n.datum)]=Object.assign({},...e.map((e=>this.getElementStateStyle(t,e,n))))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];if(void 0===t||t.includes(bh(i))){const t=this.getElementState(bh(i));this.computeElementStatesStyle(n,t,{datum:i,graph:e})}}}))}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getNodes(){return this.context.model.getNodeData().map((({id:t})=>this.elementMap[t]))}getEdges(){return this.context.model.getEdgeData().map((t=>this.elementMap[bh(t)]))}getCombos(){return this.context.model.getComboData().map((({id:t})=>this.elementMap[t]))}getElementComputedStyle(t,e){const n=bh(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(t,n),o=e.style||{},a=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),l=this.getStateStyle(n),u=Object.assign({},r,i,o,a,s,l);if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!u.collapsed?[]:t.map(bh).filter((t=>this.getElement(t)));Object.assign(u,{childrenNode:e,childrenData:t})}return u}draw(e={animation:!0}){this.init();const n=this.computeChangesAndDrawData(e);if(!n)return null;const{type:r="draw",stage:i=r,animation:o,silence:a}=e,{dataChanges:s,drawData:l}=n;this.markDestroyElement(l),this.computeStyle(i);const{add:u,update:c,remove:h}=l;return this.destroyElements(h,e),this.createElements(u,e),this.updateElements(c,e),this.context.animation.animate(o,a?{}:{before:()=>this.emit(new OH(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:o,stage:i,render:"render"===r}),e),beforeAnimate:n=>this.emit(new TH(t.GraphEvent.BEFORE_ANIMATE,pc.DRAW,n,l),e),afterAnimate:n=>this.emit(new TH(t.GraphEvent.AFTER_ANIMATE,pc.DRAW,n,l),e),after:()=>this.emit(new OH(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:o,stage:i,render:"render"===r,firstRender:!1===this.context.graph.rendered}),e)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),r=eF(n);if(0===r.length)return null;const{NodeAdded:i=[],NodeUpdated:o=[],NodeRemoved:a=[],EdgeAdded:s=[],EdgeUpdated:l=[],EdgeRemoved:u=[],ComboAdded:c=[],ComboUpdated:h=[],ComboRemoved:d=[]}=ie(r,(t=>t.type)),f=t=>new Map(t.map((t=>{const e=t.value;return[bh(e),e]}))),p={add:{nodes:f(i),edges:f(s),combos:f(c)},update:{nodes:f(o),edges:f(l),combos:f(h)},remove:{nodes:f(a),edges:f(u),combos:f(d)}},g=this.transformData(p,t);return e.clearChanges(),{dataChanges:n,drawData:g}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce(((t,n)=>n.beforeDraw(t,e)),t)}createElement(e,n,r){var i;const o=bh(n);if(this.getElement(o))return;const a=this.getElementType(e,n),s=this.getElementComputedStyle(e,n),l=Nc(e,a);if(!l)return Cc(`The element ${a} of ${e} is not registered.`);this.emit(new CH(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n),r);const u=this.container.appendChild(new l({id:o,context:this.context,style:Object.assign({},s)}));this.shapeTypeMap[o]=a,this.elementMap[o]=u;const{stage:c="enter"}=r;null===(i=this.context.animation)||void 0===i||i.add({element:u,elementType:e,stage:c,originalStyle:Object.assign({},u.attributes),updatedStyle:s},{after:()=>{var i;this.emit(new CH(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n),r),null===(i=u.onCreate)||void 0===i||i.call(u)}})}createElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.createElement(t,n,e)))}))}getUpdateStageStyle(t,e,n){const{stage:r="update"}=n;if("translate"===r){if("node"===t||"combo"===t){const{style:{x:t=0,y:n=0,z:r=0}={}}=e;return{x:t,y:n,z:r}}return{}}return this.getElementComputedStyle(t,e)}updateElement(e,n,r){var i;const o=bh(n),{stage:a="update"}=r,s=this.getElement(o);if(!s)return()=>null;this.emit(new CH(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n),r);const l=this.getElementType(e,n),u=this.getUpdateStageStyle(e,n,r);this.shapeTypeMap[o]!==l&&(s.destroy(),delete this.shapeTypeMap[o],delete this.elementMap[o],this.createElement(e,n,{animation:!1,silence:!0}));const c="visibility"!==a?a:"hidden"===u.visibility?"hide":"show";"hide"===c&&delete u.visibility,null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:c,originalStyle:Object.assign({},s.attributes),updatedStyle:u},{before:()=>{const t=this.elementMap[o];"collapse"!==a&&Ig(t,u),"visibility"===a&&(function(t,e){return LH(e)in(Oe(t,DH)||{})}(t,"opacity")||function(t,e){const n=Array.isArray(e)?e:[e];Oe(t,DH)||Te(t,DH,{}),n.forEach((e=>{Te(Oe(t,DH),LH(e),t.attributes[e])}))}(t,"opacity"),this.visibilityCache.set(t,"show"===c?"visible":"hidden"),"show"===c&&Ph(t,"visible"))},after:()=>{var i;const s=this.elementMap[o];"collapse"===a&&Ig(s,u),"hide"===c&&Ph(s,this.visibilityCache.get(s)),this.emit(new CH(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n),r),null===(i=s.onUpdate)||void 0===i||i.call(s)}})}updateElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.updateElement(t,n,e)))}))}markDestroyElement(t){Object.values(t.remove).forEach((t=>{t.forEach((t=>{const e=bh(t),n=this.getElement(e);n&&function(t){Te(t,"__to_be_destroyed__",!0)}(n)}))}))}destroyElement(e,n,r){var i;const{stage:o="exit"}=r,a=bh(n),s=this.elementMap[a];if(!s)return()=>null;this.emit(new CH(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n),r),null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:o,originalStyle:Object.assign({},s.attributes),updatedStyle:{}},{after:()=>{var i;this.clearElement(a),s.destroy(),null===(i=s.onDestroy)||void 0===i||i.call(s),this.emit(new CH(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n),r)}})}destroyElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["combo",i],["edge",r],["node",n]].forEach((([t,n])=>{n.forEach((n=>this.destroyElement(t,n,e)))}))}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,r;const i=null===(n=t.nodes)||void 0===n?void 0:n.find((t=>bh(t)===e));if(i){const n=Bh(Jh(this.context.model.getNodeLikeDatum(e)),Jh(i));null===(r=t.nodes)||void 0===r||r.forEach((t=>{var e,r,i;(null===(e=t.style)||void 0===e?void 0:e.x)&&(t.style.x+=n[0]),(null===(r=t.style)||void 0===r?void 0:r.y)&&(t.style.y+=n[1]),(null===(i=t.style)||void 0===i?void 0:i.z)&&(t.style.z+=n[2]||0)}))}}collapseNode(e,n){return ze(this,void 0,void 0,(function*(){var r;const{animation:i,align:o}=n,{model:a,layout:s}=this.context,l=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!l)return;this.markDestroyElement(l.drawData);const u=yield s.simulate();o&&this.alignLayoutResultToElement(u,e),a.updateData(u);const c=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!c)return;const{drawData:h}=c,{add:d,remove:f,update:p}=h;this.markDestroyElement(h);const g={animation:i,stage:"collapse",data:h};this.destroyElements(f,g),this.createElements(d,g),this.updateElements(p,g),yield null===(r=this.context.animation.animate(i,{beforeAnimate:e=>this.emit(new TH(t.GraphEvent.BEFORE_ANIMATE,pc.COLLAPSE,e,h),g),afterAnimate:e=>this.emit(new TH(t.GraphEvent.AFTER_ANIMATE,pc.COLLAPSE,e,h),g)},{collapse:{target:e,descendants:Array.from(f.nodes).map((([,t])=>bh(t))),position:Jh(p.nodes.get(e))}}))||void 0===r?void 0:r.finished}))}expandNode(e,n){return ze(this,void 0,void 0,(function*(){var r;const{model:i,layout:o}=this.context,{animation:a,align:s}=n,l=Jh(i.getNodeData([e])[0]),u=this.computeChangesAndDrawData({stage:"expand",animation:a});if(!u)return;const{drawData:{add:c}}=u;this.createElements(c,{animation:!1,stage:"expand",target:e}),this.context.animation.clear();const h=yield o.simulate();s&&this.alignLayoutResultToElement(h,e),i.updateData(h),this.computeStyle("expand");const d=this.computeChangesAndDrawData({stage:"collapse",animation:a});if(!d)return;const{drawData:f}=d,{update:p}=f,g={animation:a,stage:"expand",data:f};c.edges.forEach((t=>p.edges.set(bh(t),t))),c.nodes.forEach((t=>p.nodes.set(bh(t),t))),this.updateElements(p,g),yield null===(r=this.context.animation.animate(a,{beforeAnimate:e=>this.emit(new TH(t.GraphEvent.BEFORE_ANIMATE,pc.EXPAND,e,f),g),afterAnimate:e=>this.emit(new TH(t.GraphEvent.AFTER_ANIMATE,pc.EXPAND,e,f),g)},{expand:{target:e,descendants:Array.from(c.nodes).map((([,t])=>bh(t))),position:l}}))||void 0===r?void 0:r.finished}))}collapseCombo(e,n){return ze(this,void 0,void 0,(function*(){var r;const{model:i,element:o}=this.context;if(i.getAncestorsData(e,wc).some((t=>Nd(t))))return;const a=o.getElement(e),s=a.getComboPosition(Object.assign(Object.assign({},a.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:n});if(!l)return;const{dataChanges:u,drawData:c}=l;this.markDestroyElement(c);const{update:h,remove:d}=c,f={animation:n,stage:"collapse",data:c};this.destroyElements(d,f),this.updateElements(h,f);const p=t=>Array.from(t).map((([,t])=>bh(t)));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new OH(t.GraphEvent.BEFORE_DRAW,{dataChanges:u,animation:n}),f),beforeAnimate:e=>this.emit(new TH(t.GraphEvent.BEFORE_ANIMATE,pc.COLLAPSE,e,c),f),afterAnimate:e=>this.emit(new TH(t.GraphEvent.AFTER_ANIMATE,pc.COLLAPSE,e,c),f),after:()=>this.emit(new OH(t.GraphEvent.AFTER_DRAW,{dataChanges:u,animation:n}),f)},{collapse:{target:e,descendants:[...p(d.nodes),...p(d.combos)],position:s}}))||void 0===r?void 0:r.finished}))}expandCombo(e,n){return ze(this,void 0,void 0,(function*(){var r;const{model:i}=this.context,o=Jh(i.getComboData([e])[0]);this.computeStyle("expand");const a=this.computeChangesAndDrawData({stage:"expand",animation:n});if(!a)return;const{dataChanges:s,drawData:l}=a,{add:u,update:c}=l,h={animation:n,stage:"expand",data:l,target:e};this.createElements(u,h),this.updateElements(c,h);const d=t=>Array.from(t).map((([,t])=>bh(t)));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new OH(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:n}),h),beforeAnimate:e=>this.emit(new TH(t.GraphEvent.BEFORE_ANIMATE,pc.EXPAND,e,l),h),afterAnimate:e=>this.emit(new TH(t.GraphEvent.AFTER_ANIMATE,pc.EXPAND,e,l),h),after:()=>this.emit(new OH(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:n}),h)},{expand:{target:e,descendants:[...d(u.nodes),...d(u.combos)],position:o}}))||void 0===r?void 0:r.finished}))}destroy(){this.container.destroy(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={},this.context={}}}class YH{get presetOptions(){return{animation:!!Lc(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}layout(){return ze(this,void 0,void 0,(function*(){if(!this.options)return;const e=Array.isArray(this.options)?this.options:[this.options],{graph:n}=this.context;PH(n,new OH(t.GraphEvent.BEFORE_LAYOUT));for(const r of e){const i=e.indexOf(r),o=this.getLayoutData(r),a=Object.assign(Object.assign({},this.presetOptions),r);PH(n,new OH(t.GraphEvent.BEFORE_STAGE_LAYOUT,{options:a,index:i}));const s=yield this.stepLayout(o,a,i);PH(n,new OH(t.GraphEvent.AFTER_STAGE_LAYOUT,{options:a,index:i})),r.animation||this.updateElementPosition(s,!1)}PH(n,new OH(t.GraphEvent.AFTER_LAYOUT)),this.transformDataAfterLayout()}))}transformDataAfterLayout(){const t=this.context.transform.getTransformInstance();Object.values(t).forEach((t=>t.afterLayout()))}simulate(){return ze(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 r=t.indexOf(n),i=this.getLayoutData(n);e=yield this.stepLayout(i,Object.assign(Object.assign(Object.assign({},this.presetOptions),n),{animation:!1}),r)}return e}))}stepLayout(t,e,n){return ze(this,void 0,void 0,(function*(){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)}))}graphLayout(t,e,n){return ze(this,void 0,void 0,(function*(){const{animation:r,enableWorker:i,iterations:o=300}=e,a=this.initGraphLayout(e);if(!a)return{};if(this.instances[n]=a,this.instance=a,i){const e=a;return this.supervisor=new Kj(e.graphData2LayoutModel(t),e.instance,{iterations:o}),Kg(yield this.supervisor.execute())}if(Jx(a))return r?yield a.execute(t,{onTick:t=>{this.updateElementPosition(t,!1)}}):(a.execute(t),a.stop(),a.tick(o));const s=yield a.execute(t);if(r){const t=this.updateElementPosition(s,r);yield null==t?void 0:t.finished}return s}))}treeLayout(t,e,n){return ze(this,void 0,void 0,(function*(){const{type:n,animation:r}=e,i=Nc("layout",n);if(!i)return{};const{nodes:o=[],edges:a=[]}=t,s=new qg({nodes:o.map((t=>({id:bh(t),data:t.data||{}}))),edges:a.map((t=>({id:bh(t),source:t.source,target:t.target,data:t.data||{}})))});!function(t){if(t.hasTreeStructure(kc))return;t.attachTreeStructure(kc);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,kc)}}(s);const l={nodes:[],edges:[]},u={nodes:[],edges:[]};s.getRoots(kc).forEach((t=>{Ed(t,(t=>{t.children=s.getSuccessors(t.id)}),(t=>s.getSuccessors(t.id)),"TB");const n=i(t,e),{x:r,y:o,z:a=0}=n;Ed(n,(t=>{const{id:e,x:n,y:i,z:s=0}=t;l.nodes.push({id:e,style:{x:r,y:o,z:a}}),u.nodes.push({id:e,style:{x:n,y:i,z:s}})}),(t=>t.children),"TB")}));const c=this.inferTreeLayoutOffset(u);if($H(u,c),r){$H(l,c),this.updateElementPosition(l,!1);const t=this.updateElementPosition(u,r);yield null==t?void 0:t.finished}return u}))}inferTreeLayoutOffset(t){var e;let[n,r]=[1/0,-1/0],[i,o]=[1/0,-1/0];null===(e=t.nodes)||void 0===e||e.forEach((t=>{const{x:e=0,y:a=0}=t.style||{};n=Math.min(n,e),r=Math.max(r,e),i=Math.min(i,a),o=Math.max(o,a)}));const{canvas:a}=this.context,s=a.getSize(),[l,u]=a.getCanvasByViewport([0,0]),[c,h]=a.getCanvasByViewport(s);if(n>=l&&r<=c&&i>=u&&o<=h)return[0,0];return[(l+c)/2-(n+r)/2,(u+h)/2-(i+o)/2]}stopLayout(){this.instance&&Jx(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}=t,{nodes:n,edges:r,combos:i}=this.context.model.getData(),o=t=>this.context.element.getElement(t),a=n.filter((t=>{const n=bh(t),r=o(n);return!!r&&(!jg(r)&&e(t))})),s=new Map(a.map((t=>[bh(t),t])));return{nodes:a,edges:r.filter((t=>{const{source:e,target:n}=t;return!(!s.has(e)||!s.has(n))})),combos:i}}initGraphLayout(t){var e;const{element:n,viewport:r}=this.context,{type:i,enableWorker:o,animation:a,iterations:s}=t,l=Fe(t,["type","enableWorker","animation","iterations"]),[u,c]=r.getCanvasSize(),h=[u/2,c/2],d=null!==(e=null==t?void 0:t.nodeSize)&&void 0!==e?e:t=>{const e=null==n?void 0:n.getElement(t.id),{size:r}=(null==e?void 0:e.attributes)||{};return r},f=Nc("layout",i);if(!f)return Cc(`The layout of ${i} is not registered.`);const p=Object.getPrototypeOf(f.prototype)===Xg.prototype?f:function(t,e){return class extends Xg{constructor(e,n){if(super(e,n),this.instance=new t({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const t=this.instance;this.stop=t.stop.bind(t),this.tick=e=>Kg(t.tick(e))}}execute(t,e){return ze(this,void 0,void 0,(function*(){return Kg(yield this.instance.execute(this.graphData2LayoutModel(t),this.transformOptions(ke({},this.options,e))))}))}transformOptions(t){const{onTick:e}=t;return e?(t.onTick=t=>e(Kg(t)),t):t}graphData2LayoutModel(t){const{nodes:n=[],edges:r=[],combos:i=[]}=t,o=n.map((t=>{const e=bh(t),{data:n,style:r,combo:i}=t,o=Fe(t,["data","style","combo"]),a={id:e,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),{data:n}),i?{parentId:i}:{}),{style:r}),o)};return(null==r?void 0:r.x)&&Object.assign(a.data,{x:r.x}),(null==r?void 0:r.y)&&Object.assign(a.data,{y:r.y}),(null==r?void 0:r.z)&&Object.assign(a.data,{z:r.z}),a})),a=new Map(o.map((t=>[t.id,t]))),s=r.filter((t=>{const{source:e,target:n}=t;return a.has(e)&&a.has(n)})).map((t=>{const{source:e,target:n,data:r,style:i}=t;return{id:bh(t),source:e,target:n,data:Object.assign({},r),style:Object.assign({},i)}})),l=i.map((t=>({id:bh(t),data:Object.assign({_isCombo:!0},t.data),style:Object.assign({},t.style)}))),u=new qg({nodes:[...o,...l],edges:s});return e.model.model.hasTreeStructure(wc)&&(u.attachTreeStructure(wc),o.forEach((t=>{const n=e.model.model.getParent(t.id,wc);n&&u.hasNode(n.id)&&u.setParent(t.id,n.id,wc)}))),u}}}(f,this.context),g=new p(this.context),v={nodeSize:d,width:u,height:c,center:h};switch(g.id){case"d3-force":case"d3-force-3d":Object.assign(v,{center:{x:u/2,y:c/2,z:0}})}return ke(g.options,v,l),g}updateElementPosition(t,e){const{model:n,element:r}=this.context;return r?(n.updateData(t),r.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},null===(t=this.supervisor)||void 0===t||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const $H=(t,e)=>{var n;const[r,i]=e;null===(n=t.nodes)||void 0===n||n.forEach((t=>{if(t.style){const{x:e=0,y:n=0}=t.style;t.style.x=e+r,t.style.y=n+i}else t.style={x:r,y:i}}))};class qH extends Rh{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;Cc(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find((e=>e.type===t));return n?this.extensionMap[n.key]:void 0}}const XH=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class KH extends Rh{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...XH.slice(0,XH.length-1),...t,XH[XH.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}class ZH{get padding(){return Yc(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,a]=[(r-e)/2,(t-n)/2,0];return[i,o,a]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:a=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,a],rotate:i},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const r=Object.entries(t.getLayers()).filter((([t])=>!["main"].includes(t))),i=r.map((([,t])=>t.getCamera())),o=e[n];if("function"==typeof o)return(...t)=>{const r=o.apply(e,t);return i.forEach((e=>{e[n].apply(e,t)})),r}}})}createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=Lc(this.context.options,t);return!!e&&Ae(Object.assign({},e),["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),a=e.getFocalPoint(),[s,l]=this.getCanvasCenter(),[u=0,c=0,h=0]=r,d=zh([-u,-c,-h],i);return"relative"===n?{position:jh(o,d),focalPoint:jh(a,d)}:{position:jh([s,l,o[2]],d),focalPoint:jh([s,l,a[2]],d)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return oe("relative"===r?n*i:i,...e)}transform(e,n){return ze(this,void 0,void 0,(function*(){const{graph:r}=this.context,{translate:i,rotate:o,scale:a,origin:s}=e;this.cancelAnimation();const l=this.getAnimation(n);if(PH(r,new AH(t.GraphEvent.BEFORE_TRANSFORM,e)),!o&&a&&!i&&s&&!l)return this.camera.setZoomByViewportPoint(this.getZoomOptions(e),s),void PH(r,new AH(t.GraphEvent.AFTER_TRANSFORM,e));const u={};if(i&&Object.assign(u,this.getTranslateOptions(e)),ae(o)&&Object.assign(u,this.getRotateOptions(e)),ae(a)&&Object.assign(u,{zoom:this.getZoomOptions(e)}),l)return PH(r,new TH(t.GraphEvent.BEFORE_ANIMATE,pc.TRANSFORM,null,e)),new Promise((n=>{this.transformResolver=n,this.camera.gotoLandmark(this.createLandmark(u),Object.assign(Object.assign({},l),{onfinish:()=>{PH(r,new TH(t.GraphEvent.AFTER_ANIMATE,pc.TRANSFORM,null,e)),PH(r,new AH(t.GraphEvent.AFTER_TRANSFORM,e)),this.transformResolver=void 0,n()}}))}));this.camera.gotoLandmark(this.createLandmark(u),{duration:0}),PH(r,new AH(t.GraphEvent.AFTER_TRANSFORM,e))}))}fitView(t,e){return ze(this,void 0,void 0,(function*(){const[n,r,i,o]=this.padding,{when:a="always",direction:s="both"}=t||{},[l,u]=this.context.canvas.getSize(),c=l-o-r,h=u-n-i,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[p,g]=Kc(f);if("overflow"===a&&!("x"===s&&p>=c||"y"===s&&g>=h||"both"===s&&p>=c&&g>=h))return yield this.fitCenter({animation:e});const v=c/p,m=h/g,y="x"===s?v:"y"===s?m:Math.min(v,m),b=this.getAnimation(e);yield this.transform({mode:"relative",scale:y,translate:jh(Bh(this.getCanvasCenter(),this.getBBoxInViewport(d).center),zh(this.paddingOffset,y))},b)}))}fitCenter(t){return ze(this,void 0,void 0,(function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)}))}focusElements(t){return ze(this,arguments,void 0,(function*(t,e={}){const{element:n}=this.context;if(!n)return;const r=th(t.map((t=>{return r=n.getElement(t),e.shapes?r.getShape(e.shapes).getRenderBounds():r.getRenderBounds();var r})));yield this.focus(r,e)}))}focus(t,e){return ze(this,void 0,void 0,(function*(){const n=this.context.graph.getViewportByCanvas(t.center),r=Bh(e.position||this.getCanvasCenter(),n);yield this.transform({mode:"relative",translate:jh(r,this.paddingOffset)},e.animation)}))}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[a,s]=r.getViewportByCanvas(n),l=new Yr;return l.setMinMax([i,o,0],[a,s,0]),l}isInViewport(t,e=!1,n=0){const{graph:r}=this.context,i=this.getCanvasSize(),[o,a]=r.getCanvasByViewport([0,0]),[s,l]=r.getCanvasByViewport(i);let u=new Yr;return u.setMinMax([o,a,0],[s,l,0]),n&&(u=Jc(u,n)),Hc(t)?eh(t,u):e?function(t,e){const[n,r]=t.min,[i,o]=t.max,[a,s]=e.min,[l,u]=e.max;return n>=a&&i<=l&&r>=s&&o<=u}(t,u):u.intersects(t)}cancelAnimation(){var t,e;(null===(t=this.camera.landmarks)||void 0===t?void 0:t.length)&&this.camera.cancelLandmarkAnimation(),null===(e=this.transformResolver)||void 0===e||e.call(this)}}class QH extends Wg{constructor(t){var e;super(),this.rendered=!1,this.destroyed=!1,this.context={model:new HH},this.isCollapsingExpanding=!1,this.onResize=ye((()=>{this.resize()}),300),this.options=Object.assign({},QH.defaultOptions,t),this._setOptions(this.options,!0),this.context.graph=this,this.options.autoResize&&(null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),e){const{data:e}=t;return void(e&&this.addData(e))}Object.assign(this.options,t);const{behaviors:n,combo:r,data:i,edge:o,layout:a,node:s,plugins:l,theme:u,transforms:c}=t;n&&this.setBehaviors(n),i&&this.setData(i),s&&this.setNode(s),o&&this.setEdge(o),r&&this.setCombo(r),a&&this.setLayout(a),u&&this.setTheme(u),l&&this.setPlugins(l),c&&this.setTransforms(c)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Ut(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Ut(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Ut(t)?t(this.getBehaviors()):t,null===(e=this.context.behavior)||void 0===e||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors((e=>e.map((e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Ut(t)?t(this.getPlugins()):t,null===(e=this.context.plugin)||void 0===e||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins((e=>e.map((e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Ut(t)?t(this.getTransforms()):t,null===(e=this.context.transform)||void 0===e||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms((e=>e.map((e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e)))),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map((t=>this.context.model.getElementDataById(t))):this.context.model.getElementDataById(t)}getNodeData(t){var e;return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):null===(e=this.context.model.getNodeData([t]))||void 0===e?void 0:e[0]}getEdgeData(t){var e;return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):null===(e=this.context.model.getEdgeData([t]))||void 0===e?void 0:e[0]}getComboData(t){var e;return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):null===(e=this.context.model.getComboData([t]))||void 0===e?void 0:e[0]}setData(t){this.context.model.setData(Ut(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Ut(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Ut(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Ut(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Ut(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Ut(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Ut(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Ut(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Ut(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Ut(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Ut(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Ut(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Ut(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return ze(this,void 0,void 0,(function*(){var e;if(this.context.canvas)return yield this.context.canvas.ready;const{container:n="container",width:r,height:i,renderer:o,cursor:a,background:s,canvas:l,devicePixelRatio:u=(null!==(e=globalThis.devicePixelRatio)&&void 0!==e?e:1)}=this.options;if(n instanceof EH)this.context.canvas=n,a&&n.setCursor(a),o&&n.setRenderer(o),yield n.ready;else{const e=ne(n)?document.getElementById(n):n,c=SH(e);this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:e,width:r,height:i});const h=Object.assign(Object.assign({},l),{container:e,width:r||c[0],height:i||c[1],background:s,renderer:o,cursor:a,devicePixelRatio:u}),d=new EH(h);this.context.canvas=d,yield d.ready,this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:d})}}))}updateCanvas(e){var n,r;const{renderer:i,cursor:o,height:a,width:s}=e,l=this.context.canvas;l&&(i&&(this.emit(t.GraphEvent.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(t.GraphEvent.AFTER_RENDERER_CHANGE,{renderer:i})),o&&l.setCursor(o),(ae(s)||ae(a))&&this.setSize(null!==(n=null!=s?s:this.options.width)&&void 0!==n?n:0,null!==(r=null!=a?a:this.options.height)&&void 0!==r?r:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new jH(this.context)),this.context.plugin||(this.context.plugin=new qH(this.context)),this.context.viewport||(this.context.viewport=new ZH(this.context)),this.context.transform||(this.context.transform=new KH(this.context)),this.context.element||(this.context.element=new UH(this.context)),this.context.animation||(this.context.animation=new IH(this.context)),this.context.layout||(this.context.layout=new YH(this.context)),this.context.behavior||(this.context.behavior=new BH(this.context))}prepare(){return ze(this,void 0,void 0,(function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Tc("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()}))}render(){return ze(this,void 0,void 0,(function*(){yield this.prepare(),PH(this,new OH(t.GraphEvent.BEFORE_RENDER));const e=this.context.element.draw({type:"render"});yield Promise.all([null==e?void 0:e.finished,this.context.layout.layout()]),yield this.autoFit(),this.rendered=!0,PH(this,new OH(t.GraphEvent.AFTER_RENDER))}))}draw(){return ze(this,void 0,void 0,(function*(){var t;yield this.prepare(),yield null===(t=this.context.element.draw())||void 0===t?void 0:t.finished}))}layout(){return ze(this,void 0,void 0,(function*(){yield this.context.layout.layout()}))}stopLayout(){this.context.layout.stopLayout()}clear(){return ze(this,void 0,void 0,(function*(){this.context.model.setData({}),yield this.draw()}))}destroy(){var e;PH(this,new OH(t.GraphEvent.BEFORE_DESTROY));const{layout:n,animation:r,element:i,model:o,canvas:a,behavior:s,plugin:l}=this.context;null==l||l.destroy(),null==s||s.destroy(),null==n||n.destroy(),null==r||r.destroy(),null==i||i.destroy(),o.destroy(),null==a||a.destroy(),this.options={},this.context={},this.off(),null===(e=globalThis.removeEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize),this.destroyed=!0,PH(this,new OH(t.GraphEvent.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,n){var r;const i=SH(null===(r=this.context.canvas)||void 0===r?void 0:r.getContainer()),o=[e||i[0],n||i[1]];if(!this.context.canvas)return;const a=this.context.canvas.getSize();Ne(o,a)||(PH(this,new OH(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:o})),this.context.canvas.resize(...o),PH(this,new OH(t.GraphEvent.AFTER_SIZE_CHANGE,{size:o})))}fitView(t,e){return ze(this,void 0,void 0,(function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.fitView(t,e)}))}fitCenter(t){return ze(this,void 0,void 0,(function*(){var e;yield null===(e=this.context.viewport)||void 0===e?void 0:e.fitCenter({animation:t})}))}autoFit(){return ze(this,void 0,void 0,(function*(){const{autoFit:t}=this.context.options;if(t)if(ne(t))"view"===t?yield this.fitView():"center"===t&&(yield this.fitCenter());else{const{type:e,animation:n}=t;"view"===e?yield this.fitView(t.options,n):"center"===e&&(yield this.fitCenter(n))}}))}focusElement(t,e){return ze(this,void 0,void 0,(function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})}))}zoomBy(t,e,n){return ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)}))}zoomTo(t,e,n){return ze(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 ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)}))}rotateTo(t,e,n){return ze(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 ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)}))}translateTo(t,e){return ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)}))}getPosition(){return Bh([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach((([t,e])=>this.context.model.translateNodeLikeBy(t,e))),yield null===(i=this.context.element.draw({animation:a,stage:"translate"}))||void 0===i?void 0:i.finished}))}translateElementTo(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach((([t,e])=>this.context.model.translateNodeLikeTo(t,e))),yield null===(i=this.context.element.draw({animation:a,stage:"translate"}))||void 0===i?void 0:i.finished}))}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Pe(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach((([t,e])=>{const n=this.getElementType(t);s[`${n}s`].push({id:t,style:{visibility:e}})}));const{model:l,element:u}=this.context;l.preventUpdateNodeLikeHierarchy((()=>{l.updateData(s)})),yield null===(i=u.draw({animation:a,stage:"visibility"}))||void 0===i?void 0:i.finished}))}showElement(t,e){return ze(this,void 0,void 0,(function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"visible"]))),e)}))}hideElement(t,e){return ze(this,void 0,void 0,(function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"hidden"]))),e)}))}getElementVisibility(t){var e,n;const r=this.context.element.getElement(t);return null!==(n=null===(e=null==r?void 0:r.style)||void 0===e?void 0:e.visibility)&&void 0!==n?n:"visible"}setElementZIndex(t,e){return ze(this,void 0,void 0,(function*(){var n;const r={nodes:[],edges:[],combos:[]},i=qt(t)?t:{[t]:e};Object.entries(i).forEach((([t,e])=>{const n=this.getElementType(t);r[`${n}s`].push({id:t,style:{zIndex:e}})}));const{model:o,element:a}=this.context;o.preventUpdateNodeLikeHierarchy((()=>o.updateData(r))),yield null===(n=a.draw({animation:!1,stage:"zIndex"}))||void 0===n?void 0:n.finished}))}frontElement(t){return ze(this,void 0,void 0,(function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,r={};e.map((t=>{const e=n.getFrontZIndex(t);if("combo"===n.getElementType(t)){const i=n.getAncestorsData(t,wc).at(-1)||this.getComboData(t),o=[i,...n.getDescendantsData(bh(i))],a=e-RH(i);o.forEach((t=>{r[bh(t)]=this.getElementZIndex(bh(t))+a}));const{internal:s}=eg(o.map(bh),(t=>n.getRelatedEdgesData(t)));s.forEach((t=>{const e=bh(t);r[e]=this.getElementZIndex(e)+a}))}else r[t]=e})),yield this.setElementZIndex(r)}))}getElementZIndex(t){return RH(this.context.model.getElementDataById(t))}setElementState(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach((([t,e])=>{const n=this.getElementType(t);var r;s[`${n}s`].push({id:t,states:(r=e,r?Array.isArray(r)?r:[r]:[])})})),this.updateData(s),yield null===(i=this.context.element.draw({animation:a,stage:"state"}))||void 0===i?void 0:i.finished}))}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return ze(this,arguments,void 0,(function*(t,e=!0){const{model:n,element:r}=this.context;if(Nd(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!0});const i=n.getElementType(t);yield this.frontElement(t),this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!0),"node"===i?yield r.collapseNode(t,e):"combo"===i&&(yield r.collapseCombo(t,!!e.animation)),this.isCollapsingExpanding=!1}))}expandElement(t){return ze(this,arguments,void 0,(function*(t,e=!0){const{model:n,element:r}=this.context;if(!Nd(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!0});const i=n.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!1),"node"===i?yield r.expandNode(t,e):"combo"===i&&(yield r.expandCombo(t,!!e.animation)),this.isCollapsingExpanding=!1}))}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return ze(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)}}QH.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};class JH extends Dh{beforeDraw(t,e){return t}afterLayout(){}}function tU(t,e,n,r,i){const o=bh(r),a=`${n}s`,s=i?r:t.add[a].get(o)||t.update[a].get(o)||t.remove[a].get(o)||r;Object.entries(t).forEach((([t,n])=>{e===t?n[a].set(o,s):n[a].delete(o)}))}function eU(t,e){return Object.keys(t).every((n=>t[n]===e[n]))}const nU=(t,e,n,r)=>{const i=`${n}s`,o=bh(r);t.add[i].has(o)||t.update[i].has(o)||t[e][i].set(bh(r),r)};const rU=(t,e)=>{const{source:n,target:r}=e,i=t.getElementDataById(n),o=t.getElementDataById(r),a=ng(i,(e=>t.getParentData(e,wc))),s=ng(o,(e=>t.getParentData(e,wc))),l={sourceNode:bh(a),targetNode:bh(s)};return e.style?Object.assign(e.style,l):e.style=l,e};class iU extends JH{constructor(t,e){super(t,ke({},iU.defaultOptions,e)),this.assignSizeByCentrality=(t,e,n,r,i,o)=>{const a=[e,n],s=[r[0],i[0]],l=[r[1],i[1]],u=[r[2],i[2]],c=(t,e)=>{if("function"==typeof o)return o(t,a,e);switch(o){case"linear":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return i===r?o:o+(t-r)/(i-r)*(a-o)})(t,a,e);case"log":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return o+Math.log(t-r+1)/Math.log(i-r+1)*(a-o)})(t,a,e);case"pow":return((t,e,n,r=2)=>{const[i,o]=e,[a,s]=n;return a+Math.pow((t-i)/(o-i),r)*(s-a)})(t,a,e,2);case"sqrt":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return o+Math.sqrt((t-r)/(i-r))*(a-o)})(t,a,e);default:return e[0]}};return[c(t,s),c(t,l),c(t,u)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),r=Rd(this.options.maxSize),i=Rd(this.options.minSize),o=this.getCentralities(this.options.centrality),a=o.size>0?Math.max(...o.values()):0,s=o.size>0?Math.min(...o.values()):0;return n.forEach((e=>{var n;const l=this.assignSizeByCentrality(o.get(bh(e))||0,s,a,i,r,this.options.scale),u=null===(n=this.context.element)||void 0===n?void 0:n.getElement(bh(e)),c={size:l};this.assignLabelStyle(c,l,e,u),u&&eU(c,u.attributes)||tU(t,u?"update":"add","node",ke(e,{style:c}),!0)})),t}assignLabelStyle(t,e,n,r){var i;const o=r?r.config.style:null===(i=this.context.element)||void 0===i?void 0:i.getElementComputedStyle("node",n);if(Object.assign(t,Ae(o,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const n=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:n,labelLineHeight:n+$c(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const r=Math.min(...t)/2,[i,o]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(o,Math.max(r,i))}getCentralities(t){const{model:e}=this.context,n=e.getData();if("function"==typeof t)return t(n);const r=e.getRelatedEdgesData.bind(e);return wh(n,r,t)}}iU.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class oU extends JH{constructor(t,e){super(t,Object.assign({},oU.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=Jh(this.ref),{graph:n,model:r}=this.context;null===(t=r.getData().nodes)||void 0===t||t.forEach((t=>{var i;if(bh(t)===bh(this.ref))return;const o=Xh(Bh(Jh(t),e)),a=Math.abs(o)>Math.PI/2,s=!t.children||0===t.children.length,l=bh(t),u=null===(i=this.context.element)||void 0===i?void 0:i.getElement(l);if(!u||!u.isVisible())return;const c=(s?1:-1)*(Rd(n.getElementRenderStyle(l).size)[0]/2+this.options.offset),h=[["translate",c*Math.cos(o),c*Math.sin(o)],["rotate",a?ai(o)+180:ai(o)]];r.updateNodeData([{id:bh(t),style:{labelTextAlign:a===s?"right":"left",labelTextBaseline:"middle",labelTransform:h}}])})),n.draw()}}oU.defaultOptions={offset:5};const aU=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class sU extends JH{constructor(t,e){super(t,Object.assign({},sU.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=t=>{const{add:{edges:e},update:{nodes:n,edges:r,combos:i},remove:{edges:o}}=t,{model:a}=this.context,s=new Map,l=(t,e)=>{a.getRelatedEdgesData(e).forEach((t=>!s.has(bh(t))&&s.set(bh(t),t)))};n.forEach(l),i.forEach(l);const u=t=>{const e=a.getEdgeData().map((t=>rU(a,t)));uU(t,e).forEach((t=>!s.has(bh(t))&&s.set(bh(t),t)))};if(o.size&&o.forEach(u),e.size&&e.forEach(u),r.size){const t=nF(eF(a.getChanges())).update.edges;r.forEach((e=>{var n;u(e);const r=null===(n=t.find((t=>bh(t.value)===bh(e))))||void 0===n?void 0:n.original;r&&!cU(e,r)&&u(r)}))}Se(this.options.edges)||s.forEach(((t,e)=>!this.options.edges.includes(e)&&s.delete(e)));const c=a.getEdgeData().map(bh);return new Map([...s].sort(((t,e)=>c.indexOf(t[0])-c.indexOf(e[0]))))},this.applyBundlingStyle=(t,e,n)=>{const{edgeMap:r,reverses:i}=lU(e);r.forEach((e=>{e.forEach(((e,r,o)=>{var a;const s=o.length,l=e.style||{};if(e.source===e.target){const t=aU.length;l.loopPlacement=aU[r%t],l.loopDist=Math.floor(r/t)*n+50}else if(1===s)l.curveOffset=0;else{const t=(r%2==0?1:-1)*(i[`${e.source}|${e.target}|${r}`]?-1:1);l.curveOffset=s%2==1?t*Math.ceil(r/2)*n*2:t*(Math.floor(r/2)*n*2+n)}const u=Object.assign(e,{type:"quadratic",style:l}),c=null===(a=this.context.element)||void 0===a?void 0:a.getElement(bh(e));c&&eU(u.style,c.attributes)||tU(t,c?"update":"add","edge",u,!0)}))}))},this.resetEdgeStyle=t=>{const e=t.style||{},n=this.cacheMergeStyle.get(bh(t))||{};return Object.keys(n).forEach((r=>{Ne(e[r],n[r])&&(t[r]?e[r]=t[r]:delete e[r])})),Object.assign(t,{style:e})},this.applyMergingStyle=(t,e)=>{const{edgeMap:n,reverses:r}=lU(e);n.forEach((e=>{var n;if(1===e.length){const r=e[0],i=null===(n=this.context.element)||void 0===n?void 0:n.getElement(bh(r)),o=this.resetEdgeStyle(r);return void(i&&eU(o,i.attributes)||tU(t,i?"update":"add","edge",o))}const i=e.map((({source:t,target:e,style:n={}},i)=>{const{startArrow:o,endArrow:a}=n,s={},[l,u]=r[`${t}|${e}|${i}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return pe(o)&&(s[l]=o),pe(a)&&(s[u]=a),s})).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{});e.forEach(((e,n,r)=>{var o;if(0!==n)return void tU(t,"remove","edge",e);const a=Object.assign({},Ut(this.options.style)?this.options.style(r):this.options.style,{childrenData:r});this.cacheMergeStyle.set(bh(e),a);const s=Object.assign(Object.assign({},e),{type:"line",style:Object.assign(Object.assign(Object.assign({},e.style),i),a)}),l=null===(o=this.context.element)||void 0===o?void 0:o.getElement(bh(e));l&&eU(s.style,l.attributes)||tU(t,l?"update":"add","edge",s,!0)}))}))}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return 0===e.size||("bundle"===this.options.mode?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}sU.defaultOptions={mode:"bundle",distance:15};const lU=t=>{const e=new Map,n=new Set,r={};for(const[i,o]of t){if(n.has(i))continue;const{source:a,target:s}=o,l=`${a}-${s}`;e.has(l)||e.set(l,[]),e.get(l).push(o),n.add(i);for(const[i,u]of t)n.has(i)||cU(o,u)&&(e.get(l).push(u),n.add(i),a===u.target&&s===u.source&&(r[`${u.source}|${u.target}|${e.get(l).length-1}`]=!0))}return{edgeMap:e,reverses:r}},uU=(t,e,n)=>e.filter((e=>cU(e,t))),cU=(t,e)=>{const{sourceNode:n,targetNode:r}=t.style||{},{sourceNode:i,targetNode:o}=e.style||{};return n===i&&r===o||n===o&&r===i};class hU extends Xg{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Se(t)||t.length>2))return t[0]}formatSize(t){const e="function"==typeof t?t:()=>t;return t=>Rd(e(t))}doLayout(t,e){const{hGap:n,getRibSep:r,vGap:i,nodeSize:o,height:a}=e,{model:s}=this.context,l=this.formatSize(o);let u=l(t)[0]+r(t);const c=(t,e=0)=>{var r;return e+=n*((t.children||[]).length+1),null===(r=t.children)||void 0===r||r.forEach((t=>{var n;null===(n=s.getNodeLikeDatum(t).children)||void 0===n||n.forEach((t=>{const n=s.getNodeLikeDatum(t);e=c(n,e)}))})),e},h=t=>{if(1===t.depth)return u;const e=s.getParentData(t.id,"tree");if(pU(t)){const r=s.getParentData(e.id,"tree"),o=p(t)-p(r);return h(e)+o*n/i}{const n=(e.children||[]).indexOf(t.id),r=s.getNodeData((e.children||[]).slice(n));return d(e)-r.reduce(((t,e)=>t+c(e)),0)-l(e)[0]/2}},d=xe((t=>{if(fU(t))return l(t)[0]/2;const e=s.getParentData(t.id,"tree");if(pU(t))return h(t)+c(t)+l(t)[0]/2;{const r=p(t)-p(e),o=n/i;return h(t)+r*o}}),(t=>t.id)),f=t=>p(s.getParentData(t,"tree")),p=xe((t=>{if(fU(t))return a/2;if(pU(t)){const e=s.getParentData(t.id,"tree"),n=e.children.indexOf(t.id);if(0===n)return f(e.id)+i;const r=s.getNodeLikeDatum(e.children[n-1]);if(Se(r.children))return p(r)+i;const o=s.getDescendantsData(r.id);return Math.max(...o.map((t=>pU(t)?f(t.id):p(t))))+i}{if(Se(t.children))return f(t.id)+i;const e=s.getNodeLikeDatum(t.children.slice(-1)[0]);if(Se(e.children))return p(e)+i;const n=s.getDescendantsData(t.id).slice(-1)[0];return(pU(n)?f(n.id):p(n))+i}}),(t=>t.id));let g=0;const v={nodes:[],edges:[]},m=t=>{var e;null===(e=t.children)||void 0===e||e.forEach((t=>m(s.getNodeLikeDatum(t))));const n=p(t),i=d(t);if(v.nodes.push({id:t.id,x:i,y:n}),fU(t))return;const o=s.getRelatedEdgesData(t.id,"in")[0],a=[h(t),pU(t)?n:f(t.id)];v.edges.push({id:bh(o),controlPoints:[a],relatedNodeId:t.id}),g=Math.max(g,i+r(t)),1===t.depth&&(u=g)};return m(t),v}placeAlterative(t,e){const n=(e.children||[]).filter(((t,e)=>e%2!=0));if(0===n.length)return t;const{model:r}=this.context,i=t.nodes.find((t=>t.id===e.id)).y,o=t=>{const e=r.getAncestorsData(t,"tree");if(Se(e))return!1;const i=1===e.length?t:e[e.length-2].id;return n.includes(i)};t.nodes.forEach((t=>{o(t.id)&&(t.y=2*i-t.y)})),t.edges.forEach((t=>{o(t.relatedNodeId)&&(t.controlPoints=t.controlPoints.map((t=>[t[0],2*i-t[1]])))}))}rightToLeft(t,e){return t.nodes.forEach((t=>t.x=e.width-t.x)),t.edges.forEach((t=>{t.controlPoints=t.controlPoints.map((t=>[e.width-t[0],t[1]]))})),t}execute(t,e){return ze(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign(Object.assign({},hU.defaultOptions),this.options),e),{direction:r,nodeSize:i}=n,o=this.getRoot();if(!o)return t;const a=this.formatSize(i);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map((t=>a(t)[1])))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map((t=>a(t)[0]))));let s=this.doLayout(o,n);this.placeAlterative(s,o),"RL"===r&&(s=this.rightToLeft(s,n));const{model:l}=this.context,u=[],c=[];return s.nodes.forEach((t=>{const{id:e,x:n,y:r}=t,i=l.getNodeLikeDatum(e);u.push(dU(i,{x:n,y:r}))})),s.edges.forEach((t=>{const{id:e,controlPoints:n}=t,r=l.getEdgeDatum(e);c.push(dU(r,{controlPoints:n}))})),{nodes:u,edges:c}}))}}hU.defaultOptions={direction:"RL",getRibSep:()=>60};const dU=(t,e)=>Object.assign(Object.assign({},t),{style:Object.assign(Object.assign({},t.style||{}),e)}),fU=t=>0===t.depth,pU=t=>(t.depth||(t.depth=0))%2==0,gU=["#7E92B5","#F4664A","#FFBE3A"],vU={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},mU={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function yU(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeHaloStrokeOpacityActive:a=.15,nodeHaloStrokeOpacitySelected:s=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:h=gU,nodePaletteOptions:d=vU,edgeColor:f,edgeColorDisabled:p,edgePaletteOptions:g=mU,comboColor:v,comboColorDisabled:m,comboStroke:y,comboStrokeDisabled:b,edgeColorInactive:x}=t;return{background:e,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:r,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:n,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65,size:32,stroke:o,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:s,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:o},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:a},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:o,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:u,labelFill:n,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:n,labelFillOpacity:.25,strokeOpacity:l}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:f,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:f,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:x,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:p,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:e,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:v,halo:!1,haloLineWidth:12,haloStroke:y,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:y},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:m,fillOpacity:.25,labelOpacity:.25,stroke:b,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const bU=yU({bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:{type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"}),xU=yU({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"}),EU={animation:{"combo-collapse":Vc,"combo-expand":Wc,"node-collapse":Bc,"node-expand":Fc,"path-in":zc,"path-out":Gc,fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}]},behavior:{"brush-select":md,"click-select":Sd,"collapse-expand":Bg,"create-edge":zg,"drag-canvas":Gg,"drag-element-force":Jg,"drag-element":Vg,"fix-element-size":tv,"focus-element":ev,"hover-activate":nv,"lasso-select":rv,"auto-adapt-label":_h,"optimize-viewport-transform":iv,"scroll-canvas":ov,"zoom-canvas":av},combo:{circle:Dp,rect:Lp},edge:{cubic:ag,line:cg,polyline:Eg,quadratic:wg,"cubic-horizontal":sg,"cubic-radial":lg,"cubic-vertical":ug},layout:{"antv-dagre":bb,"combo-combined":nE,"compact-box":pm.compactBox,"d3-force":HE,"force-atlas2":sj,circular:kb,concentric:Ob,dagre:nj,dendrogram:pm.dendrogram,fishbone:hU,force:Xb,fruchterman:uj,grid:hj,indented:pm.indented,mds:Kx,mindmap:pm.mindmap,radial:wj,random:Cj},node:{circle:of,diamond:sf,ellipse:hf,hexagon:df,html:Op,image:Tp,rect:Cp,star:Ap,donut:lf,triangle:Pp},palette:{spectral:["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],tableau:["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],oranges:["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],greens:["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],blues:["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"]},theme:{dark:bU,light:xU},plugin:{"bubble-sets":jB,"edge-bundling":GB,"edge-filter-lens":KB,"grid-line":tF,background:tB,contextmenu:zB,fisheye:QB,fullscreen:JB,history:oF,hull:AF,legend:QW,minimap:JW,snapline:rH,timebar:sH,toolbar:hH,tooltip:dH,watermark:gH},transform:{"arrange-draw-order":class extends JH{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,r=t=>{const n=[];return t.forEach(((t,r)=>{const i=e.getAncestorsData(r,"combo").map((t=>bh(t))).reverse();n.push([r,t,i.length])})),new Map(n.sort((([,,t],[,,e])=>e-t)).map((([t,e])=>[t,e])))};return t.add.combos=r(n),t.update.combos=r(t.update.combos),t}},"collapse-expand-combo":class extends JH{beforeDraw(t,e){if("visibility"===e.stage)return t;if(!this.context.model.model.hasTreeStructure(wc))return t;const{model:n}=this.context,{add:r,update:i}=t,o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[e,a]=o.pop();if(Nd(a)){const a=n.getDescendantsData(e),s=a.map(bh),{internal:l,external:u}=eg(s,(t=>n.getRelatedEdgesData(t)));a.forEach((e=>{const r=bh(e),i=o.findIndex((([t])=>t===r));-1!==i&&o.splice(i,1);const a=n.getElementType(r);tU(t,"remove",a,e)})),l.forEach((e=>tU(t,"remove","edge",e))),u.forEach((t=>{var e;const n=bh(t);(null===(e=this.context.element)||void 0===e?void 0:e.getElement(n))?i.edges.set(n,t):r.edges.set(n,t)}))}else{const r=n.getChildrenData(e),i=r.map(bh),{edges:a}=eg(i,(t=>n.getRelatedEdgesData(t)));[...r,...a].forEach((e=>{var r;const i=bh(e),a=n.getElementType(i),s=null===(r=this.context.element)||void 0===r?void 0:r.getElement(i);tU(t,s?"update":"add",a,e),"combo"===a&&o.push([i,e])}))}}return t}},"collapse-expand-node":class extends JH{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(nU(e,"add","node",t),Nd(t))return;const n=bh(t);nU(e,"add","node",t);this.context.model.getRelatedEdgesData(n,"out").forEach((t=>{tU(e,"add","edge",t)}));this.context.model.getChildrenData(n).forEach((t=>{this.handleExpand(t,e)}))}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(kc))return t;const{add:{nodes:r,edges:i},update:{nodes:o}}=t,a=new Map,s=new Map;r.forEach(((t,e)=>{Nd(t)&&a.set(e,t)})),i.forEach((t=>{if("node"!==e.getElementType(t.source))return;const n=e.getNodeData(t.source);Nd(n)&&a.set(t.source,n)})),o.forEach(((t,e)=>{const n=this.getElement(e);if(!n)return;const r=n.attributes.collapsed;Nd(t)?r||a.set(e,t):r&&s.set(e,t)}));const l=new Set;return a.forEach(((e,r)=>{n.getDescendantsData(r).forEach((e=>{const r=bh(e);if(l.has(r))return;tU(t,"remove","node",e);n.getRelatedEdgesData(r).forEach((e=>{tU(t,"remove","edge",e)})),l.add(r)}))})),s.forEach(((e,r)=>{n.getAncestorsData(r,kc).some(Nd)?tU(t,"remove","node",e):this.handleExpand(e,t)})),t}},"get-edge-actual-ends":class extends JH{beforeDraw(t){const{add:e,update:n}=t,{model:r}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach((([,t])=>{rU(r,t)})),t}},"map-node-size":iU,"place-radial-labels":oU,"process-parallel-edges":sU,"update-related-edges":class extends JH{beforeDraw(t,e){const{stage:n}=e;if("visibility"===n)return t;const{model:r}=this.context,{update:{nodes:i,edges:o,combos:a}}=t,s=(t,e)=>{r.getRelatedEdgesData(e).forEach((t=>!o.has(bh(t))&&o.set(bh(t),t)))};return i.forEach(s),a.forEach(s),t}}},shape:{circle:Ll,ellipse:jl,group:Bl,html:zl,image:Kd,line:Wl,path:Ul,polygon:$l,polyline:Xl,rect:Kl,text:Ql,label:Hd,badge:Ud}};Object.entries(EU).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{vH(t,e,n)}))}));t.AntVDagreLayout=bb,t.AutoAdaptLabel=_h,t.Background=tB,t.Badge=Ud,t.BaseBehavior=Lh,t.BaseCombo=Rp,t.BaseEdge=og,t.BaseLayout=Xg,t.BaseNode=rf,t.BasePlugin=Zj,t.BaseShape=Vd,t.BaseTransform=JH,t.BrushSelect=md,t.BubbleSets=jB,t.CameraSetting=class extends Zj{constructor(t,e){super(t,e),this.setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach((([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}}))},this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,(()=>this.setOptions(this.options)))}getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Canvas=EH,t.Circle=of,t.CircleCombo=Dp,t.CircularLayout=kb,t.ClickSelect=Sd,t.CollapseExpand=Bg,t.ComboCombinedLayout=nE,t.CompactBoxLayout=pm.compactBox,t.ConcentricLayout=Ob,t.Contextmenu=zB,t.CreateEdge=zg,t.Cubic=ag,t.CubicHorizontal=sg,t.CubicRadial=lg,t.CubicVertical=ug,t.D3ForceLayout=HE,t.DagreLayout=nj,t.DendrogramLayout=pm.dendrogram,t.Diamond=sf,t.Donut=lf,t.DragCanvas=Gg,t.DragElement=Vg,t.DragElementForce=Jg,t.EdgeBundling=GB,t.EdgeFilterLens=KB,t.Ellipse=hf,t.FishboneLayout=hU,t.Fisheye=QB,t.FixElementSize=tv,t.FocusElement=ev,t.ForceAtlas2Layout=sj,t.ForceLayout=Xb,t.FruchtermanLayout=uj,t.Fullscreen=JB,t.Graph=QH,t.GridLayout=hj,t.GridLine=tF,t.HTML=Op,t.Hexagon=df,t.History=oF,t.HoverActivate=nv,t.Hull=AF,t.Icon=ef,t.Image=Tp,t.IndentedLayout=pm.indented,t.Label=Hd,t.LassoSelect=rv,t.Legend=QW,t.Line=cg,t.MDSLayout=Kx,t.MapNodeSize=iU,t.MindmapLayout=pm.mindmap,t.Minimap=JW,t.OptimizeViewportTransform=iv,t.PlaceRadialLabels=oU,t.Polyline=Eg,t.ProcessParallelEdges=sU,t.Quadratic=wg,t.RadialLayout=wj,t.RandomLayout=Cj,t.Rect=Cp,t.RectCombo=Lp,t.ScrollCanvas=ov,t.Shortcut=vd,t.Snapline=rH,t.Star=Ap,t.Timebar=sH,t.Toolbar=hH,t.Tooltip=dH,t.Triangle=Pp,t.Watermark=gH,t.ZoomCanvas=av,t.effect=Id,t.getExtension=Nc,t.getExtensions=function(t){return Sc[t]},t.iconfont={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"},t.idOf=bh,t.invokeLayoutMethod=Zg,t.isCollapsed=Nd,t.omitStyleProps=Pd,t.parseSize=Rd,t.positionOf=Jh,t.register=vH,t.setVisibility=Ph,t.subStyleProps=Cd,t.treeToGraphData=function(t,e){const{getNodeData:n=(t,e)=>{if(t.depth=e,!t.children)return t;const{children:n}=t,r=Fe(t,["children"]);return Object.assign(Object.assign({},r),{children:n.map((t=>t.id))})},getEdgeData:r=(t,e)=>({source:t.id,target:e.id}),getChildren:i=t=>t.children||[]}=e||{},o=[],a=[];return Ed(t,((t,e)=>{o.push(n(t,e));const s=i(t);for(const e of s)a.push(r(t,e))}),(t=>i(t)),"TB"),{nodes:o,edges:a}},t.version=Oc}));
79
+ */var RH=function(){function t(e){s(this,t),this.dragndropPluginOptions=e}return u(t,[{key:"apply",value:function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,a=function(t){var e=t.target,r=e===i,a=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(a){var s=!1,l=t.timeStamp,u=[t.clientX,t.clientY],c=null,h=[t.clientX,t.clientY],d=function(){var t=Pr(Cr().mark((function t(o){var d,f,p,g,v,m;return Cr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=8;break}if(d=o.timeStamp-l,f=gn([o.clientX,o.clientY],u),!(d<=n.dragndropPluginOptions.dragstartTimeThreshold||f<=n.dragndropPluginOptions.dragstartDistanceThreshold)){t.next=5;break}return t.abrupt("return");case 5:o.type="dragstart",a.dispatchEvent(o),s=!0;case 8:if(o.type="drag",o.dx=o.clientX-h[0],o.dy=o.clientY-h[1],a.dispatchEvent(o),h=[o.clientX,o.clientY],r){t.next=21;break}return p="pointer"===n.dragndropPluginOptions.overlap?[o.canvasX,o.canvasY]:e.getBounds().center,t.next=17,i.elementsFromPoint(p[0],p[1]);case 17:g=t.sent,v=g[g.indexOf(e)+1],m=(null==v?void 0:v.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?i:null),c!==m&&(c&&(o.type="dragleave",o.target=c,c.dispatchEvent(o)),m&&(o.type="dragenter",o.target=m,m.dispatchEvent(o)),(c=m)&&(o.type="dragover",o.target=c,c.dispatchEvent(o)));case 21:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();o.addEventListener("pointermove",d);var f=function(t){if(s){t.detail={preventClick:!0};var e=t.clone();c&&(e.type="drop",e.target=c,c.dispatchEvent(e)),e.type="dragend",a.dispatchEvent(e),s=!1}o.removeEventListener("pointermove",d)};e.addEventListener("pointerup",f,{once:!0}),e.addEventListener("pointerupoutside",f,{once:!0})}};r.hooks.init.tap(t.tag,(function(){o.addEventListener("pointerdown",a)})),r.hooks.destroy.tap(t.tag,(function(){o.removeEventListener("pointerdown",a)}))}}])}();RH.tag="Dragndrop";var DH=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),(t=v(this,e)).name="dragndrop",t.options=n,t}return y(e,t),u(e,[{key:"init",value:function(){this.addRenderingPlugin(new RH(a({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)}}])}(Br);const LH=["main"],_H=["background","main","label","transient"];class IH{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||this.getLayers().main}getLayers(){return this.extends.layers}getRenderer(t){return this.extends.renderers[t]}getCamera(t="main"){return this.getLayer(t).getCamera()}getRoot(t="main"){return this.getLayer(t).getRoot()}getContextService(t="main"){return this.getLayer(t).getContextService()}setCursor(t){this.config.cursor=t,this.getLayer().setCursor(t)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(t){this.config={enableMultiLayer:!0},Object.assign(this.config,t);const e=this.config,{renderer:n,background:r,cursor:i,enableMultiLayer:o}=e,a=Fe(e,["renderer","background","cursor","enableMultiLayer"]),s=o?_H:LH,l=jH(n,s),u=Object.fromEntries(s.map((t=>[t,new du(Object.assign(Object.assign({},a),{supportsMutipleCanvasesInOneContainer:o,renderer:l[t],background:o?"background"===t?r:void 0:r}))])));BH(u),this.extends={config:this.config,renderer:n,renderers:l,layers:u}}get ready(){return Promise.all(Object.entries(this.getLayers()).map((([,t])=>t.ready)))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach((n=>{const r=n.getCamera(),i=r.getPosition(),o=r.getFocalPoint();n.resize(t,e),r.setPosition(i),r.setFocalPoint(o)}))}getBounds(t){return th(Object.values(this.getLayers()).map((e=>t?e.getRoot().childNodes.find((e=>e.classList.includes(t))):e.getRoot())).filter((t=>(null==t?void 0:t.childNodes.length)>0)).map((t=>t.getBounds())))}getContainer(){const t=this.extends.config.container;return"string"==typeof t?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const r=(null===(n=t.style)||void 0===n?void 0:n.$layer)||"main";return this.getLayer(r).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=jH(t,this.config.enableMultiLayer?_H:LH);this.extends.renderers=e,Object.entries(e).forEach((([t,e])=>this.getLayer(t).setRenderer(e))),BH(this.getLayers())}getCanvasByViewport(t){return nd(this.getLayer().viewport2Canvas(rd(t)))}getViewportByCanvas(t){return nd(this.getLayer().canvas2Viewport(rd(t)))}getViewportByClient(t){return nd(this.getLayer().client2Viewport(rd(t)))}getClientByViewport(t){return nd(this.getLayer().viewport2Client(rd(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(rd(t));return nd(e.viewport2Canvas(n))}toDataURL(){return ze(this,arguments,void 0,(function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,r=Fe(t,["mode"]);let[i,o,a,s]=[0,0,0,0];if("viewport"===n)[a,s]=this.getSize();else if("overall"===n){const t=this.getBounds(),e=Kc(t);[i,o]=t.min,[a,s]=e}const l=Cn('<div id="virtual-image"></div>'),u=new du({width:a,height:s,renderer:new Np,devicePixelRatio:e,container:l,background:this.extends.config.background});yield u.ready,u.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),u.appendChild(this.getRoot().cloneNode(!0));const c=this.getLayer("label").getRoot().cloneNode(!0),h=u.viewport2Canvas({x:0,y:0}),d=this.getCanvasByViewport([0,0]);c.translate([d[0]-h.x,d[1]-h.y]),c.scale(1/this.getCamera().getZoom()),u.appendChild(c),u.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const f=this.getCamera(),p=u.getCamera();if("viewport"===n)p.setZoom(f.getZoom()),p.setPosition(f.getPosition()),p.setFocalPoint(f.getFocalPoint());else if("overall"===n){const[t,e,n]=p.getPosition(),[r,a,s]=p.getFocalPoint();p.setPosition([t+i,e+o,n]),p.setFocalPoint([r+i,a+o,s])}const g=u.getContextService();return new Promise((t=>{u.addEventListener(au.RERENDER,(()=>ze(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,300)));const e=yield g.toDataURL(r);t(e)}))))}))}))}destroy(){Object.values(this.getLayers()).forEach((t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()}))}}function jH(t,e){return Object.fromEntries(e.map((e=>{const n=(null==t?void 0:t(e))||new Np;return"main"===e?n.registerPlugin(new DH({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]})))}function BH(t){Object.entries(t).forEach((([t,e])=>{const n=e.getContextService().getDomElement();(null==n?void 0:n.style)&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")),(null==n?void 0:n.parentElement)&&(n.parentElement.style.display="grid")}))}const FH=t=>t?parseInt(t):0;function zH(t){if(!t)return[0,0];let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||FH(e.width),r=t.clientHeight||FH(e.height);return[n-(FH(e.paddingLeft)+FH(e.paddingRight)),r-(FH(e.paddingTop)+FH(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(ae(e)?e:1,1),Math.max(ae(n)?n:1,1)]}class GH{constructor(t){this.type=t}}class VH extends GH{constructor(t,e){super(t),this.data=e}}class WH extends GH{constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class HH extends GH{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class UH extends GH{constructor(t,e){super(t),this.data=e}}function YH(t,e){t.emit(e.type,e)}function $H(t){var e;return(null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0}const qH="cachedStyle",XH=t=>`__${t}__`;function KH(t,e){return Oe(t,[qH,XH(e)])}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 r,i,o;null===(r=null==e?void 0:e.before)||void 0===r||r.call(e);const a=this.getTasks().map((([e,r])=>{var i,o,a;const{element:s,elementType:l,stage:u}=e,c=_c(this.context.options,l,u,t);null===(i=null==r?void 0:r.before)||void 0===i||i.call(r);const h=c.length?jc(s,this.inferStyle(e,n),c):null;return h?(null===(o=null==r?void 0:r.beforeAnimate)||void 0===o||o.call(r,h),h.finished.then((()=>{var t,e;null===(t=null==r?void 0:r.afterAnimate)||void 0===t||t.call(r,h),null===(e=null==r?void 0:r.after)||void 0===e||e.call(r),this.animations.delete(h)}))):null===(a=null==r?void 0:r.after)||void 0===a||a.call(r),h})).filter(Boolean);a.forEach((t=>this.animations.add(t)));const s=Pc(a);return s?(null===(i=null==e?void 0:e.beforeAnimate)||void 0===i||i.call(e,s),s.finished.then((()=>{var t,n;null===(t=null==e?void 0:e.afterAnimate)||void 0===t||t.call(e,s),null===(n=null==e?void 0:e.after)||void 0===n||n.call(e),this.release()}))):null===(o=null==e?void 0:e.after)||void 0===o||o.call(e),s}inferStyle(t,e){var n,r;const{element:i,elementType:o,stage:a,originalStyle:s,updatedStyle:l={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},s),l));const{modifiedStyle:u}=t,c={},h={};if("enter"===a)Object.assign(c,{opacity:0});else if("exit"===a)Object.assign(h,{opacity:0});else if("show"===a)Object.assign(c,{opacity:0}),Object.assign(h,{opacity:null!==(n=KH(i,"opacity"))&&void 0!==n?n:Dc("opacity")});else if("hide"===a)Object.assign(c,{opacity:null!==(r=KH(i,"opacity"))&&void 0!==r?r:Dc("opacity")}),Object.assign(h,{opacity:0});else if("collapse"===a){const{collapse:t}=e||{},{target:n,descendants:r,position:a}=t;if("node"===o){if(r.includes(i.id)){const[t,e,n]=a;Object.assign(h,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e]=a;Object.assign(h,{x:t,y:e,childrenNode:s.childrenNode})}}else"edge"===o&&Object.assign(h,{sourceNode:u.sourceNode,targetNode:u.targetNode})}else if("expand"===a){const{expand:t}=e||{},{target:n,descendants:r,position:a}=t;if("node"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=a;Object.assign(c,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=a;Object.assign(c,{x:t,y:e,z:n,childrenNode:u.childrenNode})}}else"edge"===o&&Object.assign(c,{sourceNode:u.sourceNode,targetNode:u.targetNode})}return[Object.keys(c).length>0?Object.assign({},s,c):s,Object.keys(h).length>0?Object.assign({},u,h):u]}stop(){this.animations.forEach((t=>t.cancel()))}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,r=null===(e=null===(t=n.document)||void 0===t?void 0:t.timeline)||void 0===e?void 0:e.animationsWithPromises;r&&(n.document.timeline.animationsWithPromises=r.filter((t=>"finished"!==t.playState)))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class QH{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(e=!0){this.batchCount++,1===this.batchCount&&this.emit(new VH(t.GraphEvent.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,0===this.batchCount&&this.emit(new VH(t.GraphEvent.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class JH extends Rh{constructor(e){super(e),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof tu)return{type:"canvas",element:t};let e=t;for(;e;){if(kg(e))return{type:"node",element:e};if(Mg(e))return{type:"edge",element:e};if(Sg(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:a,element:s}=r;if("destroyed"in s&&(jg(s)||s.destroyed))return;const{type:l,detail:u,button:c}=e,h=Object.assign(Object.assign({},e),{target:s,targetType:a,originalTarget:n});l===t.CommonEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${this.currentTargetType}:${t.CommonEvent.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:t.CommonEvent.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),s&&(Object.assign(h,{type:t.CommonEvent.POINTER_ENTER}),i.emit(`${a}:${t.CommonEvent.POINTER_ENTER}`,h))),this.currentTarget=s,this.currentTargetType=a),l===t.CommonEvent.CLICK&&2===c||(i.emit(`${a}:${l}`,h),i.emit(l,h)),l===t.CommonEvent.CLICK&&2===u&&(Object.assign(h,{type:t.CommonEvent.DBLCLICK}),i.emit(`${a}:${t.CommonEvent.DBLCLICK}`,h),i.emit(t.CommonEvent.DBLCLICK,h)),l===t.CommonEvent.POINTER_DOWN&&2===c&&(Object.assign(h,{type:t.CommonEvent.CONTEXT_MENU,preventDefault:()=>{var e;null===(e=o.getContainer())||void 0===e||e.addEventListener(t.CommonEvent.CONTEXT_MENU,(t=>t.preventDefault()),{once:!0})}}),i.emit(`${a}:${t.CommonEvent.CONTEXT_MENU}`,h),i.emit(t.CommonEvent.CONTEXT_MENU,h))},this.forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.addEventListener(t,this.forwardContainerEvents)}));const n=this.context.canvas.document;n&&[t.CommonEvent.CLICK,t.CommonEvent.DBLCLICK,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE,t.CommonEvent.POINTER_ENTER,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_OUT,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_UP,t.CommonEvent.CONTEXT_MENU,t.CommonEvent.DRAG_START,t.CommonEvent.DRAG,t.CommonEvent.DRAG_END,t.CommonEvent.DRAG_ENTER,t.CommonEvent.DRAG_OVER,t.CommonEvent.DRAG_LEAVE,t.CommonEvent.DROP,t.CommonEvent.WHEEL].forEach((t=>{n.addEventListener(t,this.forwardCanvasEvents)}))}destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.removeEventListener(t,this.forwardContainerEvents)})),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function tU(t,e){const{data:n,style:r}=t,i=Fe(t,["data","style"]),{data:o,style:a}=e,s=Fe(e,["data","style"]),l=Object.assign(Object.assign({},i),s);return(n||o)&&Object.assign(l,{data:Object.assign(Object.assign({},n),o)}),(r||a)&&Object.assign(l,{style:Object.assign(Object.assign({},r),a)}),l}function eU(t){const{data:e,style:n}=t,r=Fe(t,["data","style"]);return e&&(r.data=Object.assign({},e)),n&&(r.style=Object.assign({},n)),r}function nU(t={},e={}){const{states:n=[],data:r={},style:i={},children:o=[]}=t,a=Fe(t,["states","data","style","children"]),{states:s=[],data:l={},style:u={},children:c=[]}=e,h=(t,e)=>t.length===e.length&&t.every(((t,n)=>t===e[n])),d=(t,e)=>{const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((n=>t[n]===e[n]))};return!!d(a,Fe(e,["states","data","style","children"]))&&(!!h(o,c)&&(!!h(n,s)&&(!!d(r,l)&&!!d(i,u))))}function rU(t){const{id:e=bh(t),style:n,data:r}=t,i=Fe(t,["id","style","data"]),o=Object.assign(Object.assign({},t),{style:Object.assign({},n),data:Object.assign({},r)});return function(t){return"source"in t&&"target"in t}(t)?Object.assign({id:e,data:o},i):{id:e,data:o}}function iU(t){return t.data}class oU{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new qg}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===fc.NodeUpdated||e===fc.EdgeUpdated||e===fc.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:eU(n),original:eU(r),type:e})}else this.changes.push({value:eU(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}isBatching(){return this.batchCount>0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=iU(n);return this.isCombo(bh(r))||(void 0===t||t.includes(bh(r)))&&e.push(r),e}),[])}getEdgeDatum(t){return iU(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce(((e,n)=>{const r=iU(n);return(void 0===t||t.includes(bh(r)))&&e.push(r),e}),[])}getComboData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=iU(n);return this.isCombo(bh(r))?((void 0===t||t.includes(bh(r)))&&e.push(r),e):e}),[])}getRootsData(t=kc){return this.model.getRoots(t).map(iU)}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(iU):[]}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Ed(e,(t=>{t!==e&&n.push(t)}),(t=>this.getChildrenData(bh(t))),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e)return void Cc("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?iU(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?kc:wc,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(iU):[]}getElementsDataByType(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementDataById(t){return"edge"===this.getElementType(t)?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){return iU(this.model.getNode(t))}getNodeLikeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=iU(n);return t?t.includes(bh(r))&&e.push(r):e.push(r),e}),[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter((t=>{var n;return null===(n=t.states)||void 0===n?void 0:n.includes(e)}))}getElementState(t){var e;return(null===(e=this.getElementDataById(t))||void 0===e?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(iU)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(iU)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i,edges:o,combos:a}=this.getData(),s=Ah(i,e,(t=>bh(t)),nU),l=Ah(o,n,(t=>bh(t)),nU),u=Ah(a,r,(t=>bh(t)),nU);this.batch((()=>{const t={nodes:s.enter,edges:l.enter,combos:u.enter};this.addData(t),this.computeZIndex(t,"add",!0);const e={nodes:s.update,edges:l.update,combos:u.update};this.updateData(e),this.computeZIndex(e,"update",!0);const n={nodes:s.exit.map(bh),edges:l.exit.map(bh),combos:u.exit.map(bh)};this.removeData(n)}))}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)})),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map((t=>(this.pushChange({value:t,type:fc.NodeAdded}),rU(t))))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map((t=>(this.pushChange({value:t,type:fc.EdgeAdded}),rU(t))))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(wc)||e.attachTreeStructure(wc),e.addNodes(t.map((t=>(this.comboIds.add(bh(t)),this.pushChange({value:t,type:fc.ComboAdded}),rU(t))))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),r=e.map(bh);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...r]}]),this.addEdgeData(r.map((e=>({source:t,target:e}))))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch((()=>{const{nodes:n=[],edges:r=[],combos:i=[]}=t;i.forEach((t=>{var n,r,i;const o=bh(t);if("add"===e&&ae(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t))return;const a=this.getParentData(o,wc),s=a?(null!==(i=null===(r=a.style)||void 0===r?void 0:r.zIndex)&&void 0!==i?i:0)+1:0;this.preventUpdateNodeLikeHierarchy((()=>{this.updateComboData([{id:o,style:{zIndex:s}}])}))})),n.forEach((t=>{var n,r,i;const o=bh(t);if("add"===e&&ae(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t)&&!("children"in t))return;let a=0;const s=this.getParentData(o,wc);if(s)a=((null===(r=s.style)||void 0===r?void 0:r.zIndex)||0)+1;else{const t=this.getParentData(o,kc);t&&(a=(null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.zIndex)||0)}this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:o,style:{zIndex:a}}])}))})),r.forEach((t=>{var e,n,r,i,o;if(ae(null===(e=t.style)||void 0===e?void 0:e.zIndex))return;let{id:a,source:s,target:l}=t;if(a){const t=this.getEdgeDatum(a);s=t.source,l=t.target}else a=bh(t);if(!s||!l)return;const u=(null===(r=null===(n=this.getNodeLikeDatum(s))||void 0===n?void 0:n.style)||void 0===r?void 0:r.zIndex)||0,c=(null===(o=null===(i=this.getNodeLikeDatum(l))||void 0===i?void 0:i.style)||void 0===o?void 0:o.zIndex)||0;this.updateEdgeData([{id:bh(t),style:{zIndex:Math.max(u,c)-1}}])}))}))}getFrontZIndex(t){var e;const n=this.getElementType(t),r=this.getElementDataById(t),i=this.getData();if(Object.assign(i,{[`${n}s`]:i[`${n}s`].filter((e=>bh(e)!==t))}),"combo"===n&&!Nd(r)){const e=new Set(this.getAncestorsData(t,wc).map(bh));i.nodes=i.nodes.filter((t=>!e.has(bh(t)))),i.combos=i.combos.filter((t=>!e.has(bh(t)))),i.edges=i.edges.filter((({source:t,target:n})=>!e.has(t)&&!e.has(n)))}return Math.max((null===(e=r.style)||void 0===e?void 0:e.zIndex)||0,0,...Object.values(i).flat().map((t=>{var e;return((null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0)+1})))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach((t=>{const n=bh(t),r=xh(t);void 0!==r&&(e.hasTreeStructure(wc)||e.attachTreeStructure(wc),null===r&&this.refreshComboData(n),this.setParent(n,xh(t),wc));const i=t.children||[];if(i.length){e.hasTreeStructure(kc)||e.attachTreeStructure(kc);const t=i.filter((t=>e.hasNode(t)));t.forEach((t=>this.setParent(t,n,kc))),t.length!==i.length&&this.updateNodeData([{id:n,children:t}])}}))}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)})),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{const n=[];t.forEach((t=>{const r=bh(t),i=iU(e.getNode(r));if(nU(i,t))return;const o=tU(i,t);this.pushChange({value:o,original:i,type:fc.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)})),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach((t=>{this.pushChange({value:t,original:t,type:fc.NodeUpdated})})),e.forEach((t=>{this.pushChange({value:t,original:t,type:fc.EdgeUpdated})})),n.forEach((t=>{this.pushChange({value:t,original:t,type:fc.ComboUpdated})}))}syncNodeDatum(t){const{model:e}=this,n=bh(t),r=tU(iU(e.getNode(n)),t);e.mergeNodeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{t.forEach((t=>{const n=bh(t),r=iU(e.getEdge(n));if(nU(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=tU(r,t);this.pushChange({value:i,original:r,type:fc.EdgeUpdated}),e.mergeEdgeData(n,i)}))})),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch((()=>{const n=[];t.forEach((t=>{const r=bh(t),i=iU(e.getNode(r));if(nU(i,t))return;const o=tU(i,t);this.pushChange({value:o,original:i,type:fc.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)})),this.computeZIndex({combos:t},"update")}setParent(t,e,n,r=!0){if(t===e)return;const i=xh(this.getNodeLikeDatum(t));if(i!==e&&n===wc){const n={id:t,combo:e};this.isCombo(t)?this.syncComboDatum(n):this.syncNodeDatum(n)}this.model.setParent(t,e,n),r&&n===wc&&function(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}([i,e]).forEach((t=>{void 0!==t&&this.refreshComboData(t)}))}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,wc);e&&this.pushChange({value:e,original:e,type:fc.ComboUpdated}),n.forEach((t=>{this.pushChange({value:t,original:t,type:fc.ComboUpdated})}))}syncComboDatum(t){const{model:e}=this,n=bh(t);if(!e.hasNode(n))return;const r=tU(iU(e.getNode(n)),t);e.mergeNodeData(n,r)}getElementPosition(t){return Jh(this.getElementDataById(t))}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=jh(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])}))}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every((t=>0===t)))return;const o=this.getComboData([t])[0];if(!o)return;const a=new Set;Ed(o,(t=>{const e=bh(t);if(a.has(e))return;a.add(e);const[o,s,l]=Jh(t),u=tU(t,{style:{x:o+n,y:s+r,z:l+i}});this.pushChange({value:u,original:t,type:this.isCombo(e)?fc.ComboUpdated:fc.NodeUpdated}),this.model.mergeNodeData(e,u)}),(t=>this.getChildrenData(bh(t))),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[r=0,i=0,o=0]=e,a=null===(n=this.getComboData([t]))||void 0===n?void 0:n[0];if(!a)return;const[s,l,u]=Jh(a),c=r-s,h=i-l,d=o-u;Ed(a,(t=>{const e=bh(t),[n,r,i]=Jh(t),o=tU(t,{style:{x:n+c,y:r+h,z:i+d}});this.pushChange({value:o,original:t,type:this.isCombo(e)?fc.ComboUpdated:fc.NodeUpdated}),this.model.mergeNodeData(e,o)}),(t=>this.getChildrenData(bh(t))),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)}))}removeNodeData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(bh)),this.pushChange({value:this.getNodeData([t])[0],type:fc.NodeRemoved}),this.removeNodeLikeHierarchy(t)})),this.model.removeNodes(t)}))}removeEdgeData(t=[]){t.length&&(t.forEach((t=>this.pushChange({value:this.getEdgeData([t])[0],type:fc.EdgeRemoved}))),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.pushChange({value:this.getComboData([t])[0],type:fc.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)})),this.model.removeNodes(t)}))}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(wc)){const e=xh(this.getNodeLikeDatum(t));this.setParent(t,void 0,wc,!1),this.model.getChildren(t,wc).forEach((t=>{const n=iU(t),r=bh(n);this.setParent(bh(n),e,wc,!1);const i=tU(n,{id:bh(n),combo:e});this.pushChange({value:i,original:n,type:this.isCombo(r)?fc.ComboUpdated:fc.NodeUpdated}),this.model.mergeNodeData(bh(n),i)})),Yt(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(Tc(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map((t=>t.id))),t.removeNodes(e.map((t=>t.id))),this.context={}}}class aU{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){if(!this.container){const{canvas:t}=this.context;this.container=t.appendChild(new Bl({className:"elements"}))}}emit(t,e){e.silence||YH(this.context.graph,t)}forEachElementData(t){xd.forEach((e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)}))}getElementType(t,e){var n;const{options:r,graph:i}=this.context,o=(null===(n=r[t])||void 0===n?void 0:n.type)||e.type;return o?"string"==typeof o?o:o.call(i,e):"edge"===t?"line":"circle"}getTheme(t){return Ac(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map((t=>n[t]||{})))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData(((e,n)=>{var r,i;const o=Object.assign({},Bd(null===(r=this.getTheme(e))||void 0===r?void 0:r.palette),Bd(null===(i=t[e])||void 0===i?void 0:i.palette));(null==o?void 0:o.field)&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,a=t=>{const e="string"==typeof r?Nc("palette",r):r;if("function"==typeof e){const n={};return t.forEach((([t,r])=>{n[t]=e(o?1-r:r)})),n}if(Array.isArray(e)){const n=o?[...e].reverse():e,r={};return t.forEach((([t,i])=>{r[t]=n[i%e.length]})),r}return{}},s=(t,e)=>{var n;return"string"==typeof t?null===(n=e.data)||void 0===n?void 0:n[t]:null==t?void 0:t(e)};if("group"===n){const e=ie(t,(t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"})),n=a(Object.keys(e).map(((t,e)=>[t,e]))),r={};return Object.entries(e).forEach((([t,e])=>{e.forEach((e=>{r[bh(e)]=n[t]}))})),r}if("value"===n){const[e,n]=t.reduce((([t,e],n)=>{const r=s(i,n);if("number"!=typeof r)throw new Error(Tc(`Palette field ${i} is not a number`));return[Math.min(t,r),Math.max(e,r)]}),[1/0,-1/0]),r=n-e;return a(t.map((t=>[t.id,(s(i,t)-e)/r])))}}(n,o))}))}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?"edge"===t?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:r}=this.context,i=(null===(n=r[t])||void 0===n?void 0:n.style)||{};"transform"in i&&Array.isArray(i.transform)&&(i.transform=[...i.transform]),this.defaultStyle[bh(e.datum)]=Dd(i,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];(void 0===t||t.includes(bh(i)))&&this.computeElementDefaultStyle(n,{datum:i,graph:e})}}))}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch(t){return[]}}getElementStateStyle(t,e,n){var r,i;const{options:o}=this.context;return Dd((null===(i=null===(r=o[t])||void 0===r?void 0:r.state)||void 0===i?void 0:i[e])||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[bh(n.datum)]=Object.assign({},...e.map((e=>this.getElementStateStyle(t,e,n))))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];if(void 0===t||t.includes(bh(i))){const t=this.getElementState(bh(i));this.computeElementStatesStyle(n,t,{datum:i,graph:e})}}}))}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getNodes(){return this.context.model.getNodeData().map((({id:t})=>this.elementMap[t]))}getEdges(){return this.context.model.getEdgeData().map((t=>this.elementMap[bh(t)]))}getCombos(){return this.context.model.getComboData().map((({id:t})=>this.elementMap[t]))}getElementComputedStyle(t,e){const n=bh(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(t,n),o=e.style||{},a=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),l=this.getStateStyle(n),u=Object.assign({},r,i,o,a,s,l);if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!u.collapsed?[]:t.map(bh).filter((t=>this.getElement(t)));Object.assign(u,{childrenNode:e,childrenData:t})}return u}draw(e={animation:!0}){this.init();const n=this.computeChangesAndDrawData(e);if(!n)return null;const{type:r="draw",stage:i=r,animation:o,silence:a}=e,{dataChanges:s,drawData:l}=n;this.markDestroyElement(l),this.computeStyle(i);const{add:u,update:c,remove:h}=l;return this.destroyElements(h,e),this.createElements(u,e),this.updateElements(c,e),this.context.animation.animate(o,a?{}:{before:()=>this.emit(new VH(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:o,stage:i,render:"render"===r}),e),beforeAnimate:n=>this.emit(new WH(t.GraphEvent.BEFORE_ANIMATE,pc.DRAW,n,l),e),afterAnimate:n=>this.emit(new WH(t.GraphEvent.AFTER_ANIMATE,pc.DRAW,n,l),e),after:()=>this.emit(new VH(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:o,stage:i,render:"render"===r,firstRender:!1===this.context.graph.rendered}),e)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),r=aF(n);if(0===r.length)return null;const{NodeAdded:i=[],NodeUpdated:o=[],NodeRemoved:a=[],EdgeAdded:s=[],EdgeUpdated:l=[],EdgeRemoved:u=[],ComboAdded:c=[],ComboUpdated:h=[],ComboRemoved:d=[]}=ie(r,(t=>t.type)),f=t=>new Map(t.map((t=>{const e=t.value;return[bh(e),e]}))),p={add:{nodes:f(i),edges:f(s),combos:f(c)},update:{nodes:f(o),edges:f(l),combos:f(h)},remove:{nodes:f(a),edges:f(u),combos:f(d)}},g=this.transformData(p,t);return e.clearChanges(),{dataChanges:n,drawData:g}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce(((t,n)=>n.beforeDraw(t,e)),t)}createElement(e,n,r){var i;const o=bh(n);if(this.getElement(o))return;const a=this.getElementType(e,n),s=this.getElementComputedStyle(e,n),l=Nc(e,a);if(!l)return Cc(`The element ${a} of ${e} is not registered.`);this.emit(new HH(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n),r);const u=this.container.appendChild(new l({id:o,context:this.context,style:Object.assign({},s)}));this.shapeTypeMap[o]=a,this.elementMap[o]=u;const{stage:c="enter"}=r;null===(i=this.context.animation)||void 0===i||i.add({element:u,elementType:e,stage:c,originalStyle:Object.assign({},u.attributes),updatedStyle:s},{after:()=>{var i;this.emit(new HH(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n),r),null===(i=u.onCreate)||void 0===i||i.call(u)}})}createElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.createElement(t,n,e)))}))}getUpdateStageStyle(t,e,n){const{stage:r="update"}=n;if("translate"===r){if("node"===t||"combo"===t){const{style:{x:t=0,y:n=0,z:r=0}={}}=e;return{x:t,y:n,z:r}}return{}}return this.getElementComputedStyle(t,e)}updateElement(e,n,r){var i;const o=bh(n),{stage:a="update"}=r,s=this.getElement(o);if(!s)return()=>null;this.emit(new HH(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n),r);const l=this.getElementType(e,n),u=this.getUpdateStageStyle(e,n,r);this.shapeTypeMap[o]!==l&&(s.destroy(),delete this.shapeTypeMap[o],delete this.elementMap[o],this.createElement(e,n,{animation:!1,silence:!0}));const c="visibility"!==a?a:"hidden"===u.visibility?"hide":"show";"hide"===c&&delete u.visibility,null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:c,originalStyle:Object.assign({},s.attributes),updatedStyle:u},{before:()=>{const t=this.elementMap[o];"collapse"!==a&&Ig(t,u),"visibility"===a&&(function(t,e){return XH(e)in(Oe(t,qH)||{})}(t,"opacity")||function(t,e){const n=Array.isArray(e)?e:[e];Oe(t,qH)||Te(t,qH,{}),n.forEach((e=>{Te(Oe(t,qH),XH(e),t.attributes[e])}))}(t,"opacity"),this.visibilityCache.set(t,"show"===c?"visible":"hidden"),"show"===c&&Ph(t,"visible"))},after:()=>{var i;const s=this.elementMap[o];"collapse"===a&&Ig(s,u),"hide"===c&&Ph(s,this.visibilityCache.get(s)),this.emit(new HH(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n),r),null===(i=s.onUpdate)||void 0===i||i.call(s)}})}updateElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.updateElement(t,n,e)))}))}markDestroyElement(t){Object.values(t.remove).forEach((t=>{t.forEach((t=>{const e=bh(t),n=this.getElement(e);n&&function(t){Te(t,"__to_be_destroyed__",!0)}(n)}))}))}destroyElement(e,n,r){var i;const{stage:o="exit"}=r,a=bh(n),s=this.elementMap[a];if(!s)return()=>null;this.emit(new HH(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n),r),null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:o,originalStyle:Object.assign({},s.attributes),updatedStyle:{}},{after:()=>{var i;this.clearElement(a),s.destroy(),null===(i=s.onDestroy)||void 0===i||i.call(s),this.emit(new HH(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n),r)}})}destroyElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["combo",i],["edge",r],["node",n]].forEach((([t,n])=>{n.forEach((n=>this.destroyElement(t,n,e)))}))}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,r;const i=null===(n=t.nodes)||void 0===n?void 0:n.find((t=>bh(t)===e));if(i){const n=Bh(Jh(this.context.model.getNodeLikeDatum(e)),Jh(i));null===(r=t.nodes)||void 0===r||r.forEach((t=>{var e,r,i;(null===(e=t.style)||void 0===e?void 0:e.x)&&(t.style.x+=n[0]),(null===(r=t.style)||void 0===r?void 0:r.y)&&(t.style.y+=n[1]),(null===(i=t.style)||void 0===i?void 0:i.z)&&(t.style.z+=n[2]||0)}))}}collapseNode(e,n){return ze(this,void 0,void 0,(function*(){var r;const{animation:i,align:o}=n,{model:a,layout:s}=this.context,l=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!l)return;this.markDestroyElement(l.drawData);const u=yield s.simulate();o&&this.alignLayoutResultToElement(u,e),a.updateData(u);const c=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!c)return;const{drawData:h}=c,{add:d,remove:f,update:p}=h;this.markDestroyElement(h);const g={animation:i,stage:"collapse",data:h};this.destroyElements(f,g),this.createElements(d,g),this.updateElements(p,g),yield null===(r=this.context.animation.animate(i,{beforeAnimate:e=>this.emit(new WH(t.GraphEvent.BEFORE_ANIMATE,pc.COLLAPSE,e,h),g),afterAnimate:e=>this.emit(new WH(t.GraphEvent.AFTER_ANIMATE,pc.COLLAPSE,e,h),g)},{collapse:{target:e,descendants:Array.from(f.nodes).map((([,t])=>bh(t))),position:Jh(p.nodes.get(e))}}))||void 0===r?void 0:r.finished}))}expandNode(e,n){return ze(this,void 0,void 0,(function*(){var r;const{model:i,layout:o}=this.context,{animation:a,align:s}=n,l=Jh(i.getNodeData([e])[0]),u=this.computeChangesAndDrawData({stage:"expand",animation:a});if(!u)return;const{drawData:{add:c}}=u;this.createElements(c,{animation:!1,stage:"expand",target:e}),this.context.animation.clear();const h=yield o.simulate();s&&this.alignLayoutResultToElement(h,e),i.updateData(h),this.computeStyle("expand");const d=this.computeChangesAndDrawData({stage:"collapse",animation:a});if(!d)return;const{drawData:f}=d,{update:p}=f,g={animation:a,stage:"expand",data:f};c.edges.forEach((t=>p.edges.set(bh(t),t))),c.nodes.forEach((t=>p.nodes.set(bh(t),t))),this.updateElements(p,g),yield null===(r=this.context.animation.animate(a,{beforeAnimate:e=>this.emit(new WH(t.GraphEvent.BEFORE_ANIMATE,pc.EXPAND,e,f),g),afterAnimate:e=>this.emit(new WH(t.GraphEvent.AFTER_ANIMATE,pc.EXPAND,e,f),g)},{expand:{target:e,descendants:Array.from(c.nodes).map((([,t])=>bh(t))),position:l}}))||void 0===r?void 0:r.finished}))}collapseCombo(e,n){return ze(this,void 0,void 0,(function*(){var r;const{model:i,element:o}=this.context;if(i.getAncestorsData(e,wc).some((t=>Nd(t))))return;const a=o.getElement(e),s=a.getComboPosition(Object.assign(Object.assign({},a.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:n});if(!l)return;const{dataChanges:u,drawData:c}=l;this.markDestroyElement(c);const{update:h,remove:d}=c,f={animation:n,stage:"collapse",data:c};this.destroyElements(d,f),this.updateElements(h,f);const p=t=>Array.from(t).map((([,t])=>bh(t)));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new VH(t.GraphEvent.BEFORE_DRAW,{dataChanges:u,animation:n}),f),beforeAnimate:e=>this.emit(new WH(t.GraphEvent.BEFORE_ANIMATE,pc.COLLAPSE,e,c),f),afterAnimate:e=>this.emit(new WH(t.GraphEvent.AFTER_ANIMATE,pc.COLLAPSE,e,c),f),after:()=>this.emit(new VH(t.GraphEvent.AFTER_DRAW,{dataChanges:u,animation:n}),f)},{collapse:{target:e,descendants:[...p(d.nodes),...p(d.combos)],position:s}}))||void 0===r?void 0:r.finished}))}expandCombo(e,n){return ze(this,void 0,void 0,(function*(){var r;const{model:i}=this.context,o=Jh(i.getComboData([e])[0]);this.computeStyle("expand");const a=this.computeChangesAndDrawData({stage:"expand",animation:n});if(!a)return;const{dataChanges:s,drawData:l}=a,{add:u,update:c}=l,h={animation:n,stage:"expand",data:l,target:e};this.createElements(u,h),this.updateElements(c,h);const d=t=>Array.from(t).map((([,t])=>bh(t)));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new VH(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:n}),h),beforeAnimate:e=>this.emit(new WH(t.GraphEvent.BEFORE_ANIMATE,pc.EXPAND,e,l),h),afterAnimate:e=>this.emit(new WH(t.GraphEvent.AFTER_ANIMATE,pc.EXPAND,e,l),h),after:()=>this.emit(new VH(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:n}),h)},{expand:{target:e,descendants:[...d(u.nodes),...d(u.combos)],position:o}}))||void 0===r?void 0:r.finished}))}destroy(){this.container.destroy(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={},this.context={}}}class sU{get presetOptions(){return{animation:!!Lc(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}layout(){return ze(this,void 0,void 0,(function*(){if(!this.options)return;const e=Array.isArray(this.options)?this.options:[this.options],{graph:n}=this.context;YH(n,new VH(t.GraphEvent.BEFORE_LAYOUT));for(const r of e){const i=e.indexOf(r),o=this.getLayoutData(r),a=Object.assign(Object.assign({},this.presetOptions),r);YH(n,new VH(t.GraphEvent.BEFORE_STAGE_LAYOUT,{options:a,index:i}));const s=yield this.stepLayout(o,a,i);YH(n,new VH(t.GraphEvent.AFTER_STAGE_LAYOUT,{options:a,index:i})),r.animation||this.updateElementPosition(s,!1)}YH(n,new VH(t.GraphEvent.AFTER_LAYOUT)),this.transformDataAfterLayout()}))}transformDataAfterLayout(){const t=this.context.transform.getTransformInstance();Object.values(t).forEach((t=>t.afterLayout()))}simulate(){return ze(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 r=t.indexOf(n),i=this.getLayoutData(n);e=yield this.stepLayout(i,Object.assign(Object.assign(Object.assign({},this.presetOptions),n),{animation:!1}),r)}return e}))}stepLayout(t,e,n){return ze(this,void 0,void 0,(function*(){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)}))}graphLayout(t,e,n){return ze(this,void 0,void 0,(function*(){const{animation:r,enableWorker:i,iterations:o=300}=e,a=this.initGraphLayout(e);if(!a)return{};if(this.instances[n]=a,this.instance=a,i){const e=a;return this.supervisor=new Kj(e.graphData2LayoutModel(t),e.instance,{iterations:o}),Kg(yield this.supervisor.execute())}if(Jx(a))return r?yield a.execute(t,{onTick:t=>{this.updateElementPosition(t,!1)}}):(a.execute(t),a.stop(),a.tick(o));const s=yield a.execute(t);if(r){const t=this.updateElementPosition(s,r);yield null==t?void 0:t.finished}return s}))}treeLayout(t,e,n){return ze(this,void 0,void 0,(function*(){const{type:n,animation:r}=e,i=Nc("layout",n);if(!i)return{};const{nodes:o=[],edges:a=[]}=t,s=new qg({nodes:o.map((t=>({id:bh(t),data:t.data||{}}))),edges:a.map((t=>({id:bh(t),source:t.source,target:t.target,data:t.data||{}})))});!function(t){if(t.hasTreeStructure(kc))return;t.attachTreeStructure(kc);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,kc)}}(s);const l={nodes:[],edges:[]},u={nodes:[],edges:[]};s.getRoots(kc).forEach((t=>{Ed(t,(t=>{t.children=s.getSuccessors(t.id)}),(t=>s.getSuccessors(t.id)),"TB");const n=i(t,e),{x:r,y:o,z:a=0}=n;Ed(n,(t=>{const{id:e,x:n,y:i,z:s=0}=t;l.nodes.push({id:e,style:{x:r,y:o,z:a}}),u.nodes.push({id:e,style:{x:n,y:i,z:s}})}),(t=>t.children),"TB")}));const c=this.inferTreeLayoutOffset(u);if(lU(u,c),r){lU(l,c),this.updateElementPosition(l,!1);const t=this.updateElementPosition(u,r);yield null==t?void 0:t.finished}return u}))}inferTreeLayoutOffset(t){var e;let[n,r]=[1/0,-1/0],[i,o]=[1/0,-1/0];null===(e=t.nodes)||void 0===e||e.forEach((t=>{const{x:e=0,y:a=0}=t.style||{};n=Math.min(n,e),r=Math.max(r,e),i=Math.min(i,a),o=Math.max(o,a)}));const{canvas:a}=this.context,s=a.getSize(),[l,u]=a.getCanvasByViewport([0,0]),[c,h]=a.getCanvasByViewport(s);if(n>=l&&r<=c&&i>=u&&o<=h)return[0,0];return[(l+c)/2-(n+r)/2,(u+h)/2-(i+o)/2]}stopLayout(){this.instance&&Jx(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}=t,{nodes:n,edges:r,combos:i}=this.context.model.getData(),o=t=>this.context.element.getElement(t),a=n.filter((t=>{const n=bh(t),r=o(n);return!!r&&(!jg(r)&&e(t))})),s=new Map(a.map((t=>[bh(t),t])));return{nodes:a,edges:r.filter((t=>{const{source:e,target:n}=t;return!(!s.has(e)||!s.has(n))})),combos:i}}initGraphLayout(t){var e;const{element:n,viewport:r}=this.context,{type:i,enableWorker:o,animation:a,iterations:s}=t,l=Fe(t,["type","enableWorker","animation","iterations"]),[u,c]=r.getCanvasSize(),h=[u/2,c/2],d=null!==(e=null==t?void 0:t.nodeSize)&&void 0!==e?e:t=>{const e=null==n?void 0:n.getElement(t.id),{size:r}=(null==e?void 0:e.attributes)||{};return r},f=Nc("layout",i);if(!f)return Cc(`The layout of ${i} is not registered.`);const p=Object.getPrototypeOf(f.prototype)===Xg.prototype?f:function(t,e){return class extends Xg{constructor(e,n){if(super(e,n),this.instance=new t({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const t=this.instance;this.stop=t.stop.bind(t),this.tick=e=>Kg(t.tick(e))}}execute(t,e){return ze(this,void 0,void 0,(function*(){return Kg(yield this.instance.execute(this.graphData2LayoutModel(t),this.transformOptions(ke({},this.options,e))))}))}transformOptions(t){const{onTick:e}=t;return e?(t.onTick=t=>e(Kg(t)),t):t}graphData2LayoutModel(t){const{nodes:n=[],edges:r=[],combos:i=[]}=t,o=n.map((t=>{const e=bh(t),{data:n,style:r,combo:i}=t,o=Fe(t,["data","style","combo"]),a={id:e,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),{data:n}),i?{parentId:i}:{}),{style:r}),o)};return(null==r?void 0:r.x)&&Object.assign(a.data,{x:r.x}),(null==r?void 0:r.y)&&Object.assign(a.data,{y:r.y}),(null==r?void 0:r.z)&&Object.assign(a.data,{z:r.z}),a})),a=new Map(o.map((t=>[t.id,t]))),s=r.filter((t=>{const{source:e,target:n}=t;return a.has(e)&&a.has(n)})).map((t=>{const{source:e,target:n,data:r,style:i}=t;return{id:bh(t),source:e,target:n,data:Object.assign({},r),style:Object.assign({},i)}})),l=i.map((t=>({id:bh(t),data:Object.assign({_isCombo:!0},t.data),style:Object.assign({},t.style)}))),u=new qg({nodes:[...o,...l],edges:s});return e.model.model.hasTreeStructure(wc)&&(u.attachTreeStructure(wc),o.forEach((t=>{const n=e.model.model.getParent(t.id,wc);n&&u.hasNode(n.id)&&u.setParent(t.id,n.id,wc)}))),u}}}(f,this.context),g=new p(this.context),v={nodeSize:d,width:u,height:c,center:h};switch(g.id){case"d3-force":case"d3-force-3d":Object.assign(v,{center:{x:u/2,y:c/2,z:0}})}return ke(g.options,v,l),g}updateElementPosition(t,e){const{model:n,element:r}=this.context;return r?(n.updateData(t),r.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},null===(t=this.supervisor)||void 0===t||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const lU=(t,e)=>{var n;const[r,i]=e;null===(n=t.nodes)||void 0===n||n.forEach((t=>{if(t.style){const{x:e=0,y:n=0}=t.style;t.style.x=e+r,t.style.y=n+i}else t.style={x:r,y:i}}))};class uU extends Rh{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;Cc(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find((e=>e.type===t));return n?this.extensionMap[n.key]:void 0}}const cU=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class hU extends Rh{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...cU.slice(0,cU.length-1),...t,cU[cU.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}class dU{get padding(){return Yc(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,a]=[(r-e)/2,(t-n)/2,0];return[i,o,a]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:a=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,a],rotate:i},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const r=Object.entries(t.getLayers()).filter((([t])=>!["main"].includes(t))),i=r.map((([,t])=>t.getCamera())),o=e[n];if("function"==typeof o)return(...t)=>{const r=o.apply(e,t);return i.forEach((e=>{e[n].apply(e,t)})),r}}})}createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=Lc(this.context.options,t);return!!e&&Ae(Object.assign({},e),["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),a=e.getFocalPoint(),[s,l]=this.getCanvasCenter(),[u=0,c=0,h=0]=r,d=zh([-u,-c,-h],i);return"relative"===n?{position:jh(o,d),focalPoint:jh(a,d)}:{position:jh([s,l,o[2]],d),focalPoint:jh([s,l,a[2]],d)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return oe("relative"===r?n*i:i,...e)}transform(e,n){return ze(this,void 0,void 0,(function*(){const{graph:r}=this.context,{translate:i,rotate:o,scale:a,origin:s}=e;this.cancelAnimation();const l=this.getAnimation(n);if(YH(r,new UH(t.GraphEvent.BEFORE_TRANSFORM,e)),!o&&a&&!i&&s&&!l)return this.camera.setZoomByViewportPoint(this.getZoomOptions(e),s),void YH(r,new UH(t.GraphEvent.AFTER_TRANSFORM,e));const u={};if(i&&Object.assign(u,this.getTranslateOptions(e)),ae(o)&&Object.assign(u,this.getRotateOptions(e)),ae(a)&&Object.assign(u,{zoom:this.getZoomOptions(e)}),l)return YH(r,new WH(t.GraphEvent.BEFORE_ANIMATE,pc.TRANSFORM,null,e)),new Promise((n=>{this.transformResolver=n,this.camera.gotoLandmark(this.createLandmark(u),Object.assign(Object.assign({},l),{onfinish:()=>{YH(r,new WH(t.GraphEvent.AFTER_ANIMATE,pc.TRANSFORM,null,e)),YH(r,new UH(t.GraphEvent.AFTER_TRANSFORM,e)),this.transformResolver=void 0,n()}}))}));this.camera.gotoLandmark(this.createLandmark(u),{duration:0}),YH(r,new UH(t.GraphEvent.AFTER_TRANSFORM,e))}))}fitView(t,e){return ze(this,void 0,void 0,(function*(){const[n,r,i,o]=this.padding,{when:a="always",direction:s="both"}=t||{},[l,u]=this.context.canvas.getSize(),c=l-o-r,h=u-n-i,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[p,g]=Kc(f);if("overflow"===a&&!("x"===s&&p>=c||"y"===s&&g>=h||"both"===s&&p>=c&&g>=h))return yield this.fitCenter({animation:e});const v=c/p,m=h/g,y="x"===s?v:"y"===s?m:Math.min(v,m),b=this.getAnimation(e);yield this.transform({mode:"relative",scale:y,translate:jh(Bh(this.getCanvasCenter(),this.getBBoxInViewport(d).center),zh(this.paddingOffset,y))},b)}))}fitCenter(t){return ze(this,void 0,void 0,(function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)}))}focusElements(t){return ze(this,arguments,void 0,(function*(t,e={}){const{element:n}=this.context;if(!n)return;const r=th(t.map((t=>{return r=n.getElement(t),e.shapes?r.getShape(e.shapes).getRenderBounds():r.getRenderBounds();var r})));yield this.focus(r,e)}))}focus(t,e){return ze(this,void 0,void 0,(function*(){const n=this.context.graph.getViewportByCanvas(t.center),r=Bh(e.position||this.getCanvasCenter(),n);yield this.transform({mode:"relative",translate:jh(r,this.paddingOffset)},e.animation)}))}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[a,s]=r.getViewportByCanvas(n),l=new Yr;return l.setMinMax([i,o,0],[a,s,0]),l}isInViewport(t,e=!1,n=0){const{graph:r}=this.context,i=this.getCanvasSize(),[o,a]=r.getCanvasByViewport([0,0]),[s,l]=r.getCanvasByViewport(i);let u=new Yr;return u.setMinMax([o,a,0],[s,l,0]),n&&(u=Jc(u,n)),Hc(t)?eh(t,u):e?function(t,e){const[n,r]=t.min,[i,o]=t.max,[a,s]=e.min,[l,u]=e.max;return n>=a&&i<=l&&r>=s&&o<=u}(t,u):u.intersects(t)}cancelAnimation(){var t,e;(null===(t=this.camera.landmarks)||void 0===t?void 0:t.length)&&this.camera.cancelLandmarkAnimation(),null===(e=this.transformResolver)||void 0===e||e.call(this)}}class fU extends Wg{constructor(t){var e;super(),this.rendered=!1,this.destroyed=!1,this.context={model:new oU},this.isCollapsingExpanding=!1,this.onResize=ye((()=>{this.resize()}),300),this.options=Object.assign({},fU.defaultOptions,t),this._setOptions(this.options,!0),this.context.graph=this,this.options.autoResize&&(null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),e){const{data:e}=t;return void(e&&this.addData(e))}Object.assign(this.options,t);const{behaviors:n,combo:r,data:i,edge:o,layout:a,node:s,plugins:l,theme:u,transforms:c}=t;n&&this.setBehaviors(n),i&&this.setData(i),s&&this.setNode(s),o&&this.setEdge(o),r&&this.setCombo(r),a&&this.setLayout(a),u&&this.setTheme(u),l&&this.setPlugins(l),c&&this.setTransforms(c)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Ut(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Ut(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Ut(t)?t(this.getBehaviors()):t,null===(e=this.context.behavior)||void 0===e||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors((e=>e.map((e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Ut(t)?t(this.getPlugins()):t,null===(e=this.context.plugin)||void 0===e||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins((e=>e.map((e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Ut(t)?t(this.getTransforms()):t,null===(e=this.context.transform)||void 0===e||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms((e=>e.map((e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e)))),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map((t=>this.context.model.getElementDataById(t))):this.context.model.getElementDataById(t)}getNodeData(t){var e;return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):null===(e=this.context.model.getNodeData([t]))||void 0===e?void 0:e[0]}getEdgeData(t){var e;return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):null===(e=this.context.model.getEdgeData([t]))||void 0===e?void 0:e[0]}getComboData(t){var e;return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):null===(e=this.context.model.getComboData([t]))||void 0===e?void 0:e[0]}setData(t){this.context.model.setData(Ut(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Ut(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Ut(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Ut(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Ut(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Ut(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Ut(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Ut(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Ut(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Ut(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Ut(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Ut(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Ut(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return ze(this,void 0,void 0,(function*(){var e;if(this.context.canvas)return yield this.context.canvas.ready;const{container:n="container",width:r,height:i,renderer:o,cursor:a,background:s,canvas:l,devicePixelRatio:u=(null!==(e=globalThis.devicePixelRatio)&&void 0!==e?e:1)}=this.options;if(n instanceof IH)this.context.canvas=n,a&&n.setCursor(a),o&&n.setRenderer(o),yield n.ready;else{const e=ne(n)?document.getElementById(n):n,c=zH(e);this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:e,width:r,height:i});const h=Object.assign(Object.assign({},l),{container:e,width:r||c[0],height:i||c[1],background:s,renderer:o,cursor:a,devicePixelRatio:u}),d=new IH(h);this.context.canvas=d,yield d.ready,this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:d})}}))}updateCanvas(e){var n,r;const{renderer:i,cursor:o,height:a,width:s}=e,l=this.context.canvas;l&&(i&&(this.emit(t.GraphEvent.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(t.GraphEvent.AFTER_RENDERER_CHANGE,{renderer:i})),o&&l.setCursor(o),(ae(s)||ae(a))&&this.setSize(null!==(n=null!=s?s:this.options.width)&&void 0!==n?n:0,null!==(r=null!=a?a:this.options.height)&&void 0!==r?r:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new QH(this.context)),this.context.plugin||(this.context.plugin=new uU(this.context)),this.context.viewport||(this.context.viewport=new dU(this.context)),this.context.transform||(this.context.transform=new hU(this.context)),this.context.element||(this.context.element=new aU(this.context)),this.context.animation||(this.context.animation=new ZH(this.context)),this.context.layout||(this.context.layout=new sU(this.context)),this.context.behavior||(this.context.behavior=new JH(this.context))}prepare(){return ze(this,void 0,void 0,(function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Tc("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()}))}render(){return ze(this,void 0,void 0,(function*(){yield this.prepare(),YH(this,new VH(t.GraphEvent.BEFORE_RENDER));const e=this.context.element.draw({type:"render"});yield Promise.all([null==e?void 0:e.finished,this.context.layout.layout()]),yield this.autoFit(),this.rendered=!0,YH(this,new VH(t.GraphEvent.AFTER_RENDER))}))}draw(){return ze(this,void 0,void 0,(function*(){var t;yield this.prepare(),yield null===(t=this.context.element.draw())||void 0===t?void 0:t.finished}))}layout(){return ze(this,void 0,void 0,(function*(){yield this.context.layout.layout()}))}stopLayout(){this.context.layout.stopLayout()}clear(){return ze(this,void 0,void 0,(function*(){this.context.model.setData({}),yield this.draw()}))}destroy(){var e;YH(this,new VH(t.GraphEvent.BEFORE_DESTROY));const{layout:n,animation:r,element:i,model:o,canvas:a,behavior:s,plugin:l}=this.context;null==l||l.destroy(),null==s||s.destroy(),null==n||n.destroy(),null==r||r.destroy(),null==i||i.destroy(),o.destroy(),null==a||a.destroy(),this.options={},this.context={},this.off(),null===(e=globalThis.removeEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize),this.destroyed=!0,YH(this,new VH(t.GraphEvent.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,n){var r;const i=zH(null===(r=this.context.canvas)||void 0===r?void 0:r.getContainer()),o=[e||i[0],n||i[1]];if(!this.context.canvas)return;const a=this.context.canvas.getSize();Ne(o,a)||(YH(this,new VH(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:o})),this.context.canvas.resize(...o),YH(this,new VH(t.GraphEvent.AFTER_SIZE_CHANGE,{size:o})))}fitView(t,e){return ze(this,void 0,void 0,(function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.fitView(t,e)}))}fitCenter(t){return ze(this,void 0,void 0,(function*(){var e;yield null===(e=this.context.viewport)||void 0===e?void 0:e.fitCenter({animation:t})}))}autoFit(){return ze(this,void 0,void 0,(function*(){const{autoFit:t}=this.context.options;if(t)if(ne(t))"view"===t?yield this.fitView():"center"===t&&(yield this.fitCenter());else{const{type:e,animation:n}=t;"view"===e?yield this.fitView(t.options,n):"center"===e&&(yield this.fitCenter(n))}}))}focusElement(t,e){return ze(this,void 0,void 0,(function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})}))}zoomBy(t,e,n){return ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)}))}zoomTo(t,e,n){return ze(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 ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)}))}rotateTo(t,e,n){return ze(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 ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)}))}translateTo(t,e){return ze(this,void 0,void 0,(function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)}))}getPosition(){return Bh([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach((([t,e])=>this.context.model.translateNodeLikeBy(t,e))),yield null===(i=this.context.element.draw({animation:a,stage:"translate"}))||void 0===i?void 0:i.finished}))}translateElementTo(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach((([t,e])=>this.context.model.translateNodeLikeTo(t,e))),yield null===(i=this.context.element.draw({animation:a,stage:"translate"}))||void 0===i?void 0:i.finished}))}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Pe(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach((([t,e])=>{const n=this.getElementType(t);s[`${n}s`].push({id:t,style:{visibility:e}})}));const{model:l,element:u}=this.context;l.preventUpdateNodeLikeHierarchy((()=>{l.updateData(s)})),yield null===(i=u.draw({animation:a,stage:"visibility"}))||void 0===i?void 0:i.finished}))}showElement(t,e){return ze(this,void 0,void 0,(function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"visible"]))),e)}))}hideElement(t,e){return ze(this,void 0,void 0,(function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"hidden"]))),e)}))}getElementVisibility(t){var e,n;const r=this.context.element.getElement(t);return null!==(n=null===(e=null==r?void 0:r.style)||void 0===e?void 0:e.visibility)&&void 0!==n?n:"visible"}setElementZIndex(t,e){return ze(this,void 0,void 0,(function*(){var n;const r={nodes:[],edges:[],combos:[]},i=qt(t)?t:{[t]:e};Object.entries(i).forEach((([t,e])=>{const n=this.getElementType(t);r[`${n}s`].push({id:t,style:{zIndex:e}})}));const{model:o,element:a}=this.context;o.preventUpdateNodeLikeHierarchy((()=>o.updateData(r))),yield null===(n=a.draw({animation:!1,stage:"zIndex"}))||void 0===n?void 0:n.finished}))}frontElement(t){return ze(this,void 0,void 0,(function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,r={};e.map((t=>{const e=n.getFrontZIndex(t);if("combo"===n.getElementType(t)){const i=n.getAncestorsData(t,wc).at(-1)||this.getComboData(t),o=[i,...n.getDescendantsData(bh(i))],a=e-$H(i);o.forEach((t=>{r[bh(t)]=this.getElementZIndex(bh(t))+a}));const{internal:s}=eg(o.map(bh),(t=>n.getRelatedEdgesData(t)));s.forEach((t=>{const e=bh(t);r[e]=this.getElementZIndex(e)+a}))}else r[t]=e})),yield this.setElementZIndex(r)}))}getElementZIndex(t){return $H(this.context.model.getElementDataById(t))}setElementState(t,e){return ze(this,arguments,void 0,(function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach((([t,e])=>{const n=this.getElementType(t);var r;s[`${n}s`].push({id:t,states:(r=e,r?Array.isArray(r)?r:[r]:[])})})),this.updateData(s),yield null===(i=this.context.element.draw({animation:a,stage:"state"}))||void 0===i?void 0:i.finished}))}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return ze(this,arguments,void 0,(function*(t,e=!0){const{model:n,element:r}=this.context;if(Nd(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!0});const i=n.getElementType(t);yield this.frontElement(t),this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!0),"node"===i?yield r.collapseNode(t,e):"combo"===i&&(yield r.collapseCombo(t,!!e.animation)),this.isCollapsingExpanding=!1}))}expandElement(t){return ze(this,arguments,void 0,(function*(t,e=!0){const{model:n,element:r}=this.context;if(!Nd(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!0});const i=n.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!1),"node"===i?yield r.expandNode(t,e):"combo"===i&&(yield r.expandCombo(t,!!e.animation)),this.isCollapsingExpanding=!1}))}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return ze(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)}}fU.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};const pU=(t,e)=>{const{source:n,target:r}=e,i=t.getElementDataById(n),o=t.getElementDataById(r),a=ng(i,(e=>t.getParentData(e,wc))),s=ng(o,(e=>t.getParentData(e,wc))),l={sourceNode:bh(a),targetNode:bh(s)};return e.style?Object.assign(e.style,l):e.style=l,e};class gU extends OH{constructor(t,e){super(t,ke({},gU.defaultOptions,e)),this.assignSizeByCentrality=(t,e,n,r,i,o)=>{const a=[e,n],s=[r[0],i[0]],l=[r[1],i[1]],u=[r[2],i[2]],c=(t,e)=>{if("function"==typeof o)return o(t,a,e);switch(o){case"linear":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return i===r?o:o+(t-r)/(i-r)*(a-o)})(t,a,e);case"log":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return o+Math.log(t-r+1)/Math.log(i-r+1)*(a-o)})(t,a,e);case"pow":return((t,e,n,r=2)=>{const[i,o]=e,[a,s]=n;return a+Math.pow((t-i)/(o-i),r)*(s-a)})(t,a,e,2);case"sqrt":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return o+Math.sqrt((t-r)/(i-r))*(a-o)})(t,a,e);default:return e[0]}};return[c(t,s),c(t,l),c(t,u)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),r=Rd(this.options.maxSize),i=Rd(this.options.minSize),o=this.getCentralities(this.options.centrality),a=o.size>0?Math.max(...o.values()):0,s=o.size>0?Math.min(...o.values()):0;return n.forEach((e=>{var n;const l=this.assignSizeByCentrality(o.get(bh(e))||0,s,a,i,r,this.options.scale),u=null===(n=this.context.element)||void 0===n?void 0:n.getElement(bh(e)),c={size:l};this.assignLabelStyle(c,l,e,u),u&&CH(c,u.attributes)||TH(t,u?"update":"add","node",ke(e,{style:c}),!0)})),t}assignLabelStyle(t,e,n,r){var i;const o=r?r.config.style:null===(i=this.context.element)||void 0===i?void 0:i.getElementComputedStyle("node",n);if(Object.assign(t,Ae(o,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const n=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:n,labelLineHeight:n+$c(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const r=Math.min(...t)/2,[i,o]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(o,Math.max(r,i))}getCentralities(t){const{model:e}=this.context,n=e.getData();if("function"==typeof t)return t(n);const r=e.getRelatedEdgesData.bind(e);return wh(n,r,t)}}gU.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class vU extends OH{constructor(t,e){super(t,Object.assign({},vU.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=Jh(this.ref),{graph:n,model:r}=this.context;null===(t=r.getData().nodes)||void 0===t||t.forEach((t=>{var i;if(bh(t)===bh(this.ref))return;const o=Xh(Bh(Jh(t),e)),a=Math.abs(o)>Math.PI/2,s=!t.children||0===t.children.length,l=bh(t),u=null===(i=this.context.element)||void 0===i?void 0:i.getElement(l);if(!u||!u.isVisible())return;const c=(s?1:-1)*(Rd(n.getElementRenderStyle(l).size)[0]/2+this.options.offset),h=[["translate",c*Math.cos(o),c*Math.sin(o)],["rotate",a?ai(o)+180:ai(o)]];r.updateNodeData([{id:bh(t),style:{labelTextAlign:a===s?"right":"left",labelTextBaseline:"middle",labelTransform:h}}])})),n.draw()}}vU.defaultOptions={offset:5};const mU=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class yU extends OH{constructor(t,e){super(t,Object.assign({},yU.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=t=>{const{add:{edges:e},update:{nodes:n,edges:r,combos:i},remove:{edges:o}}=t,{model:a}=this.context,s=new Map,l=(t,e)=>{a.getRelatedEdgesData(e).forEach((t=>!s.has(bh(t))&&s.set(bh(t),t)))};n.forEach(l),i.forEach(l);const u=t=>{const e=a.getEdgeData().map((t=>pU(a,t)));xU(t,e).forEach((t=>!s.has(bh(t))&&s.set(bh(t),t)))};if(o.size&&o.forEach(u),e.size&&e.forEach(u),r.size){const t=sF(aF(a.getChanges())).update.edges;r.forEach((e=>{var n;u(e);const r=null===(n=t.find((t=>bh(t.value)===bh(e))))||void 0===n?void 0:n.original;r&&!EU(e,r)&&u(r)}))}Se(this.options.edges)||s.forEach(((t,e)=>!this.options.edges.includes(e)&&s.delete(e)));const c=a.getEdgeData().map(bh);return new Map([...s].sort(((t,e)=>c.indexOf(t[0])-c.indexOf(e[0]))))},this.applyBundlingStyle=(t,e,n)=>{const{edgeMap:r,reverses:i}=bU(e);r.forEach((e=>{e.forEach(((e,r,o)=>{var a;const s=o.length,l=e.style||{};if(e.source===e.target){const t=mU.length;l.loopPlacement=mU[r%t],l.loopDist=Math.floor(r/t)*n+50}else if(1===s)l.curveOffset=0;else{const t=(r%2==0?1:-1)*(i[`${e.source}|${e.target}|${r}`]?-1:1);l.curveOffset=s%2==1?t*Math.ceil(r/2)*n*2:t*(Math.floor(r/2)*n*2+n)}const u=Object.assign(e,{type:"quadratic",style:l}),c=null===(a=this.context.element)||void 0===a?void 0:a.getElement(bh(e));c&&CH(u.style,c.attributes)||TH(t,c?"update":"add","edge",u,!0)}))}))},this.resetEdgeStyle=t=>{const e=t.style||{},n=this.cacheMergeStyle.get(bh(t))||{};return Object.keys(n).forEach((r=>{Ne(e[r],n[r])&&(t[r]?e[r]=t[r]:delete e[r])})),Object.assign(t,{style:e})},this.applyMergingStyle=(t,e)=>{const{edgeMap:n,reverses:r}=bU(e);n.forEach((e=>{var n;if(1===e.length){const r=e[0],i=null===(n=this.context.element)||void 0===n?void 0:n.getElement(bh(r)),o=this.resetEdgeStyle(r);return void(i&&CH(o,i.attributes)||TH(t,i?"update":"add","edge",o))}const i=e.map((({source:t,target:e,style:n={}},i)=>{const{startArrow:o,endArrow:a}=n,s={},[l,u]=r[`${t}|${e}|${i}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return pe(o)&&(s[l]=o),pe(a)&&(s[u]=a),s})).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{});e.forEach(((e,n,r)=>{var o;if(0!==n)return void TH(t,"remove","edge",e);const a=Object.assign({},Ut(this.options.style)?this.options.style(r):this.options.style,{childrenData:r});this.cacheMergeStyle.set(bh(e),a);const s=Object.assign(Object.assign({},e),{type:"line",style:Object.assign(Object.assign(Object.assign({},e.style),i),a)}),l=null===(o=this.context.element)||void 0===o?void 0:o.getElement(bh(e));l&&CH(s.style,l.attributes)||TH(t,l?"update":"add","edge",s,!0)}))}))}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return 0===e.size||("bundle"===this.options.mode?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}yU.defaultOptions={mode:"bundle",distance:15};const bU=t=>{const e=new Map,n=new Set,r={};for(const[i,o]of t){if(n.has(i))continue;const{source:a,target:s}=o,l=`${a}-${s}`;e.has(l)||e.set(l,[]),e.get(l).push(o),n.add(i);for(const[i,u]of t)n.has(i)||EU(o,u)&&(e.get(l).push(u),n.add(i),a===u.target&&s===u.source&&(r[`${u.source}|${u.target}|${e.get(l).length-1}`]=!0))}return{edgeMap:e,reverses:r}},xU=(t,e,n)=>e.filter((e=>EU(e,t))),EU=(t,e)=>{const{sourceNode:n,targetNode:r}=t.style||{},{sourceNode:i,targetNode:o}=e.style||{};return n===i&&r===o||n===o&&r===i};const wU={animation:{"combo-collapse":Vc,"combo-expand":Wc,"node-collapse":Bc,"node-expand":Fc,"path-in":zc,"path-out":Gc,fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}]},behavior:{"brush-select":md,"click-select":Sd,"collapse-expand":Bg,"create-edge":zg,"drag-canvas":Gg,"drag-element-force":Jg,"drag-element":Vg,"fix-element-size":tv,"focus-element":ev,"hover-activate":nv,"lasso-select":rv,"auto-adapt-label":_h,"optimize-viewport-transform":iv,"scroll-canvas":ov,"zoom-canvas":av},combo:{circle:Dp,rect:Lp},edge:{cubic:ag,line:cg,polyline:Eg,quadratic:wg,"cubic-horizontal":sg,"cubic-radial":lg,"cubic-vertical":ug},layout:{"antv-dagre":bb,"combo-combined":nE,"compact-box":pm.compactBox,"d3-force":HE,"force-atlas2":sj,circular:kb,concentric:Ob,dagre:nj,dendrogram:pm.dendrogram,fishbone:Zj,force:Xb,fruchterman:uj,grid:hj,indented:pm.indented,mds:Kx,mindmap:pm.mindmap,radial:wj,random:Cj,snake:eB},node:{circle:of,diamond:sf,ellipse:hf,hexagon:df,html:Op,image:Tp,rect:Cp,star:Ap,donut:lf,triangle:Pp},palette:{spectral:["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],tableau:["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],oranges:["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],greens:["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],blues:["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"]},theme:{dark:SH,light:NH},plugin:{"bubble-sets":VB,"edge-bundling":YB,"edge-filter-lens":eF,"grid-line":oF,background:oB,contextmenu:UB,fisheye:rF,fullscreen:iF,history:cF,hull:_F,legend:rH,minimap:iH,snapline:lH,timebar:dH,toolbar:vH,tooltip:mH,watermark:xH},transform:{"arrange-draw-order":class extends OH{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,r=t=>{const n=[];return t.forEach(((t,r)=>{const i=e.getAncestorsData(r,"combo").map((t=>bh(t))).reverse();n.push([r,t,i.length])})),new Map(n.sort((([,,t],[,,e])=>e-t)).map((([t,e])=>[t,e])))};return t.add.combos=r(n),t.update.combos=r(t.update.combos),t}},"collapse-expand-combo":class extends OH{beforeDraw(t,e){if("visibility"===e.stage)return t;if(!this.context.model.model.hasTreeStructure(wc))return t;const{model:n}=this.context,{add:r,update:i}=t,o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[e,a]=o.pop();if(Nd(a)){const a=n.getDescendantsData(e),s=a.map(bh),{internal:l,external:u}=eg(s,(t=>n.getRelatedEdgesData(t)));a.forEach((e=>{const r=bh(e),i=o.findIndex((([t])=>t===r));-1!==i&&o.splice(i,1);const a=n.getElementType(r);TH(t,"remove",a,e)})),l.forEach((e=>TH(t,"remove","edge",e))),u.forEach((t=>{var e;const n=bh(t);(null===(e=this.context.element)||void 0===e?void 0:e.getElement(n))?i.edges.set(n,t):r.edges.set(n,t)}))}else{const r=n.getChildrenData(e),i=r.map(bh),{edges:a}=eg(i,(t=>n.getRelatedEdgesData(t)));[...r,...a].forEach((e=>{var r;const i=bh(e),a=n.getElementType(i),s=null===(r=this.context.element)||void 0===r?void 0:r.getElement(i);TH(t,s?"update":"add",a,e),"combo"===a&&o.push([i,e])}))}}return t}},"collapse-expand-node":class extends OH{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(AH(e,"add","node",t),Nd(t))return;const n=bh(t);AH(e,"add","node",t);this.context.model.getRelatedEdgesData(n,"out").forEach((t=>{TH(e,"add","edge",t)}));this.context.model.getChildrenData(n).forEach((t=>{this.handleExpand(t,e)}))}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(kc))return t;const{add:{nodes:r,edges:i},update:{nodes:o}}=t,a=new Map,s=new Map;r.forEach(((t,e)=>{Nd(t)&&a.set(e,t)})),i.forEach((t=>{if("node"!==e.getElementType(t.source))return;const n=e.getNodeData(t.source);Nd(n)&&a.set(t.source,n)})),o.forEach(((t,e)=>{const n=this.getElement(e);if(!n)return;const r=n.attributes.collapsed;Nd(t)?r||a.set(e,t):r&&s.set(e,t)}));const l=new Set;return a.forEach(((e,r)=>{n.getDescendantsData(r).forEach((e=>{const r=bh(e);if(l.has(r))return;TH(t,"remove","node",e);n.getRelatedEdgesData(r).forEach((e=>{TH(t,"remove","edge",e)})),l.add(r)}))})),s.forEach(((e,r)=>{n.getAncestorsData(r,kc).some(Nd)?TH(t,"remove","node",e):this.handleExpand(e,t)})),t}},"get-edge-actual-ends":class extends OH{beforeDraw(t){const{add:e,update:n}=t,{model:r}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach((([,t])=>{pU(r,t)})),t}},"map-node-size":gU,"place-radial-labels":vU,"process-parallel-edges":yU,"update-related-edges":class extends OH{beforeDraw(t,e){const{stage:n}=e;if("visibility"===n)return t;const{model:r}=this.context,{update:{nodes:i,edges:o,combos:a}}=t,s=(t,e)=>{r.getRelatedEdgesData(e).forEach((t=>!o.has(bh(t))&&o.set(bh(t),t)))};return i.forEach(s),a.forEach(s),t}}},shape:{circle:Ll,ellipse:jl,group:Bl,html:zl,image:Kd,line:Wl,path:Ul,polygon:$l,polyline:Xl,rect:Kl,text:Ql,label:Hd,badge:Ud}};Object.entries(wU).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{PH(t,e,n)}))}));t.AntVDagreLayout=bb,t.AutoAdaptLabel=_h,t.Background=oB,t.Badge=Ud,t.BaseBehavior=Lh,t.BaseCombo=Rp,t.BaseEdge=og,t.BaseLayout=Xg,t.BaseNode=rf,t.BasePlugin=nB,t.BaseShape=Vd,t.BaseTransform=OH,t.BrushSelect=md,t.BubbleSets=VB,t.CameraSetting=class extends nB{constructor(t,e){super(t,e),this.setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach((([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}}))},this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,(()=>this.setOptions(this.options)))}getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Canvas=IH,t.Circle=of,t.CircleCombo=Dp,t.CircularLayout=kb,t.ClickSelect=Sd,t.CollapseExpand=Bg,t.ComboCombinedLayout=nE,t.CompactBoxLayout=pm.compactBox,t.ConcentricLayout=Ob,t.Contextmenu=UB,t.CreateEdge=zg,t.Cubic=ag,t.CubicHorizontal=sg,t.CubicRadial=lg,t.CubicVertical=ug,t.D3ForceLayout=HE,t.DagreLayout=nj,t.DendrogramLayout=pm.dendrogram,t.Diamond=sf,t.Donut=lf,t.DragCanvas=Gg,t.DragElement=Vg,t.DragElementForce=Jg,t.EdgeBundling=YB,t.EdgeFilterLens=eF,t.Ellipse=hf,t.FishboneLayout=Zj,t.Fisheye=rF,t.FixElementSize=tv,t.FocusElement=ev,t.ForceAtlas2Layout=sj,t.ForceLayout=Xb,t.FruchtermanLayout=uj,t.Fullscreen=iF,t.Graph=fU,t.GridLayout=hj,t.GridLine=oF,t.HTML=Op,t.Hexagon=df,t.History=cF,t.HoverActivate=nv,t.Hull=_F,t.Icon=ef,t.Image=Tp,t.IndentedLayout=pm.indented,t.Label=Hd,t.LassoSelect=rv,t.Legend=rH,t.Line=cg,t.MDSLayout=Kx,t.MapNodeSize=gU,t.MindmapLayout=pm.mindmap,t.Minimap=iH,t.OptimizeViewportTransform=iv,t.PlaceRadialLabels=vU,t.Polyline=Eg,t.ProcessParallelEdges=yU,t.Quadratic=wg,t.RadialLayout=wj,t.RandomLayout=Cj,t.Rect=Cp,t.RectCombo=Lp,t.ScrollCanvas=ov,t.Shortcut=vd,t.SnakeLayout=eB,t.Snapline=lH,t.Star=Ap,t.Timebar=dH,t.Toolbar=vH,t.Tooltip=mH,t.Triangle=Pp,t.Watermark=xH,t.ZoomCanvas=av,t.effect=Id,t.getExtension=Nc,t.getExtensions=function(t){return Sc[t]},t.iconfont={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"},t.idOf=bh,t.invokeLayoutMethod=Zg,t.isCollapsed=Nd,t.omitStyleProps=Pd,t.parseSize=Rd,t.positionOf=Jh,t.register=PH,t.setVisibility=Ph,t.subStyleProps=Cd,t.treeToGraphData=function(t,e){const{getNodeData:n=(t,e)=>{if(t.depth=e,!t.children)return t;const{children:n}=t,r=Fe(t,["children"]);return Object.assign(Object.assign({},r),{children:n.map((t=>t.id))})},getEdgeData:r=(t,e)=>({source:t.id,target:e.id}),getChildren:i=t=>t.children||[]}=e||{},o=[],a=[];return Ed(t,((t,e)=>{o.push(n(t,e));const s=i(t);for(const e of s)a.push(r(t,e))}),(t=>i(t)),"TB"),{nodes:o,edges:a}},t.version=Oc}));