import{ab as g,G as e,_ as t,p as A,H as C,q as i,U as I,c as n,h as o,B as r,f as s,g as a,d as l,I as d,a as h,n as c,e as u,b as p,t as f}from"./backend-ai-webui-783c0410.js";import"./mwc-tab-bar-3568675e.js";import{r as v}from"./rowing-ba6ddffa.js";import{t as m}from"./tus-4013acdb.js";import"./backend-ai-session-list-b26902a4.js";import"./lablup-codemirror-b55bb753.js";import"./vaadin-grid-715ecef8.js";import"./vaadin-grid-selection-column-dd77a46e.js";import"./vaadin-grid-sorter-0eecfc1c.js";import"./vaadin-grid-sort-column-c0c1957b.js";import"./iconset-0893eb84.js";import"./textfield-7977145d.js";import"./input-behavior-b8914dba.js";import"./lablup-progress-bar-766ffc05.js";let y=class extends g{constructor(){super(...arguments),this.disabled=!1,this.clickable=!1,this.noRipple=!1,this.role="listitem"}queryGroup(){return Array.from(this.parentElement.querySelectorAll(`${this.nodeName.toLowerCase()}:not([disabled])`))}rowToElement(g){g.focus()}onKeyDown(g){super.onKeyDown(g),v(this,g)}render(){return o` <slot name="before"></slot> <div id="content"> <slot></slot> </div> <slot name="after"></slot> <wl-ripple id="ripple" overlay .target="${this}" ?disabled="${this.disabled||!this.clickable||this.noRipple}"></wl-ripple> ${this.renderFormElement()} `}};y.styles=[...g.styles,e(":host{--_list-item-color:var(--list-item-color,hsl(var(--foreground,var(--foreground-hue,230),var(--foreground-saturation,70%),var(--foreground-lightness,5%))));--_list-item-bg:var(--list-item-bg,transparent);color:var(--_list-item-color);background:var(--_list-item-bg);border-radius:var(--list-item-border-radius,.5rem);transition:var(--list-item-transition,background var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease),color var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease));padding:var(--list-item-padding,.75rem 1.5rem);display:flex;align-items:center;outline:none;overflow:hidden;position:relative;text-align:left}:host([clickable]){-webkit-user-select:none;user-select:none}:host([clickable]:not([active]):not([disabled])){cursor:pointer}:host(:focus),:host(:hover){--_list-item-color:var(--list-item-color-hover,hsl(var(--foreground,var(--foreground-hue,230),var(--foreground-saturation,70%),var(--foreground-lightness,5%))));--_list-item-bg:var(--list-item-bg-hover,hsl(var(--shade-200,var(--shade-hue,200),var(--shade-saturation,4%),var(--shade-lightness,85%))));will-change:background,color}:host([active]:focus),:host([active]:hover){--_list-item-color:var(--list-item-color-active-hover,hsl(var(--primary-500,var(--primary-hue,224),var(--primary-saturation,47%),var(--primary-lightness,38%))));--_list-item-bg:var(--list-item-bg-active-hover,hsla(var(--primary-500,var(--primary-hue,224),var(--primary-saturation,47%),var(--primary-lightness,38%)),0.15))}:host([disabled]){--_list-item-color:var(--list-item-color-disabled,hsl(var(--shade-400,var(--shade-hue,200),var(--shade-saturation,4%),var(--shade-lightness,65%))));--_list-item-bg:var(--list-item-bg-disabled,transparent);opacity:var(--list-item-opacity-disabled,.6);pointer-events:none}:host([active]){--_list-item-color:var(--list-item-color,hsl(var(--primary-500,var(--primary-hue,224),var(--primary-saturation,47%),var(--primary-lightness,38%))));--_list-item-bg:var(--list-item-bg,hsla(var(--primary-500,var(--primary-hue,224),var(--primary-saturation,47%),var(--primary-lightness,38%)),0.1))}::slotted([slot=after]),::slotted([slot=before]){flex-shrink:0}::slotted([slot=before]){margin:var(--list-item-left-margin,0 1.5rem 0 0)}::slotted([slot=after]),::slotted([slot=before]){align-self:var(--list-item-left-align-self,center)}::slotted([slot=after]){margin:var(--list-item-left-margin,0 0 0 1.5rem)}#content{flex-grow:1;display:flex;flex-direction:column}#ripple{pointer-events:none}")],t([A({type:Boolean,reflect:!0}),C("design:type",Boolean)],y.prototype,"disabled",void 0),t([A({type:Boolean,reflect:!0}),C("design:type",Boolean)],y.prototype,"clickable",void 0),t([A({type:Boolean,reflect:!0}),C("design:type",Boolean)],y.prototype,"noRipple",void 0),t([A({type:String,reflect:!0}),C("design:type",String)],y.prototype,"role",void 0),t([i("#ripple"),C("design:type",I)],y.prototype,"$ripple",void 0),y=t([n("wl-list-item")],y);
/**
 * vis-network
 * https://visjs.github.io/vis-network/
 *
 * A dynamic, browser-based visualization library.
 *
 * @version 9.0.4
 * @date    2021-03-16T05:41:40.818Z
 *
 * @copyright (c) 2011-2017 Almende B.V, http://almende.com
 * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
 *
 * @license
 * vis.js is dual licensed under both
 *
 *   1. The Apache 2.0 License
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *   and
 *
 *   2. The MIT License
 *      http://opensource.org/licenses/MIT
 *
 * vis.js may be distributed under either license.
 */
var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function w(g){var e={exports:{}};return g(e,e.exports),e.exports}var k=function(g){return g&&g.Math==Math&&g},x=k("object"==typeof globalThis&&globalThis)||k("object"==typeof window&&window)||k("object"==typeof self&&self)||k("object"==typeof b&&b)||function(){return this}()||Function("return this")(),E=function(g){try{return!!g()}catch(g){return!0}},O=!E((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),T={}.propertyIsEnumerable,D=Object.getOwnPropertyDescriptor,N={f:D&&!T.call({1:2},1)?function(g){var e=D(this,g);return!!e&&e.enumerable}:T},R=function(g,e){return{enumerable:!(1&g),configurable:!(2&g),writable:!(4&g),value:e}},P={}.toString,S=function(g){return P.call(g).slice(8,-1)},M="".split,B=E((function(){return!Object("z").propertyIsEnumerable(0)}))?function(g){return"String"==S(g)?M.call(g,""):Object(g)}:Object,z=function(g){if(null==g)throw TypeError("Can't call method on "+g);return g},F=function(g){return B(z(g))},Z=function(g){return"object"==typeof g?null!==g:"function"==typeof g},j=function(g,e){if(!Z(g))return g;var t,A;if(e&&"function"==typeof(t=g.toString)&&!Z(A=t.call(g)))return A;if("function"==typeof(t=g.valueOf)&&!Z(A=t.call(g)))return A;if(!e&&"function"==typeof(t=g.toString)&&!Z(A=t.call(g)))return A;throw TypeError("Can't convert object to primitive value")},L={}.hasOwnProperty,G=function(g,e){return L.call(g,e)},V=x.document,Y=Z(V)&&Z(V.createElement),W=function(g){return Y?V.createElement(g):{}},_=!O&&!E((function(){return 7!=Object.defineProperty(W("div"),"a",{get:function(){return 7}}).a})),U=Object.getOwnPropertyDescriptor,Q={f:O?U:function(g,e){if(g=F(g),e=j(e,!0),_)try{return U(g,e)}catch(g){}if(G(g,e))return R(!N.f.call(g,e),g[e])}},H=/#|\.prototype\./,K=function(g,e){var t=J[X(g)];return t==$||t!=q&&("function"==typeof e?E(e):!!e)},X=K.normalize=function(g){return String(g).replace(H,".").toLowerCase()},J=K.data={},q=K.NATIVE="N",$=K.POLYFILL="P",gg=K,eg={},tg=function(g){if("function"!=typeof g)throw TypeError(String(g)+" is not a function");return g},Ag=function(g,e,t){if(tg(g),void 0===e)return g;switch(t){case 0:return function(){return g.call(e)};case 1:return function(t){return g.call(e,t)};case 2:return function(t,A){return g.call(e,t,A)};case 3:return function(t,A,C){return g.call(e,t,A,C)}}return function(){return g.apply(e,arguments)}},Cg=function(g){if(!Z(g))throw TypeError(String(g)+" is not an object");return g},ig=Object.defineProperty,Ig={f:O?ig:function(g,e,t){if(Cg(g),e=j(e,!0),Cg(t),_)try{return ig(g,e,t)}catch(g){}if("get"in t||"set"in t)throw TypeError("Accessors not supported");return"value"in t&&(g[e]=t.value),g}},ng=O?function(g,e,t){return Ig.f(g,e,R(1,t))}:function(g,e,t){return g[e]=t,g},og=Q.f,rg=function(g){var e=function(e,t,A){if(this instanceof g){switch(arguments.length){case 0:return new g;case 1:return new g(e);case 2:return new g(e,t)}return new g(e,t,A)}return g.apply(this,arguments)};return e.prototype=g.prototype,e},sg=function(g,e){var t,A,C,i,I,n,o,r,s=g.target,a=g.global,l=g.stat,d=g.proto,h=a?x:l?x[s]:(x[s]||{}).prototype,c=a?eg:eg[s]||(eg[s]={}),u=c.prototype;for(C in e)t=!gg(a?C:s+(l?".":"#")+C,g.forced)&&h&&G(h,C),I=c[C],t&&(n=g.noTargetGet?(r=og(h,C))&&r.value:h[C]),i=t&&n?n:e[C],t&&typeof I==typeof i||(o=g.bind&&t?Ag(i,x):g.wrap&&t?rg(i):d&&"function"==typeof i?Ag(Function.call,i):i,(g.sham||i&&i.sham||I&&I.sham)&&ng(o,"sham",!0),c[C]=o,d&&(G(eg,A=s+"Prototype")||ng(eg,A,{}),eg[A][C]=i,g.real&&u&&!u[C]&&ng(u,C,i)))},ag=Math.ceil,lg=Math.floor,dg=function(g){return isNaN(g=+g)?0:(g>0?lg:ag)(g)},hg=Math.min,cg=function(g){return g>0?hg(dg(g),9007199254740991):0},ug=Math.max,pg=Math.min,fg=function(g,e){var t=dg(g);return t<0?ug(t+e,0):pg(t,e)},vg=function(g){return function(e,t,A){var C,i=F(e),I=cg(i.length),n=fg(A,I);if(g&&t!=t){for(;I>n;)if((C=i[n++])!=C)return!0}else for(;I>n;n++)if((g||n in i)&&i[n]===t)return g||n||0;return!g&&-1}},mg={includes:vg(!0),indexOf:vg(!1)},yg={},bg=mg.indexOf,wg=function(g,e){var t,A=F(g),C=0,i=[];for(t in A)!G(yg,t)&&G(A,t)&&i.push(t);for(;e.length>C;)G(A,t=e[C++])&&(~bg(i,t)||i.push(t));return i},kg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xg=Object.keys||function(g){return wg(g,kg)},Eg={f:Object.getOwnPropertySymbols},Og=function(g){return Object(z(g))},Tg=Object.assign,Dg=Object.defineProperty,Ng=!Tg||E((function(){if(O&&1!==Tg({b:1},Tg(Dg({},"a",{enumerable:!0,get:function(){Dg(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var g={},e={},t=Symbol(),A="abcdefghijklmnopqrst";return g[t]=7,A.split("").forEach((function(g){e[g]=g})),7!=Tg({},g)[t]||xg(Tg({},e)).join("")!=A}))?function(g,e){for(var t=Og(g),A=arguments.length,C=1,i=Eg.f,I=N.f;A>C;)for(var n,o=B(arguments[C++]),r=i?xg(o).concat(i(o)):xg(o),s=r.length,a=0;s>a;)n=r[a++],O&&!I.call(o,n)||(t[n]=o[n]);return t}:Tg;sg({target:"Object",stat:!0,forced:Object.assign!==Ng},{assign:Ng});var Rg=eg.Object.assign,Pg=[].slice,Sg={},Mg=function(g,e,t){if(!(e in Sg)){for(var A=[],C=0;C<e;C++)A[C]="a["+C+"]";Sg[e]=Function("C,a","return new C("+A.join(",")+")")}return Sg[e](g,t)},Bg=Function.bind||function(g){var e=tg(this),t=Pg.call(arguments,1),A=function(){var C=t.concat(Pg.call(arguments));return this instanceof A?Mg(e,C.length,C):e.apply(g,C)};return Z(e.prototype)&&(A.prototype=e.prototype),A};sg({target:"Function",proto:!0},{bind:Bg});var zg=function(g){return eg[g+"Prototype"]},Fg=zg("Function").bind,Zg=Function.prototype,jg=function(g){var e=g.bind;return g===Zg||g instanceof Function&&e===Zg.bind?Fg:e};function Lg(g,e,t,A){g.beginPath(),g.arc(e,t,A,0,2*Math.PI,!1),g.closePath()}function Gg(g,e,t,A,C,i){var I=Math.PI/180;A-2*i<0&&(i=A/2),C-2*i<0&&(i=C/2),g.beginPath(),g.moveTo(e+i,t),g.lineTo(e+A-i,t),g.arc(e+A-i,t+i,i,270*I,360*I,!1),g.lineTo(e+A,t+C-i),g.arc(e+A-i,t+C-i,i,0,90*I,!1),g.lineTo(e+i,t+C),g.arc(e+i,t+C-i,i,90*I,180*I,!1),g.lineTo(e,t+i),g.arc(e+i,t+i,i,180*I,270*I,!1),g.closePath()}function Vg(g,e,t,A,C){var i=.5522848,I=A/2*i,n=C/2*i,o=e+A,r=t+C,s=e+A/2,a=t+C/2;g.beginPath(),g.moveTo(e,a),g.bezierCurveTo(e,a-n,s-I,t,s,t),g.bezierCurveTo(s+I,t,o,a-n,o,a),g.bezierCurveTo(o,a+n,s+I,r,s,r),g.bezierCurveTo(s-I,r,e,a+n,e,a),g.closePath()}function Yg(g,e,t,A,C){var i=C*(1/3),I=.5522848,n=A/2*I,o=i/2*I,r=e+A,s=t+i,a=e+A/2,l=t+i/2,d=t+(C-i/2),h=t+C;g.beginPath(),g.moveTo(r,l),g.bezierCurveTo(r,l+o,a+n,s,a,s),g.bezierCurveTo(a-n,s,e,l+o,e,l),g.bezierCurveTo(e,l-o,a-n,t,a,t),g.bezierCurveTo(a+n,t,r,l-o,r,l),g.lineTo(r,d),g.bezierCurveTo(r,d+o,a+n,h,a,h),g.bezierCurveTo(a-n,h,e,d+o,e,d),g.lineTo(e,l)}function Wg(g,e,t,A,C,i){g.beginPath(),g.moveTo(e,t);for(var I=i.length,n=A-e,o=C-t,r=o/n,s=Math.sqrt(n*n+o*o),a=0,l=!0,d=0,h=+i[0];s>=.1;)(h=+i[a++%I])>s&&(h=s),d=Math.sqrt(h*h/(1+r*r)),e+=d=n<0?-d:d,t+=r*d,!0===l?g.lineTo(e,t):g.moveTo(e,t),s-=h,l=!l}var _g={circle:Lg,dashedLine:Wg,database:Yg,diamond:function(g,e,t,A){g.beginPath(),g.lineTo(e,t+A),g.lineTo(e+A,t),g.lineTo(e,t-A),g.lineTo(e-A,t),g.closePath()},ellipse:Vg,ellipse_vis:Vg,hexagon:function(g,e,t,A){g.beginPath();var C=2*Math.PI/6;g.moveTo(e+A,t);for(var i=1;i<6;i++)g.lineTo(e+A*Math.cos(C*i),t+A*Math.sin(C*i));g.closePath()},roundRect:Gg,square:function(g,e,t,A){g.beginPath(),g.rect(e-A,t-A,2*A,2*A),g.closePath()},star:function(g,e,t,A){g.beginPath(),t+=.1*(A*=.82);for(var C=0;C<10;C++){var i=C%2==0?1.3*A:.5*A;g.lineTo(e+i*Math.sin(2*C*Math.PI/10),t-i*Math.cos(2*C*Math.PI/10))}g.closePath()},triangle:function(g,e,t,A){g.beginPath(),t+=.275*(A*=1.15);var C=2*A,i=C/2,I=Math.sqrt(3)/6*C,n=Math.sqrt(C*C-i*i);g.moveTo(e,t-(n-I)),g.lineTo(e+i,t+I),g.lineTo(e-i,t+I),g.lineTo(e,t-(n-I)),g.closePath()},triangleDown:function(g,e,t,A){g.beginPath(),t-=.275*(A*=1.15);var C=2*A,i=C/2,I=Math.sqrt(3)/6*C,n=Math.sqrt(C*C-i*i);g.moveTo(e,t+(n-I)),g.lineTo(e+i,t-I),g.lineTo(e-i,t-I),g.lineTo(e,t+(n-I)),g.closePath()}};function Ug(g,e){void 0===e&&(e={});var t=e.insertAt;if(g&&"undefined"!=typeof document){var A=document.head||document.getElementsByTagName("head")[0],C=document.createElement("style");C.type="text/css","top"===t&&A.firstChild?A.insertBefore(C,A.firstChild):A.appendChild(C),C.styleSheet?C.styleSheet.cssText=g:C.appendChild(document.createTextNode(g))}}Ug(".vis-overlay {\n  position: absolute;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n\n  /* Must be displayed above for example selected Timeline items */\n  z-index: 10;\n}\n\n.vis-active {\n  box-shadow: 0 0 10px #86d5f8;\n}\n");Ug('/* override some bootstrap styles screwing up the timelines css */\n\n.vis [class*="span"] {\n  min-height: 0;\n  width: auto;\n}\n');Ug("div.vis-color-picker {\n  position: absolute;\n  top: 0px;\n  left: 30px;\n  margin-top: -140px;\n  margin-left: 30px;\n  width: 310px;\n  height: 444px;\n  z-index: 1;\n  padding: 10px;\n  border-radius: 15px;\n  background-color: #ffffff;\n  display: none;\n  box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 10px 0px;\n}\n\ndiv.vis-color-picker div.vis-arrow {\n  position: absolute;\n  top: 147px;\n  left: 5px;\n}\n\ndiv.vis-color-picker div.vis-arrow::after,\ndiv.vis-color-picker div.vis-arrow::before {\n  right: 100%;\n  top: 50%;\n  border: solid transparent;\n  content: \" \";\n  height: 0;\n  width: 0;\n  position: absolute;\n  pointer-events: none;\n}\n\ndiv.vis-color-picker div.vis-arrow:after {\n  border-color: rgba(255, 255, 255, 0);\n  border-right-color: #ffffff;\n  border-width: 30px;\n  margin-top: -30px;\n}\n\ndiv.vis-color-picker div.vis-color {\n  position: absolute;\n  width: 289px;\n  height: 289px;\n  cursor: pointer;\n}\n\ndiv.vis-color-picker div.vis-brightness {\n  position: absolute;\n  top: 313px;\n}\n\ndiv.vis-color-picker div.vis-opacity {\n  position: absolute;\n  top: 350px;\n}\n\ndiv.vis-color-picker div.vis-selector {\n  position: absolute;\n  top: 137px;\n  left: 137px;\n  width: 15px;\n  height: 15px;\n  border-radius: 15px;\n  border: 1px solid #ffffff;\n  background: #4c4c4c; /* Old browsers */\n  background: -moz-linear-gradient(\n    top,\n    #4c4c4c 0%,\n    #595959 12%,\n    #666666 25%,\n    #474747 39%,\n    #2c2c2c 50%,\n    #000000 51%,\n    #111111 60%,\n    #2b2b2b 76%,\n    #1c1c1c 91%,\n    #131313 100%\n  ); /* FF3.6+ */\n  background: -webkit-gradient(\n    linear,\n    left top,\n    left bottom,\n    color-stop(0%, #4c4c4c),\n    color-stop(12%, #595959),\n    color-stop(25%, #666666),\n    color-stop(39%, #474747),\n    color-stop(50%, #2c2c2c),\n    color-stop(51%, #000000),\n    color-stop(60%, #111111),\n    color-stop(76%, #2b2b2b),\n    color-stop(91%, #1c1c1c),\n    color-stop(100%, #131313)\n  ); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(\n    top,\n    #4c4c4c 0%,\n    #595959 12%,\n    #666666 25%,\n    #474747 39%,\n    #2c2c2c 50%,\n    #000000 51%,\n    #111111 60%,\n    #2b2b2b 76%,\n    #1c1c1c 91%,\n    #131313 100%\n  ); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(\n    top,\n    #4c4c4c 0%,\n    #595959 12%,\n    #666666 25%,\n    #474747 39%,\n    #2c2c2c 50%,\n    #000000 51%,\n    #111111 60%,\n    #2b2b2b 76%,\n    #1c1c1c 91%,\n    #131313 100%\n  ); /* Opera 11.10+ */\n  background: -ms-linear-gradient(\n    top,\n    #4c4c4c 0%,\n    #595959 12%,\n    #666666 25%,\n    #474747 39%,\n    #2c2c2c 50%,\n    #000000 51%,\n    #111111 60%,\n    #2b2b2b 76%,\n    #1c1c1c 91%,\n    #131313 100%\n  ); /* IE10+ */\n  background: linear-gradient(\n    to bottom,\n    #4c4c4c 0%,\n    #595959 12%,\n    #666666 25%,\n    #474747 39%,\n    #2c2c2c 50%,\n    #000000 51%,\n    #111111 60%,\n    #2b2b2b 76%,\n    #1c1c1c 91%,\n    #131313 100%\n  ); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 ); /* IE6-9 */\n}\n\ndiv.vis-color-picker div.vis-new-color {\n  position: absolute;\n  width: 140px;\n  height: 20px;\n  border: 1px solid rgba(0, 0, 0, 0.1);\n  border-radius: 5px;\n  top: 380px;\n  left: 159px;\n  text-align: right;\n  padding-right: 2px;\n  font-size: 10px;\n  color: rgba(0, 0, 0, 0.4);\n  vertical-align: middle;\n  line-height: 20px;\n}\n\ndiv.vis-color-picker div.vis-initial-color {\n  position: absolute;\n  width: 140px;\n  height: 20px;\n  border: 1px solid rgba(0, 0, 0, 0.1);\n  border-radius: 5px;\n  top: 380px;\n  left: 10px;\n  text-align: left;\n  padding-left: 2px;\n  font-size: 10px;\n  color: rgba(0, 0, 0, 0.4);\n  vertical-align: middle;\n  line-height: 20px;\n}\n\ndiv.vis-color-picker div.vis-label {\n  position: absolute;\n  width: 300px;\n  left: 10px;\n}\n\ndiv.vis-color-picker div.vis-label.vis-brightness {\n  top: 300px;\n}\n\ndiv.vis-color-picker div.vis-label.vis-opacity {\n  top: 338px;\n}\n\ndiv.vis-color-picker div.vis-button {\n  position: absolute;\n  width: 68px;\n  height: 25px;\n  border-radius: 10px;\n  vertical-align: middle;\n  text-align: center;\n  line-height: 25px;\n  top: 410px;\n  border: 2px solid #d9d9d9;\n  background-color: #f7f7f7;\n  cursor: pointer;\n}\n\ndiv.vis-color-picker div.vis-button.vis-cancel {\n  /*border:2px solid #ff4e33;*/\n  /*background-color: #ff7761;*/\n  left: 5px;\n}\ndiv.vis-color-picker div.vis-button.vis-load {\n  /*border:2px solid #a153e6;*/\n  /*background-color: #cb8dff;*/\n  left: 82px;\n}\ndiv.vis-color-picker div.vis-button.vis-apply {\n  /*border:2px solid #4588e6;*/\n  /*background-color: #82b6ff;*/\n  left: 159px;\n}\ndiv.vis-color-picker div.vis-button.vis-save {\n  /*border:2px solid #45e655;*/\n  /*background-color: #6dff7c;*/\n  left: 236px;\n}\n\ndiv.vis-color-picker input.vis-range {\n  width: 290px;\n  height: 20px;\n}\n\n/* TODO: is this redundant?\ndiv.vis-color-picker input.vis-range-brightness {\n  width: 289px !important;\n}\n\n\ndiv.vis-color-picker input.vis-saturation-range {\n  width: 289px !important;\n}*/\n");Ug("div.vis-configuration {\n  position: relative;\n  display: block;\n  float: left;\n  font-size: 12px;\n}\n\ndiv.vis-configuration-wrapper {\n  display: block;\n  width: 700px;\n}\n\ndiv.vis-configuration-wrapper::after {\n  clear: both;\n  content: \"\";\n  display: block;\n}\n\ndiv.vis-configuration.vis-config-option-container {\n  display: block;\n  width: 495px;\n  background-color: #ffffff;\n  border: 2px solid #f7f8fa;\n  border-radius: 4px;\n  margin-top: 20px;\n  left: 10px;\n  padding-left: 5px;\n}\n\ndiv.vis-configuration.vis-config-button {\n  display: block;\n  width: 495px;\n  height: 25px;\n  vertical-align: middle;\n  line-height: 25px;\n  background-color: #f7f8fa;\n  border: 2px solid #ceced0;\n  border-radius: 4px;\n  margin-top: 20px;\n  left: 10px;\n  padding-left: 5px;\n  cursor: pointer;\n  margin-bottom: 30px;\n}\n\ndiv.vis-configuration.vis-config-button.hover {\n  background-color: #4588e6;\n  border: 2px solid #214373;\n  color: #ffffff;\n}\n\ndiv.vis-configuration.vis-config-item {\n  display: block;\n  float: left;\n  width: 495px;\n  height: 25px;\n  vertical-align: middle;\n  line-height: 25px;\n}\n\ndiv.vis-configuration.vis-config-item.vis-config-s2 {\n  left: 10px;\n  background-color: #f7f8fa;\n  padding-left: 5px;\n  border-radius: 3px;\n}\ndiv.vis-configuration.vis-config-item.vis-config-s3 {\n  left: 20px;\n  background-color: #e4e9f0;\n  padding-left: 5px;\n  border-radius: 3px;\n}\ndiv.vis-configuration.vis-config-item.vis-config-s4 {\n  left: 30px;\n  background-color: #cfd8e6;\n  padding-left: 5px;\n  border-radius: 3px;\n}\n\ndiv.vis-configuration.vis-config-header {\n  font-size: 18px;\n  font-weight: bold;\n}\n\ndiv.vis-configuration.vis-config-label {\n  width: 120px;\n  height: 25px;\n  line-height: 25px;\n}\n\ndiv.vis-configuration.vis-config-label.vis-config-s3 {\n  width: 110px;\n}\ndiv.vis-configuration.vis-config-label.vis-config-s4 {\n  width: 100px;\n}\n\ndiv.vis-configuration.vis-config-colorBlock {\n  top: 1px;\n  width: 30px;\n  height: 19px;\n  border: 1px solid #444444;\n  border-radius: 2px;\n  padding: 0px;\n  margin: 0px;\n  cursor: pointer;\n}\n\ninput.vis-configuration.vis-config-checkbox {\n  left: -5px;\n}\n\ninput.vis-configuration.vis-config-rangeinput {\n  position: relative;\n  top: -5px;\n  width: 60px;\n  /*height:13px;*/\n  padding: 1px;\n  margin: 0;\n  pointer-events: none;\n}\n\ninput.vis-configuration.vis-config-range {\n  /*removes default webkit styles*/\n  -webkit-appearance: none;\n\n  /*fix for FF unable to apply focus style bug */\n  border: 0px solid white;\n  background-color: rgba(0, 0, 0, 0);\n\n  /*required for proper track sizing in FF*/\n  width: 300px;\n  height: 20px;\n}\ninput.vis-configuration.vis-config-range::-webkit-slider-runnable-track {\n  width: 300px;\n  height: 5px;\n  background: #dedede; /* Old browsers */\n  background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */\n  background: -webkit-gradient(\n    linear,\n    left top,\n    left bottom,\n    color-stop(0%, #dedede),\n    color-stop(99%, #c8c8c8)\n  ); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(\n    top,\n    #dedede 0%,\n    #c8c8c8 99%\n  ); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(\n    top,\n    #dedede 0%,\n    #c8c8c8 99%\n  ); /* Opera 11.10+ */\n  background: -ms-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* IE10+ */\n  background: linear-gradient(to bottom, #dedede 0%, #c8c8c8 99%); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n\n  border: 1px solid #999999;\n  box-shadow: #aaaaaa 0px 0px 3px 0px;\n  border-radius: 3px;\n}\ninput.vis-configuration.vis-config-range::-webkit-slider-thumb {\n  -webkit-appearance: none;\n  border: 1px solid #14334b;\n  height: 17px;\n  width: 17px;\n  border-radius: 50%;\n  background: #3876c2; /* Old browsers */\n  background: -moz-linear-gradient(top, #3876c2 0%, #385380 100%); /* FF3.6+ */\n  background: -webkit-gradient(\n    linear,\n    left top,\n    left bottom,\n    color-stop(0%, #3876c2),\n    color-stop(100%, #385380)\n  ); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(\n    top,\n    #3876c2 0%,\n    #385380 100%\n  ); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(\n    top,\n    #3876c2 0%,\n    #385380 100%\n  ); /* Opera 11.10+ */\n  background: -ms-linear-gradient(top, #3876c2 0%, #385380 100%); /* IE10+ */\n  background: linear-gradient(to bottom, #3876c2 0%, #385380 100%); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3876c2', endColorstr='#385380',GradientType=0 ); /* IE6-9 */\n  box-shadow: #111927 0px 0px 1px 0px;\n  margin-top: -7px;\n}\ninput.vis-configuration.vis-config-range:focus {\n  outline: none;\n}\ninput.vis-configuration.vis-config-range:focus::-webkit-slider-runnable-track {\n  background: #9d9d9d; /* Old browsers */\n  background: -moz-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* FF3.6+ */\n  background: -webkit-gradient(\n    linear,\n    left top,\n    left bottom,\n    color-stop(0%, #9d9d9d),\n    color-stop(99%, #c8c8c8)\n  ); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(\n    top,\n    #9d9d9d 0%,\n    #c8c8c8 99%\n  ); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(\n    top,\n    #9d9d9d 0%,\n    #c8c8c8 99%\n  ); /* Opera 11.10+ */\n  background: -ms-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* IE10+ */\n  background: linear-gradient(to bottom, #9d9d9d 0%, #c8c8c8 99%); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9d9d9d', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n}\n\ninput.vis-configuration.vis-config-range::-moz-range-track {\n  width: 300px;\n  height: 10px;\n  background: #dedede; /* Old browsers */\n  background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */\n  background: -webkit-gradient(\n    linear,\n    left top,\n    left bottom,\n    color-stop(0%, #dedede),\n    color-stop(99%, #c8c8c8)\n  ); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(\n    top,\n    #dedede 0%,\n    #c8c8c8 99%\n  ); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(\n    top,\n    #dedede 0%,\n    #c8c8c8 99%\n  ); /* Opera 11.10+ */\n  background: -ms-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* IE10+ */\n  background: linear-gradient(to bottom, #dedede 0%, #c8c8c8 99%); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n\n  border: 1px solid #999999;\n  box-shadow: #aaaaaa 0px 0px 3px 0px;\n  border-radius: 3px;\n}\ninput.vis-configuration.vis-config-range::-moz-range-thumb {\n  border: none;\n  height: 16px;\n  width: 16px;\n\n  border-radius: 50%;\n  background: #385380;\n}\n\n/*hide the outline behind the border*/\ninput.vis-configuration.vis-config-range:-moz-focusring {\n  outline: 1px solid white;\n  outline-offset: -1px;\n}\n\ninput.vis-configuration.vis-config-range::-ms-track {\n  width: 300px;\n  height: 5px;\n\n  /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */\n  background: transparent;\n\n  /*leave room for the larger thumb to overflow with a transparent border */\n  border-color: transparent;\n  border-width: 6px 0;\n\n  /*remove default tick marks*/\n  color: transparent;\n}\ninput.vis-configuration.vis-config-range::-ms-fill-lower {\n  background: #777;\n  border-radius: 10px;\n}\ninput.vis-configuration.vis-config-range::-ms-fill-upper {\n  background: #ddd;\n  border-radius: 10px;\n}\ninput.vis-configuration.vis-config-range::-ms-thumb {\n  border: none;\n  height: 16px;\n  width: 16px;\n  border-radius: 50%;\n  background: #385380;\n}\ninput.vis-configuration.vis-config-range:focus::-ms-fill-lower {\n  background: #888;\n}\ninput.vis-configuration.vis-config-range:focus::-ms-fill-upper {\n  background: #ccc;\n}\n\n.vis-configuration-popup {\n  position: absolute;\n  background: rgba(57, 76, 89, 0.85);\n  border: 2px solid #f2faff;\n  line-height: 30px;\n  height: 30px;\n  width: 150px;\n  text-align: center;\n  color: #ffffff;\n  font-size: 14px;\n  border-radius: 4px;\n  -webkit-transition: opacity 0.3s ease-in-out;\n  -moz-transition: opacity 0.3s ease-in-out;\n  transition: opacity 0.3s ease-in-out;\n}\n.vis-configuration-popup:after,\n.vis-configuration-popup:before {\n  left: 100%;\n  top: 50%;\n  border: solid transparent;\n  content: \" \";\n  height: 0;\n  width: 0;\n  position: absolute;\n  pointer-events: none;\n}\n\n.vis-configuration-popup:after {\n  border-color: rgba(136, 183, 213, 0);\n  border-left-color: rgba(57, 76, 89, 0.85);\n  border-width: 8px;\n  margin-top: -8px;\n}\n.vis-configuration-popup:before {\n  border-color: rgba(194, 225, 245, 0);\n  border-left-color: #f2faff;\n  border-width: 12px;\n  margin-top: -12px;\n}\n");Ug("div.vis-tooltip {\n  position: absolute;\n  visibility: hidden;\n  padding: 5px;\n  white-space: nowrap;\n\n  font-family: verdana;\n  font-size: 14px;\n  color: #000000;\n  background-color: #f5f4ed;\n\n  -moz-border-radius: 3px;\n  -webkit-border-radius: 3px;\n  border-radius: 3px;\n  border: 1px solid #808074;\n\n  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);\n  pointer-events: none;\n\n  z-index: 5;\n}\n");var Qg=w((function(g){function e(g){if(g)return function(g){for(var t in e.prototype)g[t]=e.prototype[t];return g}(g)}g.exports=e,e.prototype.on=e.prototype.addEventListener=function(g,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+g]=this._callbacks["$"+g]||[]).push(e),this},e.prototype.once=function(g,e){function t(){this.off(g,t),e.apply(this,arguments)}return t.fn=e,this.on(g,t),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(g,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var t,A=this._callbacks["$"+g];if(!A)return this;if(1==arguments.length)return delete this._callbacks["$"+g],this;for(var C=0;C<A.length;C++)if((t=A[C])===e||t.fn===e){A.splice(C,1);break}return 0===A.length&&delete this._callbacks["$"+g],this},e.prototype.emit=function(g){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+g],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){A=0;for(var C=(t=t.slice(0)).length;A<C;++A)t[A].apply(this,e)}return this},e.prototype.listeners=function(g){return this._callbacks=this._callbacks||{},this._callbacks["$"+g]||[]},e.prototype.hasListeners=function(g){return!!this.listeners(g).length}})),Hg=function(g){return function(e,t){var A,C,i=String(z(e)),I=dg(t),n=i.length;return I<0||I>=n?g?"":void 0:(A=i.charCodeAt(I))<55296||A>56319||I+1===n||(C=i.charCodeAt(I+1))<56320||C>57343?g?i.charAt(I):A:g?i.slice(I,I+2):C-56320+(A-55296<<10)+65536}},Kg={codeAt:Hg(!1),charAt:Hg(!0)},Xg=x["__core-js_shared__"]||function(g,e){try{ng(x,g,e)}catch(t){x[g]=e}return e}("__core-js_shared__",{}),Jg=Function.toString;"function"!=typeof Xg.inspectSource&&(Xg.inspectSource=function(g){return Jg.call(g)});var qg,$g,ge,ee=Xg.inspectSource,te=x.WeakMap,Ae="function"==typeof te&&/native code/.test(ee(te)),Ce=w((function(g){(g.exports=function(g,e){return Xg[g]||(Xg[g]=void 0!==e?e:{})})("versions",[]).push({version:"3.9.1",mode:"pure",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),ie=0,Ie=Math.random(),ne=function(g){return"Symbol("+String(void 0===g?"":g)+")_"+(++ie+Ie).toString(36)},oe=Ce("keys"),re=function(g){return oe[g]||(oe[g]=ne(g))},se=x.WeakMap;if(Ae){var ae=Xg.state||(Xg.state=new se),le=ae.get,de=ae.has,he=ae.set;qg=function(g,e){return e.facade=g,he.call(ae,g,e),e},$g=function(g){return le.call(ae,g)||{}},ge=function(g){return de.call(ae,g)}}else{var ce=re("state");yg[ce]=!0,qg=function(g,e){return e.facade=g,ng(g,ce,e),e},$g=function(g){return G(g,ce)?g[ce]:{}},ge=function(g){return G(g,ce)}}var ue,pe,fe={set:qg,get:$g,has:ge,enforce:function(g){return ge(g)?$g(g):qg(g,{})},getterFor:function(g){return function(e){var t;if(!Z(e)||(t=$g(e)).type!==g)throw TypeError("Incompatible receiver, "+g+" required");return t}}},ve=!E((function(){function g(){}return g.prototype.constructor=null,Object.getPrototypeOf(new g)!==g.prototype})),me=re("IE_PROTO"),ye=Object.prototype,be=ve?Object.getPrototypeOf:function(g){return g=Og(g),G(g,me)?g[me]:"function"==typeof g.constructor&&g instanceof g.constructor?g.constructor.prototype:g instanceof Object?ye:null},we="process"==S(x.process),ke=function(g){return"function"==typeof g?g:void 0},xe=function(g,e){return arguments.length<2?ke(eg[g])||ke(x[g]):eg[g]&&eg[g][e]||x[g]&&x[g][e]},Ee=xe("navigator","userAgent")||"",Oe=x.process,Te=Oe&&Oe.versions,De=Te&&Te.v8;De?pe=(ue=De.split("."))[0]+ue[1]:Ee&&(!(ue=Ee.match(/Edge\/(\d+)/))||ue[1]>=74)&&(ue=Ee.match(/Chrome\/(\d+)/))&&(pe=ue[1]);var Ne,Re,Pe,Se=pe&&+pe,Me=!!Object.getOwnPropertySymbols&&!E((function(){return!Symbol.sham&&(we?38===Se:Se>37&&Se<41)})),Be=Me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ze=Ce("wks"),Fe=x.Symbol,Ze=Be?Fe:Fe&&Fe.withoutSetter||ne,je=function(g){return G(ze,g)&&(Me||"string"==typeof ze[g])||(Me&&G(Fe,g)?ze[g]=Fe[g]:ze[g]=Ze("Symbol."+g)),ze[g]},Le=je("iterator"),Ge=!1;[].keys&&("next"in(Pe=[].keys())?(Re=be(be(Pe)))!==Object.prototype&&(Ne=Re):Ge=!0);var Ve=null==Ne||E((function(){var g={};return Ne[Le].call(g)!==g}));Ve&&(Ne={}),Ve&&!G(Ne,Le)&&ng(Ne,Le,(function(){return this}));var Ye,We={IteratorPrototype:Ne,BUGGY_SAFARI_ITERATORS:Ge},_e=O?Object.defineProperties:function(g,e){Cg(g);for(var t,A=xg(e),C=A.length,i=0;C>i;)Ig.f(g,t=A[i++],e[t]);return g},Ue=xe("document","documentElement"),Qe=re("IE_PROTO"),He=function(){},Ke=function(g){return"<script>"+g+"<\/script>"},Xe=function(){try{Ye=document.domain&&new ActiveXObject("htmlfile")}catch(g){}var g,e;Xe=Ye?function(g){g.write(Ke("")),g.close();var e=g.parentWindow.Object;return g=null,e}(Ye):((e=W("iframe")).style.display="none",Ue.appendChild(e),e.src=String("javascript:"),(g=e.contentWindow.document).open(),g.write(Ke("document.F=Object")),g.close(),g.F);for(var t=kg.length;t--;)delete Xe.prototype[kg[t]];return Xe()};yg[Qe]=!0;var Je=Object.create||function(g,e){var t;return null!==g?(He.prototype=Cg(g),t=new He,He.prototype=null,t[Qe]=g):t=Xe(),void 0===e?t:_e(t,e)},qe={};qe[je("toStringTag")]="z";var $e="[object z]"===String(qe),gt=je("toStringTag"),et="Arguments"==S(function(){return arguments}()),tt=$e?S:function(g){var e,t,A;return void 0===g?"Undefined":null===g?"Null":"string"==typeof(t=function(g,e){try{return g[e]}catch(g){}}(e=Object(g),gt))?t:et?S(e):"Object"==(A=S(e))&&"function"==typeof e.callee?"Arguments":A},At=$e?{}.toString:function(){return"[object "+tt(this)+"]"},Ct=Ig.f,it=je("toStringTag"),It=function(g,e,t,A){if(g){var C=t?g:g.prototype;G(C,it)||Ct(C,it,{configurable:!0,value:e}),A&&!$e&&ng(C,"toString",At)}},nt={},ot=We.IteratorPrototype,rt=function(){return this},st=Object.setPrototypeOf||("__proto__"in{}?function(){var g,e=!1,t={};try{(g=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(t,[]),e=t instanceof Array}catch(g){}return function(t,A){return Cg(t),function(g){if(!Z(g)&&null!==g)throw TypeError("Can't set "+String(g)+" as a prototype")}(A),e?g.call(t,A):t.__proto__=A,t}}():void 0),at=function(g,e,t,A){A&&A.enumerable?g[e]=t:ng(g,e,t)},lt=We.IteratorPrototype,dt=We.BUGGY_SAFARI_ITERATORS,ht=je("iterator"),ct=function(){return this},ut=function(g,e,t,A,C,i,I){!function(g,e,t){var A=e+" Iterator";g.prototype=Je(ot,{next:R(1,t)}),It(g,A,!1,!0),nt[A]=rt}(t,e,A);var n,o,r,s=function(g){if(g===C&&c)return c;if(!dt&&g in d)return d[g];switch(g){case"keys":case"values":case"entries":return function(){return new t(this,g)}}return function(){return new t(this)}},a=e+" Iterator",l=!1,d=g.prototype,h=d[ht]||d["@@iterator"]||C&&d[C],c=!dt&&h||s(C),u="Array"==e&&d.entries||h;if(u&&(n=be(u.call(new g)),lt!==Object.prototype&&n.next&&(It(n,a,!0,!0),nt[a]=ct)),"values"==C&&h&&"values"!==h.name&&(l=!0,c=function(){return h.call(this)}),I&&d[ht]!==c&&ng(d,ht,c),nt[e]=c,C)if(o={values:s("values"),keys:i?c:s("keys"),entries:s("entries")},I)for(r in o)(dt||l||!(r in d))&&at(d,r,o[r]);else sg({target:e,proto:!0,forced:dt||l},o);return o},pt=Kg.charAt,ft=fe.set,vt=fe.getterFor("String Iterator");ut(String,"String",(function(g){ft(this,{type:"String Iterator",string:String(g),index:0})}),(function(){var g,e=vt(this),t=e.string,A=e.index;return A>=t.length?{value:void 0,done:!0}:(g=pt(t,A),e.index+=g.length,{value:g,done:!1})}));var mt=function(g){var e=g.return;if(void 0!==e)return Cg(e.call(g)).value},yt=function(g,e,t,A){try{return A?e(Cg(t)[0],t[1]):e(t)}catch(e){throw mt(g),e}},bt=je("iterator"),wt=Array.prototype,kt=function(g){return void 0!==g&&(nt.Array===g||wt[bt]===g)},xt=function(g,e,t){var A=j(e);A in g?Ig.f(g,A,R(0,t)):g[A]=t},Et=je("iterator"),Ot=function(g){if(null!=g)return g[Et]||g["@@iterator"]||nt[tt(g)]},Tt=je("iterator"),Dt=!1;try{var Nt=0,Rt={next:function(){return{done:!!Nt++}},return:function(){Dt=!0}};Rt[Tt]=function(){return this},Array.from(Rt,(function(){throw 2}))}catch(g){}var Pt=!function(g,e){if(!e&&!Dt)return!1;var t=!1;try{var A={};A[Tt]=function(){return{next:function(){return{done:t=!0}}}},g(A)}catch(g){}return t}((function(g){Array.from(g)}));sg({target:"Array",stat:!0,forced:Pt},{from:function(g){var e,t,A,C,i,I,n=Og(g),o="function"==typeof this?this:Array,r=arguments.length,s=r>1?arguments[1]:void 0,a=void 0!==s,l=Ot(n),d=0;if(a&&(s=Ag(s,r>2?arguments[2]:void 0,2)),null==l||o==Array&&kt(l))for(t=new o(e=cg(n.length));e>d;d++)I=a?s(n[d],d):n[d],xt(t,d,I);else for(i=(C=l.call(n)).next,t=new o;!(A=i.call(C)).done;d++)I=a?yt(C,s,[A.value,d],!0):A.value,xt(t,d,I);return t.length=d,t}});var St=eg.Array.from,Mt=St,Bt=fe.set,zt=fe.getterFor("Array Iterator");ut(Array,"Array",(function(g,e){Bt(this,{type:"Array Iterator",target:F(g),index:0,kind:e})}),(function(){var g=zt(this),e=g.target,t=g.kind,A=g.index++;return!e||A>=e.length?(g.target=void 0,{value:void 0,done:!0}):"keys"==t?{value:A,done:!1}:"values"==t?{value:e[A],done:!1}:{value:[A,e[A]],done:!1}}),"values"),nt.Arguments=nt.Array;var Ft=je("toStringTag");for(var Zt in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var jt=x[Zt],Lt=jt&&jt.prototype;Lt&&tt(Lt)!==Ft&&ng(Lt,Ft,Zt),nt[Zt]=nt.Array}var Gt=Ot,Vt=function(g){var e=Ot(g);if("function"!=typeof e)throw TypeError(String(g)+" is not iterable");return Cg(e.call(g))},Yt=Array.isArray||function(g){return"Array"==S(g)},Wt=kg.concat("length","prototype"),_t={f:Object.getOwnPropertyNames||function(g){return wg(g,Wt)}},Ut=_t.f,Qt={}.toString,Ht="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Kt={f:function(g){return Ht&&"[object Window]"==Qt.call(g)?function(g){try{return Ut(g)}catch(g){return Ht.slice()}}(g):Ut(F(g))}},Xt={f:je},Jt=Ig.f,qt=function(g){var e=eg.Symbol||(eg.Symbol={});G(e,g)||Jt(e,g,{value:Xt.f(g)})},$t=je("species"),gA=function(g,e){var t;return Yt(g)&&("function"!=typeof(t=g.constructor)||t!==Array&&!Yt(t.prototype)?Z(t)&&null===(t=t[$t])&&(t=void 0):t=void 0),new(void 0===t?Array:t)(0===e?0:e)},eA=[].push,tA=function(g){var e=1==g,t=2==g,A=3==g,C=4==g,i=6==g,I=7==g,n=5==g||i;return function(o,r,s,a){for(var l,d,h=Og(o),c=B(h),u=Ag(r,s,3),p=cg(c.length),f=0,v=a||gA,m=e?v(o,p):t||I?v(o,0):void 0;p>f;f++)if((n||f in c)&&(d=u(l=c[f],f,h),g))if(e)m[f]=d;else if(d)switch(g){case 3:return!0;case 5:return l;case 6:return f;case 2:eA.call(m,l)}else switch(g){case 4:return!1;case 7:eA.call(m,l)}return i?-1:A||C?C:m}},AA={forEach:tA(0),map:tA(1),filter:tA(2),some:tA(3),every:tA(4),find:tA(5),findIndex:tA(6),filterOut:tA(7)},CA=AA.forEach,iA=re("hidden"),IA=je("toPrimitive"),nA=fe.set,oA=fe.getterFor("Symbol"),rA=Object.prototype,sA=x.Symbol,aA=xe("JSON","stringify"),lA=Q.f,dA=Ig.f,hA=Kt.f,cA=N.f,uA=Ce("symbols"),pA=Ce("op-symbols"),fA=Ce("string-to-symbol-registry"),vA=Ce("symbol-to-string-registry"),mA=Ce("wks"),yA=x.QObject,bA=!yA||!yA.prototype||!yA.prototype.findChild,wA=O&&E((function(){return 7!=Je(dA({},"a",{get:function(){return dA(this,"a",{value:7}).a}})).a}))?function(g,e,t){var A=lA(rA,e);A&&delete rA[e],dA(g,e,t),A&&g!==rA&&dA(rA,e,A)}:dA,kA=function(g,e){var t=uA[g]=Je(sA.prototype);return nA(t,{type:"Symbol",tag:g,description:e}),O||(t.description=e),t},xA=Be?function(g){return"symbol"==typeof g}:function(g){return Object(g)instanceof sA},EA=function(g,e,t){g===rA&&EA(pA,e,t),Cg(g);var A=j(e,!0);return Cg(t),G(uA,A)?(t.enumerable?(G(g,iA)&&g[iA][A]&&(g[iA][A]=!1),t=Je(t,{enumerable:R(0,!1)})):(G(g,iA)||dA(g,iA,R(1,{})),g[iA][A]=!0),wA(g,A,t)):dA(g,A,t)},OA=function(g,e){Cg(g);var t=F(e),A=xg(t).concat(RA(t));return CA(A,(function(e){O&&!TA.call(t,e)||EA(g,e,t[e])})),g},TA=function(g){var e=j(g,!0),t=cA.call(this,e);return!(this===rA&&G(uA,e)&&!G(pA,e))&&(!(t||!G(this,e)||!G(uA,e)||G(this,iA)&&this[iA][e])||t)},DA=function(g,e){var t=F(g),A=j(e,!0);if(t!==rA||!G(uA,A)||G(pA,A)){var C=lA(t,A);return!C||!G(uA,A)||G(t,iA)&&t[iA][A]||(C.enumerable=!0),C}},NA=function(g){var e=hA(F(g)),t=[];return CA(e,(function(g){G(uA,g)||G(yg,g)||t.push(g)})),t},RA=function(g){var e=g===rA,t=hA(e?pA:F(g)),A=[];return CA(t,(function(g){!G(uA,g)||e&&!G(rA,g)||A.push(uA[g])})),A};if(Me||(at((sA=function(){if(this instanceof sA)throw TypeError("Symbol is not a constructor");var g=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=ne(g),t=function(g){this===rA&&t.call(pA,g),G(this,iA)&&G(this[iA],e)&&(this[iA][e]=!1),wA(this,e,R(1,g))};return O&&bA&&wA(rA,e,{configurable:!0,set:t}),kA(e,g)}).prototype,"toString",(function(){return oA(this).tag})),at(sA,"withoutSetter",(function(g){return kA(ne(g),g)})),N.f=TA,Ig.f=EA,Q.f=DA,_t.f=Kt.f=NA,Eg.f=RA,Xt.f=function(g){return kA(je(g),g)},O&&dA(sA.prototype,"description",{configurable:!0,get:function(){return oA(this).description}})),sg({global:!0,wrap:!0,forced:!Me,sham:!Me},{Symbol:sA}),CA(xg(mA),(function(g){qt(g)})),sg({target:"Symbol",stat:!0,forced:!Me},{for:function(g){var e=String(g);if(G(fA,e))return fA[e];var t=sA(e);return fA[e]=t,vA[t]=e,t},keyFor:function(g){if(!xA(g))throw TypeError(g+" is not a symbol");if(G(vA,g))return vA[g]},useSetter:function(){bA=!0},useSimple:function(){bA=!1}}),sg({target:"Object",stat:!0,forced:!Me,sham:!O},{create:function(g,e){return void 0===e?Je(g):OA(Je(g),e)},defineProperty:EA,defineProperties:OA,getOwnPropertyDescriptor:DA}),sg({target:"Object",stat:!0,forced:!Me},{getOwnPropertyNames:NA,getOwnPropertySymbols:RA}),sg({target:"Object",stat:!0,forced:E((function(){Eg.f(1)}))},{getOwnPropertySymbols:function(g){return Eg.f(Og(g))}}),aA){var PA=!Me||E((function(){var g=sA();return"[null]"!=aA([g])||"{}"!=aA({a:g})||"{}"!=aA(Object(g))}));sg({target:"JSON",stat:!0,forced:PA},{stringify:function(g,e,t){for(var A,C=[g],i=1;arguments.length>i;)C.push(arguments[i++]);if(A=e,(Z(e)||void 0!==g)&&!xA(g))return Yt(e)||(e=function(g,e){if("function"==typeof A&&(e=A.call(this,g,e)),!xA(e))return e}),C[1]=e,aA.apply(null,C)}})}sA.prototype[IA]||ng(sA.prototype,IA,sA.prototype.valueOf),It(sA,"Symbol"),yg[iA]=!0;var SA=eg.Object.getOwnPropertySymbols,MA=Q.f,BA=E((function(){MA(1)}));sg({target:"Object",stat:!0,forced:!O||BA,sham:!O},{getOwnPropertyDescriptor:function(g,e){return MA(F(g),e)}});var zA=w((function(g){var e=eg.Object,t=g.exports=function(g,t){return e.getOwnPropertyDescriptor(g,t)};e.getOwnPropertyDescriptor.sham&&(t.sham=!0)})),FA=zA,ZA=xe("Reflect","ownKeys")||function(g){var e=_t.f(Cg(g)),t=Eg.f;return t?e.concat(t(g)):e};sg({target:"Object",stat:!0,sham:!O},{getOwnPropertyDescriptors:function(g){for(var e,t,A=F(g),C=Q.f,i=ZA(A),I={},n=0;i.length>n;)void 0!==(t=C(A,e=i[n++]))&&xt(I,e,t);return I}});var jA=eg.Object.getOwnPropertyDescriptors;sg({target:"Object",stat:!0,forced:!O,sham:!O},{defineProperties:_e});var LA=w((function(g){var e=eg.Object,t=g.exports=function(g,t){return e.defineProperties(g,t)};e.defineProperties.sham&&(t.sham=!0)}));sg({target:"Object",stat:!0,forced:!O,sham:!O},{defineProperty:Ig.f});var GA=w((function(g){var e=eg.Object,t=g.exports=function(g,t,A){return e.defineProperty(g,t,A)};e.defineProperty.sham&&(t.sham=!0)})),VA=GA;function YA(g,e){if(!(g instanceof e))throw new TypeError("Cannot call a class as a function")}var WA=GA;function _A(g,e){for(var t=0;t<e.length;t++){var A=e[t];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),WA(g,A.key,A)}}function UA(g,e,t){return e&&_A(g.prototype,e),t&&_A(g,t),g}function QA(g,e,t){return e in g?WA(g,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):g[e]=t,g}sg({target:"Array",stat:!0},{isArray:Yt});var HA=eg.Array.isArray,KA=HA;var XA=je("species"),JA=function(g){return Se>=51||!E((function(){var e=[];return(e.constructor={})[XA]=function(){return{foo:1}},1!==e[g](Boolean).foo}))},qA=je("isConcatSpreadable"),$A=Se>=51||!E((function(){var g=[];return g[qA]=!1,g.concat()[0]!==g})),gC=JA("concat"),eC=function(g){if(!Z(g))return!1;var e=g[qA];return void 0!==e?!!e:Yt(g)};sg({target:"Array",proto:!0,forced:!$A||!gC},{concat:function(g){var e,t,A,C,i,I=Og(this),n=gA(I,0),o=0;for(e=-1,A=arguments.length;e<A;e++)if(eC(i=-1===e?I:arguments[e])){if(o+(C=cg(i.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(t=0;t<C;t++,o++)t in i&&xt(n,o,i[t])}else{if(o>=9007199254740991)throw TypeError("Maximum allowed index exceeded");xt(n,o++,i)}return n.length=o,n}}),qt("asyncIterator"),qt("hasInstance"),qt("isConcatSpreadable"),qt("iterator"),qt("match"),qt("matchAll"),qt("replace"),qt("search"),qt("species"),qt("split"),qt("toPrimitive"),qt("toStringTag"),qt("unscopables"),It(x.JSON,"JSON",!0);var tC=eg.Symbol;qt("asyncDispose"),qt("dispose"),qt("observable"),qt("patternMatch"),qt("replaceAll");var AC=tC,CC=je("iterator"),iC=function(g){var e=Object(g);return void 0!==e[CC]||"@@iterator"in e||nt.hasOwnProperty(tt(e))};var IC=JA("slice"),nC=je("species"),oC=[].slice,rC=Math.max;sg({target:"Array",proto:!0,forced:!IC},{slice:function(g,e){var t,A,C,i=F(this),I=cg(i.length),n=fg(g,I),o=fg(void 0===e?I:e,I);if(Yt(i)&&("function"!=typeof(t=i.constructor)||t!==Array&&!Yt(t.prototype)?Z(t)&&null===(t=t[nC])&&(t=void 0):t=void 0,t===Array||void 0===t))return oC.call(i,n,o);for(A=new(void 0===t?Array:t)(rC(o-n,0)),C=0;n<o;n++,C++)n in i&&xt(A,C,i[n]);return A.length=C,A}});var sC=zg("Array").slice,aC=Array.prototype,lC=function(g){var e=g.slice;return g===aC||g instanceof Array&&e===aC.slice?sC:e},dC=lC,hC=St;function cC(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}function uC(g,e){var t;if(g){if("string"==typeof g)return cC(g,e);var A=dC(t=Object.prototype.toString.call(g)).call(t,8,-1);return"Object"===A&&g.constructor&&(A=g.constructor.name),"Map"===A||"Set"===A?hC(g):"Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A)?cC(g,e):void 0}}function pC(g,e){return function(g){if(KA(g))return g}(g)||function(g,e){if(void 0!==AC&&iC(Object(g))){var t=[],A=!0,C=!1,i=void 0;try{for(var I,n=Vt(g);!(A=(I=n.next()).done)&&(t.push(I.value),!e||t.length!==e);A=!0);}catch(g){C=!0,i=g}finally{try{A||null==n.return||n.return()}finally{if(C)throw i}}return t}}(g,e)||uC(g,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var fC=Xt.f("iterator"),vC=fC;function mC(g){return(mC="function"==typeof AC&&"symbol"==typeof vC?function(g){return typeof g}:function(g){return g&&"function"==typeof AC&&g.constructor===AC&&g!==AC.prototype?"symbol":typeof g})(g)}function yC(g){return function(g){if(KA(g))return cC(g)}(g)||function(g){if(void 0!==AC&&iC(Object(g)))return hC(g)}(g)||uC(g)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var bC=tC,wC=zg("Array").concat,kC=Array.prototype,xC=function(g){var e=g.concat;return g===kC||g instanceof Array&&e===kC.concat?wC:e},EC=lC;sg({target:"Reflect",stat:!0},{ownKeys:ZA});var OC=eg.Reflect.ownKeys,TC=HA,DC=AA.map,NC=JA("map");sg({target:"Array",proto:!0,forced:!NC},{map:function(g){return DC(this,g,arguments.length>1?arguments[1]:void 0)}});var RC=zg("Array").map,PC=Array.prototype,SC=function(g){var e=g.map;return g===PC||g instanceof Array&&e===PC.map?RC:e},MC=E((function(){xg(1)}));sg({target:"Object",stat:!0,forced:MC},{keys:function(g){return xg(Og(g))}});var BC=eg.Object.keys;sg({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var zC=eg.Date.now,FC=function(g,e){var t=[][g];return!!t&&E((function(){t.call(null,e||function(){throw 1},1)}))},ZC=AA.forEach,jC=FC("forEach")?[].forEach:function(g){return ZC(this,g,arguments.length>1?arguments[1]:void 0)};sg({target:"Array",proto:!0,forced:[].forEach!=jC},{forEach:jC});var LC=zg("Array").forEach,GC=Array.prototype,VC={DOMTokenList:!0,NodeList:!0},YC=function(g){var e=g.forEach;return g===GC||g instanceof Array&&e===GC.forEach||VC.hasOwnProperty(tt(g))?LC:e},WC=[].reverse,_C=[1,2];sg({target:"Array",proto:!0,forced:String(_C)===String(_C.reverse())},{reverse:function(){return Yt(this)&&(this.length=this.length),WC.call(this)}});var UC=zg("Array").reverse,QC=Array.prototype,HC=function(g){var e=g.reverse;return g===QC||g instanceof Array&&e===QC.reverse?UC:e},KC=JA("splice"),XC=Math.max,JC=Math.min;sg({target:"Array",proto:!0,forced:!KC},{splice:function(g,e){var t,A,C,i,I,n,o=Og(this),r=cg(o.length),s=fg(g,r),a=arguments.length;if(0===a?t=A=0:1===a?(t=0,A=r-s):(t=a-2,A=JC(XC(dg(e),0),r-s)),r+t-A>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(C=gA(o,A),i=0;i<A;i++)(I=s+i)in o&&xt(C,i,o[I]);if(C.length=A,t<A){for(i=s;i<r-A;i++)n=i+t,(I=i+A)in o?o[n]=o[I]:delete o[n];for(i=r;i>r-A+t;i--)delete o[i-1]}else if(t>A)for(i=r-A;i>s;i--)n=i+t-1,(I=i+A-1)in o?o[n]=o[I]:delete o[n];for(i=0;i<t;i++)o[i+s]=arguments[i+2];return o.length=r-A+t,C}});var qC=zg("Array").splice,$C=Array.prototype,gi=function(g){var e=g.splice;return g===$C||g instanceof Array&&e===$C.splice?qC:e},ei=mg.includes;sg({target:"Array",proto:!0},{includes:function(g){return ei(this,g,arguments.length>1?arguments[1]:void 0)}});var ti=zg("Array").includes,Ai=je("match"),Ci=function(g){if(function(g){var e;return Z(g)&&(void 0!==(e=g[Ai])?!!e:"RegExp"==S(g))}(g))throw TypeError("The method doesn't accept regular expressions");return g},ii=je("match");sg({target:"String",proto:!0,forced:!function(g){var e=/./;try{"/./"[g](e)}catch(t){try{return e[ii]=!1,"/./"[g](e)}catch(g){}}return!1}("includes")},{includes:function(g){return!!~String(z(this)).indexOf(Ci(g),arguments.length>1?arguments[1]:void 0)}});var Ii=zg("String").includes,ni=Array.prototype,oi=String.prototype,ri=function(g){var e=g.includes;return g===ni||g instanceof Array&&e===ni.includes?ti:"string"==typeof g||g===oi||g instanceof String&&e===oi.includes?Ii:e},si=E((function(){be(1)}));sg({target:"Object",stat:!0,forced:si,sham:!ve},{getPrototypeOf:function(g){return be(Og(g))}});var ai=eg.Object.getPrototypeOf,li=ai,di=AA.filter,hi=JA("filter");sg({target:"Array",proto:!0,forced:!hi},{filter:function(g){return di(this,g,arguments.length>1?arguments[1]:void 0)}});var ci=zg("Array").filter,ui=Array.prototype,pi=function(g){var e=g.filter;return g===ui||g instanceof Array&&e===ui.filter?ci:e},fi=N.f,vi=function(g){return function(e){for(var t,A=F(e),C=xg(A),i=C.length,I=0,n=[];i>I;)t=C[I++],O&&!fi.call(A,t)||n.push(g?[t,A[t]]:A[t]);return n}},mi={entries:vi(!0),values:vi(!1)}.values;sg({target:"Object",stat:!0},{values:function(g){return mi(g)}}),eg.Object.values;var yi="\t\n\v\f\r                　\u2028\u2029\ufeff",bi="["+yi+"]",wi=RegExp("^"+bi+bi+"*"),ki=RegExp(bi+bi+"*$"),xi=function(g){return function(e){var t=String(z(e));return 1&g&&(t=t.replace(wi,"")),2&g&&(t=t.replace(ki,"")),t}},Ei={start:xi(1),end:xi(2),trim:xi(3)},Oi=Ei.trim,Ti=x.parseInt,Di=/^[+-]?0[Xx]/,Ni=8!==Ti(yi+"08")||22!==Ti(yi+"0x16")?function(g,e){var t=Oi(String(g));return Ti(t,e>>>0||(Di.test(t)?16:10))}:Ti;sg({global:!0,forced:parseInt!=Ni},{parseInt:Ni});var Ri=eg.parseInt,Pi=mg.indexOf,Si=[].indexOf,Mi=!!Si&&1/[1].indexOf(1,-0)<0,Bi=FC("indexOf");sg({target:"Array",proto:!0,forced:Mi||!Bi},{indexOf:function(g){return Mi?Si.apply(this,arguments)||0:Pi(this,g,arguments.length>1?arguments[1]:void 0)}});var zi,Fi=zg("Array").indexOf,Zi=Array.prototype,ji=function(g){var e=g.indexOf;return g===Zi||g instanceof Array&&e===Zi.indexOf?Fi:e},Li=Ei.trim;sg({target:"String",proto:!0,forced:(zi="trim",E((function(){return!!yi[zi]()||"​᠎"!="​᠎"[zi]()||yi[zi].name!==zi})))},{trim:function(){return Li(this)}}),zg("String").trim,sg({target:"Object",stat:!0,sham:!O},{create:Je});var Gi=eg.Object,Vi=function(g,e){return Gi.create(g,e)},Yi=Vi,Wi=xe("JSON","stringify"),_i=/[\uD800-\uDFFF]/g,Ui=/^[\uD800-\uDBFF]$/,Qi=/^[\uDC00-\uDFFF]$/,Hi=function(g,e,t){var A=t.charAt(e-1),C=t.charAt(e+1);return Ui.test(g)&&!Qi.test(C)||Qi.test(g)&&!Ui.test(A)?"\\u"+g.charCodeAt(0).toString(16):g},Ki=E((function(){return'"\\udf06\\ud834"'!==Wi("\udf06\ud834")||'"\\udead"'!==Wi("\udead")}));Wi&&sg({target:"JSON",stat:!0,forced:Ki},{stringify:function(g,e,t){var A=Wi.apply(null,arguments);return"string"==typeof A?A.replace(_i,Hi):A}}),eg.JSON||(eg.JSON={stringify:JSON.stringify});var Xi=function(g,e,t){return eg.JSON.stringify.apply(null,arguments)},Ji=[].slice,qi=/MSIE .\./.test(Ee),$i=function(g){return function(e,t){var A=arguments.length>2,C=A?Ji.call(arguments,2):void 0;return g(A?function(){("function"==typeof e?e:Function(e)).apply(this,C)}:e,t)}};sg({global:!0,bind:!0,forced:qi},{setTimeout:$i(x.setTimeout),setInterval:$i(x.setInterval)});var gI=eg.setTimeout;sg({target:"Array",proto:!0},{fill:function(g){for(var e=Og(this),t=cg(e.length),A=arguments.length,C=fg(A>1?arguments[1]:void 0,t),i=A>2?arguments[2]:void 0,I=void 0===i?t:fg(i,t);I>C;)e[C++]=g;return e}});var eI=zg("Array").fill,tI=Array.prototype,AI=function(g){var e=g.fill;return g===tI||g instanceof Array&&e===tI.fill?eI:e};
/*! Hammer.JS - v2.0.17-rc - 2019-12-16
 * http://naver.github.io/egjs
 *
 * Forked By Naver egjs
 * Copyright (c) hammerjs
 * Licensed under the MIT license */
function CI(){return(CI=Object.assign||function(g){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(g[A]=t[A])}return g}).apply(this,arguments)}function iI(g,e){g.prototype=Object.create(e.prototype),g.prototype.constructor=g,g.__proto__=e}function II(g){if(void 0===g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}var nI,oI="function"!=typeof Object.assign?function(g){if(null==g)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(g),t=1;t<arguments.length;t++){var A=arguments[t];if(null!=A)for(var C in A)A.hasOwnProperty(C)&&(e[C]=A[C])}return e}:Object.assign,rI=["","webkit","Moz","MS","ms","o"],sI="undefined"==typeof document?{style:{}}:document.createElement("div"),aI=Math.round,lI=Math.abs,dI=Date.now;function hI(g,e){for(var t,A,C=e[0].toUpperCase()+e.slice(1),i=0;i<rI.length;){if((A=(t=rI[i])?t+C:e)in g)return A;i++}}nI="undefined"==typeof window?{}:window;var cI=hI(sI.style,"touchAction"),uI=void 0!==cI;var pI=function(){if(!uI)return!1;var g={},e=nI.CSS&&nI.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(t){return g[t]=!e||nI.CSS.supports("touch-action",t)})),g}(),fI="ontouchstart"in nI,vI=void 0!==hI(nI,"PointerEvent"),mI=fI&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),yI=["x","y"],bI=["clientX","clientY"];function wI(g,e,t){var A;if(g)if(g.forEach)g.forEach(e,t);else if(void 0!==g.length)for(A=0;A<g.length;)e.call(t,g[A],A,g),A++;else for(A in g)g.hasOwnProperty(A)&&e.call(t,g[A],A,g)}function kI(g,e){return"function"==typeof g?g.apply(e&&e[0]||void 0,e):g}function xI(g,e){return g.indexOf(e)>-1}var EI=function(){function g(g,e){this.manager=g,this.set(e)}var e=g.prototype;return e.set=function(g){"compute"===g&&(g=this.compute()),uI&&this.manager.element.style&&pI[g]&&(this.manager.element.style[cI]=g),this.actions=g.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var g=[];return wI(this.manager.recognizers,(function(e){kI(e.options.enable,[e])&&(g=g.concat(e.getTouchAction()))})),function(g){if(xI(g,"none"))return"none";var e=xI(g,"pan-x"),t=xI(g,"pan-y");return e&&t?"none":e||t?e?"pan-x":"pan-y":xI(g,"manipulation")?"manipulation":"auto"}(g.join(" "))},e.preventDefaults=function(g){var e=g.srcEvent,t=g.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var A=this.actions,C=xI(A,"none")&&!pI.none,i=xI(A,"pan-y")&&!pI["pan-y"],I=xI(A,"pan-x")&&!pI["pan-x"];if(C){var n=1===g.pointers.length,o=g.distance<2,r=g.deltaTime<250;if(n&&o&&r)return}if(!I||!i)return C||i&&6&t||I&&24&t?this.preventSrc(e):void 0}},e.preventSrc=function(g){this.manager.session.prevented=!0,g.preventDefault()},g}();function OI(g,e){for(;g;){if(g===e)return!0;g=g.parentNode}return!1}function TI(g){var e=g.length;if(1===e)return{x:aI(g[0].clientX),y:aI(g[0].clientY)};for(var t=0,A=0,C=0;C<e;)t+=g[C].clientX,A+=g[C].clientY,C++;return{x:aI(t/e),y:aI(A/e)}}function DI(g){for(var e=[],t=0;t<g.pointers.length;)e[t]={clientX:aI(g.pointers[t].clientX),clientY:aI(g.pointers[t].clientY)},t++;return{timeStamp:dI(),pointers:e,center:TI(e),deltaX:g.deltaX,deltaY:g.deltaY}}function NI(g,e,t){t||(t=yI);var A=e[t[0]]-g[t[0]],C=e[t[1]]-g[t[1]];return Math.sqrt(A*A+C*C)}function RI(g,e,t){t||(t=yI);var A=e[t[0]]-g[t[0]],C=e[t[1]]-g[t[1]];return 180*Math.atan2(C,A)/Math.PI}function PI(g,e){return g===e?1:lI(g)>=lI(e)?g<0?2:4:e<0?8:16}function SI(g,e,t){return{x:e/g||0,y:t/g||0}}function MI(g,e){var t=g.session,A=e.pointers,C=A.length;t.firstInput||(t.firstInput=DI(e)),C>1&&!t.firstMultiple?t.firstMultiple=DI(e):1===C&&(t.firstMultiple=!1);var i=t.firstInput,I=t.firstMultiple,n=I?I.center:i.center,o=e.center=TI(A);e.timeStamp=dI(),e.deltaTime=e.timeStamp-i.timeStamp,e.angle=RI(n,o),e.distance=NI(n,o),function(g,e){var t=e.center,A=g.offsetDelta||{},C=g.prevDelta||{},i=g.prevInput||{};1!==e.eventType&&4!==i.eventType||(C=g.prevDelta={x:i.deltaX||0,y:i.deltaY||0},A=g.offsetDelta={x:t.x,y:t.y}),e.deltaX=C.x+(t.x-A.x),e.deltaY=C.y+(t.y-A.y)}(t,e),e.offsetDirection=PI(e.deltaX,e.deltaY);var r,s,a=SI(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=a.x,e.overallVelocityY=a.y,e.overallVelocity=lI(a.x)>lI(a.y)?a.x:a.y,e.scale=I?(r=I.pointers,NI((s=A)[0],s[1],bI)/NI(r[0],r[1],bI)):1,e.rotation=I?function(g,e){return RI(e[1],e[0],bI)+RI(g[1],g[0],bI)}(I.pointers,A):0,e.maxPointers=t.prevInput?e.pointers.length>t.prevInput.maxPointers?e.pointers.length:t.prevInput.maxPointers:e.pointers.length,function(g,e){var t,A,C,i,I=g.lastInterval||e,n=e.timeStamp-I.timeStamp;if(8!==e.eventType&&(n>25||void 0===I.velocity)){var o=e.deltaX-I.deltaX,r=e.deltaY-I.deltaY,s=SI(n,o,r);A=s.x,C=s.y,t=lI(s.x)>lI(s.y)?s.x:s.y,i=PI(o,r),g.lastInterval=e}else t=I.velocity,A=I.velocityX,C=I.velocityY,i=I.direction;e.velocity=t,e.velocityX=A,e.velocityY=C,e.direction=i}(t,e);var l,d=g.element,h=e.srcEvent;OI(l=h.composedPath?h.composedPath()[0]:h.path?h.path[0]:h.target,d)&&(d=l),e.target=d}function BI(g,e,t){var A=t.pointers.length,C=t.changedPointers.length,i=1&e&&A-C==0,I=12&e&&A-C==0;t.isFirst=!!i,t.isFinal=!!I,i&&(g.session={}),t.eventType=e,MI(g,t),g.emit("hammer.input",t),g.recognize(t),g.session.prevInput=t}function zI(g){return g.trim().split(/\s+/g)}function FI(g,e,t){wI(zI(e),(function(e){g.addEventListener(e,t,!1)}))}function ZI(g,e,t){wI(zI(e),(function(e){g.removeEventListener(e,t,!1)}))}function jI(g){var e=g.ownerDocument||g;return e.defaultView||e.parentWindow||window}var LI=function(){function g(g,e){var t=this;this.manager=g,this.callback=e,this.element=g.element,this.target=g.options.inputTarget,this.domHandler=function(e){kI(g.options.enable,[g])&&t.handler(e)},this.init()}var e=g.prototype;return e.handler=function(){},e.init=function(){this.evEl&&FI(this.element,this.evEl,this.domHandler),this.evTarget&&FI(this.target,this.evTarget,this.domHandler),this.evWin&&FI(jI(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&ZI(this.element,this.evEl,this.domHandler),this.evTarget&&ZI(this.target,this.evTarget,this.domHandler),this.evWin&&ZI(jI(this.element),this.evWin,this.domHandler)},g}();function GI(g,e,t){if(g.indexOf&&!t)return g.indexOf(e);for(var A=0;A<g.length;){if(t&&g[A][t]==e||!t&&g[A]===e)return A;A++}return-1}var VI={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},YI={2:"touch",3:"pen",4:"mouse",5:"kinect"},WI="pointerdown",_I="pointermove pointerup pointercancel";nI.MSPointerEvent&&!nI.PointerEvent&&(WI="MSPointerDown",_I="MSPointerMove MSPointerUp MSPointerCancel");var UI=function(g){function e(){var t,A=e.prototype;return A.evEl=WI,A.evWin=_I,(t=g.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return iI(e,g),e.prototype.handler=function(g){var e=this.store,t=!1,A=g.type.toLowerCase().replace("ms",""),C=VI[A],i=YI[g.pointerType]||g.pointerType,I="touch"===i,n=GI(e,g.pointerId,"pointerId");1&C&&(0===g.button||I)?n<0&&(e.push(g),n=e.length-1):12&C&&(t=!0),n<0||(e[n]=g,this.callback(this.manager,C,{pointers:e,changedPointers:[g],pointerType:i,srcEvent:g}),t&&e.splice(n,1))},e}(LI);function QI(g){return Array.prototype.slice.call(g,0)}function HI(g,e,t){for(var A=[],C=[],i=0;i<g.length;){var I=e?g[i][e]:g[i];GI(C,I)<0&&A.push(g[i]),C[i]=I,i++}return t&&(A=e?A.sort((function(g,t){return g[e]>t[e]})):A.sort()),A}var KI={touchstart:1,touchmove:2,touchend:4,touchcancel:8},XI=function(g){function e(){var t;return e.prototype.evTarget="touchstart touchmove touchend touchcancel",(t=g.apply(this,arguments)||this).targetIds={},t}return iI(e,g),e.prototype.handler=function(g){var e=KI[g.type],t=JI.call(this,g,e);t&&this.callback(this.manager,e,{pointers:t[0],changedPointers:t[1],pointerType:"touch",srcEvent:g})},e}(LI);function JI(g,e){var t,A,C=QI(g.touches),i=this.targetIds;if(3&e&&1===C.length)return i[C[0].identifier]=!0,[C,C];var I=QI(g.changedTouches),n=[],o=this.target;if(A=C.filter((function(g){return OI(g.target,o)})),1===e)for(t=0;t<A.length;)i[A[t].identifier]=!0,t++;for(t=0;t<I.length;)i[I[t].identifier]&&n.push(I[t]),12&e&&delete i[I[t].identifier],t++;return n.length?[HI(A.concat(n),"identifier",!0),n]:void 0}var qI={mousedown:1,mousemove:2,mouseup:4},$I=function(g){function e(){var t,A=e.prototype;return A.evEl="mousedown",A.evWin="mousemove mouseup",(t=g.apply(this,arguments)||this).pressed=!1,t}return iI(e,g),e.prototype.handler=function(g){var e=qI[g.type];1&e&&0===g.button&&(this.pressed=!0),2&e&&1!==g.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[g],changedPointers:[g],pointerType:"mouse",srcEvent:g}))},e}(LI);function gn(g){var e=g.changedPointers[0];if(e.identifier===this.primaryTouch){var t={x:e.clientX,y:e.clientY},A=this.lastTouches;this.lastTouches.push(t);setTimeout((function(){var g=A.indexOf(t);g>-1&&A.splice(g,1)}),2500)}}function en(g,e){1&g?(this.primaryTouch=e.changedPointers[0].identifier,gn.call(this,e)):12&g&&gn.call(this,e)}function tn(g){for(var e=g.srcEvent.clientX,t=g.srcEvent.clientY,A=0;A<this.lastTouches.length;A++){var C=this.lastTouches[A],i=Math.abs(e-C.x),I=Math.abs(t-C.y);if(i<=25&&I<=25)return!0}return!1}var An=function(){return function(g){function e(e,t){var A;return(A=g.call(this,e,t)||this).handler=function(g,e,t){var C="touch"===t.pointerType,i="mouse"===t.pointerType;if(!(i&&t.sourceCapabilities&&t.sourceCapabilities.firesTouchEvents)){if(C)en.call(II(II(A)),e,t);else if(i&&tn.call(II(II(A)),t))return;A.callback(g,e,t)}},A.touch=new XI(A.manager,A.handler),A.mouse=new $I(A.manager,A.handler),A.primaryTouch=null,A.lastTouches=[],A}return iI(e,g),e.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},e}(LI)}();function Cn(g,e,t){return!!Array.isArray(g)&&(wI(g,t[e],t),!0)}var In=1;function nn(g,e){var t=e.manager;return t?t.get(g):g}function on(g){return 16&g?"cancel":8&g?"end":4&g?"move":2&g?"start":""}var rn=function(){function g(g){void 0===g&&(g={}),this.options=CI({enable:!0},g),this.id=In++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=g.prototype;return e.set=function(g){return oI(this.options,g),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(g){if(Cn(g,"recognizeWith",this))return this;var e=this.simultaneous;return e[(g=nn(g,this)).id]||(e[g.id]=g,g.recognizeWith(this)),this},e.dropRecognizeWith=function(g){return Cn(g,"dropRecognizeWith",this)||(g=nn(g,this),delete this.simultaneous[g.id]),this},e.requireFailure=function(g){if(Cn(g,"requireFailure",this))return this;var e=this.requireFail;return-1===GI(e,g=nn(g,this))&&(e.push(g),g.requireFailure(this)),this},e.dropRequireFailure=function(g){if(Cn(g,"dropRequireFailure",this))return this;g=nn(g,this);var e=GI(this.requireFail,g);return e>-1&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return this.requireFail.length>0},e.canRecognizeWith=function(g){return!!this.simultaneous[g.id]},e.emit=function(g){var e=this,t=this.state;function A(t){e.manager.emit(t,g)}t<8&&A(e.options.event+on(t)),A(e.options.event),g.additionalEvent&&A(g.additionalEvent),t>=8&&A(e.options.event+on(t))},e.tryEmit=function(g){if(this.canEmit())return this.emit(g);this.state=32},e.canEmit=function(){for(var g=0;g<this.requireFail.length;){if(!(33&this.requireFail[g].state))return!1;g++}return!0},e.recognize=function(g){var e=oI({},g);if(!kI(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(g){},e.getTouchAction=function(){},e.reset=function(){},g}(),sn=function(g){function e(e){var t;return void 0===e&&(e={}),(t=g.call(this,CI({event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},e))||this).pTime=!1,t.pCenter=!1,t._timer=null,t._input=null,t.count=0,t}iI(e,g);var t=e.prototype;return t.getTouchAction=function(){return["manipulation"]},t.process=function(g){var e=this,t=this.options,A=g.pointers.length===t.pointers,C=g.distance<t.threshold,i=g.deltaTime<t.time;if(this.reset(),1&g.eventType&&0===this.count)return this.failTimeout();if(C&&i&&A){if(4!==g.eventType)return this.failTimeout();var I=!this.pTime||g.timeStamp-this.pTime<t.interval,n=!this.pCenter||NI(this.pCenter,g.center)<t.posThreshold;if(this.pTime=g.timeStamp,this.pCenter=g.center,n&&I?this.count+=1:this.count=1,this._input=g,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=setTimeout((function(){e.state=8,e.tryEmit()}),t.interval),2):8}return 32},t.failTimeout=function(){var g=this;return this._timer=setTimeout((function(){g.state=32}),this.options.interval),32},t.reset=function(){clearTimeout(this._timer)},t.emit=function(){8===this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))},e}(rn),an=function(g){function e(e){return void 0===e&&(e={}),g.call(this,CI({pointers:1},e))||this}iI(e,g);var t=e.prototype;return t.attrTest=function(g){var e=this.options.pointers;return 0===e||g.pointers.length===e},t.process=function(g){var e=this.state,t=g.eventType,A=6&e,C=this.attrTest(g);return A&&(8&t||!C)?16|e:A||C?4&t?8|e:2&e?4|e:2:32},e}(rn);function ln(g){return 16===g?"down":8===g?"up":2===g?"left":4===g?"right":""}var dn=function(g){function e(e){var t;return void 0===e&&(e={}),(t=g.call(this,CI({event:"pan",threshold:10,pointers:1,direction:30},e))||this).pX=null,t.pY=null,t}iI(e,g);var t=e.prototype;return t.getTouchAction=function(){var g=this.options.direction,e=[];return 6&g&&e.push("pan-y"),24&g&&e.push("pan-x"),e},t.directionTest=function(g){var e=this.options,t=!0,A=g.distance,C=g.direction,i=g.deltaX,I=g.deltaY;return C&e.direction||(6&e.direction?(C=0===i?1:i<0?2:4,t=i!==this.pX,A=Math.abs(g.deltaX)):(C=0===I?1:I<0?8:16,t=I!==this.pY,A=Math.abs(g.deltaY))),g.direction=C,t&&A>e.threshold&&C&e.direction},t.attrTest=function(g){return an.prototype.attrTest.call(this,g)&&(2&this.state||!(2&this.state)&&this.directionTest(g))},t.emit=function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=ln(e.direction);t&&(e.additionalEvent=this.options.event+t),g.prototype.emit.call(this,e)},e}(an),hn=function(g){function e(e){return void 0===e&&(e={}),g.call(this,CI({event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},e))||this}iI(e,g);var t=e.prototype;return t.getTouchAction=function(){return dn.prototype.getTouchAction.call(this)},t.attrTest=function(e){var t,A=this.options.direction;return 30&A?t=e.overallVelocity:6&A?t=e.overallVelocityX:24&A&&(t=e.overallVelocityY),g.prototype.attrTest.call(this,e)&&A&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers===this.options.pointers&&lI(t)>this.options.velocity&&4&e.eventType},t.emit=function(g){var e=ln(g.offsetDirection);e&&this.manager.emit(this.options.event+e,g),this.manager.emit(this.options.event,g)},e}(an),cn=function(g){function e(e){return void 0===e&&(e={}),g.call(this,CI({event:"pinch",threshold:0,pointers:2},e))||this}iI(e,g);var t=e.prototype;return t.getTouchAction=function(){return["none"]},t.attrTest=function(e){return g.prototype.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},t.emit=function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}g.prototype.emit.call(this,e)},e}(an),un=function(g){function e(e){return void 0===e&&(e={}),g.call(this,CI({event:"rotate",threshold:0,pointers:2},e))||this}iI(e,g);var t=e.prototype;return t.getTouchAction=function(){return["none"]},t.attrTest=function(e){return g.prototype.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)},e}(an),pn=function(g){function e(e){var t;return void 0===e&&(e={}),(t=g.call(this,CI({event:"press",pointers:1,time:251,threshold:9},e))||this)._timer=null,t._input=null,t}iI(e,g);var t=e.prototype;return t.getTouchAction=function(){return["auto"]},t.process=function(g){var e=this,t=this.options,A=g.pointers.length===t.pointers,C=g.distance<t.threshold,i=g.deltaTime>t.time;if(this._input=g,!C||!A||12&g.eventType&&!i)this.reset();else if(1&g.eventType)this.reset(),this._timer=setTimeout((function(){e.state=8,e.tryEmit()}),t.time);else if(4&g.eventType)return 8;return 32},t.reset=function(){clearTimeout(this._timer)},t.emit=function(g){8===this.state&&(g&&4&g.eventType?this.manager.emit(this.options.event+"up",g):(this._input.timeStamp=dI(),this.manager.emit(this.options.event,this._input)))},e}(rn),fn={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},vn=[[un,{enable:!1}],[cn,{enable:!1},["rotate"]],[hn,{direction:6}],[dn,{direction:6},["swipe"]],[sn],[sn,{event:"doubletap",taps:2},["tap"]],[pn]];function mn(g,e){var t,A=g.element;A.style&&(wI(g.options.cssProps,(function(C,i){t=hI(A.style,i),e?(g.oldCssProps[t]=A.style[t],A.style[t]=C):A.style[t]=g.oldCssProps[t]||""})),e||(g.oldCssProps={}))}var yn=function(){function g(g,e){var t,A=this;this.options=oI({},fn,e||{}),this.options.inputTarget=this.options.inputTarget||g,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=g,this.input=new((t=this).options.inputClass||(vI?UI:mI?XI:fI?An:$I))(t,BI),this.touchAction=new EI(this,this.options.touchAction),mn(this,!0),wI(this.options.recognizers,(function(g){var e=A.add(new g[0](g[1]));g[2]&&e.recognizeWith(g[2]),g[3]&&e.requireFailure(g[3])}),this)}var e=g.prototype;return e.set=function(g){return oI(this.options,g),g.touchAction&&this.touchAction.update(),g.inputTarget&&(this.input.destroy(),this.input.target=g.inputTarget,this.input.init()),this},e.stop=function(g){this.session.stopped=g?2:1},e.recognize=function(g){var e=this.session;if(!e.stopped){var t;this.touchAction.preventDefaults(g);var A=this.recognizers,C=e.curRecognizer;(!C||C&&8&C.state)&&(e.curRecognizer=null,C=null);for(var i=0;i<A.length;)t=A[i],2===e.stopped||C&&t!==C&&!t.canRecognizeWith(C)?t.reset():t.recognize(g),!C&&14&t.state&&(e.curRecognizer=t,C=t),i++}},e.get=function(g){if(g instanceof rn)return g;for(var e=this.recognizers,t=0;t<e.length;t++)if(e[t].options.event===g)return e[t];return null},e.add=function(g){if(Cn(g,"add",this))return this;var e=this.get(g.options.event);return e&&this.remove(e),this.recognizers.push(g),g.manager=this,this.touchAction.update(),g},e.remove=function(g){if(Cn(g,"remove",this))return this;var e=this.get(g);if(g){var t=this.recognizers,A=GI(t,e);-1!==A&&(t.splice(A,1),this.touchAction.update())}return this},e.on=function(g,e){if(void 0===g||void 0===e)return this;var t=this.handlers;return wI(zI(g),(function(g){t[g]=t[g]||[],t[g].push(e)})),this},e.off=function(g,e){if(void 0===g)return this;var t=this.handlers;return wI(zI(g),(function(g){e?t[g]&&t[g].splice(GI(t[g],e),1):delete t[g]})),this},e.emit=function(g,e){this.options.domEvents&&function(g,e){var t=document.createEvent("Event");t.initEvent(g,!0,!0),t.gesture=e,e.target.dispatchEvent(t)}(g,e);var t=this.handlers[g]&&this.handlers[g].slice();if(t&&t.length){e.type=g,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var A=0;A<t.length;)t[A](e),A++}},e.destroy=function(){this.element&&mn(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},g}(),bn={touchstart:1,touchmove:2,touchend:4,touchcancel:8},wn=function(g){function e(){var t,A=e.prototype;return A.evTarget="touchstart",A.evWin="touchstart touchmove touchend touchcancel",(t=g.apply(this,arguments)||this).started=!1,t}return iI(e,g),e.prototype.handler=function(g){var e=bn[g.type];if(1===e&&(this.started=!0),this.started){var t=kn.call(this,g,e);12&e&&t[0].length-t[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:t[0],changedPointers:t[1],pointerType:"touch",srcEvent:g})}},e}(LI);function kn(g,e){var t=QI(g.touches),A=QI(g.changedTouches);return 12&e&&(t=HI(t.concat(A),"identifier",!0)),[t,A]}function xn(g,e,t){var A="DEPRECATED METHOD: "+e+"\n"+t+" AT \n";return function(){var e=new Error("get-stack-trace"),t=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",C=window.console&&(window.console.warn||window.console.log);return C&&C.call(window.console,A,t),g.apply(this,arguments)}}var En=xn((function(g,e,t){for(var A=Object.keys(e),C=0;C<A.length;)(!t||t&&void 0===g[A[C]])&&(g[A[C]]=e[A[C]]),C++;return g}),"extend","Use `assign`."),On=xn((function(g,e){return En(g,e,!0)}),"merge","Use `assign`.");function Tn(g,e,t){var A,C=e.prototype;(A=g.prototype=Object.create(C)).constructor=g,A._super=C,t&&oI(A,t)}function Dn(g,e){return function(){return g.apply(e,arguments)}}var Nn=function(){var g=function(g,e){return void 0===e&&(e={}),new yn(g,CI({recognizers:vn.concat()},e))};return g.VERSION="2.0.17-rc",g.DIRECTION_ALL=30,g.DIRECTION_DOWN=16,g.DIRECTION_LEFT=2,g.DIRECTION_RIGHT=4,g.DIRECTION_UP=8,g.DIRECTION_HORIZONTAL=6,g.DIRECTION_VERTICAL=24,g.DIRECTION_NONE=1,g.DIRECTION_DOWN=16,g.INPUT_START=1,g.INPUT_MOVE=2,g.INPUT_END=4,g.INPUT_CANCEL=8,g.STATE_POSSIBLE=1,g.STATE_BEGAN=2,g.STATE_CHANGED=4,g.STATE_ENDED=8,g.STATE_RECOGNIZED=8,g.STATE_CANCELLED=16,g.STATE_FAILED=32,g.Manager=yn,g.Input=LI,g.TouchAction=EI,g.TouchInput=XI,g.MouseInput=$I,g.PointerEventInput=UI,g.TouchMouseInput=An,g.SingleTouchInput=wn,g.Recognizer=rn,g.AttrRecognizer=an,g.Tap=sn,g.Pan=dn,g.Swipe=hn,g.Pinch=cn,g.Rotate=un,g.Press=pn,g.on=FI,g.off=ZI,g.each=wI,g.merge=On,g.extend=En,g.bindFn=Dn,g.assign=oI,g.inherit=Tn,g.bindFn=Dn,g.prefixed=hI,g.toArray=QI,g.inArray=GI,g.uniqueArray=HI,g.splitStr=zI,g.boolOrFn=kI,g.hasParent=OI,g.addEventListeners=FI,g.removeEventListeners=ZI,g.defaults=oI({},fn,{preset:vn}),g}();function Rn(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return Pn(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return Pn(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function Pn(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}var Sn=bC("DELETE");function Mn(){var g=Bn.apply(void 0,arguments);return Fn(g),g}function Bn(){for(var g=arguments.length,e=new Array(g),t=0;t<g;t++)e[t]=arguments[t];if(e.length<2)return e[0];var A;if(e.length>2)return Bn.apply(void 0,xC(A=[Mn(e[0],e[1])]).call(A,yC(EC(e).call(e,2))));var C,i=e[0],I=e[1],n=Rn(OC(I));try{for(n.s();!(C=n.n()).done;){var o=C.value;Object.prototype.propertyIsEnumerable.call(I,o)&&(I[o]===Sn?delete i[o]:null===i[o]||null===I[o]||"object"!==mC(i[o])||"object"!==mC(I[o])||TC(i[o])||TC(I[o])?i[o]=zn(I[o]):i[o]=Bn(i[o],I[o]))}}catch(g){n.e(g)}finally{n.f()}return i}function zn(g){return TC(g)?SC(g).call(g,(function(g){return zn(g)})):"object"===mC(g)&&null!==g?Bn({},g):g}function Fn(g){for(var e=0,t=BC(g);e<t.length;e++){var A=t[e];g[A]===Sn?delete g[A]:"object"===mC(g[A])&&null!==g[A]&&Fn(g[A])}}function Zn(){for(var g=arguments.length,e=new Array(g),t=0;t<g;t++)e[t]=arguments[t];return jn(e.length?e:[zC()])}function jn(g){var e=pC(function(){for(var g=Ln(),e=g(" "),t=g(" "),A=g(" "),C=0;C<arguments.length;C++)(e-=g(C<0||arguments.length<=C?void 0:arguments[C]))<0&&(e+=1),(t-=g(C<0||arguments.length<=C?void 0:arguments[C]))<0&&(t+=1),(A-=g(C<0||arguments.length<=C?void 0:arguments[C]))<0&&(A+=1);return[e,t,A]}(g),3),t=e[0],A=e[1],C=e[2],i=1,I=function(){var g=2091639*t+2.3283064365386963e-10*i;return t=A,A=C,C=g-(i=0|g)};return I.uint32=function(){return 4294967296*I()},I.fract53=function(){return I()+11102230246251565e-32*(2097152*I()|0)},I.algorithm="Alea",I.seed=g,I.version="0.9",I}function Ln(){var g=4022871197;return function(e){for(var t=e.toString(),A=0;A<t.length;A++){var C=.02519603282416938*(g+=t.charCodeAt(A));C-=g=C>>>0,g=(C*=g)>>>0,g+=4294967296*(C-=g)}return 2.3283064365386963e-10*(g>>>0)}}var Gn="undefined"!=typeof window?window.Hammer||Nn:function(){return{on:g=function(){},off:g,destroy:g,emit:g,get:function(){return{set:g}}};var g};function Vn(g){var e,t=this;this._cleanupQueue=[],this.active=!1,this._dom={container:g,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push((function(){t._dom.overlay.parentNode.removeChild(t._dom.overlay)}));var A=Gn(this._dom.overlay);A.on("tap",jg(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push((function(){A.destroy()}));var C=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];YC(C).call(C,(function(g){A.on(g,(function(g){g.srcEvent.stopPropagation()}))})),document&&document.body&&(this._onClick=function(e){(function(g,e){for(;g;){if(g===e)return!0;g=g.parentNode}return!1})(e.target,g)||t.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push((function(){document.body.removeEventListener("click",t._onClick)}))),this._escListener=function(g){("key"in g?"Escape"===g.key:27===g.keyCode)&&t.deactivate()}}Qg(Vn.prototype),Vn.current=null,Vn.prototype.destroy=function(){var g,e;this.deactivate();var t,A=Rn(HC(g=gi(e=this._cleanupQueue).call(e,0)).call(g));try{for(A.s();!(t=A.n()).done;){(0,t.value)()}}catch(g){A.e(g)}finally{A.f()}},Vn.prototype.activate=function(){Vn.current&&Vn.current.deactivate(),Vn.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)},Vn.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")},Vn.prototype._onTapOverlay=function(g){this.activate(),g.srcEvent.stopPropagation()};var Yn=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Wn=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,_n=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,Un=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Qn(g){if(g)for(;!0===g.hasChildNodes();){var e=g.firstChild;e&&(Qn(e),g.removeChild(e))}}function Hn(g){return g instanceof String||"string"==typeof g}function Kn(g){return"object"===mC(g)&&null!==g}function Xn(g,e,t,A){var C=!1;!0===A&&(C=null===e[t]&&void 0!==g[t]),C?delete g[t]:g[t]=e[t]}function Jn(g,e){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var A in g)if(void 0!==e[A])if(null===e[A]||"object"!==mC(e[A]))Xn(g,e,A,t);else{var C=g[A],i=e[A];Kn(C)&&Kn(i)&&Jn(C,i,t)}}function qn(g,e,t){var A=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(TC(t))throw new TypeError("Arrays are not supported by deepExtend");for(var C=0;C<g.length;C++){var i=g[C];if(Object.prototype.hasOwnProperty.call(t,i))if(t[i]&&t[i].constructor===Object)void 0===e[i]&&(e[i]={}),e[i].constructor===Object?go(e[i],t[i],!1,A):Xn(e,t,i,A);else{if(TC(t[i]))throw new TypeError("Arrays are not supported by deepExtend");Xn(e,t,i,A)}}return e}function $n(g,e,t){var A=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(TC(t))throw new TypeError("Arrays are not supported by deepExtend");for(var C in t)if(Object.prototype.hasOwnProperty.call(t,C)&&!ri(g).call(g,C))if(t[C]&&t[C].constructor===Object)void 0===e[C]&&(e[C]={}),e[C].constructor===Object?go(e[C],t[C]):Xn(e,t,C,A);else if(TC(t[C])){e[C]=[];for(var i=0;i<t[C].length;i++)e[C].push(t[C][i])}else Xn(e,t,C,A);return e}function go(g,e){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var C in e)if(Object.prototype.hasOwnProperty.call(e,C)||!0===t)if("object"===mC(e[C])&&null!==e[C]&&li(e[C])===Object.prototype)void 0===g[C]?g[C]=go({},e[C],t):"object"===mC(g[C])&&null!==g[C]&&li(g[C])===Object.prototype?go(g[C],e[C],t):Xn(g,e,C,A);else if(TC(e[C])){var i;g[C]=EC(i=e[C]).call(i)}else Xn(g,e,C,A);return g}function eo(g,e){var t;return xC(t=[]).call(t,yC(g),[e])}function to(g){return EC(g).call(g)}function Ao(g){return g.getBoundingClientRect().top}function Co(g,e){if(TC(g))for(var t=g.length,A=0;A<t;A++)e(g[A],A,g);else for(var C in g)Object.prototype.hasOwnProperty.call(g,C)&&e(g[C],C,g)}function io(g){var e;switch(g.length){case 3:case 4:return(e=Wn.exec(g))?{r:Ri(e[1]+e[1],16),g:Ri(e[2]+e[2],16),b:Ri(e[3]+e[3],16)}:null;case 6:case 7:return(e=Yn.exec(g))?{r:Ri(e[1],16),g:Ri(e[2],16),b:Ri(e[3],16)}:null;default:return null}}function Io(g,e){if(ri(g).call(g,"rgba"))return g;if(ri(g).call(g,"rgb")){var t=g.substr(ji(g).call(g,"(")+1).replace(")","").split(",");return"rgba("+t[0]+","+t[1]+","+t[2]+","+e+")"}var A=io(g);return null==A?g:"rgba("+A.r+","+A.g+","+A.b+","+e+")"}function no(g,e,t){var A;return"#"+EC(A=((1<<24)+(g<<16)+(e<<8)+t).toString(16)).call(A,1)}function oo(g,e){if(Hn(g)){var t=g;if(ho(t)){var A,C=SC(A=t.substr(4).substr(0,t.length-5).split(",")).call(A,(function(g){return Ri(g)}));t=no(C[0],C[1],C[2])}if(!0===lo(t)){var i=function(g){var e=io(g);if(!e)throw new TypeError("'".concat(g,"' is not a valid color."));return ro(e.r,e.g,e.b)}(t),I={h:i.h,s:.8*i.s,v:Math.min(1,1.02*i.v)},n={h:i.h,s:Math.min(1,1.25*i.s),v:.8*i.v},o=ao(n.h,n.s,n.v),r=ao(I.h,I.s,I.v);return{background:t,border:o,highlight:{background:r,border:o},hover:{background:r,border:o}}}return{background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}return e?{background:g.background||e.background,border:g.border||e.border,highlight:Hn(g.highlight)?{border:g.highlight,background:g.highlight}:{background:g.highlight&&g.highlight.background||e.highlight.background,border:g.highlight&&g.highlight.border||e.highlight.border},hover:Hn(g.hover)?{border:g.hover,background:g.hover}:{border:g.hover&&g.hover.border||e.hover.border,background:g.hover&&g.hover.background||e.hover.background}}:{background:g.background||void 0,border:g.border||void 0,highlight:Hn(g.highlight)?{border:g.highlight,background:g.highlight}:{background:g.highlight&&g.highlight.background||void 0,border:g.highlight&&g.highlight.border||void 0},hover:Hn(g.hover)?{border:g.hover,background:g.hover}:{border:g.hover&&g.hover.border||void 0,background:g.hover&&g.hover.background||void 0}}}function ro(g,e,t){g/=255,e/=255,t/=255;var A=Math.min(g,Math.min(e,t)),C=Math.max(g,Math.max(e,t));return A===C?{h:0,s:0,v:A}:{h:60*((g===A?3:t===A?1:5)-(g===A?e-t:t===A?g-e:t-g)/(C-A))/360,s:(C-A)/C,v:C}}function so(g,e,t){var A,C,i,I=Math.floor(6*g),n=6*g-I,o=t*(1-e),r=t*(1-n*e),s=t*(1-(1-n)*e);switch(I%6){case 0:A=t,C=s,i=o;break;case 1:A=r,C=t,i=o;break;case 2:A=o,C=t,i=s;break;case 3:A=o,C=r,i=t;break;case 4:A=s,C=o,i=t;break;case 5:A=t,C=o,i=r}return{r:Math.floor(255*A),g:Math.floor(255*C),b:Math.floor(255*i)}}function ao(g,e,t){var A=so(g,e,t);return no(A.r,A.g,A.b)}function lo(g){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(g)}function ho(g){return _n.test(g)}function co(g){return Un.test(g)}function uo(g){if(null===g||"object"!==mC(g))return null;if(g instanceof Element)return g;var e=Yi(g);for(var t in g)Object.prototype.hasOwnProperty.call(g,t)&&"object"==mC(g[t])&&(e[t]=uo(g[t]));return e}function po(g,e,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},C=function(g){return null!=g},i=function(g){return null!==g&&"object"===mC(g)},I=function(g){for(var e in g)if(Object.prototype.hasOwnProperty.call(g,e))return!1;return!0};if(!i(g))throw new Error("Parameter mergeTarget must be an object");if(!i(e))throw new Error("Parameter options must be an object");if(!C(t))throw new Error("Parameter option must have a value");if(!i(A))throw new Error("Parameter globalOptions must be an object");var n=function(g,e,t){i(g[t])||(g[t]={});var A=e[t],C=g[t];for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&(C[I]=A[I])},o=e[t],r=i(A)&&!I(A),s=r?A[t]:void 0,a=s?s.enabled:void 0;if(void 0!==o){if("boolean"==typeof o)return i(g[t])||(g[t]={}),void(g[t].enabled=o);if(null===o&&!i(g[t])){if(!C(s))return;g[t]=Yi(s)}if(i(o)){var l=!0;void 0!==o.enabled?l=o.enabled:void 0!==a&&(l=s.enabled),n(g,e,t),g[t].enabled=l}}}var fo={linear:function(g){return g},easeInQuad:function(g){return g*g},easeOutQuad:function(g){return g*(2-g)},easeInOutQuad:function(g){return g<.5?2*g*g:(4-2*g)*g-1},easeInCubic:function(g){return g*g*g},easeOutCubic:function(g){return--g*g*g+1},easeInOutCubic:function(g){return g<.5?4*g*g*g:(g-1)*(2*g-2)*(2*g-2)+1},easeInQuart:function(g){return g*g*g*g},easeOutQuart:function(g){return 1- --g*g*g*g},easeInOutQuart:function(g){return g<.5?8*g*g*g*g:1-8*--g*g*g*g},easeInQuint:function(g){return g*g*g*g*g},easeOutQuint:function(g){return 1+--g*g*g*g*g},easeInOutQuint:function(g){return g<.5?16*g*g*g*g*g:1+16*--g*g*g*g*g}};function vo(g,e){var t;TC(e)||(e=[e]);var A,C=Rn(g);try{for(C.s();!(A=C.n()).done;){var i=A.value;if(i){t=i[e[0]];for(var I=1;I<e.length;I++)t&&(t=t[e[I]]);if(void 0!==t)break}}}catch(g){C.e(g)}finally{C.f()}return t}var mo={black:"#000000",navy:"#000080",darkblue:"#00008B",mediumblue:"#0000CD",blue:"#0000FF",darkgreen:"#006400",green:"#008000",teal:"#008080",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",lime:"#00FF00",springgreen:"#00FF7F",aqua:"#00FFFF",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",mediumaquamarine:"#66CDAA",dimgray:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",lightslategray:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",maroon:"#800000",purple:"#800080",olive:"#808000",gray:"#808080",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370D8",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",silver:"#C0C0C0",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgrey:"#D3D3D3",palevioletred:"#D87093",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",red:"#FF0000",fuchsia:"#FF00FF",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",yellow:"#FFFF00",lightyellow:"#FFFFE0",ivory:"#FFFFF0",white:"#FFFFFF"},yo=function(){function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;YA(this,g),this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return UA(g,[{key:"insertTo",value:function(g){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=g,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(g){if("function"!=typeof g)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=g}},{key:"setCloseCallback",value:function(g){if("function"!=typeof g)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=g}},{key:"_isColorString",value:function(g){if("string"==typeof g)return mo[g]}},{key:"setColor",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==g){var t,A=this._isColorString(g);if(void 0!==A&&(g=A),!0===Hn(g)){if(!0===ho(g)){var C=g.substr(4).substr(0,g.length-5).split(",");t={r:C[0],g:C[1],b:C[2],a:1}}else if(!0===co(g)){var i=g.substr(5).substr(0,g.length-6).split(",");t={r:i[0],g:i[1],b:i[2],a:i[3]}}else if(!0===lo(g)){var I=io(g);t={r:I.r,g:I.g,b:I.b,a:1}}}else if(g instanceof Object&&void 0!==g.r&&void 0!==g.g&&void 0!==g.b){var n=void 0!==g.a?g.a:"1.0";t={r:g.r,g:g.g,b:g.b,a:n}}if(void 0===t)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+Xi(g));this._setColor(t,e)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var g=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&(this.previousColor=Rg({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",gI((function(){void 0!==g.closeCallback&&(g.closeCallback(),g.closeCallback=void 0)}),0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!0===e&&(this.initialColor=Rg({},g)),this.color=g;var t=ro(g.r,g.g,g.b),A=2*Math.PI,C=this.r*t.s,i=this.centerCoordinates.x+C*Math.sin(A*t.h),I=this.centerCoordinates.y+C*Math.cos(A*t.h);this.colorPickerSelector.style.left=i-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=I-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(g)}},{key:"_setOpacity",value:function(g){this.color.a=g/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(g){var e=ro(this.color.r,this.color.g,this.color.b);e.v=g/100;var t=so(e.h,e.s,e.v);t.a=this.color.a,this.color=t,this._updatePicker()}},{key:"_updatePicker",value:function(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,e=ro(g.r,g.g,g.b),t=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)),t.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var A=this.colorPickerCanvas.clientWidth,C=this.colorPickerCanvas.clientHeight;t.clearRect(0,0,A,C),t.putImageData(this.hueCircle,0,0),t.fillStyle="rgba(0,0,0,"+(1-e.v)+")",t.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),AI(t).call(t),this.brightnessRange.value=100*e.v,this.opacityRange.value=100*g.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var g,e,t,A;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var C=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(C.webkitBackingStorePixelRatio||C.mozBackingStorePixelRatio||C.msBackingStorePixelRatio||C.oBackingStorePixelRatio||C.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var i=document.createElement("DIV");i.style.color="red",i.style.fontWeight="bold",i.style.padding="10px",i.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(i)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(g){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(g){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var I=this;this.opacityRange.onchange=function(){I._setOpacity(this.value)},this.opacityRange.oninput=function(){I._setOpacity(this.value)},this.brightnessRange.onchange=function(){I._setBrightness(this.value)},this.brightnessRange.oninput=function(){I._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=jg(g=this._hide).call(g,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=jg(e=this._apply).call(e,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=jg(t=this._save).call(t,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=jg(A=this._loadLast).call(A,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var g=this;this.drag={},this.pinch={},this.hammer=new Gn(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",(function(e){e.isFirst&&g._moveSelector(e)})),this.hammer.on("tap",(function(e){g._moveSelector(e)})),this.hammer.on("panstart",(function(e){g._moveSelector(e)})),this.hammer.on("panmove",(function(e){g._moveSelector(e)})),this.hammer.on("panend",(function(e){g._moveSelector(e)}))}},{key:"_generateHueCircle",value:function(){if(!1===this.generated){var g=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(g.webkitBackingStorePixelRatio||g.mozBackingStorePixelRatio||g.msBackingStorePixelRatio||g.oBackingStorePixelRatio||g.backingStorePixelRatio||1)),g.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var e,t,A,C,i=this.colorPickerCanvas.clientWidth,I=this.colorPickerCanvas.clientHeight;g.clearRect(0,0,i,I),this.centerCoordinates={x:.5*i,y:.5*I},this.r=.49*i;var n,o=2*Math.PI/360,r=1/this.r;for(A=0;A<360;A++)for(C=0;C<this.r;C++)e=this.centerCoordinates.x+C*Math.sin(o*A),t=this.centerCoordinates.y+C*Math.cos(o*A),n=so(.002777777777777778*A,C*r,1),g.fillStyle="rgb("+n.r+","+n.g+","+n.b+")",g.fillRect(e-.5,t-.5,2,2);g.strokeStyle="rgba(0,0,0,1)",g.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),g.stroke(),this.hueCircle=g.getImageData(0,0,i,I)}this.generated=!0}},{key:"_moveSelector",value:function(g){var e=this.colorPickerDiv.getBoundingClientRect(),t=g.center.x-e.left,A=g.center.y-e.top,C=.5*this.colorPickerDiv.clientHeight,i=.5*this.colorPickerDiv.clientWidth,I=t-i,n=A-C,o=Math.atan2(I,n),r=.98*Math.min(Math.sqrt(I*I+n*n),i),s=Math.cos(o)*r+C,a=Math.sin(o)*r+i;this.colorPickerSelector.style.top=s-.5*this.colorPickerSelector.clientHeight+"px",this.colorPickerSelector.style.left=a-.5*this.colorPickerSelector.clientWidth+"px";var l=o/(2*Math.PI);l=l<0?l+1:l;var d=r/this.r,h=ro(this.color.r,this.color.g,this.color.b);h.h=l,h.s=d;var c=so(h.h,h.s,h.v);c.a=this.color.a,this.color=c,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}}]),g}();function bo(){for(var g=arguments.length,e=new Array(g),t=0;t<g;t++)e[t]=arguments[t];if(e.length<1)throw new TypeError("Invalid arguments.");if(1===e.length)return document.createTextNode(e[0]);var A=document.createElement(e[0]);return A.appendChild(bo.apply(void 0,yC(EC(e).call(e,1)))),A}var wo,ko=!1,xo=Vn,Eo=function(){function g(e,t,A){var C=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){return!1};YA(this,g),this.parent=e,this.changedOptions=[],this.container=t,this.allowCreation=!1,this.hideOption=i,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Rg(this.options,this.defaultOptions),this.configureOptions=A,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new yo(C),this.wrapper=void 0}return UA(g,[{key:"setOptions",value:function(g){if(void 0!==g){this.popupHistory={},this._removePopup();var e=!0;if("string"==typeof g)this.options.filter=g;else if(TC(g))this.options.filter=g.join();else if("object"===mC(g)){if(null==g)throw new TypeError("options cannot be null");void 0!==g.container&&(this.options.container=g.container),void 0!==pi(g)&&(this.options.filter=pi(g)),void 0!==g.showButton&&(this.options.showButton=g.showButton),void 0!==g.enabled&&(e=g.enabled)}else"boolean"==typeof g?(this.options.filter=!0,e=g):"function"==typeof g&&(this.options.filter=g,e=!0);!1===pi(this.options)&&(e=!1),this.options.enabled=e}this._clean()}},{key:"setModuleOptions",value:function(g){this.moduleOptions=g,!0===this.options.enabled&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var g=pi(this.options),e=0,t=!1;for(var A in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,A)&&(this.allowCreation=!1,t=!1,"function"==typeof g?t=(t=g(A,[]))||this._handleObject(this.configureOptions[A],[A],!0):!0!==g&&-1===ji(g).call(g,A)||(t=!0),!1!==t&&(this.allowCreation=!0,e>0&&this._makeItem([]),this._makeHeader(A),this._handleObject(this.configureOptions[A],[A])),e++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var g=0;g<this.domElements.length;g++)this.wrapper.appendChild(this.domElements[g]);this._showPopupIfNeeded()}},{key:"_clean",value:function(){for(var g=0;g<this.domElements.length;g++)this.wrapper.removeChild(this.domElements[g]);void 0!==this.wrapper&&(this.container.removeChild(this.wrapper),this.wrapper=void 0),this.domElements=[],this._removePopup()}},{key:"_getValue",value:function(g){for(var e=this.moduleOptions,t=0;t<g.length;t++){if(void 0===e[g[t]]){e=void 0;break}e=e[g[t]]}return e}},{key:"_makeItem",value:function(g){if(!0===this.allowCreation){var e=document.createElement("div");e.className="vis-configuration vis-config-item vis-config-s"+g.length;for(var t=arguments.length,A=new Array(t>1?t-1:0),C=1;C<t;C++)A[C-1]=arguments[C];return YC(A).call(A,(function(g){e.appendChild(g)})),this.domElements.push(e),this.domElements.length}return 0}},{key:"_makeHeader",value:function(g){var e=document.createElement("div");e.className="vis-configuration vis-config-header",e.innerText=g,this._makeItem([],e)}},{key:"_makeLabel",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=document.createElement("div");if(A.className="vis-configuration vis-config-label vis-config-s"+e.length,!0===t){for(;A.firstChild;)A.removeChild(A.firstChild);A.appendChild(bo("i","b",g))}else A.innerText=g+":";return A}},{key:"_makeDropdown",value:function(g,e,t){var A=document.createElement("select");A.className="vis-configuration vis-config-select";var C=0;void 0!==e&&-1!==ji(g).call(g,e)&&(C=ji(g).call(g,e));for(var i=0;i<g.length;i++){var I=document.createElement("option");I.value=g[i],i===C&&(I.selected="selected"),I.innerText=g[i],A.appendChild(I)}var n=this;A.onchange=function(){n._update(this.value,t)};var o=this._makeLabel(t[t.length-1],t);this._makeItem(t,o,A)}},{key:"_makeRange",value:function(g,e,t){var A=g[0],C=g[1],i=g[2],I=g[3],n=document.createElement("input");n.className="vis-configuration vis-config-range";try{n.type="range",n.min=C,n.max=i}catch(g){}n.step=I;var o="",r=0;if(void 0!==e){var s=1.2;e<0&&e*s<C?(n.min=Math.ceil(e*s),r=n.min,o="range increased"):e/s<C&&(n.min=Math.ceil(e/s),r=n.min,o="range increased"),e*s>i&&1!==i&&(n.max=Math.ceil(e*s),r=n.max,o="range increased"),n.value=e}else n.value=A;var a=document.createElement("input");a.className="vis-configuration vis-config-rangeinput",a.value=n.value;var l=this;n.onchange=function(){a.value=this.value,l._update(Number(this.value),t)},n.oninput=function(){a.value=this.value};var d=this._makeLabel(t[t.length-1],t),h=this._makeItem(t,d,n,a);""!==o&&this.popupHistory[h]!==r&&(this.popupHistory[h]=r,this._setupPopup(o,h))}},{key:"_makeButton",value:function(){var g=this;if(!0===this.options.showButton){var e=document.createElement("div");e.className="vis-configuration vis-config-button",e.innerText="generate options",e.onclick=function(){g._printOptions()},e.onmouseover=function(){e.className="vis-configuration vis-config-button hover"},e.onmouseout=function(){e.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(e)}}},{key:"_setupPopup",value:function(g,e){var t=this;if(!0===this.initialized&&!0===this.allowCreation&&this.popupCounter<this.popupLimit){var A=document.createElement("div");A.id="vis-configuration-popup",A.className="vis-configuration-popup",A.innerText=g,A.onclick=function(){t._removePopup()},this.popupCounter+=1,this.popupDiv={html:A,index:e}}}},{key:"_removePopup",value:function(){void 0!==this.popupDiv.html&&(this.popupDiv.html.parentNode.removeChild(this.popupDiv.html),clearTimeout(this.popupDiv.hideTimeout),clearTimeout(this.popupDiv.deleteTimeout),this.popupDiv={})}},{key:"_showPopupIfNeeded",value:function(){var g=this;if(void 0!==this.popupDiv.html){var e=this.domElements[this.popupDiv.index].getBoundingClientRect();this.popupDiv.html.style.left=e.left+"px",this.popupDiv.html.style.top=e.top-30+"px",document.body.appendChild(this.popupDiv.html),this.popupDiv.hideTimeout=gI((function(){g.popupDiv.html.style.opacity=0}),1500),this.popupDiv.deleteTimeout=gI((function(){g._removePopup()}),1800)}}},{key:"_makeCheckbox",value:function(g,e,t){var A=document.createElement("input");A.type="checkbox",A.className="vis-configuration vis-config-checkbox",A.checked=g,void 0!==e&&(A.checked=e,e!==g&&("object"===mC(g)?e!==g.enabled&&this.changedOptions.push({path:t,value:e}):this.changedOptions.push({path:t,value:e})));var C=this;A.onchange=function(){C._update(this.checked,t)};var i=this._makeLabel(t[t.length-1],t);this._makeItem(t,i,A)}},{key:"_makeTextInput",value:function(g,e,t){var A=document.createElement("input");A.type="text",A.className="vis-configuration vis-config-text",A.value=e,e!==g&&this.changedOptions.push({path:t,value:e});var C=this;A.onchange=function(){C._update(this.value,t)};var i=this._makeLabel(t[t.length-1],t);this._makeItem(t,i,A)}},{key:"_makeColorField",value:function(g,e,t){var A=this,C=g[1],i=document.createElement("div");"none"!==(e=void 0===e?C:e)?(i.className="vis-configuration vis-config-colorBlock",i.style.backgroundColor=e):i.className="vis-configuration vis-config-colorBlock none",e=void 0===e?C:e,i.onclick=function(){A._showColorPicker(e,i,t)};var I=this._makeLabel(t[t.length-1],t);this._makeItem(t,I,i)}},{key:"_showColorPicker",value:function(g,e,t){var A=this;e.onclick=function(){},this.colorPicker.insertTo(e),this.colorPicker.show(),this.colorPicker.setColor(g),this.colorPicker.setUpdateCallback((function(g){var C="rgba("+g.r+","+g.g+","+g.b+","+g.a+")";e.style.backgroundColor=C,A._update(C,t)})),this.colorPicker.setCloseCallback((function(){e.onclick=function(){A._showColorPicker(g,e,t)}}))}},{key:"_handleObject",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=!1,C=pi(this.options),i=!1;for(var I in g)if(Object.prototype.hasOwnProperty.call(g,I)){A=!0;var n=g[I],o=eo(e,I);if("function"==typeof C&&!1===(A=C(I,e))&&!TC(n)&&"string"!=typeof n&&"boolean"!=typeof n&&n instanceof Object&&(this.allowCreation=!1,A=this._handleObject(n,o,!0),this.allowCreation=!1===t),!1!==A){i=!0;var r=this._getValue(o);if(TC(n))this._handleArray(n,r,o);else if("string"==typeof n)this._makeTextInput(n,r,o);else if("boolean"==typeof n)this._makeCheckbox(n,r,o);else if(n instanceof Object){if(!this.hideOption(e,I,this.moduleOptions))if(void 0!==n.enabled){var s=eo(o,"enabled"),a=this._getValue(s);if(!0===a){var l=this._makeLabel(I,o,!0);this._makeItem(o,l),i=this._handleObject(n,o)||i}else this._makeCheckbox(n,a,o)}else{var d=this._makeLabel(I,o,!0);this._makeItem(o,d),i=this._handleObject(n,o)||i}}else console.error("dont know how to handle",n,I,o)}}return i}},{key:"_handleArray",value:function(g,e,t){"string"==typeof g[0]&&"color"===g[0]?(this._makeColorField(g,e,t),g[1]!==e&&this.changedOptions.push({path:t,value:e})):"string"==typeof g[0]?(this._makeDropdown(g,e,t),g[0]!==e&&this.changedOptions.push({path:t,value:e})):"number"==typeof g[0]&&(this._makeRange(g,e,t),g[0]!==e&&this.changedOptions.push({path:t,value:Number(e)}))}},{key:"_update",value:function(g,e){var t=this._constructOptions(g,e);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",t),this.initialized=!0,this.parent.setOptions(t)}},{key:"_constructOptions",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},A=t;g="false"!==(g="true"===g||g)&&g;for(var C=0;C<e.length;C++)"global"!==e[C]&&(void 0===A[e[C]]&&(A[e[C]]={}),C!==e.length-1?A=A[e[C]]:A[e[C]]=g);return t}},{key:"_printOptions",value:function(){for(var g=this.getOptions();this.optionsContainer.firstChild;)this.optionsContainer.removeChild(this.optionsContainer.firstChild);this.optionsContainer.appendChild(bo("pre","const options = "+Xi(g,null,2)))}},{key:"getOptions",value:function(){for(var g={},e=0;e<this.changedOptions.length;e++)this._constructOptions(this.changedOptions[e].value,this.changedOptions[e].path,g);return g}}]),g}(),Oo=Gn,To=function(){function g(e,t){YA(this,g),this.container=e,this.overflowMethod=t||"cap",this.x=0,this.y=0,this.padding=5,this.hidden=!1,this.frame=document.createElement("div"),this.frame.className="vis-tooltip",this.container.appendChild(this.frame)}return UA(g,[{key:"setPosition",value:function(g,e){this.x=Ri(g),this.y=Ri(e)}},{key:"setText",value:function(g){if(g instanceof Element){for(;this.frame.firstChild;)this.frame.removeChild(this.frame.firstChild);this.frame.appendChild(g)}else this.frame.innerText=g}},{key:"show",value:function(g){if(void 0===g&&(g=!0),!0===g){var e=this.frame.clientHeight,t=this.frame.clientWidth,A=this.frame.parentNode.clientHeight,C=this.frame.parentNode.clientWidth,i=0,I=0;if("flip"==this.overflowMethod){var n=!1,o=!0;this.y-e<this.padding&&(o=!1),this.x+t>C-this.padding&&(n=!0),i=n?this.x-t:this.x,I=o?this.y-e:this.y}else(I=this.y-e)+e+this.padding>A&&(I=A-e-this.padding),I<this.padding&&(I=this.padding),(i=this.x)+t+this.padding>C&&(i=C-t-this.padding),i<this.padding&&(i=this.padding);this.frame.style.left=i+"px",this.frame.style.top=I+"px",this.frame.style.visibility="visible",this.hidden=!1}else this.hide()}},{key:"hide",value:function(){this.hidden=!0,this.frame.style.left="0",this.frame.style.top="0",this.frame.style.visibility="hidden"}},{key:"destroy",value:function(){this.frame.parentNode.removeChild(this.frame)}}]),g}(),Do=function(){function g(){YA(this,g)}return UA(g,null,[{key:"validate",value:function(e,t,A){ko=!1,wo=t;var C=t;return void 0!==A&&(C=t[A]),g.parse(e,C,[]),ko}},{key:"parse",value:function(e,t,A){for(var C in e)Object.prototype.hasOwnProperty.call(e,C)&&g.check(C,e,t,A)}},{key:"check",value:function(e,t,A,C){if(void 0!==A[e]||void 0!==A.__any__){var i=e,I=!0;void 0===A[e]&&void 0!==A.__any__&&(i="__any__",I="object"===g.getType(t[e]));var n=A[i];I&&void 0!==n.__type__&&(n=n.__type__),g.checkFields(e,t,A,i,n,C)}else g.getSuggestion(e,A,C)}},{key:"checkFields",value:function(e,t,A,C,i,I){var n=function(t){console.error("%c"+t+g.printLocation(I,e),"background: #FFeeee; color: #dd0000")},o=g.getType(t[e]),r=i[o];void 0!==r?"array"===g.getType(r)&&-1===ji(r).call(r,t[e])?(n('Invalid option detected in "'+e+'". Allowed values are:'+g.print(r)+' not "'+t[e]+'". '),ko=!0):"object"===o&&"__any__"!==C&&(I=eo(I,e),g.parse(t[e],A[C],I)):void 0===i.any&&(n('Invalid type received for "'+e+'". Expected: '+g.print(BC(i))+". Received ["+o+'] "'+t[e]+'"'),ko=!0)}},{key:"getType",value:function(g){var e=mC(g);return"object"===e?null===g?"null":g instanceof Boolean?"boolean":g instanceof Number?"number":g instanceof String?"string":TC(g)?"array":g instanceof Date?"date":void 0!==g.nodeType?"dom":!0===g._isAMomentObject?"moment":"object":"number"===e?"number":"boolean"===e?"boolean":"string"===e?"string":void 0===e?"undefined":e}},{key:"getSuggestion",value:function(e,t,A){var C,i=g.findInOptions(e,t,A,!1),I=g.findInOptions(e,wo,[],!0);C=void 0!==i.indexMatch?" in "+g.printLocation(i.path,e,"")+'Perhaps it was incomplete? Did you mean: "'+i.indexMatch+'"?\n\n':I.distance<=4&&i.distance>I.distance?" in "+g.printLocation(i.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+g.printLocation(I.path,I.closestMatch,""):i.distance<=8?'. Did you mean "'+i.closestMatch+'"?'+g.printLocation(i.path,e):". Did you mean one of these: "+g.print(BC(t))+g.printLocation(A,e),console.error('%cUnknown option detected: "'+e+'"'+C,"background: #FFeeee; color: #dd0000"),ko=!0}},{key:"findInOptions",value:function(e,t,A){var C=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=1e9,I="",n=[],o=e.toLowerCase(),r=void 0;for(var s in t){var a=void 0;if(void 0!==t[s].__type__&&!0===C){var l=g.findInOptions(e,t[s],eo(A,s));i>l.distance&&(I=l.closestMatch,n=l.path,i=l.distance,r=l.indexMatch)}else{var d;-1!==ji(d=s.toLowerCase()).call(d,o)&&(r=s),i>(a=g.levenshteinDistance(e,s))&&(I=s,n=to(A),i=a)}}return{closestMatch:I,path:n,distance:i,indexMatch:r}}},{key:"printLocation",value:function(g,e){for(var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",A="\n\n"+t+"options = {\n",C=0;C<g.length;C++){for(var i=0;i<C+1;i++)A+="  ";A+=g[C]+": {\n"}for(var I=0;I<g.length+1;I++)A+="  ";A+=e+"\n";for(var n=0;n<g.length+1;n++){for(var o=0;o<g.length-n;o++)A+="  ";A+="}\n"}return A+"\n\n"}},{key:"print",value:function(g){return Xi(g).replace(/(")|(\[)|(\])|(,"__type__")/g,"").replace(/(,)/g,", ")}},{key:"levenshteinDistance",value:function(g,e){if(0===g.length)return e.length;if(0===e.length)return g.length;var t,A,C=[];for(t=0;t<=e.length;t++)C[t]=[t];for(A=0;A<=g.length;A++)C[0][A]=A;for(t=1;t<=e.length;t++)for(A=1;A<=g.length;A++)e.charAt(t-1)==g.charAt(A-1)?C[t][A]=C[t-1][A-1]:C[t][A]=Math.min(C[t-1][A-1]+1,Math.min(C[t][A-1]+1,C[t-1][A]+1));return C[e.length][g.length]}}]),g}();function No(g){return Zo=g,function(){var g={};jo=0,void(Lo=Zo.charAt(0)),Jo(),"strict"===Go&&(g.strict=!0,Jo());"graph"!==Go&&"digraph"!==Go||(g.type=Go,Jo());Vo===Bo&&(g.id=Go,Jo());if("{"!=Go)throw Ar("Angle bracket { expected");if(Jo(),qo(g),"}"!=Go)throw Ar("Angle bracket } expected");if(Jo(),""!==Go)throw Ar("End of file expected");return Jo(),delete g.node,delete g.edge,delete g.graph,g}()}var Ro={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},Po=Yi(Ro);Po.color="color.color",Po.style="dashes";var So=0,Mo=1,Bo=2,zo=3,Fo={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},Zo="",jo=0,Lo="",Go="",Vo=So;function Yo(){jo++,Lo=Zo.charAt(jo)}function Wo(){return Zo.charAt(jo+1)}function _o(g){var e=g.charCodeAt(0);return e<47?35===e||46===e:e<59?e>47:e<91?e>64:e<96?95===e:e<123&&e>96}function Uo(g,e){if(g||(g={}),e)for(var t in e)e.hasOwnProperty(t)&&(g[t]=e[t]);return g}function Qo(g,e,t){for(var A=e.split("."),C=g;A.length;){var i=A.shift();A.length?(C[i]||(C[i]={}),C=C[i]):C[i]=t}}function Ho(g,e){for(var t,A,C=null,i=[g],I=g;I.parent;)i.push(I.parent),I=I.parent;if(I.nodes)for(t=0,A=I.nodes.length;t<A;t++)if(e.id===I.nodes[t].id){C=I.nodes[t];break}for(C||(C={id:e.id},g.node&&(C.attr=Uo(C.attr,g.node))),t=i.length-1;t>=0;t--){var n,o=i[t];o.nodes||(o.nodes=[]),-1===ji(n=o.nodes).call(n,C)&&o.nodes.push(C)}e.attr&&(C.attr=Uo(C.attr,e.attr))}function Ko(g,e){if(g.edges||(g.edges=[]),g.edges.push(e),g.edge){var t=Uo({},g.edge);e.attr=Uo(t,e.attr)}}function Xo(g,e,t,A,C){var i={from:e,to:t,type:A};return g.edge&&(i.attr=Uo({},g.edge)),i.attr=Uo(i.attr||{},C),null!=C&&C.hasOwnProperty("arrows")&&null!=C.arrows&&(i.arrows={to:{enabled:!0,type:C.arrows.type}},C.arrows=null),i}function Jo(){for(Vo=So,Go="";" "===Lo||"\t"===Lo||"\n"===Lo||"\r"===Lo;)Yo();do{var g=!1;if("#"===Lo){for(var e=jo-1;" "===Zo.charAt(e)||"\t"===Zo.charAt(e);)e--;if("\n"===Zo.charAt(e)||""===Zo.charAt(e)){for(;""!=Lo&&"\n"!=Lo;)Yo();g=!0}}if("/"===Lo&&"/"===Wo()){for(;""!=Lo&&"\n"!=Lo;)Yo();g=!0}if("/"===Lo&&"*"===Wo()){for(;""!=Lo;){if("*"===Lo&&"/"===Wo()){Yo(),Yo();break}Yo()}g=!0}for(;" "===Lo||"\t"===Lo||"\n"===Lo||"\r"===Lo;)Yo()}while(g);if(""!==Lo){var t=Lo+Wo();if(Fo[t])return Vo=Mo,Go=t,Yo(),void Yo();if(Fo[Lo])return Vo=Mo,Go=Lo,void Yo();if(_o(Lo)||"-"===Lo){for(Go+=Lo,Yo();_o(Lo);)Go+=Lo,Yo();return"false"===Go?Go=!1:"true"===Go?Go=!0:isNaN(Number(Go))||(Go=Number(Go)),void(Vo=Bo)}if('"'===Lo){for(Yo();""!=Lo&&('"'!=Lo||'"'===Lo&&'"'===Wo());)'"'===Lo?(Go+=Lo,Yo()):"\\"===Lo&&"n"===Wo()?(Go+="\n",Yo()):Go+=Lo,Yo();if('"'!=Lo)throw Ar('End of string " expected');return Yo(),void(Vo=Bo)}for(Vo=zo;""!=Lo;)Go+=Lo,Yo();throw new SyntaxError('Syntax error in part "'+Cr(Go,30)+'"')}Vo=Mo}function qo(g){for(;""!==Go&&"}"!=Go;)$o(g),";"===Go&&Jo()}function $o(g){var e=gr(g);if(e)er(g,e);else if(!function(g){if("node"===Go)return Jo(),g.node=tr(),"node";if("edge"===Go)return Jo(),g.edge=tr(),"edge";if("graph"===Go)return Jo(),g.graph=tr(),"graph";return null}(g)){if(Vo!=Bo)throw Ar("Identifier expected");var t=Go;if(Jo(),"="===Go){if(Jo(),Vo!=Bo)throw Ar("Identifier expected");g[t]=Go,Jo()}else!function(g,e){var t={id:e},A=tr();A&&(t.attr=A);Ho(g,t),er(g,e)}(g,t)}}function gr(g){var e=null;if("subgraph"===Go&&((e={}).type="subgraph",Jo(),Vo===Bo&&(e.id=Go,Jo())),"{"===Go){if(Jo(),e||(e={}),e.parent=g,e.node=g.node,e.edge=g.edge,e.graph=g.graph,qo(e),"}"!=Go)throw Ar("Angle bracket } expected");Jo(),delete e.node,delete e.edge,delete e.graph,delete e.parent,g.subgraphs||(g.subgraphs=[]),g.subgraphs.push(e)}return e}function er(g,e){for(;"->"===Go||"--"===Go;){var t,A=Go;Jo();var C=gr(g);if(C)t=C;else{if(Vo!=Bo)throw Ar("Identifier or subgraph expected");Ho(g,{id:t=Go}),Jo()}Ko(g,Xo(g,e,t,A,tr())),e=t}}function tr(){for(var g,e,t=null,A={dashed:!0,solid:!1,dotted:[1,5]},C={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},i=new Array,I=new Array;"["===Go;){for(Jo(),t={};""!==Go&&"]"!=Go;){if(Vo!=Bo)throw Ar("Attribute name expected");var n=Go;if(Jo(),"="!=Go)throw Ar("Equal sign = expected");if(Jo(),Vo!=Bo)throw Ar("Attribute value expected");var o=Go;"style"===n&&(o=A[o]),"arrowhead"===n&&(n="arrows",o={to:{enabled:!0,type:C[o]}}),"arrowtail"===n&&(n="arrows",o={from:{enabled:!0,type:C[o]}}),i.push({attr:t,name:n,value:o}),I.push(n),Jo(),","==Go&&Jo()}if("]"!=Go)throw Ar("Bracket ] expected");Jo()}if(ri(I).call(I,"dir")){var r={arrows:{}};for(g=0;g<i.length;g++)if("arrows"===i[g].name)if(null!=i[g].value.to)r.arrows.to=g;else{if(null==i[g].value.from)throw Ar("Invalid value of arrows");r.arrows.from=g}else"dir"===i[g].name&&(r.dir=g);var s,a,l=i[r.dir].value;if(!ri(I).call(I,"arrows"))if("both"===l)i.push({attr:i[r.dir].attr,name:"arrows",value:{to:{enabled:!0}}}),r.arrows.to=i.length-1,i.push({attr:i[r.dir].attr,name:"arrows",value:{from:{enabled:!0}}}),r.arrows.from=i.length-1;else if("forward"===l)i.push({attr:i[r.dir].attr,name:"arrows",value:{to:{enabled:!0}}}),r.arrows.to=i.length-1;else if("back"===l)i.push({attr:i[r.dir].attr,name:"arrows",value:{from:{enabled:!0}}}),r.arrows.from=i.length-1;else{if("none"!==l)throw Ar('Invalid dir type "'+l+'"');i.push({attr:i[r.dir].attr,name:"arrows",value:""}),r.arrows.to=i.length-1}if("both"===l)r.arrows.to&&r.arrows.from?(a=i[r.arrows.to].value.to.type,s=i[r.arrows.from].value.from.type,i[r.arrows.to]={attr:i[r.arrows.to].attr,name:i[r.arrows.to].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}},gi(i).call(i,r.arrows.from,1)):r.arrows.to?(a=i[r.arrows.to].value.to.type,s="arrow",i[r.arrows.to]={attr:i[r.arrows.to].attr,name:i[r.arrows.to].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}):r.arrows.from&&(a="arrow",s=i[r.arrows.from].value.from.type,i[r.arrows.from]={attr:i[r.arrows.from].attr,name:i[r.arrows.from].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}});else if("back"===l)r.arrows.to&&r.arrows.from?(a="",s=i[r.arrows.from].value.from.type,i[r.arrows.from]={attr:i[r.arrows.from].attr,name:i[r.arrows.from].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}):r.arrows.to?(a="",s="arrow",r.arrows.from=r.arrows.to,i[r.arrows.from]={attr:i[r.arrows.from].attr,name:i[r.arrows.from].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}):r.arrows.from&&(a="",s=i[r.arrows.from].value.from.type,i[r.arrows.to]={attr:i[r.arrows.from].attr,name:i[r.arrows.from].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}),i[r.arrows.from]={attr:i[r.arrows.from].attr,name:i[r.arrows.from].name,value:{from:{enabled:!0,type:i[r.arrows.from].value.from.type}}};else if("none"===l){var d;i[d=r.arrows.to?r.arrows.to:r.arrows.from]={attr:i[d].attr,name:i[d].name,value:""}}else{if("forward"!==l)throw Ar('Invalid dir type "'+l+'"');r.arrows.to&&r.arrows.from||r.arrows.to?(a=i[r.arrows.to].value.to.type,s="",i[r.arrows.to]={attr:i[r.arrows.to].attr,name:i[r.arrows.to].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}):r.arrows.from&&(a="arrow",s="",r.arrows.to=r.arrows.from,i[r.arrows.to]={attr:i[r.arrows.to].attr,name:i[r.arrows.to].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}),i[r.arrows.to]={attr:i[r.arrows.to].attr,name:i[r.arrows.to].name,value:{to:{enabled:!0,type:i[r.arrows.to].value.to.type}}}}gi(i).call(i,r.dir,1)}if(ri(I).call(I,"penwidth")){var h=[];for(e=i.length,g=0;g<e;g++)"width"!==i[g].name&&("penwidth"===i[g].name&&(i[g].name="width"),h.push(i[g]));i=h}for(e=i.length,g=0;g<e;g++)Qo(i[g].attr,i[g].name,i[g].value);return t}function Ar(g){return new SyntaxError(g+', got "'+Cr(Go,30)+'" (char '+jo+")")}function Cr(g,e){return g.length<=e?g:g.substr(0,27)+"..."}function ir(g,e,t){for(var A=e.split("."),C=A.pop(),i=g,I=0;I<A.length;I++){var n=A[I];n in i||(i[n]={}),i=i[n]}return i[C]=t,g}function Ir(g,e){var t={};for(var A in g)if(g.hasOwnProperty(A)){var C=e[A];TC(C)?YC(C).call(C,(function(e){ir(t,e,g[A])})):ir(t,"string"==typeof C?C:A,g[A])}return t}function nr(g){var e,t=No(g),A={nodes:[],edges:[],options:{}};t.nodes&&YC(e=t.nodes).call(e,(function(g){var e={id:g.id,label:String(g.label||g.id)};Uo(e,Ir(g.attr,Ro)),e.image&&(e.shape="image"),A.nodes.push(e)}));if(t.edges){var C,i=function(g){var e={from:g.from,to:g.to};return Uo(e,Ir(g.attr,Po)),null==e.arrows&&"->"===g.type&&(e.arrows="to"),e};YC(C=t.edges).call(C,(function(g){var e,t,C,I,n,o,r;(e=g.from instanceof Object?g.from.nodes:{id:g.from},t=g.to instanceof Object?g.to.nodes:{id:g.to},g.from instanceof Object&&g.from.edges)&&YC(C=g.from.edges).call(C,(function(g){var e=i(g);A.edges.push(e)}));(n=t,o=function(e,t){var C=Xo(A,e.id,t.id,g.type,g.attr),I=i(C);A.edges.push(I)},TC(I=e)?YC(I).call(I,(function(g){TC(n)?YC(n).call(n,(function(e){o(g,e)})):o(g,n)})):TC(n)?YC(n).call(n,(function(g){o(I,g)})):o(I,n),g.to instanceof Object&&g.to.edges)&&YC(r=g.to.edges).call(r,(function(g){var e=i(g);A.edges.push(e)}))}))}return t.attr&&(A.options=t.attr),A}var or=Object.freeze({__proto__:null,en:{addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},de:{addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},es:{addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},it:{addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},nl:{addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},pt:{addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},ru:{addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},cn:{addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},uk:{addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},fr:{addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},cs:{addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"}});var rr=function(){function g(){YA(this,g),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return UA(g,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var g=this.image.width,e=this.image.height;this.width=g,this.height=e;var t=Math.floor(e/2),A=Math.floor(e/4),C=Math.floor(e/8),i=Math.floor(e/16),I=Math.floor(g/2),n=Math.floor(g/4),o=Math.floor(g/8),r=Math.floor(g/16);this.canvas.width=3*n,this.canvas.height=t,this.coordinates=[[0,0,I,t],[I,0,n,A],[I,A,o,C],[5*o,A,r,i]],this._fillMipMap()}}},{key:"initialized",value:function(){return void 0!==this.coordinates}},{key:"_fillMipMap",value:function(){var g=this.canvas.getContext("2d"),e=this.coordinates[0];g.drawImage(this.image,e[0],e[1],e[2],e[3]);for(var t=1;t<this.NUM_ITERATIONS;t++){var A=this.coordinates[t-1],C=this.coordinates[t];g.drawImage(this.canvas,A[0],A[1],A[2],A[3],C[0],C[1],C[2],C[3])}}},{key:"drawImageAtPosition",value:function(g,e,t,A,C,i){if(this.initialized())if(e>2){e*=.5;for(var I=0;e>2&&I<this.NUM_ITERATIONS;)e*=.5,I+=1;I>=this.NUM_ITERATIONS&&(I=this.NUM_ITERATIONS-1);var n=this.coordinates[I];g.drawImage(this.canvas,n[0],n[1],n[2],n[3],t,A,C,i)}else g.drawImage(this.image,t,A,C,i)}}]),g}(),sr=function(){function g(e){YA(this,g),this.images={},this.imageBroken={},this.callback=e}return UA(g,[{key:"_tryloadBrokenUrl",value:function(g,e,t){void 0!==g&&void 0!==t&&(void 0!==e?(t.image.onerror=function(){console.error("Could not load brokenImage:",e)},t.image.src=e):console.warn("No broken url image defined"))}},{key:"_redrawWithImage",value:function(g){this.callback&&this.callback(g)}},{key:"load",value:function(g,e){var t=this,A=this.images[g];if(A)return A;var C=new rr;return this.images[g]=C,C.image.onload=function(){t._fixImageCoordinates(C.image),C.init(),t._redrawWithImage(C)},C.image.onerror=function(){console.error("Could not load image:",g),t._tryloadBrokenUrl(g,e,C)},C.image.src=g,C}},{key:"_fixImageCoordinates",value:function(g){0===g.width&&(document.body.appendChild(g),g.width=g.offsetWidth,g.height=g.offsetHeight,document.body.removeChild(g))}}]),g}(),ar=!E((function(){return Object.isExtensible(Object.preventExtensions({}))})),lr=w((function(g){var e=Ig.f,t=ne("meta"),A=0,C=Object.isExtensible||function(){return!0},i=function(g){e(g,t,{value:{objectID:"O"+ ++A,weakData:{}}})},I=g.exports={REQUIRED:!1,fastKey:function(g,e){if(!Z(g))return"symbol"==typeof g?g:("string"==typeof g?"S":"P")+g;if(!G(g,t)){if(!C(g))return"F";if(!e)return"E";i(g)}return g[t].objectID},getWeakData:function(g,e){if(!G(g,t)){if(!C(g))return!0;if(!e)return!1;i(g)}return g[t].weakData},onFreeze:function(g){return ar&&I.REQUIRED&&C(g)&&!G(g,t)&&i(g),g}};yg[t]=!0})),dr=function(g,e){this.stopped=g,this.result=e},hr=function(g,e,t){var A,C,i,I,n,o,r,s=t&&t.that,a=!(!t||!t.AS_ENTRIES),l=!(!t||!t.IS_ITERATOR),d=!(!t||!t.INTERRUPTED),h=Ag(e,s,1+a+d),c=function(g){return A&&mt(A),new dr(!0,g)},u=function(g){return a?(Cg(g),d?h(g[0],g[1],c):h(g[0],g[1])):d?h(g,c):h(g)};if(l)A=g;else{if("function"!=typeof(C=Ot(g)))throw TypeError("Target is not iterable");if(kt(C)){for(i=0,I=cg(g.length);I>i;i++)if((n=u(g[i]))&&n instanceof dr)return n;return new dr(!1)}A=C.call(g)}for(o=A.next;!(r=o.call(A)).done;){try{n=u(r.value)}catch(g){throw mt(A),g}if("object"==typeof n&&n&&n instanceof dr)return n}return new dr(!1)},cr=function(g,e,t){if(!(g instanceof e))throw TypeError("Incorrect "+(t?t+" ":"")+"invocation");return g},ur=Ig.f,pr=AA.forEach,fr=fe.set,vr=fe.getterFor,mr=function(g,e,t){var A,C=-1!==g.indexOf("Map"),i=-1!==g.indexOf("Weak"),I=C?"set":"add",n=x[g],o=n&&n.prototype,r={};if(O&&"function"==typeof n&&(i||o.forEach&&!E((function(){(new n).entries().next()})))){A=e((function(e,t){fr(cr(e,A,g),{type:g,collection:new n}),null!=t&&hr(t,e[I],{that:e,AS_ENTRIES:C})}));var s=vr(g);pr(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(g){var e="add"==g||"set"==g;!(g in o)||i&&"clear"==g||ng(A.prototype,g,(function(t,A){var C=s(this).collection;if(!e&&i&&!Z(t))return"get"==g&&void 0;var I=C[g](0===t?0:t,A);return e?this:I}))})),i||ur(A.prototype,"size",{configurable:!0,get:function(){return s(this).collection.size}})}else A=t.getConstructor(e,g,C,I),lr.REQUIRED=!0;return It(A,g,!1,!0),r[g]=A,sg({global:!0,forced:!0},r),i||t.setStrong(A,g,C),A},yr=function(g,e,t){for(var A in e)t&&t.unsafe&&g[A]?g[A]=e[A]:at(g,A,e[A],t);return g},br=je("species"),wr=Ig.f,kr=lr.fastKey,xr=fe.set,Er=fe.getterFor,Or={getConstructor:function(g,e,t,A){var C=g((function(g,i){cr(g,C,e),xr(g,{type:e,index:Je(null),first:void 0,last:void 0,size:0}),O||(g.size=0),null!=i&&hr(i,g[A],{that:g,AS_ENTRIES:t})})),i=Er(e),I=function(g,e,t){var A,C,I=i(g),o=n(g,e);return o?o.value=t:(I.last=o={index:C=kr(e,!0),key:e,value:t,previous:A=I.last,next:void 0,removed:!1},I.first||(I.first=o),A&&(A.next=o),O?I.size++:g.size++,"F"!==C&&(I.index[C]=o)),g},n=function(g,e){var t,A=i(g),C=kr(e);if("F"!==C)return A.index[C];for(t=A.first;t;t=t.next)if(t.key==e)return t};return yr(C.prototype,{clear:function(){for(var g=i(this),e=g.index,t=g.first;t;)t.removed=!0,t.previous&&(t.previous=t.previous.next=void 0),delete e[t.index],t=t.next;g.first=g.last=void 0,O?g.size=0:this.size=0},delete:function(g){var e=this,t=i(e),A=n(e,g);if(A){var C=A.next,I=A.previous;delete t.index[A.index],A.removed=!0,I&&(I.next=C),C&&(C.previous=I),t.first==A&&(t.first=C),t.last==A&&(t.last=I),O?t.size--:e.size--}return!!A},forEach:function(g){for(var e,t=i(this),A=Ag(g,arguments.length>1?arguments[1]:void 0,3);e=e?e.next:t.first;)for(A(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(g){return!!n(this,g)}}),yr(C.prototype,t?{get:function(g){var e=n(this,g);return e&&e.value},set:function(g,e){return I(this,0===g?0:g,e)}}:{add:function(g){return I(this,g=0===g?0:g,g)}}),O&&wr(C.prototype,"size",{get:function(){return i(this).size}}),C},setStrong:function(g,e,t){var A=e+" Iterator",C=Er(e),i=Er(A);ut(g,e,(function(g,e){xr(this,{type:A,target:g,state:C(g),kind:e,last:void 0})}),(function(){for(var g=i(this),e=g.kind,t=g.last;t&&t.removed;)t=t.previous;return g.target&&(g.last=t=t?t.next:g.state.first)?"keys"==e?{value:t.key,done:!1}:"values"==e?{value:t.value,done:!1}:{value:[t.key,t.value],done:!1}:(g.target=void 0,{value:void 0,done:!0})}),t?"entries":"values",!t,!0),function(g){var e=xe(g),t=Ig.f;O&&e&&!e[br]&&t(e,br,{configurable:!0,get:function(){return this}})}(e)}};mr("Map",(function(g){return function(){return g(this,arguments.length?arguments[0]:void 0)}}),Or);var Tr=eg.Map,Dr=function(){function g(){YA(this,g),this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Rg(this.options,this.defaultOptions)}return UA(g,[{key:"setOptions",value:function(g){var e=["useDefaultGroups"];if(void 0!==g)for(var t in g)if(Object.prototype.hasOwnProperty.call(g,t)&&-1===ji(e).call(e,t)){var A=g[t];this.add(t,A)}}},{key:"clear",value:function(){this._groups=new Tr,this._groupNames=[]}},{key:"get",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this._groups.get(g);if(void 0===t&&e)if(!1===this.options.useDefaultGroups&&this._groupNames.length>0){var A=this._groupIndex%this._groupNames.length;++this._groupIndex,(t={}).color=this._groups.get(this._groupNames[A]),this._groups.set(g,t)}else{var C=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,(t={}).color=this._defaultGroups[C],this._groups.set(g,t)}return t}},{key:"add",value:function(g,e){return this._groups.has(g)||this._groupNames.push(g),this._groups.set(g,e),e}}]),g}();sg({target:"Number",stat:!0},{isNaN:function(g){return g!=g}});var Nr=eg.Number.isNaN,Rr=x.isFinite,Pr=Number.isFinite||function(g){return"number"==typeof g&&Rr(g)};sg({target:"Number",stat:!0},{isFinite:Pr});var Sr=eg.Number.isFinite,Mr=AA.some,Br=FC("some");sg({target:"Array",proto:!0,forced:!Br},{some:function(g){return Mr(this,g,arguments.length>1?arguments[1]:void 0)}});var zr=zg("Array").some,Fr=Array.prototype,Zr=function(g){var e=g.some;return g===Fr||g instanceof Array&&e===Fr.some?zr:e},jr=xe("Reflect","construct"),Lr=E((function(){function g(){}return!(jr((function(){}),[],g)instanceof g)})),Gr=!E((function(){jr((function(){}))})),Vr=Lr||Gr;sg({target:"Reflect",stat:!0,forced:Vr,sham:Vr},{construct:function(g,e){tg(g),Cg(e);var t=arguments.length<3?g:tg(arguments[2]);if(Gr&&!Lr)return jr(g,e,t);if(g==t){switch(e.length){case 0:return new g;case 1:return new g(e[0]);case 2:return new g(e[0],e[1]);case 3:return new g(e[0],e[1],e[2]);case 4:return new g(e[0],e[1],e[2],e[3])}var A=[null];return A.push.apply(A,e),new(Bg.apply(g,A))}var C=t.prototype,i=Je(Z(C)?C:Object.prototype),I=Function.apply.call(g,i,e);return Z(I)?I:i}});var Yr=eg.Reflect.construct;var Wr=Vi;sg({target:"Object",stat:!0},{setPrototypeOf:st});var _r=eg.Object.setPrototypeOf;function Ur(g,e){return(Ur=_r||function(g,e){return g.__proto__=e,g})(g,e)}function Qr(g,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");g.prototype=Wr(e&&e.prototype,{constructor:{value:g,writable:!0,configurable:!0}}),e&&Ur(g,e)}function Hr(g,e){return!e||"object"!==mC(e)&&"function"!=typeof e?function(g){if(void 0===g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}(g):e}var Kr=ai;function Xr(g){return(Xr=_r?Kr:function(g){return g.__proto__||Kr(g)})(g)}var Jr=w((function(g){var e=function(g){var e,t=Object.prototype,A=t.hasOwnProperty,C="function"==typeof Symbol?Symbol:{},i=C.iterator||"@@iterator",I=C.asyncIterator||"@@asyncIterator",n=C.toStringTag||"@@toStringTag";function o(g,e,t){return Object.defineProperty(g,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),g[e]}try{o({},"")}catch(g){o=function(g,e,t){return g[e]=t}}function r(g,e,t,A){var C=e&&e.prototype instanceof u?e:u,i=Object.create(C.prototype),I=new T(A||[]);return i._invoke=function(g,e,t){var A=a;return function(C,i){if(A===d)throw new Error("Generator is already running");if(A===h){if("throw"===C)throw i;return N()}for(t.method=C,t.arg=i;;){var I=t.delegate;if(I){var n=x(I,t);if(n){if(n===c)continue;return n}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if(A===a)throw A=h,t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);A=d;var o=s(g,e,t);if("normal"===o.type){if(A=t.done?h:l,o.arg===c)continue;return{value:o.arg,done:t.done}}"throw"===o.type&&(A=h,t.method="throw",t.arg=o.arg)}}}(g,t,I),i}function s(g,e,t){try{return{type:"normal",arg:g.call(e,t)}}catch(g){return{type:"throw",arg:g}}}g.wrap=r;var a="suspendedStart",l="suspendedYield",d="executing",h="completed",c={};function u(){}function p(){}function f(){}var v={};v[i]=function(){return this};var m=Object.getPrototypeOf,y=m&&m(m(D([])));y&&y!==t&&A.call(y,i)&&(v=y);var b=f.prototype=u.prototype=Object.create(v);function w(g){["next","throw","return"].forEach((function(e){o(g,e,(function(g){return this._invoke(e,g)}))}))}function k(g,e){function t(C,i,I,n){var o=s(g[C],g,i);if("throw"!==o.type){var r=o.arg,a=r.value;return a&&"object"==typeof a&&A.call(a,"__await")?e.resolve(a.__await).then((function(g){t("next",g,I,n)}),(function(g){t("throw",g,I,n)})):e.resolve(a).then((function(g){r.value=g,I(r)}),(function(g){return t("throw",g,I,n)}))}n(o.arg)}var C;this._invoke=function(g,A){function i(){return new e((function(e,C){t(g,A,e,C)}))}return C=C?C.then(i,i):i()}}function x(g,t){var A=g.iterator[t.method];if(A===e){if(t.delegate=null,"throw"===t.method){if(g.iterator.return&&(t.method="return",t.arg=e,x(g,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var C=s(A,g.iterator,t.arg);if("throw"===C.type)return t.method="throw",t.arg=C.arg,t.delegate=null,c;var i=C.arg;return i?i.done?(t[g.resultName]=i.value,t.next=g.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function E(g){var e={tryLoc:g[0]};1 in g&&(e.catchLoc=g[1]),2 in g&&(e.finallyLoc=g[2],e.afterLoc=g[3]),this.tryEntries.push(e)}function O(g){var e=g.completion||{};e.type="normal",delete e.arg,g.completion=e}function T(g){this.tryEntries=[{tryLoc:"root"}],g.forEach(E,this),this.reset(!0)}function D(g){if(g){var t=g[i];if(t)return t.call(g);if("function"==typeof g.next)return g;if(!isNaN(g.length)){var C=-1,I=function t(){for(;++C<g.length;)if(A.call(g,C))return t.value=g[C],t.done=!1,t;return t.value=e,t.done=!0,t};return I.next=I}}return{next:N}}function N(){return{value:e,done:!0}}return p.prototype=b.constructor=f,f.constructor=p,p.displayName=o(f,n,"GeneratorFunction"),g.isGeneratorFunction=function(g){var e="function"==typeof g&&g.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},g.mark=function(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,f):(g.__proto__=f,o(g,n,"GeneratorFunction")),g.prototype=Object.create(b),g},g.awrap=function(g){return{__await:g}},w(k.prototype),k.prototype[I]=function(){return this},g.AsyncIterator=k,g.async=function(e,t,A,C,i){void 0===i&&(i=Promise);var I=new k(r(e,t,A,C),i);return g.isGeneratorFunction(t)?I:I.next().then((function(g){return g.done?g.value:I.next()}))},w(b),o(b,n,"Generator"),b[i]=function(){return this},b.toString=function(){return"[object Generator]"},g.keys=function(g){var e=[];for(var t in g)e.push(t);return e.reverse(),function t(){for(;e.length;){var A=e.pop();if(A in g)return t.value=A,t.done=!1,t}return t.done=!0,t}},g.values=D,T.prototype={constructor:T,reset:function(g){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!g)for(var t in this)"t"===t.charAt(0)&&A.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var g=this.tryEntries[0].completion;if("throw"===g.type)throw g.arg;return this.rval},dispatchException:function(g){if(this.done)throw g;var t=this;function C(A,C){return n.type="throw",n.arg=g,t.next=A,C&&(t.method="next",t.arg=e),!!C}for(var i=this.tryEntries.length-1;i>=0;--i){var I=this.tryEntries[i],n=I.completion;if("root"===I.tryLoc)return C("end");if(I.tryLoc<=this.prev){var o=A.call(I,"catchLoc"),r=A.call(I,"finallyLoc");if(o&&r){if(this.prev<I.catchLoc)return C(I.catchLoc,!0);if(this.prev<I.finallyLoc)return C(I.finallyLoc)}else if(o){if(this.prev<I.catchLoc)return C(I.catchLoc,!0)}else{if(!r)throw new Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return C(I.finallyLoc)}}}},abrupt:function(g,e){for(var t=this.tryEntries.length-1;t>=0;--t){var C=this.tryEntries[t];if(C.tryLoc<=this.prev&&A.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var i=C;break}}i&&("break"===g||"continue"===g)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var I=i?i.completion:{};return I.type=g,I.arg=e,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(I)},complete:function(g,e){if("throw"===g.type)throw g.arg;return"break"===g.type||"continue"===g.type?this.next=g.arg:"return"===g.type?(this.rval=this.arg=g.arg,this.method="return",this.next="end"):"normal"===g.type&&e&&(this.next=e),c},finish:function(g){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.finallyLoc===g)return this.complete(t.completion,t.afterLoc),O(t),c}},catch:function(g){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.tryLoc===g){var A=t.completion;if("throw"===A.type){var C=A.arg;O(t)}return C}}throw new Error("illegal catch attempt")},delegateYield:function(g,t,A){return this.delegate={iterator:D(g),resultName:t,nextLoc:A},"next"===this.method&&(this.arg=e),c}},g}(g.exports);try{regeneratorRuntime=e}catch(g){Function("r","regeneratorRuntime = r")(e)}})),qr=function(g){return function(e,t,A,C){tg(t);var i=Og(e),I=B(i),n=cg(i.length),o=g?n-1:0,r=g?-1:1;if(A<2)for(;;){if(o in I){C=I[o],o+=r;break}if(o+=r,g?o<0:n<=o)throw TypeError("Reduce of empty array with no initial value")}for(;g?o>=0:n>o;o+=r)o in I&&(C=t(C,I[o],o,i));return C}},$r={left:qr(!1),right:qr(!0)}.left,gs=FC("reduce");sg({target:"Array",proto:!0,forced:!gs||!we&&Se>79&&Se<83},{reduce:function(g){return $r(this,g,arguments.length,arguments.length>1?arguments[1]:void 0)}});var es=zg("Array").reduce,ts=Array.prototype,As=function(g){var e=g.reduce;return g===ts||g instanceof Array&&e===ts.reduce?es:e},Cs=function(g,e,t,A,C,i,I,n){for(var o,r=C,s=0,a=!!I&&Ag(I,n,3);s<A;){if(s in t){if(o=a?a(t[s],s,e):t[s],i>0&&Yt(o))r=Cs(g,e,o,cg(o.length),r,i-1)-1;else{if(r>=9007199254740991)throw TypeError("Exceed the acceptable array length");g[r]=o}r++}s++}return r},is=Cs;sg({target:"Array",proto:!0},{flatMap:function(g){var e,t=Og(this),A=cg(t.length);return tg(g),(e=gA(t,0)).length=is(e,t,t,A,0,1,g,arguments.length>1?arguments[1]:void 0),e}}),zg("Array").flatMap;var Is=fC;mr("Set",(function(g){return function(){return g(this,arguments.length?arguments[0]:void 0)}}),Or);var ns=eg.Set,os=[],rs=os.sort,ss=E((function(){os.sort(void 0)})),as=E((function(){os.sort(null)})),ls=FC("sort");sg({target:"Array",proto:!0,forced:ss||!as||!ls},{sort:function(g){return void 0===g?rs.call(Og(this)):rs.call(Og(this),tg(g))}});var ds,hs=zg("Array").sort,cs=Array.prototype,us=function(g){var e=g.sort;return g===cs||g instanceof Array&&e===cs.sort?hs:e},ps=zg("Array").keys,fs=Array.prototype,vs={DOMTokenList:!0,NodeList:!0},ms=function(g){var e=g.keys;return g===fs||g instanceof Array&&e===fs.keys||vs.hasOwnProperty(tt(g))?ps:e},ys=zg("Array").values,bs=Array.prototype,ws={DOMTokenList:!0,NodeList:!0},ks=function(g){var e=g.values;return g===bs||g instanceof Array&&e===bs.values||ws.hasOwnProperty(tt(g))?ys:e},xs=zg("Array").entries,Es=Array.prototype,Os={DOMTokenList:!0,NodeList:!0},Ts=function(g){var e=g.entries;return g===Es||g instanceof Array&&e===Es.entries||Os.hasOwnProperty(tt(g))?xs:e},Ds=new Uint8Array(16);function Ns(){if(!ds&&!(ds="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ds(Ds)}var Rs=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ps(g){return"string"==typeof g&&Rs.test(g)}for(var Ss=[],Ms=0;Ms<256;++Ms)Ss.push((Ms+256).toString(16).substr(1));function Bs(g,e,t){var A=(g=g||{}).random||(g.rng||Ns)();if(A[6]=15&A[6]|64,A[8]=63&A[8]|128,e){t=t||0;for(var C=0;C<16;++C)e[t+C]=A[C];return e}return function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=(Ss[g[e+0]]+Ss[g[e+1]]+Ss[g[e+2]]+Ss[g[e+3]]+"-"+Ss[g[e+4]]+Ss[g[e+5]]+"-"+Ss[g[e+6]]+Ss[g[e+7]]+"-"+Ss[g[e+8]]+Ss[g[e+9]]+"-"+Ss[g[e+10]]+Ss[g[e+11]]+Ss[g[e+12]]+Ss[g[e+13]]+Ss[g[e+14]]+Ss[g[e+15]]).toLowerCase();if(!Ps(t))throw TypeError("Stringified UUID is invalid");return t}(A)}function zs(g,e){var t=BC(g);if(SA){var A=SA(g);e&&(A=pi(A).call(A,(function(e){return FA(g,e).enumerable}))),t.push.apply(t,A)}return t}function Fs(g){for(var e=1;e<arguments.length;e++){var t,A=null!=arguments[e]?arguments[e]:{};if(e%2)YC(t=zs(Object(A),!0)).call(t,(function(e){QA(g,e,A[e])}));else if(jA)LA(g,jA(A));else{var C;YC(C=zs(Object(A))).call(C,(function(e){VA(g,e,FA(A,e))}))}}return g}function Zs(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}function js(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return Ls(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return Ls(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function Ls(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}function Gs(g){return"string"==typeof g||"number"==typeof g}var Vs=function(){function g(e){YA(this,g),this._queue=[],this._timeout=null,this._extended=null,this.delay=null,this.max=1/0,this.setOptions(e)}return UA(g,[{key:"setOptions",value:function(g){g&&void 0!==g.delay&&(this.delay=g.delay),g&&void 0!==g.max&&(this.max=g.max),this._flushIfNeeded()}},{key:"destroy",value:function(){if(this.flush(),this._extended){for(var g=this._extended.object,e=this._extended.methods,t=0;t<e.length;t++){var A=e[t];A.original?g[A.name]=A.original:delete g[A.name]}this._extended=null}}},{key:"replace",value:function(g,e){var t=this,A=g[e];if(!A)throw new Error("Method "+e+" undefined");g[e]=function(){for(var g=arguments.length,e=new Array(g),C=0;C<g;C++)e[C]=arguments[C];t.queue({args:e,fn:A,context:this})}}},{key:"queue",value:function(g){"function"==typeof g?this._queue.push({fn:g}):this._queue.push(g),this._flushIfNeeded()}},{key:"_flushIfNeeded",value:function(){var g=this;this._queue.length>this.max&&this.flush(),null!=this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&"number"==typeof this.delay&&(this._timeout=gI((function(){g.flush()}),this.delay))}},{key:"flush",value:function(){var g,e;YC(g=gi(e=this._queue).call(e,0)).call(g,(function(g){g.fn.apply(g.context||g.fn,g.args||[])}))}}],[{key:"extend",value:function(e,t){var A=new g(t);if(void 0!==e.flush)throw new Error("Target object already has a property flush");e.flush=function(){A.flush()};var C=[{name:"flush",original:void 0}];if(t&&t.replace)for(var i=0;i<t.replace.length;i++){var I=t.replace[i];C.push({name:I,original:e[I]}),A.replace(e,I)}return A._extended={object:e,methods:C},A}}]),g}(),Ys=function(){function g(){YA(this,g),this._subscribers={"*":[],add:[],remove:[],update:[]},this.subscribe=g.prototype.on,this.unsubscribe=g.prototype.off}return UA(g,[{key:"_trigger",value:function(g,e,t){var A,C;if("*"===g)throw new Error("Cannot trigger event *");YC(A=xC(C=[]).call(C,yC(this._subscribers[g]),yC(this._subscribers["*"]))).call(A,(function(A){A(g,e,null!=t?t:null)}))}},{key:"on",value:function(g,e){"function"==typeof e&&this._subscribers[g].push(e)}},{key:"off",value:function(g,e){var t;this._subscribers[g]=pi(t=this._subscribers[g]).call(t,(function(g){return g!==e}))}}]),g}(),Ws=function(){function g(e){YA(this,g),this._pairs=e}return UA(g,[{key:Is,value:Jr.mark((function g(){var e,t,A,C,i;return Jr.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:e=js(this._pairs),g.prev=1,e.s();case 3:if((t=e.n()).done){g.next=9;break}return A=pC(t.value,2),C=A[0],i=A[1],g.next=7,[C,i];case 7:g.next=3;break;case 9:g.next=14;break;case 11:g.prev=11,g.t0=g.catch(1),e.e(g.t0);case 14:return g.prev=14,e.f(),g.finish(14);case 17:case"end":return g.stop()}}),g,this,[[1,11,14,17]])}))},{key:"entries",value:Jr.mark((function g(){var e,t,A,C,i;return Jr.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:e=js(this._pairs),g.prev=1,e.s();case 3:if((t=e.n()).done){g.next=9;break}return A=pC(t.value,2),C=A[0],i=A[1],g.next=7,[C,i];case 7:g.next=3;break;case 9:g.next=14;break;case 11:g.prev=11,g.t0=g.catch(1),e.e(g.t0);case 14:return g.prev=14,e.f(),g.finish(14);case 17:case"end":return g.stop()}}),g,this,[[1,11,14,17]])}))},{key:"keys",value:Jr.mark((function g(){var e,t,A,C;return Jr.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:e=js(this._pairs),g.prev=1,e.s();case 3:if((t=e.n()).done){g.next=9;break}return A=pC(t.value,1),C=A[0],g.next=7,C;case 7:g.next=3;break;case 9:g.next=14;break;case 11:g.prev=11,g.t0=g.catch(1),e.e(g.t0);case 14:return g.prev=14,e.f(),g.finish(14);case 17:case"end":return g.stop()}}),g,this,[[1,11,14,17]])}))},{key:"values",value:Jr.mark((function g(){var e,t,A,C;return Jr.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:e=js(this._pairs),g.prev=1,e.s();case 3:if((t=e.n()).done){g.next=9;break}return A=pC(t.value,2),C=A[1],g.next=7,C;case 7:g.next=3;break;case 9:g.next=14;break;case 11:g.prev=11,g.t0=g.catch(1),e.e(g.t0);case 14:return g.prev=14,e.f(),g.finish(14);case 17:case"end":return g.stop()}}),g,this,[[1,11,14,17]])}))},{key:"toIdArray",value:function(){var g;return SC(g=yC(this._pairs)).call(g,(function(g){return g[0]}))}},{key:"toItemArray",value:function(){var g;return SC(g=yC(this._pairs)).call(g,(function(g){return g[1]}))}},{key:"toEntryArray",value:function(){return yC(this._pairs)}},{key:"toObjectMap",value:function(){var g,e=Yi(null),t=js(this._pairs);try{for(t.s();!(g=t.n()).done;){var A=pC(g.value,2),C=A[0],i=A[1];e[C]=i}}catch(g){t.e(g)}finally{t.f()}return e}},{key:"toMap",value:function(){return new Tr(this._pairs)}},{key:"toIdSet",value:function(){return new ns(this.toIdArray())}},{key:"toItemSet",value:function(){return new ns(this.toItemArray())}},{key:"cache",value:function(){return new g(yC(this._pairs))}},{key:"distinct",value:function(g){var e,t=new ns,A=js(this._pairs);try{for(A.s();!(e=A.n()).done;){var C=pC(e.value,2),i=C[0],I=C[1];t.add(g(I,i))}}catch(g){A.e(g)}finally{A.f()}return t}},{key:"filter",value:function(e){var t=this._pairs;return new g(QA({},Is,Jr.mark((function g(){var A,C,i,I,n;return Jr.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:A=js(t),g.prev=1,A.s();case 3:if((C=A.n()).done){g.next=10;break}if(i=pC(C.value,2),I=i[0],n=i[1],!e(n,I)){g.next=8;break}return g.next=8,[I,n];case 8:g.next=3;break;case 10:g.next=15;break;case 12:g.prev=12,g.t0=g.catch(1),A.e(g.t0);case 15:return g.prev=15,A.f(),g.finish(15);case 18:case"end":return g.stop()}}),g,null,[[1,12,15,18]])}))))}},{key:"forEach",value:function(g){var e,t=js(this._pairs);try{for(t.s();!(e=t.n()).done;){var A=pC(e.value,2),C=A[0];g(A[1],C)}}catch(g){t.e(g)}finally{t.f()}}},{key:"map",value:function(e){var t=this._pairs;return new g(QA({},Is,Jr.mark((function g(){var A,C,i,I,n;return Jr.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:A=js(t),g.prev=1,A.s();case 3:if((C=A.n()).done){g.next=9;break}return i=pC(C.value,2),I=i[0],n=i[1],g.next=7,[I,e(n,I)];case 7:g.next=3;break;case 9:g.next=14;break;case 11:g.prev=11,g.t0=g.catch(1),A.e(g.t0);case 14:return g.prev=14,A.f(),g.finish(14);case 17:case"end":return g.stop()}}),g,null,[[1,11,14,17]])}))))}},{key:"max",value:function(g){var e=Vt(this._pairs),t=e.next();if(t.done)return null;for(var A=t.value[1],C=g(t.value[1],t.value[0]);!(t=e.next()).done;){var i=pC(t.value,2),I=i[0],n=i[1],o=g(n,I);o>C&&(C=o,A=n)}return A}},{key:"min",value:function(g){var e=Vt(this._pairs),t=e.next();if(t.done)return null;for(var A=t.value[1],C=g(t.value[1],t.value[0]);!(t=e.next()).done;){var i=pC(t.value,2),I=i[0],n=i[1],o=g(n,I);o<C&&(C=o,A=n)}return A}},{key:"reduce",value:function(g,e){var t,A=js(this._pairs);try{for(A.s();!(t=A.n()).done;){var C=pC(t.value,2),i=C[0];e=g(e,C[1],i)}}catch(g){A.e(g)}finally{A.f()}return e}},{key:"sort",value:function(e){var t=this;return new g(QA({},Is,(function(){var g;return Vt(us(g=yC(t._pairs)).call(g,(function(g,t){var A=pC(g,2),C=A[0],i=A[1],I=pC(t,2),n=I[0],o=I[1];return e(i,o,C,n)})))})))}}]),g}();var _s=function(g){Qr(t,Ys);var e=Zs(t);function t(g,A){var C;return YA(this,t),(C=e.call(this))._queue=null,g&&!TC(g)&&(A=g,g=[]),C._options=A||{},C._data=new Tr,C.length=0,C._idProp=C._options.fieldId||"id",g&&g.length&&C.add(g),C.setOptions(A),C}return UA(t,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(g){g&&void 0!==g.queue&&(!1===g.queue?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=Vs.extend(this,{replace:["add","update","remove"]})),g.queue&&"object"===mC(g.queue)&&this._queue.setOptions(g.queue)))}},{key:"add",value:function(g,e){var t,A=this,C=[];if(TC(g)){var i=SC(g).call(g,(function(g){return g[A._idProp]}));if(Zr(i).call(i,(function(g){return A._data.has(g)})))throw new Error("A duplicate id was found in the parameter array.");for(var I=0,n=g.length;I<n;I++)t=this._addItem(g[I]),C.push(t)}else{if(!g||"object"!==mC(g))throw new Error("Unknown dataType");t=this._addItem(g),C.push(t)}return C.length&&this._trigger("add",{items:C},e),C}},{key:"update",value:function(g,e){var t=this,A=[],C=[],i=[],I=[],n=this._idProp,o=function(g){var e=g[n];if(null!=e&&t._data.has(e)){var o=g,r=Rg({},t._data.get(e)),s=t._updateItem(o);C.push(s),I.push(o),i.push(r)}else{var a=t._addItem(g);A.push(a)}};if(TC(g))for(var r=0,s=g.length;r<s;r++)g[r]&&"object"===mC(g[r])?o(g[r]):console.warn("Ignoring input item, which is not an object at index "+r);else{if(!g||"object"!==mC(g))throw new Error("Unknown dataType");o(g)}if(A.length&&this._trigger("add",{items:A},e),C.length){var a={items:C,oldData:i,data:I};this._trigger("update",a,e)}return xC(A).call(A,C)}},{key:"updateOnly",value:function(g,e){var t,A=this;TC(g)||(g=[g]);var C=SC(t=SC(g).call(g,(function(g){var e=A._data.get(g[A._idProp]);if(null==e)throw new Error("Updating non-existent items is not allowed.");return{oldData:e,update:g}}))).call(t,(function(g){var e=g.oldData,t=g.update,C=e[A._idProp],i=function(g){for(var e,t=arguments.length,A=new Array(t>1?t-1:0),C=1;C<t;C++)A[C-1]=arguments[C];return Mn.apply(void 0,xC(e=[{},g]).call(e,A))}(e,t);return A._data.set(C,i),{id:C,oldData:e,updatedData:i}}));if(C.length){var i={items:SC(C).call(C,(function(g){return g.id})),oldData:SC(C).call(C,(function(g){return g.oldData})),data:SC(C).call(C,(function(g){return g.updatedData}))};return this._trigger("update",i,e),i.items}return[]}},{key:"get",value:function(g,e){var t=void 0,A=void 0,C=void 0;Gs(g)?(t=g,C=e):TC(g)?(A=g,C=e):C=g;var i,I=C&&"Object"===C.returnType?"Object":"Array",n=C&&pi(C),o=[],r=void 0,s=void 0,a=void 0;if(null!=t)(r=this._data.get(t))&&n&&!n(r)&&(r=void 0);else if(null!=A)for(var l=0,d=A.length;l<d;l++)null==(r=this._data.get(A[l]))||n&&!n(r)||o.push(r);else for(var h,c=0,u=(s=yC(ms(h=this._data).call(h))).length;c<u;c++)a=s[c],null==(r=this._data.get(a))||n&&!n(r)||o.push(r);if(C&&C.order&&null==t&&this._sort(o,C.order),C&&C.fields){var p=C.fields;if(null!=t&&null!=r)r=this._filterFields(r,p);else for(var f=0,v=o.length;f<v;f++)o[f]=this._filterFields(o[f],p)}if("Object"==I){for(var m={},y=0,b=o.length;y<b;y++){var w=o[y];m[w[this._idProp]]=w}return m}return null!=t?null!==(i=r)&&void 0!==i?i:null:o}},{key:"getIds",value:function(g){var e=this._data,t=g&&pi(g),A=g&&g.order,C=yC(ms(e).call(e)),i=[];if(t)if(A){for(var I=[],n=0,o=C.length;n<o;n++){var r=C[n],s=this._data.get(r);null!=s&&t(s)&&I.push(s)}this._sort(I,A);for(var a=0,l=I.length;a<l;a++)i.push(I[a][this._idProp])}else for(var d=0,h=C.length;d<h;d++){var c=C[d],u=this._data.get(c);null!=u&&t(u)&&i.push(u[this._idProp])}else if(A){for(var p=[],f=0,v=C.length;f<v;f++){var m=C[f];p.push(e.get(m))}this._sort(p,A);for(var y=0,b=p.length;y<b;y++)i.push(p[y][this._idProp])}else for(var w=0,k=C.length;w<k;w++){var x=C[w],E=e.get(x);null!=E&&i.push(E[this._idProp])}return i}},{key:"getDataSet",value:function(){return this}},{key:"forEach",value:function(g,e){var t=e&&pi(e),A=this._data,C=yC(ms(A).call(A));if(e&&e.order)for(var i=this.get(e),I=0,n=i.length;I<n;I++){var o=i[I];g(o,o[this._idProp])}else for(var r=0,s=C.length;r<s;r++){var a=C[r],l=this._data.get(a);null==l||t&&!t(l)||g(l,a)}}},{key:"map",value:function(g,e){for(var t=e&&pi(e),A=[],C=this._data,i=yC(ms(C).call(C)),I=0,n=i.length;I<n;I++){var o=i[I],r=this._data.get(o);null==r||t&&!t(r)||A.push(g(r,o))}return e&&e.order&&this._sort(A,e.order),A}},{key:"_filterFields",value:function(g,e){var t;return g?As(t=TC(e)?e:BC(e)).call(t,(function(e,t){return e[t]=g[t],e}),{}):g}},{key:"_sort",value:function(g,e){if("string"==typeof e){var t=e;us(g).call(g,(function(g,e){var A=g[t],C=e[t];return A>C?1:A<C?-1:0}))}else{if("function"!=typeof e)throw new TypeError("Order must be a function or a string");us(g).call(g,e)}}},{key:"remove",value:function(g,e){for(var t=[],A=[],C=TC(g)?g:[g],i=0,I=C.length;i<I;i++){var n=this._remove(C[i]);if(n){var o=n[this._idProp];null!=o&&(t.push(o),A.push(n))}}return t.length&&this._trigger("remove",{items:t,oldData:A},e),t}},{key:"_remove",value:function(g){var e;if(Gs(g)?e=g:g&&"object"===mC(g)&&(e=g[this._idProp]),null!=e&&this._data.has(e)){var t=this._data.get(e)||null;return this._data.delete(e),--this.length,t}return null}},{key:"clear",value:function(g){for(var e,t=yC(ms(e=this._data).call(e)),A=[],C=0,i=t.length;C<i;C++)A.push(this._data.get(t[C]));return this._data.clear(),this.length=0,this._trigger("remove",{items:t,oldData:A},g),t}},{key:"max",value:function(g){var e,t,A=null,C=null,i=js(ks(e=this._data).call(e));try{for(i.s();!(t=i.n()).done;){var I=t.value,n=I[g];"number"==typeof n&&(null==C||n>C)&&(A=I,C=n)}}catch(g){i.e(g)}finally{i.f()}return A||null}},{key:"min",value:function(g){var e,t,A=null,C=null,i=js(ks(e=this._data).call(e));try{for(i.s();!(t=i.n()).done;){var I=t.value,n=I[g];"number"==typeof n&&(null==C||n<C)&&(A=I,C=n)}}catch(g){i.e(g)}finally{i.f()}return A||null}},{key:"distinct",value:function(g){for(var e=this._data,t=yC(ms(e).call(e)),A=[],C=0,i=0,I=t.length;i<I;i++){for(var n=t[i],o=e.get(n)[g],r=!1,s=0;s<C;s++)if(A[s]==o){r=!0;break}r||void 0===o||(A[C]=o,C++)}return A}},{key:"_addItem",value:function(g){var e=function(g,e){return null==g[e]&&(g[e]=Bs()),g}(g,this._idProp),t=e[this._idProp];if(this._data.has(t))throw new Error("Cannot add item: item with id "+t+" already exists");return this._data.set(t,e),++this.length,t}},{key:"_updateItem",value:function(g){var e=g[this._idProp];if(null==e)throw new Error("Cannot update item: item has no id (item: "+Xi(g)+")");var t=this._data.get(e);if(!t)throw new Error("Cannot update item: no item with id "+e+" found");return this._data.set(e,Fs(Fs({},t),g)),e}},{key:"stream",value:function(g){if(g){var e=this._data;return new Ws(QA({},Is,Jr.mark((function t(){var A,C,i,I;return Jr.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:A=js(g),t.prev=1,A.s();case 3:if((C=A.n()).done){t.next=11;break}if(i=C.value,null==(I=e.get(i))){t.next=9;break}return t.next=9,[i,I];case 9:t.next=3;break;case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(1),A.e(t.t0);case 16:return t.prev=16,A.f(),t.finish(16);case 19:case"end":return t.stop()}}),t,null,[[1,13,16,19]])}))))}var t;return new Ws(QA({},Is,jg(t=Ts(this._data)).call(t,this._data)))}}]),t}();function Us(g,e){return"object"===mC(e)&&null!==e&&g===e.idProp&&"function"==typeof YC(e)&&"function"==typeof e.get&&"function"==typeof e.getDataSet&&"function"==typeof e.getIds&&"number"==typeof e.length&&"function"==typeof SC(e)&&"function"==typeof e.off&&"function"==typeof e.on&&"function"==typeof e.stream&&function(g,e){return"object"===mC(e)&&null!==e&&g===e.idProp&&"function"==typeof e.add&&"function"==typeof e.clear&&"function"==typeof e.distinct&&"function"==typeof YC(e)&&"function"==typeof e.get&&"function"==typeof e.getDataSet&&"function"==typeof e.getIds&&"number"==typeof e.length&&"function"==typeof SC(e)&&"function"==typeof e.max&&"function"==typeof e.min&&"function"==typeof e.off&&"function"==typeof e.on&&"function"==typeof e.remove&&"function"==typeof e.setOptions&&"function"==typeof e.stream&&"function"==typeof e.update&&"function"==typeof e.updateOnly}(g,e.getDataSet())}var Qs=Ei.trim,Hs=x.parseFloat,Ks=1/Hs(yi+"-0")!=-1/0?function(g){var e=Qs(String(g)),t=Hs(e);return 0===t&&"-"==e.charAt(0)?-0:t}:Hs;sg({global:!0,forced:parseFloat!=Ks},{parseFloat:Ks});var Xs=eg.parseFloat,Js=Kt.f,qs=E((function(){return!Object.getOwnPropertyNames(1)}));sg({target:"Object",stat:!0,forced:qs},{getOwnPropertyNames:Js});var $s=eg.Object,ga=function(g){return $s.getOwnPropertyNames(g)};function ea(g,e){var t=["node","edge","label"],A=!0,C=vo(e,"chosen");if("boolean"==typeof C)A=C;else if("object"===mC(C)){if(-1===ji(t).call(t,g))throw new Error("choosify: subOption '"+g+"' should be one of '"+t.join("', '")+"'");var i=vo(e,["chosen",g]);"boolean"!=typeof i&&"function"!=typeof i||(A=i)}return A}function ta(g,e,t){if(g.width<=0||g.height<=0)return!1;if(void 0!==t){var A={x:e.x-t.x,y:e.y-t.y};if(0!==t.angle){var C=-t.angle;e={x:Math.cos(C)*A.x-Math.sin(C)*A.y,y:Math.sin(C)*A.x+Math.cos(C)*A.y}}else e=A}var i=g.x+g.width,I=g.y+g.width;return g.left<e.x&&i>e.x&&g.top<e.y&&I>e.y}function Aa(g){return"string"==typeof g&&""!==g}function Ca(g,e,t,A){var C=A.x,i=A.y;if("function"==typeof A.distanceToBorder){var I=A.distanceToBorder(g,e),n=Math.sin(e)*I,o=Math.cos(e)*I;o===I?(C+=I,i=A.y):n===I?(C=A.x,i-=I):(C+=o,i-=n)}else A.shape.width>A.shape.height?(C=A.x+.5*A.shape.width,i=A.y-t):(C=A.x+t,i=A.y-.5*A.shape.height);return{x:C,y:i}}var ia=function(){function g(e){YA(this,g),this.measureText=e,this.current=0,this.width=0,this.height=0,this.lines=[]}return UA(g,[{key:"_add",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";void 0===this.lines[g]&&(this.lines[g]={width:0,height:0,blocks:[]});var A=e;void 0!==e&&""!==e||(A=" ");var C=this.measureText(A,t),i=Rg({},ks(C));i.text=e,i.width=C.width,i.mod=t,void 0!==e&&""!==e||(i.width=0),this.lines[g].blocks.push(i),this.lines[g].width+=i.width}},{key:"curWidth",value:function(){var g=this.lines[this.current];return void 0===g?0:g.width}},{key:"append",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,g,e)}},{key:"newLine",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,g,e),this.current++}},{key:"determineLineHeights",value:function(){for(var g=0;g<this.lines.length;g++){var e=this.lines[g],t=0;if(void 0!==e.blocks)for(var A=0;A<e.blocks.length;A++){var C=e.blocks[A];t<C.height&&(t=C.height)}e.height=t}}},{key:"determineLabelSize",value:function(){for(var g=0,e=0,t=0;t<this.lines.length;t++){var A=this.lines[t];A.width>g&&(g=A.width),e+=A.height}this.width=g,this.height=e}},{key:"removeEmptyBlocks",value:function(){for(var g=[],e=0;e<this.lines.length;e++){var t=this.lines[e];if(0!==t.blocks.length&&(e!==this.lines.length-1||0!==t.width)){var A={};Rg(A,t),A.blocks=[];for(var C=void 0,i=[],I=0;I<t.blocks.length;I++){var n=t.blocks[I];0!==n.width?i.push(n):void 0===C&&(C=n)}0===i.length&&void 0!==C&&i.push(C),A.blocks=i,g.push(A)}}return g}},{key:"finalize",value:function(){this.determineLineHeights(),this.determineLabelSize();var g=this.removeEmptyBlocks();return{width:this.width,height:this.height,lines:g}}}]),g}(),Ia={"<b>":/<b>/,"<i>":/<i>/,"<code>":/<code>/,"</b>":/<\/b>/,"</i>":/<\/i>/,"</code>":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},na=function(){function g(e){YA(this,g),this.text=e,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return UA(g,[{key:"mod",value:function(){return 0===this.modStack.length?"normal":this.modStack[0]}},{key:"modName",value:function(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":this.bold&&this.ital?"boldital":this.bold?"bold":this.ital?"ital":void 0}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(g){" "===g&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=g&&(this.buffer+=g)}},{key:"parseWS",value:function(g){return!!/[ \t]/.test(g)&&(this.mono?this.add(g):this.spacing=!0,!0)}},{key:"setTag",value:function(g){this.emitBlock(),this[g]=!0,this.modStack.unshift(g)}},{key:"unsetTag",value:function(g){this.emitBlock(),this[g]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(g,e){return!(this.mono||this[g]||!this.match(e))&&(this.setTag(g),!0)}},{key:"match",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this.prepareRegExp(g),A=pC(t,2),C=A[0],i=A[1],I=C.test(this.text.substr(this.position,i));return I&&e&&(this.position+=i-1),I}},{key:"parseEndTag",value:function(g,e,t){var A=this.mod()===g;return!(!(A="mono"===g?A&&this.mono:A&&!this.mono)||!this.match(e))&&(void 0!==t?(this.position===this.text.length-1||this.match(t,!1))&&this.unsetTag(g):this.unsetTag(g),!0)}},{key:"replace",value:function(g,e){return!!this.match(g)&&(this.add(e),this.position+=length-1,!0)}},{key:"prepareRegExp",value:function(g){var e,t;if(g instanceof RegExp)t=g,e=1;else{var A=Ia[g];t=void 0!==A?A:new RegExp(g),e=g.length}return[t,e]}}]),g}(),oa=function(){function g(e,t,A,C){var i=this;YA(this,g),this.ctx=e,this.parent=t,this.selected=A,this.hover=C;this.lines=new ia((function(g,t){if(void 0===g)return 0;var I=i.parent.getFormattingValues(e,A,C,t),n=0;""!==g&&(n=i.ctx.measureText(g).width);return{width:n,values:I}}))}return UA(g,[{key:"process",value:function(g){if(!Aa(g))return this.lines.finalize();var e=this.parent.fontOptions;g=(g=g.replace(/\r\n/g,"\n")).replace(/\r/g,"\n");var t=String(g).split("\n"),A=t.length;if(e.multi)for(var C=0;C<A;C++){var i=this.splitBlocks(t[C],e.multi);if(void 0!==i)if(0!==i.length){if(e.maxWdt>0)for(var I=0;I<i.length;I++){var n=i[I].mod,o=i[I].text;this.splitStringIntoLines(o,n,!0)}else for(var r=0;r<i.length;r++){var s=i[r].mod,a=i[r].text;this.lines.append(a,s)}this.lines.newLine()}else this.lines.newLine("")}else if(e.maxWdt>0)for(var l=0;l<A;l++)this.splitStringIntoLines(t[l]);else for(var d=0;d<A;d++)this.lines.newLine(t[d]);return this.lines.finalize()}},{key:"decodeMarkupSystem",value:function(g){var e="none";return"markdown"===g||"md"===g?e="markdown":!0!==g&&"html"!==g||(e="html"),e}},{key:"splitHtmlBlocks",value:function(g){for(var e=new na(g),t=function(g){return!!/&/.test(g)&&(e.replace(e.text,"&lt;","<")||e.replace(e.text,"&amp;","&")||e.add("&"),!0)};e.position<e.text.length;){var A=e.text.charAt(e.position);e.parseWS(A)||/</.test(A)&&(e.parseStartTag("bold","<b>")||e.parseStartTag("ital","<i>")||e.parseStartTag("mono","<code>")||e.parseEndTag("bold","</b>")||e.parseEndTag("ital","</i>")||e.parseEndTag("mono","</code>"))||t(A)||e.add(A),e.position++}return e.emitBlock(),e.blocks}},{key:"splitMarkdownBlocks",value:function(g){for(var e=this,t=new na(g),A=!0,C=function(g){return!!/\\/.test(g)&&(t.position<e.text.length+1&&(t.position++,g=e.text.charAt(t.position),/ \t/.test(g)?t.spacing=!0:(t.add(g),A=!1)),!0)};t.position<t.text.length;){var i=t.text.charAt(t.position);t.parseWS(i)||C(i)||(A||t.spacing)&&(t.parseStartTag("bold","*")||t.parseStartTag("ital","_")||t.parseStartTag("mono","`"))||t.parseEndTag("bold","*","afterBold")||t.parseEndTag("ital","_","afterItal")||t.parseEndTag("mono","`","afterMono")||(t.add(i),A=!1),t.position++}return t.emitBlock(),t.blocks}},{key:"splitBlocks",value:function(g,e){var t=this.decodeMarkupSystem(e);return"none"===t?[{text:g,mod:"normal"}]:"markdown"===t?this.splitMarkdownBlocks(g):"html"===t?this.splitHtmlBlocks(g):void 0}},{key:"overMaxWidth",value:function(g){var e=this.ctx.measureText(g).width;return this.lines.curWidth()+e>this.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(g){for(var e="",t=0;t<g.length;){var A=e+(""===e?"":" ")+g[t];if(this.overMaxWidth(A))break;e=A,t++}return t}},{key:"getLongestFitWord",value:function(g){for(var e=0;e<g.length&&!this.overMaxWidth(EC(g).call(g,0,e));)e++;return e}},{key:"splitStringIntoLines",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal",t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.parent.getFormattingValues(this.ctx,this.selected,this.hover,e);for(var A=(g=(g=g.replace(/^( +)/g,"$1\r")).replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r")).split("\r");A.length>0;){var C=this.getLongestFit(A);if(0===C){var i=A[0],I=this.getLongestFitWord(i);this.lines.newLine(EC(i).call(i,0,I),e),A[0]=EC(i).call(i,I)}else{var n=C;" "===A[C-1]?C--:" "===A[n]&&n++;var o=EC(A).call(A,0,C).join("");C==A.length&&t?this.lines.append(o,e):this.lines.newLine(o,e),A=EC(A).call(A,n)}}}}]),g}(),ra=["bold","ital","boldital","mono"],sa=function(){function g(e,t){var A=arguments.length>2&&void 0!==arguments[2]&&arguments[2];YA(this,g),this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=A}return UA(g,[{key:"setOptions",value:function(g){if(this.elementOptions=g,this.initFontOptions(g.font),Aa(g.label)?this.labelDirty=!0:g.label=void 0,void 0!==g.font&&null!==g.font)if("string"==typeof g.font)this.baseSize=this.fontOptions.size;else if("object"===mC(g.font)){var e=g.font.size;void 0!==e&&(this.baseSize=e)}}},{key:"initFontOptions",value:function(e){var t=this;Co(ra,(function(g){t.fontOptions[g]={}})),g.parseFontString(this.fontOptions,e)?this.fontOptions.vadjust=0:Co(e,(function(g,e){null!=g&&"object"!==mC(g)&&(t.fontOptions[e]=g)}))}},{key:"constrain",value:function(g){var e={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},t=vo(g,"widthConstraint");if("number"==typeof t)e.maxWdt=Number(t),e.minWdt=Number(t);else if("object"===mC(t)){var A=vo(g,["widthConstraint","maximum"]);"number"==typeof A&&(e.maxWdt=Number(A));var C=vo(g,["widthConstraint","minimum"]);"number"==typeof C&&(e.minWdt=Number(C))}var i=vo(g,"heightConstraint");if("number"==typeof i)e.minHgt=Number(i);else if("object"===mC(i)){var I=vo(g,["heightConstraint","minimum"]);"number"==typeof I&&(e.minHgt=Number(I));var n=vo(g,["heightConstraint","valign"]);"string"==typeof n&&("top"!==n&&"bottom"!==n||(e.valign=n))}return e}},{key:"update",value:function(g,e){this.setOptions(g,!0),this.propagateFonts(e),go(this.fontOptions,this.constrain(e)),this.fontOptions.chooser=ea("label",e)}},{key:"adjustSizes",value:function(g){var e=g?g.right+g.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=e,this.fontOptions.minWdt-=e);var t=g?g.top+g.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=t)}},{key:"addFontOptionsToPile",value:function(g,e){for(var t=0;t<e.length;++t)this.addFontToPile(g,e[t])}},{key:"addFontToPile",value:function(g,e){if(void 0!==e&&void 0!==e.font&&null!==e.font){var t=e.font;g.push(t)}}},{key:"getBasicOptions",value:function(e){for(var t={},A=0;A<e.length;++A){var C=e[A],i={};g.parseFontString(i,C)&&(C=i),Co(C,(function(g,e){void 0!==g&&(Object.prototype.hasOwnProperty.call(t,e)||(-1!==ji(ra).call(ra,e)?t[e]={}:t[e]=g))}))}return t}},{key:"getFontOption",value:function(e,t,A){for(var C,i=0;i<e.length;++i){var I=e[i];if(Object.prototype.hasOwnProperty.call(I,t)){if(null==(C=I[t]))continue;var n={};if(g.parseFontString(n,C)&&(C=n),Object.prototype.hasOwnProperty.call(C,A))return C[A]}}if(Object.prototype.hasOwnProperty.call(this.fontOptions,A))return this.fontOptions[A];throw new Error("Did not find value for multi-font for property: '"+A+"'")}},{key:"getFontOptions",value:function(g,e){for(var t={},A=["color","size","face","mod","vadjust"],C=0;C<A.length;++C){var i=A[C];t[i]=this.getFontOption(g,e,i)}return t}},{key:"propagateFonts",value:function(g){var e=this,t=[];this.addFontOptionsToPile(t,g),this.fontOptions=this.getBasicOptions(t);for(var A=function(g){var A=ra[g],C=e.fontOptions[A];Co(e.getFontOptions(t,A),(function(g,e){C[e]=g})),C.size=Number(C.size),C.vadjust=Number(C.vadjust)},C=0;C<ra.length;++C)A(C)}},{key:"draw",value:function(g,e,t,A,C){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";if(void 0!==this.elementOptions.label){var I=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&I<this.elementOptions.scaling.label.drawThreshold-1||(I>=this.elementOptions.scaling.label.maxVisible&&(I=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(g,A,C,e,t,i),this._drawBackground(g),this._drawText(g,e,this.size.yLine,i,I))}}},{key:"_drawBackground",value:function(g){if(void 0!==this.fontOptions.background&&"none"!==this.fontOptions.background){g.fillStyle=this.fontOptions.background;var e=this.getSize();g.fillRect(e.left,e.top,e.width,e.height)}}},{key:"_drawText",value:function(g,e,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle",C=arguments.length>4?arguments[4]:void 0,i=this._setAlignment(g,e,t,A),I=pC(i,2);e=I[0],t=I[1],g.textAlign="left",e-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&("top"===this.fontOptions.valign&&(t-=(this.size.height-this.size.labelHeight)/2),"bottom"===this.fontOptions.valign&&(t+=(this.size.height-this.size.labelHeight)/2));for(var n=0;n<this.lineCount;n++){var o=this.lines[n];if(o&&o.blocks){var r=0;this.isEdgeLabel||"center"===this.fontOptions.align?r+=(this.size.width-o.width)/2:"right"===this.fontOptions.align&&(r+=this.size.width-o.width);for(var s=0;s<o.blocks.length;s++){var a=o.blocks[s];g.font=a.font;var l=this._getColor(a.color,C,a.strokeColor),d=pC(l,2),h=d[0],c=d[1];a.strokeWidth>0&&(g.lineWidth=a.strokeWidth,g.strokeStyle=c,g.lineJoin="round"),g.fillStyle=h,a.strokeWidth>0&&g.strokeText(a.text,e+r,t+a.vadjust),g.fillText(a.text,e+r,t+a.vadjust),r+=a.width}t+=o.height}}}},{key:"_setAlignment",value:function(g,e,t,A){if(this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&!1===this.pointToSelf){e=0,t=0;"top"===this.fontOptions.align?(g.textBaseline="alphabetic",t-=4):"bottom"===this.fontOptions.align?(g.textBaseline="hanging",t+=4):g.textBaseline="middle"}else g.textBaseline=A;return[e,t]}},{key:"_getColor",value:function(g,e,t){var A=g||"#000000",C=t||"#ffffff";if(e<=this.elementOptions.scaling.label.drawThreshold){var i=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-e)));A=Io(A,i),C=Io(C,i)}return[A,C]}},{key:"getTextSize",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._processLabel(g,e,t),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var g=this.size.left,e=this.size.top-1;if(this.isEdgeLabel){var t=.5*-this.size.width;switch(this.fontOptions.align){case"middle":g=t,e=.5*-this.size.height;break;case"top":g=t,e=-(this.size.height+2);break;case"bottom":g=t,e=2}}return{left:g,top:e,width:this.size.width,height:this.size.height}}},{key:"calculateLabelSize",value:function(g,e,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,C=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";this._processLabel(g,e,t),this.size.left=A-.5*this.size.width,this.size.top=C-.5*this.size.height,this.size.yLine=C+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===i&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(g,e,t,A){var C=function(g,e,t){return"normal"===e?"mod"===t?"":g[t]:void 0!==g[e][t]?g[e][t]:g[t]},i={color:C(this.fontOptions,A,"color"),size:C(this.fontOptions,A,"size"),face:C(this.fontOptions,A,"face"),mod:C(this.fontOptions,A,"mod"),vadjust:C(this.fontOptions,A,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(e||t)&&("normal"===A&&!0===this.fontOptions.chooser&&this.elementOptions.labelHighlightBold?i.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(i,this.elementOptions.id,e,t));var I="";return void 0!==i.mod&&""!==i.mod&&(I+=i.mod+" "),I+=i.size+"px "+i.face,g.font=I.replace(/"/g,""),i.font=g.font,i.height=i.size,i}},{key:"differentState",value:function(g,e){return g!==this.selectedState||e!==this.hoverState}},{key:"_processLabelText",value:function(g,e,t,A){return new oa(g,this,e,t).process(A)}},{key:"_processLabel",value:function(g,e,t){if(!1!==this.labelDirty||this.differentState(e,t)){var A=this._processLabelText(g,e,t,this.elementOptions.label);this.fontOptions.minWdt>0&&A.width<this.fontOptions.minWdt&&(A.width=this.fontOptions.minWdt),this.size.labelHeight=A.height,this.fontOptions.minHgt>0&&A.height<this.fontOptions.minHgt&&(A.height=this.fontOptions.minHgt),this.lines=A.lines,this.lineCount=A.lines.length,this.size.width=A.width,this.size.height=A.height,this.selectedState=e,this.hoverState=t,this.labelDirty=!1}}},{key:"visible",value:function(){return 0!==this.size.width&&0!==this.size.height&&void 0!==this.elementOptions.label&&!(this.fontOptions.size*this.body.view.scale<this.elementOptions.scaling.label.drawThreshold-1)}}],[{key:"parseFontString",value:function(g,e){if(!e||"string"!=typeof e)return!1;var t=e.split(" ");return g.size=+t[0].replace("px",""),g.face=t[1],g.color=t[2],!0}}]),g}(),aa=function(){function g(e,t,A){YA(this,g),this.body=t,this.labelModule=A,this.setOptions(e),this.top=void 0,this.left=void 0,this.height=void 0,this.width=void 0,this.radius=void 0,this.margin=void 0,this.refreshNeeded=!0,this.boundingBox={top:0,left:0,right:0,bottom:0}}return UA(g,[{key:"setOptions",value:function(g){this.options=g}},{key:"_setMargins",value:function(g){this.margin={},this.options.margin&&("object"==mC(this.options.margin)?(this.margin.top=this.options.margin.top,this.margin.right=this.options.margin.right,this.margin.bottom=this.options.margin.bottom,this.margin.left=this.options.margin.left):(this.margin.top=this.options.margin,this.margin.right=this.options.margin,this.margin.bottom=this.options.margin,this.margin.left=this.options.margin)),g.adjustSizes(this.margin)}},{key:"_distanceToBorder",value:function(g,e){var t=this.options.borderWidth;return g&&this.resize(g),Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+t}},{key:"enableShadow",value:function(g,e){e.shadow&&(g.shadowColor=e.shadowColor,g.shadowBlur=e.shadowSize,g.shadowOffsetX=e.shadowX,g.shadowOffsetY=e.shadowY)}},{key:"disableShadow",value:function(g,e){e.shadow&&(g.shadowColor="rgba(0,0,0,0)",g.shadowBlur=0,g.shadowOffsetX=0,g.shadowOffsetY=0)}},{key:"enableBorderDashes",value:function(g,e){if(!1!==e.borderDashes)if(void 0!==g.setLineDash){var t=e.borderDashes;!0===t&&(t=[5,15]),g.setLineDash(t)}else console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,e.borderDashes=!1}},{key:"disableBorderDashes",value:function(g,e){!1!==e.borderDashes&&(void 0!==g.setLineDash?g.setLineDash([0]):(console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,e.borderDashes=!1))}},{key:"needsRefresh",value:function(g,e){return!0===this.refreshNeeded?(this.refreshNeeded=!1,!0):void 0===this.width||this.labelModule.differentState(g,e)}},{key:"initContextForDraw",value:function(g,e){var t=e.borderWidth/this.body.view.scale;g.lineWidth=Math.min(this.width,t),g.strokeStyle=e.borderColor,g.fillStyle=e.color}},{key:"performStroke",value:function(g,e){var t=e.borderWidth/this.body.view.scale;g.save(),t>0&&(this.enableBorderDashes(g,e),g.stroke(),this.disableBorderDashes(g,e)),g.restore()}},{key:"performFill",value:function(g,e){g.save(),g.fillStyle=e.color,this.enableShadow(g,e),AI(g).call(g),this.disableShadow(g,e),g.restore(),this.performStroke(g,e)}},{key:"_addBoundingBoxMargin",value:function(g){this.boundingBox.left-=g,this.boundingBox.top-=g,this.boundingBox.bottom+=g,this.boundingBox.right+=g}},{key:"_updateBoundingBox",value:function(g,e,t,A,C){void 0!==t&&this.resize(t,A,C),this.left=g-this.width/2,this.top=e-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(g,e,t,A,C){this._updateBoundingBox(g,e,t,A,C)}},{key:"getDimensionsFromLabel",value:function(g,e,t){this.textSize=this.labelModule.getTextSize(g,e,t);var A=this.textSize.width,C=this.textSize.height;return 0===A&&(A=14,C=14),{width:A,height:C}}}]),g}();function la(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var da=function(g){Qr(t,aa);var e=la(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C))._setMargins(C),i}return UA(t,[{key:"resize",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(e,t)){var A=this.getDimensionsFromLabel(g,e,t);this.width=A.width+this.margin.right+this.margin.left,this.height=A.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(g,e,t,A,C,i){this.resize(g,A,C),this.left=e-this.width/2,this.top=t-this.height/2,this.initContextForDraw(g,i),Gg(g,this.left,this.top,this.width,this.height,i.borderRadius),this.performFill(g,i),this.updateBoundingBox(e,t,g,A,C),this.labelModule.draw(g,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,A,C)}},{key:"updateBoundingBox",value:function(g,e,t,A,C){this._updateBoundingBox(g,e,t,A,C);var i=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(i)}},{key:"distanceToBorder",value:function(g,e){g&&this.resize(g);var t=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+t}}]),t}();function ha(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var ca=function(g){Qr(t,aa);var e=ha(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C)).labelOffset=0,i.selected=!1,i}return UA(t,[{key:"setOptions",value:function(g,e,t){this.options=g,void 0===e&&void 0===t||this.setImages(e,t)}},{key:"setImages",value:function(g,e){e&&this.selected?(this.imageObj=e,this.imageObjAlt=g):(this.imageObj=g,this.imageObjAlt=e)}},{key:"switchImages",value:function(g){var e=g&&!this.selected||!g&&this.selected;if(this.selected=g,void 0!==this.imageObjAlt&&e){var t=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=t}}},{key:"_getImagePadding",value:function(){var g={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var e=this.options.imagePadding;"object"==mC(e)?(g.top=e.top,g.right=e.right,g.bottom=e.bottom,g.left=e.left):(g.top=e,g.right=e,g.bottom=e,g.left=e)}return g}},{key:"_resizeImage",value:function(){var g,e;if(!1===this.options.shapeProperties.useImageSize){var t=1,A=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?t=this.imageObj.width/this.imageObj.height:A=this.imageObj.height/this.imageObj.width),g=2*this.options.size*t,e=2*this.options.size*A}else{var C=this._getImagePadding();g=this.imageObj.width+C.left+C.right,e=this.imageObj.height+C.top+C.bottom}this.width=g,this.height=e,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(g,e,t,A){this.initContextForDraw(g,A),Lg(g,e,t,A.size),this.performFill(g,A)}},{key:"_drawImageAtPosition",value:function(g,e){if(0!=this.imageObj.width){g.globalAlpha=void 0!==e.opacity?e.opacity:1,this.enableShadow(g,e);var t=1;!0===this.options.shapeProperties.interpolation&&(t=this.imageObj.width/this.width/this.body.view.scale);var A=this._getImagePadding(),C=this.left+A.left,i=this.top+A.top,I=this.width-A.left-A.right,n=this.height-A.top-A.bottom;this.imageObj.drawImageAtPosition(g,t,C,i,I,n),this.disableShadow(g,e)}}},{key:"_drawImageLabel",value:function(g,e,t,A,C){var i=0;if(void 0!==this.height){i=.5*this.height;var I=this.labelModule.getTextSize(g,A,C);I.lineCount>=1&&(i+=I.height/2)}var n=t+i;this.options.label&&(this.labelOffset=i),this.labelModule.draw(g,e,n,A,C,"hanging")}}]),t}();function ua(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var pa=function(g){Qr(t,ca);var e=ua(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C))._setMargins(C),i}return UA(t,[{key:"resize",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(e,t)){var A=this.getDimensionsFromLabel(g,e,t),C=Math.max(A.width+this.margin.right+this.margin.left,A.height+this.margin.top+this.margin.bottom);this.options.size=C/2,this.width=C,this.height=C,this.radius=this.width/2}}},{key:"draw",value:function(g,e,t,A,C,i){this.resize(g,A,C),this.left=e-this.width/2,this.top=t-this.height/2,this._drawRawCircle(g,e,t,i),this.updateBoundingBox(e,t),this.labelModule.draw(g,this.left+this.textSize.width/2+this.margin.left,t,A,C)}},{key:"updateBoundingBox",value:function(g,e){this.boundingBox.top=e-this.options.size,this.boundingBox.left=g-this.options.size,this.boundingBox.right=g+this.options.size,this.boundingBox.bottom=e+this.options.size}},{key:"distanceToBorder",value:function(g){return g&&this.resize(g),.5*this.width}}]),t}();function fa(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var va=function(g){Qr(t,ca);var e=fa(t);function t(g,A,C,i,I){var n;return YA(this,t),(n=e.call(this,g,A,C)).setImages(i,I),n}return UA(t,[{key:"resize",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,A=void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height;if(A){var C=2*this.options.size;return this.width=C,this.height=C,void(this.radius=.5*this.width)}this.needsRefresh(e,t)&&this._resizeImage()}},{key:"draw",value:function(g,e,t,A,C,i){this.switchImages(A),this.resize();var I=e,n=t;"top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=e,this.top=t,I+=this.width/2,n+=this.height/2):(this.left=e-this.width/2,this.top=t-this.height/2),this._drawRawCircle(g,I,n,i),g.save(),g.clip(),this._drawImageAtPosition(g,i),g.restore(),this._drawImageLabel(g,I,n,A,C),this.updateBoundingBox(e,t)}},{key:"updateBoundingBox",value:function(g,e){"top-left"===this.options.shapeProperties.coordinateOrigin?(this.boundingBox.top=e,this.boundingBox.left=g,this.boundingBox.right=g+2*this.options.size,this.boundingBox.bottom=e+2*this.options.size):(this.boundingBox.top=e-this.options.size,this.boundingBox.left=g-this.options.size,this.boundingBox.right=g+this.options.size,this.boundingBox.bottom=e+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(g){return g&&this.resize(g),.5*this.width}}]),t}();function ma(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var ya=function(g){Qr(t,aa);var e=ma(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"resize",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{size:this.options.size};if(this.needsRefresh(e,t)){var C,i;this.labelModule.getTextSize(g,e,t);var I=2*A.size;this.width=null!==(C=this.customSizeWidth)&&void 0!==C?C:I,this.height=null!==(i=this.customSizeHeight)&&void 0!==i?i:I,this.radius=.5*this.width}}},{key:"_drawShape",value:function(g,e,t,A,C,i,I,n){var o,r=this;return this.resize(g,i,I,n),this.left=A-this.width/2,this.top=C-this.height/2,this.initContextForDraw(g,n),(o=e,Object.prototype.hasOwnProperty.call(_g,o)?_g[o]:function(g){for(var e=arguments.length,t=new Array(e>1?e-1:0),A=1;A<e;A++)t[A-1]=arguments[A];CanvasRenderingContext2D.prototype[o].call(g,t)})(g,A,C,n.size),this.performFill(g,n),void 0!==this.options.icon&&void 0!==this.options.icon.code&&(g.font=(i?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),g.fillStyle=this.options.icon.color||"black",g.textAlign="center",g.textBaseline="middle",g.fillText(this.options.icon.code,A,C)),{drawExternalLabel:function(){if(void 0!==r.options.label){r.labelModule.calculateLabelSize(g,i,I,A,C,"hanging");var e=C+.5*r.height+.5*r.labelModule.size.height;r.labelModule.draw(g,A,e,i,I,"hanging")}r.updateBoundingBox(A,C)}}}},{key:"updateBoundingBox",value:function(g,e){this.boundingBox.top=e-this.options.size,this.boundingBox.left=g-this.options.size,this.boundingBox.right=g+this.options.size,this.boundingBox.bottom=e+this.options.size,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),t}();function ba(g,e){var t=BC(g);if(SA){var A=SA(g);e&&(A=pi(A).call(A,(function(e){return FA(g,e).enumerable}))),t.push.apply(t,A)}return t}function wa(g){for(var e=1;e<arguments.length;e++){var t,A=null!=arguments[e]?arguments[e]:{};if(e%2)YC(t=ba(Object(A),!0)).call(t,(function(e){QA(g,e,A[e])}));else if(jA)LA(g,jA(A));else{var C;YC(C=ba(Object(A))).call(C,(function(e){VA(g,e,FA(A,e))}))}}return g}function ka(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var xa=function(g){Qr(t,ya);var e=ka(t);function t(g,A,C,i){var I;return YA(this,t),(I=e.call(this,g,A,C,i)).ctxRenderer=i,I}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){this.resize(g,A,C,i),this.left=e-this.width/2,this.top=t-this.height/2,g.save();var I=this.ctxRenderer({ctx:g,id:this.options.id,x:e,y:t,state:{selected:A,hover:C},style:wa({},i),label:this.options.label});if(null!=I.drawNode&&I.drawNode(),g.restore(),I.drawExternalLabel){var n=I.drawExternalLabel;I.drawExternalLabel=function(){g.save(),n(),g.restore()}}return I.nodeDimensions&&(this.customSizeWidth=I.nodeDimensions.width,this.customSizeHeight=I.nodeDimensions.height),I}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Ea(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Oa=function(g){Qr(t,aa);var e=Ea(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C))._setMargins(C),i}return UA(t,[{key:"resize",value:function(g,e,t){if(this.needsRefresh(e,t)){var A=this.getDimensionsFromLabel(g,e,t).width+this.margin.right+this.margin.left;this.width=A,this.height=A,this.radius=this.width/2}}},{key:"draw",value:function(g,e,t,A,C,i){this.resize(g,A,C),this.left=e-this.width/2,this.top=t-this.height/2,this.initContextForDraw(g,i),Yg(g,e-this.width/2,t-this.height/2,this.width,this.height),this.performFill(g,i),this.updateBoundingBox(e,t,g,A,C),this.labelModule.draw(g,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,A,C)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Ta(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Da=function(g){Qr(t,ya);var e=Ta(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){return this._drawShape(g,"diamond",4,e,t,A,C,i)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Na(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Ra=function(g){Qr(t,ya);var e=Na(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){return this._drawShape(g,"circle",2,e,t,A,C,i)}},{key:"distanceToBorder",value:function(g){return g&&this.resize(g),this.options.size}}]),t}();function Pa(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Sa=function(g){Qr(t,aa);var e=Pa(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"resize",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(e,t)){var A=this.getDimensionsFromLabel(g,e,t);this.height=2*A.height,this.width=A.width+A.height,this.radius=.5*this.width}}},{key:"draw",value:function(g,e,t,A,C,i){this.resize(g,A,C),this.left=e-.5*this.width,this.top=t-.5*this.height,this.initContextForDraw(g,i),Vg(g,this.left,this.top,this.width,this.height),this.performFill(g,i),this.updateBoundingBox(e,t,g,A,C),this.labelModule.draw(g,e,t,A,C)}},{key:"distanceToBorder",value:function(g,e){g&&this.resize(g);var t=.5*this.width,A=.5*this.height,C=Math.sin(e)*t,i=Math.cos(e)*A;return t*A/Math.sqrt(C*C+i*i)}}]),t}();function Ma(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Ba=function(g){Qr(t,aa);var e=Ma(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C))._setMargins(C),i}return UA(t,[{key:"resize",value:function(g,e,t){this.needsRefresh(e,t)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(g,e,t,A,C,i){var I=this;return this.resize(g,A,C),this.options.icon.size=this.options.icon.size||50,this.left=e-this.width/2,this.top=t-this.height/2,this._icon(g,e,t,A,C,i),{drawExternalLabel:function(){if(void 0!==I.options.label){I.labelModule.draw(g,I.left+I.iconSize.width/2+I.margin.left,t+I.height/2+5,A)}I.updateBoundingBox(e,t)}}}},{key:"updateBoundingBox",value:function(g,e){if(this.boundingBox.top=e-.5*this.options.icon.size,this.boundingBox.left=g-.5*this.options.icon.size,this.boundingBox.right=g+.5*this.options.icon.size,this.boundingBox.bottom=e+.5*this.options.icon.size,void 0!==this.options.label&&this.labelModule.size.width>0){this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5)}}},{key:"_icon",value:function(g,e,t,A,C,i){var I=Number(this.options.icon.size);void 0!==this.options.icon.code?(g.font=[null!=this.options.icon.weight?this.options.icon.weight:A?"bold":"",(null!=this.options.icon.weight&&A?5:0)+I+"px",this.options.icon.face].join(" "),g.fillStyle=this.options.icon.color||"black",g.textAlign="center",g.textBaseline="middle",this.enableShadow(g,i),g.fillText(this.options.icon.code,e,t),this.disableShadow(g,i)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function za(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Fa=function(g){Qr(t,ca);var e=za(t);function t(g,A,C,i,I){var n;return YA(this,t),(n=e.call(this,g,A,C)).setImages(i,I),n}return UA(t,[{key:"resize",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,A=void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height;if(A){var C=2*this.options.size;return this.width=C,void(this.height=C)}this.needsRefresh(e,t)&&this._resizeImage()}},{key:"draw",value:function(g,e,t,A,C,i){g.save(),this.switchImages(A),this.resize();var I=e,n=t;if("top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=e,this.top=t,I+=this.width/2,n+=this.height/2):(this.left=e-this.width/2,this.top=t-this.height/2),!0===this.options.shapeProperties.useBorderWithImage){var o=this.options.borderWidth,r=this.options.borderWidthSelected||2*this.options.borderWidth,s=(A?r:o)/this.body.view.scale;g.lineWidth=Math.min(this.width,s),g.beginPath();var a=A?this.options.color.highlight.border:C?this.options.color.hover.border:this.options.color.border,l=A?this.options.color.highlight.background:C?this.options.color.hover.background:this.options.color.background;void 0!==i.opacity&&(a=Io(a,i.opacity),l=Io(l,i.opacity)),g.strokeStyle=a,g.fillStyle=l,g.rect(this.left-.5*g.lineWidth,this.top-.5*g.lineWidth,this.width+g.lineWidth,this.height+g.lineWidth),AI(g).call(g),this.performStroke(g,i),g.closePath()}this._drawImageAtPosition(g,i),this._drawImageLabel(g,I,n,A,C),this.updateBoundingBox(e,t),g.restore()}},{key:"updateBoundingBox",value:function(g,e){this.resize(),"top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=g,this.top=e):(this.left=g-this.width/2,this.top=e-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Za(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var ja=function(g){Qr(t,ya);var e=Za(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){return this._drawShape(g,"square",2,e,t,A,C,i)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function La(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Ga=function(g){Qr(t,ya);var e=La(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){return this._drawShape(g,"hexagon",4,e,t,A,C,i)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Va(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Ya=function(g){Qr(t,ya);var e=Va(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){return this._drawShape(g,"star",4,e,t,A,C,i)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Wa(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var _a=function(g){Qr(t,aa);var e=Wa(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C))._setMargins(C),i}return UA(t,[{key:"resize",value:function(g,e,t){this.needsRefresh(e,t)&&(this.textSize=this.labelModule.getTextSize(g,e,t),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(g,e,t,A,C,i){this.resize(g,A,C),this.left=e-this.width/2,this.top=t-this.height/2,this.enableShadow(g,i),this.labelModule.draw(g,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,A,C),this.disableShadow(g,i),this.updateBoundingBox(e,t,g,A,C)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Ua(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Qa=function(g){Qr(t,ya);var e=Ua(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){return this._drawShape(g,"triangle",3,e,t,A,C,i)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Ha(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Ka=function(g){Qr(t,ya);var e=Ha(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"draw",value:function(g,e,t,A,C,i){return this._drawShape(g,"triangleDown",3,e,t,A,C,i)}},{key:"distanceToBorder",value:function(g,e){return this._distanceToBorder(g,e)}}]),t}();function Xa(g,e){var t=BC(g);if(SA){var A=SA(g);e&&(A=pi(A).call(A,(function(e){return FA(g,e).enumerable}))),t.push.apply(t,A)}return t}function Ja(g){for(var e=1;e<arguments.length;e++){var t,A=null!=arguments[e]?arguments[e]:{};if(e%2)YC(t=Xa(Object(A),!0)).call(t,(function(e){QA(g,e,A[e])}));else if(jA)LA(g,jA(A));else{var C;YC(C=Xa(Object(A))).call(C,(function(e){VA(g,e,FA(A,e))}))}}return g}var qa=function(){function g(e,t,A,C,i,I){YA(this,g),this.options=uo(i),this.globalOptions=i,this.defaultOptions=I,this.body=t,this.edges=[],this.id=void 0,this.imagelist=A,this.grouplist=C,this.x=void 0,this.y=void 0,this.baseSize=this.options.size,this.baseFontSize=this.options.font.size,this.predefinedPosition=!1,this.selected=!1,this.hover=!1,this.labelModule=new sa(this.body,this.options,!1),this.setOptions(e)}return UA(g,[{key:"attachEdge",value:function(g){var e;-1===ji(e=this.edges).call(e,g)&&this.edges.push(g)}},{key:"detachEdge",value:function(g){var e,t,A=ji(e=this.edges).call(e,g);-1!=A&&gi(t=this.edges).call(t,A,1)}},{key:"setOptions",value:function(e){var t=this.options.shape;if(e){if(void 0!==e.color&&(this._localColor=e.color),void 0!==e.id&&(this.id=e.id),void 0===this.id)throw new Error("Node must have an id");g.checkMass(e,this.id),void 0!==e.x&&(null===e.x?(this.x=void 0,this.predefinedPosition=!1):(this.x=Ri(e.x),this.predefinedPosition=!0)),void 0!==e.y&&(null===e.y?(this.y=void 0,this.predefinedPosition=!1):(this.y=Ri(e.y),this.predefinedPosition=!0)),void 0!==e.size&&(this.baseSize=e.size),void 0!==e.value&&(e.value=Xs(e.value)),g.parseOptions(this.options,e,!0,this.globalOptions,this.grouplist);var A=[e,this.options,this.defaultOptions];return this.chooser=ea("node",A),this._load_images(),this.updateLabelModule(e),void 0!==e.opacity&&g.checkOpacity(e.opacity)&&(this.options.opacity=e.opacity),this.updateShape(t),void 0!==e.hidden||void 0!==e.physics}}},{key:"_load_images",value:function(){if(("circularImage"===this.options.shape||"image"===this.options.shape)&&void 0===this.options.image)throw new Error("Option image must be defined for node type '"+this.options.shape+"'");if(void 0!==this.options.image){if(void 0===this.imagelist)throw new Error("Internal Error: No images provided");if("string"==typeof this.options.image)this.imageObj=this.imagelist.load(this.options.image,this.options.brokenImage,this.id);else{if(void 0===this.options.image.unselected)throw new Error("No unselected image provided");this.imageObj=this.imagelist.load(this.options.image.unselected,this.options.brokenImage,this.id),void 0!==this.options.image.selected?this.imageObjAlt=this.imagelist.load(this.options.image.selected,this.options.brokenImage,this.id):this.imageObjAlt=void 0}}}},{key:"getFormattingValues",value:function(){var g={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?!0===this.chooser?this.selected?(null!=this.options.borderWidthSelected?g.borderWidth=this.options.borderWidthSelected:g.borderWidth*=2,g.color=this.options.color.highlight.background,g.borderColor=this.options.color.highlight.border,g.shadow=this.options.shadow.enabled):this.hover&&(g.color=this.options.color.hover.background,g.borderColor=this.options.color.hover.border,g.shadow=this.options.shadow.enabled):"function"==typeof this.chooser&&(this.chooser(g,this.options.id,this.selected,this.hover),!1===g.shadow&&(g.shadowColor===this.options.shadow.color&&g.shadowSize===this.options.shadow.size&&g.shadowX===this.options.shadow.x&&g.shadowY===this.options.shadow.y||(g.shadow=!0))):g.shadow=this.options.shadow.enabled,void 0!==this.options.opacity){var e=this.options.opacity;g.borderColor=Io(g.borderColor,e),g.color=Io(g.color,e),g.shadowColor=Io(g.shadowColor,e)}return g}},{key:"updateLabelModule",value:function(e){void 0!==this.options.label&&null!==this.options.label||(this.options.label=""),g.updateGroupOptions(this.options,Ja(Ja({},e),{},{color:e&&e.color||this._localColor||void 0}),this.grouplist);var t=this.grouplist.get(this.options.group,!1),A=[e,this.options,t,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,A),void 0!==this.labelModule.baseSize&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateShape",value:function(g){if(g===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case"box":this.shape=new da(this.options,this.body,this.labelModule);break;case"circle":this.shape=new pa(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new va(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new xa(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new Oa(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new Da(this.options,this.body,this.labelModule);break;case"dot":this.shape=new Ra(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new Sa(this.options,this.body,this.labelModule);break;case"icon":this.shape=new Ba(this.options,this.body,this.labelModule);break;case"image":this.shape=new Fa(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new ja(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new Ga(this.options,this.body,this.labelModule);break;case"star":this.shape=new Ya(this.options,this.body,this.labelModule);break;case"text":this.shape=new _a(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new Qa(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new Ka(this.options,this.body,this.labelModule);break;default:this.shape=new Sa(this.options,this.body,this.labelModule)}this.needsRefresh()}},{key:"select",value:function(){this.selected=!0,this.needsRefresh()}},{key:"unselect",value:function(){this.selected=!1,this.needsRefresh()}},{key:"needsRefresh",value:function(){this.shape.refreshNeeded=!0}},{key:"getTitle",value:function(){return this.options.title}},{key:"distanceToBorder",value:function(g,e){return this.shape.distanceToBorder(g,e)}},{key:"isFixed",value:function(){return this.options.fixed.x&&this.options.fixed.y}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"getLabelSize",value:function(){return this.labelModule.size()}},{key:"setValueRange",value:function(g,e,t){if(void 0!==this.options.value){var A=this.options.scaling.customScalingFunction(g,e,t,this.options.value),C=this.options.scaling.max-this.options.scaling.min;if(!0===this.options.scaling.label.enabled){var i=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+A*i}this.options.size=this.options.scaling.min+A*C}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}},{key:"draw",value:function(g){var e=this.getFormattingValues();return this.shape.draw(g,this.x,this.y,this.selected,this.hover,e)||{}}},{key:"updateBoundingBox",value:function(g){this.shape.updateBoundingBox(this.x,this.y,g)}},{key:"resize",value:function(g){var e=this.getFormattingValues();this.shape.resize(g,this.selected,this.hover,e)}},{key:"getItemsOnPoint",value:function(g){var e=[];return this.labelModule.visible()&&ta(this.labelModule.getSize(),g)&&e.push({nodeId:this.id,labelId:0}),ta(this.shape.boundingBox,g)&&e.push({nodeId:this.id}),e}},{key:"isOverlappingWith",value:function(g){return this.shape.left<g.right&&this.shape.left+this.shape.width>g.left&&this.shape.top<g.bottom&&this.shape.top+this.shape.height>g.top}},{key:"isBoundingBoxOverlappingWith",value:function(g){return this.shape.boundingBox.left<g.right&&this.shape.boundingBox.right>g.left&&this.shape.boundingBox.top<g.bottom&&this.shape.boundingBox.bottom>g.top}}],[{key:"checkOpacity",value:function(g){return 0<=g&&g<=1}},{key:"checkCoordinateOrigin",value:function(g){return void 0===g||"center"===g||"top-left"===g}},{key:"updateGroupOptions",value:function(e,t,A){var C;if(void 0!==A){var i=e.group;if(void 0!==t&&void 0!==t.group&&i!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");if("number"==typeof i||"string"==typeof i&&""!=i){var I=A.get(i);void 0!==I.opacity&&void 0===t.opacity&&(g.checkOpacity(I.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+I.opacity),I.opacity=void 0));var n=pi(C=ga(t)).call(C,(function(g){return null!=t[g]}));n.push("font"),$n(n,e,I),e.color=oo(e.color)}}}},{key:"parseOptions",value:function(e,t){var A=arguments.length>2&&void 0!==arguments[2]&&arguments[2],C=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4?arguments[4]:void 0,I=["color","fixed","shadow"];if($n(I,e,t,A),g.checkMass(t),void 0!==e.opacity&&(g.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),void 0!==t.opacity&&(g.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!g.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),po(e,t,"shadow",C),void 0!==t.color&&null!==t.color){var n=oo(t.color);Jn(e.color,n)}else!0===A&&null===t.color&&(e.color=uo(C.color));void 0!==t.fixed&&null!==t.fixed&&("boolean"==typeof t.fixed?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(void 0!==t.fixed.x&&"boolean"==typeof t.fixed.x&&(e.fixed.x=t.fixed.x),void 0!==t.fixed.y&&"boolean"==typeof t.fixed.y&&(e.fixed.y=t.fixed.y))),!0===A&&null===t.font&&(e.font=uo(C.font)),g.updateGroupOptions(e,t,i),void 0!==t.scaling&&po(e.scaling,t.scaling,"label",C.scaling)}},{key:"checkMass",value:function(g,e){if(void 0!==g.mass&&g.mass<=0){var t="";void 0!==e&&(t=" in node id: "+e),console.error("%cNegative or zero mass disallowed"+t+", setting mass to 1.","background: #FFeeee; color: #dd0000"),g.mass=1}}}]),g}();function $a(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return gl(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return gl(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function gl(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}var el=function(){function g(e,t,A,C){var i,I=this;if(YA(this,g),this.body=e,this.images=t,this.groups=A,this.layoutEngine=C,this.body.functions.createNode=jg(i=this.create).call(i,this),this.nodesListeners={add:function(g,e){I.add(e.items)},update:function(g,e){I.update(e.items,e.data,e.oldData)},remove:function(g,e){I.remove(e.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(g,e,t,A){if(e===g)return.5;var C=1/(e-g);return Math.max(0,(A-g)*C)}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:"center"},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=uo(this.defaultOptions),this.bindEventListeners()}return UA(g,[{key:"bindEventListeners",value:function(){var g,e,t=this;this.body.emitter.on("refreshNodes",jg(g=this.refresh).call(g,this)),this.body.emitter.on("refresh",jg(e=this.refresh).call(e,this)),this.body.emitter.on("destroy",(function(){Co(t.nodesListeners,(function(g,e){t.body.data.nodes&&t.body.data.nodes.off(e,g)})),delete t.body.functions.createNode,delete t.nodesListeners.add,delete t.nodesListeners.update,delete t.nodesListeners.remove,delete t.nodesListeners}))}},{key:"setOptions",value:function(g){if(void 0!==g){if(qa.parseOptions(this.options,g),void 0!==g.opacity&&(Nr(g.opacity)||!Sr(g.opacity)||g.opacity<0||g.opacity>1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+g.opacity):this.options.opacity=g.opacity),void 0!==g.shape)for(var e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].updateShape();if(void 0!==g.font||void 0!==g.widthConstraint||void 0!==g.heightConstraint)for(var t=0,A=BC(this.body.nodes);t<A.length;t++){var C=A[t];this.body.nodes[C].updateLabelModule(),this.body.nodes[C].needsRefresh()}if(void 0!==g.size)for(var i in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,i)&&this.body.nodes[i].needsRefresh();void 0===g.hidden&&void 0===g.physics||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=this.body.data.nodes;if(Us("id",g))this.body.data.nodes=g;else if(TC(g))this.body.data.nodes=new _s,this.body.data.nodes.add(g);else{if(g)throw new TypeError("Array or DataSet expected");this.body.data.nodes=new _s}if(t&&Co(this.nodesListeners,(function(g,e){t.off(e,g)})),this.body.nodes={},this.body.data.nodes){var A=this;Co(this.nodesListeners,(function(g,e){A.body.data.nodes.on(e,g)}));var C=this.body.data.nodes.getIds();this.add(C,!0)}!1===e&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(g){for(var e,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=[],C=0;C<g.length;C++){e=g[C];var i=this.body.data.nodes.get(e),I=this.create(i);A.push(I),this.body.nodes[e]=I}this.layoutEngine.positionInitially(A),!1===t&&this.body.emitter.emit("_dataChanged")}},{key:"update",value:function(g,e,t){for(var A=this.body.nodes,C=!1,i=0;i<g.length;i++){var I=g[i],n=A[I],o=e[i];void 0!==n?n.setOptions(o)&&(C=!0):(C=!0,n=this.create(o),A[I]=n)}C||void 0===t||(C=Zr(e).call(e,(function(g,e){var A=t[e];return A&&A.level!==g.level}))),!0===C?this.body.emitter.emit("_dataChanged"):this.body.emitter.emit("_dataUpdated")}},{key:"remove",value:function(g){for(var e=this.body.nodes,t=0;t<g.length;t++){delete e[g[t]]}this.body.emitter.emit("_dataChanged")}},{key:"create",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qa;return new e(g,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var g=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Co(this.body.nodes,(function(t,A){var C=g.body.data.nodes.get(A);void 0!==C&&(!0===e&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(C))}))}},{key:"getPositions",value:function(g){var e={};if(void 0!==g){if(!0===TC(g)){for(var t=0;t<g.length;t++)if(void 0!==this.body.nodes[g[t]]){var A=this.body.nodes[g[t]];e[g[t]]={x:Math.round(A.x),y:Math.round(A.y)}}}else if(void 0!==this.body.nodes[g]){var C=this.body.nodes[g];e[g]={x:Math.round(C.x),y:Math.round(C.y)}}}else for(var i=0;i<this.body.nodeIndices.length;i++){var I=this.body.nodes[this.body.nodeIndices[i]];e[this.body.nodeIndices[i]]={x:Math.round(I.x),y:Math.round(I.y)}}return e}},{key:"getPosition",value:function(g){if(null==g)throw new TypeError("No id was specified for getPosition method.");if(null==this.body.nodes[g])throw new ReferenceError("NodeId provided for getPosition does not exist. Provided: ".concat(g));return{x:Math.round(this.body.nodes[g].x),y:Math.round(this.body.nodes[g].y)}}},{key:"storePositions",value:function(){var g,e=[],t=this.body.data.nodes.getDataSet(),A=$a(t.get());try{for(A.s();!(g=A.n()).done;){var C=g.value,i=C.id,I=this.body.nodes[i],n=Math.round(I.x),o=Math.round(I.y);C.x===n&&C.y===o||e.push({id:i,x:n,y:o})}}catch(g){A.e(g)}finally{A.f()}t.update(e)}},{key:"getBoundingBox",value:function(g){if(void 0!==this.body.nodes[g])return this.body.nodes[g].shape.boundingBox}},{key:"getConnectedNodes",value:function(g,e){var t=[];if(void 0!==this.body.nodes[g])for(var A=this.body.nodes[g],C={},i=0;i<A.edges.length;i++){var I=A.edges[i];"to"!==e&&I.toId==A.id?void 0===C[I.fromId]&&(t.push(I.fromId),C[I.fromId]=!0):"from"!==e&&I.fromId==A.id&&void 0===C[I.toId]&&(t.push(I.toId),C[I.toId]=!0)}return t}},{key:"getConnectedEdges",value:function(g){var e=[];if(void 0!==this.body.nodes[g])for(var t=this.body.nodes[g],A=0;A<t.edges.length;A++)e.push(t.edges[A].id);else console.error("NodeId provided for getConnectedEdges does not exist. Provided: ",g);return e}},{key:"moveNode",value:function(g,e,t){var A=this;void 0!==this.body.nodes[g]?(this.body.nodes[g].x=Number(e),this.body.nodes[g].y=Number(t),gI((function(){A.body.emitter.emit("startSimulation")}),0)):console.error("Node id supplied to moveNode does not exist. Provided: ",g)}}]),g}();sg({target:"Reflect",stat:!0},{get:function g(e,t){var A,C,i=arguments.length<3?e:arguments[2];return Cg(e)===i?e[t]:(A=Q.f(e,t))?G(A,"value")?A.value:void 0===A.get?void 0:A.get.call(i):Z(C=be(e))?g(C,t,i):void 0}});var tl=eg.Reflect.get,Al=zA;function Cl(g,e,t){return(Cl="undefined"!=typeof Reflect&&tl?tl:function(g,e,t){var A=function(g,e){for(;!Object.prototype.hasOwnProperty.call(g,e)&&null!==(g=Xr(g)););return g}(g,e);if(A){var C=Al(A,e);return C.get?C.get.call(t):C.value}})(g,e,t||g)}var il=Math.hypot,Il=Math.abs,nl=Math.sqrt,ol=!!il&&il(1/0,NaN)!==1/0;sg({target:"Math",stat:!0,forced:ol},{hypot:function(g,e){for(var t,A,C=0,i=0,I=arguments.length,n=0;i<I;)n<(t=Il(arguments[i++]))?(C=C*(A=n/t)*A+1,n=t):C+=t>0?(A=t/n)*A:t;return n===1/0?1/0:n*nl(C)}});var rl=eg.Math.hypot;function sl(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var al=function(){function g(){YA(this,g)}return UA(g,null,[{key:"transform",value:function(g,e){TC(g)||(g=[g]);for(var t=e.point.x,A=e.point.y,C=e.angle,i=e.length,I=0;I<g.length;++I){var n=g[I],o=n.x*Math.cos(C)-n.y*Math.sin(C),r=n.x*Math.sin(C)+n.y*Math.cos(C);n.x=t+i*o,n.y=A+i*r}}},{key:"drawPath",value:function(g,e){g.beginPath(),g.moveTo(e[0].x,e[0].y);for(var t=1;t<e.length;++t)g.lineTo(e[t].x,e[t].y);g.closePath()}}]),g}(),ll=function(g){Qr(t,al);var e=sl(t);function t(){return YA(this,t),e.apply(this,arguments)}return UA(t,null,[{key:"draw",value:function(g,e){if(e.image){g.save(),g.translate(e.point.x,e.point.y),g.rotate(Math.PI/2+e.angle);var t=null!=e.imageWidth?e.imageWidth:e.image.width,A=null!=e.imageHeight?e.imageHeight:e.image.height;e.image.drawImageAtPosition(g,1,-t/2,0,t,A),g.restore()}return!1}}]),t}(),dl=function(g){Qr(t,al);var e=sl(t);function t(){return YA(this,t),e.apply(this,arguments)}return UA(t,null,[{key:"draw",value:function(g,e){var t=[{x:0,y:0},{x:-1,y:.3},{x:-.9,y:0},{x:-1,y:-.3}];return al.transform(t,e),al.drawPath(g,t),!0}}]),t}(),hl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t=[{x:-1,y:0},{x:0,y:.3},{x:-.4,y:0},{x:0,y:-.3}];return al.transform(t,e),al.drawPath(g,t),!0}}]),g}(),cl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t={x:-.4,y:0};al.transform(t,e),g.strokeStyle=g.fillStyle,g.fillStyle="rgba(0, 0, 0, 0)";var A=Math.PI,C=e.angle-A/2,i=e.angle+A/2;return g.beginPath(),g.arc(t.x,t.y,.4*e.length,C,i,!1),g.stroke(),!0}}]),g}(),ul=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t={x:-.3,y:0};al.transform(t,e),g.strokeStyle=g.fillStyle,g.fillStyle="rgba(0, 0, 0, 0)";var A=Math.PI,C=e.angle+A/2,i=e.angle+3*A/2;return g.beginPath(),g.arc(t.x,t.y,.4*e.length,C,i,!1),g.stroke(),!0}}]),g}(),pl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t=[{x:.02,y:0},{x:-1,y:.3},{x:-1,y:-.3}];return al.transform(t,e),al.drawPath(g,t),!0}}]),g}(),fl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t=[{x:0,y:.3},{x:0,y:-.3},{x:-1,y:0}];return al.transform(t,e),al.drawPath(g,t),!0}}]),g}(),vl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t={x:-.4,y:0};return al.transform(t,e),Lg(g,t.x,t.y,.4*e.length),!0}}]),g}(),ml=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t=[{x:0,y:.5},{x:0,y:-.5},{x:-.15,y:-.5},{x:-.15,y:.5}];return al.transform(t,e),al.drawPath(g,t),!0}}]),g}(),yl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t=[{x:0,y:.3},{x:0,y:-.3},{x:-.6,y:-.3},{x:-.6,y:.3}];return al.transform(t,e),al.drawPath(g,t),!0}}]),g}(),bl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t=[{x:0,y:0},{x:-.5,y:-.3},{x:-1,y:0},{x:-.5,y:.3}];return al.transform(t,e),al.drawPath(g,t),!0}}]),g}(),wl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t=[{x:-1,y:.3},{x:-.5,y:0},{x:-1,y:-.3},{x:0,y:0}];return al.transform(t,e),al.drawPath(g,t),!0}}]),g}(),kl=function(){function g(){YA(this,g)}return UA(g,null,[{key:"draw",value:function(g,e){var t;switch(e.type&&(t=e.type.toLowerCase()),t){case"image":return ll.draw(g,e);case"circle":return vl.draw(g,e);case"box":return yl.draw(g,e);case"crow":return hl.draw(g,e);case"curve":return cl.draw(g,e);case"diamond":return bl.draw(g,e);case"inv_curve":return ul.draw(g,e);case"triangle":return pl.draw(g,e);case"inv_triangle":return fl.draw(g,e);case"bar":return ml.draw(g,e);case"vee":return wl.draw(g,e);case"arrow":default:return dl.draw(g,e)}}}]),g}();function xl(g,e){var t=BC(g);if(SA){var A=SA(g);e&&(A=pi(A).call(A,(function(e){return FA(g,e).enumerable}))),t.push.apply(t,A)}return t}function El(g){for(var e=1;e<arguments.length;e++){var t,A=null!=arguments[e]?arguments[e]:{};if(e%2)YC(t=xl(Object(A),!0)).call(t,(function(e){QA(g,e,A[e])}));else if(jA)LA(g,jA(A));else{var C;YC(C=xl(Object(A))).call(C,(function(e){VA(g,e,FA(A,e))}))}}return g}var Ol=function(){function g(e,t,A){YA(this,g),this._body=t,this._labelModule=A,this.color={},this.colorDirty=!0,this.hoverWidth=1.5,this.selectionWidth=2,this.setOptions(e),this.fromPoint=this.from,this.toPoint=this.to}return UA(g,[{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to]}},{key:"cleanup",value:function(){return!1}},{key:"setOptions",value:function(g){this.options=g,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.id=this.options.id}},{key:"drawLine",value:function(g,e,t,A){var C=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.getViaNode();g.strokeStyle=this.getColor(g,e),g.lineWidth=e.width,!1!==e.dashes?this._drawDashedLine(g,e,C):this._drawLine(g,e,C)}},{key:"_drawLine",value:function(g,e,t,A,C){if(this.from!=this.to)this._line(g,e,t,A,C);else{var i=pC(this._getCircleData(g),3),I=i[0],n=i[1],o=i[2];this._circle(g,e,I,n,o)}}},{key:"_drawDashedLine",value:function(g,e,t,A,C){g.lineCap="round";var i=TC(e.dashes)?e.dashes:[5,5];if(void 0!==g.setLineDash){if(g.save(),g.setLineDash(i),g.lineDashOffset=0,this.from!=this.to)this._line(g,e,t);else{var I=pC(this._getCircleData(g),3),n=I[0],o=I[1],r=I[2];this._circle(g,e,n,o,r)}g.setLineDash([0]),g.lineDashOffset=0,g.restore()}else{if(this.from!=this.to)Wg(g,this.from.x,this.from.y,this.to.x,this.to.y,i);else{var s=pC(this._getCircleData(g),3),a=s[0],l=s[1],d=s[2];this._circle(g,e,a,l,d)}this.enableShadow(g,e),g.stroke(),this.disableShadow(g,e)}}},{key:"findBorderPosition",value:function(g,e,t){return this.from!=this.to?this._findBorderPosition(g,e,t):this._findBorderPositionCircle(g,e,t)}},{key:"findBorderPositions",value:function(g){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,g),to:this._findBorderPosition(this.to,g)};var e,t=pC(EC(e=this._getCircleData(g)).call(e,0,2),2),A=t[0],C=t[1];return{from:this._findBorderPositionCircle(this.from,g,{x:A,y:C,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,g,{x:A,y:C,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(g){var e=this.options.selfReference.size;void 0!==g&&void 0===this.from.shape.width&&this.from.shape.resize(g);var t=Ca(g,this.options.selfReference.angle,e,this.from);return[t.x,t.y,e]}},{key:"_pointOnCircle",value:function(g,e,t,A){var C=2*A*Math.PI;return{x:g+t*Math.cos(C),y:e-t*Math.sin(C)}}},{key:"_findBorderPositionCircle",value:function(g,e,t){var A,C=t.x,i=t.y,I=t.low,n=t.high,o=t.direction,r=this.options.selfReference.size,s=.5*(I+n),a=0;!0===this.options.arrowStrikethrough&&(-1===o?a=this.options.endPointOffset.from:1===o&&(a=this.options.endPointOffset.to));var l=0;do{s=.5*(I+n),A=this._pointOnCircle(C,i,r,s);var d=Math.atan2(g.y-A.y,g.x-A.x),h=g.distanceToBorder(e,d)+a-Math.sqrt(Math.pow(A.x-g.x,2)+Math.pow(A.y-g.y,2));if(Math.abs(h)<.05)break;h>0?o>0?I=s:n=s:o>0?n=s:I=s,++l}while(I<=n&&l<10);return El(El({},A),{},{t:s})}},{key:"getLineWidth",value:function(g,e){return!0===g?Math.max(this.selectionWidth,.3/this._body.view.scale):!0===e?Math.max(this.hoverWidth,.3/this._body.view.scale):Math.max(this.options.width,.3/this._body.view.scale)}},{key:"getColor",value:function(g,e){if(!1!==e.inheritsColor){if("both"===e.inheritsColor&&this.from.id!==this.to.id){var t=g.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),A=this.from.options.color.highlight.border,C=this.to.options.color.highlight.border;return!1===this.from.selected&&!1===this.to.selected?(A=Io(this.from.options.color.border,e.opacity),C=Io(this.to.options.color.border,e.opacity)):!0===this.from.selected&&!1===this.to.selected?C=this.to.options.color.border:!1===this.from.selected&&!0===this.to.selected&&(A=this.from.options.color.border),t.addColorStop(0,A),t.addColorStop(1,C),t}return"to"===e.inheritsColor?Io(this.to.options.color.border,e.opacity):Io(this.from.options.color.border,e.opacity)}return Io(e.color,e.opacity)}},{key:"_circle",value:function(g,e,t,A,C){this.enableShadow(g,e);var i=0,I=2*Math.PI;if(!this.options.selfReference.renderBehindTheNode){var n=this.options.selfReference.angle,o=this.options.selfReference.angle+Math.PI,r=this._findBorderPositionCircle(this.from,g,{x:t,y:A,low:n,high:o,direction:-1}),s=this._findBorderPositionCircle(this.from,g,{x:t,y:A,low:n,high:o,direction:1});i=Math.atan2(r.y-A,r.x-t),I=Math.atan2(s.y-A,s.x-t)}g.beginPath(),g.arc(t,A,C,i,I,!1),g.stroke(),this.disableShadow(g,e)}},{key:"getDistanceToEdge",value:function(g,e,t,A,C,i){if(this.from!=this.to)return this._getDistanceToEdge(g,e,t,A,C,i);var I=pC(this._getCircleData(void 0),3),n=I[0],o=I[1],r=I[2],s=n-C,a=o-i;return Math.abs(Math.sqrt(s*s+a*a)-r)}},{key:"_getDistanceToLine",value:function(g,e,t,A,C,i){var I=t-g,n=A-e,o=((C-g)*I+(i-e)*n)/(I*I+n*n);o>1?o=1:o<0&&(o=0);var r=g+o*I-C,s=e+o*n-i;return Math.sqrt(r*r+s*s)}},{key:"getArrowData",value:function(g,e,t,A,C,i){var I,n,o,r,s,a,l,d=i.width;"from"===e?(o=this.from,r=this.to,s=i.fromArrowScale<0,a=Math.abs(i.fromArrowScale),l=i.fromArrowType):"to"===e?(o=this.to,r=this.from,s=i.toArrowScale<0,a=Math.abs(i.toArrowScale),l=i.toArrowType):(o=this.to,r=this.from,s=i.middleArrowScale<0,a=Math.abs(i.middleArrowScale),l=i.middleArrowType);var h=15*a+3*d;if(o!=r){var c=h/rl(o.x-r.x,o.y-r.y);if("middle"!==e)if(!0===this.options.smooth.enabled){var u=this._findBorderPosition(o,g,{via:t}),p=this.getPoint(u.t+c*("from"===e?1:-1),t);I=Math.atan2(u.y-p.y,u.x-p.x),n=u}else I=Math.atan2(o.y-r.y,o.x-r.x),n=this._findBorderPosition(o,g);else{var f=(s?-c:c)/2,v=this.getPoint(.5+f,t),m=this.getPoint(.5-f,t);I=Math.atan2(v.y-m.y,v.x-m.x),n=this.getPoint(.5,t)}}else{var y=pC(this._getCircleData(g),3),b=y[0],w=y[1],k=y[2];if("from"===e){var x=this.options.selfReference.angle,E=this.options.selfReference.angle+Math.PI,O=this._findBorderPositionCircle(this.from,g,{x:b,y:w,low:x,high:E,direction:-1});I=-2*O.t*Math.PI+1.5*Math.PI+.1*Math.PI,n=O}else if("to"===e){var T=this.options.selfReference.angle,D=this.options.selfReference.angle+Math.PI,N=this._findBorderPositionCircle(this.from,g,{x:b,y:w,low:T,high:D,direction:1});I=-2*N.t*Math.PI+1.5*Math.PI-1.1*Math.PI,n=N}else{var R=this.options.selfReference.angle/(2*Math.PI);n=this._pointOnCircle(b,w,k,R),I=-2*R*Math.PI+1.5*Math.PI+.1*Math.PI}}return{point:n,core:{x:n.x-.9*h*Math.cos(I),y:n.y-.9*h*Math.sin(I)},angle:I,length:h,type:l}}},{key:"drawArrowHead",value:function(g,e,t,A,C){g.strokeStyle=this.getColor(g,e),g.fillStyle=g.strokeStyle,g.lineWidth=e.width,kl.draw(g,C)&&(this.enableShadow(g,e),AI(g).call(g),this.disableShadow(g,e))}},{key:"enableShadow",value:function(g,e){!0===e.shadow&&(g.shadowColor=e.shadowColor,g.shadowBlur=e.shadowSize,g.shadowOffsetX=e.shadowX,g.shadowOffsetY=e.shadowY)}},{key:"disableShadow",value:function(g,e){!0===e.shadow&&(g.shadowColor="rgba(0,0,0,0)",g.shadowBlur=0,g.shadowOffsetX=0,g.shadowOffsetY=0)}},{key:"drawBackground",value:function(g,e){if(!1!==e.background){var t={strokeStyle:g.strokeStyle,lineWidth:g.lineWidth,dashes:g.dashes};g.strokeStyle=e.backgroundColor,g.lineWidth=e.backgroundSize,this.setStrokeDashed(g,e.backgroundDashes),g.stroke(),g.strokeStyle=t.strokeStyle,g.lineWidth=t.lineWidth,g.dashes=t.dashes,this.setStrokeDashed(g,e.dashes)}}},{key:"setStrokeDashed",value:function(g,e){if(!1!==e)if(void 0!==g.setLineDash){var t=TC(e)?e:[5,5];g.setLineDash(t)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else void 0!==g.setLineDash?g.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),g}();function Tl(g,e){var t=BC(g);if(SA){var A=SA(g);e&&(A=pi(A).call(A,(function(e){return FA(g,e).enumerable}))),t.push.apply(t,A)}return t}function Dl(g){for(var e=1;e<arguments.length;e++){var t,A=null!=arguments[e]?arguments[e]:{};if(e%2)YC(t=Tl(Object(A),!0)).call(t,(function(e){QA(g,e,A[e])}));else if(jA)LA(g,jA(A));else{var C;YC(C=Tl(Object(A))).call(C,(function(e){VA(g,e,FA(A,e))}))}}return g}function Nl(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Rl=function(g){Qr(t,Ol);var e=Nl(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"_findBorderPositionBezier",value:function(g,e){var t,A,C=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._getViaCoordinates(),i=10,I=.2,n=!1,o=1,r=0,s=this.to,a=this.options.endPointOffset?this.options.endPointOffset.to:0;g.id===this.from.id&&(s=this.from,n=!0,a=this.options.endPointOffset?this.options.endPointOffset.from:0),!1===this.options.arrowStrikethrough&&(a=0);var l=0;do{A=.5*(r+o),t=this.getPoint(A,C);var d=Math.atan2(s.y-t.y,s.x-t.x),h=s.distanceToBorder(e,d)+a,c=Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2)),u=h-c;if(Math.abs(u)<I)break;u<0?!1===n?r=A:o=A:!1===n?o=A:r=A,++l}while(r<=o&&l<i);return Dl(Dl({},t),{},{t:A})}},{key:"_getDistanceToBezierEdge",value:function(g,e,t,A,C,i,I){var n,o,r,s,a,l=1e9,d=g,h=e;for(o=1;o<10;o++)r=.1*o,s=Math.pow(1-r,2)*g+2*r*(1-r)*I.x+Math.pow(r,2)*t,a=Math.pow(1-r,2)*e+2*r*(1-r)*I.y+Math.pow(r,2)*A,o>0&&(l=(n=this._getDistanceToLine(d,h,s,a,C,i))<l?n:l),d=s,h=a;return l}},{key:"_bezierCurve",value:function(g,e,t,A){g.beginPath(),g.moveTo(this.fromPoint.x,this.fromPoint.y),null!=t&&null!=t.x?null!=A&&null!=A.x?g.bezierCurveTo(t.x,t.y,A.x,A.y,this.toPoint.x,this.toPoint.y):g.quadraticCurveTo(t.x,t.y,this.toPoint.x,this.toPoint.y):g.lineTo(this.toPoint.x,this.toPoint.y),this.drawBackground(g,e),this.enableShadow(g,e),g.stroke(),this.disableShadow(g,e)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}}]),t}();function Pl(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Sl=function(g){Qr(t,Rl);var e=Pl(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C)).via=i.via,i._boundFunction=function(){i.positionBezierNode()},i._body.emitter.on("_repositionBezierNodes",i._boundFunction),i}return UA(t,[{key:"setOptions",value:function(g){Cl(Xr(t.prototype),"setOptions",this).call(this,g);var e=!1;this.options.physics!==g.physics&&(e=!0),this.options=g,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),!0===e&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],void 0===this.from||void 0===this.to||!1===this.options.physics||this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),void 0!==this.via&&(delete this._body.nodes[this.via.id],this.via=void 0,!0)}},{key:"setupSupportNode",value:function(){if(void 0===this.via){var g="edgeId:"+this.id,e=this._body.functions.createNode({id:g,shape:"circle",physics:!0,hidden:!0});this._body.nodes[g]=e,this.via=e,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){void 0!==this.via&&void 0!==this.from&&void 0!==this.to?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):void 0!==this.via&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(g,e,t){this._bezierCurve(g,e,t)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.via;if(this.from===this.to){var t=this._getCircleData(),A=pC(t,3),C=A[0],i=A[1],I=A[2],n=2*Math.PI*(1-g);return{x:C+I*Math.sin(n),y:i+I-I*(1-Math.cos(n))}}return{x:Math.pow(1-g,2)*this.fromPoint.x+2*g*(1-g)*e.x+Math.pow(g,2)*this.toPoint.x,y:Math.pow(1-g,2)*this.fromPoint.y+2*g*(1-g)*e.y+Math.pow(g,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(g,e){return this._findBorderPositionBezier(g,e,this.via)}},{key:"_getDistanceToEdge",value:function(g,e,t,A,C,i){return this._getDistanceToBezierEdge(g,e,t,A,C,i,this.via)}}]),t}();function Ml(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Bl=function(g){Qr(t,Rl);var e=Ml(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"_line",value:function(g,e,t){this._bezierCurve(g,e,t)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var g,e,t=this.options.smooth.roundness,A=this.options.smooth.type,C=Math.abs(this.from.x-this.to.x),i=Math.abs(this.from.y-this.to.y);if("discrete"===A||"diagonalCross"===A){var I,n;I=n=C<=i?t*i:t*C,this.from.x>this.to.x&&(I=-I),this.from.y>=this.to.y&&(n=-n);var o=this.from.x+I,r=this.from.y+n;return"discrete"===A&&(C<=i?o=C<t*i?this.from.x:o:r=i<t*C?this.from.y:r),{x:o,y:r}}if("straightCross"===A){var s=(1-t)*C,a=(1-t)*i;return C<=i?(s=0,this.from.y<this.to.y&&(a=-a)):(this.from.x<this.to.x&&(s=-s),a=0),{x:this.to.x+s,y:this.to.y+a}}if("horizontal"===A){var l=(1-t)*C;return this.from.x<this.to.x&&(l=-l),{x:this.to.x+l,y:this.from.y}}if("vertical"===A){var d=(1-t)*i;return this.from.y<this.to.y&&(d=-d),{x:this.from.x,y:this.to.y+d}}if("curvedCW"===A){C=this.to.x-this.from.x,i=this.from.y-this.to.y;var h=Math.sqrt(C*C+i*i),c=Math.PI,u=(Math.atan2(i,C)+(.5*t+.5)*c)%(2*c);return{x:this.from.x+(.5*t+.5)*h*Math.sin(u),y:this.from.y+(.5*t+.5)*h*Math.cos(u)}}if("curvedCCW"===A){C=this.to.x-this.from.x,i=this.from.y-this.to.y;var p=Math.sqrt(C*C+i*i),f=Math.PI,v=(Math.atan2(i,C)+(.5*-t+.5)*f)%(2*f);return{x:this.from.x+(.5*t+.5)*p*Math.sin(v),y:this.from.y+(.5*t+.5)*p*Math.cos(v)}}g=e=C<=i?t*i:t*C,this.from.x>this.to.x&&(g=-g),this.from.y>=this.to.y&&(e=-e);var m=this.from.x+g,y=this.from.y+e;return C<=i?m=this.from.x<=this.to.x?this.to.x<m?this.to.x:m:this.to.x>m?this.to.x:m:y=this.from.y>=this.to.y?this.to.y>y?this.to.y:y:this.to.y<y?this.to.y:y,{x:m,y:y}}},{key:"_findBorderPosition",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._findBorderPositionBezier(g,e,t.via)}},{key:"_getDistanceToEdge",value:function(g,e,t,A,C,i){var I=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(g,e,t,A,C,i,I)}},{key:"getPoint",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),t=g,A=Math.pow(1-t,2)*this.fromPoint.x+2*t*(1-t)*e.x+Math.pow(t,2)*this.toPoint.x,C=Math.pow(1-t,2)*this.fromPoint.y+2*t*(1-t)*e.y+Math.pow(t,2)*this.toPoint.y;return{x:A,y:C}}}]),t}();function zl(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Fl=function(g){Qr(t,Rl);var e=zl(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"_getDistanceToBezierEdge2",value:function(g,e,t,A,C,i,I,n){for(var o=1e9,r=g,s=e,a=[0,0,0,0],l=1;l<10;l++){var d=.1*l;a[0]=Math.pow(1-d,3),a[1]=3*d*Math.pow(1-d,2),a[2]=3*Math.pow(d,2)*(1-d),a[3]=Math.pow(d,3);var h=a[0]*g+a[1]*I.x+a[2]*n.x+a[3]*t,c=a[0]*e+a[1]*I.y+a[2]*n.y+a[3]*A;if(l>0){var u=this._getDistanceToLine(r,s,h,c,C,i);o=u<o?u:o}r=h,s=c}return o}}]),t}();function Zl(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var jl=function(g){Qr(t,Fl);var e=Zl(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"_line",value:function(g,e,t){var A=t[0],C=t[1];this._bezierCurve(g,e,A,C)}},{key:"_getViaCoordinates",value:function(){var g,e,t,A,C=this.from.x-this.to.x,i=this.from.y-this.to.y,I=this.options.smooth.roundness;return(Math.abs(C)>Math.abs(i)||!0===this.options.smooth.forceDirection||"horizontal"===this.options.smooth.forceDirection)&&"vertical"!==this.options.smooth.forceDirection?(e=this.from.y,A=this.to.y,g=this.from.x-I*C,t=this.to.x+I*C):(e=this.from.y-I*i,A=this.to.y+I*i,g=this.from.x,t=this.to.x),[{x:g,y:e},{x:t,y:A}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(g,e){return this._findBorderPositionBezier(g,e)}},{key:"_getDistanceToEdge",value:function(g,e,t,A,C,i){var I=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates(),n=pC(I,2),o=n[0],r=n[1];return this._getDistanceToBezierEdge2(g,e,t,A,C,i,o,r)}},{key:"getPoint",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),t=pC(e,2),A=t[0],C=t[1],i=g,I=[Math.pow(1-i,3),3*i*Math.pow(1-i,2),3*Math.pow(i,2)*(1-i),Math.pow(i,3)],n=I[0]*this.fromPoint.x+I[1]*A.x+I[2]*C.x+I[3]*this.toPoint.x,o=I[0]*this.fromPoint.y+I[1]*A.y+I[2]*C.y+I[3]*this.toPoint.y;return{x:n,y:o}}}]),t}();function Ll(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Gl=function(g){Qr(t,Ol);var e=Ll(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"_line",value:function(g,e){g.beginPath(),g.moveTo(this.fromPoint.x,this.fromPoint.y),g.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(g,e),g.stroke(),this.disableShadow(g,e)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(g){return{x:(1-g)*this.fromPoint.x+g*this.toPoint.x,y:(1-g)*this.fromPoint.y+g*this.toPoint.y}}},{key:"_findBorderPosition",value:function(g,e){var t=this.to,A=this.from;g.id===this.from.id&&(t=this.from,A=this.to);var C=Math.atan2(t.y-A.y,t.x-A.x),i=t.x-A.x,I=t.y-A.y,n=Math.sqrt(i*i+I*I),o=(n-g.distanceToBorder(e,C))/n;return{x:(1-o)*A.x+o*t.x,y:(1-o)*A.y+o*t.y,t:0}}},{key:"_getDistanceToEdge",value:function(g,e,t,A,C,i){return this._getDistanceToLine(g,e,t,A,C,i)}}]),t}(),Vl=function(){function g(e,t,A,C,i){if(YA(this,g),void 0===t)throw new Error("No body provided");this.options=uo(C),this.globalOptions=C,this.defaultOptions=i,this.body=t,this.imagelist=A,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new sa(this.body,this.options,!0),this.setOptions(e)}return UA(g,[{key:"setOptions",value:function(e){if(e){var t=void 0!==e.physics&&this.options.physics!==e.physics||void 0!==e.hidden&&(this.options.hidden||!1)!==(e.hidden||!1)||void 0!==e.from&&this.options.from!==e.from||void 0!==e.to&&this.options.to!==e.to;g.parseOptions(this.options,e,!0,this.globalOptions),void 0!==e.id&&(this.id=e.id),void 0!==e.from&&(this.fromId=e.from),void 0!==e.to&&(this.toId=e.to),void 0!==e.title&&(this.title=e.title),void 0!==e.value&&(e.value=Xs(e.value));var A=[e,this.options,this.defaultOptions];return this.chooser=ea("edge",A),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var g=!0===this.options.arrows.to||!0===this.options.arrows.to.enabled,e=!0===this.options.arrows.from||!0===this.options.arrows.from.enabled,t=!0===this.options.arrows.middle||!0===this.options.arrows.middle.enabled,A=this.options.color.inherit,C={toArrow:g,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:t,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:e,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:A?void 0:this.options.color.color,inheritsColor:A,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(!0===this.chooser){if(this.selected){var i=this.options.selectionWidth;"function"==typeof i?C.width=i(C.width):"number"==typeof i&&(C.width+=i),C.width=Math.max(C.width,.3/this.body.view.scale),C.color=this.options.color.highlight,C.shadow=this.options.shadow.enabled}else if(this.hover){var I=this.options.hoverWidth;"function"==typeof I?C.width=I(C.width):"number"==typeof I&&(C.width+=I),C.width=Math.max(C.width,.3/this.body.view.scale),C.color=this.options.color.hover,C.shadow=this.options.shadow.enabled}}else"function"==typeof this.chooser&&(this.chooser(C,this.options.id,this.selected,this.hover),void 0!==C.color&&(C.inheritsColor=!1),!1===C.shadow&&(C.shadowColor===this.options.shadow.color&&C.shadowSize===this.options.shadow.size&&C.shadowX===this.options.shadow.x&&C.shadowY===this.options.shadow.y||(C.shadow=!0)));else C.shadow=this.options.shadow.enabled,C.width=Math.max(C.width,.3/this.body.view.scale);return C}},{key:"updateLabelModule",value:function(g){var e=[g,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,e),void 0!==this.labelModule.baseSize&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var g=this.options.smooth,e=!1,t=!0;return void 0!==this.edgeType&&((this.edgeType instanceof Sl&&!0===g.enabled&&"dynamic"===g.type||this.edgeType instanceof jl&&!0===g.enabled&&"cubicBezier"===g.type||this.edgeType instanceof Bl&&!0===g.enabled&&"dynamic"!==g.type&&"cubicBezier"!==g.type||this.edgeType instanceof Gl&&!1===g.type.enabled)&&(t=!1),!0===t&&(e=this.cleanup())),!0===t?!0===g.enabled?"dynamic"===g.type?(e=!0,this.edgeType=new Sl(this.options,this.body,this.labelModule)):"cubicBezier"===g.type?this.edgeType=new jl(this.options,this.body,this.labelModule):this.edgeType=new Bl(this.options,this.body,this.labelModule):this.edgeType=new Gl(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),e}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=void 0!==this.from&&void 0!==this.to,!0===this.connected?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(g,e,t){if(void 0!==this.options.value){var A=this.options.scaling.customScalingFunction(g,e,t,this.options.value),C=this.options.scaling.max-this.options.scaling.min;if(!0===this.options.scaling.label.enabled){var i=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+A*i}this.options.width=this.options.scaling.min+A*C}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){"function"==typeof this.options.hoverWidth?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,"function"==typeof this.options.selectionWidth?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(g){var e=this.getFormattingValues();if(!e.hidden){var t=this.edgeType.getViaNode();this.edgeType.drawLine(g,e,this.selected,this.hover,t),this.drawLabel(g,t)}}},{key:"drawArrows",value:function(g){var e=this.getFormattingValues();if(!e.hidden){var t=this.edgeType.getViaNode(),A={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,e.fromArrow&&(A.from=this.edgeType.getArrowData(g,"from",t,this.selected,this.hover,e),!1===e.arrowStrikethrough&&(this.edgeType.fromPoint=A.from.core),e.fromArrowSrc&&(A.from.image=this.imagelist.load(e.fromArrowSrc)),e.fromArrowImageWidth&&(A.from.imageWidth=e.fromArrowImageWidth),e.fromArrowImageHeight&&(A.from.imageHeight=e.fromArrowImageHeight)),e.toArrow&&(A.to=this.edgeType.getArrowData(g,"to",t,this.selected,this.hover,e),!1===e.arrowStrikethrough&&(this.edgeType.toPoint=A.to.core),e.toArrowSrc&&(A.to.image=this.imagelist.load(e.toArrowSrc)),e.toArrowImageWidth&&(A.to.imageWidth=e.toArrowImageWidth),e.toArrowImageHeight&&(A.to.imageHeight=e.toArrowImageHeight)),e.middleArrow&&(A.middle=this.edgeType.getArrowData(g,"middle",t,this.selected,this.hover,e),e.middleArrowSrc&&(A.middle.image=this.imagelist.load(e.middleArrowSrc)),e.middleArrowImageWidth&&(A.middle.imageWidth=e.middleArrowImageWidth),e.middleArrowImageHeight&&(A.middle.imageHeight=e.middleArrowImageHeight)),e.fromArrow&&this.edgeType.drawArrowHead(g,e,this.selected,this.hover,A.from),e.middleArrow&&this.edgeType.drawArrowHead(g,e,this.selected,this.hover,A.middle),e.toArrow&&this.edgeType.drawArrowHead(g,e,this.selected,this.hover,A.to)}}},{key:"drawLabel",value:function(g,e){if(void 0!==this.options.label){var t,A=this.from,C=this.to;if(this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(g,this.selected,this.hover),A.id!=C.id){this.labelModule.pointToSelf=!1,t=this.edgeType.getPoint(.5,e),g.save();var i=this._getRotation(g);0!=i.angle&&(g.translate(i.x,i.y),g.rotate(i.angle)),this.labelModule.draw(g,t.x,t.y,this.selected,this.hover),g.restore()}else{this.labelModule.pointToSelf=!0;var I=Ca(g,this.options.selfReference.angle,this.options.selfReference.size,A);t=this._pointOnCircle(I.x,I.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(g,t.x,t.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(g){var e=[];if(this.labelModule.visible()){var t=this._getRotation();ta(this.labelModule.getSize(),g,t)&&e.push({edgeId:this.id,labelId:0})}var A={left:g.x,top:g.y};return this.isOverlappingWith(A)&&e.push({edgeId:this.id}),e}},{key:"isOverlappingWith",value:function(g){if(this.connected){var e=this.from.x,t=this.from.y,A=this.to.x,C=this.to.y,i=g.left,I=g.top;return this.edgeType.getDistanceToEdge(e,t,A,C,i,I)<10}return!1}},{key:"_getRotation",value:function(g){var e=this.edgeType.getViaNode(),t=this.edgeType.getPoint(.5,e);void 0!==g&&this.labelModule.calculateLabelSize(g,this.selected,this.hover,t.x,t.y);var A={x:t.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible())return A;if("horizontal"===this.options.font.align)return A;var C=this.from.y-this.to.y,i=this.from.x-this.to.x,I=Math.atan2(C,i);return(I<-1&&i<0||I>0&&i<0)&&(I+=Math.PI),A.angle=I,A}},{key:"_pointOnCircle",value:function(g,e,t,A){return{x:g+t*Math.cos(A),y:e-t*Math.sin(A)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return void 0!==this.body.nodes[this.fromId]&&void 0!==this.body.nodes[this.toId]}}],[{key:"parseOptions",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},C=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(qn(i,g,e,t),void 0!==e.endPointOffset&&void 0!==e.endPointOffset.from&&(Sr(e.endPointOffset.from)?g.endPointOffset.from=e.endPointOffset.from:(g.endPointOffset.from=void 0!==A.endPointOffset.from?A.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),void 0!==e.endPointOffset&&void 0!==e.endPointOffset.to&&(Sr(e.endPointOffset.to)?g.endPointOffset.to=e.endPointOffset.to:(g.endPointOffset.to=void 0!==A.endPointOffset.to?A.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),Aa(e.label)?g.label=e.label:Aa(g.label)||(g.label=void 0),po(g,e,"smooth",A),po(g,e,"shadow",A),po(g,e,"background",A),void 0!==e.dashes&&null!==e.dashes?g.dashes=e.dashes:!0===t&&null===e.dashes&&(g.dashes=Yi(A.dashes)),void 0!==e.scaling&&null!==e.scaling?(void 0!==e.scaling.min&&(g.scaling.min=e.scaling.min),void 0!==e.scaling.max&&(g.scaling.max=e.scaling.max),po(g.scaling,e.scaling,"label",A.scaling)):!0===t&&null===e.scaling&&(g.scaling=Yi(A.scaling)),void 0!==e.arrows&&null!==e.arrows)if("string"==typeof e.arrows){var I=e.arrows.toLowerCase();g.arrows.to.enabled=-1!=ji(I).call(I,"to"),g.arrows.middle.enabled=-1!=ji(I).call(I,"middle"),g.arrows.from.enabled=-1!=ji(I).call(I,"from")}else{if("object"!==mC(e.arrows))throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+Xi(e.arrows));po(g.arrows,e.arrows,"to",A.arrows),po(g.arrows,e.arrows,"middle",A.arrows),po(g.arrows,e.arrows,"from",A.arrows)}else!0===t&&null===e.arrows&&(g.arrows=Yi(A.arrows));if(void 0!==e.color&&null!==e.color){var n=Hn(e.color)?{color:e.color,highlight:e.color,hover:e.color,inherit:!1,opacity:1}:e.color,o=g.color;if(C)go(o,A.color,!1,t);else for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&delete o[r];if(Hn(o))o.color=o,o.highlight=o,o.hover=o,o.inherit=!1,void 0===n.opacity&&(o.opacity=1);else{var s=!1;void 0!==n.color&&(o.color=n.color,s=!0),void 0!==n.highlight&&(o.highlight=n.highlight,s=!0),void 0!==n.hover&&(o.hover=n.hover,s=!0),void 0!==n.inherit&&(o.inherit=n.inherit),void 0!==n.opacity&&(o.opacity=Math.min(1,Math.max(0,n.opacity))),!0===s?o.inherit=!1:void 0===o.inherit&&(o.inherit="from")}}else!0===t&&null===e.color&&(g.color=uo(A.color));!0===t&&null===e.font&&(g.font=uo(A.font)),Object.prototype.hasOwnProperty.call(e,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),g.selfReference.size=e.selfReferenceSize)}}]),g}(),Yl=function(){function g(e,t,A){var C,i=this;YA(this,g),this.body=e,this.images=t,this.groups=A,this.body.functions.createEdge=jg(C=this.create).call(C,this),this.edgesListeners={add:function(g,e){i.add(e.items)},update:function(g,e){i.update(e.items)},remove:function(g,e){i.remove(e.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(g,e,t,A){if(e===g)return.5;var C=1/(e-g);return Math.max(0,(A-g)*C)}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},go(this.options,this.defaultOptions),this.bindEventListeners()}return UA(g,[{key:"bindEventListeners",value:function(){var g,e,t=this;this.body.emitter.on("_forceDisableDynamicCurves",(function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"dynamic"===g&&(g="continuous");var A=!1;for(var C in t.body.edges)if(Object.prototype.hasOwnProperty.call(t.body.edges,C)){var i=t.body.edges[C],I=t.body.data.edges.get(C);if(null!=I){var n=I.smooth;void 0!==n&&!0===n.enabled&&"dynamic"===n.type&&(void 0===g?i.setOptions({smooth:!1}):i.setOptions({smooth:{type:g}}),A=!0)}}!0===e&&!0===A&&t.body.emitter.emit("_dataChanged")})),this.body.emitter.on("_dataUpdated",(function(){t.reconnectEdges()})),this.body.emitter.on("refreshEdges",jg(g=this.refresh).call(g,this)),this.body.emitter.on("refresh",jg(e=this.refresh).call(e,this)),this.body.emitter.on("destroy",(function(){Co(t.edgesListeners,(function(g,e){t.body.data.edges&&t.body.data.edges.off(e,g)})),delete t.body.functions.createEdge,delete t.edgesListeners.add,delete t.edgesListeners.update,delete t.edgesListeners.remove,delete t.edgesListeners}))}},{key:"setOptions",value:function(g){if(void 0!==g){Vl.parseOptions(this.options,g,!0,this.defaultOptions,!0);var e=!1;if(void 0!==g.smooth)for(var t in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,t)&&(e=this.body.edges[t].updateEdgeType()||e);if(void 0!==g.font)for(var A in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,A)&&this.body.edges[A].updateLabelModule();void 0===g.hidden&&void 0===g.physics&&!0!==e||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(g){var e=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=this.body.data.edges;if(Us("id",g))this.body.data.edges=g;else if(TC(g))this.body.data.edges=new _s,this.body.data.edges.add(g);else{if(g)throw new TypeError("Array or DataSet expected");this.body.data.edges=new _s}if(A&&Co(this.edgesListeners,(function(g,e){A.off(e,g)})),this.body.edges={},this.body.data.edges){Co(this.edgesListeners,(function(g,t){e.body.data.edges.on(t,g)}));var C=this.body.data.edges.getIds();this.add(C,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),!1===t&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(g){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=this.body.edges,A=this.body.data.edges,C=0;C<g.length;C++){var i=g[C],I=t[i];I&&I.disconnect();var n=A.get(i,{showInternalIds:!0});t[i]=this.create(n)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),!1===e&&this.body.emitter.emit("_dataChanged")}},{key:"update",value:function(g){for(var e=this.body.edges,t=this.body.data.edges,A=!1,C=0;C<g.length;C++){var i=g[C],I=t.get(i),n=e[i];void 0!==n?(n.disconnect(),A=n.setOptions(I)||A,n.connect()):(this.body.edges[i]=this.create(I),A=!0)}!0===A?(this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),this.body.emitter.emit("_dataChanged")):this.body.emitter.emit("_dataUpdated")}},{key:"remove",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(0!==g.length){var t=this.body.edges;Co(g,(function(g){var e=t[g];void 0!==e&&e.remove()})),e&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var g=this;Co(this.body.edges,(function(e,t){var A=g.body.data.edges.get(t);void 0!==A&&e.setOptions(A)}))}},{key:"create",value:function(g){return new Vl(g,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var g,e=this.body.nodes,t=this.body.edges;for(g in e)Object.prototype.hasOwnProperty.call(e,g)&&(e[g].edges=[]);for(g in t)if(Object.prototype.hasOwnProperty.call(t,g)){var A=t[g];A.from=null,A.to=null,A.connect()}}},{key:"getConnectedNodes",value:function(g){var e=[];if(void 0!==this.body.edges[g]){var t=this.body.edges[g];void 0!==t.fromId&&e.push(t.fromId),void 0!==t.toId&&e.push(t.toId)}return e}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var g=this,e=[];Co(this.body.edges,(function(t,A){var C=g.body.nodes[t.toId],i=g.body.nodes[t.fromId];void 0!==C&&!0===C.isCluster||void 0!==i&&!0===i.isCluster||void 0!==C&&void 0!==i||e.push(A)})),this.remove(e,!1)}},{key:"_addMissingEdges",value:function(){var g=this.body.data.edges;if(null!=g){var e=this.body.edges,t=[];YC(g).call(g,(function(g,A){void 0===e[A]&&t.push(A)})),this.add(t,!0)}}}]),g}(),Wl=function(){function g(e,t,A){YA(this,g),this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(A),this._rng=Zn("BARNES HUT SOLVER")}return UA(g,[{key:"setOptions",value:function(g){this.options=g,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"solve",value:function(){if(0!==this.options.gravitationalConstant&&this.physicsBody.physicsNodeIndices.length>0){var g,e=this.body.nodes,t=this.physicsBody.physicsNodeIndices,A=t.length,C=this._formBarnesHutTree(e,t);this.barnesHutTree=C;for(var i=0;i<A;i++)(g=e[t[i]]).options.mass>0&&this._getForceContributions(C.root,g)}}},{key:"_getForceContributions",value:function(g,e){this._getForceContribution(g.children.NW,e),this._getForceContribution(g.children.NE,e),this._getForceContribution(g.children.SW,e),this._getForceContribution(g.children.SE,e)}},{key:"_getForceContribution",value:function(g,e){if(g.childrenCount>0){var t=g.centerOfMass.x-e.x,A=g.centerOfMass.y-e.y,C=Math.sqrt(t*t+A*A);C*g.calcSize>this.thetaInversed?this._calculateForces(C,t,A,e,g):4===g.childrenCount?this._getForceContributions(g,e):g.children.data.id!=e.id&&this._calculateForces(C,t,A,e,g)}}},{key:"_calculateForces",value:function(g,e,t,A,C){0===g&&(e=g=.1),this.overlapAvoidanceFactor<1&&A.shape.radius&&(g=Math.max(.1+this.overlapAvoidanceFactor*A.shape.radius,g-A.shape.radius));var i=this.options.gravitationalConstant*C.mass*A.options.mass/Math.pow(g,3),I=e*i,n=t*i;this.physicsBody.forces[A.id].x+=I,this.physicsBody.forces[A.id].y+=n}},{key:"_formBarnesHutTree",value:function(g,e){for(var t,A=e.length,C=g[e[0]].x,i=g[e[0]].y,I=g[e[0]].x,n=g[e[0]].y,o=1;o<A;o++){var r=g[e[o]],s=r.x,a=r.y;r.options.mass>0&&(s<C&&(C=s),s>I&&(I=s),a<i&&(i=a),a>n&&(n=a))}var l=Math.abs(I-C)-Math.abs(n-i);l>0?(i-=.5*l,n+=.5*l):(C+=.5*l,I-=.5*l);var d=Math.max(1e-5,Math.abs(I-C)),h=.5*d,c=.5*(C+I),u=.5*(i+n),p={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:c-h,maxX:c+h,minY:u-h,maxY:u+h},size:d,calcSize:1/d,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(p.root);for(var f=0;f<A;f++)(t=g[e[f]]).options.mass>0&&this._placeInTree(p.root,t);return p}},{key:"_updateBranchMass",value:function(g,e){var t=g.centerOfMass,A=g.mass+e.options.mass,C=1/A;t.x=t.x*g.mass+e.x*e.options.mass,t.x*=C,t.y=t.y*g.mass+e.y*e.options.mass,t.y*=C,g.mass=A;var i=Math.max(Math.max(e.height,e.radius),e.width);g.maxWidth=g.maxWidth<i?i:g.maxWidth}},{key:"_placeInTree",value:function(g,e,t){1==t&&void 0!==t||this._updateBranchMass(g,e);var A,C=g.children.NW.range;A=C.maxX>e.x?C.maxY>e.y?"NW":"SW":C.maxY>e.y?"NE":"SE",this._placeInRegion(g,e,A)}},{key:"_placeInRegion",value:function(g,e,t){var A=g.children[t];switch(A.childrenCount){case 0:A.children.data=e,A.childrenCount=1,this._updateBranchMass(A,e);break;case 1:A.children.data.x===e.x&&A.children.data.y===e.y?(e.x+=this._rng(),e.y+=this._rng()):(this._splitBranch(A),this._placeInTree(A,e));break;case 4:this._placeInTree(A,e)}}},{key:"_splitBranch",value:function(g){var e=null;1===g.childrenCount&&(e=g.children.data,g.mass=0,g.centerOfMass.x=0,g.centerOfMass.y=0),g.childrenCount=4,g.children.data=null,this._insertRegion(g,"NW"),this._insertRegion(g,"NE"),this._insertRegion(g,"SW"),this._insertRegion(g,"SE"),null!=e&&this._placeInTree(g,e)}},{key:"_insertRegion",value:function(g,e){var t,A,C,i,I=.5*g.size;switch(e){case"NW":t=g.range.minX,A=g.range.minX+I,C=g.range.minY,i=g.range.minY+I;break;case"NE":t=g.range.minX+I,A=g.range.maxX,C=g.range.minY,i=g.range.minY+I;break;case"SW":t=g.range.minX,A=g.range.minX+I,C=g.range.minY+I,i=g.range.maxY;break;case"SE":t=g.range.minX+I,A=g.range.maxX,C=g.range.minY+I,i=g.range.maxY}g.children[e]={centerOfMass:{x:0,y:0},mass:0,range:{minX:t,maxX:A,minY:C,maxY:i},size:.5*g.size,calcSize:2*g.calcSize,children:{data:null},maxWidth:0,level:g.level+1,childrenCount:0}}},{key:"_debug",value:function(g,e){void 0!==this.barnesHutTree&&(g.lineWidth=1,this._drawBranch(this.barnesHutTree.root,g,e))}},{key:"_drawBranch",value:function(g,e,t){void 0===t&&(t="#FF0000"),4===g.childrenCount&&(this._drawBranch(g.children.NW,e),this._drawBranch(g.children.NE,e),this._drawBranch(g.children.SE,e),this._drawBranch(g.children.SW,e)),e.strokeStyle=t,e.beginPath(),e.moveTo(g.range.minX,g.range.minY),e.lineTo(g.range.maxX,g.range.minY),e.stroke(),e.beginPath(),e.moveTo(g.range.maxX,g.range.minY),e.lineTo(g.range.maxX,g.range.maxY),e.stroke(),e.beginPath(),e.moveTo(g.range.maxX,g.range.maxY),e.lineTo(g.range.minX,g.range.maxY),e.stroke(),e.beginPath(),e.moveTo(g.range.minX,g.range.maxY),e.lineTo(g.range.minX,g.range.minY),e.stroke()}}]),g}(),_l=function(){function g(e,t,A){YA(this,g),this._rng=Zn("REPULSION SOLVER"),this.body=e,this.physicsBody=t,this.setOptions(A)}return UA(g,[{key:"setOptions",value:function(g){this.options=g}},{key:"solve",value:function(){for(var g,e,t,A,C,i,I,n,o=this.body.nodes,r=this.physicsBody.physicsNodeIndices,s=this.physicsBody.forces,a=this.options.nodeDistance,l=-2/3/a,d=0;d<r.length-1;d++){I=o[r[d]];for(var h=d+1;h<r.length;h++)g=(n=o[r[h]]).x-I.x,e=n.y-I.y,0===(t=Math.sqrt(g*g+e*e))&&(g=t=.1*this._rng()),t<2*a&&(i=t<.5*a?1:l*t+1.3333333333333333,A=g*(i/=t),C=e*i,s[I.id].x-=A,s[I.id].y-=C,s[n.id].x+=A,s[n.id].y+=C)}}}]),g}(),Ul=function(){function g(e,t,A){YA(this,g),this.body=e,this.physicsBody=t,this.setOptions(A)}return UA(g,[{key:"setOptions",value:function(g){this.options=g,this.overlapAvoidanceFactor=Math.max(0,Math.min(1,this.options.avoidOverlap||0))}},{key:"solve",value:function(){for(var g=this.body.nodes,e=this.physicsBody.physicsNodeIndices,t=this.physicsBody.forces,A=this.options.nodeDistance,C=0;C<e.length-1;C++)for(var i=g[e[C]],I=C+1;I<e.length;I++){var n=g[e[I]];if(i.level===n.level){var o=A+this.overlapAvoidanceFactor*((i.shape.radius||0)/2+(n.shape.radius||0)/2),r=n.x-i.x,s=n.y-i.y,a=Math.sqrt(r*r+s*s),l=void 0;l=a<o?-Math.pow(.05*a,2)+Math.pow(.05*o,2):0,0!==a&&(l/=a);var d=r*l,h=s*l;t[i.id].x-=d,t[i.id].y-=h,t[n.id].x+=d,t[n.id].y+=h}}}}]),g}(),Ql=function(){function g(e,t,A){YA(this,g),this.body=e,this.physicsBody=t,this.setOptions(A)}return UA(g,[{key:"setOptions",value:function(g){this.options=g}},{key:"solve",value:function(){for(var g,e,t,A,C,i=this.physicsBody.physicsEdgeIndices,I=this.body.edges,n=0;n<i.length;n++)!0===(e=I[i[n]]).connected&&e.toId!==e.fromId&&void 0!==this.body.nodes[e.toId]&&void 0!==this.body.nodes[e.fromId]&&(void 0!==e.edgeType.via?(g=void 0===e.options.length?this.options.springLength:e.options.length,t=e.to,A=e.edgeType.via,C=e.from,this._calculateSpringForce(t,A,.5*g),this._calculateSpringForce(A,C,.5*g)):(g=void 0===e.options.length?1.5*this.options.springLength:e.options.length,this._calculateSpringForce(e.from,e.to,g)))}},{key:"_calculateSpringForce",value:function(g,e,t){var A=g.x-e.x,C=g.y-e.y,i=Math.max(Math.sqrt(A*A+C*C),.01),I=this.options.springConstant*(t-i)/i,n=A*I,o=C*I;void 0!==this.physicsBody.forces[g.id]&&(this.physicsBody.forces[g.id].x+=n,this.physicsBody.forces[g.id].y+=o),void 0!==this.physicsBody.forces[e.id]&&(this.physicsBody.forces[e.id].x-=n,this.physicsBody.forces[e.id].y-=o)}}]),g}(),Hl=function(){function g(e,t,A){YA(this,g),this.body=e,this.physicsBody=t,this.setOptions(A)}return UA(g,[{key:"setOptions",value:function(g){this.options=g}},{key:"solve",value:function(){for(var g,e,t,A,C,i,I,n,o,r,s=this.body.edges,a=.5,l=this.physicsBody.physicsEdgeIndices,d=this.physicsBody.physicsNodeIndices,h=this.physicsBody.forces,c=0;c<d.length;c++){var u=d[c];h[u].springFx=0,h[u].springFy=0}for(var p=0;p<l.length;p++)!0===(e=s[l[p]]).connected&&(g=void 0===e.options.length?this.options.springLength:e.options.length,t=e.from.x-e.to.x,A=e.from.y-e.to.y,n=0===(n=Math.sqrt(t*t+A*A))?.01:n,C=t*(I=this.options.springConstant*(g-n)/n),i=A*I,e.to.level!=e.from.level?(void 0!==h[e.toId]&&(h[e.toId].springFx-=C,h[e.toId].springFy-=i),void 0!==h[e.fromId]&&(h[e.fromId].springFx+=C,h[e.fromId].springFy+=i)):(void 0!==h[e.toId]&&(h[e.toId].x-=a*C,h[e.toId].y-=a*i),void 0!==h[e.fromId]&&(h[e.fromId].x+=a*C,h[e.fromId].y+=a*i)));I=1;for(var f=0;f<d.length;f++){var v=d[f];o=Math.min(I,Math.max(-I,h[v].springFx)),r=Math.min(I,Math.max(-I,h[v].springFy)),h[v].x+=o,h[v].y+=r}for(var m=0,y=0,b=0;b<d.length;b++){var w=d[b];m+=h[w].x,y+=h[w].y}for(var k=m/d.length,x=y/d.length,E=0;E<d.length;E++){var O=d[E];h[O].x-=k,h[O].y-=x}}}]),g}(),Kl=function(){function g(e,t,A){YA(this,g),this.body=e,this.physicsBody=t,this.setOptions(A)}return UA(g,[{key:"setOptions",value:function(g){this.options=g}},{key:"solve",value:function(){for(var g,e,t,A,C=this.body.nodes,i=this.physicsBody.physicsNodeIndices,I=this.physicsBody.forces,n=0;n<i.length;n++){g=-(A=C[i[n]]).x,e=-A.y,t=Math.sqrt(g*g+e*e),this._calculateForces(t,g,e,I,A)}}},{key:"_calculateForces",value:function(g,e,t,A,C){var i=0===g?0:this.options.centralGravity/g;A[C.id].x=e*i,A[C.id].y=t*i}}]),g}();function Xl(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Jl=function(g){Qr(t,Wl);var e=Xl(t);function t(g,A,C){var i;return YA(this,t),(i=e.call(this,g,A,C))._rng=Zn("FORCE ATLAS 2 BASED REPULSION SOLVER"),i}return UA(t,[{key:"_calculateForces",value:function(g,e,t,A,C){0===g&&(e=g=.1*this._rng()),this.overlapAvoidanceFactor<1&&A.shape.radius&&(g=Math.max(.1+this.overlapAvoidanceFactor*A.shape.radius,g-A.shape.radius));var i=A.edges.length+1,I=this.options.gravitationalConstant*C.mass*A.options.mass*i/Math.pow(g,2),n=e*I,o=t*I;this.physicsBody.forces[A.id].x+=n,this.physicsBody.forces[A.id].y+=o}}]),t}();function ql(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var $l=function(g){Qr(t,Kl);var e=ql(t);function t(g,A,C){return YA(this,t),e.call(this,g,A,C)}return UA(t,[{key:"_calculateForces",value:function(g,e,t,A,C){if(g>0){var i=C.edges.length+1,I=this.options.centralGravity*i*C.options.mass;A[C.id].x=e*I,A[C.id].y=t*I}}}]),t}(),gd=function(){function g(e){YA(this,g),this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Rg(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return UA(g,[{key:"bindEventListeners",value:function(){var g=this;this.body.emitter.on("initPhysics",(function(){g.initPhysics()})),this.body.emitter.on("_layoutFailed",(function(){g.layoutFailed=!0})),this.body.emitter.on("resetPhysics",(function(){g.stopSimulation(),g.ready=!1})),this.body.emitter.on("disablePhysics",(function(){g.physicsEnabled=!1,g.stopSimulation()})),this.body.emitter.on("restorePhysics",(function(){g.setOptions(g.options),!0===g.ready&&g.startSimulation()})),this.body.emitter.on("startSimulation",(function(){!0===g.ready&&g.startSimulation()})),this.body.emitter.on("stopSimulation",(function(){g.stopSimulation()})),this.body.emitter.on("destroy",(function(){g.stopSimulation(!1),g.body.emitter.off()})),this.body.emitter.on("_dataChanged",(function(){g.updatePhysicsData()}))}},{key:"setOptions",value:function(g){if(void 0!==g)if(!1===g)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(!0===g)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,$n(["stabilization"],this.options,g),po(this.options,g,"stabilization"),void 0===g.enabled&&(this.options.enabled=!0),!1===this.options.enabled&&(this.physicsEnabled=!1,this.stopSimulation());var e=this.options.wind;e&&(("number"!=typeof e.x||Nr(e.x))&&(e.x=0),("number"!=typeof e.y||Nr(e.y))&&(e.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var g;"forceAtlas2Based"===this.options.solver?(g=this.options.forceAtlas2Based,this.nodesSolver=new Jl(this.body,this.physicsBody,g),this.edgesSolver=new Ql(this.body,this.physicsBody,g),this.gravitySolver=new $l(this.body,this.physicsBody,g)):"repulsion"===this.options.solver?(g=this.options.repulsion,this.nodesSolver=new _l(this.body,this.physicsBody,g),this.edgesSolver=new Ql(this.body,this.physicsBody,g),this.gravitySolver=new Kl(this.body,this.physicsBody,g)):"hierarchicalRepulsion"===this.options.solver?(g=this.options.hierarchicalRepulsion,this.nodesSolver=new Ul(this.body,this.physicsBody,g),this.edgesSolver=new Hl(this.body,this.physicsBody,g),this.gravitySolver=new Kl(this.body,this.physicsBody,g)):(g=this.options.barnesHut,this.nodesSolver=new Wl(this.body,this.physicsBody,g),this.edgesSolver=new Ql(this.body,this.physicsBody,g),this.gravitySolver=new Kl(this.body,this.physicsBody,g)),this.modelOptions=g}},{key:"initPhysics",value:function(){!0===this.physicsEnabled&&!0===this.options.enabled?!0===this.options.stabilization.enabled?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){var g;!0===this.physicsEnabled&&!0===this.options.enabled?(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),void 0===this.viewFunction&&(this.viewFunction=jg(g=this.simulationStep).call(g,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))):this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var g=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.stabilized=!0,!0===g&&this._emitStabilized(),void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,!0===g&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var g=zC();this.physicsTick(),(zC()-g<.4*this.simulationInterval||!0===this.runDoubleSpeed)&&!1===this.stabilized&&(this.physicsTick(),this.runDoubleSpeed=!0),!0===this.stabilized&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var g=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||!0===this.startedStabilization)&&gI((function(){g.body.emitter.emit("stabilized",{iterations:e}),g.startedStabilization=!1,g.stabilizationIterations=0}),0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){!0===this._evaluateStepQuality()?this.timestep=1.2*this.timestep:this.timestep/1.2<this.options.timestep?this.timestep=this.options.timestep:(this.adaptiveCounter=-1,this.timestep=Math.max(this.options.timestep,this.timestep/1.2))}},{key:"physicsTick",value:function(){if(this._startStabilizing(),!0!==this.stabilized){if(!0===this.adaptiveTimestep&&!0===this.adaptiveTimestepEnabled)this.adaptiveCounter%this.adaptiveInterval==0?(this.timestep=2*this.timestep,this.physicsStep(),this.revert(),this.timestep=.5*this.timestep,this.physicsStep(),this.physicsStep(),this.adjustTimeStep()):this.physicsStep(),this.adaptiveCounter+=1;else this.timestep=this.options.timestep,this.physicsStep();!0===this.stabilized&&this.revert(),this.stabilizationIterations++}}},{key:"updatePhysicsData",value:function(){this.physicsBody.forces={},this.physicsBody.physicsNodeIndices=[],this.physicsBody.physicsEdgeIndices=[];var g=this.body.nodes,e=this.body.edges;for(var t in g)Object.prototype.hasOwnProperty.call(g,t)&&!0===g[t].options.physics&&this.physicsBody.physicsNodeIndices.push(g[t].id);for(var A in e)Object.prototype.hasOwnProperty.call(e,A)&&!0===e[A].options.physics&&this.physicsBody.physicsEdgeIndices.push(e[A].id);for(var C=0;C<this.physicsBody.physicsNodeIndices.length;C++){var i=this.physicsBody.physicsNodeIndices[C];this.physicsBody.forces[i]={x:0,y:0},void 0===this.physicsBody.velocities[i]&&(this.physicsBody.velocities[i]={x:0,y:0})}for(var I in this.physicsBody.velocities)void 0===g[I]&&delete this.physicsBody.velocities[I]}},{key:"revert",value:function(){var g=BC(this.previousStates),e=this.body.nodes,t=this.physicsBody.velocities;this.referenceState={};for(var A=0;A<g.length;A++){var C=g[A];void 0!==e[C]?!0===e[C].options.physics&&(this.referenceState[C]={positions:{x:e[C].x,y:e[C].y}},t[C].x=this.previousStates[C].vx,t[C].y=this.previousStates[C].vy,e[C].x=this.previousStates[C].x,e[C].y=this.previousStates[C].y):delete this.previousStates[C]}}},{key:"_evaluateStepQuality",value:function(){var g,e,t=this.body.nodes,A=this.referenceState;for(var C in this.referenceState)if(Object.prototype.hasOwnProperty.call(this.referenceState,C)&&void 0!==t[C]&&(g=t[C].x-A[C].positions.x,e=t[C].y-A[C].positions.y,Math.sqrt(Math.pow(g,2)+Math.pow(e,2))>.3))return!1;return!0}},{key:"moveNodes",value:function(){for(var g=this.physicsBody.physicsNodeIndices,e=0,t=0,A=0;A<g.length;A++){var C=g[A],i=this._performStep(C);e=Math.max(e,i),t+=i}this.adaptiveTimestepEnabled=t/g.length<5,this.stabilized=e<this.options.minVelocity}},{key:"calculateComponentVelocity",value:function(g,e,t){g+=(e-this.modelOptions.damping*g)/t*this.timestep;var A=this.options.maxVelocity||1e9;return Math.abs(g)>A&&(g=g>0?A:-A),g}},{key:"_performStep",value:function(g){var e=this.body.nodes[g],t=this.physicsBody.forces[g];this.options.wind&&(t.x+=this.options.wind.x,t.y+=this.options.wind.y);var A=this.physicsBody.velocities[g];return this.previousStates[g]={x:e.x,y:e.y,vx:A.x,vy:A.y},!1===e.options.fixed.x?(A.x=this.calculateComponentVelocity(A.x,t.x,e.options.mass),e.x+=A.x*this.timestep):(t.x=0,A.x=0),!1===e.options.fixed.y?(A.y=this.calculateComponentVelocity(A.y,t.y,e.options.mass),e.y+=A.y*this.timestep):(t.y=0,A.y=0),Math.sqrt(Math.pow(A.x,2)+Math.pow(A.y,2))}},{key:"_freezeNodes",value:function(){var g=this.body.nodes;for(var e in g)if(Object.prototype.hasOwnProperty.call(g,e)&&g[e].x&&g[e].y){var t=g[e].options.fixed;this.freezeCache[e]={x:t.x,y:t.y},t.x=!0,t.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var g=this.body.nodes;for(var e in g)Object.prototype.hasOwnProperty.call(g,e)&&void 0!==this.freezeCache[e]&&(g[e].options.fixed.x=this.freezeCache[e].x,g[e].options.fixed.y=this.freezeCache[e].y);this.freezeCache={}}},{key:"stabilize",value:function(){var g=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.stabilization.iterations;"number"!=typeof e&&(e=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",e)),0!==this.physicsBody.physicsNodeIndices.length?(this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,!0===this.options.stabilization.onlyDynamicEdges&&this._freezeNodes(),this.stabilizationIterations=0,gI((function(){return g._stabilizationBatch()}),0)):this.ready=!0}},{key:"_startStabilizing",value:function(){return!0!==this.startedStabilization&&(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var g=this,e=function(){return!1===g.stabilized&&g.stabilizationIterations<g.targetIterations},t=function(){g.body.emitter.emit("stabilizationProgress",{iterations:g.stabilizationIterations,total:g.targetIterations})};this._startStabilizing()&&t();for(var A,C=0;e()&&C<this.options.stabilization.updateInterval;)this.physicsTick(),C++;(t(),e())?gI(jg(A=this._stabilizationBatch).call(A,this),0):this._finalizeStabilization()}},{key:"_finalizeStabilization",value:function(){this.body.emitter.emit("_allowRedraw"),!0===this.options.stabilization.fit&&this.body.emitter.emit("fit"),!0===this.options.stabilization.onlyDynamicEdges&&this._restoreFrozenNodes(),this.body.emitter.emit("stabilizationIterationsDone"),this.body.emitter.emit("_requestRedraw"),!0===this.stabilized?this._emitStabilized():this.startSimulation(),this.ready=!0}},{key:"_drawForces",value:function(g){for(var e=0;e<this.physicsBody.physicsNodeIndices.length;e++){var t=this.physicsBody.physicsNodeIndices[e],A=this.body.nodes[t],C=this.physicsBody.forces[t],i=Math.sqrt(Math.pow(C.x,2)+Math.pow(C.x,2)),I=Math.min(Math.max(5,i),15),n=3*I,o=ao((180-180*Math.min(1,Math.max(0,.03*i)))/360,1,1),r={x:A.x+20*C.x,y:A.y+20*C.y};g.lineWidth=I,g.strokeStyle=o,g.beginPath(),g.moveTo(A.x,A.y),g.lineTo(r.x,r.y),g.stroke();var s=Math.atan2(C.y,C.x);g.fillStyle=o,kl.draw(g,{type:"arrow",point:r,angle:s,length:n}),AI(g).call(g)}}}]),g}(),ed=function(){function g(){YA(this,g)}return UA(g,null,[{key:"getRange",value:function(g){var e,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],A=1e9,C=-1e9,i=1e9,I=-1e9;if(t.length>0)for(var n=0;n<t.length;n++)i>(e=g[t[n]]).shape.boundingBox.left&&(i=e.shape.boundingBox.left),I<e.shape.boundingBox.right&&(I=e.shape.boundingBox.right),A>e.shape.boundingBox.top&&(A=e.shape.boundingBox.top),C<e.shape.boundingBox.bottom&&(C=e.shape.boundingBox.bottom);return 1e9===i&&-1e9===I&&1e9===A&&-1e9===C&&(A=0,C=0,i=0,I=0),{minX:i,maxX:I,minY:A,maxY:C}}},{key:"getRangeCore",value:function(g){var e,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],A=1e9,C=-1e9,i=1e9,I=-1e9;if(t.length>0)for(var n=0;n<t.length;n++)i>(e=g[t[n]]).x&&(i=e.x),I<e.x&&(I=e.x),A>e.y&&(A=e.y),C<e.y&&(C=e.y);return 1e9===i&&-1e9===I&&1e9===A&&-1e9===C&&(A=0,C=0,i=0,I=0),{minX:i,maxX:I,minY:A,maxY:C}}},{key:"findCenter",value:function(g){return{x:.5*(g.maxX+g.minX),y:.5*(g.maxY+g.minY)}}},{key:"cloneOptions",value:function(g,e){var t={};return void 0===e||"node"===e?(go(t,g.options,!0),t.x=g.x,t.y=g.y,t.amountOfConnections=g.edges.length):go(t,g.options,!0),t}}]),g}();function td(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Ad=function(g){Qr(t,qa);var e=td(t);function t(g,A,C,i,I,n){var o;return YA(this,t),(o=e.call(this,g,A,C,i,I,n)).isCluster=!0,o.containedNodes={},o.containedEdges={},o}return UA(t,[{key:"_openChildCluster",value:function(g){var e=this,t=this.body.nodes[g];if(void 0===this.containedNodes[g])throw new Error("node with id: "+g+" not in current cluster");if(!t.isCluster)throw new Error("node with id: "+g+" is not a cluster");delete this.containedNodes[g],Co(t.edges,(function(g){delete e.containedEdges[g.id]})),Co(t.containedNodes,(function(g,t){e.containedNodes[t]=g})),t.containedNodes={},Co(t.containedEdges,(function(g,t){e.containedEdges[t]=g})),t.containedEdges={},Co(t.edges,(function(g){Co(e.edges,(function(t){var A,C,i=ji(A=t.clusteringEdgeReplacingIds).call(A,g.id);-1!==i&&(Co(g.clusteringEdgeReplacingIds,(function(g){t.clusteringEdgeReplacingIds.push(g),e.body.edges[g].edgeReplacedById=t.id})),gi(C=t.clusteringEdgeReplacingIds).call(C,i,1))}))})),t.edges=[]}}]),t}(),Cd=function(){function g(e){var t=this;YA(this,g),this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Rg(this.options,this.defaultOptions),this.body.emitter.on("_resetData",(function(){t.clusteredNodes={},t.clusteredEdges={}}))}return UA(g,[{key:"clusterByHubsize",value:function(g,e){void 0===g?g=this._getHubSize():"object"===mC(g)&&(e=this._checkOptions(g),g=this._getHubSize());for(var t=[],A=0;A<this.body.nodeIndices.length;A++){var C=this.body.nodes[this.body.nodeIndices[A]];C.edges.length>=g&&t.push(C.id)}for(var i=0;i<t.length;i++)this.clusterByConnection(t[i],e,!0);this.body.emitter.emit("_dataChanged")}},{key:"cluster",value:function(){var g=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===e.joinCondition)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);var A={},C={};Co(this.body.nodes,(function(t,i){t.options&&!0===e.joinCondition(t.options)&&(A[i]=t,Co(t.edges,(function(e){void 0===g.clusteredEdges[e.id]&&(C[e.id]=e)})))})),this._cluster(A,C,e,t)}},{key:"clusterByEdgeCount",value:function(g,e){var t=this,A=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=this._checkOptions(e);for(var C,i,I,n=[],o={},r=function(A){var r={},s={},a=t.body.nodeIndices[A],l=t.body.nodes[a];if(void 0===o[a]){I=0,i=[];for(var d=0;d<l.edges.length;d++)C=l.edges[d],void 0===t.clusteredEdges[C.id]&&(C.toId!==C.fromId&&I++,i.push(C));if(I===g){for(var h=function(g){if(void 0===e.joinCondition||null===e.joinCondition)return!0;var t=ed.cloneOptions(g);return e.joinCondition(t)},c=!0,u=0;u<i.length;u++){C=i[u];var p=t._getConnectedId(C,a);if(!h(l)){c=!1;break}s[C.id]=C,r[a]=l,r[p]=t.body.nodes[p],o[a]=!0}if(BC(r).length>0&&BC(s).length>0&&!0===c){var f=function(){for(var g=0;g<n.length;++g)for(var e in r)if(void 0!==n[g].nodes[e])return n[g]}();if(void 0!==f){for(var v in r)void 0===f.nodes[v]&&(f.nodes[v]=r[v]);for(var m in s)void 0===f.edges[m]&&(f.edges[m]=s[m])}else n.push({nodes:r,edges:s})}}}},s=0;s<this.body.nodeIndices.length;s++)r(s);for(var a=0;a<n.length;a++)this._cluster(n[a].nodes,n[a].edges,e,!1);!0===A&&this.body.emitter.emit("_dataChanged")}},{key:"clusterOutliers",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(1,g,e)}},{key:"clusterBridges",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(2,g,e)}},{key:"clusterByConnection",value:function(g,e){var t,A=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===g)throw new Error("No nodeId supplied to clusterByConnection!");if(void 0===this.body.nodes[g])throw new Error("The nodeId given to clusterByConnection does not exist!");var C=this.body.nodes[g];void 0===(e=this._checkOptions(e,C)).clusterNodeProperties.x&&(e.clusterNodeProperties.x=C.x),void 0===e.clusterNodeProperties.y&&(e.clusterNodeProperties.y=C.y),void 0===e.clusterNodeProperties.fixed&&(e.clusterNodeProperties.fixed={},e.clusterNodeProperties.fixed.x=C.options.fixed.x,e.clusterNodeProperties.fixed.y=C.options.fixed.y);var i={},I={},n=C.id,o=ed.cloneOptions(C);i[n]=C;for(var r=0;r<C.edges.length;r++){var s=C.edges[r];if(void 0===this.clusteredEdges[s.id]){var a=this._getConnectedId(s,n);if(void 0===this.clusteredNodes[a])if(a!==n)if(void 0===e.joinCondition)I[s.id]=s,i[a]=this.body.nodes[a];else{var l=ed.cloneOptions(this.body.nodes[a]);!0===e.joinCondition(o,l)&&(I[s.id]=s,i[a]=this.body.nodes[a])}else I[s.id]=s}}var d=SC(t=BC(i)).call(t,(function(g){return i[g].id}));for(var h in i)if(Object.prototype.hasOwnProperty.call(i,h))for(var c=i[h],u=0;u<c.edges.length;u++){var p=c.edges[u];ji(d).call(d,this._getConnectedId(p,c.id))>-1&&(I[p.id]=p)}this._cluster(i,I,e,A)}},{key:"_createClusterEdges",value:function(g,e,t,A){for(var C,i,I,n,o,r,s=BC(g),a=[],l=0;l<s.length;l++){I=g[i=s[l]];for(var d=0;d<I.edges.length;d++)C=I.edges[d],void 0===this.clusteredEdges[C.id]&&(C.toId==C.fromId?e[C.id]=C:C.toId==i?(n=t.id,r=o=C.fromId):(n=C.toId,o=t.id,r=n),void 0===g[r]&&a.push({edge:C,fromId:o,toId:n}))}for(var h=[],c=function(g){for(var e=0;e<h.length;e++){var t=h[e],A=g.fromId===t.fromId&&g.toId===t.toId,C=g.fromId===t.toId&&g.toId===t.fromId;if(A||C)return t}return null},u=0;u<a.length;u++){var p=a[u],f=p.edge,v=c(p);null===v?(v=this._createClusteredEdge(p.fromId,p.toId,f,A),h.push(v)):v.clusteringEdgeReplacingIds.push(f.id),this.body.edges[f.id].edgeReplacedById=v.id,this._backupEdgeOptions(f),f.setOptions({physics:!1})}}},{key:"_checkOptions",value:function(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0===g.clusterEdgeProperties&&(g.clusterEdgeProperties={}),void 0===g.clusterNodeProperties&&(g.clusterNodeProperties={}),g}},{key:"_cluster",value:function(g,e,t){var A=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],C=[];for(var i in g)Object.prototype.hasOwnProperty.call(g,i)&&void 0!==this.clusteredNodes[i]&&C.push(i);for(var I=0;I<C.length;++I)delete g[C[I]];if(0!=BC(g).length&&(1!=BC(g).length||1==t.clusterNodeProperties.allowSingleNodeCluster)){var n=go({},t.clusterNodeProperties);if(void 0!==t.processProperties){var o=[];for(var r in g)if(Object.prototype.hasOwnProperty.call(g,r)){var s=ed.cloneOptions(g[r]);o.push(s)}var a=[];for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)&&"clusterEdge:"!==l.substr(0,12)){var d=ed.cloneOptions(e[l],"edge");a.push(d)}if(!(n=t.processProperties(n,o,a)))throw new Error("The processProperties function does not return properties!")}void 0===n.id&&(n.id="cluster:"+Bs());var h=n.id;void 0===n.label&&(n.label="cluster");var c=void 0;void 0===n.x&&(c=this._getClusterPosition(g),n.x=c.x),void 0===n.y&&(void 0===c&&(c=this._getClusterPosition(g)),n.y=c.y),n.id=h;var u=this.body.functions.createNode(n,Ad);u.containedNodes=g,u.containedEdges=e,u.clusterEdgeProperties=t.clusterEdgeProperties,this.body.nodes[n.id]=u,this._clusterEdges(g,e,n,t.clusterEdgeProperties),n.id=void 0,!0===A&&this.body.emitter.emit("_dataChanged")}}},{key:"_backupEdgeOptions",value:function(g){void 0===this.clusteredEdges[g.id]&&(this.clusteredEdges[g.id]={physics:g.options.physics})}},{key:"_restoreEdge",value:function(g){var e=this.clusteredEdges[g.id];void 0!==e&&(g.setOptions({physics:e.physics}),delete this.clusteredEdges[g.id])}},{key:"isCluster",value:function(g){return void 0!==this.body.nodes[g]?!0===this.body.nodes[g].isCluster:(console.error("Node does not exist."),!1)}},{key:"_getClusterPosition",value:function(g){for(var e,t=BC(g),A=g[t[0]].x,C=g[t[0]].x,i=g[t[0]].y,I=g[t[0]].y,n=1;n<t.length;n++)A=(e=g[t[n]]).x<A?e.x:A,C=e.x>C?e.x:C,i=e.y<i?e.y:i,I=e.y>I?e.y:I;return{x:.5*(A+C),y:.5*(i+I)}}},{key:"openCluster",value:function(g,e){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===g)throw new Error("No clusterNodeId supplied to openCluster.");var A=this.body.nodes[g];if(void 0===A)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(!0!==A.isCluster||void 0===A.containedNodes||void 0===A.containedEdges)throw new Error("The node:"+g+" is not a valid cluster.");var C=this.findNode(g),i=ji(C).call(C,g)-1;if(i>=0){var I=C[i],n=this.body.nodes[I];return n._openChildCluster(g),delete this.body.nodes[g],void(!0===t&&this.body.emitter.emit("_dataChanged"))}var o=A.containedNodes,r=A.containedEdges;if(void 0!==e&&void 0!==e.releaseFunction&&"function"==typeof e.releaseFunction){var s={},a={x:A.x,y:A.y};for(var l in o)if(Object.prototype.hasOwnProperty.call(o,l)){var d=this.body.nodes[l];s[l]={x:d.x,y:d.y}}var h=e.releaseFunction(a,s);for(var c in o)if(Object.prototype.hasOwnProperty.call(o,c)){var u=this.body.nodes[c];void 0!==h[c]&&(u.x=void 0===h[c].x?A.x:h[c].x,u.y=void 0===h[c].y?A.y:h[c].y)}}else Co(o,(function(g){!1===g.options.fixed.x&&(g.x=A.x),!1===g.options.fixed.y&&(g.y=A.y)}));for(var p in o)if(Object.prototype.hasOwnProperty.call(o,p)){var f=this.body.nodes[p];f.vx=A.vx,f.vy=A.vy,f.setOptions({physics:!0}),delete this.clusteredNodes[p]}for(var v=[],m=0;m<A.edges.length;m++)v.push(A.edges[m]);for(var y=0;y<v.length;y++){for(var b=v[y],w=this._getConnectedId(b,g),k=this.clusteredNodes[w],x=0;x<b.clusteringEdgeReplacingIds.length;x++){var E=b.clusteringEdgeReplacingIds[x],O=this.body.edges[E];if(void 0!==O)if(void 0!==k){var T=this.body.nodes[k.clusterId];T.containedEdges[O.id]=O,delete r[O.id];var D=O.fromId,N=O.toId;O.toId==w?N=k.clusterId:D=k.clusterId,this._createClusteredEdge(D,N,O,T.clusterEdgeProperties,{hidden:!1,physics:!0})}else this._restoreEdge(O)}b.remove()}for(var R in r)Object.prototype.hasOwnProperty.call(r,R)&&this._restoreEdge(r[R]);delete this.body.nodes[g],!0===t&&this.body.emitter.emit("_dataChanged")}},{key:"getNodesInCluster",value:function(g){var e=[];if(!0===this.isCluster(g)){var t=this.body.nodes[g].containedNodes;for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&e.push(this.body.nodes[A].id)}return e}},{key:"findNode",value:function(g){for(var e,t=[],A=0;void 0!==this.clusteredNodes[g]&&A<100;){if(void 0===(e=this.body.nodes[g]))return[];t.push(e.id),g=this.clusteredNodes[g].clusterId,A++}return void 0===(e=this.body.nodes[g])?[]:(t.push(e.id),HC(t).call(t),t)}},{key:"updateClusteredNode",value:function(g,e){if(void 0===g)throw new Error("No clusteredNodeId supplied to updateClusteredNode.");if(void 0===e)throw new Error("No newOptions supplied to updateClusteredNode.");if(void 0===this.body.nodes[g])throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist.");this.body.nodes[g].setOptions(e),this.body.emitter.emit("_dataChanged")}},{key:"updateEdge",value:function(g,e){if(void 0===g)throw new Error("No startEdgeId supplied to updateEdge.");if(void 0===e)throw new Error("No newOptions supplied to updateEdge.");if(void 0===this.body.edges[g])throw new Error("The startEdgeId supplied to updateEdge does not exist.");for(var t=this.getClusteredEdges(g),A=0;A<t.length;A++){this.body.edges[t[A]].setOptions(e)}this.body.emitter.emit("_dataChanged")}},{key:"getClusteredEdges",value:function(g){for(var e=[],t=0;void 0!==g&&void 0!==this.body.edges[g]&&t<100;)e.push(this.body.edges[g].id),g=this.body.edges[g].edgeReplacedById,t++;return HC(e).call(e),e}},{key:"getBaseEdge",value:function(g){return this.getBaseEdges(g)[0]}},{key:"getBaseEdges",value:function(g){for(var e=[g],t=[],A=[],C=0;e.length>0&&C<100;){var i=e.pop();if(void 0!==i){var I=this.body.edges[i];if(void 0!==I){C++;var n=I.clusteringEdgeReplacingIds;if(void 0===n)A.push(i);else for(var o=0;o<n.length;++o){var r=n[o];-1===ji(e).call(e,n)&&-1===ji(t).call(t,n)&&e.push(r)}t.push(i)}}}return A}},{key:"_getConnectedId",value:function(g,e){return g.toId!=e?g.toId:(g.fromId,g.fromId)}},{key:"_getHubSize",value:function(){for(var g=0,e=0,t=0,A=0,C=0;C<this.body.nodeIndices.length;C++){var i=this.body.nodes[this.body.nodeIndices[C]];i.edges.length>A&&(A=i.edges.length),g+=i.edges.length,e+=Math.pow(i.edges.length,2),t+=1}g/=t;var I=(e/=t)-Math.pow(g,2),n=Math.sqrt(I),o=Math.floor(g+2*n);return o>A&&(o=A),o}},{key:"_createClusteredEdge",value:function(g,e,t,A,C){var i=ed.cloneOptions(t,"edge");go(i,A),i.from=g,i.to=e,i.id="clusterEdge:"+Bs(),void 0!==C&&go(i,C);var I=this.body.functions.createEdge(i);return I.clusteringEdgeReplacingIds=[t.id],I.connect(),this.body.edges[I.id]=I,I}},{key:"_clusterEdges",value:function(g,e,t,A){if(e instanceof Vl){var C=e,i={};i[C.id]=C,e=i}if(g instanceof qa){var I=g,n={};n[I.id]=I,g=n}if(null==t)throw new Error("_clusterEdges: parameter clusterNode required");for(var o in void 0===A&&(A=t.clusterEdgeProperties),this._createClusterEdges(g,e,t,A),e)if(Object.prototype.hasOwnProperty.call(e,o)&&void 0!==this.body.edges[o]){var r=this.body.edges[o];this._backupEdgeOptions(r),r.setOptions({physics:!1})}for(var s in g)Object.prototype.hasOwnProperty.call(g,s)&&(this.clusteredNodes[s]={clusterId:t.id,node:this.body.nodes[s]},this.body.nodes[s].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(g){if(void 0!==g){var e=this.clusteredNodes[g];if(void 0!==e){var t=e.clusterId;if(void 0!==t)return this.body.nodes[t]}}}},{key:"_filter",value:function(g,e){var t=[];return Co(g,(function(g){e(g)&&t.push(g)})),t}},{key:"_updateState",value:function(){var g,e=this,t=[],A={},C=function(g){Co(e.body.nodes,(function(e){!0===e.isCluster&&g(e)}))};for(g in this.clusteredNodes){if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,g))void 0===this.body.nodes[g]&&t.push(g)}C((function(g){for(var e=0;e<t.length;e++)delete g.containedNodes[t[e]]}));for(var i=0;i<t.length;i++)delete this.clusteredNodes[t[i]];Co(this.clusteredEdges,(function(g){var t=e.body.edges[g];void 0!==t&&t.endPointsValid()||(A[g]=g)})),C((function(g){Co(g.containedEdges,(function(g,e){g.endPointsValid()||A[e]||(A[e]=e)}))})),Co(this.body.edges,(function(g,t){var C=!0,i=g.clusteringEdgeReplacingIds;if(void 0!==i){var I=0;Co(i,(function(g){var t=e.body.edges[g];void 0!==t&&t.endPointsValid()&&(I+=1)})),C=I>0}g.endPointsValid()&&C||(A[t]=t)})),C((function(g){Co(A,(function(t){delete g.containedEdges[t],Co(g.edges,(function(C,i){C.id!==t?C.clusteringEdgeReplacingIds=e._filter(C.clusteringEdgeReplacingIds,(function(g){return!A[g]})):g.edges[i]=null})),g.edges=e._filter(g.edges,(function(g){return null!==g}))}))})),Co(A,(function(g){delete e.clusteredEdges[g]})),Co(A,(function(g){delete e.body.edges[g]})),Co(BC(this.body.edges),(function(g){var t=e.body.edges[g],A=e._isClusteredNode(t.fromId)||e._isClusteredNode(t.toId);if(A!==e._isClusteredEdge(t.id))if(A){var C=e._getClusterNodeForNode(t.fromId);void 0!==C&&e._clusterEdges(e.body.nodes[t.fromId],t,C);var i=e._getClusterNodeForNode(t.toId);void 0!==i&&e._clusterEdges(e.body.nodes[t.toId],t,i)}else delete e._clusterEdges[g],e._restoreEdge(t)}));for(var I=!1,n=!0,o=function(){var g=[];C((function(e){var t=BC(e.containedNodes).length,A=!0===e.options.allowSingleNodeCluster;(A&&t<1||!A&&t<2)&&g.push(e.id)}));for(var t=0;t<g.length;++t)e.openCluster(g[t],{},!1);n=g.length>0,I=I||n};n;)o();I&&this._updateState()}},{key:"_isClusteredNode",value:function(g){return void 0!==this.clusteredNodes[g]}},{key:"_isClusteredEdge",value:function(g){return void 0!==this.clusteredEdges[g]}}]),g}();function id(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return Id(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return Id(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function Id(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}var nd=function(){function g(e,t){var A;YA(this,g),void 0!==window&&(A=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),window.requestAnimationFrame=void 0===A?function(g){g()}:A,this.body=e,this.canvas=t,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Rg(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return UA(g,[{key:"bindEventListeners",value:function(){var g,e=this;this.body.emitter.on("dragStart",(function(){e.dragging=!0})),this.body.emitter.on("dragEnd",(function(){e.dragging=!1})),this.body.emitter.on("zoom",(function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=gI((function(){var g;e.zooming=!1,jg(g=e._requestRedraw).call(g,e)()}),250)})),this.body.emitter.on("_resizeNodes",(function(){e._resizeNodes()})),this.body.emitter.on("_redraw",(function(){!1===e.renderingActive&&e._redraw()})),this.body.emitter.on("_blockRedraw",(function(){e.allowRedraw=!1})),this.body.emitter.on("_allowRedraw",(function(){e.allowRedraw=!0,e.redrawRequested=!1})),this.body.emitter.on("_requestRedraw",jg(g=this._requestRedraw).call(g,this)),this.body.emitter.on("_startRendering",(function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()})),this.body.emitter.on("_stopRendering",(function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0})),this.body.emitter.on("destroy",(function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,!0===e.requiresTimeout?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()}))}},{key:"setOptions",value:function(g){if(void 0!==g){qn(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,g)}}},{key:"_requestNextFrame",value:function(g,e){if("undefined"!=typeof window){var t,A=window;return!0===this.requiresTimeout?t=gI(g,e):A.requestAnimationFrame&&(t=A.requestAnimationFrame(g)),t}}},{key:"_startRendering",value:function(){var g;!0===this.renderingActive&&(void 0===this.renderTimer&&(this.renderTimer=this._requestNextFrame(jg(g=this._renderStep).call(g,this),this.simulationInterval)))}},{key:"_renderStep",value:function(){!0===this.renderingActive&&(this.renderTimer=void 0,!0===this.requiresTimeout&&this._startRendering(),this._redraw(),!1===this.requiresTimeout&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var g=this;!0!==this.redrawRequested&&!1===this.renderingActive&&!0===this.allowRedraw&&(this.redrawRequested=!0,this._requestNextFrame((function(){g._redraw(!1)}),0))}},{key:"_redraw",value:function(){var g=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!0===this.allowRedraw){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var e={drawExternalLabels:null};0!==this.canvas.frame.canvas.width&&0!==this.canvas.frame.canvas.height||this.canvas.setSize(),this.canvas.setTransform();var t=this.canvas.getContext(),A=this.canvas.frame.canvas.clientWidth,C=this.canvas.frame.canvas.clientHeight;if(t.clearRect(0,0,A,C),0===this.canvas.frame.clientWidth)return;if(t.save(),t.translate(this.body.view.translation.x,this.body.view.translation.y),t.scale(this.body.view.scale,this.body.view.scale),t.beginPath(),this.body.emitter.emit("beforeDrawing",t),t.closePath(),!1===g&&(!1===this.dragging||!0===this.dragging&&!1===this.options.hideEdgesOnDrag)&&(!1===this.zooming||!0===this.zooming&&!1===this.options.hideEdgesOnZoom)&&this._drawEdges(t),!1===this.dragging||!0===this.dragging&&!1===this.options.hideNodesOnDrag){var i=this._drawNodes(t,g),I=i.drawExternalLabels;e.drawExternalLabels=I}!1===g&&(!1===this.dragging||!0===this.dragging&&!1===this.options.hideEdgesOnDrag)&&(!1===this.zooming||!0===this.zooming&&!1===this.options.hideEdgesOnZoom)&&this._drawArrows(t),null!=e.drawExternalLabels&&e.drawExternalLabels(),!1===g&&this._drawSelectionBox(t),t.beginPath(),this.body.emitter.emit("afterDrawing",t),t.closePath(),t.restore(),!0===g&&t.clearRect(0,0,A,C)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var g=this.canvas.getContext();g.save(),g.translate(this.body.view.translation.x,this.body.view.translation.y),g.scale(this.body.view.scale,this.body.view.scale);var e,t=this.body.nodes;for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&((e=t[A]).resize(g),e.updateBoundingBox(g,e.selected));g.restore()}},{key:"_drawNodes",value:function(g){for(var e,t,A=arguments.length>1&&void 0!==arguments[1]&&arguments[1],C=this.body.nodes,i=this.body.nodeIndices,I=[],n=[],o=20,r=this.canvas.DOMtoCanvas({x:-o,y:-o}),s=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+o,y:this.canvas.frame.canvas.clientHeight+o}),a={top:r.y,left:r.x,bottom:s.y,right:s.x},l=[],d=0;d<i.length;d++)if((e=C[i[d]]).hover)n.push(i[d]);else if(e.isSelected())I.push(i[d]);else if(!0===A){var h=e.draw(g);null!=h.drawExternalLabel&&l.push(h.drawExternalLabel)}else if(!0===e.isBoundingBoxOverlappingWith(a)){var c=e.draw(g);null!=c.drawExternalLabel&&l.push(c.drawExternalLabel)}else e.updateBoundingBox(g,e.selected);var u=I.length,p=n.length;for(t=0;t<u;t++){var f=(e=C[I[t]]).draw(g);null!=f.drawExternalLabel&&l.push(f.drawExternalLabel)}for(t=0;t<p;t++){var v=(e=C[n[t]]).draw(g);null!=v.drawExternalLabel&&l.push(v.drawExternalLabel)}return{drawExternalLabels:function(){var g,e=id(l);try{for(e.s();!(g=e.n()).done;){(0,g.value)()}}catch(g){e.e(g)}finally{e.f()}}}}},{key:"_drawEdges",value:function(g){for(var e=this.body.edges,t=this.body.edgeIndices,A=0;A<t.length;A++){var C=e[t[A]];!0===C.connected&&C.draw(g)}}},{key:"_drawArrows",value:function(g){for(var e=this.body.edges,t=this.body.edgeIndices,A=0;A<t.length;A++){var C=e[t[A]];!0===C.connected&&C.drawArrows(g)}}},{key:"_determineBrowserMethod",value:function(){if("undefined"!=typeof window){var g=navigator.userAgent.toLowerCase();this.requiresTimeout=!1,(-1!=ji(g).call(g,"msie 9.0")||-1!=ji(g).call(g,"safari")&&ji(g).call(g,"chrome")<=-1)&&(this.requiresTimeout=!0)}else this.requiresTimeout=!0}},{key:"_drawSelectionBox",value:function(g){if(this.body.selectionBox.show){g.beginPath();var e=this.body.selectionBox.position.end.x-this.body.selectionBox.position.start.x,t=this.body.selectionBox.position.end.y-this.body.selectionBox.position.start.y;g.rect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,e,t),g.fillStyle="rgba(151, 194, 252, 0.2)",g.fillRect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,e,t),g.strokeStyle="rgba(151, 194, 252, 1)",g.stroke()}else g.closePath()}}]),g}(),od=eg.setInterval;function rd(g,e){e.inputHandler=function(g){g.isFirst&&e(g)},g.on("hammer.input",e.inputHandler)}function sd(g,e){return e.inputHandler=function(g){g.isFinal&&e(g)},g.on("hammer.input",e.inputHandler)}var ad=function(){function g(e){YA(this,g),this.body=e,this.pixelRatio=1,this.cameraState={},this.initialized=!1,this.canvasViewCenter={},this._cleanupCallbacks=[],this.options={},this.defaultOptions={autoResize:!0,height:"100%",width:"100%"},Rg(this.options,this.defaultOptions),this.bindEventListeners()}return UA(g,[{key:"bindEventListeners",value:function(){var g,e=this;this.body.emitter.once("resize",(function(g){0!==g.width&&(e.body.view.translation.x=.5*g.width),0!==g.height&&(e.body.view.translation.y=.5*g.height)})),this.body.emitter.on("setSize",jg(g=this.setSize).call(g,this)),this.body.emitter.on("destroy",(function(){e.hammerFrame.destroy(),e.hammer.destroy(),e._cleanUp()}))}},{key:"setOptions",value:function(g){var e,t,A,C,i,I=this;if(void 0!==g){qn(["width","height","autoResize"],this.options,g)}if(this._cleanUp(),!0===this.options.autoResize){var n;if(window.ResizeObserver){var o=new ResizeObserver((function(){!0===I.setSize()&&I.body.emitter.emit("_requestRedraw")})),r=this.frame;o.observe(r),this._cleanupCallbacks.push((function(){o.unobserve(r)}))}else{var s=od((function(){!0===I.setSize()&&I.body.emitter.emit("_requestRedraw")}),1e3);this._cleanupCallbacks.push((function(){clearInterval(s)}))}var a=jg(n=this._onResize).call(n,this);e=window,t="resize",A=a,e.addEventListener?(void 0===C&&(C=!1),"mousewheel"===t&&ri(i=navigator.userAgent).call(i,"Firefox")&&(t="DOMMouseScroll"),e.addEventListener(t,A,C)):e.attachEvent("on"+t,A),this._cleanupCallbacks.push((function(){!function(g,e,t,A){var C;g.removeEventListener?(void 0===A&&(A=!1),"mousewheel"===e&&ri(C=navigator.userAgent).call(C,"Firefox")&&(e="DOMMouseScroll"),g.removeEventListener(e,t,A)):g.detachEvent("on"+e,t)}(window,"resize",a)}))}}},{key:"_cleanUp",value:function(){var g,e,t;YC(g=HC(e=gi(t=this._cleanupCallbacks).call(t,0)).call(e)).call(g,(function(g){try{g()}catch(g){console.error(g)}}))}},{key:"_onResize",value:function(){this.setSize(),this.body.emitter.emit("_redraw")}},{key:"_getCameraState",value:function(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pixelRatio;!0===this.initialized&&(this.cameraState.previousWidth=this.frame.canvas.width/g,this.cameraState.previousHeight=this.frame.canvas.height/g,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/g,y:.5*this.frame.canvas.height/g}))}},{key:"_setCameraState",value:function(){if(void 0!==this.cameraState.scale&&0!==this.frame.canvas.clientWidth&&0!==this.frame.canvas.clientHeight&&0!==this.pixelRatio&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){var g=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,e=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,t=this.cameraState.scale;1!=g&&1!=e?t=.5*this.cameraState.scale*(g+e):1!=g?t=this.cameraState.scale*g:1!=e&&(t=this.cameraState.scale*e),this.body.view.scale=t;var A=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),C={x:A.x-this.cameraState.position.x,y:A.y-this.cameraState.position.y};this.body.view.translation.x+=C.x*this.body.view.scale,this.body.view.translation.y+=C.y*this.body.view.scale}}},{key:"_prepareValue",value:function(g){if("number"==typeof g)return g+"px";if("string"==typeof g){if(-1!==ji(g).call(g,"%")||-1!==ji(g).call(g,"px"))return g;if(-1===ji(g).call(g,"%"))return g+"px"}throw new Error("Could not use the value supplied for width or height:"+g)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var g=document.createElement("DIV");g.style.color="red",g.style.fontWeight="bold",g.style.padding="10px",g.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(g)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var g=this;void 0!==this.hammer&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Oo(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Oo.DIRECTION_ALL}),rd(this.hammer,(function(e){g.body.eventListeners.onTouch(e)})),this.hammer.on("tap",(function(e){g.body.eventListeners.onTap(e)})),this.hammer.on("doubletap",(function(e){g.body.eventListeners.onDoubleTap(e)})),this.hammer.on("press",(function(e){g.body.eventListeners.onHold(e)})),this.hammer.on("panstart",(function(e){g.body.eventListeners.onDragStart(e)})),this.hammer.on("panmove",(function(e){g.body.eventListeners.onDrag(e)})),this.hammer.on("panend",(function(e){g.body.eventListeners.onDragEnd(e)})),this.hammer.on("pinch",(function(e){g.body.eventListeners.onPinch(e)})),this.frame.canvas.addEventListener("wheel",(function(e){g.body.eventListeners.onMouseWheel(e)})),this.frame.canvas.addEventListener("mousemove",(function(e){g.body.eventListeners.onMouseMove(e)})),this.frame.canvas.addEventListener("contextmenu",(function(e){g.body.eventListeners.onContext(e)})),this.hammerFrame=new Oo(this.frame),sd(this.hammerFrame,(function(e){g.body.eventListeners.onRelease(e)}))}},{key:"setSize",value:function(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.width,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.height;g=this._prepareValue(g),e=this._prepareValue(e);var t=!1,A=this.frame.canvas.width,C=this.frame.canvas.height,i=this.pixelRatio;if(this._setPixelRatio(),g!=this.options.width||e!=this.options.height||this.frame.style.width!=g||this.frame.style.height!=e)this._getCameraState(i),this.frame.style.width=g,this.frame.style.height=e,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=g,this.options.height=e,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},t=!0;else{var I=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),n=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);this.frame.canvas.width===I&&this.frame.canvas.height===n||this._getCameraState(i),this.frame.canvas.width!==I&&(this.frame.canvas.width=I,t=!0),this.frame.canvas.height!==n&&(this.frame.canvas.height=n,t=!0)}return!0===t&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(A/this.pixelRatio),oldHeight:Math.round(C/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,t}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var g=this.getContext();if(void 0===g)throw new Error("Could not get canvax context");var e=1;return"undefined"!=typeof window&&(e=window.devicePixelRatio||1),e/(g.webkitBackingStorePixelRatio||g.mozBackingStorePixelRatio||g.msBackingStorePixelRatio||g.oBackingStorePixelRatio||g.backingStorePixelRatio||1)}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var g=this.getContext();if(void 0===g)throw new Error("Could not get canvax context");g.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(g){return(g-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(g){return g*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(g){return(g-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(g){return g*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(g){return{x:this._XconvertCanvasToDOM(g.x),y:this._YconvertCanvasToDOM(g.y)}}},{key:"DOMtoCanvas",value:function(g){return{x:this._XconvertDOMtoCanvas(g.x),y:this._YconvertDOMtoCanvas(g.y)}}}]),g}();function ld(g,e){var t=Rg({nodes:e,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},null!=g?g:{});if(!TC(t.nodes))throw new TypeError("Nodes has to be an array of ids.");if(0===t.nodes.length&&(t.nodes=e),!("number"==typeof t.minZoomLevel&&t.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!("number"==typeof t.maxZoomLevel&&t.minZoomLevel<=t.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return t}var dd=function(){function g(e,t){var A,C,i=this;YA(this,g),this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",jg(A=this.fit).call(A,this)),this.body.emitter.on("animationFinished",(function(){i.body.emitter.emit("_stopRendering")})),this.body.emitter.on("unlockNode",jg(C=this.releaseNode).call(C,this))}return UA(g,[{key:"setOptions",value:function(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=g}},{key:"fit",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];g=ld(g,this.body.nodeIndices);var t,A,C=this.canvas.frame.canvas.clientWidth,i=this.canvas.frame.canvas.clientHeight;if(0===C||0===i)A=1,t=ed.getRange(this.body.nodes,g.nodes);else if(!0===e){var I=0;for(var n in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,n)){var o=this.body.nodes[n];!0===o.predefinedPosition&&(I+=1)}if(I>.5*this.body.nodeIndices.length)return void this.fit(g,!1);t=ed.getRange(this.body.nodes,g.nodes);var r=this.body.nodeIndices.length;A=12.662/(r+7.4147)+.0964822;var s=Math.min(C/600,i/600);A*=s}else{this.body.emitter.emit("_resizeNodes"),t=ed.getRange(this.body.nodes,g.nodes);var a=1.1*Math.abs(t.maxX-t.minX),l=1.1*Math.abs(t.maxY-t.minY),d=C/a,h=i/l;A=d<=h?d:h}A>g.maxZoomLevel?A=g.maxZoomLevel:A<g.minZoomLevel&&(A=g.minZoomLevel);var c=ed.findCenter(t),u={position:c,scale:A,animation:g.animation};this.moveTo(u)}},{key:"focus",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==this.body.nodes[g]){var t={x:this.body.nodes[g].x,y:this.body.nodes[g].y};e.position=t,e.lockedOnNode=g,this.moveTo(e)}else console.error("Node: "+g+" cannot be found.")}},{key:"moveTo",value:function(g){if(void 0!==g){if(null!=g.offset){if(null!=g.offset.x){if(g.offset.x=+g.offset.x,!Sr(g.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else g.offset.x=0;if(null!=g.offset.y){if(g.offset.y=+g.offset.y,!Sr(g.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else g.offset.x=0}else g.offset={x:0,y:0};if(null!=g.position){if(null!=g.position.x){if(g.position.x=+g.position.x,!Sr(g.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else g.position.x=0;if(null!=g.position.y){if(g.position.y=+g.position.y,!Sr(g.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else g.position.x=0}else g.position=this.getViewPosition();if(null!=g.scale){if(g.scale=+g.scale,!(g.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else g.scale=this.body.view.scale;void 0===g.animation&&(g.animation={duration:0}),!1===g.animation&&(g.animation={duration:0}),!0===g.animation&&(g.animation={}),void 0===g.animation.duration&&(g.animation.duration=1e3),void 0===g.animation.easingFunction&&(g.animation.easingFunction="easeInOutQuad"),this.animateView(g)}else g={}}},{key:"animateView",value:function(g){if(void 0!==g){this.animationEasingFunction=g.animation.easingFunction,this.releaseNode(),!0===g.locked&&(this.lockedOnNodeId=g.lockedOnNode,this.lockedOnNodeOffset=g.offset),0!=this.easingTime&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=g.scale,this.body.view.scale=this.targetScale;var e,t,A=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),C=A.x-g.position.x,i=A.y-g.position.y;if(this.targetTranslation={x:this.sourceTranslation.x+C*this.targetScale+g.offset.x,y:this.sourceTranslation.y+i*this.targetScale+g.offset.y},0===g.animation.duration)if(null!=this.lockedOnNodeId)this.viewFunction=jg(e=this._lockedRedraw).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction);else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else this.animationSpeed=1/(60*g.animation.duration*.001)||1/60,this.animationEasingFunction=g.animation.easingFunction,this.viewFunction=jg(t=this._transitionRedraw).call(t,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}},{key:"_lockedRedraw",value:function(){var g=this.body.nodes[this.lockedOnNodeId].x,e=this.body.nodes[this.lockedOnNodeId].y,t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),A=t.x-g,C=t.y-e,i=this.body.view.translation,I={x:i.x+A*this.body.view.scale+this.lockedOnNodeOffset.x,y:i.y+C*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=I}},{key:"releaseNode",value:function(){void 0!==this.lockedOnNodeId&&void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var g=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.easingTime+=this.animationSpeed,this.easingTime=!0===g?1:this.easingTime;var e=fo[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*e,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*e,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*e},this.easingTime>=1){var t;if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,null!=this.lockedOnNodeId)this.viewFunction=jg(t=this._lockedRedraw).call(t,this),this.body.emitter.on("initRedraw",this.viewFunction);this.body.emitter.emit("animationFinished")}}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),g}();function hd(g){var e,t=g&&g.preventDefault||!1,A=g&&g.container||window,C={},i={keydown:{},keyup:{}},I={};for(e=97;e<=122;e++)I[String.fromCharCode(e)]={code:e-97+65,shift:!1};for(e=65;e<=90;e++)I[String.fromCharCode(e)]={code:e,shift:!0};for(e=0;e<=9;e++)I[""+e]={code:48+e,shift:!1};for(e=1;e<=12;e++)I["F"+e]={code:111+e,shift:!1};for(e=0;e<=9;e++)I["num"+e]={code:96+e,shift:!1};I["num*"]={code:106,shift:!1},I["num+"]={code:107,shift:!1},I["num-"]={code:109,shift:!1},I["num/"]={code:111,shift:!1},I["num."]={code:110,shift:!1},I.left={code:37,shift:!1},I.up={code:38,shift:!1},I.right={code:39,shift:!1},I.down={code:40,shift:!1},I.space={code:32,shift:!1},I.enter={code:13,shift:!1},I.shift={code:16,shift:void 0},I.esc={code:27,shift:!1},I.backspace={code:8,shift:!1},I.tab={code:9,shift:!1},I.ctrl={code:17,shift:!1},I.alt={code:18,shift:!1},I.delete={code:46,shift:!1},I.pageup={code:33,shift:!1},I.pagedown={code:34,shift:!1},I["="]={code:187,shift:!1},I["-"]={code:189,shift:!1},I["]"]={code:221,shift:!1},I["["]={code:219,shift:!1};var n=function(g){r(g,"keydown")},o=function(g){r(g,"keyup")},r=function(g,e){if(void 0!==i[e][g.keyCode]){for(var A=i[e][g.keyCode],C=0;C<A.length;C++)(void 0===A[C].shift||1==A[C].shift&&1==g.shiftKey||0==A[C].shift&&0==g.shiftKey)&&A[C].fn(g);1==t&&g.preventDefault()}};return C.bind=function(g,e,t){if(void 0===t&&(t="keydown"),void 0===I[g])throw new Error("unsupported key: "+g);void 0===i[t][I[g].code]&&(i[t][I[g].code]=[]),i[t][I[g].code].push({fn:e,shift:I[g].shift})},C.bindAll=function(g,e){for(var t in void 0===e&&(e="keydown"),I)I.hasOwnProperty(t)&&C.bind(t,g,e)},C.getKey=function(g){for(var e in I)if(I.hasOwnProperty(e)){if(1==g.shiftKey&&1==I[e].shift&&g.keyCode==I[e].code)return e;if(0==g.shiftKey&&0==I[e].shift&&g.keyCode==I[e].code)return e;if(g.keyCode==I[e].code&&"shift"==e)return e}return"unknown key, currently not supported"},C.unbind=function(g,e,t){if(void 0===t&&(t="keydown"),void 0===I[g])throw new Error("unsupported key: "+g);if(void 0!==e){var A=[],C=i[t][I[g].code];if(void 0!==C)for(var n=0;n<C.length;n++)C[n].fn==e&&C[n].shift==I[g].shift||A.push(i[t][I[g].code][n]);i[t][I[g].code]=A}else i[t][I[g].code]=[]},C.reset=function(){i={keydown:{},keyup:{}}},C.destroy=function(){i={keydown:{},keyup:{}},A.removeEventListener("keydown",n,!0),A.removeEventListener("keyup",o,!0)},A.addEventListener("keydown",n,!0),A.addEventListener("keyup",o,!0),C}Ug("div.vis-network div.vis-navigation div.vis-button {\n  width: 34px;\n  height: 34px;\n  -moz-border-radius: 17px;\n  border-radius: 17px;\n  position: absolute;\n  display: inline-block;\n  background-position: 2px 2px;\n  background-repeat: no-repeat;\n  cursor: pointer;\n  -webkit-touch-callout: none;\n  -webkit-user-select: none;\n  -khtml-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n\ndiv.vis-network div.vis-navigation div.vis-button:hover {\n  box-shadow: 0 0 3px 3px rgba(56, 207, 21, 0.3);\n}\n\ndiv.vis-network div.vis-navigation div.vis-button:active {\n  box-shadow: 0 0 1px 3px rgba(56, 207, 21, 0.95);\n}\n\ndiv.vis-network div.vis-navigation div.vis-button.vis-up {\n  background-image: url('data:image/png;base64, ');\n  bottom: 50px;\n  left: 55px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-down {\n  background-image: url('data:image/png;base64, ');\n  bottom: 10px;\n  left: 55px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-left {\n  background-image: url('data:image/png;base64, ');\n  bottom: 10px;\n  left: 15px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-right {\n  background-image: url('data:image/png;base64, ');\n  bottom: 10px;\n  left: 95px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-zoomIn {\n  background-image: url('data:image/png;base64, ');\n  bottom: 10px;\n  right: 15px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-zoomOut {\n  background-image: url('data:image/png;base64, ');\n  bottom: 10px;\n  right: 55px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-zoomExtends {\n  background-image: url('data:image/png;base64, ');\n  bottom: 50px;\n  right: 15px;\n}\n");var cd=function(){function g(e,t){var A=this;YA(this,g),this.body=e,this.canvas=t,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on("activate",(function(){A.activated=!0,A.configureKeyboardBindings()})),this.body.emitter.on("deactivate",(function(){A.activated=!1,A.configureKeyboardBindings()})),this.body.emitter.on("destroy",(function(){void 0!==A.keycharm&&A.keycharm.destroy()})),this.options={}}return UA(g,[{key:"setOptions",value:function(g){void 0!==g&&(this.options=g,this.create())}},{key:"create",value:function(){!0===this.options.navigationButtons?!1===this.iconsCreated&&this.loadNavigationElements():!0===this.iconsCreated&&this.cleanNavigation(),this.configureKeyboardBindings()}},{key:"cleanNavigation",value:function(){if(0!=this.navigationHammers.length){for(var g=0;g<this.navigationHammers.length;g++)this.navigationHammers[g].destroy();this.navigationHammers=[]}this.navigationDOM&&this.navigationDOM.wrapper&&this.navigationDOM.wrapper.parentNode&&this.navigationDOM.wrapper.parentNode.removeChild(this.navigationDOM.wrapper),this.iconsCreated=!1}},{key:"loadNavigationElements",value:function(){var g=this;this.cleanNavigation(),this.navigationDOM={};var e=["up","down","left","right","zoomIn","zoomOut","zoomExtends"],t=["_moveUp","_moveDown","_moveLeft","_moveRight","_zoomIn","_zoomOut","_fit"];this.navigationDOM.wrapper=document.createElement("div"),this.navigationDOM.wrapper.className="vis-navigation",this.canvas.frame.appendChild(this.navigationDOM.wrapper);for(var A=0;A<e.length;A++){this.navigationDOM[e[A]]=document.createElement("div"),this.navigationDOM[e[A]].className="vis-button vis-"+e[A],this.navigationDOM.wrapper.appendChild(this.navigationDOM[e[A]]);var C,i,I=new Oo(this.navigationDOM[e[A]]);if("_fit"===t[A])rd(I,jg(C=this._fit).call(C,this));else rd(I,jg(i=this.bindToRedraw).call(i,this,t[A]));this.navigationHammers.push(I)}var n=new Oo(this.canvas.frame);sd(n,(function(){g._stopMovement()})),this.navigationHammers.push(n),this.iconsCreated=!0}},{key:"bindToRedraw",value:function(g){var e;void 0===this.boundFunctions[g]&&(this.boundFunctions[g]=jg(e=this[g]).call(e,this),this.body.emitter.on("initRedraw",this.boundFunctions[g]),this.body.emitter.emit("_startRendering"))}},{key:"unbindFromRedraw",value:function(g){void 0!==this.boundFunctions[g]&&(this.body.emitter.off("initRedraw",this.boundFunctions[g]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[g])}},{key:"_fit",value:function(){(new Date).valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=(new Date).valueOf())}},{key:"_stopMovement",value:function(){for(var g in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,g)&&(this.body.emitter.off("initRedraw",this.boundFunctions[g]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var g=this.body.view.scale,e=this.body.view.scale*(1+this.options.keyboard.speed.zoom),t=this.body.view.translation,A=e/g,C=(1-A)*this.canvas.canvasViewCenter.x+t.x*A,i=(1-A)*this.canvas.canvasViewCenter.y+t.y*A;this.body.view.scale=e,this.body.view.translation={x:C,y:i},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var g=this.body.view.scale,e=this.body.view.scale/(1+this.options.keyboard.speed.zoom),t=this.body.view.translation,A=e/g,C=(1-A)*this.canvas.canvasViewCenter.x+t.x*A,i=(1-A)*this.canvas.canvasViewCenter.y+t.y*A;this.body.view.scale=e,this.body.view.translation={x:C,y:i},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var g,e,t,A,C,i,I,n,o,r,s,a,l,d,h,c,u,p,f,v,m,y,b,w,k=this;(void 0!==this.keycharm&&this.keycharm.destroy(),!0===this.options.keyboard.enabled)&&(!0===this.options.keyboard.bindToWindow?this.keycharm=hd({container:window,preventDefault:!0}):this.keycharm=hd({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),!0===this.activated&&(jg(g=this.keycharm).call(g,"up",(function(){k.bindToRedraw("_moveUp")}),"keydown"),jg(e=this.keycharm).call(e,"down",(function(){k.bindToRedraw("_moveDown")}),"keydown"),jg(t=this.keycharm).call(t,"left",(function(){k.bindToRedraw("_moveLeft")}),"keydown"),jg(A=this.keycharm).call(A,"right",(function(){k.bindToRedraw("_moveRight")}),"keydown"),jg(C=this.keycharm).call(C,"=",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),jg(i=this.keycharm).call(i,"num+",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),jg(I=this.keycharm).call(I,"num-",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),jg(n=this.keycharm).call(n,"-",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),jg(o=this.keycharm).call(o,"[",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),jg(r=this.keycharm).call(r,"]",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),jg(s=this.keycharm).call(s,"pageup",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),jg(a=this.keycharm).call(a,"pagedown",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),jg(l=this.keycharm).call(l,"up",(function(){k.unbindFromRedraw("_moveUp")}),"keyup"),jg(d=this.keycharm).call(d,"down",(function(){k.unbindFromRedraw("_moveDown")}),"keyup"),jg(h=this.keycharm).call(h,"left",(function(){k.unbindFromRedraw("_moveLeft")}),"keyup"),jg(c=this.keycharm).call(c,"right",(function(){k.unbindFromRedraw("_moveRight")}),"keyup"),jg(u=this.keycharm).call(u,"=",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),jg(p=this.keycharm).call(p,"num+",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),jg(f=this.keycharm).call(f,"num-",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup"),jg(v=this.keycharm).call(v,"-",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup"),jg(m=this.keycharm).call(m,"[",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup"),jg(y=this.keycharm).call(y,"]",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),jg(b=this.keycharm).call(b,"pageup",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),jg(w=this.keycharm).call(w,"pagedown",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup")))}}]),g}();function ud(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return pd(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return pd(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function pd(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}var fd=function(){function g(e,t,A){var C,i,I,n,o,r,s,a,l,d,h,c,u;YA(this,g),this.body=e,this.canvas=t,this.selectionHandler=A,this.navigationHandler=new cd(e,t),this.body.eventListeners.onTap=jg(C=this.onTap).call(C,this),this.body.eventListeners.onTouch=jg(i=this.onTouch).call(i,this),this.body.eventListeners.onDoubleTap=jg(I=this.onDoubleTap).call(I,this),this.body.eventListeners.onHold=jg(n=this.onHold).call(n,this),this.body.eventListeners.onDragStart=jg(o=this.onDragStart).call(o,this),this.body.eventListeners.onDrag=jg(r=this.onDrag).call(r,this),this.body.eventListeners.onDragEnd=jg(s=this.onDragEnd).call(s,this),this.body.eventListeners.onMouseWheel=jg(a=this.onMouseWheel).call(a,this),this.body.eventListeners.onPinch=jg(l=this.onPinch).call(l,this),this.body.eventListeners.onMouseMove=jg(d=this.onMouseMove).call(d,this),this.body.eventListeners.onRelease=jg(h=this.onRelease).call(h,this),this.body.eventListeners.onContext=jg(c=this.onContext).call(c,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=jg(u=this.getPointer).call(u,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},Rg(this.options,this.defaultOptions),this.bindEventListeners()}return UA(g,[{key:"bindEventListeners",value:function(){var g=this;this.body.emitter.on("destroy",(function(){clearTimeout(g.popupTimer),delete g.body.functions.getPointer}))}},{key:"setOptions",value:function(g){if(void 0!==g){$n(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,g),po(this.options,g,"keyboard"),g.tooltip&&(Rg(this.options.tooltip,g.tooltip),g.tooltip.color&&(this.options.tooltip.color=oo(g.tooltip.color)))}this.navigationHandler.setOptions(this.options)}},{key:"getPointer",value:function(g){return{x:g.x-(e=this.canvas.frame.canvas,e.getBoundingClientRect().left),y:g.y-Ao(this.canvas.frame.canvas)};var e}},{key:"onTouch",value:function(g){(new Date).valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(g.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=(new Date).valueOf())}},{key:"onTap",value:function(g){var e=this.getPointer(g.center),t=this.selectionHandler.options.multiselect&&(g.changedPointers[0].ctrlKey||g.changedPointers[0].metaKey);this.checkSelectionChanges(e,t),this.selectionHandler.commitAndEmit(e,g),this.selectionHandler.generateClickEvent("click",g,e)}},{key:"onDoubleTap",value:function(g){var e=this.getPointer(g.center);this.selectionHandler.generateClickEvent("doubleClick",g,e)}},{key:"onHold",value:function(g){var e=this.getPointer(g.center),t=this.selectionHandler.options.multiselect;this.checkSelectionChanges(e,t),this.selectionHandler.commitAndEmit(e,g),this.selectionHandler.generateClickEvent("click",g,e),this.selectionHandler.generateClickEvent("hold",g,e)}},{key:"onRelease",value:function(g){if((new Date).valueOf()-this.touchTime>10){var e=this.getPointer(g.center);this.selectionHandler.generateClickEvent("release",g,e),this.touchTime=(new Date).valueOf()}}},{key:"onContext",value:function(g){var e=this.getPointer({x:g.clientX,y:g.clientY});this.selectionHandler.generateClickEvent("oncontext",g,e)}},{key:"checkSelectionChanges",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!0===e?this.selectionHandler.selectAdditionalOnPoint(g):this.selectionHandler.selectOnPoint(g)}},{key:"_determineDifference",value:function(g,e){var t=function(g,e){for(var t=[],A=0;A<g.length;A++){var C=g[A];-1===ji(e).call(e,C)&&t.push(C)}return t};return{nodes:t(g.nodes,e.nodes),edges:t(g.edges,e.edges)}}},{key:"onDragStart",value:function(g){if(!this.drag.dragging){void 0===this.drag.pointer&&this.onTouch(g);var e=this.selectionHandler.getNodeAt(this.drag.pointer);if(this.drag.dragging=!0,this.drag.selection=[],this.drag.translation=Rg({},this.body.view.translation),this.drag.nodeId=void 0,g.srcEvent.shiftKey){this.body.selectionBox.show=!0;var t=this.getPointer(g.center);this.body.selectionBox.position.start={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)}}if(void 0!==e&&!0===this.options.dragNodes){this.drag.nodeId=e.id,!1===e.isSelected()&&(this.selectionHandler.unselectAll(),this.selectionHandler.selectObject(e)),this.selectionHandler.generateClickEvent("dragStart",g,this.drag.pointer);var A,C=ud(this.selectionHandler.getSelectedNodes());try{for(C.s();!(A=C.n()).done;){var i=A.value,I={id:i.id,node:i,x:i.x,y:i.y,xFixed:i.options.fixed.x,yFixed:i.options.fixed.y};i.options.fixed.x=!0,i.options.fixed.y=!0,this.drag.selection.push(I)}}catch(g){C.e(g)}finally{C.f()}}else this.selectionHandler.generateClickEvent("dragStart",g,this.drag.pointer,void 0,!0)}}},{key:"onDrag",value:function(g){var e=this;if(!0!==this.drag.pinched){this.body.emitter.emit("unlockNode");var t=this.getPointer(g.center),A=this.drag.selection;if(A&&A.length&&!0===this.options.dragNodes){this.selectionHandler.generateClickEvent("dragging",g,t);var C=t.x-this.drag.pointer.x,i=t.y-this.drag.pointer.y;YC(A).call(A,(function(g){var t=g.node;!1===g.xFixed&&(t.x=e.canvas._XconvertDOMtoCanvas(e.canvas._XconvertCanvasToDOM(g.x)+C)),!1===g.yFixed&&(t.y=e.canvas._YconvertDOMtoCanvas(e.canvas._YconvertCanvasToDOM(g.y)+i))})),this.body.emitter.emit("startSimulation")}else{if(g.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",g,t,void 0,!0),void 0===this.drag.pointer)return void this.onDragStart(g);this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit("_requestRedraw")}if(!0===this.options.dragView&&!g.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",g,t,void 0,!0),void 0===this.drag.pointer)return void this.onDragStart(g);var I=t.x-this.drag.pointer.x,n=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+I,y:this.drag.translation.y+n},this.body.emitter.emit("_requestRedraw")}}}}},{key:"onDragEnd",value:function(g){var e=this;if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;var A=this.body.selectionBox.position,C={minX:Math.min(A.start.x,A.end.x),minY:Math.min(A.start.y,A.end.y),maxX:Math.max(A.start.x,A.end.x),maxY:Math.max(A.start.y,A.end.y)},i=pi(t=this.body.nodeIndices).call(t,(function(g){var t=e.body.nodes[g];return t.x>=C.minX&&t.x<=C.maxX&&t.y>=C.minY&&t.y<=C.maxY}));YC(i).call(i,(function(g){return e.selectionHandler.selectObject(e.body.nodes[g])}));var I=this.getPointer(g.center);this.selectionHandler.commitAndEmit(I,g),this.selectionHandler.generateClickEvent("dragEnd",g,this.getPointer(g.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var n=this.drag.selection;n&&n.length?(YC(n).call(n,(function(g){g.node.options.fixed.x=g.xFixed,g.node.options.fixed.y=g.yFixed})),this.selectionHandler.generateClickEvent("dragEnd",g,this.getPointer(g.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",g,this.getPointer(g.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(g){var e=this.getPointer(g.center);this.drag.pinched=!0,void 0===this.pinch.scale&&(this.pinch.scale=1);var t=this.pinch.scale*g.scale;this.zoom(t,e)}},{key:"zoom",value:function(g,e){if(!0===this.options.zoomView){var t=this.body.view.scale;g<1e-5&&(g=1e-5),g>10&&(g=10);var A=void 0;void 0!==this.drag&&!0===this.drag.dragging&&(A=this.canvas.DOMtoCanvas(this.drag.pointer));var C=this.body.view.translation,i=g/t,I=(1-i)*e.x+C.x*i,n=(1-i)*e.y+C.y*i;if(this.body.view.scale=g,this.body.view.translation={x:I,y:n},null!=A){var o=this.canvas.canvasToDOM(A);this.drag.pointer.x=o.x,this.drag.pointer.y=o.y}this.body.emitter.emit("_requestRedraw"),t<g?this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:e}):this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:e})}}},{key:"onMouseWheel",value:function(g){if(!0===this.options.zoomView){if(0!==g.deltaY){var e=this.body.view.scale;e*=1+(g.deltaY<0?1:-1)*(.1*this.options.zoomSpeed);var t=this.getPointer({x:g.clientX,y:g.clientY});this.zoom(e,t)}g.preventDefault()}}},{key:"onMouseMove",value:function(g){var e=this,t=this.getPointer({x:g.clientX,y:g.clientY}),A=!1;void 0!==this.popup&&(!1===this.popup.hidden&&this._checkHidePopup(t),!1===this.popup.hidden&&(A=!0,this.popup.setPosition(t.x+3,t.y-5),this.popup.show())),!1===this.options.keyboard.bindToWindow&&!0===this.options.keyboard.enabled&&this.canvas.frame.focus(),!1===A&&(void 0!==this.popupTimer&&(clearInterval(this.popupTimer),this.popupTimer=void 0),this.drag.dragging||(this.popupTimer=gI((function(){return e._checkShowPopup(t)}),this.options.tooltipDelay))),!0===this.options.hover&&this.selectionHandler.hoverObject(g,t)}},{key:"_checkShowPopup",value:function(g){var e=this.canvas._XconvertDOMtoCanvas(g.x),t=this.canvas._YconvertDOMtoCanvas(g.y),A={left:e,top:t,right:e,bottom:t},C=void 0===this.popupObj?void 0:this.popupObj.id,i=!1,I="node";if(void 0===this.popupObj){for(var n,o=this.body.nodeIndices,r=this.body.nodes,s=[],a=0;a<o.length;a++)!0===(n=r[o[a]]).isOverlappingWith(A)&&(i=!0,void 0!==n.getTitle()&&s.push(o[a]));s.length>0&&(this.popupObj=r[s[s.length-1]],i=!0)}if(void 0===this.popupObj&&!1===i){for(var l,d=this.body.edgeIndices,h=this.body.edges,c=[],u=0;u<d.length;u++)!0===(l=h[d[u]]).isOverlappingWith(A)&&!0===l.connected&&void 0!==l.getTitle()&&c.push(d[u]);c.length>0&&(this.popupObj=h[c[c.length-1]],I="edge")}void 0!==this.popupObj?this.popupObj.id!==C&&(void 0===this.popup&&(this.popup=new To(this.canvas.frame)),this.popup.popupTargetType=I,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(g.x+3,g.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):void 0!==this.popup&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(g){var e=this.selectionHandler._pointerToPositionObject(g),t=!1;if("node"===this.popup.popupTargetType){if(void 0!==this.body.nodes[this.popup.popupTargetId]&&!0===(t=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(e))){var A=this.selectionHandler.getNodeAt(g);t=void 0!==A&&A.id===this.popup.popupTargetId}}else void 0===this.selectionHandler.getNodeAt(g)&&void 0!==this.body.edges[this.popup.popupTargetId]&&(t=this.body.edges[this.popup.popupTargetId].isOverlappingWith(e));!1===t&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),g}(),vd=lr.getWeakData,md=fe.set,yd=fe.getterFor,bd=AA.find,wd=AA.findIndex,kd=0,xd=function(g){return g.frozen||(g.frozen=new Ed)},Ed=function(){this.entries=[]},Od=function(g,e){return bd(g.entries,(function(g){return g[0]===e}))};Ed.prototype={get:function(g){var e=Od(this,g);if(e)return e[1]},has:function(g){return!!Od(this,g)},set:function(g,e){var t=Od(this,g);t?t[1]=e:this.entries.push([g,e])},delete:function(g){var e=wd(this.entries,(function(e){return e[0]===g}));return~e&&this.entries.splice(e,1),!!~e}};var Td={getConstructor:function(g,e,t,A){var C=g((function(g,i){cr(g,C,e),md(g,{type:e,id:kd++,frozen:void 0}),null!=i&&hr(i,g[A],{that:g,AS_ENTRIES:t})})),i=yd(e),I=function(g,e,t){var A=i(g),C=vd(Cg(e),!0);return!0===C?xd(A).set(e,t):C[A.id]=t,g};return yr(C.prototype,{delete:function(g){var e=i(this);if(!Z(g))return!1;var t=vd(g);return!0===t?xd(e).delete(g):t&&G(t,e.id)&&delete t[e.id]},has:function(g){var e=i(this);if(!Z(g))return!1;var t=vd(g);return!0===t?xd(e).has(g):t&&G(t,e.id)}}),yr(C.prototype,t?{get:function(g){var e=i(this);if(Z(g)){var t=vd(g);return!0===t?xd(e).get(g):t?t[e.id]:void 0}},set:function(g,e){return I(this,g,e)}}:{add:function(g){return I(this,g,!0)}}),C}};w((function(g){var e,t=fe.enforce,A=!x.ActiveXObject&&"ActiveXObject"in x,C=Object.isExtensible,i=function(g){return function(){return g(this,arguments.length?arguments[0]:void 0)}},I=g.exports=mr("WeakMap",i,Td);if(Ae&&A){e=Td.getConstructor(i,"WeakMap",!0),lr.REQUIRED=!0;var n=I.prototype,o=n.delete,r=n.has,s=n.get,a=n.set;yr(n,{delete:function(g){if(Z(g)&&!C(g)){var A=t(this);return A.frozen||(A.frozen=new e),o.call(this,g)||A.frozen.delete(g)}return o.call(this,g)},has:function(g){if(Z(g)&&!C(g)){var A=t(this);return A.frozen||(A.frozen=new e),r.call(this,g)||A.frozen.has(g)}return r.call(this,g)},get:function(g){if(Z(g)&&!C(g)){var A=t(this);return A.frozen||(A.frozen=new e),r.call(this,g)?s.call(this,g):A.frozen.get(g)}return s.call(this,g)},set:function(g,A){if(Z(g)&&!C(g)){var i=t(this);i.frozen||(i.frozen=new e),r.call(this,g)?a.call(this,g,A):i.frozen.set(g,A)}else a.call(this,g,A);return this}})}}));var Dd,Nd,Rd,Pd,Sd,Md=eg.WeakMap;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function Bd(g,e){if(!e.has(g))throw new TypeError("attempted to get private field on non-instance");return e.get(g)}function zd(g,e,t){if(!e.has(g))throw new TypeError("attempted to set private field on non-instance");return e.set(g,t),t}function Fd(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return Zd(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return Zd(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function Zd(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}function jd(g,e){var t,A=new ns,C=Fd(e);try{for(C.s();!(t=C.n()).done;){var i=t.value;g.has(i)||A.add(i)}}catch(g){C.e(g)}finally{C.f()}return A}var Ld=function(){function g(){YA(this,g),Dd.set(this,new ns),Nd.set(this,new ns)}return UA(g,[{key:"size",get:function(){return Bd(this,Nd).size}},{key:"add",value:function(){for(var g=arguments.length,e=new Array(g),t=0;t<g;t++)e[t]=arguments[t];for(var A=0,C=e;A<C.length;A++){var i=C[A];Bd(this,Nd).add(i)}}},{key:"delete",value:function(){for(var g=arguments.length,e=new Array(g),t=0;t<g;t++)e[t]=arguments[t];for(var A=0,C=e;A<C.length;A++){var i=C[A];Bd(this,Nd).delete(i)}}},{key:"clear",value:function(){Bd(this,Nd).clear()}},{key:"getSelection",value:function(){return yC(Bd(this,Nd))}},{key:"getChanges",value:function(){return{added:yC(jd(Bd(this,Dd),Bd(this,Nd))),deleted:yC(jd(Bd(this,Nd),Bd(this,Dd))),previous:yC(new ns(Bd(this,Dd))),current:yC(new ns(Bd(this,Nd)))}}},{key:"commit",value:function(){var g=this.getChanges();zd(this,Dd,Bd(this,Nd)),zd(this,Nd,new ns(Bd(this,Dd)));var e,t=Fd(g.added);try{for(t.s();!(e=t.n()).done;){e.value.select()}}catch(g){t.e(g)}finally{t.f()}var A,C=Fd(g.deleted);try{for(C.s();!(A=C.n()).done;){A.value.unselect()}}catch(g){C.e(g)}finally{C.f()}return g}}]),g}();Dd=new Md,Nd=new Md;var Gd=function(){function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};YA(this,g),Rd.set(this,new Ld),Pd.set(this,new Ld),Sd.set(this,void 0),zd(this,Sd,e)}return UA(g,[{key:"sizeNodes",get:function(){return Bd(this,Rd).size}},{key:"sizeEdges",get:function(){return Bd(this,Pd).size}},{key:"getNodes",value:function(){return Bd(this,Rd).getSelection()}},{key:"getEdges",value:function(){return Bd(this,Pd).getSelection()}},{key:"addNodes",value:function(){var g;(g=Bd(this,Rd)).add.apply(g,arguments)}},{key:"addEdges",value:function(){var g;(g=Bd(this,Pd)).add.apply(g,arguments)}},{key:"deleteNodes",value:function(g){Bd(this,Rd).delete(g)}},{key:"deleteEdges",value:function(g){Bd(this,Pd).delete(g)}},{key:"clear",value:function(){Bd(this,Rd).clear(),Bd(this,Pd).clear()}},{key:"commit",value:function(){for(var g,e,t={nodes:Bd(this,Rd).commit(),edges:Bd(this,Pd).commit()},A=arguments.length,C=new Array(A),i=0;i<A;i++)C[i]=arguments[i];return(g=Bd(this,Sd)).call.apply(g,xC(e=[this,t]).call(e,C)),t}}]),g}();function Vd(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return Yd(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return Yd(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function Yd(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}Rd=new Md,Pd=new Md,Sd=new Md;var Wd=function(){function g(e,t){var A=this;YA(this,g),this.body=e,this.canvas=t,this._selectionAccumulator=new Gd,this.hoverObj={nodes:{},edges:{}},this.options={},this.defaultOptions={multiselect:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0},Rg(this.options,this.defaultOptions),this.body.emitter.on("_dataChanged",(function(){A.updateSelection()}))}return UA(g,[{key:"setOptions",value:function(g){if(void 0!==g){qn(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,g)}}},{key:"selectOnPoint",value:function(g){var e=!1;if(!0===this.options.selectable){var t=this.getNodeAt(g)||this.getEdgeAt(g);this.unselectAll(),void 0!==t&&(e=this.selectObject(t)),this.body.emitter.emit("_requestRedraw")}return e}},{key:"selectAdditionalOnPoint",value:function(g){var e=!1;if(!0===this.options.selectable){var t=this.getNodeAt(g)||this.getEdgeAt(g);void 0!==t&&(e=!0,!0===t.isSelected()?this.deselectObject(t):this.selectObject(t),this.body.emitter.emit("_requestRedraw"))}return e}},{key:"_initBaseEvent",value:function(g,e){var t={};return t.pointer={DOM:{x:e.x,y:e.y},canvas:this.canvas.DOMtoCanvas(e)},t.event=g,t}},{key:"generateClickEvent",value:function(g,e,t,A){var C=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=this._initBaseEvent(e,t);if(!0===C)i.nodes=[],i.edges=[];else{var I=this.getSelection();i.nodes=I.nodes,i.edges=I.edges}void 0!==A&&(i.previousSelection=A),"click"==g&&(i.items=this.getClickedItems(t)),void 0!==e.controlEdge&&(i.controlEdge=e.controlEdge),this.body.emitter.emit(g,i)}},{key:"selectObject",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.selectConnectedEdges;if(void 0!==g){if(g instanceof qa){var t;if(!0===e)(t=this._selectionAccumulator).addEdges.apply(t,yC(g.edges));this._selectionAccumulator.addNodes(g)}else this._selectionAccumulator.addEdges(g);return!0}return!1}},{key:"deselectObject",value:function(g){!0===g.isSelected()&&(g.selected=!1,this._removeFromSelection(g))}},{key:"_getAllNodesOverlappingWith",value:function(g){for(var e=[],t=this.body.nodes,A=0;A<this.body.nodeIndices.length;A++){var C=this.body.nodeIndices[A];t[C].isOverlappingWith(g)&&e.push(C)}return e}},{key:"_pointerToPositionObject",value:function(g){var e=this.canvas.DOMtoCanvas(g);return{left:e.x-1,top:e.y+1,right:e.x+1,bottom:e.y-1}}},{key:"getNodeAt",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this._pointerToPositionObject(g),A=this._getAllNodesOverlappingWith(t);return A.length>0?!0===e?this.body.nodes[A[A.length-1]]:A[A.length-1]:void 0}},{key:"_getEdgesOverlappingWith",value:function(g,e){for(var t=this.body.edges,A=0;A<this.body.edgeIndices.length;A++){var C=this.body.edgeIndices[A];t[C].isOverlappingWith(g)&&e.push(C)}}},{key:"_getAllEdgesOverlappingWith",value:function(g){var e=[];return this._getEdgesOverlappingWith(g,e),e}},{key:"getEdgeAt",value:function(g){for(var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this.canvas.DOMtoCanvas(g),A=10,C=null,i=this.body.edges,I=0;I<this.body.edgeIndices.length;I++){var n=this.body.edgeIndices[I],o=i[n];if(o.connected){var r=o.from.x,s=o.from.y,a=o.to.x,l=o.to.y,d=o.edgeType.getDistanceToEdge(r,s,a,l,t.x,t.y);d<A&&(C=n,A=d)}}return null!==C?!0===e?this.body.edges[C]:C:void 0}},{key:"_addToHover",value:function(g){g instanceof qa?this.hoverObj.nodes[g.id]=g:this.hoverObj.edges[g.id]=g}},{key:"_removeFromSelection",value:function(g){var e;g instanceof qa?(this._selectionAccumulator.deleteNodes(g),(e=this._selectionAccumulator).deleteEdges.apply(e,yC(g.edges))):this._selectionAccumulator.deleteEdges(g)}},{key:"unselectAll",value:function(){this._selectionAccumulator.clear()}},{key:"getSelectedNodeCount",value:function(){return this._selectionAccumulator.sizeNodes}},{key:"getSelectedEdgeCount",value:function(){return this._selectionAccumulator.sizeEdges}},{key:"_hoverConnectedEdges",value:function(g){for(var e=0;e<g.edges.length;e++){var t=g.edges[e];t.hover=!0,this._addToHover(t)}}},{key:"emitBlurEvent",value:function(g,e,t){var A=this._initBaseEvent(g,e);!0===t.hover&&(t.hover=!1,t instanceof qa?(A.node=t.id,this.body.emitter.emit("blurNode",A)):(A.edge=t.id,this.body.emitter.emit("blurEdge",A)))}},{key:"emitHoverEvent",value:function(g,e,t){var A=this._initBaseEvent(g,e),C=!1;return!1===t.hover&&(t.hover=!0,this._addToHover(t),C=!0,t instanceof qa?(A.node=t.id,this.body.emitter.emit("hoverNode",A)):(A.edge=t.id,this.body.emitter.emit("hoverEdge",A))),C}},{key:"hoverObject",value:function(g,e){var t=this.getNodeAt(e);void 0===t&&(t=this.getEdgeAt(e));var A=!1;for(var C in this.hoverObj.nodes)Object.prototype.hasOwnProperty.call(this.hoverObj.nodes,C)&&(void 0===t||t instanceof qa&&t.id!=C||t instanceof Vl)&&(this.emitBlurEvent(g,e,this.hoverObj.nodes[C]),delete this.hoverObj.nodes[C],A=!0);for(var i in this.hoverObj.edges)Object.prototype.hasOwnProperty.call(this.hoverObj.edges,i)&&(!0===A?(this.hoverObj.edges[i].hover=!1,delete this.hoverObj.edges[i]):(void 0===t||t instanceof Vl&&t.id!=i||t instanceof qa&&!t.hover)&&(this.emitBlurEvent(g,e,this.hoverObj.edges[i]),delete this.hoverObj.edges[i],A=!0));if(void 0!==t){var I=BC(this.hoverObj.edges).length,n=BC(this.hoverObj.nodes).length;(A||t instanceof Vl&&0===I&&0===n||t instanceof qa&&0===I&&0===n)&&(A=this.emitHoverEvent(g,e,t)),t instanceof qa&&!0===this.options.hoverConnectedEdges&&this._hoverConnectedEdges(t)}!0===A&&this.body.emitter.emit("_requestRedraw")}},{key:"commitWithoutEmitting",value:function(){this._selectionAccumulator.commit()}},{key:"commitAndEmit",value:function(g,e){var t=!1,A=this._selectionAccumulator.commit(),C={nodes:A.nodes.previous,edges:A.edges.previous};A.edges.deleted.length>0&&(this.generateClickEvent("deselectEdge",e,g,C),t=!0),A.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",e,g,C),t=!0),A.nodes.added.length>0&&(this.generateClickEvent("selectNode",e,g),t=!0),A.edges.added.length>0&&(this.generateClickEvent("selectEdge",e,g),t=!0),!0===t&&this.generateClickEvent("select",e,g)}},{key:"getSelection",value:function(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}},{key:"getSelectedNodes",value:function(){return this._selectionAccumulator.getNodes()}},{key:"getSelectedEdges",value:function(){return this._selectionAccumulator.getEdges()}},{key:"getSelectedNodeIds",value:function(){var g;return SC(g=this._selectionAccumulator.getNodes()).call(g,(function(g){return g.id}))}},{key:"getSelectedEdgeIds",value:function(){var g;return SC(g=this._selectionAccumulator.getEdges()).call(g,(function(g){return g.id}))}},{key:"setSelection",value:function(g){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!g||!g.nodes&&!g.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((e.unselectAll||void 0===e.unselectAll)&&this.unselectAll(),g.nodes){var t,A=Vd(g.nodes);try{for(A.s();!(t=A.n()).done;){var C=t.value,i=this.body.nodes[C];if(!i)throw new RangeError('Node with id "'+C+'" not found');this.selectObject(i,e.highlightEdges)}}catch(g){A.e(g)}finally{A.f()}}if(g.edges){var I,n=Vd(g.edges);try{for(n.s();!(I=n.n()).done;){var o=I.value,r=this.body.edges[o];if(!r)throw new RangeError('Edge with id "'+o+'" not found');this.selectObject(r)}}catch(g){n.e(g)}finally{n.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(g){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!g||void 0===g.length)throw"Selection must be an array with ids";this.setSelection({nodes:g},{highlightEdges:e})}},{key:"selectEdges",value:function(g){if(!g||void 0===g.length)throw"Selection must be an array with ids";this.setSelection({edges:g})}},{key:"updateSelection",value:function(){for(var g in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,g.id)||this._selectionAccumulator.deleteNodes(g);for(var e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}},{key:"getClickedItems",value:function(g){for(var e=this.canvas.DOMtoCanvas(g),t=[],A=this.body.nodeIndices,C=this.body.nodes,i=A.length-1;i>=0;i--){var I=C[A[i]].getItemsOnPoint(e);t.push.apply(t,I)}for(var n=this.body.edgeIndices,o=this.body.edges,r=n.length-1;r>=0;r--){var s=o[n[r]].getItemsOnPoint(e);t.push.apply(t,s)}return t}}]),g}(),_d=w((function(g,e){!function(g){function e(g,e){if(!(g instanceof e))throw new TypeError("Cannot call a class as a function")}g.__esModule=!0,g.sort=c;var t=32,A=7,C=256,i=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9];function I(g){return g<1e5?g<100?g<10?0:1:g<1e4?g<1e3?2:3:4:g<1e7?g<1e6?5:6:g<1e9?g<1e8?7:8:9}function n(g,e){if(g===e)return 0;if(~~g===g&&~~e===e){if(0===g||0===e)return g<e?-1:1;if(g<0||e<0){if(e>=0)return-1;if(g>=0)return 1;g=-g,e=-e}var t=I(g),A=I(e),C=0;return t<A?(g*=i[A-t-1],e/=10,C=-1):t>A&&(e*=i[t-A-1],g/=10,C=1),g===e?C:g<e?-1:1}var n=String(g),o=String(e);return n===o?0:n<o?-1:1}function o(g){for(var e=0;g>=t;)e|=1&g,g>>=1;return g+e}function r(g,e,t,A){var C=e+1;if(C===t)return 1;if(A(g[C++],g[e])<0){for(;C<t&&A(g[C],g[C-1])<0;)C++;s(g,e,C)}else for(;C<t&&A(g[C],g[C-1])>=0;)C++;return C-e}function s(g,e,t){for(t--;e<t;){var A=g[e];g[e++]=g[t],g[t--]=A}}function a(g,e,t,A,C){for(A===e&&A++;A<t;A++){for(var i=g[A],I=e,n=A;I<n;){var o=I+n>>>1;C(i,g[o])<0?n=o:I=o+1}var r=A-I;switch(r){case 3:g[I+3]=g[I+2];case 2:g[I+2]=g[I+1];case 1:g[I+1]=g[I];break;default:for(;r>0;)g[I+r]=g[I+r-1],r--}g[I]=i}}function l(g,e,t,A,C,i){var I=0,n=0,o=1;if(i(g,e[t+C])>0){for(n=A-C;o<n&&i(g,e[t+C+o])>0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n),I+=C,o+=C}else{for(n=C+1;o<n&&i(g,e[t+C-o])<=0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n);var r=I;I=C-o,o=C-r}for(I++;I<o;){var s=I+(o-I>>>1);i(g,e[t+s])>0?I=s+1:o=s}return o}function d(g,e,t,A,C,i){var I=0,n=0,o=1;if(i(g,e[t+C])<0){for(n=C+1;o<n&&i(g,e[t+C-o])<0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n);var r=I;I=C-o,o=C-r}else{for(n=A-C;o<n&&i(g,e[t+C+o])>=0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n),I+=C,o+=C}for(I++;I<o;){var s=I+(o-I>>>1);i(g,e[t+s])<0?o=s:I=s+1}return o}var h=function(){function g(t,i){e(this,g),this.array=null,this.compare=null,this.minGallop=A,this.length=0,this.tmpStorageLength=C,this.stackLength=0,this.runStart=null,this.runLength=null,this.stackSize=0,this.array=t,this.compare=i,this.length=t.length,this.length<2*C&&(this.tmpStorageLength=this.length>>>1),this.tmp=new Array(this.tmpStorageLength),this.stackLength=this.length<120?5:this.length<1542?10:this.length<119151?19:40,this.runStart=new Array(this.stackLength),this.runLength=new Array(this.stackLength)}return g.prototype.pushRun=function(g,e){this.runStart[this.stackSize]=g,this.runLength[this.stackSize]=e,this.stackSize+=1},g.prototype.mergeRuns=function(){for(;this.stackSize>1;){var g=this.stackSize-2;if(g>=1&&this.runLength[g-1]<=this.runLength[g]+this.runLength[g+1]||g>=2&&this.runLength[g-2]<=this.runLength[g]+this.runLength[g-1])this.runLength[g-1]<this.runLength[g+1]&&g--;else if(this.runLength[g]>this.runLength[g+1])break;this.mergeAt(g)}},g.prototype.forceMergeRuns=function(){for(;this.stackSize>1;){var g=this.stackSize-2;g>0&&this.runLength[g-1]<this.runLength[g+1]&&g--,this.mergeAt(g)}},g.prototype.mergeAt=function(g){var e=this.compare,t=this.array,A=this.runStart[g],C=this.runLength[g],i=this.runStart[g+1],I=this.runLength[g+1];this.runLength[g]=C+I,g===this.stackSize-3&&(this.runStart[g+1]=this.runStart[g+2],this.runLength[g+1]=this.runLength[g+2]),this.stackSize--;var n=d(t[i],t,A,C,0,e);A+=n,0!=(C-=n)&&0!==(I=l(t[A+C-1],t,i,I,I-1,e))&&(C<=I?this.mergeLow(A,C,i,I):this.mergeHigh(A,C,i,I))},g.prototype.mergeLow=function(g,e,t,C){var i=this.compare,I=this.array,n=this.tmp,o=0;for(o=0;o<e;o++)n[o]=I[g+o];var r=0,s=t,a=g;if(I[a++]=I[s++],0!=--C)if(1!==e){for(var h=this.minGallop;;){var c=0,u=0,p=!1;do{if(i(I[s],n[r])<0){if(I[a++]=I[s++],u++,c=0,0==--C){p=!0;break}}else if(I[a++]=n[r++],c++,u=0,1==--e){p=!0;break}}while((c|u)<h);if(p)break;do{if(0!==(c=d(I[s],n,r,e,0,i))){for(o=0;o<c;o++)I[a+o]=n[r+o];if(a+=c,r+=c,(e-=c)<=1){p=!0;break}}if(I[a++]=I[s++],0==--C){p=!0;break}if(0!==(u=l(n[r],I,s,C,0,i))){for(o=0;o<u;o++)I[a+o]=I[s+o];if(a+=u,s+=u,0==(C-=u)){p=!0;break}}if(I[a++]=n[r++],1==--e){p=!0;break}h--}while(c>=A||u>=A);if(p)break;h<0&&(h=0),h+=2}if(this.minGallop=h,h<1&&(this.minGallop=1),1===e){for(o=0;o<C;o++)I[a+o]=I[s+o];I[a+C]=n[r]}else{if(0===e)throw new Error("mergeLow preconditions were not respected");for(o=0;o<e;o++)I[a+o]=n[r+o]}}else{for(o=0;o<C;o++)I[a+o]=I[s+o];I[a+C]=n[r]}else for(o=0;o<e;o++)I[a+o]=n[r+o]},g.prototype.mergeHigh=function(g,e,t,C){var i=this.compare,I=this.array,n=this.tmp,o=0;for(o=0;o<C;o++)n[o]=I[t+o];var r=g+e-1,s=C-1,a=t+C-1,h=0,c=0;if(I[a--]=I[r--],0!=--e)if(1!==C){for(var u=this.minGallop;;){var p=0,f=0,v=!1;do{if(i(n[s],I[r])<0){if(I[a--]=I[r--],p++,f=0,0==--e){v=!0;break}}else if(I[a--]=n[s--],f++,p=0,1==--C){v=!0;break}}while((p|f)<u);if(v)break;do{if(0!=(p=e-d(n[s],I,g,e,e-1,i))){for(e-=p,c=1+(a-=p),h=1+(r-=p),o=p-1;o>=0;o--)I[c+o]=I[h+o];if(0===e){v=!0;break}}if(I[a--]=n[s--],1==--C){v=!0;break}if(0!=(f=C-l(I[r],n,0,C,C-1,i))){for(C-=f,c=1+(a-=f),h=1+(s-=f),o=0;o<f;o++)I[c+o]=n[h+o];if(C<=1){v=!0;break}}if(I[a--]=I[r--],0==--e){v=!0;break}u--}while(p>=A||f>=A);if(v)break;u<0&&(u=0),u+=2}if(this.minGallop=u,u<1&&(this.minGallop=1),1===C){for(c=1+(a-=e),h=1+(r-=e),o=e-1;o>=0;o--)I[c+o]=I[h+o];I[a]=n[s]}else{if(0===C)throw new Error("mergeHigh preconditions were not respected");for(h=a-(C-1),o=0;o<C;o++)I[h+o]=n[o]}}else{for(c=1+(a-=e),h=1+(r-=e),o=e-1;o>=0;o--)I[c+o]=I[h+o];I[a]=n[s]}else for(h=a-(C-1),o=0;o<C;o++)I[h+o]=n[o]},g}();function c(g,e,A,C){if(!Array.isArray(g))throw new TypeError("Can only sort arrays");e?"function"!=typeof e&&(C=A,A=e,e=n):e=n,A||(A=0),C||(C=g.length);var i=C-A;if(!(i<2)){var I=0;if(i<t)a(g,A,C,A+(I=r(g,A,C,e)),e);else{var s=new h(g,e),l=o(i);do{if((I=r(g,A,C,e))<l){var d=i;d>l&&(d=l),a(g,A,A+d,A+I,e),I=d}s.pushRun(A,I),s.mergeRuns(),i-=I,A+=I}while(0!==i);s.forceMergeRuns()}}}}(e)}));function Ud(g){var e=function(){if("undefined"==typeof Reflect||!Yr)return!1;if(Yr.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Yr(Boolean,[],(function(){}))),!0}catch(g){return!1}}();return function(){var t,A=Xr(g);if(e){var C=Xr(this).constructor;t=Yr(A,arguments,C)}else t=A.apply(this,arguments);return Hr(this,t)}}var Qd=function(){function g(){YA(this,g)}return UA(g,[{key:"abstract",value:function(){throw new Error("Can't instantiate abstract class!")}},{key:"fake_use",value:function(){}},{key:"curveType",value:function(){return this.abstract()}},{key:"getPosition",value:function(g){return this.fake_use(g),this.abstract()}},{key:"setPosition",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;this.fake_use(g,e,t),this.abstract()}},{key:"getTreeSize",value:function(g){return this.fake_use(g),this.abstract()}},{key:"sort",value:function(g){this.fake_use(g),this.abstract()}},{key:"fix",value:function(g,e){this.fake_use(g,e),this.abstract()}},{key:"shift",value:function(g,e){this.fake_use(g,e),this.abstract()}}]),g}(),Hd=function(g){Qr(t,Qd);var e=Ud(t);function t(g){var A;return YA(this,t),(A=e.call(this)).layout=g,A}return UA(t,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(g){return g.x}},{key:"setPosition",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==t&&this.layout.hierarchical.addToOrdering(g,t),g.x=e}},{key:"getTreeSize",value:function(g){var e=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,g);return{min:e.min_x,max:e.max_x}}},{key:"sort",value:function(g){_d.sort(g,(function(g,e){return g.x-e.x}))}},{key:"fix",value:function(g,e){g.y=this.layout.options.hierarchical.levelSeparation*e,g.options.fixed.y=!0}},{key:"shift",value:function(g,e){this.layout.body.nodes[g].x+=e}}]),t}(),Kd=function(g){Qr(t,Qd);var e=Ud(t);function t(g){var A;return YA(this,t),(A=e.call(this)).layout=g,A}return UA(t,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(g){return g.y}},{key:"setPosition",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==t&&this.layout.hierarchical.addToOrdering(g,t),g.y=e}},{key:"getTreeSize",value:function(g){var e=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,g);return{min:e.min_y,max:e.max_y}}},{key:"sort",value:function(g){_d.sort(g,(function(g,e){return g.y-e.y}))}},{key:"fix",value:function(g,e){g.x=this.layout.options.hierarchical.levelSeparation*e,g.options.fixed.x=!0}},{key:"shift",value:function(g,e){this.layout.body.nodes[g].y+=e}}]),t}(),Xd=AA.every,Jd=FC("every");sg({target:"Array",proto:!0,forced:!Jd},{every:function(g){return Xd(this,g,arguments.length>1?arguments[1]:void 0)}});var qd=zg("Array").every,$d=Array.prototype,gh=function(g){var e=g.every;return g===$d||g instanceof Array&&e===$d.every?qd:e};function eh(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return th(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return th(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function th(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}function Ah(g,e){var t=new ns;return YC(g).call(g,(function(g){var e;YC(e=g.edges).call(e,(function(g){g.connected&&t.add(g)}))})),YC(t).call(t,(function(g){var t=g.from.id,A=g.to.id;null==e[t]&&(e[t]=0),(null==e[A]||e[t]>=e[A])&&(e[A]=e[t]+1)})),e}function Ch(g,e,t,A){var C,i,I=Yi(null),n=As(C=yC(ks(A).call(A))).call(C,(function(g,e){return g+1+e.edges.length}),0),o=t+"Id",r="to"===t?1:-1,s=eh(A);try{var a=function(){var C=pC(i.value,2),s=C[0],a=C[1];if(!A.has(s)||!g(a))return"continue";I[s]=0;for(var l=[a],d=0,h=void 0,c=function(){var g,C;if(!A.has(s))return"continue";var i=I[h.id]+r;if(YC(g=pi(C=h.edges).call(C,(function(g){return g.connected&&g.to!==g.from&&g[t]!==h&&A.has(g.toId)&&A.has(g.fromId)}))).call(g,(function(g){var A=g[o],C=I[A];(null==C||e(i,C))&&(I[A]=i,l.push(g[t]))})),d>n)return{v:{v:Ah(A,I)}};++d};h=l.pop();){var u=c();if("continue"!==u&&"object"===mC(u))return u.v}};for(s.s();!(i=s.n()).done;){var l=a();if("continue"!==l&&"object"===mC(l))return l.v}}catch(g){s.e(g)}finally{s.f()}return I}var ih=function(){function g(){YA(this,g),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return UA(g,[{key:"addRelation",value:function(g,e){void 0===this.childrenReference[g]&&(this.childrenReference[g]=[]),this.childrenReference[g].push(e),void 0===this.parentReference[e]&&(this.parentReference[e]=[]),this.parentReference[e].push(g)}},{key:"checkIfTree",value:function(){for(var g in this.parentReference)if(this.parentReference[g].length>1)return void(this.isTree=!1);this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(g,e){void 0!==e&&void 0===this.trees[g.id]&&(this.trees[g.id]=e,this.treeIndex=Math.max(e,this.treeIndex))}},{key:"ensureLevel",value:function(g){void 0===this.levels[g]&&(this.levels[g]=0)}},{key:"getMaxLevel",value:function(g){var e=this,t={};return function g(A){if(void 0!==t[A])return t[A];var C=e.levels[A];if(e.childrenReference[A]){var i=e.childrenReference[A];if(i.length>0)for(var I=0;I<i.length;I++)C=Math.max(C,g(i[I]))}return t[A]=C,C}(g)}},{key:"levelDownstream",value:function(g,e){void 0===this.levels[e.id]&&(void 0===this.levels[g.id]&&(this.levels[g.id]=0),this.levels[e.id]=this.levels[g.id]+1)}},{key:"setMinLevelToZero",value:function(g){var e=1e9;for(var t in g)Object.prototype.hasOwnProperty.call(g,t)&&void 0!==this.levels[t]&&(e=Math.min(this.levels[t],e));for(var A in g)Object.prototype.hasOwnProperty.call(g,A)&&void 0!==this.levels[A]&&(this.levels[A]-=e)}},{key:"getTreeSize",value:function(g,e){var t=1e9,A=-1e9,C=1e9,i=-1e9;for(var I in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,I)&&this.trees[I]===e){var n=g[I];t=Math.min(n.x,t),A=Math.max(n.x,A),C=Math.min(n.y,C),i=Math.max(n.y,i)}return{min_x:t,max_x:A,min_y:C,max_y:i}}},{key:"hasSameParent",value:function(g,e){var t=this.parentReference[g.id],A=this.parentReference[e.id];if(void 0===t||void 0===A)return!1;for(var C=0;C<t.length;C++)for(var i=0;i<A.length;i++)if(t[C]==A[i])return!0;return!1}},{key:"inSameSubNetwork",value:function(g,e){return this.trees[g.id]===this.trees[e.id]}},{key:"getLevels",value:function(){return BC(this.distributionOrdering)}},{key:"addToOrdering",value:function(g,e){void 0===this.distributionOrdering[e]&&(this.distributionOrdering[e]=[]);var t=!1,A=this.distributionOrdering[e];for(var C in A)if(A[C]===g){t=!0;break}t||(this.distributionOrdering[e].push(g),this.distributionIndex[g.id]=this.distributionOrdering[e].length-1)}}]),g}(),Ih=function(){function g(e){YA(this,g),this.body=e,this._resetRNG(Math.random()+":"+zC()),this.setPhysics=!1,this.options={},this.optionsBackup={physics:{}},this.defaultOptions={randomSeed:void 0,improvedLayout:!0,clusterThreshold:150,hierarchical:{enabled:!1,levelSeparation:150,nodeSpacing:100,treeSpacing:200,blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:"UD",sortMethod:"hubsize"}},Rg(this.options,this.defaultOptions),this.bindEventListeners()}return UA(g,[{key:"bindEventListeners",value:function(){var g=this;this.body.emitter.on("_dataChanged",(function(){g.setupHierarchicalLayout()})),this.body.emitter.on("_dataLoaded",(function(){g.layoutNetwork()})),this.body.emitter.on("_resetHierarchicalLayout",(function(){g.setupHierarchicalLayout()})),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",(function(){if(!0===g.options.hierarchical.enabled){var e=g.direction.curveType();g.body.emitter.emit("_forceDisableDynamicCurves",e,!1)}}))}},{key:"setOptions",value:function(g,e){if(void 0!==g){var t=this.options.hierarchical,A=t.enabled;if(qn(["randomSeed","improvedLayout","clusterThreshold"],this.options,g),po(this.options,g,"hierarchical"),void 0!==g.randomSeed&&this._resetRNG(g.randomSeed),!0===t.enabled)return!0===A&&this.body.emitter.emit("refresh",!0),"RL"===t.direction||"DU"===t.direction?t.levelSeparation>0&&(t.levelSeparation*=-1):t.levelSeparation<0&&(t.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(e);if(!0===A)return this.body.emitter.emit("refresh"),go(e,this.optionsBackup)}return e}},{key:"_resetRNG",value:function(g){this.initialRandomSeed=g,this._rng=Zn(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(g){if(!0===this.options.hierarchical.enabled){var e=this.optionsBackup.physics;void 0===g.physics||!0===g.physics?(g.physics={enabled:void 0===e.enabled||e.enabled,solver:"hierarchicalRepulsion"},e.enabled=void 0===e.enabled||e.enabled,e.solver=e.solver||"barnesHut"):"object"===mC(g.physics)?(e.enabled=void 0===g.physics.enabled||g.physics.enabled,e.solver=g.physics.solver||"barnesHut",g.physics.solver="hierarchicalRepulsion"):!1!==g.physics&&(e.solver="barnesHut",g.physics={solver:"hierarchicalRepulsion"});var t=this.direction.curveType();if(void 0===g.edges)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},g.edges={smooth:!1};else if(void 0===g.edges.smooth)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},g.edges.smooth=!1;else if("boolean"==typeof g.edges.smooth)this.optionsBackup.edges={smooth:g.edges.smooth},g.edges.smooth={enabled:g.edges.smooth,type:t};else{var A=g.edges.smooth;void 0!==A.type&&"dynamic"!==A.type&&(t=A.type),this.optionsBackup.edges={smooth:{enabled:void 0===A.enabled||A.enabled,type:void 0===A.type?"dynamic":A.type,roundness:void 0===A.roundness?.5:A.roundness,forceDirection:void 0!==A.forceDirection&&A.forceDirection}},g.edges.smooth={enabled:void 0===A.enabled||A.enabled,type:t,roundness:void 0===A.roundness?.5:A.roundness,forceDirection:void 0!==A.forceDirection&&A.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",t)}return g}},{key:"positionInitially",value:function(g){if(!0!==this.options.hierarchical.enabled){this._resetRNG(this.initialRandomSeed);for(var e=g.length+50,t=0;t<g.length;t++){var A=g[t],C=2*Math.PI*this._rng();void 0===A.x&&(A.x=e*Math.cos(C)),void 0===A.y&&(A.y=e*Math.sin(C))}}}},{key:"layoutNetwork",value:function(){if(!0!==this.options.hierarchical.enabled&&!0===this.options.improvedLayout){for(var g=this.body.nodeIndices,e=0,t=0;t<g.length;t++){!0===this.body.nodes[g[t]].predefinedPosition&&(e+=1)}if(e<.5*g.length){var A=0,C=this.options.clusterThreshold,i={clusterNodeProperties:{shape:"ellipse",label:"",group:"",font:{multi:!1}},clusterEdgeProperties:{label:"",font:{multi:!1},smooth:{enabled:!1}}};if(g.length>C){for(var I=g.length;g.length>C&&A<=10;){A+=1;var n=g.length;if(A%3==0?this.body.modules.clustering.clusterBridges(i):this.body.modules.clustering.clusterOutliers(i),n==g.length&&A%3!=0)return this._declusterAll(),this.body.emitter.emit("_layoutFailed"),void console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.")}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*I)})}A>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(g,this.body.edgeIndices,!0),this._shiftToCenter();for(var o=0;o<g.length;o++){var r=this.body.nodes[g[o]];!1===r.predefinedPosition&&(r.x+=70*(.5-this._rng()),r.y+=70*(.5-this._rng()))}this._declusterAll(),this.body.emitter.emit("_repositionBezierNodes")}}}},{key:"_shiftToCenter",value:function(){for(var g=ed.getRangeCore(this.body.nodes,this.body.nodeIndices),e=ed.findCenter(g),t=0;t<this.body.nodeIndices.length;t++){var A=this.body.nodes[this.body.nodeIndices[t]];A.x-=e.x,A.y-=e.y}}},{key:"_declusterAll",value:function(){for(var g=!0;!0===g;){g=!1;for(var e=0;e<this.body.nodeIndices.length;e++)!0===this.body.nodes[this.body.nodeIndices[e]].isCluster&&(g=!0,this.body.modules.clustering.openCluster(this.body.nodeIndices[e],{},!1));!0===g&&this.body.emitter.emit("_dataChanged")}}},{key:"getSeed",value:function(){return this.initialRandomSeed}},{key:"setupHierarchicalLayout",value:function(){if(!0===this.options.hierarchical.enabled&&this.body.nodeIndices.length>0){var g,e,t=!1,A=!1;for(e in this.lastNodeOnLevel={},this.hierarchical=new ih,this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&(void 0!==(g=this.body.nodes[e]).options.level?(t=!0,this.hierarchical.levels[e]=g.options.level):A=!0);if(!0===A&&!0===t)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(!0===A){var C=this.options.hierarchical.sortMethod;"hubsize"===C?this._determineLevelsByHubsize():"directed"===C?this._determineLevelsDirected():"custom"===C&&this._determineLevelsCustomCallback()}for(var i in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,i)&&this.hierarchical.ensureLevel(i);var I=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(I),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var g=this,e=!1,t={},A=function(e,t){var A=g.hierarchical.trees;for(var C in A)Object.prototype.hasOwnProperty.call(A,C)&&A[C]===e&&g.direction.shift(C,t)},C=function(){for(var e=[],t=0;t<g.hierarchical.numTrees();t++)e.push(g.direction.getTreeSize(t));return e},i=function e(t,A){if(!A[t.id]&&(A[t.id]=!0,g.hierarchical.childrenReference[t.id])){var C=g.hierarchical.childrenReference[t.id];if(C.length>0)for(var i=0;i<C.length;i++)e(g.body.nodes[C[i]],A)}},I=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e9,A=1e9,C=1e9,i=1e9,I=-1e9;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=g.body.nodes[n],r=g.hierarchical.levels[o.id],s=g.direction.getPosition(o),a=g._getSpaceAroundNode(o,e),l=pC(a,2),d=l[0],h=l[1];A=Math.min(d,A),C=Math.min(h,C),r<=t&&(i=Math.min(s,i),I=Math.max(s,I))}return[i,I,A,C]},n=function(e,t){var A=g.hierarchical.getMaxLevel(e.id),C=g.hierarchical.getMaxLevel(t.id);return Math.min(A,C)},o=function(e,t,A){for(var C=g.hierarchical,i=0;i<t.length;i++){var I=t[i],n=C.distributionOrdering[I];if(n.length>1)for(var o=0;o<n.length-1;o++){var r=n[o],s=n[o+1];C.hasSameParent(r,s)&&C.inSameSubNetwork(r,s)&&e(r,s,A)}}},r=function(t,A){var C=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=g.direction.getPosition(t),r=g.direction.getPosition(A),s=Math.abs(r-o),a=g.options.hierarchical.nodeSpacing;if(s>a){var l={},d={};i(t,l),i(A,d);var h=n(t,A),c=I(l,h),u=I(d,h),p=c[1],f=u[0],v=u[2],m=Math.abs(p-f);if(m>a){var y=p-f+a;y<-v+a&&(y=-v+a),y<0&&(g._shiftBlock(A.id,y),e=!0,!0===C&&g._centerParent(A))}}},s=function(A,C){for(var n=C.id,o=C.edges,r=g.hierarchical.levels[C.id],s=g.options.hierarchical.levelSeparation*g.options.hierarchical.levelSeparation,a={},l=[],d=0;d<o.length;d++){var h=o[d];if(h.toId!=h.fromId){var c=h.toId==n?h.from:h.to;a[o[d].id]=c,g.hierarchical.levels[c.id]<r&&l.push(h)}}var u=function(e,t){for(var A=0,C=0;C<t.length;C++)if(void 0!==a[t[C].id]){var i=g.direction.getPosition(a[t[C].id])-e;A+=i/Math.sqrt(i*i+s)}return A},p=function(e,t){for(var A=0,C=0;C<t.length;C++)if(void 0!==a[t[C].id]){var i=g.direction.getPosition(a[t[C].id])-e;A-=s*Math.pow(i*i+s,-1.5)}return A},f=function(e,t){for(var A=g.direction.getPosition(C),i={},I=0;I<e;I++){var n=u(A,t),o=p(A,t);if(void 0!==i[A-=Math.max(-40,Math.min(40,Math.round(n/o)))])break;i[A]=I}return A},v=f(A,l);!function(A){var n=g.direction.getPosition(C);if(void 0===t[C.id]){var o={};i(C,o),t[C.id]=o}var r=I(t[C.id]),s=r[2],a=r[3],l=A-n,d=0;l>0?d=Math.min(l,a-g.options.hierarchical.nodeSpacing):l<0&&(d=-Math.min(-l,s-g.options.hierarchical.nodeSpacing)),0!=d&&(g._shiftBlock(C.id,d),e=!0)}(v),function(t){var A=g.direction.getPosition(C),i=pC(g._getSpaceAroundNode(C),2),I=i[0],n=i[1],o=t-A,r=A;o>0?r=Math.min(A+(n-g.options.hierarchical.nodeSpacing),t):o<0&&(r=Math.max(A-(I-g.options.hierarchical.nodeSpacing),t)),r!==A&&(g.direction.setPosition(C,r),e=!0)}(v=f(A,o))};!0===this.options.hierarchical.blockShifting&&(function(t){var A=g.hierarchical.getLevels();A=HC(A).call(A);for(var C=0;C<t&&(e=!1,o(r,A,!0),!0===e);C++);}(5),function(){for(var e in g.body.nodes)Object.prototype.hasOwnProperty.call(g.body.nodes,e)&&g._centerParent(g.body.nodes[e])}()),!0===this.options.hierarchical.edgeMinimization&&function(t){var A=g.hierarchical.getLevels();A=HC(A).call(A);for(var C=0;C<t;C++){e=!1;for(var i=0;i<A.length;i++)for(var I=A[i],n=g.hierarchical.distributionOrdering[I],o=0;o<n.length;o++)s(1e3,n[o]);if(!0!==e)break}}(20),!0===this.options.hierarchical.parentCentralization&&function(){var e=g.hierarchical.getLevels();e=HC(e).call(e);for(var t=0;t<e.length;t++)for(var A=e[t],C=g.hierarchical.distributionOrdering[A],i=0;i<C.length;i++)g._centerParent(C[i])}(),function(){for(var e=C(),t=0,i=0;i<e.length-1;i++){t+=e[i].max-e[i+1].min+g.options.hierarchical.treeSpacing,A(i+1,t)}}()}},{key:"_getSpaceAroundNode",value:function(g,e){var t=!0;void 0===e&&(t=!1);var A=this.hierarchical.levels[g.id];if(void 0!==A){var C=this.hierarchical.distributionIndex[g.id],i=this.direction.getPosition(g),I=this.hierarchical.distributionOrdering[A],n=1e9,o=1e9;if(0!==C){var r=I[C-1];if(!0===t&&void 0===e[r.id]||!1===t)n=i-this.direction.getPosition(r)}if(C!=I.length-1){var s=I[C+1];if(!0===t&&void 0===e[s.id]||!1===t){var a=this.direction.getPosition(s);o=Math.min(o,a-i)}}return[n,o]}return[0,0]}},{key:"_centerParent",value:function(g){if(this.hierarchical.parentReference[g.id])for(var e=this.hierarchical.parentReference[g.id],t=0;t<e.length;t++){var A=e[t],C=this.body.nodes[A],i=this.hierarchical.childrenReference[A];if(void 0!==i){var I=this._getCenterPosition(i),n=this.direction.getPosition(C),o=pC(this._getSpaceAroundNode(C),2),r=o[0],s=o[1],a=n-I;(a<0&&Math.abs(a)<s-this.options.hierarchical.nodeSpacing||a>0&&Math.abs(a)<r-this.options.hierarchical.nodeSpacing)&&this.direction.setPosition(C,I)}}}},{key:"_placeNodesByHierarchy",value:function(g){for(var e in this.positionedNodes={},g)if(Object.prototype.hasOwnProperty.call(g,e)){var t,A=BC(g[e]);A=this._indexArrayToNodes(A),us(t=this.direction).call(t,A);for(var C=0,i=0;i<A.length;i++){var I=A[i];if(void 0===this.positionedNodes[I.id]){var n=this.options.hierarchical.nodeSpacing,o=n*C;C>0&&(o=this.direction.getPosition(A[i-1])+n),this.direction.setPosition(I,o,e),this._validatePositionAndContinue(I,e,o),C++}}}}},{key:"_placeBranchNodes",value:function(g,e){var t,A=this.hierarchical.childrenReference[g];if(void 0!==A){for(var C=[],i=0;i<A.length;i++)C.push(this.body.nodes[A[i]]);us(t=this.direction).call(t,C);for(var I=0;I<C.length;I++){var n=C[I],o=this.hierarchical.levels[n.id];if(!(o>e&&void 0===this.positionedNodes[n.id]))return;var r=this.options.hierarchical.nodeSpacing,s=void 0;s=0===I?this.direction.getPosition(this.body.nodes[g]):this.direction.getPosition(C[I-1])+r,this.direction.setPosition(n,s,o),this._validatePositionAndContinue(n,o,s)}var a=this._getCenterPosition(C);this.direction.setPosition(this.body.nodes[g],a,e)}}},{key:"_validatePositionAndContinue",value:function(g,e,t){if(this.hierarchical.isTree){if(void 0!==this.lastNodeOnLevel[e]){var A=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[e]]);if(t-A<this.options.hierarchical.nodeSpacing){var C=A+this.options.hierarchical.nodeSpacing-t,i=this._findCommonParent(this.lastNodeOnLevel[e],g.id);this._shiftBlock(i.withChild,C)}}this.lastNodeOnLevel[e]=g.id,this.positionedNodes[g.id]=!0,this._placeBranchNodes(g.id,e)}}},{key:"_indexArrayToNodes",value:function(g){for(var e=[],t=0;t<g.length;t++)e.push(this.body.nodes[g[t]]);return e}},{key:"_getDistribution",value:function(){var g,e,t={};for(g in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,g)){e=this.body.nodes[g];var A=void 0===this.hierarchical.levels[g]?0:this.hierarchical.levels[g];this.direction.fix(e,A),void 0===t[A]&&(t[A]={}),t[A][g]=e}return t}},{key:"_getActiveEdges",value:function(g){var e=this,t=[];return Co(g.edges,(function(g){var A;-1!==ji(A=e.body.edgeIndices).call(A,g.id)&&t.push(g)})),t}},{key:"_getHubSizes",value:function(){var g=this,e={};Co(this.body.nodeIndices,(function(t){var A=g.body.nodes[t],C=g._getActiveEdges(A).length;e[C]=!0}));var t=[];return Co(e,(function(g){t.push(Number(g))})),us(_d).call(_d,t,(function(g,e){return e-g})),t}},{key:"_determineLevelsByHubsize",value:function(){for(var g=this,e=function(e,t){g.hierarchical.levelDownstream(e,t)},t=this._getHubSizes(),A=function(A){var C=t[A];if(0===C)return"break";Co(g.body.nodeIndices,(function(t){var A=g.body.nodes[t];C===g._getActiveEdges(A).length&&g._crawlNetwork(e,t)}))},C=0;C<t.length;++C){if("break"===A(C))break}}},{key:"_determineLevelsCustomCallback",value:function(){var g=this;this._crawlNetwork((function(e,t,A){var C=g.hierarchical.levels[e.id];void 0===C&&(C=g.hierarchical.levels[e.id]=1e5);var i=(ed.cloneOptions(e,"node"),ed.cloneOptions(t,"node"),void ed.cloneOptions(A,"edge"));g.hierarchical.levels[t.id]=C+i})),this.hierarchical.setMinLevelToZero(this.body.nodes)}},{key:"_determineLevelsDirected",value:function(){var g,e=this,t=As(g=this.body.nodeIndices).call(g,(function(g,t){return g.set(t,e.body.nodes[t]),g}),new Tr);"roots"===this.options.hierarchical.shakeTowards?this.hierarchical.levels=function(g){return Ch((function(e){var t,A;return gh(t=pi(A=e.edges).call(A,(function(e){return g.has(e.toId)}))).call(t,(function(g){return g.from===e}))}),(function(g,e){return e<g}),"to",g)}(t):this.hierarchical.levels=function(g){return Ch((function(e){var t,A;return gh(t=pi(A=e.edges).call(A,(function(e){return g.has(e.toId)}))).call(t,(function(g){return g.to===e}))}),(function(g,e){return e>g}),"from",g)}(t),this.hierarchical.setMinLevelToZero(this.body.nodes)}},{key:"_generateMap",value:function(){var g=this;this._crawlNetwork((function(e,t){g.hierarchical.levels[t.id]>g.hierarchical.levels[e.id]&&g.hierarchical.addRelation(e.id,t.id)})),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var g=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0,A={},C=function t(C,i){if(void 0===A[C.id]){var I;g.hierarchical.setTreeIndex(C,i),A[C.id]=!0;for(var n=g._getActiveEdges(C),o=0;o<n.length;o++){var r=n[o];!0===r.connected&&(I=r.toId==C.id?r.from:r.to,C.id!=I.id&&(e(C,I,r),t(I,i)))}}};if(void 0===t)for(var i=0,I=0;I<this.body.nodeIndices.length;I++){var n=this.body.nodeIndices[I];if(void 0===A[n]){var o=this.body.nodes[n];C(o,i),i+=1}}else{var r=this.body.nodes[t];if(void 0===r)return void console.error("Node not found:",t);C(r)}}},{key:"_shiftBlock",value:function(g,e){var t=this,A={};!function g(C){if(!A[C]){A[C]=!0,t.direction.shift(C,e);var i=t.hierarchical.childrenReference[C];if(void 0!==i)for(var I=0;I<i.length;I++)g(i[I])}}(g)}},{key:"_findCommonParent",value:function(g,e){var t=this,A={};return function g(e,A){var C=t.hierarchical.parentReference[A];if(void 0!==C)for(var i=0;i<C.length;i++){var I=C[i];e[I]=!0,g(e,I)}}(A,g),function g(e,A){var C=t.hierarchical.parentReference[A];if(void 0!==C)for(var i=0;i<C.length;i++){var I=C[i];if(void 0!==e[I])return{foundParent:I,withChild:A};var n=g(e,I);if(null!==n.foundParent)return n}return{foundParent:null,withChild:A}}(A,e)}},{key:"setDirectionStrategy",value:function(){var g="UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction;this.direction=g?new Hd(this):new Kd(this)}},{key:"_getCenterPosition",value:function(g){for(var e=1e9,t=-1e9,A=0;A<g.length;A++){var C=void 0;if(void 0!==g[A].id)C=g[A];else{var i=g[A];C=this.body.nodes[i]}var I=this.direction.getPosition(C);e=Math.min(e,I),t=Math.max(t,I)}return.5*(e+t)}}]),g}();function nh(g,e){var t;if(void 0===bC||null==Gt(g)){if(TC(g)||(t=function(g,e){var t;if(!g)return;if("string"==typeof g)return oh(g,e);var A=EC(t=Object.prototype.toString.call(g)).call(t,8,-1);"Object"===A&&g.constructor&&(A=g.constructor.name);if("Map"===A||"Set"===A)return Mt(g);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return oh(g,e)}(g))||e&&g&&"number"==typeof g.length){t&&(g=t);var A=0,C=function(){};return{s:C,n:function(){return A>=g.length?{done:!0}:{done:!1,value:g[A++]}},e:function(g){throw g},f:C}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,I=!0,n=!1;return{s:function(){t=Vt(g)},n:function(){var g=t.next();return I=g.done,g},e:function(g){n=!0,i=g},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw i}}}}function oh(g,e){(null==e||e>g.length)&&(e=g.length);for(var t=0,A=new Array(e);t<e;t++)A[t]=g[t];return A}Ug("div.vis-network div.vis-manipulation {\n  box-sizing: content-box;\n\n  border-width: 0;\n  border-bottom: 1px;\n  border-style: solid;\n  border-color: #d6d9d8;\n  background: #ffffff; /* Old browsers */\n  background: -moz-linear-gradient(\n    top,\n    #ffffff 0%,\n    #fcfcfc 48%,\n    #fafafa 50%,\n    #fcfcfc 100%\n  ); /* FF3.6+ */\n  background: -webkit-gradient(\n    linear,\n    left top,\n    left bottom,\n    color-stop(0%, #ffffff),\n    color-stop(48%, #fcfcfc),\n    color-stop(50%, #fafafa),\n    color-stop(100%, #fcfcfc)\n  ); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(\n    top,\n    #ffffff 0%,\n    #fcfcfc 48%,\n    #fafafa 50%,\n    #fcfcfc 100%\n  ); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(\n    top,\n    #ffffff 0%,\n    #fcfcfc 48%,\n    #fafafa 50%,\n    #fcfcfc 100%\n  ); /* Opera 11.10+ */\n  background: -ms-linear-gradient(\n    top,\n    #ffffff 0%,\n    #fcfcfc 48%,\n    #fafafa 50%,\n    #fcfcfc 100%\n  ); /* IE10+ */\n  background: linear-gradient(\n    to bottom,\n    #ffffff 0%,\n    #fcfcfc 48%,\n    #fafafa 50%,\n    #fcfcfc 100%\n  ); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */\n\n  padding-top: 4px;\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 28px;\n}\n\ndiv.vis-network div.vis-edit-mode,\ndiv.vis-network button.vis-edit-mode {\n  position: absolute;\n  left: 0;\n  top: 5px;\n  height: 30px;\n}\n\n/* FIXME: shouldn't the vis-close button be a child of the vis-manipulation div? */\n\ndiv.vis-network button.vis-close {\n  position: absolute;\n  right: 0;\n  top: 0;\n  width: 30px;\n  height: 30px;\n\n  background-color: transparent;\n  background-position: 20px 3px;\n  background-repeat: no-repeat;\n  background-image: url('data:image/png;base64, ');\n  border: none;\n  cursor: pointer;\n  -webkit-touch-callout: none;\n  -webkit-user-select: none;\n  -khtml-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n\ndiv.vis-network button.vis-close:hover {\n  opacity: 0.6;\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button,\ndiv.vis-network div.vis-edit-mode button.vis-button {\n  float: left;\n  font-family: verdana;\n  font-size: 12px;\n  border: none;\n  box-sizing: content-box;\n  -moz-border-radius: 15px;\n  border-radius: 15px;\n  background-color: transparent;\n  background-position: 0px 0px;\n  background-repeat: no-repeat;\n  height: 24px;\n  margin-left: 10px;\n  cursor: pointer;\n  padding: 0px 8px 0px 8px;\n  -webkit-touch-callout: none;\n  -webkit-user-select: none;\n  -khtml-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button:hover {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.2);\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button:active {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.5);\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button.vis-back {\n  background-image: url('data:image/png;base64, ');\n}\n\ndiv.vis-network div.vis-manipulation div.vis-none:hover {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0);\n  cursor: default;\n}\ndiv.vis-network div.vis-manipulation div.vis-none:active {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0);\n}\ndiv.vis-network div.vis-manipulation div.vis-none {\n  padding: 0px;\n  line-height: 23px;\n}\ndiv.vis-network div.vis-manipulation div.notification {\n  margin: 2px;\n  font-weight: bold;\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button.vis-add {\n  background-image: url('data:image/png;base64, ');\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button.vis-edit,\ndiv.vis-network div.vis-edit-mode button.vis-button.vis-edit {\n  background-image: url('data:image/png;base64, ');\n}\n\ndiv.vis-network div.vis-edit-mode button.vis-button.vis-edit.vis-edit-mode {\n  background-color: #fcfcfc;\n  border: 1px solid #cccccc;\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button.vis-connect {\n  background-image: url('data:image/png;base64, ');\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button.vis-delete {\n  background-image: url('data:image/png;base64, ');\n}\n/* top right bottom left */\ndiv.vis-network div.vis-manipulation div.vis-label,\ndiv.vis-network div.vis-edit-mode div.vis-label {\n  margin: 0 0 0 23px;\n  line-height: 25px;\n}\ndiv.vis-network div.vis-manipulation div.vis-separator-line {\n  float: left;\n  display: inline-block;\n  width: 1px;\n  height: 21px;\n  background-color: #bdbdbd;\n  margin: 0px 7px 0 15px; /*top right bottom left*/\n}\n\n/* TODO: is this redundant?\ndiv.network-navigation_wrapper {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n}\n*/\n");var rh=function(){function g(e,t,A,C){var i,I,n=this;YA(this,g),this.body=e,this.canvas=t,this.selectionHandler=A,this.interactionHandler=C,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this._domEventListenerCleanupQueue=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},Rg(this.options,this.defaultOptions),this.body.emitter.on("destroy",(function(){n._clean()})),this.body.emitter.on("_dataChanged",jg(i=this._restore).call(i,this)),this.body.emitter.on("_resetData",jg(I=this._restore).call(I,this))}return UA(g,[{key:"_restore",value:function(){!1!==this.inMode&&(!0===this.options.initiallyActive?this.enableEditMode():this.disableEditMode())}},{key:"setOptions",value:function(g,e,t){void 0!==e&&(void 0!==e.locale?this.options.locale=e.locale:this.options.locale=t.locale,void 0!==e.locales?this.options.locales=e.locales:this.options.locales=t.locales),void 0!==g&&("boolean"==typeof g?this.options.enabled=g:(this.options.enabled=!0,go(this.options,g)),!0===this.options.initiallyActive&&(this.editMode=!0),this._setup())}},{key:"toggleEditMode",value:function(){!0===this.editMode?this.disableEditMode():this.enableEditMode()}},{key:"enableEditMode",value:function(){this.editMode=!0,this._clean(),!0===this.guiEnabled&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}},{key:"disableEditMode",value:function(){this.editMode=!1,this._clean(),!0===this.guiEnabled&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}},{key:"showManipulatorToolbar",value:function(){if(this._clean(),this.manipulationDOM={},!0===this.guiEnabled){var g,e;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";var t=this.selectionHandler.getSelectedNodeCount(),A=this.selectionHandler.getSelectedEdgeCount(),C=t+A,i=this.options.locales[this.options.locale],I=!1;!1!==this.options.addNode&&(this._createAddNodeButton(i),I=!0),!1!==this.options.addEdge&&(!0===I?this._createSeperator(1):I=!0,this._createAddEdgeButton(i)),1===t&&"function"==typeof this.options.editNode?(!0===I?this._createSeperator(2):I=!0,this._createEditNodeButton(i)):1===A&&0===t&&!1!==this.options.editEdge&&(!0===I?this._createSeperator(3):I=!0,this._createEditEdgeButton(i)),0!==C&&(t>0&&!1!==this.options.deleteNode||0===t&&!1!==this.options.deleteEdge)&&(!0===I&&this._createSeperator(4),this._createDeleteButton(i)),this._bindElementEvents(this.closeDiv,jg(g=this.toggleEditMode).call(g,this)),this._temporaryBindEvent("select",jg(e=this.showManipulatorToolbar).call(e,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var g;if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addNode",!0===this.guiEnabled){var e,t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,jg(e=this.toggleEditMode).call(e,this))}this._temporaryBindEvent("click",jg(g=this._performAddNode).call(g,this))}},{key:"editNode",value:function(){var g=this;!0!==this.editMode&&this.enableEditMode(),this._clean();var e=this.selectionHandler.getSelectedNodes()[0];if(void 0!==e){if(this.inMode="editNode","function"!=typeof this.options.editNode)throw new Error("No function has been configured to handle the editing of nodes.");if(!0!==e.isCluster){var t=go({},e.options,!1);if(t.x=e.x,t.y=e.y,2!==this.options.editNode.length)throw new Error("The function for edit does not support two arguments (data, callback)");this.options.editNode(t,(function(e){null!=e&&"editNode"===g.inMode&&g.body.data.nodes.getDataSet().update(e),g.showManipulatorToolbar()}))}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError)}else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var g,e,t,A,C;if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addEdge",!0===this.guiEnabled){var i,I=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(I),this._createSeperator(),this._createDescription(I.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,jg(i=this.toggleEditMode).call(i,this))}this._temporaryBindUI("onTouch",jg(g=this._handleConnect).call(g,this)),this._temporaryBindUI("onDragEnd",jg(e=this._finishConnect).call(e,this)),this._temporaryBindUI("onDrag",jg(t=this._dragControlNode).call(t,this)),this._temporaryBindUI("onRelease",jg(A=this._finishConnect).call(A,this)),this._temporaryBindUI("onDragStart",jg(C=this._dragStartEdge).call(C,this)),this._temporaryBindUI("onHold",(function(){}))}},{key:"editEdgeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="editEdge","object"!==mC(this.options.editEdge)||"function"!=typeof this.options.editEdge.editWithoutDrag||(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],void 0===this.edgeBeingEditedId)){if(!0===this.guiEnabled){var g,e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,jg(g=this.toggleEditMode).call(g,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],void 0!==this.edgeBeingEditedId){var t,A,C,i,I=this.body.edges[this.edgeBeingEditedId],n=this._getNewTargetNode(I.from.x,I.from.y),o=this._getNewTargetNode(I.to.x,I.to.y);this.temporaryIds.nodes.push(n.id),this.temporaryIds.nodes.push(o.id),this.body.nodes[n.id]=n,this.body.nodeIndices.push(n.id),this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id),this._temporaryBindUI("onTouch",jg(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",(function(){})),this._temporaryBindUI("onHold",(function(){})),this._temporaryBindUI("onDragStart",jg(A=this._controlNodeDragStart).call(A,this)),this._temporaryBindUI("onDrag",jg(C=this._controlNodeDrag).call(C,this)),this._temporaryBindUI("onDragEnd",jg(i=this._controlNodeDragEnd).call(i,this)),this._temporaryBindUI("onMouseMove",(function(){})),this._temporaryBindEvent("beforeDrawing",(function(g){var e=I.edgeType.findBorderPositions(g);!1===n.selected&&(n.x=e.from.x,n.y=e.from.y),!1===o.selected&&(o.x=e.to.x,o.y=e.to.y)})),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}else{var r=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(r.from.id,r.to.id)}}},{key:"deleteSelected",value:function(){var g=this;!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="delete";var e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds(),A=void 0;if(e.length>0){for(var C=0;C<e.length;C++)if(!0===this.body.nodes[e[C]].isCluster)return void alert(this.options.locales[this.options.locale].deleteClusterError||this.options.locales.en.deleteClusterError);"function"==typeof this.options.deleteNode&&(A=this.options.deleteNode)}else t.length>0&&"function"==typeof this.options.deleteEdge&&(A=this.options.deleteEdge);if("function"==typeof A){var i={nodes:e,edges:t};if(2!==A.length)throw new Error("The function for delete does not support two arguments (data, callback)");A(i,(function(e){null!=e&&"delete"===g.inMode?(g.body.data.edges.getDataSet().remove(e.edges),g.body.data.nodes.getDataSet().remove(e.nodes),g.body.emitter.emit("startSimulation"),g.showManipulatorToolbar()):(g.body.emitter.emit("startSimulation"),g.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){!0===this.options.enabled?(this.guiEnabled=!0,this._createWrappers(),!1===this.editMode?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){var g,e;(void 0===this.manipulationDiv&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",!0===this.editMode?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),void 0===this.editModeDiv&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",!0===this.editMode?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),void 0===this.closeDiv)&&(this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",null!==(g=null===(e=this.options.locales[this.options.locale])||void 0===e?void 0:e.close)&&void 0!==g?g:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}},{key:"_getNewTargetNode",value:function(g,e){var t=go({},this.options.controlNodeStyle);t.id="targetNode"+Bs(),t.hidden=!1,t.physics=!1,t.x=g,t.y=e;var A=this.body.functions.createNode(t);return A.shape.boundingBox={left:g,right:g,top:e,bottom:e},A}},{key:"_createEditButton",value:function(){var g;this._clean(),this.manipulationDOM={},Qn(this.editModeDiv);var e=this.options.locales[this.options.locale],t=this._createButton("editMode","vis-edit vis-edit-mode",e.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(t),this._bindElementEvents(t,jg(g=this.toggleEditMode).call(g,this))}},{key:"_clean",value:function(){this.inMode=!1,!0===this.guiEnabled&&(Qn(this.editModeDiv),Qn(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var g,e,t=nh(gi(g=this._domEventListenerCleanupQueue).call(g,0));try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(g){t.e(g)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),Qn(this.manipulationDiv),Qn(this.editModeDiv),Qn(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+g]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+g].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+g])}},{key:"_createAddNodeButton",value:function(g){var e,t=this._createButton("addNode","vis-add",g.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,jg(e=this.addNodeMode).call(e,this))}},{key:"_createAddEdgeButton",value:function(g){var e,t=this._createButton("addEdge","vis-connect",g.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,jg(e=this.addEdgeMode).call(e,this))}},{key:"_createEditNodeButton",value:function(g){var e,t=this._createButton("editNode","vis-edit",g.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,jg(e=this.editNode).call(e,this))}},{key:"_createEditEdgeButton",value:function(g){var e,t=this._createButton("editEdge","vis-edit",g.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,jg(e=this.editEdgeMode).call(e,this))}},{key:"_createDeleteButton",value:function(g){var e,t;t=this.options.rtl?"vis-delete-rtl":"vis-delete";var A=this._createButton("delete",t,g.del||this.options.locales.en.del);this.manipulationDiv.appendChild(A),this._bindElementEvents(A,jg(e=this.deleteSelected).call(e,this))}},{key:"_createBackButton",value:function(g){var e,t=this._createButton("back","vis-back",g.back||this.options.locales.en.back);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,jg(e=this.showManipulatorToolbar).call(e,this))}},{key:"_createButton",value:function(g,e,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"vis-label";return this.manipulationDOM[g+"Div"]=document.createElement("button"),this.manipulationDOM[g+"Div"].className="vis-button "+e,this.manipulationDOM[g+"Label"]=document.createElement("div"),this.manipulationDOM[g+"Label"].className=A,this.manipulationDOM[g+"Label"].innerText=t,this.manipulationDOM[g+"Div"].appendChild(this.manipulationDOM[g+"Label"]),this.manipulationDOM[g+"Div"]}},{key:"_createDescription",value:function(g){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=g,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(g,e){this.temporaryEventFunctions.push({event:g,boundFunction:e}),this.body.emitter.on(g,e)}},{key:"_temporaryBindUI",value:function(g,e){if(void 0===this.body.eventListeners[g])throw new Error("This UI function does not exist. Typo? You tried: "+g+" possible are: "+Xi(BC(this.body.eventListeners)));this.temporaryUIFunctions[g]=this.body.eventListeners[g],this.body.eventListeners[g]=e}},{key:"_unbindTemporaryUIs",value:function(){for(var g in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,g)&&(this.body.eventListeners[g]=this.temporaryUIFunctions[g],delete this.temporaryUIFunctions[g]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var g=0;g<this.temporaryEventFunctions.length;g++){var e=this.temporaryEventFunctions[g].event,t=this.temporaryEventFunctions[g].boundFunction;this.body.emitter.off(e,t)}this.temporaryEventFunctions=[]}},{key:"_bindElementEvents",value:function(g,e){var t=new Oo(g,{});rd(t,e),this._domEventListenerCleanupQueue.push((function(){t.destroy()}));var A=function(g){var t=g.keyCode,A=g.key;"Enter"!==A&&" "!==A&&13!==t&&32!==t||e()};g.addEventListener("keyup",A,!1),this._domEventListenerCleanupQueue.push((function(){g.removeEventListener("keyup",A,!1)}))}},{key:"_cleanupTemporaryNodesAndEdges",value:function(){for(var g=0;g<this.temporaryIds.edges.length;g++){var e;this.body.edges[this.temporaryIds.edges[g]].disconnect(),delete this.body.edges[this.temporaryIds.edges[g]];var t,A=ji(e=this.body.edgeIndices).call(e,this.temporaryIds.edges[g]);if(-1!==A)gi(t=this.body.edgeIndices).call(t,A,1)}for(var C=0;C<this.temporaryIds.nodes.length;C++){var i;delete this.body.nodes[this.temporaryIds.nodes[C]];var I,n=ji(i=this.body.nodeIndices).call(i,this.temporaryIds.nodes[C]);if(-1!==n)gi(I=this.body.nodeIndices).call(I,n,1)}this.temporaryIds={nodes:[],edges:[]}}},{key:"_controlNodeTouch",value:function(g){this.selectionHandler.unselectAll(),this.lastTouch=this.body.functions.getPointer(g.center),this.lastTouch.translation=Rg({},this.body.view.translation)}},{key:"_controlNodeDragStart",value:function(){var g=this.lastTouch,e=this.selectionHandler._pointerToPositionObject(g),t=this.body.nodes[this.temporaryIds.nodes[0]],A=this.body.nodes[this.temporaryIds.nodes[1]],C=this.body.edges[this.edgeBeingEditedId];this.selectedControlNode=void 0;var i=t.isOverlappingWith(e),I=A.isOverlappingWith(e);!0===i?(this.selectedControlNode=t,C.edgeType.from=t):!0===I&&(this.selectedControlNode=A,C.edgeType.to=A),void 0!==this.selectedControlNode&&this.selectionHandler.selectObject(this.selectedControlNode),this.body.emitter.emit("_redraw")}},{key:"_controlNodeDrag",value:function(g){this.body.emitter.emit("disablePhysics");var e=this.body.functions.getPointer(g.center),t=this.canvas.DOMtoCanvas(e);void 0!==this.selectedControlNode?(this.selectedControlNode.x=t.x,this.selectedControlNode.y=t.y):this.interactionHandler.onDrag(g),this.body.emitter.emit("_redraw")}},{key:"_controlNodeDragEnd",value:function(g){var e=this.body.functions.getPointer(g.center),t=this.selectionHandler._pointerToPositionObject(e),A=this.body.edges[this.edgeBeingEditedId];if(void 0!==this.selectedControlNode){this.selectionHandler.unselectAll();for(var C=this.selectionHandler._getAllNodesOverlappingWith(t),i=void 0,I=C.length-1;I>=0;I--)if(C[I]!==this.selectedControlNode.id){i=this.body.nodes[C[I]];break}if(void 0!==i&&void 0!==this.selectedControlNode)if(!0===i.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var n=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===n.id?this._performEditEdge(i.id,A.to.id):this._performEditEdge(A.from.id,i.id)}else A.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(g){if((new Date).valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(g.center),this.lastTouch.translation=Rg({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var e=this.lastTouch,t=this.selectionHandler.getNodeAt(e);if(void 0!==t)if(!0===t.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var A=this._getNewTargetNode(t.x,t.y);this.body.nodes[A.id]=A,this.body.nodeIndices.push(A.id);var C=this.body.functions.createEdge({id:"connectionEdge"+Bs(),from:t.id,to:A.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[C.id]=C,this.body.edgeIndices.push(C.id),this.temporaryIds.nodes.push(A.id),this.temporaryIds.edges.push(C.id)}this.touchTime=(new Date).valueOf()}}},{key:"_dragControlNode",value:function(g){var e=this.body.functions.getPointer(g.center),t=this.selectionHandler._pointerToPositionObject(e),A=void 0;void 0!==this.temporaryIds.edges[0]&&(A=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var C=this.selectionHandler._getAllNodesOverlappingWith(t),i=void 0,I=C.length-1;I>=0;I--){var n;if(-1===ji(n=this.temporaryIds.nodes).call(n,C[I])){i=this.body.nodes[C[I]];break}}if(g.controlEdge={from:A,to:i?i.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",g,e),void 0!==this.temporaryIds.nodes[0]){var o=this.body.nodes[this.temporaryIds.nodes[0]];o.x=this.canvas._XconvertDOMtoCanvas(e.x),o.y=this.canvas._YconvertDOMtoCanvas(e.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(g)}},{key:"_finishConnect",value:function(g){var e=this.body.functions.getPointer(g.center),t=this.selectionHandler._pointerToPositionObject(e),A=void 0;void 0!==this.temporaryIds.edges[0]&&(A=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var C=this.selectionHandler._getAllNodesOverlappingWith(t),i=void 0,I=C.length-1;I>=0;I--){var n;if(-1===ji(n=this.temporaryIds.nodes).call(n,C[I])){i=this.body.nodes[C[I]];break}}this._cleanupTemporaryNodesAndEdges(),void 0!==i&&(!0===i.isCluster?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):void 0!==this.body.nodes[A]&&void 0!==this.body.nodes[i.id]&&this._performAddEdge(A,i.id)),g.controlEdge={from:A,to:i?i.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",g,e),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(g){var e=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",g,e,void 0,!0)}},{key:"_performAddNode",value:function(g){var e=this,t={id:Bs(),x:g.pointer.canvas.x,y:g.pointer.canvas.y,label:"new"};if("function"==typeof this.options.addNode){if(2!==this.options.addNode.length)throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");this.options.addNode(t,(function(g){null!=g&&"addNode"===e.inMode&&e.body.data.nodes.getDataSet().add(g),e.showManipulatorToolbar()}))}else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(g,e){var t=this,A={from:g,to:e};if("function"==typeof this.options.addEdge){if(2!==this.options.addEdge.length)throw new Error("The function for connect does not support two arguments (data,callback)");this.options.addEdge(A,(function(g){null!=g&&"addEdge"===t.inMode&&(t.body.data.edges.getDataSet().add(g),t.selectionHandler.unselectAll(),t.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().add(A),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(g,e){var t=this,A={id:this.edgeBeingEditedId,from:g,to:e,label:this.body.data.edges.get(this.edgeBeingEditedId).label},C=this.options.editEdge;if("object"===mC(C)&&(C=C.editWithoutDrag),"function"==typeof C){if(2!==C.length)throw new Error("The function for edit does not support two arguments (data, callback)");C(A,(function(g){null==g||"editEdge"!==t.inMode?(t.body.edges[A.id].updateEdgeType(),t.body.emitter.emit("_redraw"),t.showManipulatorToolbar()):(t.body.data.edges.getDataSet().update(g),t.selectionHandler.unselectAll(),t.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().update(A),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),g}(),sh="string",ah="boolean",lh="number",dh="object",hh=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],ch={borderWidth:{number:lh},borderWidthSelected:{number:lh,undefined:"undefined"},brokenImage:{string:sh,undefined:"undefined"},chosen:{label:{boolean:ah,function:"function"},node:{boolean:ah,function:"function"},__type__:{object:dh,boolean:ah}},color:{border:{string:sh},background:{string:sh},highlight:{border:{string:sh},background:{string:sh},__type__:{object:dh,string:sh}},hover:{border:{string:sh},background:{string:sh},__type__:{object:dh,string:sh}},__type__:{object:dh,string:sh}},opacity:{number:lh,undefined:"undefined"},fixed:{x:{boolean:ah},y:{boolean:ah},__type__:{object:dh,boolean:ah}},font:{align:{string:sh},color:{string:sh},size:{number:lh},face:{string:sh},background:{string:sh},strokeWidth:{number:lh},strokeColor:{string:sh},vadjust:{number:lh},multi:{boolean:ah,string:sh},bold:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},boldital:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},ital:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},mono:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},__type__:{object:dh,string:sh}},group:{string:sh,number:lh,undefined:"undefined"},heightConstraint:{minimum:{number:lh},valign:{string:sh},__type__:{object:dh,boolean:ah,number:lh}},hidden:{boolean:ah},icon:{face:{string:sh},code:{string:sh},size:{number:lh},color:{string:sh},weight:{string:sh,number:lh},__type__:{object:dh}},id:{string:sh,number:lh},image:{selected:{string:sh,undefined:"undefined"},unselected:{string:sh,undefined:"undefined"},__type__:{object:dh,string:sh}},imagePadding:{top:{number:lh},right:{number:lh},bottom:{number:lh},left:{number:lh},__type__:{object:dh,number:lh}},label:{string:sh,undefined:"undefined"},labelHighlightBold:{boolean:ah},level:{number:lh,undefined:"undefined"},margin:{top:{number:lh},right:{number:lh},bottom:{number:lh},left:{number:lh},__type__:{object:dh,number:lh}},mass:{number:lh},physics:{boolean:ah},scaling:{min:{number:lh},max:{number:lh},label:{enabled:{boolean:ah},min:{number:lh},max:{number:lh},maxVisible:{number:lh},drawThreshold:{number:lh},__type__:{object:dh,boolean:ah}},customScalingFunction:{function:"function"},__type__:{object:dh}},shadow:{enabled:{boolean:ah},color:{string:sh},size:{number:lh},x:{number:lh},y:{number:lh},__type__:{object:dh,boolean:ah}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:ah,array:"array"},borderRadius:{number:lh},interpolation:{boolean:ah},useImageSize:{boolean:ah},useBorderWithImage:{boolean:ah},coordinateOrigin:{string:["center","top-left"]},__type__:{object:dh}},size:{number:lh},title:{string:sh,dom:"dom",undefined:"undefined"},value:{number:lh,undefined:"undefined"},widthConstraint:{minimum:{number:lh},maximum:{number:lh},__type__:{object:dh,boolean:ah,number:lh}},x:{number:lh},y:{number:lh},__type__:{object:dh}},uh={configure:{enabled:{boolean:ah},filter:{boolean:ah,string:sh,array:"array",function:"function"},container:{dom:"dom"},showButton:{boolean:ah},__type__:{object:dh,boolean:ah,string:sh,array:"array",function:"function"}},edges:{arrows:{to:{enabled:{boolean:ah},scaleFactor:{number:lh},type:{string:hh},imageHeight:{number:lh},imageWidth:{number:lh},src:{string:sh},__type__:{object:dh,boolean:ah}},middle:{enabled:{boolean:ah},scaleFactor:{number:lh},type:{string:hh},imageWidth:{number:lh},imageHeight:{number:lh},src:{string:sh},__type__:{object:dh,boolean:ah}},from:{enabled:{boolean:ah},scaleFactor:{number:lh},type:{string:hh},imageWidth:{number:lh},imageHeight:{number:lh},src:{string:sh},__type__:{object:dh,boolean:ah}},__type__:{string:["from","to","middle"],object:dh}},endPointOffset:{from:{number:lh},to:{number:lh},__type__:{object:dh,number:lh}},arrowStrikethrough:{boolean:ah},background:{enabled:{boolean:ah},color:{string:sh},size:{number:lh},dashes:{boolean:ah,array:"array"},__type__:{object:dh,boolean:ah}},chosen:{label:{boolean:ah,function:"function"},edge:{boolean:ah,function:"function"},__type__:{object:dh,boolean:ah}},color:{color:{string:sh},highlight:{string:sh},hover:{string:sh},inherit:{string:["from","to","both"],boolean:ah},opacity:{number:lh},__type__:{object:dh,string:sh}},dashes:{boolean:ah,array:"array"},font:{color:{string:sh},size:{number:lh},face:{string:sh},background:{string:sh},strokeWidth:{number:lh},strokeColor:{string:sh},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:lh},multi:{boolean:ah,string:sh},bold:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},boldital:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},ital:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},mono:{color:{string:sh},size:{number:lh},face:{string:sh},mod:{string:sh},vadjust:{number:lh},__type__:{object:dh,string:sh}},__type__:{object:dh,string:sh}},hidden:{boolean:ah},hoverWidth:{function:"function",number:lh},label:{string:sh,undefined:"undefined"},labelHighlightBold:{boolean:ah},length:{number:lh,undefined:"undefined"},physics:{boolean:ah},scaling:{min:{number:lh},max:{number:lh},label:{enabled:{boolean:ah},min:{number:lh},max:{number:lh},maxVisible:{number:lh},drawThreshold:{number:lh},__type__:{object:dh,boolean:ah}},customScalingFunction:{function:"function"},__type__:{object:dh}},selectionWidth:{function:"function",number:lh},selfReferenceSize:{number:lh},selfReference:{size:{number:lh},angle:{number:lh},renderBehindTheNode:{boolean:ah},__type__:{object:dh}},shadow:{enabled:{boolean:ah},color:{string:sh},size:{number:lh},x:{number:lh},y:{number:lh},__type__:{object:dh,boolean:ah}},smooth:{enabled:{boolean:ah},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:lh},forceDirection:{string:["horizontal","vertical","none"],boolean:ah},__type__:{object:dh,boolean:ah}},title:{string:sh,undefined:"undefined"},width:{number:lh},widthConstraint:{maximum:{number:lh},__type__:{object:dh,boolean:ah,number:lh}},value:{number:lh,undefined:"undefined"},__type__:{object:dh}},groups:{useDefaultGroups:{boolean:ah},__any__:ch,__type__:{object:dh}},interaction:{dragNodes:{boolean:ah},dragView:{boolean:ah},hideEdgesOnDrag:{boolean:ah},hideEdgesOnZoom:{boolean:ah},hideNodesOnDrag:{boolean:ah},hover:{boolean:ah},keyboard:{enabled:{boolean:ah},speed:{x:{number:lh},y:{number:lh},zoom:{number:lh},__type__:{object:dh}},bindToWindow:{boolean:ah},__type__:{object:dh,boolean:ah}},multiselect:{boolean:ah},navigationButtons:{boolean:ah},selectable:{boolean:ah},selectConnectedEdges:{boolean:ah},hoverConnectedEdges:{boolean:ah},tooltipDelay:{number:lh},zoomView:{boolean:ah},zoomSpeed:{number:lh},__type__:{object:dh}},layout:{randomSeed:{undefined:"undefined",number:lh,string:sh},improvedLayout:{boolean:ah},clusterThreshold:{number:lh},hierarchical:{enabled:{boolean:ah},levelSeparation:{number:lh},nodeSpacing:{number:lh},treeSpacing:{number:lh},blockShifting:{boolean:ah},edgeMinimization:{boolean:ah},parentCentralization:{boolean:ah},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:dh,boolean:ah}},__type__:{object:dh}},manipulation:{enabled:{boolean:ah},initiallyActive:{boolean:ah},addNode:{boolean:ah,function:"function"},addEdge:{boolean:ah,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:dh,boolean:ah,function:"function"}},deleteNode:{boolean:ah,function:"function"},deleteEdge:{boolean:ah,function:"function"},controlNodeStyle:ch,__type__:{object:dh,boolean:ah}},nodes:ch,physics:{enabled:{boolean:ah},barnesHut:{theta:{number:lh},gravitationalConstant:{number:lh},centralGravity:{number:lh},springLength:{number:lh},springConstant:{number:lh},damping:{number:lh},avoidOverlap:{number:lh},__type__:{object:dh}},forceAtlas2Based:{theta:{number:lh},gravitationalConstant:{number:lh},centralGravity:{number:lh},springLength:{number:lh},springConstant:{number:lh},damping:{number:lh},avoidOverlap:{number:lh},__type__:{object:dh}},repulsion:{centralGravity:{number:lh},springLength:{number:lh},springConstant:{number:lh},nodeDistance:{number:lh},damping:{number:lh},__type__:{object:dh}},hierarchicalRepulsion:{centralGravity:{number:lh},springLength:{number:lh},springConstant:{number:lh},nodeDistance:{number:lh},damping:{number:lh},avoidOverlap:{number:lh},__type__:{object:dh}},maxVelocity:{number:lh},minVelocity:{number:lh},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:ah},iterations:{number:lh},updateInterval:{number:lh},onlyDynamicEdges:{boolean:ah},fit:{boolean:ah},__type__:{object:dh,boolean:ah}},timestep:{number:lh},adaptiveTimestep:{boolean:ah},wind:{x:{number:lh},y:{number:lh},__type__:{object:dh}},__type__:{object:dh,boolean:ah}},autoResize:{boolean:ah},clickToUse:{boolean:ah},locale:{string:sh},locales:{__any__:{any:"any"},__type__:{object:dh}},height:{string:sh},width:{string:sh},__type__:{object:dh}},ph={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},fh=function(g,e,t){var A;return!(!ri(g).call(g,"physics")||!ri(A=ph.physics.solver).call(A,e)||t.physics.solver===e||"wind"===e)},vh=function(){function g(){YA(this,g)}return UA(g,[{key:"getDistances",value:function(g,e,t){for(var A={},C=g.edges,i=0;i<e.length;i++){var I={};A[e[i]]=I;for(var n=0;n<e.length;n++)I[e[n]]=i==n?0:1e9}for(var o=0;o<t.length;o++){var r=C[t[o]];!0===r.connected&&void 0!==A[r.fromId]&&void 0!==A[r.toId]&&(A[r.fromId][r.toId]=1,A[r.toId][r.fromId]=1)}for(var s=e.length,a=0;a<s;a++)for(var l=e[a],d=A[l],h=0;h<s-1;h++)for(var c=e[h],u=A[c],p=h+1;p<s;p++){var f=e[p],v=A[f],m=Math.min(u[f],u[l]+d[f]);u[f]=m,v[c]=m}return A}}]),g}(),mh=function(){function g(e,t,A){YA(this,g),this.body=e,this.springLength=t,this.springConstant=A,this.distanceSolver=new vh}return UA(g,[{key:"setOptions",value:function(g){g&&(g.springLength&&(this.springLength=g.springLength),g.springConstant&&(this.springConstant=g.springConstant))}},{key:"solve",value:function(g,e){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=this.distanceSolver.getDistances(this.body,g,e);this._createL_matrix(A),this._createK_matrix(A),this._createE_matrix();for(var C=.01,i=1,I=0,n=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),o=5,r=1e9,s=0,a=0,l=0,d=0,h=0;r>C&&I<n;){I+=1;var c=this._getHighestEnergyNode(t),u=pC(c,4);for(s=u[0],r=u[1],a=u[2],l=u[3],d=r,h=0;d>i&&h<o;){h+=1,this._moveNode(s,a,l);var p=this._getEnergy(s),f=pC(p,3);d=f[0],a=f[1],l=f[2]}}}},{key:"_getHighestEnergyNode",value:function(g){for(var e=this.body.nodeIndices,t=this.body.nodes,A=0,C=e[0],i=0,I=0,n=0;n<e.length;n++){var o=e[n];if(!0!==t[o].predefinedPosition||!0===t[o].isCluster&&!0===g||!0!==t[o].options.fixed.x||!0!==t[o].options.fixed.y){var r=pC(this._getEnergy(o),3),s=r[0],a=r[1],l=r[2];A<s&&(A=s,C=o,i=a,I=l)}}return[C,A,i,I]}},{key:"_getEnergy",value:function(g){var e=pC(this.E_sums[g],2),t=e[0],A=e[1];return[Math.sqrt(Math.pow(t,2)+Math.pow(A,2)),t,A]}},{key:"_moveNode",value:function(g,e,t){for(var A=this.body.nodeIndices,C=this.body.nodes,i=0,I=0,n=0,o=C[g].x,r=C[g].y,s=this.K_matrix[g],a=this.L_matrix[g],l=0;l<A.length;l++){var d=A[l];if(d!==g){var h=C[d].x,c=C[d].y,u=s[d],p=a[d],f=1/Math.pow(Math.pow(o-h,2)+Math.pow(r-c,2),1.5);i+=u*(1-p*Math.pow(r-c,2)*f),I+=u*(p*(o-h)*(r-c)*f),n+=u*(1-p*Math.pow(o-h,2)*f)}}var v=(e/i+t/I)/(I/i-n/I),m=-(I*v+e)/i;C[g].x+=m,C[g].y+=v,this._updateE_matrix(g)}},{key:"_createL_matrix",value:function(g){var e=this.body.nodeIndices,t=this.springLength;this.L_matrix=[];for(var A=0;A<e.length;A++){this.L_matrix[e[A]]={};for(var C=0;C<e.length;C++)this.L_matrix[e[A]][e[C]]=t*g[e[A]][e[C]]}}},{key:"_createK_matrix",value:function(g){var e=this.body.nodeIndices,t=this.springConstant;this.K_matrix=[];for(var A=0;A<e.length;A++){this.K_matrix[e[A]]={};for(var C=0;C<e.length;C++)this.K_matrix[e[A]][e[C]]=t*Math.pow(g[e[A]][e[C]],-2)}}},{key:"_createE_matrix",value:function(){var g=this.body.nodeIndices,e=this.body.nodes;this.E_matrix={},this.E_sums={};for(var t=0;t<g.length;t++)this.E_matrix[g[t]]=[];for(var A=0;A<g.length;A++){for(var C=g[A],i=e[C].x,I=e[C].y,n=0,o=0,r=A;r<g.length;r++){var s=g[r];if(s!==C){var a=e[s].x,l=e[s].y,d=1/Math.sqrt(Math.pow(i-a,2)+Math.pow(I-l,2));this.E_matrix[C][r]=[this.K_matrix[C][s]*(i-a-this.L_matrix[C][s]*(i-a)*d),this.K_matrix[C][s]*(I-l-this.L_matrix[C][s]*(I-l)*d)],this.E_matrix[s][A]=this.E_matrix[C][r],n+=this.E_matrix[C][r][0],o+=this.E_matrix[C][r][1]}}this.E_sums[C]=[n,o]}}},{key:"_updateE_matrix",value:function(g){for(var e=this.body.nodeIndices,t=this.body.nodes,A=this.E_matrix[g],C=this.K_matrix[g],i=this.L_matrix[g],I=t[g].x,n=t[g].y,o=0,r=0,s=0;s<e.length;s++){var a=e[s];if(a!==g){var l=A[s],d=l[0],h=l[1],c=t[a].x,u=t[a].y,p=1/Math.sqrt(Math.pow(I-c,2)+Math.pow(n-u,2)),f=C[a]*(I-c-i[a]*(I-c)*p),v=C[a]*(n-u-i[a]*(n-u)*p);A[s]=[f,v],o+=f,r+=v;var m=this.E_sums[a];m[0]+=f-d,m[1]+=v-h}}this.E_sums[g]=[o,r]}}]),g}();function yh(g,e,t){var A,C,i,I,n=this;if(!(this instanceof yh))throw new SyntaxError("Constructor must be called with the new operator");this.options={},this.defaultOptions={locale:"en",locales:or,clickToUse:!1},Rg(this.options,this.defaultOptions),this.body={container:g,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:jg(A=this.on).call(A,this),off:jg(C=this.off).call(C,this),emit:jg(i=this.emit).call(i,this),once:jg(I=this.once).call(I,this)},eventListeners:{onTap:function(){},onTouch:function(){},onDoubleTap:function(){},onHold:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},onMouseWheel:function(){},onPinch:function(){},onMouseMove:function(){},onRelease:function(){},onContext:function(){}},data:{nodes:null,edges:null},functions:{createNode:function(){},createEdge:function(){},getPointer:function(){}},modules:{},view:{scale:1,translation:{x:0,y:0}},selectionBox:{show:!1,position:{start:{x:0,y:0},end:{x:0,y:0}}}},this.bindEventListeners(),this.images=new sr((function(){return n.body.emitter.emit("_requestRedraw")})),this.groups=new Dr,this.canvas=new ad(this.body),this.selectionHandler=new Wd(this.body,this.canvas),this.interactionHandler=new fd(this.body,this.canvas,this.selectionHandler),this.view=new dd(this.body,this.canvas),this.renderer=new nd(this.body,this.canvas),this.physics=new gd(this.body),this.layoutEngine=new Ih(this.body),this.clustering=new Cd(this.body),this.manipulation=new rh(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new el(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new Yl(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new mh(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(t),this.setData(e)}Qg(yh.prototype),yh.prototype.setOptions=function(g){var e=this;if(null===g&&(g=void 0),void 0!==g){!0===Do.validate(g,uh)&&console.error("%cErrors have been found in the supplied options object.","background: #FFeeee; color: #dd0000");if(qn(["locale","locales","clickToUse"],this.options,g),void 0!==g.locale&&(g.locale=function(g,e){try{var t=pC(e.split(/[-_ /]/,2),2),A=t[0],C=t[1],i=null!=A?A.toLowerCase():null,I=null!=C?C.toUpperCase():null;if(i&&I){var n,o=i+"-"+I;if(Object.prototype.hasOwnProperty.call(g,o))return o;console.warn(xC(n="Unknown variant ".concat(I," of language ")).call(n,i,"."))}if(i){var r=i;if(Object.prototype.hasOwnProperty.call(g,r))return r;console.warn("Unknown language ".concat(i))}return console.warn("Unknown locale ".concat(e,", falling back to English.")),"en"}catch(g){return console.error(g),console.warn("Unexpected error while normalizing locale ".concat(e,", falling back to English.")),"en"}}(g.locales||this.options.locales,g.locale)),g=this.layoutEngine.setOptions(g.layout,g),this.canvas.setOptions(g),this.groups.setOptions(g.groups),this.nodesHandler.setOptions(g.nodes),this.edgesHandler.setOptions(g.edges),this.physics.setOptions(g.physics),this.manipulation.setOptions(g.manipulation,g,this.options),this.interactionHandler.setOptions(g.interaction),this.renderer.setOptions(g.interaction),this.selectionHandler.setOptions(g.interaction),void 0!==g.groups&&this.body.emitter.emit("refreshNodes"),"configure"in g&&(this.configurator||(this.configurator=new Eo(this,this.body.container,ph,this.canvas.pixelRatio,fh)),this.configurator.setOptions(g.configure)),this.configurator&&!0===this.configurator.options.enabled){var t={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};go(t.nodes,this.nodesHandler.options),go(t.edges,this.edgesHandler.options),go(t.layout,this.layoutEngine.options),go(t.interaction,this.selectionHandler.options),go(t.interaction,this.renderer.options),go(t.interaction,this.interactionHandler.options),go(t.manipulation,this.manipulation.options),go(t.physics,this.physics.options),go(t.global,this.canvas.options),go(t.global,this.options),this.configurator.setModuleOptions(t)}void 0!==g.clickToUse?!0===g.clickToUse?void 0===this.activator&&(this.activator=new xo(this.canvas.frame),this.activator.on("change",(function(){e.body.emitter.emit("activate")}))):(void 0!==this.activator&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}},yh.prototype._updateVisibleIndices=function(){var g=this.body.nodes,e=this.body.edges;for(var t in this.body.nodeIndices=[],this.body.edgeIndices=[],g)Object.prototype.hasOwnProperty.call(g,t)&&(this.clustering._isClusteredNode(t)||!1!==g[t].options.hidden||this.body.nodeIndices.push(g[t].id));for(var A in e)if(Object.prototype.hasOwnProperty.call(e,A)){var C=e[A],i=g[C.fromId],I=g[C.toId],n=void 0!==i&&void 0!==I;!this.clustering._isClusteredEdge(A)&&!1===C.options.hidden&&n&&!1===i.options.hidden&&!1===I.options.hidden&&this.body.edgeIndices.push(C.id)}},yh.prototype.bindEventListeners=function(){var g=this;this.body.emitter.on("_dataChanged",(function(){g.edgesHandler._updateState(),g.body.emitter.emit("_dataUpdated")})),this.body.emitter.on("_dataUpdated",(function(){g.clustering._updateState(),g._updateVisibleIndices(),g._updateValueRange(g.body.nodes),g._updateValueRange(g.body.edges),g.body.emitter.emit("startSimulation"),g.body.emitter.emit("_requestRedraw")}))},yh.prototype.setData=function(g){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),g&&g.dot&&(g.nodes||g.edges))throw new SyntaxError('Data must contain either parameter "dot" or  parameter pair "nodes" and "edges", but not both.');if(this.setOptions(g&&g.options),g&&g.dot){console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");var e=nr(g.dot);this.setData(e)}else if(g&&g.gephi){console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");var t=function(g,e){var t,A={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};null!=e&&(null!=e.fixed&&(A.nodes.fixed=e.fixed),null!=e.parseColor&&(A.nodes.parseColor=e.parseColor),null!=e.inheritColor&&(A.edges.inheritColor=e.inheritColor));var C=g.edges,i=SC(C).call(C,(function(g){var e={from:g.source,id:g.id,to:g.target};return null!=g.attributes&&(e.attributes=g.attributes),null!=g.label&&(e.label=g.label),null!=g.attributes&&null!=g.attributes.title&&(e.title=g.attributes.title),"Directed"===g.type&&(e.arrows="to"),g.color&&!1===A.edges.inheritColor&&(e.color=g.color),e}));return{nodes:SC(t=g.nodes).call(t,(function(g){var e={id:g.id,fixed:A.nodes.fixed&&null!=g.x&&null!=g.y};return null!=g.attributes&&(e.attributes=g.attributes),null!=g.label&&(e.label=g.label),null!=g.size&&(e.size=g.size),null!=g.attributes&&null!=g.attributes.title&&(e.title=g.attributes.title),null!=g.title&&(e.title=g.title),null!=g.x&&(e.x=g.x),null!=g.y&&(e.y=g.y),null!=g.color&&(!0===A.nodes.parseColor?e.color=g.color:e.color={background:g.color,border:g.color,highlight:{background:g.color,border:g.color},hover:{background:g.color,border:g.color}}),e})),edges:i}}(g.gephi);this.setData(t)}else this.nodesHandler.setData(g&&g.nodes,!0),this.edgesHandler.setData(g&&g.edges,!0),this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},yh.prototype.destroy=function(){for(var g in this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images,this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,g)&&delete this.body.nodes[g];for(var e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&delete this.body.edges[e];Qn(this.body.container)},yh.prototype._updateValueRange=function(g){var e,t=void 0,A=void 0,C=0;for(e in g)if(Object.prototype.hasOwnProperty.call(g,e)){var i=g[e].getValue();void 0!==i&&(t=void 0===t?i:Math.min(i,t),A=void 0===A?i:Math.max(i,A),C+=i)}if(void 0!==t&&void 0!==A)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&g[e].setValueRange(t,A,C)},yh.prototype.isActive=function(){return!this.activator||this.activator.active},yh.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},yh.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},yh.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},yh.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},yh.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},yh.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},yh.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},yh.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},yh.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},yh.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},yh.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},yh.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},yh.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},yh.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},yh.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},yh.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},yh.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},yh.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},yh.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},yh.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},yh.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},yh.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},yh.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},yh.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},yh.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},yh.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},yh.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},yh.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},yh.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},yh.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},yh.prototype.getConnectedNodes=function(g){return void 0!==this.body.nodes[g]?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},yh.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},yh.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},yh.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},yh.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},yh.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},yh.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},yh.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},yh.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},yh.prototype.getNodeAt=function(){var g=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return void 0!==g&&void 0!==g.id?g.id:g},yh.prototype.getEdgeAt=function(){var g=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return void 0!==g&&void 0!==g.id?g.id:g},yh.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},yh.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},yh.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},yh.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},yh.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},yh.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},yh.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},yh.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},yh.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},yh.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},yh.prototype.getOptionsFromConfigurator=function(){var g={};return this.configurator&&(g=this.configurator.getOptions.apply(this.configurator)),g};
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let bh=class extends r{constructor(){super(),this.pipelineConfigPath="config.json",this.pipelineComponentDetailPath="components.json"}async _downloadPipelineConfig(g){try{const e=await window.backendaiclient.vfolder.download(this.pipelineConfigPath,g,!1,!0);return await e.json()}catch(g){console.error(g),this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)}}async _uploadFile(g,e,t){return new Promise(((A,C)=>{globalThis.backendaiclient.vfolder.create_upload_session(g,e,t).then((t=>{new m.Upload(e,{endpoint:t,retryDelays:[0,3e3,5e3,1e4,2e4],uploadUrl:t,chunksize:15728640,metadata:{filename:g,filetype:e.type},onError:g=>{console.error("upload failed:"+g),this.notification.text=g,this.notification.show(!0),C(new Error(g))},onSuccess:()=>{console.log(`${g} uploaded`),A(!0)}}).start()})).catch((g=>{console.error(g),this.notification.text=g,this.notification.show(!0),C(new Error(g))}))}))}};t([A({type:String})],bh.prototype,"pipelineConfigPath",void 0),t([A({type:String})],bh.prototype,"pipelineComponentDetailPath",void 0),bh=t([n("backend-ai-pipeline-common")],bh);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let wh=class extends bh{constructor(){super(),this.spinner=Object(),this.notification=Object(),this.pipelineSelectedName="",this.componentCreateMode="create",this.componentNodes=[],this.componentEdges=[],this.selectedNodes=[]}firstUpdated(){this.spinner=this.shadowRoot.querySelector("#loading-spinner"),this.notification=globalThis.lablupNotification}async _viewStateChanged(g){await this.updateComplete,!1!==g&&(void 0!==window.backendaiclient&&null!==window.backendaiclient&&!1!==window.backendaiclient.ready||document.addEventListener("backend-ai-connected",(async()=>{}),!0))}openComponentAddDialog(g,e,t,A){if(!g||""===g)return this.notification.text=a("pipeline.NoPipelineSelected"),void this.notification.show();this.componentCreateMode="create",this.pipelineSelectedName=g,this.componentNodes=e,this.componentEdges=t,this.selectedNodes=A,this.shadowRoot.querySelector("#component-add-dialog").show()}openComponentUpdateDialog(g,e,t,A){return g&&""!==g?A?(this.componentCreateMode="update",this.pipelineSelectedName=g,this.componentNodes=e,this.componentEdges=t,this.selectedNodes=[A.id],this._fillComponentAddDialogFields(A),void this.shadowRoot.querySelector("#component-add-dialog").show()):(this.notification.text=a("pipeline.Component.NoComponentSelected"),void this.notification.show()):(this.notification.text=a("pipeline.NoPipelineSelected"),void this.notification.show())}openComponentDeleteDialog(g,e,t,A){return g&&""!==g?!A||A.length<1?(this.notification.text=a("pipeline.Component.NoComponentSelected"),void this.notification.show()):(this.pipelineSelectedName=g,this.componentNodes=e,this.componentEdges=t,this.selectedNodes=A,void this.shadowRoot.querySelector("#component-delete-dialog").show()):(this.notification.text=a("pipeline.NoPipelineSelected"),void this.notification.show())}_hideComponentAddDialog(){this.shadowRoot.querySelector("#component-add-dialog").hide()}_hideComponentDeleteDialog(){this.shadowRoot.querySelector("#component-delete-dialog").hide()}async connectTwoNodes(g,e,t,A){if(2!==A.length)return this.notification.text=a("pipeline.Component.NoComponentSelected"),void this.notification.show();let C=-1;const i=A[0],I=A[1];for(let g=0;g<t.length;g++)if(t[g].from===i&&t[g].to===I||t[g].from===I&&t[g].to===i){C=g;break}C>0?t.splice(C,1):t.push({from:i,to:I});const n={nodes:e,edges:t};this.spinner.show(),await this._uploadPipelineComponents(g,n),this.spinner.hide();const o=new CustomEvent("backend-ai-pipeline-component-connection-updated",{detail:{nodes:n.nodes,edges:n.edges}});this.dispatchEvent(o)}_fillComponentAddDialogFields(g){g||(g={});const e=this.shadowRoot.querySelector("#component-add-dialog");e.querySelector("#component-name").value=g.title||"",e.querySelector("#component-description").value=g.description||"",e.querySelector("#component-path").value=g.path||"",e.querySelector("#component-cpu").value=g.cpu||"1",e.querySelector("#component-mem").value=g.mem||"1",e.querySelector("#component-gpu").value=g.gpu||"0"}async _addComponent(){const g=this.shadowRoot.querySelector("#component-name").value,e=this.shadowRoot.querySelector("#component-description").value,t=this.shadowRoot.querySelector("#component-path").value;if(!g||!t)return this.notification.text=a("pipeline.ComponentDialog.NamePathRequired"),void this.notification.show();const A=window.backendaiclient.slugify(t),C=this.shadowRoot.querySelector("#component-cpu").value,i=this.shadowRoot.querySelector("#component-mem").value;let I=this.shadowRoot.querySelector("#component-gpu").value;if(C<1)return this.notification.text=a("pipeline.ComponentDialog.CPUNotEnough"),void this.notification.show();if(i<.1)return this.notification.text=a("pipeline.ComponentDialog.MemoryNotEnough"),void this.notification.show();I||(I=0);const n={id:"",title:g,label:g,description:e,path:A,cpu:C,mem:i,gpu:I,executed:!1};if("create"===this.componentCreateMode){const g=`component-${window.backendaiclient.generateSessionId(8,!0)}`;n.id=g,this.componentNodes.push(n),this.selectedNodes&&this.selectedNodes.length>0&&this.selectedNodes.forEach((g=>{this.componentEdges.push({from:g,to:n.id})}))}else{n.id=this.selectedNodes[0];for(let g=0;g<this.componentNodes.length;g++)if(n.id===this.componentNodes[g].id){this.componentNodes[g]=n;break}}this.spinner.show();const o={nodes:this.componentNodes,edges:this.componentEdges};await this._uploadPipelineComponents(this.pipelineSelectedName,o),this._hideComponentAddDialog(),this._fillComponentAddDialogFields(null),this.spinner.hide();const r="create"===this.componentCreateMode?"backend-ai-pipeline-component-created":"backend-ai-pipeline-component-updated",s=new CustomEvent(r,{detail:{nodes:o.nodes,edges:o.edges}});this.dispatchEvent(s)}async _deleteComponent(){this.selectedNodes.forEach((g=>{for(let e=0;e<this.componentNodes.length;e++)if(g===this.componentNodes[e].id){this.componentNodes.splice(e,1);break}const e=[];for(let t=0;t<this.componentEdges.length;t++)g!==this.componentEdges[t].from&&g!=this.componentEdges[t].to||e.push(t);if(e.length>0)for(let g=e.length-1;g>=0;g--)this.componentEdges.splice(e[g],1)}));const g={nodes:this.componentNodes,edges:this.componentEdges};this.spinner.show(),await this._uploadPipelineComponents(this.pipelineSelectedName,g),this._hideComponentDeleteDialog(),this.spinner.hide();const e=new CustomEvent("backend-ai-pipeline-component-deleted",{detail:{nodes:g.nodes,edges:g.edges}});this.dispatchEvent(e)}async _uploadPipelineComponents(g,e){const t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"});try{await this._uploadFile(this.pipelineComponentDetailPath,t,g)}catch(g){console.error(g),this.spinner.hide(),this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)}}static get styles(){return[l,d,h,c,u,p`
        mwc-textfield {
          width: 100%;
          --mdc-text-field-idle-line-color: rgba(0, 0, 0, 0.42);
          --mdc-text-field-hover-line-color: rgba(0, 0, 255, 0.87);
          --mdc-text-field-fill-color: transparent;
          --mdc-theme-primary: var(--paper-blue-600);
        }
      `]}render(){return o`
      <backend-ai-dialog id="component-add-dialog" fixed backdrop>
        <span slot="title">
          ${"create"===this.componentCreateMode?f("pipeline.ComponentDialog.CreateTitle"):f("pipeline.ComponentDialog.UpdateTitle")}
        </span>
        <div slot="content" class="layout verticlal" style="width:450px">
          <mwc-textfield id="component-name" type="text" autofocus
              label="${f("pipeline.ComponentDialog.Name")}" maxLength="30"></mwc-textfield>
          <mwc-textfield id="component-description" type="text"
              label="${f("pipeline.ComponentDialog.Description")}" maxLength="200"></mwc-textfield>
          <mwc-textfield id="component-path" type="text"
              label="${f("pipeline.ComponentDialog.PathInFolder")}" maxLength="300"></mwc-textfield>
          <div class="layout horizontal">
            <mwc-textfield id="component-cpu" label="CPU" type="number" value="1" min="1"></mwc-textfield>
            <mwc-textfield id="component-mem" label="Memory (GiB)" type="number" value="1" min="0"></mwc-textfield>
            <mwc-textfield id="component-gpu" label="GPU" type="number" value="0" min="0"></mwc-textfield>
          </div>
        </div>
        <div slot="footer" class="horizontal end-justified flex layout">
          <div class="flex"></div>
          <mwc-button label="${f("button.Cancel")}"
              @click="${this._hideComponentAddDialog}"></mwc-button>
          <mwc-button unelevated
              label="${"create"===this.componentCreateMode?f("button.Add"):f("button.Update")}"
              @click="${this._addComponent}"></mwc-button>
        </div>
      </backend-ai-dialog>

      <backend-ai-dialog id="component-delete-dialog" fixed backdrop blockscrolling>
        <span slot="title">${f("pipeline.ComponentDialog.DeleteTitle")}</span>
        <div slot="content" class="layout vertical">
          <p>${f("session.CheckAgainDialog")}</p>
          <span>${this.selectedNodes&&this.selectedNodes.length>0?this.selectedNodes.join(" | "):""}</span>
        </div>
        <div slot="footer" class="horizontal end-justified flex layout">
          <div class="flex"></div>
          <mwc-button label="${f("button.Cancel")}"
              @click="${this._hideComponentDeleteDialog}"></mwc-button>
          <mwc-button unelevated
              label="${f("button.Delete")}"
              @click="${this._deleteComponent}"></mwc-button>
        </div>
      </backend-ai-dialog>

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([A({type:Object})],wh.prototype,"spinner",void 0),t([A({type:Object})],wh.prototype,"notification",void 0),t([A({type:String})],wh.prototype,"pipelineSelectedName",void 0),t([A({type:String})],wh.prototype,"componentCreateMode",void 0),t([A({type:Array})],wh.prototype,"componentNodes",void 0),t([A({type:Array})],wh.prototype,"componentEdges",void 0),t([A({type:Array})],wh.prototype,"selectedNodes",void 0),wh=t([n("backend-ai-pipeline-component-create")],wh);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let kh=class extends bh{constructor(){super(),this.spinner=Object(),this.notification=Object(),this.pipelineSelectedName="",this.pipelineFolderName=""}firstUpdated(){this.spinner=this.shadowRoot.querySelector("#loading-spinner"),this.notification=globalThis.lablupNotification}async _viewStateChanged(g){await this.updateComplete,!1!==g&&(void 0!==window.backendaiclient&&null!==window.backendaiclient&&!1!==window.backendaiclient.ready||document.addEventListener("backend-ai-connected",(async()=>{}),!0))}async editCode(g,e){this.spinner.show();const t=await this._ensureComponentMainCode(e),A=this.shadowRoot.querySelector("#codemirror-dialog");this.shadowRoot.querySelector("#codemirror-editor").setValue(t),A.show(),this.spinner.hide()}async _ensureComponentMainCode(g){await this._ensureComponentFolder(g);const e=`${g.path}/main.py`;try{const g=await window.backendaiclient.vfolder.download(e,this.pipelineFolderName,!1,!0);return await g.text()}catch(g){if(console.error(g),g.title&&"404"===g.title.split(" ")[0]){const g=new Blob([""],{type:"plain/text"});return await this._uploadFile(e,g,this.pipelineFolderName),""}this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)}}async _ensureComponentFolder(g){const e=`${g.path}`;try{await window.backendaiclient.vfolder.mkdir(e,this.pipelineFolderName,null,!0)}catch(g){g&&g.message&&g.message.includes("already exists")||(console.error(g),this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0))}}static get styles(){return[l,d,h,c,u,p`
      `]}render(){return o`
      <div class="card" elevation="0">
      </div>

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([A({type:Object})],kh.prototype,"spinner",void 0),t([A({type:Object})],kh.prototype,"notification",void 0),t([A({type:String})],kh.prototype,"pipelineSelectedName",void 0),t([A({type:String})],kh.prototype,"pipelineFolderName",void 0),kh=t([n("backend-ai-pipeline-runner")],kh);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let xh=class extends bh{constructor(){super(),this.spinner=Object(),this.notification=Object(),this.componentCreate=Object(),this.pipelineRunner=Object(),this.pipelineSelectedName="",this.pipelineSelectedConfig=Object(),this.network=Object(),this.networkOptions=Object(),this.networkContainer=Object(),this.nodes=[],this.edges=[],this.nodeInfo=Object(),this.componentsSelected=[],this.networkOptions={nodes:{borderWidth:2,shape:"box",color:{border:"lightgray",background:"white",highlight:{border:"lightgray",background:"lightblue"},hover:{border:"lightgray",background:"lightblue"}}},edges:{arrows:"to",smooth:{type:"cubicBezier",forceDirection:"vertical"},color:"lightgray"},layout:{hierarchical:{direction:"UD",levelSeparation:60,sortMethod:"directed"}},interaction:{hover:!0,multiselect:!0},physics:{}}}firstUpdated(){this.spinner=this.shadowRoot.querySelector("#loading-spinner"),this.notification=globalThis.lablupNotification,this.componentCreate=this.shadowRoot.querySelector("backend-ai-pipeline-component-create"),this.pipelineRunner=this.shadowRoot.querySelector("backend-ai-pipeline-runner"),this._initEventHandlers(),this._initNetwork()}async _viewStateChanged(g){await this.updateComplete,!1!==g&&(void 0!==window.backendaiclient&&null!==window.backendaiclient&&!1!==window.backendaiclient.ready||document.addEventListener("backend-ai-connected",(async()=>{}),!0))}_initEventHandlers(){const g=g=>{g.stopPropagation(),this.nodes=g.detail.nodes.slice(),this.edges=g.detail.edges.slice(),this.network.setData({nodes:this.nodes,edges:this.edges})};this.componentCreate.addEventListener("backend-ai-pipeline-component-created",(e=>{g(e)})),this.componentCreate.addEventListener("backend-ai-pipeline-component-updated",(e=>{g(e)})),this.componentCreate.addEventListener("backend-ai-pipeline-component-deleted",(e=>{g(e)})),this.componentCreate.addEventListener("backend-ai-pipeline-component-connection-updated",(e=>{g(e)}))}_initNetwork(){const g={nodes:this.nodes,edges:this.edges};this.networkContainer=this.shadowRoot.querySelector("#component-network"),this.network=new yh(this.networkContainer,g,this.networkOptions),this.network.on("click",(g=>{this.componentsSelected=g.nodes})),this.network.on("doubleClick",(g=>{1===g.nodes.length&&this._editComponentCode()}))}async pipelineChanged(){const{nodes:g,edges:e}=await this._fetchPipelineComponents();this.nodes=g||[],this.edges=e||[],this.network.setData({nodes:g,edges:e});const t={};this.nodes.forEach((g=>t[g.id]=g)),this.nodeInfo=t}async _fetchPipelineComponents(g=""){""!==g&&g||(g=this.pipelineSelectedName);try{this.spinner.show();const e=await window.backendaiclient.vfolder.download(this.pipelineComponentDetailPath,g,!1,!0);return await e.json()}catch(g){console.error(g),this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)}finally{this.spinner.hide()}}_openComponentAddDialog(){let g=null;this.componentsSelected.length>0&&(g=this.componentsSelected),this.componentCreate.openComponentAddDialog(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),g)}_openComponentUpdateDialog(){if(1!==this.componentsSelected.length)return this.notification.text=a("pipeline.Component.NoComponentSelected"),void this.notification.show();const g=this.componentsSelected[0],e=this.network.body.data.nodes.get(g);this.componentCreate.openComponentUpdateDialog(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),e)}_openComponentDeleteDialog(){if(this.componentsSelected.length<1)return this.notification.text=a("pipeline.Component.NoComponentSelected"),void this.notification.show();const g=this.componentsSelected.slice();this.componentCreate.openComponentDeleteDialog(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),g)}_connectTwoComponents(){if(2!==this.componentsSelected.length)return this.notification.text=a("pipeline.Component.NoComponentSelected"),void this.notification.show();const g=this.componentsSelected.slice();this.componentCreate.connectTwoNodes(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),g)}_editComponentCode(){if(1!==this.componentsSelected.length)return this.notification.text=a("pipeline.Component.NoComponentSelected"),void this.notification.show();const g=this.componentsSelected[0],e=this.network.body.data.nodes.get(g);this.pipelineRunner.editCode(this.pipelineSelectedName,e)}_runPipeline(){}static get styles(){return[l,d,h,c,u,p`
        #component-network {
          // min-height: 500px;
        }
      `]}render(){return o`
      <div class="card" elevation="0">
        <div class="layout horizontal center wrap" style="margin:0.2em">
          <mwc-button dense outlined id="add-component-btn" icon="add"
              label="${f("button.Add")}" @click="${()=>this._openComponentAddDialog()}">
          </mwc-button>
          ${1===this.componentsSelected.length?o`
            <mwc-button dense outlined id="update-component-btn" icon="edit"
                label="${f("button.Edit")}" @click="${()=>this._openComponentUpdateDialog()}">
            </mwc-button>
          `:o``}
          ${this.componentsSelected.length>0?o`
            <mwc-button dense outlined id="delete-component-btn" icon="delete"
                label="${f("button.Delete")}" @click="${()=>this._openComponentDeleteDialog()}">
            </mwc-button>
          `:o``}
          ${2===this.componentsSelected.length?o`
            <mwc-button dense outlined id="connect-component-btn" icon="trending_up"
                label="${f("pipeline.Component.Connect")}" @click="${()=>this._connectTwoComponents()}">
            </mwc-button>
          `:o``}
          <span class="flex"></span>
          <mwc-button dense raised id="run-pipeline-btn" icon="play_arrow"
              label="${f("pipeline.RunPipeline")}" @click="${()=>this._runPipeline()}">
          </mwc-button>
        </div>
        <backend-ai-pipeline-component-create ?active="${this.active}"></backend-ai-pipeline-component-create>
        <backend-ai-pipeline-runner ?active="${this.active}"></backend-ai-pipeline-runner>
        <div id="component-network"></div>
      </div>

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([A({type:Object})],xh.prototype,"spinner",void 0),t([A({type:Object})],xh.prototype,"notification",void 0),t([A({type:Object})],xh.prototype,"componentCreate",void 0),t([A({type:Object})],xh.prototype,"pipelineRunner",void 0),t([A({type:String})],xh.prototype,"pipelineSelectedName",void 0),t([A({type:Object})],xh.prototype,"pipelineSelectedConfig",void 0),t([A({type:Array})],xh.prototype,"network",void 0),t([A({type:Array})],xh.prototype,"networkOptions",void 0),t([A({type:Object})],xh.prototype,"networkContainer",void 0),t([A({type:Array})],xh.prototype,"nodes",void 0),t([A({type:Array})],xh.prototype,"edges",void 0),t([A({type:Object})],xh.prototype,"nodeInfo",void 0),t([A({type:Array})],xh.prototype,"componentsSelected",void 0),xh=t([n("backend-ai-pipeline-component-view")],xh);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let Eh=class extends bh{constructor(){super(),this.spinner=Object(),this.notification=Object(),this.tags=Object(),this.defaultLanguage="",this.versions=[],this.scalingGroup="",this.scalingGroups=[],this.vhost="",this.vhosts=[],this.images=Object(),this.imageInfo=Object(),this.imageNames=Object(),this.resourceLimits=Object(),this.supports=Object(),this.aliases=Object(),this.pipelineCreateMode="create",this.pipelineFolderName="",this.aliases={TensorFlow:"python-tensorflow","NGC-TensorFlow":"ngc-tensorflow",PyTorch:"python-pytorch","NGC-PyTorch":"ngc-pytorch","Lablup Research Env.":"python-ff",Python:"python"},this.languages=[]}firstUpdated(){this.spinner=this.shadowRoot.querySelector("#loading-spinner"),this.notification=globalThis.lablupNotification,fetch("resources/image_metadata.json").then((g=>g.json())).then((g=>{this.imageInfo=g.imageInfo;for(const g in this.imageInfo)({}).hasOwnProperty.call(this.imageInfo,g)&&(this.tags[g]=[],"name"in this.imageInfo[g]&&(this.aliases[g]=this.imageInfo[g].name,this.imageNames[g]=this.imageInfo[g].name),"label"in this.imageInfo[g]&&this.imageInfo[g].label.forEach((e=>{"category"in e||this.tags[g].push(e.tag)})))})),this.shadowRoot.querySelector("#pipeline-environment").addEventListener("selected",this.updateLanguage.bind(this)),this._refreshImageList()}updateLanguage(){const g=this.shadowRoot.querySelector("#pipeline-environment").selected;if(null===g)return;const e=g.id;this._updateVersions(e)}_updateVersions(g){const e=this.shadowRoot.querySelector("#pipeline-environment-tag");if(g in this.supports){const e=this.supports[g];e.sort(),e.reverse(),this.versions=e}void 0!==this.versions&&(e.value=this.versions[0],e.selectedText=e.value)}async _fetchResourceGroup(){const g=window.backendaiclient.current_group||null,e=await window.backendaiclient.scalingGroup.list(g);this.scalingGroups=e.scaling_groups,this.scalingGroup=e.scaling_groups[0].name}_refreshImageList(){window.backendaiclient.image.list(["name","humanized_name","tag","registry","digest","installed","resource_limits { key min max }"],!0).then((g=>{const e=[];Object.keys(g.images).map(((t,A)=>{const C=g.images[t];!0===C.installed&&e.push(C)})),0!==e.length&&(this.images=e,this.supports={},Object.keys(this.images).map(((g,e)=>{const t=this.images[g],A=`${t.registry}/${t.name}`;A in this.supports||(this.supports[A]=[]),this.supports[A].push(t.tag),this.resourceLimits[`${A}:${t.tag}`]=t.resource_limits})),this._updateEnvironment())})).catch((g=>{console.error(g),g&&g.message&&(this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0))}))}_updateEnvironment(){const g=Object.keys(this.supports);void 0!==g&&(g.sort(),this.languages=[],g.forEach(((g,e)=>{if(!Object.keys(this.aliases).includes(g)){const e=this._guessHumanizedNames(g);this.aliases[g]=null!==e?e:g}const t=g.split("/"),A=t[0];let C,i;2==t.length?(C="",i=t[1]):(C=t[1],i=t[2]);const I=this.aliases[g];let n;n=void 0!==I?I.split(" (")[0]:i;let o=[];i in this.tags&&(o=o.concat(this.tags[i])),""!=C&&o.push(C),this.languages.push({name:g,registry:A,prefix:C,kernelname:i,alias:I,basename:n,tags:o})})),this._initAliases())}selectDefaultLanguage(){void 0===window.backendaiclient||null===window.backendaiclient||!1===window.backendaiclient.ready?document.addEventListener("backend-ai-connected",(()=>{this._selectDefaultLanguage()}),!0):this._selectDefaultLanguage()}_selectDefaultLanguage(){return void 0!==window.backendaiclient._config.default_session_environment&&"default_session_environment"in window.backendaiclient._config&&""!==window.backendaiclient._config.default_session_environment?this.defaultLanguage=window.backendaiclient._config.default_session_environment:0!==this.languages.length?this.defaultLanguage=this.languages[0].name:this.defaultLanguage="index.docker.io/lablup/ngc-tensorflow",!0}_guessHumanizedNames(g){const e=this.imageNames;let t="",A=null,C="abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()";return Object.keys(e).forEach(((i,I)=>{const n=g.split("/");t=2==n.length?n[1]:n[2],(t===i||""===t&&g.endsWith(i)&&i.length<C.length)&&(A=e[i],C=i)})),A}_initAliases(){for(const g in this.aliases)({}).hasOwnProperty.call(this.aliases,g)&&(this.aliases[this.aliases[g]]=g)}_openPipelineCreateDialog(){this.selectDefaultLanguage(),this._fetchResourceGroup(),this._fillPipelineCreateDialogFields(null),this.pipelineCreateMode="create",window.backendaiclient.vfolder.list_hosts().then((g=>{const e=this.shadowRoot.querySelector("#pipeline-folder-host");this.vhosts=g.allowed.slice(),this.vhost=g.default,e.value=this.vhost})).catch((g=>{console.error(g),g&&g.message&&(this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0))})),this.shadowRoot.querySelector("#pipeline-create-dialog").show()}async _openPipelineUpdateDialog(g){if(this.pipelineFolderName=g,!this.pipelineFolderName)return this.notification.text=a("pipeline.NoPipelineSelected"),void this.notification.show();this._fetchResourceGroup();const e=await this._downloadPipelineConfig(this.pipelineFolderName);this.pipelineCreateMode="update",window.backendaiclient.vfolder.list_hosts().then((g=>{const t=this.shadowRoot.querySelector("#pipeline-folder-host");this.vhosts=g.allowed.slice(),this.vhost=e.folder_host,t.value=this.vhost,this._fillPipelineCreateDialogFields(e)})).catch((g=>{console.error(g),g&&g.message&&(this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0))})),this._fillPipelineCreateDialogFields(e),this.shadowRoot.querySelector("#pipeline-create-dialog").show()}_openPipelineDeleteDialog(g){if(this.pipelineFolderName=g,!this.pipelineFolderName)return this.notification.text=a("pipeline.NoPipelineSelected"),void this.notification.show();this.shadowRoot.querySelector("#pipeline-delete-dialog").show()}_hidePipelineCreateDialog(){this.shadowRoot.querySelector("#pipeline-create-dialog").hide()}_hidePipelineDeleteDialog(){this.shadowRoot.querySelector("#pipeline-delete-dialog").hide()}_fillPipelineCreateDialogFields(g){g||(g={});const e=this.shadowRoot.querySelector("#pipeline-create-dialog");e.querySelector("#pipeline-title").value=g.title||"",e.querySelector("#pipeline-description").value=g.description||"",g.environment&&(e.querySelector("#pipeline-environment").value=g.environment),g.version&&(e.querySelector("#pipeline-environment-tag").value=g.version),g.scaling_group&&(e.querySelector("#pipeline-scaling-group").value=g.scaling_group),g.folder_host&&(e.querySelector("#pipeline-folder-host").value=g.folder_host)}async _createPipeline(){const g=this.shadowRoot.querySelector("#pipeline-title").value,e=this.shadowRoot.querySelector("#pipeline-description").value,t=this.shadowRoot.querySelector("#pipeline-environment").value,A=this.shadowRoot.querySelector("#pipeline-environment-tag").value,C=this.shadowRoot.querySelector("#pipeline-scaling-group").value,i=this.shadowRoot.querySelector("#pipeline-folder-host").value,I=`pipeline-${window.backendaiclient.slugify(g)}-${window.backendaiclient.generateSessionId(8,!0)}`;if(!(g&&t&&A&&C&&i))return this.notification.text=a("pipeline.PipelineDialog.FillAllInputFields"),void this.notification.show();const n={title:g,description:e,environment:t,version:A,scaling_group:C,folder_host:i};if(this.spinner.show(),"create"===this.pipelineCreateMode)try{await window.backendaiclient.vfolder.create(I,i);const g=this._uploadPipelineConfig(I,n),e=this._uploadPipelineComponents(I,{});await Promise.all([g,e]);const t=new CustomEvent("backend-ai-pipeline-created",{detail:I});this.dispatchEvent(t),this._hidePipelineCreateDialog(),this.spinner.hide(),this.notification.text=a("pipeline.PipelineCreated"),this.notification.show()}catch(g){console.error(g),g&&g.message&&(this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)),this.spinner.hide()}else try{await this._uploadPipelineConfig(this.pipelineFolderName,n);const g=new CustomEvent("backend-ai-pipeline-updated",{detail:this.pipelineFolderName});this.dispatchEvent(g),this._hidePipelineCreateDialog(),this.spinner.hide()}catch(g){console.error(g),g&&g.message&&(this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)),this.spinner.hide()}}_deletePipeline(){globalThis.backendaiclient.vfolder.delete(this.pipelineFolderName).then((g=>{const e=new CustomEvent("backend-ai-pipeline-deleted",{detail:this.pipelineFolderName});this.dispatchEvent(e),this._hidePipelineDeleteDialog(),this.notification.text=a("pipeline.PipelineDeleted"),this.notification.show()})).catch((g=>{console.log(g),g&&g.message&&(this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0,g))}))}async _uploadPipelineConfig(g,e){const t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"});await this._uploadFile(this.pipelineConfigPath,t,g)}async _uploadPipelineComponents(g,e){const t=this.pipelineComponentDetailPath,A=new Blob([JSON.stringify(e,null,2)],{type:"application/json"});try{this.spinner.show(),await this._uploadFile(t,A,g),this.spinner.hide()}catch(g){console.error(g),this.spinner.hide(),this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)}}static get styles(){return[l,d,h,c,u,p`
        .warning {
          color: red;
        }
      `]}render(){return o`
      <div class="card" elevation="0">
      </div>

      <backend-ai-dialog id="pipeline-create-dialog" fixed backdrop>
        <span slot="title">
          ${"create"===this.pipelineCreateMode?f("pipeline.PipelineDialog.CreateTitle"):f("pipeline.PipelineDialog.UpdateTitle")}
        </span>
        <div slot="content" class="layout vertical" style="width:450px">
          <mwc-textfield id="pipeline-title" type="text" autofocus
              label="${f("pipeline.PipelineDialog.Name")}" maxLength="30">
          </mwc-textfield>
          <mwc-textfield id="pipeline-description" type="text"
              label="${f("pipeline.PipelineDialog.Description")}" maxLength="200">
          </mwc-textfield>
          <mwc-select id="pipeline-environment" label="${f("pipeline.PipelineDialog.Environment")}">
            <mwc-list-item style="display:none;" value="None">${f("session.launcher.ChooseEnvironment")}</mwc-list-item>
            ${this.languages.map((g=>o`
              <mwc-list-item id="${g.name}" value="${g.name}"
                  ?selected="${g.name===this.defaultLanguage}">
                <div class="layout horizontal">
                  ${g.basename}
                  ${g.tags?g.tags.map((g=>o`
                    <lablup-shields style="margin-left:5px;" description="${g}"></lablup-shields>
                  `)):""}
                </div>
              </mwc-list-item>
            `))}
          </mwc-select>
          <mwc-select id="pipeline-environment-tag" label="${f("pipeline.PipelineDialog.Version")}">
            <mwc-list-item style="display:none"></mwc-list-item>
            ${this.versions.map(((g,e)=>o`
              <mwc-list-item id="${g}" value="${g}"
                  ?selected="${0===e}">${g}</mwc-list-item>
            `))}
          </mwc-select>
          <mwc-select id="pipeline-scaling-group" label="${f("session.launcher.OwnerResourceGroup")}">
            ${this.scalingGroups.map((g=>o`
              <mwc-list-item id="${g.name}" value="${g.name}"
                  ?selected="${g.name===this.scalingGroup}">
                ${g.name}
              </mwc-list-item>
            `))}
          </mwc-select>
          <mwc-select id="pipeline-folder-host" label="${f("data.Host")}">
            ${this.vhosts.map(((g,e)=>o`
              <mwc-list-item value="${g}" ?selected="${0===e}">${g}</mwc-list-item>
            `))}
          </mwc-select>
        </div>
        <div slot="footer" class="horizontal end-justified flex layout">
          <div class="flex"></div>
          <mwc-button label="${f("button.Cancel")}" @click="${this._hideDialog}"></mwc-button>
          <mwc-button unelevated
              label="${"create"===this.pipelineCreateMode?f("button.Create"):f("button.Update")}"
              @click="${this._createPipeline}"></mwc-button>
        </div>
      </backend-ai-dialog>

      <backend-ai-dialog id="pipeline-delete-dialog" fixed backdrop>
        <span slot="title">${f("pipeline.PipelineDialog.DeleteTitle")}</span>
        <div slot="content" style="width:100%;">
          <p class="warning">${f("dialog.warning.CannotBeUndone")}</p>
          <div>${f("pipeline.PipelineDialog.TargetFolder")}: ${this.pipelineFolderName}</div>
        </div>
        <div slot="footer" class="horizontal end-justified flex layout">
          <div class="flex"></div>
          <mwc-button label="${f("button.Cancel")}" @click="${this._hideDialog}"></mwc-button>
          <mwc-button unelevated @click="${this._deletePipeline}">
            ${f("button.Delete")}
          </mwc-button>
        </div>
      </backend-ai-dialog>

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([A({type:Object})],Eh.prototype,"spinner",void 0),t([A({type:Object})],Eh.prototype,"notification",void 0),t([A({type:Object})],Eh.prototype,"tags",void 0),t([A({type:Array})],Eh.prototype,"languages",void 0),t([A({type:String})],Eh.prototype,"defaultLanguage",void 0),t([A({type:Array})],Eh.prototype,"versions",void 0),t([A({type:String})],Eh.prototype,"scalingGroup",void 0),t([A({type:Array})],Eh.prototype,"scalingGroups",void 0),t([A({type:String})],Eh.prototype,"vhost",void 0),t([A({type:Array})],Eh.prototype,"vhosts",void 0),t([A({type:Object})],Eh.prototype,"images",void 0),t([A({type:Object})],Eh.prototype,"imageInfo",void 0),t([A({type:Object})],Eh.prototype,"imageNames",void 0),t([A({type:Object})],Eh.prototype,"resourceLimits",void 0),t([A({type:Object})],Eh.prototype,"supports",void 0),t([A({type:Object})],Eh.prototype,"aliases",void 0),t([A({type:String})],Eh.prototype,"pipelineCreateMode",void 0),t([A({type:String})],Eh.prototype,"pipelineFolderName",void 0),Eh=t([n("backend-ai-pipeline-create")],Eh);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let Oh=class extends bh{constructor(){super(),this.spinner=Object(),this.pipelineFolders=Object();try{this.pipelineSelectedName=localStorage.getItem("backendaiconsole.pipeline.selectedName")||"",this.pipelineSelectedConfig=JSON.parse(localStorage.getItem("backendaiconsole.pipeline.selectedConfig")||"{}")}catch(g){console.log(g),localStorage.removeItem("backendaiconsole.pipeline.selectedName"),localStorage.removeItem("backendaiconsole.pipeline.selectedConfig")}}firstUpdated(){this.spinner=this.shadowRoot.querySelector("#loading-spinner")}async _viewStateChanged(g){await this.updateComplete,!1!==g&&(void 0===window.backendaiclient||null===window.backendaiclient||!1===window.backendaiclient.ready?document.addEventListener("backend-ai-connected",(async()=>{this._fetchPipelineFolders()}),!0):this._fetchPipelineFolders())}async changePipeline(g){await this._fetchPipelineFolders(),this.pipelineSelectedName=g,this.pipelineSelectedConfig=this.pipelineFolders[g].config,this.shadowRoot.querySelector("#pipeline-selector").selectedText=this.pipelineSelectedConfig.title,localStorage.setItem("backendaiconsole.pipeline.selectedName",this.pipelineSelectedName),localStorage.setItem("backendaiconsole.pipeline.selectedConfig",JSON.stringify(this.pipelineSelectedConfig))}async deselectPipeline(){await this._fetchPipelineFolders(),this.pipelineSelectedName="",this.pipelineSelectedConfig={},this.shadowRoot.querySelector("#pipeline-selector").select(-1),localStorage.removeItem("backendaiconsole.pipeline.selectedName"),localStorage.removeItem("backendaiconsole.pipeline.selectedConfig")}_pipelineChanged(g){const e=g.target.value;if(!e)return;this.pipelineSelectedName=e,this.pipelineSelectedConfig=this.pipelineFolders[e].config,localStorage.setItem("backendaiconsole.pipeline.selectedName",this.pipelineSelectedName),localStorage.setItem("backendaiconsole.pipeline.selectedConfig",JSON.stringify(this.pipelineSelectedConfig));const t=new CustomEvent("backend-ai-pipeline-changed",{detail:{pipelineSelectedName:this.pipelineSelectedName,pipelineSelectedConfig:this.pipelineSelectedConfig}});this.dispatchEvent(t)}async _fetchPipelineFolders(){this.spinner.show();try{const g=await window.backendaiclient.vfolder.list(),e={},t=[];return g.forEach((g=>{if(g.name.startsWith("pipeline-")){const A=this._downloadPipelineConfig(g.name).then((t=>{g.config=t,e[g.name]=g}));t.push(A)}})),Promise.all(t).then((()=>{this.pipelineFolders=e,this.spinner.hide()}))}catch(g){console.error(g),this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0),this.spinner.hide()}}static get styles(){return[l,d,h,c,u,p`
        :host {
          width: 100%;
        }

        mwc-select#pipeline-selector {
          width: 40%;
          min-width: 300px;
        }

        #pipeline-description {
          font-size: initial;
          color: #222;
          padding: 0.5em;
        }

        .indicator {
          font-size: smaller;
        }
      `]}render(){return o`
      <div class="card" elevation="0">
        <h3 class="horizontal center layout wrap">
          <mwc-select id="pipeline-selector" outlined label="${f("pipeline.SelectPipeline")}"
              @change="${this._pipelineChanged}">
            ${Object.keys(this.pipelineFolders).map((g=>o`
              <mwc-list-item class="pipeline-item" value="${g}"
                  ?selected="${g===this.pipelineSelectedName}"
                  folder-id="${this.pipelineFolders[g].id}"
                  folder-host="${this.pipelineFolders[g].host}">
                <span>${this.pipelineFolders[g].config.title}</span>
              </mwc-list-item>
            `))}
          </mwc-select>
          <div id="pipeline-description" class="layout vertical">
            ${this.pipelineSelectedConfig&&this.pipelineSelectedConfig.description?o`
              <span>${this.pipelineSelectedConfig.description}</span>
            `:o``}
            ${this.pipelineSelectedConfig&&this.pipelineSelectedConfig.environment?o`
              <span class="indicator monospace">${this.pipelineSelectedConfig.environment+":"+this.pipelineSelectedConfig.version}</span>
            `:o``}
          </div>
        </h3>
      </div>

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([A({type:Object})],Oh.prototype,"spinner",void 0),t([A({type:Array})],Oh.prototype,"pipelineFolders",void 0),t([A({type:String})],Oh.prototype,"pipelineSelectedName",void 0),t([A({type:Object})],Oh.prototype,"pipelineSelectedConfig",void 0),Oh=t([n("backend-ai-pipeline-list")],Oh);
/**
 @license
 Copyright (c) 2015-2019 Lablup Inc. All rights reserved.
 */
let Th=class extends r{constructor(){super(),this.notification=Object(),this.spinner=Object(),this.pipelineCreate=Object(),this.pipelineList=Object(),this.pipelineComponent=Object(),this._status="inactive",this.componentCreateMode="create",this.pipelineFolderName="",this.pipelineConfig=Object(),this.selectedComponentIndex=-1,this._dragSource=Object(),this._dragTarget=Object(),this.active=!1,this.pipelineComponents=[],this.componentsToBeRun=[]}static get styles(){return[l,d,h,c,u,p`
        h3.tab {
          background-color: var(--general-tabbar-background-color);
          border-radius: 5px 5px 0px 0px;
          margin: 0px auto;
        }

        mwc-tab-bar {
          --mdc-theme-primary: var(--general-sidebar-selected-color);
          --mdc-text-transform: none;
          --mdc-tab-color-default: var(--general-tabbar-background-color);
          --mdc-tab-text-label-color-default: var(--general-tabbar-tab-disabled-color);
        }

        mwc-button[outlined] {
          margin: 10px 5px;
          background-image: none;
          --mdc-button-outline-width: 2px;
          --mdc-button-disabled-outline-color: var(--general-sidebar-color);
          --mdc-button-disabled-ink-color: var(--general-sidebar-color);
          --mdc-theme-primary: var(--paper-light-blue-800, #efefef);
          --mdc-on-theme-primary: var(--paper-light-blue-800, #efefef);
        }

        h3 mwc-button[outlined] {
          --mdc-theme-primary: #38bd73;
          --mdc-on-theme-primary: #38bd73;
        }

        #edit-pipeline {
          margin: 5px;
        }

        #codemirror-dialog {
          --dialog-min-width: calc(100vw - 200px);
          --dialog-max-width: calc(100vw - 200px);
          --dialog-min-height: calc(100vh - 100px);
          --dialog-max-height: calc(100vh - 100px);
        }
      `]}firstUpdated(){this.pipelineCreate=this.shadowRoot.querySelector("backend-ai-pipeline-create"),this.pipelineList=this.shadowRoot.querySelector("backend-ai-pipeline-list"),this.pipelineComponent=this.shadowRoot.querySelector("backend-ai-pipeline-component-view"),this.notification=globalThis.lablupNotification,this.spinner=this.shadowRoot.querySelector("#loading-spinner"),this._initEventHandlers()}async _viewStateChanged(g){await this.updateComplete,!1!==g&&(void 0!==window.backendaiclient&&null!==window.backendaiclient&&!1!==window.backendaiclient.ready||document.addEventListener("backend-ai-connected",(async()=>{}),!0))}_initEventHandlers(){this.shadowRoot.querySelector("#codemirror-dialog").addEventListener("didShow",(()=>{this.shadowRoot.querySelector("#codemirror-editor").refresh()})),this.pipelineCreate.addEventListener("backend-ai-pipeline-created",(g=>{g.stopPropagation();const e=g.detail;this.pipelineList.changePipeline(e)})),this.pipelineCreate.addEventListener("backend-ai-pipeline-updated",(g=>{g.stopPropagation();const e=g.detail;this.pipelineList.changePipeline(e)})),this.pipelineCreate.addEventListener("backend-ai-pipeline-deleted",(g=>{g.stopPropagation(),this.pipelineList.deselectPipeline()})),this.pipelineList.addEventListener("backend-ai-pipeline-changed",(g=>{g.stopPropagation(),this.pipelineComponent.pipelineSelectedName=g.detail.pipelineSelectedName,this.pipelineComponent.pipelineSelectedConfig=g.detail.pipelineSelectedConfig,this.pipelineComponent.pipelineChanged()}))}_openPipelineCreateDialog(){this.pipelineCreate._openPipelineCreateDialog()}_openPipelineUpdateDialog(){this.pipelineCreate._openPipelineUpdateDialog(this.pipelineList.pipelineSelectedName)}_openPipelineDeleteDialog(){this.pipelineCreate._openPipelineDeleteDialog(this.pipelineList.pipelineSelectedName)}async _saveCode(){if(this.selectedComponentIndex<0)return this.notification.text="Invalid component",void this.notification.show();this.spinner.show();const g=`${this.pipelineComponents[this.selectedComponentIndex].path}/main.py`,e=this.shadowRoot.querySelector("#codemirror-editor").getValue(),t=new Blob([e],{type:"plain/text"});await this._uploadFile(g,t,this.pipelineFolderName),this.pipelineComponents[this.selectedComponentIndex].executed=!1,this.pipelineComponents=this.pipelineComponents.slice(),await this._uploadPipelineComponents(this.pipelineFolderName,this.pipelineComponents),this.spinner.hide()}_uploadFile(g,e,t){}_uploadPipelineComponents(g,e){}_ensureComponentMainCode(g){}_hideCodeDialog(){this.selectedComponentIndex=-1;this.shadowRoot.querySelector("#codemirror-dialog").hide()}async _saveCodeAndCloseDialog(){await this._saveCode(),this._hideCodeDialog()}_subscribeKernelEventStream(g,e,t,A){const C=window.backendaiclient._config.endpoint+`/func/events/session?sessionName=${g}`,i=new EventSource(C,{withCredentials:!0});let I;return this.spinner.show(),i.addEventListener("kernel_pulling",(g=>{this.notification.text="Pulling kernel image. This may take several minutes...",this.notification.show()})),i.addEventListener("session_started",(g=>{const e=JSON.parse(g.data);this.notification.text=`Session started (${e.sessionName}). Running component...`,this.notification.show()})),i.addEventListener("session_success",(async g=>{t.executed=!0,this.pipelineComponents[e]=t,await this._uploadPipelineComponents(this.pipelineFolderName,this.pipelineComponents),this.pipelineComponents=this.pipelineComponents.slice(),I=!0})),i.addEventListener("session_failure",(g=>{I=!1})),i.addEventListener("session_terminated",(async g=>{const e=JSON.parse(g.data),C=await window.backendaiclient.getTaskLogs(A);console.log(C.substring(0,500));const n=`${t.path}/execution_logs.txt`,o=new Blob([C],{type:"plain/text"});if(await this._uploadFile(n,o,this.pipelineFolderName),i.close(),this.notification.text=I?`Execution succeed (${e.sessionName})`:`Execution error (${e.sessionName})`,this.notification.show(),this.spinner.hide(),I&&this.componentsToBeRun.length>0){const g=this.componentsToBeRun.shift(),e=this.pipelineComponents.map((g=>g.id)).indexOf(g);e<0?this.componentsToBeRun=[]:this._runComponent(e)}I=void 0})),i}async _runComponent(g){if(g<0)return this.notification.text="Invalid component",void this.notification.show();for(let e=0;e<g;e++){if(!this.pipelineComponents[e].executed)return this.notification.text="Run previous component(s) first",void this.notification.show()}const e=this.pipelineConfig,t=this.pipelineComponents[g],A=`${e.environment}:${e.version}`,C={domain:window.backendaiclient._config.domainName,group_name:window.backendaiclient.current_group,type:"batch",enqueueOnly:!0,startupCommand:`\n        cd /home/work/${this.pipelineFolderName}/;\n        python /home/work/${this.pipelineFolderName}/${t.path}/main.py\n      `,maxWaitSeconds:10,mounts:[this.pipelineFolderName],scaling_group:t.scaling_group,cpu:t.cpu,mem:t.mem+"g",fgpu:t.gpu};let i;this.spinner.show(),await this._ensureComponentMainCode(t);try{const e=await window.backendaiclient.createKernel(A,void 0,C),I=e.sessionId,n=e.sessionName;let o;for(let g=0;g<10;g++){const g=await window.backendaiclient.computeSession.get(["id"],I);if(g.compute_session&&g.compute_session.id){o=g.compute_session.id;break}await new Promise((g=>setTimeout(g,1e3)))}if(!o)throw new Error("Unable to get information on compute session");i=this._subscribeKernelEventStream(n,g,t,o)}catch(g){console.error(g),i&&i.close(),this.componentsToBeRun=[],this.spinner.hide(),this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0)}}async _showComponentLogs(g){if(g<0)return this.notification.text="Invalid component",void this.notification.show();const e=`${this.pipelineComponents[g].path}/execution_logs.txt`;try{const t=await window.backendaiclient.vfolder.download(e,this.pipelineFolderName),A=await t.text(),C=window.open("",`Component ${g} log`,"width=800,height=600");C&&(C.document.body.innerHTML=`<pre style="color:#ccc; background:#222; padding:1em; overflow:auto;">${A}</pre>`)}catch(g){console.error(g),g.title&&"404"===g.title.split(" ")[0]?(this.notification.text="No logs for this component",this.notification.detail=g.message,this.notification.show(!0)):(this.notification.text=s.relieve(g.title),this.notification.detail=g.message,this.notification.show(!0))}}async _savePipeline(){await this._uploadPipelineComponents(this.pipelineFolderName,this.pipelineComponents),this.notification.text="Saved pipeline components structure",this.notification.show()}async _runPipeline(){this.pipelineComponents.forEach(((g,e)=>{g.executed=!1,this.pipelineComponents[e]=g})),await this._uploadPipelineComponents(this.pipelineFolderName,this.pipelineComponents),this.spinner.show();const g=this.pipelineComponents.map((g=>g.id));this.componentsToBeRun=g,this.componentsToBeRun.shift(),await this._runComponent(0)}render(){return o`
      <link rel="stylesheet" href="resources/fonts/font-awesome-all.min.css">
      <div style="margin:20px">
        <lablup-activity-panel elevation="1" noheader narrow autowidth>
          <div slot="message">
            <h3 class="tab horizontal center layout">
              <mwc-tab-bar>
                <mwc-tab aria-label="exp-lists" label="${f("pipeline.List")}">
                </mwc-tab>
                <mwc-tab style="display:none" aria-label="running-lists"
                    label="${f("pipeline.Running")}">
                </mwc-tab>
                <mwc-tab style="display:none" aria-label="finished-lists"
                    label="${f("pipeline.Finished")}">
                </mwc-tab>
              </mwc-tab-bar>
              <span class="flex"></span>
              <mwc-button outlined id="delete-pipeline" icon="delete"
                  label="${f("button.Delete")}" @click="${()=>this._openPipelineDeleteDialog()}">
              </mwc-button>
              <mwc-button outlined id="edit-pipeline" icon="edit"
                  label="${f("button.Edit")}" @click="${()=>this._openPipelineUpdateDialog()}">
              </mwc-button>
              <mwc-button dense raised id="add-pipeline" icon="add"
                  label="${f("button.Create")}" style="margin-right:15px"
                  @click="${()=>this._openPipelineCreateDialog()}">
              </mwc-button>
            </h3>
            <div class="horizontal wrap layout">
              <backend-ai-pipeline-list ?active="${this.active}"></backend-ai-pipeline-list>
              <backend-ai-pipeline-create ?active="${this.active}"></backend-ai-pipeline-create>
              <backend-ai-pipeline-component-view ?active="${this.active}"></backend-ai-pipeline-component-view>

      <!--
              <div id="exp-lists" class="tab-content" style="margin:0;padding:0;height:calc(100vh - 235px);">
                <div class="horizontal wrap layout" style="margin:0;padding:0;">
                  <div class="layout vertical flex">
                    <div class="layout vertical" style="padding:5px 20px">
                      <div class="layout vertical flex" style="margin-bottom:0.5em;">
                        ${this.pipelineConfig.environment&&this.pipelineConfig.version?o`
                          <span>Environment: ${this.pipelineConfig.environment}:${this.pipelineConfig.version}</span>
                        `:""}
                        ${this.pipelineConfig.scaling_group?o`
                          <span>Scaling group: ${this.pipelineConfig.scaling_group}</span>
                        `:""}
                        ${this.pipelineConfig.folder_host?o`
                          <span>Folder: ${this.pipelineFolderName} (${this.pipelineConfig.folder_host})</span>
                        `:""}
                      </div>
                    </div>
                    <div class="layout horizontal end-justified" style="margin-bottom:1em">
                      ${this.pipelineComponents.length<1?o`
                        <mwc-list-item>No components.</mwc-list-item>
                      `:o`
                        <mwc-button id="save-pipeline-button"
                            label="Save pipeline components"
                            @click="${this._savePipeline}"></mwc-button>
                        <mwc-button unelevated id="run-pipeline-button"
                            label="Run pipeline"
                            @click="${this._runPipeline}"></mwc-button>
                      `}
                    </div>
                  </div>
                </div>
              </div>
            </div> -->
          </div>
        </lablup-activity-panel>
      </div>

      <backend-ai-dialog id="codemirror-dialog" fixed backdrop scrollable blockScrolling persistent>
        <span slot="title"></span>
        <div slot="content" class="layout vertical">
          <lablup-codemirror id="codemirror-editor" mode="python"></lablup-codemirror>
        </div>
        <div slot="footer" class="horizontal end-justified flex layout">
          <div class="flex"></div>
          <mwc-button label="Close without save"
              @click="${this._hideCodeDialog}"></mwc-button>
          <mwc-button label="Save and close"
              @click="${this._saveCodeAndCloseDialog}"></mwc-button>
          <mwc-button unelevated
              label="${f("button.Save")}"
              @click="${this._saveCode}"></mwc-button>
        </div>
      </backend-ai-dialog>

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([A({type:Object})],Th.prototype,"notification",void 0),t([A({type:Object})],Th.prototype,"spinner",void 0),t([A({type:Object})],Th.prototype,"pipelineCreate",void 0),t([A({type:Object})],Th.prototype,"pipelineList",void 0),t([A({type:Object})],Th.prototype,"pipelineComponent",void 0),t([A({type:String})],Th.prototype,"_status",void 0),t([A({type:String})],Th.prototype,"componentCreateMode",void 0),t([A({type:String})],Th.prototype,"pipelineFolderName",void 0),t([A({type:Object})],Th.prototype,"pipelineConfig",void 0),t([A({type:Array})],Th.prototype,"pipelineComponents",void 0),t([A({type:Number})],Th.prototype,"selectedComponentIndex",void 0),t([A({type:Array})],Th.prototype,"componentsToBeRun",void 0),t([A({type:Object})],Th.prototype,"_dragSource",void 0),t([A({type:Object})],Th.prototype,"_dragTarget",void 0),Th=t([n("backend-ai-pipeline-view")],Th);var Dh=Th;export default Dh;
