import{aj as e,f as g,_ as t,p as A,h as i,a0 as C,a1 as I,i as n,j as o,e as r,n as s,B as a,d as l,g as d,b as h,I as c,a as u,x as p,c as f,r as v,$ as m,t as y}from"./backend-ai-webui-c13f73fb.js";import"./mwc-tab-bar-10b23dde.js";import{r as b}from"./radio-behavior-69b67ba1.js";import{t as w}from"./tus-4013acdb.js";import"./backend-ai-session-list-b409bbc3.js";import"./lablup-codemirror-0eae5571.js";import"./vaadin-grid-7a951967.js";import"./vaadin-grid-selection-column-99b979b4.js";import"./vaadin-grid-sort-column-5ec56de5.js";import"./vaadin-grid-filter-column-c580231b.js";import"./iconset-64f5a144.js";import"./dom-repeat-a35fd60f.js";import"./expansion-774642a8.js";import"./textfield-ff58bba4.js";import"./input-behavior-37d50cc9.js";import"./lablup-progress-bar-49c0c89b.js";let k=class extends e{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(e){e.focus()}onKeyDown(e){super.onKeyDown(e),b(this,e)}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()} `}};k.styles=[...e.styles,g(":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}),i("design:type",Boolean)],k.prototype,"disabled",void 0),t([A({type:Boolean,reflect:!0}),i("design:type",Boolean)],k.prototype,"clickable",void 0),t([A({type:Boolean,reflect:!0}),i("design:type",Boolean)],k.prototype,"noRipple",void 0),t([A({type:String,reflect:!0}),i("design:type",String)],k.prototype,"role",void 0),t([C("#ripple"),i("design:type",I)],k.prototype,"$ripple",void 0),k=t([n("wl-list-item")],k);
/**
 * vis-network
 * https://visjs.github.io/vis-network/
 *
 * A dynamic, browser-based visualization library.
 *
 * @version 9.1.2
 * @date    2022-03-28T20:13:51.046Z
 *
 * @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 x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},E=function(e){return e&&e.Math==Math&&e},O=E("object"==typeof globalThis&&globalThis)||E("object"==typeof window&&window)||E("object"==typeof self&&self)||E("object"==typeof x&&x)||function(){return this}()||Function("return this")(),T=function(e){try{return!!e()}catch(e){return!0}},D=!T((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),N=D,R=Function.prototype,P=R.apply,S=R.call,M="object"==typeof Reflect&&Reflect.apply||(N?S.bind(P):function(){return S.apply(P,arguments)}),B=D,z=Function.prototype,F=z.bind,Z=z.call,j=B&&F.bind(Z,Z),G=B?function(e){return e&&j(e)}:function(e){return e&&function(){return Z.apply(e,arguments)}},L=function(e){return"function"==typeof e},V={},Y=!T((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),W=D,_=Function.prototype.call,U=W?_.bind(_):function(){return _.apply(_,arguments)},Q={},H={}.propertyIsEnumerable,K=Object.getOwnPropertyDescriptor,X=K&&!H.call({1:2},1);Q.f=X?function(e){var g=K(this,e);return!!g&&g.enumerable}:H;var J,q,$=function(e,g){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:g}},ee=G,ge=ee({}.toString),te=ee("".slice),Ae=function(e){return te(ge(e),8,-1)},ie=G,Ce=T,Ie=Ae,ne=O.Object,oe=ie("".split),re=Ce((function(){return!ne("z").propertyIsEnumerable(0)}))?function(e){return"String"==Ie(e)?oe(e,""):ne(e)}:ne,se=O.TypeError,ae=function(e){if(null==e)throw se("Can't call method on "+e);return e},le=re,de=ae,he=function(e){return le(de(e))},ce=L,ue=function(e){return"object"==typeof e?null!==e:ce(e)},pe={},fe=pe,ve=O,me=L,ye=function(e){return me(e)?e:void 0},be=function(e,g){return arguments.length<2?ye(fe[e])||ye(ve[e]):fe[e]&&fe[e][g]||ve[e]&&ve[e][g]},we=G({}.isPrototypeOf),ke=be("navigator","userAgent")||"",xe=O,Ee=ke,Oe=xe.process,Te=xe.Deno,De=Oe&&Oe.versions||Te&&Te.version,Ne=De&&De.v8;Ne&&(q=(J=Ne.split("."))[0]>0&&J[0]<4?1:+(J[0]+J[1])),!q&&Ee&&(!(J=Ee.match(/Edge\/(\d+)/))||J[1]>=74)&&(J=Ee.match(/Chrome\/(\d+)/))&&(q=+J[1]);var Re=q,Pe=Re,Se=T,Me=!!Object.getOwnPropertySymbols&&!Se((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Pe&&Pe<41})),Be=Me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ze=be,Fe=L,Ze=we,je=Be,Ge=O.Object,Le=je?function(e){return"symbol"==typeof e}:function(e){var g=ze("Symbol");return Fe(g)&&Ze(g.prototype,Ge(e))},Ve=O.String,Ye=function(e){try{return Ve(e)}catch(e){return"Object"}},We=L,_e=Ye,Ue=O.TypeError,Qe=function(e){if(We(e))return e;throw Ue(_e(e)+" is not a function")},He=Qe,Ke=function(e,g){var t=e[g];return null==t?void 0:He(t)},Xe=U,Je=L,qe=ue,$e=O.TypeError,eg={exports:{}},gg=O,tg=Object.defineProperty,Ag=function(e,g){try{tg(gg,e,{value:g,configurable:!0,writable:!0})}catch(t){gg[e]=g}return g},ig=O["__core-js_shared__"]||Ag("__core-js_shared__",{}),Cg=ig;(eg.exports=function(e,g){return Cg[e]||(Cg[e]=void 0!==g?g:{})})("versions",[]).push({version:"3.21.1",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ig=ae,ng=O.Object,og=function(e){return ng(Ig(e))},rg=og,sg=G({}.hasOwnProperty),ag=Object.hasOwn||function(e,g){return sg(rg(e),g)},lg=G,dg=0,hg=Math.random(),cg=lg(1..toString),ug=function(e){return"Symbol("+(void 0===e?"":e)+")_"+cg(++dg+hg,36)},pg=O,fg=eg.exports,vg=ag,mg=ug,yg=Me,bg=Be,wg=fg("wks"),kg=pg.Symbol,xg=kg&&kg.for,Eg=bg?kg:kg&&kg.withoutSetter||mg,Og=function(e){if(!vg(wg,e)||!yg&&"string"!=typeof wg[e]){var g="Symbol."+e;yg&&vg(kg,e)?wg[e]=kg[e]:wg[e]=bg&&xg?xg(g):Eg(g)}return wg[e]},Tg=U,Dg=ue,Ng=Le,Rg=Ke,Pg=function(e,g){var t,A;if("string"===g&&Je(t=e.toString)&&!qe(A=Xe(t,e)))return A;if(Je(t=e.valueOf)&&!qe(A=Xe(t,e)))return A;if("string"!==g&&Je(t=e.toString)&&!qe(A=Xe(t,e)))return A;throw $e("Can't convert object to primitive value")},Sg=Og,Mg=O.TypeError,Bg=Sg("toPrimitive"),zg=function(e,g){if(!Dg(e)||Ng(e))return e;var t,A=Rg(e,Bg);if(A){if(void 0===g&&(g="default"),t=Tg(A,e,g),!Dg(t)||Ng(t))return t;throw Mg("Can't convert object to primitive value")}return void 0===g&&(g="number"),Pg(e,g)},Fg=Le,Zg=function(e){var g=zg(e,"string");return Fg(g)?g:g+""},jg=ue,Gg=O.document,Lg=jg(Gg)&&jg(Gg.createElement),Vg=function(e){return Lg?Gg.createElement(e):{}},Yg=Vg,Wg=!Y&&!T((function(){return 7!=Object.defineProperty(Yg("div"),"a",{get:function(){return 7}}).a})),_g=Y,Ug=U,Qg=Q,Hg=$,Kg=he,Xg=Zg,Jg=ag,qg=Wg,$g=Object.getOwnPropertyDescriptor;V.f=_g?$g:function(e,g){if(e=Kg(e),g=Xg(g),qg)try{return $g(e,g)}catch(e){}if(Jg(e,g))return Hg(!Ug(Qg.f,e,g),e[g])};var et=T,gt=L,tt=/#|\.prototype\./,At=function(e,g){var t=Ct[it(e)];return t==nt||t!=It&&(gt(g)?et(g):!!g)},it=At.normalize=function(e){return String(e).replace(tt,".").toLowerCase()},Ct=At.data={},It=At.NATIVE="N",nt=At.POLYFILL="P",ot=At,rt=Qe,st=D,at=G(G.bind),lt=function(e,g){return rt(e),void 0===g?e:st?at(e,g):function(){return e.apply(g,arguments)}},dt={},ht=Y&&T((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ct=O,ut=ue,pt=ct.String,ft=ct.TypeError,vt=function(e){if(ut(e))return e;throw ft(pt(e)+" is not an object")},mt=Y,yt=Wg,bt=ht,wt=vt,kt=Zg,xt=O.TypeError,Et=Object.defineProperty,Ot=Object.getOwnPropertyDescriptor;dt.f=mt?bt?function(e,g,t){if(wt(e),g=kt(g),wt(t),"function"==typeof e&&"prototype"===g&&"value"in t&&"writable"in t&&!t.writable){var A=Ot(e,g);A&&A.writable&&(e[g]=t.value,t={configurable:"configurable"in t?t.configurable:A.configurable,enumerable:"enumerable"in t?t.enumerable:A.enumerable,writable:!1})}return Et(e,g,t)}:Et:function(e,g,t){if(wt(e),g=kt(g),wt(t),yt)try{return Et(e,g,t)}catch(e){}if("get"in t||"set"in t)throw xt("Accessors not supported");return"value"in t&&(e[g]=t.value),e};var Tt=dt,Dt=$,Nt=Y?function(e,g,t){return Tt.f(e,g,Dt(1,t))}:function(e,g,t){return e[g]=t,e},Rt=O,Pt=M,St=G,Mt=L,Bt=V.f,zt=ot,Ft=pe,Zt=lt,jt=Nt,Gt=ag,Lt=function(e){var g=function(t,A,i){if(this instanceof g){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,A)}return new e(t,A,i)}return Pt(e,this,arguments)};return g.prototype=e.prototype,g},Vt=function(e,g){var t,A,i,C,I,n,o,r,s=e.target,a=e.global,l=e.stat,d=e.proto,h=a?Rt:l?Rt[s]:(Rt[s]||{}).prototype,c=a?Ft:Ft[s]||jt(Ft,s,{})[s],u=c.prototype;for(i in g)t=!zt(a?i:s+(l?".":"#")+i,e.forced)&&h&&Gt(h,i),I=c[i],t&&(n=e.noTargetGet?(r=Bt(h,i))&&r.value:h[i]),C=t&&n?n:g[i],t&&typeof I==typeof C||(o=e.bind&&t?Zt(C,Rt):e.wrap&&t?Lt(C):d&&Mt(C)?St(C):C,(e.sham||C&&C.sham||I&&I.sham)&&jt(o,"sham",!0),jt(c,i,o),d&&(Gt(Ft,A=s+"Prototype")||jt(Ft,A,{}),jt(Ft[A],i,C),e.real&&u&&!u[i]&&jt(u,i,C)))},Yt=Math.ceil,Wt=Math.floor,_t=function(e){var g=+e;return g!=g||0===g?0:(g>0?Wt:Yt)(g)},Ut=_t,Qt=Math.max,Ht=Math.min,Kt=function(e,g){var t=Ut(e);return t<0?Qt(t+g,0):Ht(t,g)},Xt=_t,Jt=Math.min,qt=function(e){return e>0?Jt(Xt(e),9007199254740991):0},$t=function(e){return qt(e.length)},eA=he,gA=Kt,tA=$t,AA=function(e){return function(g,t,A){var i,C=eA(g),I=tA(C),n=gA(A,I);if(e&&t!=t){for(;I>n;)if((i=C[n++])!=i)return!0}else for(;I>n;n++)if((e||n in C)&&C[n]===t)return e||n||0;return!e&&-1}},iA={includes:AA(!0),indexOf:AA(!1)},CA={},IA=ag,nA=he,oA=iA.indexOf,rA=CA,sA=G([].push),aA=function(e,g){var t,A=nA(e),i=0,C=[];for(t in A)!IA(rA,t)&&IA(A,t)&&sA(C,t);for(;g.length>i;)IA(A,t=g[i++])&&(~oA(C,t)||sA(C,t));return C},lA=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],dA=aA,hA=lA,cA=Object.keys||function(e){return dA(e,hA)},uA={};uA.f=Object.getOwnPropertySymbols;var pA=Y,fA=G,vA=U,mA=T,yA=cA,bA=uA,wA=Q,kA=og,xA=re,EA=Object.assign,OA=Object.defineProperty,TA=fA([].concat),DA=!EA||mA((function(){if(pA&&1!==EA({b:1},EA(OA({},"a",{enumerable:!0,get:function(){OA(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},g={},t=Symbol(),A="abcdefghijklmnopqrst";return e[t]=7,A.split("").forEach((function(e){g[e]=e})),7!=EA({},e)[t]||yA(EA({},g)).join("")!=A}))?function(e,g){for(var t=kA(e),A=arguments.length,i=1,C=bA.f,I=wA.f;A>i;)for(var n,o=xA(arguments[i++]),r=C?TA(yA(o),C(o)):yA(o),s=r.length,a=0;s>a;)n=r[a++],pA&&!vA(I,o,n)||(t[n]=o[n]);return t}:EA;Vt({target:"Object",stat:!0,forced:Object.assign!==DA},{assign:DA});var NA=pe.Object.assign,RA=G([].slice),PA=G,SA=Qe,MA=ue,BA=ag,zA=RA,FA=D,ZA=O.Function,jA=PA([].concat),GA=PA([].join),LA={},VA=function(e,g,t){if(!BA(LA,g)){for(var A=[],i=0;i<g;i++)A[i]="a["+i+"]";LA[g]=ZA("C,a","return new C("+GA(A,",")+")")}return LA[g](e,t)},YA=FA?ZA.bind:function(e){var g=SA(this),t=g.prototype,A=zA(arguments,1),i=function(){var t=jA(A,zA(arguments));return this instanceof i?VA(g,t.length,t):g.apply(e,t)};return MA(t)&&(i.prototype=t),i},WA=YA;Vt({target:"Function",proto:!0,forced:Function.bind!==WA},{bind:WA});var _A=pe,UA=function(e){return _A[e+"Prototype"]},QA=UA("Function").bind,HA=we,KA=QA,XA=Function.prototype,JA=function(e){var g=e.bind;return e===XA||HA(XA,e)&&g===XA.bind?KA:g};function qA(e,g,t,A){e.beginPath(),e.arc(g,t,A,0,2*Math.PI,!1),e.closePath()}function $A(e,g,t,A,i,C){var I=Math.PI/180;A-2*C<0&&(C=A/2),i-2*C<0&&(C=i/2),e.beginPath(),e.moveTo(g+C,t),e.lineTo(g+A-C,t),e.arc(g+A-C,t+C,C,270*I,360*I,!1),e.lineTo(g+A,t+i-C),e.arc(g+A-C,t+i-C,C,0,90*I,!1),e.lineTo(g+C,t+i),e.arc(g+C,t+i-C,C,90*I,180*I,!1),e.lineTo(g,t+C),e.arc(g+C,t+C,C,180*I,270*I,!1),e.closePath()}function ei(e,g,t,A,i){var C=.5522848,I=A/2*C,n=i/2*C,o=g+A,r=t+i,s=g+A/2,a=t+i/2;e.beginPath(),e.moveTo(g,a),e.bezierCurveTo(g,a-n,s-I,t,s,t),e.bezierCurveTo(s+I,t,o,a-n,o,a),e.bezierCurveTo(o,a+n,s+I,r,s,r),e.bezierCurveTo(s-I,r,g,a+n,g,a),e.closePath()}function gi(e,g,t,A,i){var C=i*(1/3),I=.5522848,n=A/2*I,o=C/2*I,r=g+A,s=t+C,a=g+A/2,l=t+C/2,d=t+(i-C/2),h=t+i;e.beginPath(),e.moveTo(r,l),e.bezierCurveTo(r,l+o,a+n,s,a,s),e.bezierCurveTo(a-n,s,g,l+o,g,l),e.bezierCurveTo(g,l-o,a-n,t,a,t),e.bezierCurveTo(a+n,t,r,l-o,r,l),e.lineTo(r,d),e.bezierCurveTo(r,d+o,a+n,h,a,h),e.bezierCurveTo(a-n,h,g,d+o,g,d),e.lineTo(g,l)}function ti(e,g,t,A,i,C){e.beginPath(),e.moveTo(g,t);for(var I=C.length,n=A-g,o=i-t,r=o/n,s=Math.sqrt(n*n+o*o),a=0,l=!0,d=0,h=+C[0];s>=.1;)(h=+C[a++%I])>s&&(h=s),d=Math.sqrt(h*h/(1+r*r)),g+=d=n<0?-d:d,t+=r*d,!0===l?e.lineTo(g,t):e.moveTo(g,t),s-=h,l=!l}var Ai={circle:qA,dashedLine:ti,database:gi,diamond:function(e,g,t,A){e.beginPath(),e.lineTo(g,t+A),e.lineTo(g+A,t),e.lineTo(g,t-A),e.lineTo(g-A,t),e.closePath()},ellipse:ei,ellipse_vis:ei,hexagon:function(e,g,t,A){e.beginPath();var i=2*Math.PI/6;e.moveTo(g+A,t);for(var C=1;C<6;C++)e.lineTo(g+A*Math.cos(i*C),t+A*Math.sin(i*C));e.closePath()},roundRect:$A,square:function(e,g,t,A){e.beginPath(),e.rect(g-A,t-A,2*A,2*A),e.closePath()},star:function(e,g,t,A){e.beginPath(),t+=.1*(A*=.82);for(var i=0;i<10;i++){var C=i%2==0?1.3*A:.5*A;e.lineTo(g+C*Math.sin(2*i*Math.PI/10),t-C*Math.cos(2*i*Math.PI/10))}e.closePath()},triangle:function(e,g,t,A){e.beginPath(),t+=.275*(A*=1.15);var i=2*A,C=i/2,I=Math.sqrt(3)/6*i,n=Math.sqrt(i*i-C*C);e.moveTo(g,t-(n-I)),e.lineTo(g+C,t+I),e.lineTo(g-C,t+I),e.lineTo(g,t-(n-I)),e.closePath()},triangleDown:function(e,g,t,A){e.beginPath(),t-=.275*(A*=1.15);var i=2*A,C=i/2,I=Math.sqrt(3)/6*i,n=Math.sqrt(i*i-C*C);e.moveTo(g,t+(n-I)),e.lineTo(g+C,t-I),e.lineTo(g-C,t-I),e.lineTo(g,t+(n-I)),e.closePath()}};function ii(e,g){void 0===g&&(g={});var t=g.insertAt;if(e&&"undefined"!=typeof document){var A=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===t&&A.firstChild?A.insertBefore(i,A.firstChild):A.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}ii(".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");ii('/* override some bootstrap styles screwing up the timelines css */\n\n.vis [class*="span"] {\n  min-height: 0;\n  width: auto;\n}\n');ii("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");ii("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");ii("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 Ci={exports:{}};!function(e){function g(e){if(e)return function(e){for(var t in g.prototype)e[t]=g.prototype[t];return e}(e)}Ci.exports=g,g.prototype.on=g.prototype.addEventListener=function(e,g){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(g),this},g.prototype.once=function(e,g){function t(){this.off(e,t),g.apply(this,arguments)}return t.fn=g,this.on(e,t),this},g.prototype.off=g.prototype.removeListener=g.prototype.removeAllListeners=g.prototype.removeEventListener=function(e,g){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var t,A=this._callbacks["$"+e];if(!A)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<A.length;i++)if((t=A[i])===g||t.fn===g){A.splice(i,1);break}return 0===A.length&&delete this._callbacks["$"+e],this},g.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var g=new Array(arguments.length-1),t=this._callbacks["$"+e],A=1;A<arguments.length;A++)g[A-1]=arguments[A];if(t){A=0;for(var i=(t=t.slice(0)).length;A<i;++A)t[A].apply(this,g)}return this},g.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},g.prototype.hasListeners=function(e){return!!this.listeners(e).length}}();var Ii=Ci.exports,ni={};ni[Og("toStringTag")]="z";var oi="[object z]"===String(ni),ri=O,si=oi,ai=L,li=Ae,di=Og("toStringTag"),hi=ri.Object,ci="Arguments"==li(function(){return arguments}()),ui=si?li:function(e){var g,t,A;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(t=function(e,g){try{return e[g]}catch(e){}}(g=hi(e),di))?t:ci?li(g):"Object"==(A=li(g))&&ai(g.callee)?"Arguments":A},pi=ui,fi=O.String,vi=function(e){if("Symbol"===pi(e))throw TypeError("Cannot convert a Symbol value to a string");return fi(e)},mi=G,yi=_t,bi=vi,wi=ae,ki=mi("".charAt),xi=mi("".charCodeAt),Ei=mi("".slice),Oi=function(e){return function(g,t){var A,i,C=bi(wi(g)),I=yi(t),n=C.length;return I<0||I>=n?e?"":void 0:(A=xi(C,I))<55296||A>56319||I+1===n||(i=xi(C,I+1))<56320||i>57343?e?ki(C,I):A:e?Ei(C,I,I+2):i-56320+(A-55296<<10)+65536}},Ti={codeAt:Oi(!1),charAt:Oi(!0)},Di=L,Ni=ig,Ri=G(Function.toString);Di(Ni.inspectSource)||(Ni.inspectSource=function(e){return Ri(e)});var Pi,Si,Mi,Bi=Ni.inspectSource,zi=L,Fi=Bi,Zi=O.WeakMap,ji=zi(Zi)&&/native code/.test(Fi(Zi)),Gi=eg.exports,Li=ug,Vi=Gi("keys"),Yi=function(e){return Vi[e]||(Vi[e]=Li(e))},Wi=ji,_i=O,Ui=G,Qi=ue,Hi=Nt,Ki=ag,Xi=ig,Ji=Yi,qi=CA,$i=_i.TypeError,eC=_i.WeakMap;if(Wi||Xi.state){var gC=Xi.state||(Xi.state=new eC),tC=Ui(gC.get),AC=Ui(gC.has),iC=Ui(gC.set);Pi=function(e,g){if(AC(gC,e))throw new $i("Object already initialized");return g.facade=e,iC(gC,e,g),g},Si=function(e){return tC(gC,e)||{}},Mi=function(e){return AC(gC,e)}}else{var CC=Ji("state");qi[CC]=!0,Pi=function(e,g){if(Ki(e,CC))throw new $i("Object already initialized");return g.facade=e,Hi(e,CC,g),g},Si=function(e){return Ki(e,CC)?e[CC]:{}},Mi=function(e){return Ki(e,CC)}}var IC={set:Pi,get:Si,has:Mi,enforce:function(e){return Mi(e)?Si(e):Pi(e,{})},getterFor:function(e){return function(g){var t;if(!Qi(g)||(t=Si(g)).type!==e)throw $i("Incompatible receiver, "+e+" required");return t}}},nC=Y,oC=ag,rC=Function.prototype,sC=nC&&Object.getOwnPropertyDescriptor,aC=oC(rC,"name"),lC={EXISTS:aC,PROPER:aC&&"something"===function(){}.name,CONFIGURABLE:aC&&(!nC||nC&&sC(rC,"name").configurable)},dC={},hC=Y,cC=ht,uC=dt,pC=vt,fC=he,vC=cA;dC.f=hC&&!cC?Object.defineProperties:function(e,g){pC(e);for(var t,A=fC(g),i=vC(g),C=i.length,I=0;C>I;)uC.f(e,t=i[I++],A[t]);return e};var mC,yC=be("document","documentElement"),bC=vt,wC=dC,kC=lA,xC=CA,EC=yC,OC=Vg,TC=Yi("IE_PROTO"),DC=function(){},NC=function(e){return"<script>"+e+"<\/script>"},RC=function(e){e.write(NC("")),e.close();var g=e.parentWindow.Object;return e=null,g},PC=function(){try{mC=new ActiveXObject("htmlfile")}catch(e){}var e,g;PC="undefined"!=typeof document?document.domain&&mC?RC(mC):((g=OC("iframe")).style.display="none",EC.appendChild(g),g.src=String("javascript:"),(e=g.contentWindow.document).open(),e.write(NC("document.F=Object")),e.close(),e.F):RC(mC);for(var t=kC.length;t--;)delete PC.prototype[kC[t]];return PC()};xC[TC]=!0;var SC,MC,BC,zC=Object.create||function(e,g){var t;return null!==e?(DC.prototype=bC(e),t=new DC,DC.prototype=null,t[TC]=e):t=PC(),void 0===g?t:wC.f(t,g)},FC=!T((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ZC=O,jC=ag,GC=L,LC=og,VC=FC,YC=Yi("IE_PROTO"),WC=ZC.Object,_C=WC.prototype,UC=VC?WC.getPrototypeOf:function(e){var g=LC(e);if(jC(g,YC))return g[YC];var t=g.constructor;return GC(t)&&g instanceof t?t.prototype:g instanceof WC?_C:null},QC=Nt,HC=function(e,g,t,A){A&&A.enumerable?e[g]=t:QC(e,g,t)},KC=T,XC=L,JC=zC,qC=UC,$C=HC,eI=Og("iterator"),gI=!1;[].keys&&("next"in(BC=[].keys())?(MC=qC(qC(BC)))!==Object.prototype&&(SC=MC):gI=!0);var tI=null==SC||KC((function(){var e={};return SC[eI].call(e)!==e}));XC((SC=tI?{}:JC(SC))[eI])||$C(SC,eI,(function(){return this}));var AI={IteratorPrototype:SC,BUGGY_SAFARI_ITERATORS:gI},iI=ui,CI=oi?{}.toString:function(){return"[object "+iI(this)+"]"},II=oi,nI=dt.f,oI=Nt,rI=ag,sI=CI,aI=Og("toStringTag"),lI=function(e,g,t,A){if(e){var i=t?e:e.prototype;rI(i,aI)||nI(i,aI,{configurable:!0,value:g}),A&&!II&&oI(i,"toString",sI)}},dI={},hI=AI.IteratorPrototype,cI=zC,uI=$,pI=lI,fI=dI,vI=function(){return this},mI=O,yI=L,bI=mI.String,wI=mI.TypeError,kI=G,xI=vt,EI=function(e){if("object"==typeof e||yI(e))return e;throw wI("Can't set "+bI(e)+" as a prototype")},OI=Object.setPrototypeOf||("__proto__"in{}?function(){var e,g=!1,t={};try{(e=kI(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(t,[]),g=t instanceof Array}catch(e){}return function(t,A){return xI(t),EI(A),g?e(t,A):t.__proto__=A,t}}():void 0),TI=Vt,DI=U,NI=function(e,g,t,A){var i=g+" Iterator";return e.prototype=cI(hI,{next:uI(+!A,t)}),pI(e,i,!1,!0),fI[i]=vI,e},RI=UC,PI=lI,SI=HC,MI=dI,BI=lC.PROPER,zI=AI.BUGGY_SAFARI_ITERATORS,FI=Og("iterator"),ZI=function(){return this},jI=function(e,g,t,A,i,C,I){NI(t,g,A);var n,o,r,s=function(e){if(e===i&&c)return c;if(!zI&&e in d)return d[e];switch(e){case"keys":case"values":case"entries":return function(){return new t(this,e)}}return function(){return new t(this)}},a=g+" Iterator",l=!1,d=e.prototype,h=d[FI]||d["@@iterator"]||i&&d[i],c=!zI&&h||s(i),u="Array"==g&&d.entries||h;if(u&&(n=RI(u.call(new e)))!==Object.prototype&&n.next&&(PI(n,a,!0,!0),MI[a]=ZI),BI&&"values"==i&&h&&"values"!==h.name&&(l=!0,c=function(){return DI(h,this)}),i)if(o={values:s("values"),keys:C?c:s("keys"),entries:s("entries")},I)for(r in o)(zI||l||!(r in d))&&SI(d,r,o[r]);else TI({target:g,proto:!0,forced:zI||l},o);return I&&d[FI]!==c&&SI(d,FI,c,{name:i}),MI[g]=c,o},GI=Ti.charAt,LI=vi,VI=IC,YI=jI,WI=VI.set,_I=VI.getterFor("String Iterator");YI(String,"String",(function(e){WI(this,{type:"String Iterator",string:LI(e),index:0})}),(function(){var e,g=_I(this),t=g.string,A=g.index;return A>=t.length?{value:void 0,done:!0}:(e=GI(t,A),g.index+=e.length,{value:e,done:!1})}));var UI=U,QI=vt,HI=Ke,KI=function(e,g,t){var A,i;QI(e);try{if(!(A=HI(e,"return"))){if("throw"===g)throw t;return t}A=UI(A,e)}catch(e){i=!0,A=e}if("throw"===g)throw t;if(i)throw A;return QI(A),t},XI=vt,JI=KI,qI=dI,$I=Og("iterator"),en=Array.prototype,gn=function(e){return void 0!==e&&(qI.Array===e||en[$I]===e)},tn=G,An=T,Cn=L,In=ui,nn=Bi,on=function(){},rn=[],sn=be("Reflect","construct"),an=/^\s*(?:class|function)\b/,ln=tn(an.exec),dn=!an.exec(on),hn=function(e){if(!Cn(e))return!1;try{return sn(on,rn,e),!0}catch(e){return!1}},cn=function(e){if(!Cn(e))return!1;switch(In(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return dn||!!ln(an,nn(e))}catch(e){return!0}};cn.sham=!0;var un=!sn||An((function(){var e;return hn(hn.call)||!hn(Object)||!hn((function(){e=!0}))||e}))?cn:hn,pn=Zg,fn=dt,vn=$,mn=function(e,g,t){var A=pn(g);A in e?fn.f(e,A,vn(0,t)):e[A]=t},yn=ui,bn=Ke,wn=dI,kn=Og("iterator"),xn=function(e){if(null!=e)return bn(e,kn)||bn(e,"@@iterator")||wn[yn(e)]},En=U,On=Qe,Tn=vt,Dn=Ye,Nn=xn,Rn=O.TypeError,Pn=function(e,g){var t=arguments.length<2?Nn(e):g;if(On(t))return Tn(En(t,e));throw Rn(Dn(e)+" is not iterable")},Sn=lt,Mn=U,Bn=og,zn=function(e,g,t,A){try{return A?g(XI(t)[0],t[1]):g(t)}catch(g){JI(e,"throw",g)}},Fn=gn,Zn=un,jn=$t,Gn=mn,Ln=Pn,Vn=xn,Yn=O.Array,Wn=Og("iterator"),_n=!1;try{var Un=0,Qn={next:function(){return{done:!!Un++}},return:function(){_n=!0}};Qn[Wn]=function(){return this},Array.from(Qn,(function(){throw 2}))}catch(e){}var Hn=function(e){var g=Bn(e),t=Zn(this),A=arguments.length,i=A>1?arguments[1]:void 0,C=void 0!==i;C&&(i=Sn(i,A>2?arguments[2]:void 0));var I,n,o,r,s,a,l=Vn(g),d=0;if(!l||this==Yn&&Fn(l))for(I=jn(g),n=t?new this(I):Yn(I);I>d;d++)a=C?i(g[d],d):g[d],Gn(n,d,a);else for(s=(r=Ln(g,l)).next,n=t?new this:[];!(o=Mn(s,r)).done;d++)a=C?zn(r,i,[o.value,d],!0):o.value,Gn(n,d,a);return n.length=d,n};Vt({target:"Array",stat:!0,forced:!function(e,g){if(!g&&!_n)return!1;var t=!1;try{var A={};A[Wn]=function(){return{next:function(){return{done:t=!0}}}},e(A)}catch(e){}return t}((function(e){Array.from(e)}))},{from:Hn});var Kn=pe.Array.from,Xn=Kn,Jn=he,qn=dI,$n=IC;dt.f;var eo=jI,go=$n.set,to=$n.getterFor("Array Iterator");eo(Array,"Array",(function(e,g){go(this,{type:"Array Iterator",target:Jn(e),index:0,kind:g})}),(function(){var e=to(this),g=e.target,t=e.kind,A=e.index++;return!g||A>=g.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==t?{value:A,done:!1}:"values"==t?{value:g[A],done:!1}:{value:[A,g[A]],done:!1}}),"values"),qn.Arguments=qn.Array;var Ao=xn,io={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},Co=O,Io=ui,no=Nt,oo=dI,ro=Og("toStringTag");for(var so in io){var ao=Co[so],lo=ao&&ao.prototype;lo&&Io(lo)!==ro&&no(lo,ro,so),oo[so]=oo.Array}var ho=Ao,co=Ae,uo=Array.isArray||function(e){return"Array"==co(e)},po={},fo=aA,vo=lA.concat("length","prototype");po.f=Object.getOwnPropertyNames||function(e){return fo(e,vo)};var mo={},yo=Kt,bo=$t,wo=mn,ko=O.Array,xo=Math.max,Eo=function(e,g,t){for(var A=bo(e),i=yo(g,A),C=yo(void 0===t?A:t,A),I=ko(xo(C-i,0)),n=0;i<C;i++,n++)wo(I,n,e[i]);return I.length=n,I},Oo=Ae,To=he,Do=po.f,No=Eo,Ro="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];mo.f=function(e){return Ro&&"Window"==Oo(e)?function(e){try{return Do(e)}catch(e){return No(Ro)}}(e):Do(To(e))};var Po={},So=Og;Po.f=So;var Mo=pe,Bo=ag,zo=Po,Fo=dt.f,Zo=function(e){var g=Mo.Symbol||(Mo.Symbol={});Bo(g,e)||Fo(g,e,{value:zo.f(e)})},jo=O,Go=uo,Lo=un,Vo=ue,Yo=Og("species"),Wo=jo.Array,_o=function(e){var g;return Go(e)&&(g=e.constructor,(Lo(g)&&(g===Wo||Go(g.prototype))||Vo(g)&&null===(g=g[Yo]))&&(g=void 0)),void 0===g?Wo:g},Uo=function(e,g){return new(_o(e))(0===g?0:g)},Qo=lt,Ho=re,Ko=og,Xo=$t,Jo=Uo,qo=G([].push),$o=function(e){var g=1==e,t=2==e,A=3==e,i=4==e,C=6==e,I=7==e,n=5==e||C;return function(o,r,s,a){for(var l,d,h=Ko(o),c=Ho(h),u=Qo(r,s),p=Xo(c),f=0,v=a||Jo,m=g?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),e))if(g)m[f]=d;else if(d)switch(e){case 3:return!0;case 5:return l;case 6:return f;case 2:qo(m,l)}else switch(e){case 4:return!1;case 7:qo(m,l)}return C?-1:A||i?i:m}},er={forEach:$o(0),map:$o(1),filter:$o(2),some:$o(3),every:$o(4),find:$o(5),findIndex:$o(6),filterReject:$o(7)},gr=Vt,tr=O,Ar=be,ir=M,Cr=U,Ir=G,nr=Y,or=Me,rr=T,sr=ag,ar=uo,lr=L,dr=ue,hr=we,cr=Le,ur=vt,pr=og,fr=he,vr=Zg,mr=vi,yr=$,br=zC,wr=cA,kr=po,xr=mo,Er=uA,Or=V,Tr=dt,Dr=dC,Nr=Q,Rr=RA,Pr=HC,Sr=eg.exports,Mr=CA,Br=ug,zr=Og,Fr=Po,Zr=Zo,jr=lI,Gr=IC,Lr=er.forEach,Vr=Yi("hidden"),Yr=zr("toPrimitive"),Wr=Gr.set,_r=Gr.getterFor("Symbol"),Ur=Object.prototype,Qr=tr.Symbol,Hr=Qr&&Qr.prototype,Kr=tr.TypeError,Xr=tr.QObject,Jr=Ar("JSON","stringify"),qr=Or.f,$r=Tr.f,es=xr.f,gs=Nr.f,ts=Ir([].push),As=Sr("symbols"),is=Sr("op-symbols"),Cs=Sr("string-to-symbol-registry"),Is=Sr("symbol-to-string-registry"),ns=Sr("wks"),os=!Xr||!Xr.prototype||!Xr.prototype.findChild,rs=nr&&rr((function(){return 7!=br($r({},"a",{get:function(){return $r(this,"a",{value:7}).a}})).a}))?function(e,g,t){var A=qr(Ur,g);A&&delete Ur[g],$r(e,g,t),A&&e!==Ur&&$r(Ur,g,A)}:$r,ss=function(e,g){var t=As[e]=br(Hr);return Wr(t,{type:"Symbol",tag:e,description:g}),nr||(t.description=g),t},as=function(e,g,t){e===Ur&&as(is,g,t),ur(e);var A=vr(g);return ur(t),sr(As,A)?(t.enumerable?(sr(e,Vr)&&e[Vr][A]&&(e[Vr][A]=!1),t=br(t,{enumerable:yr(0,!1)})):(sr(e,Vr)||$r(e,Vr,yr(1,{})),e[Vr][A]=!0),rs(e,A,t)):$r(e,A,t)},ls=function(e,g){ur(e);var t=fr(g),A=wr(t).concat(us(t));return Lr(A,(function(g){nr&&!Cr(ds,t,g)||as(e,g,t[g])})),e},ds=function(e){var g=vr(e),t=Cr(gs,this,g);return!(this===Ur&&sr(As,g)&&!sr(is,g))&&(!(t||!sr(this,g)||!sr(As,g)||sr(this,Vr)&&this[Vr][g])||t)},hs=function(e,g){var t=fr(e),A=vr(g);if(t!==Ur||!sr(As,A)||sr(is,A)){var i=qr(t,A);return!i||!sr(As,A)||sr(t,Vr)&&t[Vr][A]||(i.enumerable=!0),i}},cs=function(e){var g=es(fr(e)),t=[];return Lr(g,(function(e){sr(As,e)||sr(Mr,e)||ts(t,e)})),t},us=function(e){var g=e===Ur,t=es(g?is:fr(e)),A=[];return Lr(t,(function(e){!sr(As,e)||g&&!sr(Ur,e)||ts(A,As[e])})),A};(or||(Pr(Hr=(Qr=function(){if(hr(Hr,this))throw Kr("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?mr(arguments[0]):void 0,g=Br(e),t=function(e){this===Ur&&Cr(t,is,e),sr(this,Vr)&&sr(this[Vr],g)&&(this[Vr][g]=!1),rs(this,g,yr(1,e))};return nr&&os&&rs(Ur,g,{configurable:!0,set:t}),ss(g,e)}).prototype,"toString",(function(){return _r(this).tag})),Pr(Qr,"withoutSetter",(function(e){return ss(Br(e),e)})),Nr.f=ds,Tr.f=as,Dr.f=ls,Or.f=hs,kr.f=xr.f=cs,Er.f=us,Fr.f=function(e){return ss(zr(e),e)},nr&&$r(Hr,"description",{configurable:!0,get:function(){return _r(this).description}})),gr({global:!0,wrap:!0,forced:!or,sham:!or},{Symbol:Qr}),Lr(wr(ns),(function(e){Zr(e)})),gr({target:"Symbol",stat:!0,forced:!or},{for:function(e){var g=mr(e);if(sr(Cs,g))return Cs[g];var t=Qr(g);return Cs[g]=t,Is[t]=g,t},keyFor:function(e){if(!cr(e))throw Kr(e+" is not a symbol");if(sr(Is,e))return Is[e]},useSetter:function(){os=!0},useSimple:function(){os=!1}}),gr({target:"Object",stat:!0,forced:!or,sham:!nr},{create:function(e,g){return void 0===g?br(e):ls(br(e),g)},defineProperty:as,defineProperties:ls,getOwnPropertyDescriptor:hs}),gr({target:"Object",stat:!0,forced:!or},{getOwnPropertyNames:cs,getOwnPropertySymbols:us}),gr({target:"Object",stat:!0,forced:rr((function(){Er.f(1)}))},{getOwnPropertySymbols:function(e){return Er.f(pr(e))}}),Jr)&&gr({target:"JSON",stat:!0,forced:!or||rr((function(){var e=Qr();return"[null]"!=Jr([e])||"{}"!=Jr({a:e})||"{}"!=Jr(Object(e))}))},{stringify:function(e,g,t){var A=Rr(arguments),i=g;if((dr(g)||void 0!==e)&&!cr(e))return ar(g)||(g=function(e,g){if(lr(i)&&(g=Cr(i,this,e,g)),!cr(g))return g}),A[1]=g,ir(Jr,null,A)}});if(!Hr[Yr]){var ps=Hr.valueOf;Pr(Hr,Yr,(function(e){return Cr(ps,this)}))}jr(Qr,"Symbol"),Mr[Vr]=!0;var fs=pe.Object.getOwnPropertySymbols,vs={exports:{}},ms=Vt,ys=T,bs=he,ws=V.f,ks=Y,xs=ys((function(){ws(1)}));ms({target:"Object",stat:!0,forced:!ks||xs,sham:!ks},{getOwnPropertyDescriptor:function(e,g){return ws(bs(e),g)}});var Es=pe.Object,Os=vs.exports=function(e,g){return Es.getOwnPropertyDescriptor(e,g)};Es.getOwnPropertyDescriptor.sham&&(Os.sham=!0);var Ts=vs.exports,Ds=Ts,Ns=be,Rs=po,Ps=uA,Ss=vt,Ms=G([].concat),Bs=Ns("Reflect","ownKeys")||function(e){var g=Rs.f(Ss(e)),t=Ps.f;return t?Ms(g,t(e)):g},zs=Bs,Fs=he,Zs=V,js=mn;Vt({target:"Object",stat:!0,sham:!Y},{getOwnPropertyDescriptors:function(e){for(var g,t,A=Fs(e),i=Zs.f,C=zs(A),I={},n=0;C.length>n;)void 0!==(t=i(A,g=C[n++]))&&js(I,g,t);return I}});var Gs=pe.Object.getOwnPropertyDescriptors,Ls={exports:{}},Vs=Vt,Ys=Y,Ws=dC.f;Vs({target:"Object",stat:!0,forced:Object.defineProperties!==Ws,sham:!Ys},{defineProperties:Ws});var _s=pe.Object,Us=Ls.exports=function(e,g){return _s.defineProperties(e,g)};_s.defineProperties.sham&&(Us.sham=!0);var Qs=Ls.exports,Hs={exports:{}},Ks=Vt,Xs=Y,Js=dt.f;Ks({target:"Object",stat:!0,forced:Object.defineProperty!==Js,sham:!Xs},{defineProperty:Js});var qs=pe.Object,$s=Hs.exports=function(e,g,t){return qs.defineProperty(e,g,t)};qs.defineProperty.sham&&($s.sham=!0);var ea=Hs.exports,ga=ea;function ta(e,g){if(!(e instanceof g))throw new TypeError("Cannot call a class as a function")}var Aa=ea;function ia(e,g){for(var t=0;t<g.length;t++){var A=g[t];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Aa(e,A.key,A)}}function Ca(e,g,t){return g&&ia(e.prototype,g),t&&ia(e,t),Aa(e,"prototype",{writable:!1}),e}function Ia(e,g,t){return g in e?Aa(e,g,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[g]=t,e}Vt({target:"Array",stat:!0},{isArray:uo});var na=pe.Array.isArray,oa=na;var ra=T,sa=Re,aa=Og("species"),la=function(e){return sa>=51||!ra((function(){var g=[];return(g.constructor={})[aa]=function(){return{foo:1}},1!==g[e](Boolean).foo}))},da=Vt,ha=O,ca=T,ua=uo,pa=ue,fa=og,va=$t,ma=mn,ya=Uo,ba=la,wa=Re,ka=Og("isConcatSpreadable"),xa=ha.TypeError,Ea=wa>=51||!ca((function(){var e=[];return e[ka]=!1,e.concat()[0]!==e})),Oa=ba("concat"),Ta=function(e){if(!pa(e))return!1;var g=e[ka];return void 0!==g?!!g:ua(e)};da({target:"Array",proto:!0,forced:!Ea||!Oa},{concat:function(e){var g,t,A,i,C,I=fa(this),n=ya(I,0),o=0;for(g=-1,A=arguments.length;g<A;g++)if(Ta(C=-1===g?I:arguments[g])){if(o+(i=va(C))>9007199254740991)throw xa("Maximum allowed index exceeded");for(t=0;t<i;t++,o++)t in C&&ma(n,o,C[t])}else{if(o>=9007199254740991)throw xa("Maximum allowed index exceeded");ma(n,o++,C)}return n.length=o,n}}),Zo("asyncIterator"),Zo("hasInstance"),Zo("isConcatSpreadable"),Zo("iterator"),Zo("match"),Zo("matchAll"),Zo("replace"),Zo("search"),Zo("species"),Zo("split"),Zo("toPrimitive"),Zo("toStringTag"),Zo("unscopables"),lI(O.JSON,"JSON",!0);var Da=pe.Symbol,Na=Da;Zo("asyncDispose"),Zo("dispose"),Zo("matcher"),Zo("metadata"),Zo("observable"),Zo("patternMatch"),Zo("replaceAll");var Ra=Na;var Pa=Vt,Sa=O,Ma=uo,Ba=un,za=ue,Fa=Kt,Za=$t,ja=he,Ga=mn,La=Og,Va=RA,Ya=la("slice"),Wa=La("species"),_a=Sa.Array,Ua=Math.max;Pa({target:"Array",proto:!0,forced:!Ya},{slice:function(e,g){var t,A,i,C=ja(this),I=Za(C),n=Fa(e,I),o=Fa(void 0===g?I:g,I);if(Ma(C)&&(t=C.constructor,(Ba(t)&&(t===_a||Ma(t.prototype))||za(t)&&null===(t=t[Wa]))&&(t=void 0),t===_a||void 0===t))return Va(C,n,o);for(A=new(void 0===t?_a:t)(Ua(o-n,0)),i=0;n<o;n++,i++)n in C&&Ga(A,i,C[n]);return A.length=i,A}});var Qa=UA("Array").slice,Ha=we,Ka=Qa,Xa=Array.prototype,Ja=function(e){var g=e.slice;return e===Xa||Ha(Xa,e)&&g===Xa.slice?Ka:g},qa=Ja,$a=Kn;function el(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}function gl(e,g){var t;if(e){if("string"==typeof e)return el(e,g);var A=qa(t=Object.prototype.toString.call(e)).call(t,8,-1);return"Object"===A&&e.constructor&&(A=e.constructor.name),"Map"===A||"Set"===A?$a(e):"Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A)?el(e,g):void 0}}function tl(e,g){return function(e){if(oa(e))return e}(e)||function(e,g){var t=null==e?null:void 0!==Ra&&ho(e)||e["@@iterator"];if(null!=t){var A,i,C=[],I=!0,n=!1;try{for(t=t.call(e);!(I=(A=t.next()).done)&&(C.push(A.value),!g||C.length!==g);I=!0);}catch(e){n=!0,i=e}finally{try{I||null==t.return||t.return()}finally{if(n)throw i}}return C}}(e,g)||gl(e,g)||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 Al=Po.f("iterator"),il=Al;function Cl(e){return(Cl="function"==typeof Ra&&"symbol"==typeof il?function(e){return typeof e}:function(e){return e&&"function"==typeof Ra&&e.constructor===Ra&&e!==Ra.prototype?"symbol":typeof e})(e)}function Il(e){return function(e){if(oa(e))return el(e)}(e)||function(e){if(void 0!==Ra&&null!=ho(e)||null!=e["@@iterator"])return $a(e)}(e)||gl(e)||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 nl=Da,ol=UA("Array").concat,rl=we,sl=ol,al=Array.prototype,ll=function(e){var g=e.concat;return e===al||rl(al,e)&&g===al.concat?sl:g},dl=Ja;Vt({target:"Reflect",stat:!0},{ownKeys:Bs});var hl=pe.Reflect.ownKeys,cl=na,ul=er.map;Vt({target:"Array",proto:!0,forced:!la("map")},{map:function(e){return ul(this,e,arguments.length>1?arguments[1]:void 0)}});var pl=UA("Array").map,fl=we,vl=pl,ml=Array.prototype,yl=function(e){var g=e.map;return e===ml||fl(ml,e)&&g===ml.map?vl:g},bl=og,wl=cA;Vt({target:"Object",stat:!0,forced:T((function(){wl(1)}))},{keys:function(e){return wl(bl(e))}});var kl=pe.Object.keys,xl=Vt,El=G,Ol=O.Date,Tl=El(Ol.prototype.getTime);xl({target:"Date",stat:!0},{now:function(){return Tl(new Ol)}});var Dl=pe.Date.now,Nl=T,Rl=function(e,g){var t=[][e];return!!t&&Nl((function(){t.call(null,g||function(){return 1},1)}))},Pl=er.forEach,Sl=Rl("forEach")?[].forEach:function(e){return Pl(this,e,arguments.length>1?arguments[1]:void 0)};Vt({target:"Array",proto:!0,forced:[].forEach!=Sl},{forEach:Sl});var Ml=UA("Array").forEach,Bl=ui,zl=ag,Fl=we,Zl=Ml,jl=Array.prototype,Gl={DOMTokenList:!0,NodeList:!0},Ll=function(e){var g=e.forEach;return e===jl||Fl(jl,e)&&g===jl.forEach||zl(Gl,Bl(e))?Zl:g},Vl=Vt,Yl=uo,Wl=G([].reverse),_l=[1,2];Vl({target:"Array",proto:!0,forced:String(_l)===String(_l.reverse())},{reverse:function(){return Yl(this)&&(this.length=this.length),Wl(this)}});var Ul=UA("Array").reverse,Ql=we,Hl=Ul,Kl=Array.prototype,Xl=function(e){var g=e.reverse;return e===Kl||Ql(Kl,e)&&g===Kl.reverse?Hl:g},Jl=Vt,ql=O,$l=Kt,ed=_t,gd=$t,td=og,Ad=Uo,id=mn,Cd=la("splice"),Id=ql.TypeError,nd=Math.max,od=Math.min;Jl({target:"Array",proto:!0,forced:!Cd},{splice:function(e,g){var t,A,i,C,I,n,o=td(this),r=gd(o),s=$l(e,r),a=arguments.length;if(0===a?t=A=0:1===a?(t=0,A=r-s):(t=a-2,A=od(nd(ed(g),0),r-s)),r+t-A>9007199254740991)throw Id("Maximum allowed length exceeded");for(i=Ad(o,A),C=0;C<A;C++)(I=s+C)in o&&id(i,C,o[I]);if(i.length=A,t<A){for(C=s;C<r-A;C++)n=C+t,(I=C+A)in o?o[n]=o[I]:delete o[n];for(C=r;C>r-A+t;C--)delete o[C-1]}else if(t>A)for(C=r-A;C>s;C--)n=C+t-1,(I=C+A-1)in o?o[n]=o[I]:delete o[n];for(C=0;C<t;C++)o[C+s]=arguments[C+2];return o.length=r-A+t,i}});var rd=UA("Array").splice,sd=we,ad=rd,ld=Array.prototype,dd=function(e){var g=e.splice;return e===ld||sd(ld,e)&&g===ld.splice?ad:g},hd=iA.includes;Vt({target:"Array",proto:!0},{includes:function(e){return hd(this,e,arguments.length>1?arguments[1]:void 0)}});var cd=UA("Array").includes,ud=ue,pd=Ae,fd=Og("match"),vd=function(e){var g;return ud(e)&&(void 0!==(g=e[fd])?!!g:"RegExp"==pd(e))},md=O.TypeError,yd=Og("match"),bd=Vt,wd=function(e){if(vd(e))throw md("The method doesn't accept regular expressions");return e},kd=ae,xd=vi,Ed=function(e){var g=/./;try{"/./"[e](g)}catch(t){try{return g[yd]=!1,"/./"[e](g)}catch(e){}}return!1},Od=G("".indexOf);bd({target:"String",proto:!0,forced:!Ed("includes")},{includes:function(e){return!!~Od(xd(kd(this)),xd(wd(e)),arguments.length>1?arguments[1]:void 0)}});var Td=UA("String").includes,Dd=we,Nd=cd,Rd=Td,Pd=Array.prototype,Sd=String.prototype,Md=function(e){var g=e.includes;return e===Pd||Dd(Pd,e)&&g===Pd.includes?Nd:"string"==typeof e||e===Sd||Dd(Sd,e)&&g===Sd.includes?Rd:g},Bd=og,zd=UC,Fd=FC;Vt({target:"Object",stat:!0,forced:T((function(){zd(1)})),sham:!Fd},{getPrototypeOf:function(e){return zd(Bd(e))}});var Zd=pe.Object.getPrototypeOf,jd=Zd,Gd=er.filter;Vt({target:"Array",proto:!0,forced:!la("filter")},{filter:function(e){return Gd(this,e,arguments.length>1?arguments[1]:void 0)}});var Ld=UA("Array").filter,Vd=we,Yd=Ld,Wd=Array.prototype,_d=function(e){var g=e.filter;return e===Wd||Vd(Wd,e)&&g===Wd.filter?Yd:g},Ud=Y,Qd=G,Hd=cA,Kd=he,Xd=Qd(Q.f),Jd=Qd([].push),qd=function(e){return function(g){for(var t,A=Kd(g),i=Hd(A),C=i.length,I=0,n=[];C>I;)t=i[I++],Ud&&!Xd(A,t)||Jd(n,e?[t,A[t]]:A[t]);return n}},$d={entries:qd(!0),values:qd(!1)}.values;Vt({target:"Object",stat:!0},{values:function(e){return $d(e)}}),pe.Object.values;var eh="\t\n\v\f\r                　\u2028\u2029\ufeff",gh=ae,th=vi,Ah=G("".replace),ih="[\t\n\v\f\r                　\u2028\u2029\ufeff]",Ch=RegExp("^"+ih+ih+"*"),Ih=RegExp(ih+ih+"*$"),nh=function(e){return function(g){var t=th(gh(g));return 1&e&&(t=Ah(t,Ch,"")),2&e&&(t=Ah(t,Ih,"")),t}},oh={start:nh(1),end:nh(2),trim:nh(3)},rh=O,sh=T,ah=G,lh=vi,dh=oh.trim,hh=rh.parseInt,ch=rh.Symbol,uh=ch&&ch.iterator,ph=/^[+-]?0x/i,fh=ah(ph.exec),vh=8!==hh("\t\n\v\f\r                　\u2028\u2029\ufeff08")||22!==hh("\t\n\v\f\r                　\u2028\u2029\ufeff0x16")||uh&&!sh((function(){hh(Object(uh))}))?function(e,g){var t=dh(lh(e));return hh(t,g>>>0||(fh(ph,t)?16:10))}:hh;Vt({global:!0,forced:parseInt!=vh},{parseInt:vh});var mh=pe.parseInt,yh=Vt,bh=iA.indexOf,wh=Rl,kh=G([].indexOf),xh=!!kh&&1/kh([1],1,-0)<0,Eh=wh("indexOf");yh({target:"Array",proto:!0,forced:xh||!Eh},{indexOf:function(e){var g=arguments.length>1?arguments[1]:void 0;return xh?kh(this,e,g)||0:bh(this,e,g)}});var Oh=UA("Array").indexOf,Th=we,Dh=Oh,Nh=Array.prototype,Rh=function(e){var g=e.indexOf;return e===Nh||Th(Nh,e)&&g===Nh.indexOf?Dh:g},Ph=lC.PROPER,Sh=T,Mh=eh,Bh=oh.trim;Vt({target:"String",proto:!0,forced:function(e){return Sh((function(){return!!Mh[e]()||"​᠎"!=="​᠎"[e]()||Ph&&Mh[e].name!==e}))}("trim")},{trim:function(){return Bh(this)}}),UA("String").trim,Vt({target:"Object",stat:!0,sham:!Y},{create:zC});var zh=pe.Object,Fh=function(e,g){return zh.create(e,g)},Zh=Fh,jh=Vt,Gh=be,Lh=M,Vh=G,Yh=T,Wh=O.Array,_h=Gh("JSON","stringify"),Uh=Vh(/./.exec),Qh=Vh("".charAt),Hh=Vh("".charCodeAt),Kh=Vh("".replace),Xh=Vh(1..toString),Jh=/[\uD800-\uDFFF]/g,qh=/^[\uD800-\uDBFF]$/,$h=/^[\uDC00-\uDFFF]$/,ec=function(e,g,t){var A=Qh(t,g-1),i=Qh(t,g+1);return Uh(qh,e)&&!Uh($h,i)||Uh($h,e)&&!Uh(qh,A)?"\\u"+Xh(Hh(e,0),16):e},gc=Yh((function(){return'"\\udf06\\ud834"'!==_h("\udf06\ud834")||'"\\udead"'!==_h("\udead")}));_h&&jh({target:"JSON",stat:!0,forced:gc},{stringify:function(e,g,t){for(var A=0,i=arguments.length,C=Wh(i);A<i;A++)C[A]=arguments[A];var I=Lh(_h,null,C);return"string"==typeof I?Kh(I,Jh,ec):I}});var tc=pe,Ac=M;tc.JSON||(tc.JSON={stringify:JSON.stringify});var ic=function(e,g,t){return Ac(tc.JSON.stringify,null,arguments)},Cc=O.TypeError,Ic=Vt,nc=O,oc=M,rc=L,sc=RA,ac=function(e,g){if(e<g)throw Cc("Not enough arguments");return e},lc=/MSIE .\./.test(ke),dc=nc.Function,hc=function(e){return function(g,t){var A=ac(arguments.length,1)>2,i=rc(g)?g:dc(g),C=A?sc(arguments,2):void 0;return e(A?function(){oc(i,this,C)}:i,t)}};Ic({global:!0,bind:!0,forced:lc},{setTimeout:hc(nc.setTimeout),setInterval:hc(nc.setInterval)});var cc=pe.setTimeout,uc=og,pc=Kt,fc=$t;Vt({target:"Array",proto:!0},{fill:function(e){for(var g=uc(this),t=fc(g),A=arguments.length,i=pc(A>1?arguments[1]:void 0,t),C=A>2?arguments[2]:void 0,I=void 0===C?t:pc(C,t);I>i;)g[i++]=e;return g}});var vc=UA("Array").fill,mc=we,yc=vc,bc=Array.prototype,wc=function(e){var g=e.fill;return e===bc||mc(bc,e)&&g===bc.fill?yc:g};
/*! 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 kc(){return(kc=Object.assign||function(e){for(var g=1;g<arguments.length;g++){var t=arguments[g];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(e[A]=t[A])}return e}).apply(this,arguments)}function xc(e,g){e.prototype=Object.create(g.prototype),e.prototype.constructor=e,e.__proto__=g}function Ec(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Oc,Tc="function"!=typeof Object.assign?function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var g=Object(e),t=1;t<arguments.length;t++){var A=arguments[t];if(null!=A)for(var i in A)A.hasOwnProperty(i)&&(g[i]=A[i])}return g}:Object.assign,Dc=["","webkit","Moz","MS","ms","o"],Nc="undefined"==typeof document?{style:{}}:document.createElement("div"),Rc=Math.round,Pc=Math.abs,Sc=Date.now;function Mc(e,g){for(var t,A,i=g[0].toUpperCase()+g.slice(1),C=0;C<Dc.length;){if((A=(t=Dc[C])?t+i:g)in e)return A;C++}}Oc="undefined"==typeof window?{}:window;var Bc=Mc(Nc.style,"touchAction"),zc=void 0!==Bc;var Fc=function(){if(!zc)return!1;var e={},g=Oc.CSS&&Oc.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(t){return e[t]=!g||Oc.CSS.supports("touch-action",t)})),e}(),Zc="ontouchstart"in Oc,jc=void 0!==Mc(Oc,"PointerEvent"),Gc=Zc&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),Lc=["x","y"],Vc=["clientX","clientY"];function Yc(e,g,t){var A;if(e)if(e.forEach)e.forEach(g,t);else if(void 0!==e.length)for(A=0;A<e.length;)g.call(t,e[A],A,e),A++;else for(A in e)e.hasOwnProperty(A)&&g.call(t,e[A],A,e)}function Wc(e,g){return"function"==typeof e?e.apply(g&&g[0]||void 0,g):e}function _c(e,g){return e.indexOf(g)>-1}var Uc=function(){function e(e,g){this.manager=e,this.set(g)}var g=e.prototype;return g.set=function(e){"compute"===e&&(e=this.compute()),zc&&this.manager.element.style&&Fc[e]&&(this.manager.element.style[Bc]=e),this.actions=e.toLowerCase().trim()},g.update=function(){this.set(this.manager.options.touchAction)},g.compute=function(){var e=[];return Yc(this.manager.recognizers,(function(g){Wc(g.options.enable,[g])&&(e=e.concat(g.getTouchAction()))})),function(e){if(_c(e,"none"))return"none";var g=_c(e,"pan-x"),t=_c(e,"pan-y");return g&&t?"none":g||t?g?"pan-x":"pan-y":_c(e,"manipulation")?"manipulation":"auto"}(e.join(" "))},g.preventDefaults=function(e){var g=e.srcEvent,t=e.offsetDirection;if(this.manager.session.prevented)g.preventDefault();else{var A=this.actions,i=_c(A,"none")&&!Fc.none,C=_c(A,"pan-y")&&!Fc["pan-y"],I=_c(A,"pan-x")&&!Fc["pan-x"];if(i){var n=1===e.pointers.length,o=e.distance<2,r=e.deltaTime<250;if(n&&o&&r)return}if(!I||!C)return i||C&&6&t||I&&24&t?this.preventSrc(g):void 0}},g.preventSrc=function(e){this.manager.session.prevented=!0,e.preventDefault()},e}();function Qc(e,g){for(;e;){if(e===g)return!0;e=e.parentNode}return!1}function Hc(e){var g=e.length;if(1===g)return{x:Rc(e[0].clientX),y:Rc(e[0].clientY)};for(var t=0,A=0,i=0;i<g;)t+=e[i].clientX,A+=e[i].clientY,i++;return{x:Rc(t/g),y:Rc(A/g)}}function Kc(e){for(var g=[],t=0;t<e.pointers.length;)g[t]={clientX:Rc(e.pointers[t].clientX),clientY:Rc(e.pointers[t].clientY)},t++;return{timeStamp:Sc(),pointers:g,center:Hc(g),deltaX:e.deltaX,deltaY:e.deltaY}}function Xc(e,g,t){t||(t=Lc);var A=g[t[0]]-e[t[0]],i=g[t[1]]-e[t[1]];return Math.sqrt(A*A+i*i)}function Jc(e,g,t){t||(t=Lc);var A=g[t[0]]-e[t[0]],i=g[t[1]]-e[t[1]];return 180*Math.atan2(i,A)/Math.PI}function qc(e,g){return e===g?1:Pc(e)>=Pc(g)?e<0?2:4:g<0?8:16}function $c(e,g,t){return{x:g/e||0,y:t/e||0}}function eu(e,g){var t=e.session,A=g.pointers,i=A.length;t.firstInput||(t.firstInput=Kc(g)),i>1&&!t.firstMultiple?t.firstMultiple=Kc(g):1===i&&(t.firstMultiple=!1);var C=t.firstInput,I=t.firstMultiple,n=I?I.center:C.center,o=g.center=Hc(A);g.timeStamp=Sc(),g.deltaTime=g.timeStamp-C.timeStamp,g.angle=Jc(n,o),g.distance=Xc(n,o),function(e,g){var t=g.center,A=e.offsetDelta||{},i=e.prevDelta||{},C=e.prevInput||{};1!==g.eventType&&4!==C.eventType||(i=e.prevDelta={x:C.deltaX||0,y:C.deltaY||0},A=e.offsetDelta={x:t.x,y:t.y}),g.deltaX=i.x+(t.x-A.x),g.deltaY=i.y+(t.y-A.y)}(t,g),g.offsetDirection=qc(g.deltaX,g.deltaY);var r,s,a=$c(g.deltaTime,g.deltaX,g.deltaY);g.overallVelocityX=a.x,g.overallVelocityY=a.y,g.overallVelocity=Pc(a.x)>Pc(a.y)?a.x:a.y,g.scale=I?(r=I.pointers,Xc((s=A)[0],s[1],Vc)/Xc(r[0],r[1],Vc)):1,g.rotation=I?function(e,g){return Jc(g[1],g[0],Vc)+Jc(e[1],e[0],Vc)}(I.pointers,A):0,g.maxPointers=t.prevInput?g.pointers.length>t.prevInput.maxPointers?g.pointers.length:t.prevInput.maxPointers:g.pointers.length,function(e,g){var t,A,i,C,I=e.lastInterval||g,n=g.timeStamp-I.timeStamp;if(8!==g.eventType&&(n>25||void 0===I.velocity)){var o=g.deltaX-I.deltaX,r=g.deltaY-I.deltaY,s=$c(n,o,r);A=s.x,i=s.y,t=Pc(s.x)>Pc(s.y)?s.x:s.y,C=qc(o,r),e.lastInterval=g}else t=I.velocity,A=I.velocityX,i=I.velocityY,C=I.direction;g.velocity=t,g.velocityX=A,g.velocityY=i,g.direction=C}(t,g);var l,d=e.element,h=g.srcEvent;Qc(l=h.composedPath?h.composedPath()[0]:h.path?h.path[0]:h.target,d)&&(d=l),g.target=d}function gu(e,g,t){var A=t.pointers.length,i=t.changedPointers.length,C=1&g&&A-i==0,I=12&g&&A-i==0;t.isFirst=!!C,t.isFinal=!!I,C&&(e.session={}),t.eventType=g,eu(e,t),e.emit("hammer.input",t),e.recognize(t),e.session.prevInput=t}function tu(e){return e.trim().split(/\s+/g)}function Au(e,g,t){Yc(tu(g),(function(g){e.addEventListener(g,t,!1)}))}function iu(e,g,t){Yc(tu(g),(function(g){e.removeEventListener(g,t,!1)}))}function Cu(e){var g=e.ownerDocument||e;return g.defaultView||g.parentWindow||window}var Iu=function(){function e(e,g){var t=this;this.manager=e,this.callback=g,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(g){Wc(e.options.enable,[e])&&t.handler(g)},this.init()}var g=e.prototype;return g.handler=function(){},g.init=function(){this.evEl&&Au(this.element,this.evEl,this.domHandler),this.evTarget&&Au(this.target,this.evTarget,this.domHandler),this.evWin&&Au(Cu(this.element),this.evWin,this.domHandler)},g.destroy=function(){this.evEl&&iu(this.element,this.evEl,this.domHandler),this.evTarget&&iu(this.target,this.evTarget,this.domHandler),this.evWin&&iu(Cu(this.element),this.evWin,this.domHandler)},e}();function nu(e,g,t){if(e.indexOf&&!t)return e.indexOf(g);for(var A=0;A<e.length;){if(t&&e[A][t]==g||!t&&e[A]===g)return A;A++}return-1}var ou={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},ru={2:"touch",3:"pen",4:"mouse",5:"kinect"},su="pointerdown",au="pointermove pointerup pointercancel";Oc.MSPointerEvent&&!Oc.PointerEvent&&(su="MSPointerDown",au="MSPointerMove MSPointerUp MSPointerCancel");var lu=function(e){function g(){var t,A=g.prototype;return A.evEl=su,A.evWin=au,(t=e.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return xc(g,e),g.prototype.handler=function(e){var g=this.store,t=!1,A=e.type.toLowerCase().replace("ms",""),i=ou[A],C=ru[e.pointerType]||e.pointerType,I="touch"===C,n=nu(g,e.pointerId,"pointerId");1&i&&(0===e.button||I)?n<0&&(g.push(e),n=g.length-1):12&i&&(t=!0),n<0||(g[n]=e,this.callback(this.manager,i,{pointers:g,changedPointers:[e],pointerType:C,srcEvent:e}),t&&g.splice(n,1))},g}(Iu);function du(e){return Array.prototype.slice.call(e,0)}function hu(e,g,t){for(var A=[],i=[],C=0;C<e.length;){var I=g?e[C][g]:e[C];nu(i,I)<0&&A.push(e[C]),i[C]=I,C++}return t&&(A=g?A.sort((function(e,t){return e[g]>t[g]})):A.sort()),A}var cu={touchstart:1,touchmove:2,touchend:4,touchcancel:8},uu=function(e){function g(){var t;return g.prototype.evTarget="touchstart touchmove touchend touchcancel",(t=e.apply(this,arguments)||this).targetIds={},t}return xc(g,e),g.prototype.handler=function(e){var g=cu[e.type],t=pu.call(this,e,g);t&&this.callback(this.manager,g,{pointers:t[0],changedPointers:t[1],pointerType:"touch",srcEvent:e})},g}(Iu);function pu(e,g){var t,A,i=du(e.touches),C=this.targetIds;if(3&g&&1===i.length)return C[i[0].identifier]=!0,[i,i];var I=du(e.changedTouches),n=[],o=this.target;if(A=i.filter((function(e){return Qc(e.target,o)})),1===g)for(t=0;t<A.length;)C[A[t].identifier]=!0,t++;for(t=0;t<I.length;)C[I[t].identifier]&&n.push(I[t]),12&g&&delete C[I[t].identifier],t++;return n.length?[hu(A.concat(n),"identifier",!0),n]:void 0}var fu={mousedown:1,mousemove:2,mouseup:4},vu=function(e){function g(){var t,A=g.prototype;return A.evEl="mousedown",A.evWin="mousemove mouseup",(t=e.apply(this,arguments)||this).pressed=!1,t}return xc(g,e),g.prototype.handler=function(e){var g=fu[e.type];1&g&&0===e.button&&(this.pressed=!0),2&g&&1!==e.which&&(g=4),this.pressed&&(4&g&&(this.pressed=!1),this.callback(this.manager,g,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))},g}(Iu);function mu(e){var g=e.changedPointers[0];if(g.identifier===this.primaryTouch){var t={x:g.clientX,y:g.clientY},A=this.lastTouches;this.lastTouches.push(t);setTimeout((function(){var e=A.indexOf(t);e>-1&&A.splice(e,1)}),2500)}}function yu(e,g){1&e?(this.primaryTouch=g.changedPointers[0].identifier,mu.call(this,g)):12&e&&mu.call(this,g)}function bu(e){for(var g=e.srcEvent.clientX,t=e.srcEvent.clientY,A=0;A<this.lastTouches.length;A++){var i=this.lastTouches[A],C=Math.abs(g-i.x),I=Math.abs(t-i.y);if(C<=25&&I<=25)return!0}return!1}var wu=function(){return function(e){function g(g,t){var A;return(A=e.call(this,g,t)||this).handler=function(e,g,t){var i="touch"===t.pointerType,C="mouse"===t.pointerType;if(!(C&&t.sourceCapabilities&&t.sourceCapabilities.firesTouchEvents)){if(i)yu.call(Ec(Ec(A)),g,t);else if(C&&bu.call(Ec(Ec(A)),t))return;A.callback(e,g,t)}},A.touch=new uu(A.manager,A.handler),A.mouse=new vu(A.manager,A.handler),A.primaryTouch=null,A.lastTouches=[],A}return xc(g,e),g.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},g}(Iu)}();function ku(e,g,t){return!!Array.isArray(e)&&(Yc(e,t[g],t),!0)}var xu=1;function Eu(e,g){var t=g.manager;return t?t.get(e):e}function Ou(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}var Tu=function(){function e(e){void 0===e&&(e={}),this.options=kc({enable:!0},e),this.id=xu++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var g=e.prototype;return g.set=function(e){return Tc(this.options,e),this.manager&&this.manager.touchAction.update(),this},g.recognizeWith=function(e){if(ku(e,"recognizeWith",this))return this;var g=this.simultaneous;return g[(e=Eu(e,this)).id]||(g[e.id]=e,e.recognizeWith(this)),this},g.dropRecognizeWith=function(e){return ku(e,"dropRecognizeWith",this)||(e=Eu(e,this),delete this.simultaneous[e.id]),this},g.requireFailure=function(e){if(ku(e,"requireFailure",this))return this;var g=this.requireFail;return-1===nu(g,e=Eu(e,this))&&(g.push(e),e.requireFailure(this)),this},g.dropRequireFailure=function(e){if(ku(e,"dropRequireFailure",this))return this;e=Eu(e,this);var g=nu(this.requireFail,e);return g>-1&&this.requireFail.splice(g,1),this},g.hasRequireFailures=function(){return this.requireFail.length>0},g.canRecognizeWith=function(e){return!!this.simultaneous[e.id]},g.emit=function(e){var g=this,t=this.state;function A(t){g.manager.emit(t,e)}t<8&&A(g.options.event+Ou(t)),A(g.options.event),e.additionalEvent&&A(e.additionalEvent),t>=8&&A(g.options.event+Ou(t))},g.tryEmit=function(e){if(this.canEmit())return this.emit(e);this.state=32},g.canEmit=function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},g.recognize=function(e){var g=Tc({},e);if(!Wc(this.options.enable,[this,g]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(g),30&this.state&&this.tryEmit(g)},g.process=function(e){},g.getTouchAction=function(){},g.reset=function(){},e}(),Du=function(e){function g(g){var t;return void 0===g&&(g={}),(t=e.call(this,kc({event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},g))||this).pTime=!1,t.pCenter=!1,t._timer=null,t._input=null,t.count=0,t}xc(g,e);var t=g.prototype;return t.getTouchAction=function(){return["manipulation"]},t.process=function(e){var g=this,t=this.options,A=e.pointers.length===t.pointers,i=e.distance<t.threshold,C=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(i&&C&&A){if(4!==e.eventType)return this.failTimeout();var I=!this.pTime||e.timeStamp-this.pTime<t.interval,n=!this.pCenter||Xc(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,n&&I?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=setTimeout((function(){g.state=8,g.tryEmit()}),t.interval),2):8}return 32},t.failTimeout=function(){var e=this;return this._timer=setTimeout((function(){e.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))},g}(Tu),Nu=function(e){function g(g){return void 0===g&&(g={}),e.call(this,kc({pointers:1},g))||this}xc(g,e);var t=g.prototype;return t.attrTest=function(e){var g=this.options.pointers;return 0===g||e.pointers.length===g},t.process=function(e){var g=this.state,t=e.eventType,A=6&g,i=this.attrTest(e);return A&&(8&t||!i)?16|g:A||i?4&t?8|g:2&g?4|g:2:32},g}(Tu);function Ru(e){return 16===e?"down":8===e?"up":2===e?"left":4===e?"right":""}var Pu=function(e){function g(g){var t;return void 0===g&&(g={}),(t=e.call(this,kc({event:"pan",threshold:10,pointers:1,direction:30},g))||this).pX=null,t.pY=null,t}xc(g,e);var t=g.prototype;return t.getTouchAction=function(){var e=this.options.direction,g=[];return 6&e&&g.push("pan-y"),24&e&&g.push("pan-x"),g},t.directionTest=function(e){var g=this.options,t=!0,A=e.distance,i=e.direction,C=e.deltaX,I=e.deltaY;return i&g.direction||(6&g.direction?(i=0===C?1:C<0?2:4,t=C!==this.pX,A=Math.abs(e.deltaX)):(i=0===I?1:I<0?8:16,t=I!==this.pY,A=Math.abs(e.deltaY))),e.direction=i,t&&A>g.threshold&&i&g.direction},t.attrTest=function(e){return Nu.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},t.emit=function(g){this.pX=g.deltaX,this.pY=g.deltaY;var t=Ru(g.direction);t&&(g.additionalEvent=this.options.event+t),e.prototype.emit.call(this,g)},g}(Nu),Su=function(e){function g(g){return void 0===g&&(g={}),e.call(this,kc({event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},g))||this}xc(g,e);var t=g.prototype;return t.getTouchAction=function(){return Pu.prototype.getTouchAction.call(this)},t.attrTest=function(g){var t,A=this.options.direction;return 30&A?t=g.overallVelocity:6&A?t=g.overallVelocityX:24&A&&(t=g.overallVelocityY),e.prototype.attrTest.call(this,g)&&A&g.offsetDirection&&g.distance>this.options.threshold&&g.maxPointers===this.options.pointers&&Pc(t)>this.options.velocity&&4&g.eventType},t.emit=function(e){var g=Ru(e.offsetDirection);g&&this.manager.emit(this.options.event+g,e),this.manager.emit(this.options.event,e)},g}(Nu),Mu=function(e){function g(g){return void 0===g&&(g={}),e.call(this,kc({event:"pinch",threshold:0,pointers:2},g))||this}xc(g,e);var t=g.prototype;return t.getTouchAction=function(){return["none"]},t.attrTest=function(g){return e.prototype.attrTest.call(this,g)&&(Math.abs(g.scale-1)>this.options.threshold||2&this.state)},t.emit=function(g){if(1!==g.scale){var t=g.scale<1?"in":"out";g.additionalEvent=this.options.event+t}e.prototype.emit.call(this,g)},g}(Nu),Bu=function(e){function g(g){return void 0===g&&(g={}),e.call(this,kc({event:"rotate",threshold:0,pointers:2},g))||this}xc(g,e);var t=g.prototype;return t.getTouchAction=function(){return["none"]},t.attrTest=function(g){return e.prototype.attrTest.call(this,g)&&(Math.abs(g.rotation)>this.options.threshold||2&this.state)},g}(Nu),zu=function(e){function g(g){var t;return void 0===g&&(g={}),(t=e.call(this,kc({event:"press",pointers:1,time:251,threshold:9},g))||this)._timer=null,t._input=null,t}xc(g,e);var t=g.prototype;return t.getTouchAction=function(){return["auto"]},t.process=function(e){var g=this,t=this.options,A=e.pointers.length===t.pointers,i=e.distance<t.threshold,C=e.deltaTime>t.time;if(this._input=e,!i||!A||12&e.eventType&&!C)this.reset();else if(1&e.eventType)this.reset(),this._timer=setTimeout((function(){g.state=8,g.tryEmit()}),t.time);else if(4&e.eventType)return 8;return 32},t.reset=function(){clearTimeout(this._timer)},t.emit=function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=Sc(),this.manager.emit(this.options.event,this._input)))},g}(Tu),Fu={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)"}},Zu=[[Bu,{enable:!1}],[Mu,{enable:!1},["rotate"]],[Su,{direction:6}],[Pu,{direction:6},["swipe"]],[Du],[Du,{event:"doubletap",taps:2},["tap"]],[zu]];function ju(e,g){var t,A=e.element;A.style&&(Yc(e.options.cssProps,(function(i,C){t=Mc(A.style,C),g?(e.oldCssProps[t]=A.style[t],A.style[t]=i):A.style[t]=e.oldCssProps[t]||""})),g||(e.oldCssProps={}))}var Gu=function(){function e(e,g){var t,A=this;this.options=Tc({},Fu,g||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((t=this).options.inputClass||(jc?lu:Gc?uu:Zc?wu:vu))(t,gu),this.touchAction=new Uc(this,this.options.touchAction),ju(this,!0),Yc(this.options.recognizers,(function(e){var g=A.add(new e[0](e[1]));e[2]&&g.recognizeWith(e[2]),e[3]&&g.requireFailure(e[3])}),this)}var g=e.prototype;return g.set=function(e){return Tc(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},g.stop=function(e){this.session.stopped=e?2:1},g.recognize=function(e){var g=this.session;if(!g.stopped){var t;this.touchAction.preventDefaults(e);var A=this.recognizers,i=g.curRecognizer;(!i||i&&8&i.state)&&(g.curRecognizer=null,i=null);for(var C=0;C<A.length;)t=A[C],2===g.stopped||i&&t!==i&&!t.canRecognizeWith(i)?t.reset():t.recognize(e),!i&&14&t.state&&(g.curRecognizer=t,i=t),C++}},g.get=function(e){if(e instanceof Tu)return e;for(var g=this.recognizers,t=0;t<g.length;t++)if(g[t].options.event===e)return g[t];return null},g.add=function(e){if(ku(e,"add",this))return this;var g=this.get(e.options.event);return g&&this.remove(g),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},g.remove=function(e){if(ku(e,"remove",this))return this;var g=this.get(e);if(e){var t=this.recognizers,A=nu(t,g);-1!==A&&(t.splice(A,1),this.touchAction.update())}return this},g.on=function(e,g){if(void 0===e||void 0===g)return this;var t=this.handlers;return Yc(tu(e),(function(e){t[e]=t[e]||[],t[e].push(g)})),this},g.off=function(e,g){if(void 0===e)return this;var t=this.handlers;return Yc(tu(e),(function(e){g?t[e]&&t[e].splice(nu(t[e],g),1):delete t[e]})),this},g.emit=function(e,g){this.options.domEvents&&function(e,g){var t=document.createEvent("Event");t.initEvent(e,!0,!0),t.gesture=g,g.target.dispatchEvent(t)}(e,g);var t=this.handlers[e]&&this.handlers[e].slice();if(t&&t.length){g.type=e,g.preventDefault=function(){g.srcEvent.preventDefault()};for(var A=0;A<t.length;)t[A](g),A++}},g.destroy=function(){this.element&&ju(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},e}(),Lu={touchstart:1,touchmove:2,touchend:4,touchcancel:8},Vu=function(e){function g(){var t,A=g.prototype;return A.evTarget="touchstart",A.evWin="touchstart touchmove touchend touchcancel",(t=e.apply(this,arguments)||this).started=!1,t}return xc(g,e),g.prototype.handler=function(e){var g=Lu[e.type];if(1===g&&(this.started=!0),this.started){var t=Yu.call(this,e,g);12&g&&t[0].length-t[1].length==0&&(this.started=!1),this.callback(this.manager,g,{pointers:t[0],changedPointers:t[1],pointerType:"touch",srcEvent:e})}},g}(Iu);function Yu(e,g){var t=du(e.touches),A=du(e.changedTouches);return 12&g&&(t=hu(t.concat(A),"identifier",!0)),[t,A]}function Wu(e,g,t){var A="DEPRECATED METHOD: "+g+"\n"+t+" AT \n";return function(){var g=new Error("get-stack-trace"),t=g&&g.stack?g.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",i=window.console&&(window.console.warn||window.console.log);return i&&i.call(window.console,A,t),e.apply(this,arguments)}}var _u=Wu((function(e,g,t){for(var A=Object.keys(g),i=0;i<A.length;)(!t||t&&void 0===e[A[i]])&&(e[A[i]]=g[A[i]]),i++;return e}),"extend","Use `assign`."),Uu=Wu((function(e,g){return _u(e,g,!0)}),"merge","Use `assign`.");function Qu(e,g,t){var A,i=g.prototype;(A=e.prototype=Object.create(i)).constructor=e,A._super=i,t&&Tc(A,t)}function Hu(e,g){return function(){return e.apply(g,arguments)}}var Ku=function(){var e=function(e,g){return void 0===g&&(g={}),new Gu(e,kc({recognizers:Zu.concat()},g))};return e.VERSION="2.0.17-rc",e.DIRECTION_ALL=30,e.DIRECTION_DOWN=16,e.DIRECTION_LEFT=2,e.DIRECTION_RIGHT=4,e.DIRECTION_UP=8,e.DIRECTION_HORIZONTAL=6,e.DIRECTION_VERTICAL=24,e.DIRECTION_NONE=1,e.DIRECTION_DOWN=16,e.INPUT_START=1,e.INPUT_MOVE=2,e.INPUT_END=4,e.INPUT_CANCEL=8,e.STATE_POSSIBLE=1,e.STATE_BEGAN=2,e.STATE_CHANGED=4,e.STATE_ENDED=8,e.STATE_RECOGNIZED=8,e.STATE_CANCELLED=16,e.STATE_FAILED=32,e.Manager=Gu,e.Input=Iu,e.TouchAction=Uc,e.TouchInput=uu,e.MouseInput=vu,e.PointerEventInput=lu,e.TouchMouseInput=wu,e.SingleTouchInput=Vu,e.Recognizer=Tu,e.AttrRecognizer=Nu,e.Tap=Du,e.Pan=Pu,e.Swipe=Su,e.Pinch=Mu,e.Rotate=Bu,e.Press=zu,e.on=Au,e.off=iu,e.each=Yc,e.merge=Uu,e.extend=_u,e.bindFn=Hu,e.assign=Tc,e.inherit=Qu,e.bindFn=Hu,e.prefixed=Mc,e.toArray=du,e.inArray=nu,e.uniqueArray=hu,e.splitStr=tu,e.boolOrFn=Wc,e.hasParent=Qc,e.addEventListeners=Au,e.removeEventListeners=iu,e.defaults=Tc({},Fu,{preset:Zu}),e}();function Xu(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return Ju(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return Ju(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function Ju(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}var qu=nl("DELETE");function $u(){var e=ep.apply(void 0,arguments);return tp(e),e}function ep(){for(var e=arguments.length,g=new Array(e),t=0;t<e;t++)g[t]=arguments[t];if(g.length<2)return g[0];var A;if(g.length>2)return ep.apply(void 0,ll(A=[$u(g[0],g[1])]).call(A,Il(dl(g).call(g,2))));var i,C=g[0],I=g[1],n=Xu(hl(I));try{for(n.s();!(i=n.n()).done;){var o=i.value;Object.prototype.propertyIsEnumerable.call(I,o)&&(I[o]===qu?delete C[o]:null===C[o]||null===I[o]||"object"!==Cl(C[o])||"object"!==Cl(I[o])||cl(C[o])||cl(I[o])?C[o]=gp(I[o]):C[o]=ep(C[o],I[o]))}}catch(e){n.e(e)}finally{n.f()}return C}function gp(e){return cl(e)?yl(e).call(e,(function(e){return gp(e)})):"object"===Cl(e)&&null!==e?ep({},e):e}function tp(e){for(var g=0,t=kl(e);g<t.length;g++){var A=t[g];e[A]===qu?delete e[A]:"object"===Cl(e[A])&&null!==e[A]&&tp(e[A])}}function Ap(){for(var e=arguments.length,g=new Array(e),t=0;t<e;t++)g[t]=arguments[t];return ip(g.length?g:[Dl()])}function ip(e){var g=tl(function(){for(var e=Cp(),g=e(" "),t=e(" "),A=e(" "),i=0;i<arguments.length;i++)(g-=e(i<0||arguments.length<=i?void 0:arguments[i]))<0&&(g+=1),(t-=e(i<0||arguments.length<=i?void 0:arguments[i]))<0&&(t+=1),(A-=e(i<0||arguments.length<=i?void 0:arguments[i]))<0&&(A+=1);return[g,t,A]}(e),3),t=g[0],A=g[1],i=g[2],C=1,I=function(){var e=2091639*t+2.3283064365386963e-10*C;return t=A,A=i,i=e-(C=0|e)};return I.uint32=function(){return 4294967296*I()},I.fract53=function(){return I()+11102230246251565e-32*(2097152*I()|0)},I.algorithm="Alea",I.seed=e,I.version="0.9",I}function Cp(){var e=4022871197;return function(g){for(var t=g.toString(),A=0;A<t.length;A++){var i=.02519603282416938*(e+=t.charCodeAt(A));i-=e=i>>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)}}var Ip="undefined"!=typeof window?window.Hammer||Ku:function(){return function(){var e=function(){};return{on:e,off:e,destroy:e,emit:e,get:function(){return{set:e}}}}()};function np(e){var g,t=this;this._cleanupQueue=[],this.active=!1,this._dom={container:e,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=Ip(this._dom.overlay);A.on("tap",JA(g=this._onTapOverlay).call(g,this)),this._cleanupQueue.push((function(){A.destroy()}));var i=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];Ll(i).call(i,(function(e){A.on(e,(function(e){e.srcEvent.stopPropagation()}))})),document&&document.body&&(this._onClick=function(g){(function(e,g){for(;e;){if(e===g)return!0;e=e.parentNode}return!1})(g.target,e)||t.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push((function(){document.body.removeEventListener("click",t._onClick)}))),this._escListener=function(e){("key"in e?"Escape"===e.key:27===e.keyCode)&&t.deactivate()}}Ii(np.prototype),np.current=null,np.prototype.destroy=function(){var e,g;this.deactivate();var t,A=Xu(Xl(e=dd(g=this._cleanupQueue).call(g,0)).call(e));try{for(A.s();!(t=A.n()).done;){(0,t.value)()}}catch(e){A.e(e)}finally{A.f()}},np.prototype.activate=function(){np.current&&np.current.deactivate(),np.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)},np.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")},np.prototype._onTapOverlay=function(e){this.activate(),e.srcEvent.stopPropagation()};var op=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,rp=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,sp=/^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,ap=/^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 lp(e){if(e)for(;!0===e.hasChildNodes();){var g=e.firstChild;g&&(lp(g),e.removeChild(g))}}function dp(e){return e instanceof String||"string"==typeof e}function hp(e){return"object"===Cl(e)&&null!==e}function cp(e,g,t,A){var i=!1;!0===A&&(i=null===g[t]&&void 0!==e[t]),i?delete e[t]:e[t]=g[t]}function up(e,g){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var A in e)if(void 0!==g[A])if(null===g[A]||"object"!==Cl(g[A]))cp(e,g,A,t);else{var i=e[A],C=g[A];hp(i)&&hp(C)&&up(i,C,t)}}function pp(e,g,t){var A=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(cl(t))throw new TypeError("Arrays are not supported by deepExtend");for(var i=0;i<e.length;i++){var C=e[i];if(Object.prototype.hasOwnProperty.call(t,C))if(t[C]&&t[C].constructor===Object)void 0===g[C]&&(g[C]={}),g[C].constructor===Object?vp(g[C],t[C],!1,A):cp(g,t,C,A);else{if(cl(t[C]))throw new TypeError("Arrays are not supported by deepExtend");cp(g,t,C,A)}}return g}function fp(e,g,t){var A=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(cl(t))throw new TypeError("Arrays are not supported by deepExtend");for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&!Md(e).call(e,i))if(t[i]&&t[i].constructor===Object)void 0===g[i]&&(g[i]={}),g[i].constructor===Object?vp(g[i],t[i]):cp(g,t,i,A);else if(cl(t[i])){g[i]=[];for(var C=0;C<t[i].length;C++)g[i].push(t[i][C])}else cp(g,t,i,A);return g}function vp(e,g){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var i in g)if(Object.prototype.hasOwnProperty.call(g,i)||!0===t)if("object"===Cl(g[i])&&null!==g[i]&&jd(g[i])===Object.prototype)void 0===e[i]?e[i]=vp({},g[i],t):"object"===Cl(e[i])&&null!==e[i]&&jd(e[i])===Object.prototype?vp(e[i],g[i],t):cp(e,g,i,A);else if(cl(g[i])){var C;e[i]=dl(C=g[i]).call(C)}else cp(e,g,i,A);return e}function mp(e,g){var t;return ll(t=[]).call(t,Il(e),[g])}function yp(e){return dl(e).call(e)}function bp(e){return e.getBoundingClientRect().top}function wp(e,g){if(cl(e))for(var t=e.length,A=0;A<t;A++)g(e[A],A,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&g(e[i],i,e)}function kp(e){var g;switch(e.length){case 3:case 4:return(g=rp.exec(e))?{r:mh(g[1]+g[1],16),g:mh(g[2]+g[2],16),b:mh(g[3]+g[3],16)}:null;case 6:case 7:return(g=op.exec(e))?{r:mh(g[1],16),g:mh(g[2],16),b:mh(g[3],16)}:null;default:return null}}function xp(e,g){if(Md(e).call(e,"rgba"))return e;if(Md(e).call(e,"rgb")){var t=e.substr(Rh(e).call(e,"(")+1).replace(")","").split(",");return"rgba("+t[0]+","+t[1]+","+t[2]+","+g+")"}var A=kp(e);return null==A?e:"rgba("+A.r+","+A.g+","+A.b+","+g+")"}function Ep(e,g,t){var A;return"#"+dl(A=((1<<24)+(e<<16)+(g<<8)+t).toString(16)).call(A,1)}function Op(e,g){if(dp(e)){var t=e;if(Pp(t)){var A,i=yl(A=t.substr(4).substr(0,t.length-5).split(",")).call(A,(function(e){return mh(e)}));t=Ep(i[0],i[1],i[2])}if(!0===Rp(t)){var C=function(e){var g=kp(e);if(!g)throw new TypeError("'".concat(e,"' is not a valid color."));return Tp(g.r,g.g,g.b)}(t),I={h:C.h,s:.8*C.s,v:Math.min(1,1.02*C.v)},n={h:C.h,s:Math.min(1,1.25*C.s),v:.8*C.v},o=Np(n.h,n.s,n.v),r=Np(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 g?{background:e.background||g.background,border:e.border||g.border,highlight:dp(e.highlight)?{border:e.highlight,background:e.highlight}:{background:e.highlight&&e.highlight.background||g.highlight.background,border:e.highlight&&e.highlight.border||g.highlight.border},hover:dp(e.hover)?{border:e.hover,background:e.hover}:{border:e.hover&&e.hover.border||g.hover.border,background:e.hover&&e.hover.background||g.hover.background}}:{background:e.background||void 0,border:e.border||void 0,highlight:dp(e.highlight)?{border:e.highlight,background:e.highlight}:{background:e.highlight&&e.highlight.background||void 0,border:e.highlight&&e.highlight.border||void 0},hover:dp(e.hover)?{border:e.hover,background:e.hover}:{border:e.hover&&e.hover.border||void 0,background:e.hover&&e.hover.background||void 0}}}function Tp(e,g,t){e/=255,g/=255,t/=255;var A=Math.min(e,Math.min(g,t)),i=Math.max(e,Math.max(g,t));return A===i?{h:0,s:0,v:A}:{h:60*((e===A?3:t===A?1:5)-(e===A?g-t:t===A?e-g:t-e)/(i-A))/360,s:(i-A)/i,v:i}}function Dp(e,g,t){var A,i,C,I=Math.floor(6*e),n=6*e-I,o=t*(1-g),r=t*(1-n*g),s=t*(1-(1-n)*g);switch(I%6){case 0:A=t,i=s,C=o;break;case 1:A=r,i=t,C=o;break;case 2:A=o,i=t,C=s;break;case 3:A=o,i=r,C=t;break;case 4:A=s,i=o,C=t;break;case 5:A=t,i=o,C=r}return{r:Math.floor(255*A),g:Math.floor(255*i),b:Math.floor(255*C)}}function Np(e,g,t){var A=Dp(e,g,t);return Ep(A.r,A.g,A.b)}function Rp(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)}function Pp(e){return sp.test(e)}function Sp(e){return ap.test(e)}function Mp(e){if(null===e||"object"!==Cl(e))return null;if(e instanceof Element)return e;var g=Zh(e);for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&"object"==Cl(e[t])&&(g[t]=Mp(e[t]));return g}function Bp(e,g,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=function(e){return null!=e},C=function(e){return null!==e&&"object"===Cl(e)},I=function(e){for(var g in e)if(Object.prototype.hasOwnProperty.call(e,g))return!1;return!0};if(!C(e))throw new Error("Parameter mergeTarget must be an object");if(!C(g))throw new Error("Parameter options must be an object");if(!i(t))throw new Error("Parameter option must have a value");if(!C(A))throw new Error("Parameter globalOptions must be an object");var n=function(e,g,t){C(e[t])||(e[t]={});var A=g[t],i=e[t];for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&(i[I]=A[I])},o=g[t],r=C(A)&&!I(A),s=r?A[t]:void 0,a=s?s.enabled:void 0;if(void 0!==o){if("boolean"==typeof o)return C(e[t])||(e[t]={}),void(e[t].enabled=o);if(null===o&&!C(e[t])){if(!i(s))return;e[t]=Zh(s)}if(C(o)){var l=!0;void 0!==o.enabled?l=o.enabled:void 0!==a&&(l=s.enabled),n(e,g,t),e[t].enabled=l}}}var zp={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}};function Fp(e,g){var t;cl(g)||(g=[g]);var A,i=Xu(e);try{for(i.s();!(A=i.n()).done;){var C=A.value;if(C){t=C[g[0]];for(var I=1;I<g.length;I++)t&&(t=t[g[I]]);if(void 0!==t)break}}}catch(e){i.e(e)}finally{i.f()}return t}var Zp={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"},jp=function(){function e(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;ta(this,e),this.pixelRatio=g,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 Ca(e,[{key:"insertTo",value:function(e){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=e}},{key:"setCloseCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=e}},{key:"_isColorString",value:function(e){if("string"==typeof e)return Zp[e]}},{key:"setColor",value:function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==e){var t,A=this._isColorString(e);if(void 0!==A&&(e=A),!0===dp(e)){if(!0===Pp(e)){var i=e.substr(4).substr(0,e.length-5).split(",");t={r:i[0],g:i[1],b:i[2],a:1}}else if(!0===Sp(e)){var C=e.substr(5).substr(0,e.length-6).split(",");t={r:C[0],g:C[1],b:C[2],a:C[3]}}else if(!0===Rp(e)){var I=kp(e);t={r:I.r,g:I.g,b:I.b,a:1}}}else if(e instanceof Object&&void 0!==e.r&&void 0!==e.g&&void 0!==e.b){var n=void 0!==e.a?e.a:"1.0";t={r:e.r,g:e.g,b:e.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: "+ic(e));this._setColor(t,g)}}},{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 e=this,g=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===g&&(this.previousColor=NA({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",cc((function(){void 0!==e.closeCallback&&(e.closeCallback(),e.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(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!0===g&&(this.initialColor=NA({},e)),this.color=e;var t=Tp(e.r,e.g,e.b),A=2*Math.PI,i=this.r*t.s,C=this.centerCoordinates.x+i*Math.sin(A*t.h),I=this.centerCoordinates.y+i*Math.cos(A*t.h);this.colorPickerSelector.style.left=C-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=I-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var g=Tp(this.color.r,this.color.g,this.color.b);g.v=e/100;var t=Dp(g.h,g.s,g.v);t.a=this.color.a,this.color=t,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,g=Tp(e.r,e.g,e.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,i=this.colorPickerCanvas.clientHeight;t.clearRect(0,0,A,i),t.putImageData(this.hueCircle,0,0),t.fillStyle="rgba(0,0,0,"+(1-g.v)+")",t.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),wc(t).call(t),this.brightnessRange.value=100*g.v,this.opacityRange.value=100*e.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 e,g,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 i=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var C=document.createElement("DIV");C.style.color="red",C.style.fontWeight="bold",C.style.padding="10px",C.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(C)}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(e){}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(e){}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=JA(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=JA(g=this._apply).call(g,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=JA(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=JA(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 e=this;this.drag={},this.pinch={},this.hammer=new Ip(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",(function(g){g.isFirst&&e._moveSelector(g)})),this.hammer.on("tap",(function(g){e._moveSelector(g)})),this.hammer.on("panstart",(function(g){e._moveSelector(g)})),this.hammer.on("panmove",(function(g){e._moveSelector(g)})),this.hammer.on("panend",(function(g){e._moveSelector(g)}))}},{key:"_generateHueCircle",value:function(){if(!1===this.generated){var e=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var g,t,A,i,C=this.colorPickerCanvas.clientWidth,I=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,C,I),this.centerCoordinates={x:.5*C,y:.5*I},this.r=.49*C;var n,o=2*Math.PI/360,r=1/this.r;for(A=0;A<360;A++)for(i=0;i<this.r;i++)g=this.centerCoordinates.x+i*Math.sin(o*A),t=this.centerCoordinates.y+i*Math.cos(o*A),n=Dp(.002777777777777778*A,i*r,1),e.fillStyle="rgb("+n.r+","+n.g+","+n.b+")",e.fillRect(g-.5,t-.5,2,2);e.strokeStyle="rgba(0,0,0,1)",e.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),e.stroke(),this.hueCircle=e.getImageData(0,0,C,I)}this.generated=!0}},{key:"_moveSelector",value:function(e){var g=this.colorPickerDiv.getBoundingClientRect(),t=e.center.x-g.left,A=e.center.y-g.top,i=.5*this.colorPickerDiv.clientHeight,C=.5*this.colorPickerDiv.clientWidth,I=t-C,n=A-i,o=Math.atan2(I,n),r=.98*Math.min(Math.sqrt(I*I+n*n),C),s=Math.cos(o)*r+i,a=Math.sin(o)*r+C;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=Tp(this.color.r,this.color.g,this.color.b);h.h=l,h.s=d;var c=Dp(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+")"}}]),e}();function Gp(){for(var e=arguments.length,g=new Array(e),t=0;t<e;t++)g[t]=arguments[t];if(g.length<1)throw new TypeError("Invalid arguments.");if(1===g.length)return document.createTextNode(g[0]);var A=document.createElement(g[0]);return A.appendChild(Gp.apply(void 0,Il(dl(g).call(g,1)))),A}var Lp,Vp=!1,Yp=np,Wp=function(){function e(g,t,A){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,C=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){return!1};ta(this,e),this.parent=g,this.changedOptions=[],this.container=t,this.allowCreation=!1,this.hideOption=C,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},NA(this.options,this.defaultOptions),this.configureOptions=A,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new jp(i),this.wrapper=void 0}return Ca(e,[{key:"setOptions",value:function(e){if(void 0!==e){this.popupHistory={},this._removePopup();var g=!0;if("string"==typeof e)this.options.filter=e;else if(cl(e))this.options.filter=e.join();else if("object"===Cl(e)){if(null==e)throw new TypeError("options cannot be null");void 0!==e.container&&(this.options.container=e.container),void 0!==_d(e)&&(this.options.filter=_d(e)),void 0!==e.showButton&&(this.options.showButton=e.showButton),void 0!==e.enabled&&(g=e.enabled)}else"boolean"==typeof e?(this.options.filter=!0,g=e):"function"==typeof e&&(this.options.filter=e,g=!0);!1===_d(this.options)&&(g=!1),this.options.enabled=g}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,!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 e=_d(this.options),g=0,t=!1;for(var A in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,A)&&(this.allowCreation=!1,t=!1,"function"==typeof e?t=(t=e(A,[]))||this._handleObject(this.configureOptions[A],[A],!0):!0!==e&&-1===Rh(e).call(e,A)||(t=!0),!1!==t&&(this.allowCreation=!0,g>0&&this._makeItem([]),this._makeHeader(A),this._handleObject(this.configureOptions[A],[A])),g++);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 e=0;e<this.domElements.length;e++)this.wrapper.appendChild(this.domElements[e]);this._showPopupIfNeeded()}},{key:"_clean",value:function(){for(var e=0;e<this.domElements.length;e++)this.wrapper.removeChild(this.domElements[e]);void 0!==this.wrapper&&(this.container.removeChild(this.wrapper),this.wrapper=void 0),this.domElements=[],this._removePopup()}},{key:"_getValue",value:function(e){for(var g=this.moduleOptions,t=0;t<e.length;t++){if(void 0===g[e[t]]){g=void 0;break}g=g[e[t]]}return g}},{key:"_makeItem",value:function(e){if(!0===this.allowCreation){var g=document.createElement("div");g.className="vis-configuration vis-config-item vis-config-s"+e.length;for(var t=arguments.length,A=new Array(t>1?t-1:0),i=1;i<t;i++)A[i-1]=arguments[i];return Ll(A).call(A,(function(e){g.appendChild(e)})),this.domElements.push(g),this.domElements.length}return 0}},{key:"_makeHeader",value:function(e){var g=document.createElement("div");g.className="vis-configuration vis-config-header",g.innerText=e,this._makeItem([],g)}},{key:"_makeLabel",value:function(e,g){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"+g.length,!0===t){for(;A.firstChild;)A.removeChild(A.firstChild);A.appendChild(Gp("i","b",e))}else A.innerText=e+":";return A}},{key:"_makeDropdown",value:function(e,g,t){var A=document.createElement("select");A.className="vis-configuration vis-config-select";var i=0;void 0!==g&&-1!==Rh(e).call(e,g)&&(i=Rh(e).call(e,g));for(var C=0;C<e.length;C++){var I=document.createElement("option");I.value=e[C],C===i&&(I.selected="selected"),I.innerText=e[C],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(e,g,t){var A=e[0],i=e[1],C=e[2],I=e[3],n=document.createElement("input");n.className="vis-configuration vis-config-range";try{n.type="range",n.min=i,n.max=C}catch(e){}n.step=I;var o="",r=0;if(void 0!==g){var s=1.2;g<0&&g*s<i?(n.min=Math.ceil(g*s),r=n.min,o="range increased"):g/s<i&&(n.min=Math.ceil(g/s),r=n.min,o="range increased"),g*s>C&&1!==C&&(n.max=Math.ceil(g*s),r=n.max,o="range increased"),n.value=g}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 e=this;if(!0===this.options.showButton){var g=document.createElement("div");g.className="vis-configuration vis-config-button",g.innerText="generate options",g.onclick=function(){e._printOptions()},g.onmouseover=function(){g.className="vis-configuration vis-config-button hover"},g.onmouseout=function(){g.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(g)}}},{key:"_setupPopup",value:function(e,g){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=e,A.onclick=function(){t._removePopup()},this.popupCounter+=1,this.popupDiv={html:A,index:g}}}},{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 e=this;if(void 0!==this.popupDiv.html){var g=this.domElements[this.popupDiv.index].getBoundingClientRect();this.popupDiv.html.style.left=g.left+"px",this.popupDiv.html.style.top=g.top-30+"px",document.body.appendChild(this.popupDiv.html),this.popupDiv.hideTimeout=cc((function(){e.popupDiv.html.style.opacity=0}),1500),this.popupDiv.deleteTimeout=cc((function(){e._removePopup()}),1800)}}},{key:"_makeCheckbox",value:function(e,g,t){var A=document.createElement("input");A.type="checkbox",A.className="vis-configuration vis-config-checkbox",A.checked=e,void 0!==g&&(A.checked=g,g!==e&&("object"===Cl(e)?g!==e.enabled&&this.changedOptions.push({path:t,value:g}):this.changedOptions.push({path:t,value:g})));var i=this;A.onchange=function(){i._update(this.checked,t)};var C=this._makeLabel(t[t.length-1],t);this._makeItem(t,C,A)}},{key:"_makeTextInput",value:function(e,g,t){var A=document.createElement("input");A.type="text",A.className="vis-configuration vis-config-text",A.value=g,g!==e&&this.changedOptions.push({path:t,value:g});var i=this;A.onchange=function(){i._update(this.value,t)};var C=this._makeLabel(t[t.length-1],t);this._makeItem(t,C,A)}},{key:"_makeColorField",value:function(e,g,t){var A=this,i=e[1],C=document.createElement("div");"none"!==(g=void 0===g?i:g)?(C.className="vis-configuration vis-config-colorBlock",C.style.backgroundColor=g):C.className="vis-configuration vis-config-colorBlock none",g=void 0===g?i:g,C.onclick=function(){A._showColorPicker(g,C,t)};var I=this._makeLabel(t[t.length-1],t);this._makeItem(t,I,C)}},{key:"_showColorPicker",value:function(e,g,t){var A=this;g.onclick=function(){},this.colorPicker.insertTo(g),this.colorPicker.show(),this.colorPicker.setColor(e),this.colorPicker.setUpdateCallback((function(e){var i="rgba("+e.r+","+e.g+","+e.b+","+e.a+")";g.style.backgroundColor=i,A._update(i,t)})),this.colorPicker.setCloseCallback((function(){g.onclick=function(){A._showColorPicker(e,g,t)}}))}},{key:"_handleObject",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=!1,i=_d(this.options),C=!1;for(var I in e)if(Object.prototype.hasOwnProperty.call(e,I)){A=!0;var n=e[I],o=mp(g,I);if("function"==typeof i&&!1===(A=i(I,g))&&!cl(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){C=!0;var r=this._getValue(o);if(cl(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(g,I,this.moduleOptions))if(void 0!==n.enabled){var s=mp(o,"enabled"),a=this._getValue(s);if(!0===a){var l=this._makeLabel(I,o,!0);this._makeItem(o,l),C=this._handleObject(n,o)||C}else this._makeCheckbox(n,a,o)}else{var d=this._makeLabel(I,o,!0);this._makeItem(o,d),C=this._handleObject(n,o)||C}}else console.error("dont know how to handle",n,I,o)}}return C}},{key:"_handleArray",value:function(e,g,t){"string"==typeof e[0]&&"color"===e[0]?(this._makeColorField(e,g,t),e[1]!==g&&this.changedOptions.push({path:t,value:g})):"string"==typeof e[0]?(this._makeDropdown(e,g,t),e[0]!==g&&this.changedOptions.push({path:t,value:g})):"number"==typeof e[0]&&(this._makeRange(e,g,t),e[0]!==g&&this.changedOptions.push({path:t,value:Number(g)}))}},{key:"_update",value:function(e,g){var t=this._constructOptions(e,g);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(e,g){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},A=t;e="false"!==(e="true"===e||e)&&e;for(var i=0;i<g.length;i++)"global"!==g[i]&&(void 0===A[g[i]]&&(A[g[i]]={}),i!==g.length-1?A=A[g[i]]:A[g[i]]=e);return t}},{key:"_printOptions",value:function(){for(var e=this.getOptions();this.optionsContainer.firstChild;)this.optionsContainer.removeChild(this.optionsContainer.firstChild);this.optionsContainer.appendChild(Gp("pre","const options = "+ic(e,null,2)))}},{key:"getOptions",value:function(){for(var e={},g=0;g<this.changedOptions.length;g++)this._constructOptions(this.changedOptions[g].value,this.changedOptions[g].path,e);return e}}]),e}(),_p=Ip,Up=function(){function e(g,t){ta(this,e),this.container=g,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 Ca(e,[{key:"setPosition",value:function(e,g){this.x=mh(e),this.y=mh(g)}},{key:"setText",value:function(e){if(e instanceof Element){for(;this.frame.firstChild;)this.frame.removeChild(this.frame.firstChild);this.frame.appendChild(e)}else this.frame.innerText=e}},{key:"show",value:function(e){if(void 0===e&&(e=!0),!0===e){var g=this.frame.clientHeight,t=this.frame.clientWidth,A=this.frame.parentNode.clientHeight,i=this.frame.parentNode.clientWidth,C=0,I=0;if("flip"==this.overflowMethod){var n=!1,o=!0;this.y-g<this.padding&&(o=!1),this.x+t>i-this.padding&&(n=!0),C=n?this.x-t:this.x,I=o?this.y-g:this.y}else(I=this.y-g)+g+this.padding>A&&(I=A-g-this.padding),I<this.padding&&(I=this.padding),(C=this.x)+t+this.padding>i&&(C=i-t-this.padding),C<this.padding&&(C=this.padding);this.frame.style.left=C+"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)}}]),e}(),Qp=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"validate",value:function(g,t,A){Vp=!1,Lp=t;var i=t;return void 0!==A&&(i=t[A]),e.parse(g,i,[]),Vp}},{key:"parse",value:function(g,t,A){for(var i in g)Object.prototype.hasOwnProperty.call(g,i)&&e.check(i,g,t,A)}},{key:"check",value:function(g,t,A,i){if(void 0!==A[g]||void 0!==A.__any__){var C=g,I=!0;void 0===A[g]&&void 0!==A.__any__&&(C="__any__",I="object"===e.getType(t[g]));var n=A[C];I&&void 0!==n.__type__&&(n=n.__type__),e.checkFields(g,t,A,C,n,i)}else e.getSuggestion(g,A,i)}},{key:"checkFields",value:function(g,t,A,i,C,I){var n=function(t){console.error("%c"+t+e.printLocation(I,g),"background: #FFeeee; color: #dd0000")},o=e.getType(t[g]),r=C[o];void 0!==r?"array"===e.getType(r)&&-1===Rh(r).call(r,t[g])?(n('Invalid option detected in "'+g+'". Allowed values are:'+e.print(r)+' not "'+t[g]+'". '),Vp=!0):"object"===o&&"__any__"!==i&&(I=mp(I,g),e.parse(t[g],A[i],I)):void 0===C.any&&(n('Invalid type received for "'+g+'". Expected: '+e.print(kl(C))+". Received ["+o+'] "'+t[g]+'"'),Vp=!0)}},{key:"getType",value:function(e){var g=Cl(e);return"object"===g?null===e?"null":e instanceof Boolean?"boolean":e instanceof Number?"number":e instanceof String?"string":cl(e)?"array":e instanceof Date?"date":void 0!==e.nodeType?"dom":!0===e._isAMomentObject?"moment":"object":"number"===g?"number":"boolean"===g?"boolean":"string"===g?"string":void 0===g?"undefined":g}},{key:"getSuggestion",value:function(g,t,A){var i,C=e.findInOptions(g,t,A,!1),I=e.findInOptions(g,Lp,[],!0);i=void 0!==C.indexMatch?" in "+e.printLocation(C.path,g,"")+'Perhaps it was incomplete? Did you mean: "'+C.indexMatch+'"?\n\n':I.distance<=4&&C.distance>I.distance?" in "+e.printLocation(C.path,g,"")+"Perhaps it was misplaced? Matching option found at: "+e.printLocation(I.path,I.closestMatch,""):C.distance<=8?'. Did you mean "'+C.closestMatch+'"?'+e.printLocation(C.path,g):". Did you mean one of these: "+e.print(kl(t))+e.printLocation(A,g),console.error('%cUnknown option detected: "'+g+'"'+i,"background: #FFeeee; color: #dd0000"),Vp=!0}},{key:"findInOptions",value:function(g,t,A){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],C=1e9,I="",n=[],o=g.toLowerCase(),r=void 0;for(var s in t){var a=void 0;if(void 0!==t[s].__type__&&!0===i){var l=e.findInOptions(g,t[s],mp(A,s));C>l.distance&&(I=l.closestMatch,n=l.path,C=l.distance,r=l.indexMatch)}else{var d;-1!==Rh(d=s.toLowerCase()).call(d,o)&&(r=s),C>(a=e.levenshteinDistance(g,s))&&(I=s,n=yp(A),C=a)}}return{closestMatch:I,path:n,distance:C,indexMatch:r}}},{key:"printLocation",value:function(e,g){for(var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",A="\n\n"+t+"options = {\n",i=0;i<e.length;i++){for(var C=0;C<i+1;C++)A+="  ";A+=e[i]+": {\n"}for(var I=0;I<e.length+1;I++)A+="  ";A+=g+"\n";for(var n=0;n<e.length+1;n++){for(var o=0;o<e.length-n;o++)A+="  ";A+="}\n"}return A+"\n\n"}},{key:"print",value:function(e){return ic(e).replace(/(")|(\[)|(\])|(,"__type__")/g,"").replace(/(,)/g,", ")}},{key:"levenshteinDistance",value:function(e,g){if(0===e.length)return g.length;if(0===g.length)return e.length;var t,A,i=[];for(t=0;t<=g.length;t++)i[t]=[t];for(A=0;A<=e.length;A++)i[0][A]=A;for(t=1;t<=g.length;t++)for(A=1;A<=e.length;A++)g.charAt(t-1)==e.charAt(A-1)?i[t][A]=i[t-1][A-1]:i[t][A]=Math.min(i[t-1][A-1]+1,Math.min(i[t][A-1]+1,i[t-1][A]+1));return i[g.length][e.length]}}]),e}();function Hp(e){return tf=e,function(){var e={};Af=0,void(Cf=tf.charAt(0)),uf(),"strict"===If&&(e.strict=!0,uf());"graph"!==If&&"digraph"!==If||(e.type=If,uf());nf===$p&&(e.id=If,uf());if("{"!=If)throw bf("Angle bracket { expected");if(uf(),pf(e),"}"!=If)throw bf("Angle bracket } expected");if(uf(),""!==If)throw bf("End of file expected");return uf(),delete e.node,delete e.edge,delete e.graph,e}()}var Kp={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},Xp=Zh(Kp);Xp.color="color.color",Xp.style="dashes";var Jp=0,qp=1,$p=2,ef=3,gf={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},tf="",Af=0,Cf="",If="",nf=Jp;function of(){Af++,Cf=tf.charAt(Af)}function rf(){return tf.charAt(Af+1)}function sf(e){var g=e.charCodeAt(0);return g<47?35===g||46===g:g<59?g>47:g<91?g>64:g<96?95===g:g<123&&g>96}function af(e,g){if(e||(e={}),g)for(var t in g)g.hasOwnProperty(t)&&(e[t]=g[t]);return e}function lf(e,g,t){for(var A=g.split("."),i=e;A.length;){var C=A.shift();A.length?(i[C]||(i[C]={}),i=i[C]):i[C]=t}}function df(e,g){for(var t,A,i=null,C=[e],I=e;I.parent;)C.push(I.parent),I=I.parent;if(I.nodes)for(t=0,A=I.nodes.length;t<A;t++)if(g.id===I.nodes[t].id){i=I.nodes[t];break}for(i||(i={id:g.id},e.node&&(i.attr=af(i.attr,e.node))),t=C.length-1;t>=0;t--){var n,o=C[t];o.nodes||(o.nodes=[]),-1===Rh(n=o.nodes).call(n,i)&&o.nodes.push(i)}g.attr&&(i.attr=af(i.attr,g.attr))}function hf(e,g){if(e.edges||(e.edges=[]),e.edges.push(g),e.edge){var t=af({},e.edge);g.attr=af(t,g.attr)}}function cf(e,g,t,A,i){var C={from:g,to:t,type:A};return e.edge&&(C.attr=af({},e.edge)),C.attr=af(C.attr||{},i),null!=i&&i.hasOwnProperty("arrows")&&null!=i.arrows&&(C.arrows={to:{enabled:!0,type:i.arrows.type}},i.arrows=null),C}function uf(){for(nf=Jp,If="";" "===Cf||"\t"===Cf||"\n"===Cf||"\r"===Cf;)of();do{var e=!1;if("#"===Cf){for(var g=Af-1;" "===tf.charAt(g)||"\t"===tf.charAt(g);)g--;if("\n"===tf.charAt(g)||""===tf.charAt(g)){for(;""!=Cf&&"\n"!=Cf;)of();e=!0}}if("/"===Cf&&"/"===rf()){for(;""!=Cf&&"\n"!=Cf;)of();e=!0}if("/"===Cf&&"*"===rf()){for(;""!=Cf;){if("*"===Cf&&"/"===rf()){of(),of();break}of()}e=!0}for(;" "===Cf||"\t"===Cf||"\n"===Cf||"\r"===Cf;)of()}while(e);if(""!==Cf){var t=Cf+rf();if(gf[t])return nf=qp,If=t,of(),void of();if(gf[Cf])return nf=qp,If=Cf,void of();if(sf(Cf)||"-"===Cf){for(If+=Cf,of();sf(Cf);)If+=Cf,of();return"false"===If?If=!1:"true"===If?If=!0:isNaN(Number(If))||(If=Number(If)),void(nf=$p)}if('"'===Cf){for(of();""!=Cf&&('"'!=Cf||'"'===Cf&&'"'===rf());)'"'===Cf?(If+=Cf,of()):"\\"===Cf&&"n"===rf()?(If+="\n",of()):If+=Cf,of();if('"'!=Cf)throw bf('End of string " expected');return of(),void(nf=$p)}for(nf=ef;""!=Cf;)If+=Cf,of();throw new SyntaxError('Syntax error in part "'+wf(If,30)+'"')}nf=qp}function pf(e){for(;""!==If&&"}"!=If;)ff(e),";"===If&&uf()}function ff(e){var g=vf(e);if(g)mf(e,g);else if(!function(e){if("node"===If)return uf(),e.node=yf(),"node";if("edge"===If)return uf(),e.edge=yf(),"edge";if("graph"===If)return uf(),e.graph=yf(),"graph";return null}(e)){if(nf!=$p)throw bf("Identifier expected");var t=If;if(uf(),"="===If){if(uf(),nf!=$p)throw bf("Identifier expected");e[t]=If,uf()}else!function(e,g){var t={id:g},A=yf();A&&(t.attr=A);df(e,t),mf(e,g)}(e,t)}}function vf(e){var g=null;if("subgraph"===If&&((g={}).type="subgraph",uf(),nf===$p&&(g.id=If,uf())),"{"===If){if(uf(),g||(g={}),g.parent=e,g.node=e.node,g.edge=e.edge,g.graph=e.graph,pf(g),"}"!=If)throw bf("Angle bracket } expected");uf(),delete g.node,delete g.edge,delete g.graph,delete g.parent,e.subgraphs||(e.subgraphs=[]),e.subgraphs.push(g)}return g}function mf(e,g){for(;"->"===If||"--"===If;){var t,A=If;uf();var i=vf(e);if(i)t=i;else{if(nf!=$p)throw bf("Identifier or subgraph expected");df(e,{id:t=If}),uf()}hf(e,cf(e,g,t,A,yf())),g=t}}function yf(){for(var e,g,t=null,A={dashed:!0,solid:!1,dotted:[1,5]},i={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},C=new Array,I=new Array;"["===If;){for(uf(),t={};""!==If&&"]"!=If;){if(nf!=$p)throw bf("Attribute name expected");var n=If;if(uf(),"="!=If)throw bf("Equal sign = expected");if(uf(),nf!=$p)throw bf("Attribute value expected");var o=If;"style"===n&&(o=A[o]),"arrowhead"===n&&(n="arrows",o={to:{enabled:!0,type:i[o]}}),"arrowtail"===n&&(n="arrows",o={from:{enabled:!0,type:i[o]}}),C.push({attr:t,name:n,value:o}),I.push(n),uf(),","==If&&uf()}if("]"!=If)throw bf("Bracket ] expected");uf()}if(Md(I).call(I,"dir")){var r={arrows:{}};for(e=0;e<C.length;e++)if("arrows"===C[e].name)if(null!=C[e].value.to)r.arrows.to=e;else{if(null==C[e].value.from)throw bf("Invalid value of arrows");r.arrows.from=e}else"dir"===C[e].name&&(r.dir=e);var s,a,l=C[r.dir].value;if(!Md(I).call(I,"arrows"))if("both"===l)C.push({attr:C[r.dir].attr,name:"arrows",value:{to:{enabled:!0}}}),r.arrows.to=C.length-1,C.push({attr:C[r.dir].attr,name:"arrows",value:{from:{enabled:!0}}}),r.arrows.from=C.length-1;else if("forward"===l)C.push({attr:C[r.dir].attr,name:"arrows",value:{to:{enabled:!0}}}),r.arrows.to=C.length-1;else if("back"===l)C.push({attr:C[r.dir].attr,name:"arrows",value:{from:{enabled:!0}}}),r.arrows.from=C.length-1;else{if("none"!==l)throw bf('Invalid dir type "'+l+'"');C.push({attr:C[r.dir].attr,name:"arrows",value:""}),r.arrows.to=C.length-1}if("both"===l)r.arrows.to&&r.arrows.from?(a=C[r.arrows.to].value.to.type,s=C[r.arrows.from].value.from.type,C[r.arrows.to]={attr:C[r.arrows.to].attr,name:C[r.arrows.to].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}},dd(C).call(C,r.arrows.from,1)):r.arrows.to?(a=C[r.arrows.to].value.to.type,s="arrow",C[r.arrows.to]={attr:C[r.arrows.to].attr,name:C[r.arrows.to].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}):r.arrows.from&&(a="arrow",s=C[r.arrows.from].value.from.type,C[r.arrows.from]={attr:C[r.arrows.from].attr,name:C[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=C[r.arrows.from].value.from.type,C[r.arrows.from]={attr:C[r.arrows.from].attr,name:C[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,C[r.arrows.from]={attr:C[r.arrows.from].attr,name:C[r.arrows.from].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}):r.arrows.from&&(a="",s=C[r.arrows.from].value.from.type,C[r.arrows.to]={attr:C[r.arrows.from].attr,name:C[r.arrows.from].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}),C[r.arrows.from]={attr:C[r.arrows.from].attr,name:C[r.arrows.from].name,value:{from:{enabled:!0,type:C[r.arrows.from].value.from.type}}};else if("none"===l){var d;C[d=r.arrows.to?r.arrows.to:r.arrows.from]={attr:C[d].attr,name:C[d].name,value:""}}else{if("forward"!==l)throw bf('Invalid dir type "'+l+'"');r.arrows.to&&r.arrows.from||r.arrows.to?(a=C[r.arrows.to].value.to.type,s="",C[r.arrows.to]={attr:C[r.arrows.to].attr,name:C[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,C[r.arrows.to]={attr:C[r.arrows.to].attr,name:C[r.arrows.to].name,value:{to:{enabled:!0,type:a},from:{enabled:!0,type:s}}}),C[r.arrows.to]={attr:C[r.arrows.to].attr,name:C[r.arrows.to].name,value:{to:{enabled:!0,type:C[r.arrows.to].value.to.type}}}}dd(C).call(C,r.dir,1)}if(Md(I).call(I,"penwidth")){var h=[];for(g=C.length,e=0;e<g;e++)"width"!==C[e].name&&("penwidth"===C[e].name&&(C[e].name="width"),h.push(C[e]));C=h}for(g=C.length,e=0;e<g;e++)lf(C[e].attr,C[e].name,C[e].value);return t}function bf(e){return new SyntaxError(e+', got "'+wf(If,30)+'" (char '+Af+")")}function wf(e,g){return e.length<=g?e:e.substr(0,27)+"..."}function kf(e,g,t){for(var A=g.split("."),i=A.pop(),C=e,I=0;I<A.length;I++){var n=A[I];n in C||(C[n]={}),C=C[n]}return C[i]=t,e}function xf(e,g){var t={};for(var A in e)if(e.hasOwnProperty(A)){var i=g[A];cl(i)?Ll(i).call(i,(function(g){kf(t,g,e[A])})):kf(t,"string"==typeof i?i:A,e[A])}return t}function Ef(e){var g,t=Hp(e),A={nodes:[],edges:[],options:{}};t.nodes&&Ll(g=t.nodes).call(g,(function(e){var g={id:e.id,label:String(e.label||e.id)};af(g,xf(e.attr,Kp)),g.image&&(g.shape="image"),A.nodes.push(g)}));if(t.edges){var i,C=function(e){var g={from:e.from,to:e.to};return af(g,xf(e.attr,Xp)),null==g.arrows&&"->"===e.type&&(g.arrows="to"),g};Ll(i=t.edges).call(i,(function(e){var g,t,i,I,n,o,r;(g=e.from instanceof Object?e.from.nodes:{id:e.from},t=e.to instanceof Object?e.to.nodes:{id:e.to},e.from instanceof Object&&e.from.edges)&&Ll(i=e.from.edges).call(i,(function(e){var g=C(e);A.edges.push(g)}));(n=t,o=function(g,t){var i=cf(A,g.id,t.id,e.type,e.attr),I=C(i);A.edges.push(I)},cl(I=g)?Ll(I).call(I,(function(e){cl(n)?Ll(n).call(n,(function(g){o(e,g)})):o(e,n)})):cl(n)?Ll(n).call(n,(function(e){o(I,e)})):o(I,n),e.to instanceof Object&&e.to.edges)&&Ll(r=e.to.edges).call(r,(function(e){var g=C(e);A.edges.push(g)}))}))}return t.attr&&(A.options=t.attr),A}var Of=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 Tf=function(){function e(){ta(this,e),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return Ca(e,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var e=this.image.width,g=this.image.height;this.width=e,this.height=g;var t=Math.floor(g/2),A=Math.floor(g/4),i=Math.floor(g/8),C=Math.floor(g/16),I=Math.floor(e/2),n=Math.floor(e/4),o=Math.floor(e/8),r=Math.floor(e/16);this.canvas.width=3*n,this.canvas.height=t,this.coordinates=[[0,0,I,t],[I,0,n,A],[I,A,o,i],[5*o,A,r,C]],this._fillMipMap()}}},{key:"initialized",value:function(){return void 0!==this.coordinates}},{key:"_fillMipMap",value:function(){var e=this.canvas.getContext("2d"),g=this.coordinates[0];e.drawImage(this.image,g[0],g[1],g[2],g[3]);for(var t=1;t<this.NUM_ITERATIONS;t++){var A=this.coordinates[t-1],i=this.coordinates[t];e.drawImage(this.canvas,A[0],A[1],A[2],A[3],i[0],i[1],i[2],i[3])}}},{key:"drawImageAtPosition",value:function(e,g,t,A,i,C){if(this.initialized())if(g>2){g*=.5;for(var I=0;g>2&&I<this.NUM_ITERATIONS;)g*=.5,I+=1;I>=this.NUM_ITERATIONS&&(I=this.NUM_ITERATIONS-1);var n=this.coordinates[I];e.drawImage(this.canvas,n[0],n[1],n[2],n[3],t,A,i,C)}else e.drawImage(this.image,t,A,i,C)}}]),e}(),Df=function(){function e(g){ta(this,e),this.images={},this.imageBroken={},this.callback=g}return Ca(e,[{key:"_tryloadBrokenUrl",value:function(e,g,t){void 0!==e&&void 0!==t&&(void 0!==g?(t.image.onerror=function(){console.error("Could not load brokenImage:",g)},t.image.src=g):console.warn("No broken url image defined"))}},{key:"_redrawWithImage",value:function(e){this.callback&&this.callback(e)}},{key:"load",value:function(e,g){var t=this,A=this.images[e];if(A)return A;var i=new Tf;return this.images[e]=i,i.image.onload=function(){t._fixImageCoordinates(i.image),i.init(),t._redrawWithImage(i)},i.image.onerror=function(){console.error("Could not load image:",e),t._tryloadBrokenUrl(e,g,i)},i.image.src=e,i}},{key:"_fixImageCoordinates",value:function(e){0===e.width&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}]),e}(),Nf={exports:{}},Rf=T((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Pf=T,Sf=ue,Mf=Ae,Bf=Rf,zf=Object.isExtensible,Ff=Pf((function(){zf(1)}))||Bf?function(e){return!!Sf(e)&&((!Bf||"ArrayBuffer"!=Mf(e))&&(!zf||zf(e)))}:zf,Zf=!T((function(){return Object.isExtensible(Object.preventExtensions({}))})),jf=Vt,Gf=G,Lf=CA,Vf=ue,Yf=ag,Wf=dt.f,_f=po,Uf=mo,Qf=Ff,Hf=Zf,Kf=!1,Xf=ug("meta"),Jf=0,qf=function(e){Wf(e,Xf,{value:{objectID:"O"+Jf++,weakData:{}}})},$f=Nf.exports={enable:function(){$f.enable=function(){},Kf=!0;var e=_f.f,g=Gf([].splice),t={};t[Xf]=1,e(t).length&&(_f.f=function(t){for(var A=e(t),i=0,C=A.length;i<C;i++)if(A[i]===Xf){g(A,i,1);break}return A},jf({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Uf.f}))},fastKey:function(e,g){if(!Vf(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Yf(e,Xf)){if(!Qf(e))return"F";if(!g)return"E";qf(e)}return e[Xf].objectID},getWeakData:function(e,g){if(!Yf(e,Xf)){if(!Qf(e))return!0;if(!g)return!1;qf(e)}return e[Xf].weakData},onFreeze:function(e){return Hf&&Kf&&Qf(e)&&!Yf(e,Xf)&&qf(e),e}};Lf[Xf]=!0;var ev=lt,gv=U,tv=vt,Av=Ye,iv=gn,Cv=$t,Iv=we,nv=Pn,ov=xn,rv=KI,sv=O.TypeError,av=function(e,g){this.stopped=e,this.result=g},lv=av.prototype,dv=function(e,g,t){var A,i,C,I,n,o,r,s=t&&t.that,a=!(!t||!t.AS_ENTRIES),l=!(!t||!t.IS_ITERATOR),d=!(!t||!t.INTERRUPTED),h=ev(g,s),c=function(e){return A&&rv(A,"normal",e),new av(!0,e)},u=function(e){return a?(tv(e),d?h(e[0],e[1],c):h(e[0],e[1])):d?h(e,c):h(e)};if(l)A=e;else{if(!(i=ov(e)))throw sv(Av(e)+" is not iterable");if(iv(i)){for(C=0,I=Cv(e);I>C;C++)if((n=u(e[C]))&&Iv(lv,n))return n;return new av(!1)}A=nv(e,i)}for(o=A.next;!(r=gv(o,A)).done;){try{n=u(r.value)}catch(e){rv(A,"throw",e)}if("object"==typeof n&&n&&Iv(lv,n))return n}return new av(!1)},hv=we,cv=O.TypeError,uv=function(e,g){if(hv(g,e))return e;throw cv("Incorrect invocation")},pv=Vt,fv=O,vv=Nf.exports,mv=T,yv=Nt,bv=dv,wv=uv,kv=L,xv=ue,Ev=lI,Ov=dt.f,Tv=er.forEach,Dv=Y,Nv=IC.set,Rv=IC.getterFor,Pv=function(e,g,t){var A,i=-1!==e.indexOf("Map"),C=-1!==e.indexOf("Weak"),I=i?"set":"add",n=fv[e],o=n&&n.prototype,r={};if(Dv&&kv(n)&&(C||o.forEach&&!mv((function(){(new n).entries().next()})))){var s=(A=g((function(g,t){Nv(wv(g,s),{type:e,collection:new n}),null!=t&&bv(t,g[I],{that:g,AS_ENTRIES:i})}))).prototype,a=Rv(e);Tv(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var g="add"==e||"set"==e;!(e in o)||C&&"clear"==e||yv(s,e,(function(t,A){var i=a(this).collection;if(!g&&C&&!xv(t))return"get"==e&&void 0;var I=i[e](0===t?0:t,A);return g?this:I}))})),C||Ov(s,"size",{configurable:!0,get:function(){return a(this).collection.size}})}else A=t.getConstructor(g,e,i,I),vv.enable();return Ev(A,e,!1,!0),r[e]=A,pv({global:!0,forced:!0},r),C||t.setStrong(A,e,i),A},Sv=HC,Mv=function(e,g,t){for(var A in g)t&&t.unsafe&&e[A]?e[A]=g[A]:Sv(e,A,g[A],t);return e},Bv=be,zv=dt,Fv=Y,Zv=Og("species"),jv=dt.f,Gv=zC,Lv=Mv,Vv=lt,Yv=uv,Wv=dv,_v=jI,Uv=function(e){var g=Bv(e),t=zv.f;Fv&&g&&!g[Zv]&&t(g,Zv,{configurable:!0,get:function(){return this}})},Qv=Y,Hv=Nf.exports.fastKey,Kv=IC.set,Xv=IC.getterFor,Jv={getConstructor:function(e,g,t,A){var i=e((function(e,i){Yv(e,C),Kv(e,{type:g,index:Gv(null),first:void 0,last:void 0,size:0}),Qv||(e.size=0),null!=i&&Wv(i,e[A],{that:e,AS_ENTRIES:t})})),C=i.prototype,I=Xv(g),n=function(e,g,t){var A,i,C=I(e),n=o(e,g);return n?n.value=t:(C.last=n={index:i=Hv(g,!0),key:g,value:t,previous:A=C.last,next:void 0,removed:!1},C.first||(C.first=n),A&&(A.next=n),Qv?C.size++:e.size++,"F"!==i&&(C.index[i]=n)),e},o=function(e,g){var t,A=I(e),i=Hv(g);if("F"!==i)return A.index[i];for(t=A.first;t;t=t.next)if(t.key==g)return t};return Lv(C,{clear:function(){for(var e=I(this),g=e.index,t=e.first;t;)t.removed=!0,t.previous&&(t.previous=t.previous.next=void 0),delete g[t.index],t=t.next;e.first=e.last=void 0,Qv?e.size=0:this.size=0},delete:function(e){var g=this,t=I(g),A=o(g,e);if(A){var i=A.next,C=A.previous;delete t.index[A.index],A.removed=!0,C&&(C.next=i),i&&(i.previous=C),t.first==A&&(t.first=i),t.last==A&&(t.last=C),Qv?t.size--:g.size--}return!!A},forEach:function(e){for(var g,t=I(this),A=Vv(e,arguments.length>1?arguments[1]:void 0);g=g?g.next:t.first;)for(A(g.value,g.key,this);g&&g.removed;)g=g.previous},has:function(e){return!!o(this,e)}}),Lv(C,t?{get:function(e){var g=o(this,e);return g&&g.value},set:function(e,g){return n(this,0===e?0:e,g)}}:{add:function(e){return n(this,e=0===e?0:e,e)}}),Qv&&jv(C,"size",{get:function(){return I(this).size}}),i},setStrong:function(e,g,t){var A=g+" Iterator",i=Xv(g),C=Xv(A);_v(e,g,(function(e,g){Kv(this,{type:A,target:e,state:i(e),kind:g,last:void 0})}),(function(){for(var e=C(this),g=e.kind,t=e.last;t&&t.removed;)t=t.previous;return e.target&&(e.last=t=t?t.next:e.state.first)?"keys"==g?{value:t.key,done:!1}:"values"==g?{value:t.value,done:!1}:{value:[t.key,t.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),t?"entries":"values",!t,!0),Uv(g)}};Pv("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Jv);var qv=pe.Map,$v=function(){function e(){ta(this,e),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},NA(this.options,this.defaultOptions)}return Ca(e,[{key:"setOptions",value:function(e){var g=["useDefaultGroups"];if(void 0!==e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&-1===Rh(g).call(g,t)){var A=e[t];this.add(t,A)}}},{key:"clear",value:function(){this._groups=new qv,this._groupNames=[]}},{key:"get",value:function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this._groups.get(e);if(void 0===t&&g)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(e,t)}else{var i=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,(t={}).color=this._defaultGroups[i],this._groups.set(e,t)}return t}},{key:"add",value:function(e,g){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,g),g}}]),e}();Vt({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var em=pe.Number.isNaN,gm=O.isFinite;Vt({target:"Number",stat:!0},{isFinite:Number.isFinite||function(e){return"number"==typeof e&&gm(e)}});var tm=pe.Number.isFinite,Am=er.some;Vt({target:"Array",proto:!0,forced:!Rl("some")},{some:function(e){return Am(this,e,arguments.length>1?arguments[1]:void 0)}});var im=UA("Array").some,Cm=we,Im=im,nm=Array.prototype,om=function(e){var g=e.some;return e===nm||Cm(nm,e)&&g===nm.some?Im:g},rm=un,sm=Ye,am=O.TypeError,lm=Vt,dm=M,hm=YA,cm=function(e){if(rm(e))return e;throw am(sm(e)+" is not a constructor")},um=vt,pm=ue,fm=zC,vm=T,mm=be("Reflect","construct"),ym=Object.prototype,bm=[].push,wm=vm((function(){function e(){}return!(mm((function(){}),[],e)instanceof e)})),km=!vm((function(){mm((function(){}))})),xm=wm||km;lm({target:"Reflect",stat:!0,forced:xm,sham:xm},{construct:function(e,g){cm(e),um(g);var t=arguments.length<3?e:cm(arguments[2]);if(km&&!wm)return mm(e,g,t);if(e==t){switch(g.length){case 0:return new e;case 1:return new e(g[0]);case 2:return new e(g[0],g[1]);case 3:return new e(g[0],g[1],g[2]);case 4:return new e(g[0],g[1],g[2],g[3])}var A=[null];return dm(bm,A,g),new(dm(hm,e,A))}var i=t.prototype,C=fm(pm(i)?i:ym),I=dm(e,C,g);return pm(I)?I:C}});var Em=pe.Reflect.construct;function Om(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Tm=Fh;Vt({target:"Object",stat:!0},{setPrototypeOf:OI});var Dm=pe.Object.setPrototypeOf;function Nm(e,g){return(Nm=Dm||function(e,g){return e.__proto__=g,e})(e,g)}function Rm(e,g){if("function"!=typeof g&&null!==g)throw new TypeError("Super expression must either be null or a function");e.prototype=Tm(g&&g.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Aa(e,"prototype",{writable:!1}),g&&Nm(e,g)}function Pm(e,g){if(g&&("object"===Cl(g)||"function"==typeof g))return g;if(void 0!==g)throw new TypeError("Derived constructors may only return object or undefined");return Om(e)}var Sm=Zd;function Mm(e){return(Mm=Dm?Sm:function(e){return e.__proto__||Sm(e)})(e)}var Bm={exports:{}};!function(e){var g=function(e){var g,t=Object.prototype,A=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},C=i.iterator||"@@iterator",I=i.asyncIterator||"@@asyncIterator",n=i.toStringTag||"@@toStringTag";function o(e,g,t){return Object.defineProperty(e,g,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[g]}try{o({},"")}catch(e){o=function(e,g,t){return e[g]=t}}function r(e,g,t,A){var i=g&&g.prototype instanceof u?g:u,C=Object.create(i.prototype),I=new T(A||[]);return C._invoke=function(e,g,t){var A=a;return function(i,C){if(A===d)throw new Error("Generator is already running");if(A===h){if("throw"===i)throw C;return N()}for(t.method=i,t.arg=C;;){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(e,g,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)}}}(e,t,I),C}function s(e,g,t){try{return{type:"normal",arg:e.call(g,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=r;var a="suspendedStart",l="suspendedYield",d="executing",h="completed",c={};function u(){}function p(){}function f(){}var v={};o(v,C,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(D([])));y&&y!==t&&A.call(y,C)&&(v=y);var b=f.prototype=u.prototype=Object.create(v);function w(e){["next","throw","return"].forEach((function(g){o(e,g,(function(e){return this._invoke(g,e)}))}))}function k(e,g){function t(i,C,I,n){var o=s(e[i],e,C);if("throw"!==o.type){var r=o.arg,a=r.value;return a&&"object"==typeof a&&A.call(a,"__await")?g.resolve(a.__await).then((function(e){t("next",e,I,n)}),(function(e){t("throw",e,I,n)})):g.resolve(a).then((function(e){r.value=e,I(r)}),(function(e){return t("throw",e,I,n)}))}n(o.arg)}var i;this._invoke=function(e,A){function C(){return new g((function(g,i){t(e,A,g,i)}))}return i=i?i.then(C,C):C()}}function x(e,t){var A=e.iterator[t.method];if(A===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,x(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var i=s(A,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,c;var C=i.arg;return C?C.done?(t[e.resultName]=C.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,c):C:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function E(e){var g={tryLoc:e[0]};1 in e&&(g.catchLoc=e[1]),2 in e&&(g.finallyLoc=e[2],g.afterLoc=e[3]),this.tryEntries.push(g)}function O(e){var g=e.completion||{};g.type="normal",delete g.arg,e.completion=g}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function D(e){if(e){var t=e[C];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,I=function t(){for(;++i<e.length;)if(A.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=g,t.done=!0,t};return I.next=I}}return{next:N}}function N(){return{value:g,done:!0}}return p.prototype=f,o(b,"constructor",f),o(f,"constructor",p),p.displayName=o(f,n,"GeneratorFunction"),e.isGeneratorFunction=function(e){var g="function"==typeof e&&e.constructor;return!!g&&(g===p||"GeneratorFunction"===(g.displayName||g.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,n,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},w(k.prototype),o(k.prototype,I,(function(){return this})),e.AsyncIterator=k,e.async=function(g,t,A,i,C){void 0===C&&(C=Promise);var I=new k(r(g,t,A,i),C);return e.isGeneratorFunction(t)?I:I.next().then((function(e){return e.done?e.value:I.next()}))},w(b),o(b,n,"Generator"),o(b,C,(function(){return this})),o(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var g=[];for(var t in e)g.push(t);return g.reverse(),function t(){for(;g.length;){var A=g.pop();if(A in e)return t.value=A,t.done=!1,t}return t.done=!0,t}},e.values=D,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&A.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(A,i){return n.type="throw",n.arg=e,t.next=A,i&&(t.method="next",t.arg=g),!!i}for(var C=this.tryEntries.length-1;C>=0;--C){var I=this.tryEntries[C],n=I.completion;if("root"===I.tryLoc)return i("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 i(I.catchLoc,!0);if(this.prev<I.finallyLoc)return i(I.finallyLoc)}else if(o){if(this.prev<I.catchLoc)return i(I.catchLoc,!0)}else{if(!r)throw new Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return i(I.finallyLoc)}}}},abrupt:function(e,g){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc<=this.prev&&A.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var C=i;break}}C&&("break"===e||"continue"===e)&&C.tryLoc<=g&&g<=C.finallyLoc&&(C=null);var I=C?C.completion:{};return I.type=e,I.arg=g,C?(this.method="next",this.next=C.finallyLoc,c):this.complete(I)},complete:function(e,g){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&g&&(this.next=g),c},finish:function(e){for(var g=this.tryEntries.length-1;g>=0;--g){var t=this.tryEntries[g];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),O(t),c}},catch:function(e){for(var g=this.tryEntries.length-1;g>=0;--g){var t=this.tryEntries[g];if(t.tryLoc===e){var A=t.completion;if("throw"===A.type){var i=A.arg;O(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,A){return this.delegate={iterator:D(e),resultName:t,nextLoc:A},"next"===this.method&&(this.arg=g),c}},e}(e.exports);try{regeneratorRuntime=g}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}}(Bm);var zm=Bm.exports,Fm=Qe,Zm=og,jm=re,Gm=$t,Lm=O.TypeError,Vm=function(e){return function(g,t,A,i){Fm(t);var C=Zm(g),I=jm(C),n=Gm(C),o=e?n-1:0,r=e?-1:1;if(A<2)for(;;){if(o in I){i=I[o],o+=r;break}if(o+=r,e?o<0:n<=o)throw Lm("Reduce of empty array with no initial value")}for(;e?o>=0:n>o;o+=r)o in I&&(i=t(i,I[o],o,C));return i}},Ym={left:Vm(!1),right:Vm(!0)},Wm="process"==Ae(O.process),_m=Ym.left,Um=Re,Qm=Wm;Vt({target:"Array",proto:!0,forced:!Rl("reduce")||!Qm&&Um>79&&Um<83},{reduce:function(e){var g=arguments.length;return _m(this,e,g,g>1?arguments[1]:void 0)}});var Hm=UA("Array").reduce,Km=we,Xm=Hm,Jm=Array.prototype,qm=function(e){var g=e.reduce;return e===Jm||Km(Jm,e)&&g===Jm.reduce?Xm:g},$m=uo,ey=$t,gy=lt,ty=O.TypeError,Ay=function(e,g,t,A,i,C,I,n){for(var o,r,s=i,a=0,l=!!I&&gy(I,n);a<A;){if(a in t){if(o=l?l(t[a],a,g):t[a],C>0&&$m(o))r=ey(o),s=Ay(e,g,o,r,s,C-1)-1;else{if(s>=9007199254740991)throw ty("Exceed the acceptable array length");e[s]=o}s++}a++}return s},iy=Ay,Cy=Qe,Iy=og,ny=$t,oy=Uo;Vt({target:"Array",proto:!0},{flatMap:function(e){var g,t=Iy(this),A=ny(t);return Cy(e),(g=oy(t,0)).length=iy(g,t,t,A,0,1,e,arguments.length>1?arguments[1]:void 0),g}}),UA("Array").flatMap,Pv("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Jv);var ry=pe.Set,sy=Al,ay=Pn,ly=Eo,dy=Math.floor,hy=function(e,g){var t=e.length,A=dy(t/2);return t<8?cy(e,g):uy(e,hy(ly(e,0,A),g),hy(ly(e,A),g),g)},cy=function(e,g){for(var t,A,i=e.length,C=1;C<i;){for(A=C,t=e[C];A&&g(e[A-1],t)>0;)e[A]=e[--A];A!==C++&&(e[A]=t)}return e},uy=function(e,g,t,A){for(var i=g.length,C=t.length,I=0,n=0;I<i||n<C;)e[I+n]=I<i&&n<C?A(g[I],t[n])<=0?g[I++]:t[n++]:I<i?g[I++]:t[n++];return e},py=hy,fy=ke.match(/firefox\/(\d+)/i),vy=!!fy&&+fy[1],my=/MSIE|Trident/.test(ke),yy=ke.match(/AppleWebKit\/(\d+)\./),by=!!yy&&+yy[1],wy=Vt,ky=G,xy=Qe,Ey=og,Oy=$t,Ty=vi,Dy=T,Ny=py,Ry=Rl,Py=vy,Sy=my,My=Re,By=by,zy=[],Fy=ky(zy.sort),Zy=ky(zy.push),jy=Dy((function(){zy.sort(void 0)})),Gy=Dy((function(){zy.sort(null)})),Ly=Ry("sort"),Vy=!Dy((function(){if(My)return My<70;if(!(Py&&Py>3)){if(Sy)return!0;if(By)return By<603;var e,g,t,A,i="";for(e=65;e<76;e++){switch(g=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(A=0;A<47;A++)zy.push({k:g+A,v:t})}for(zy.sort((function(e,g){return g.v-e.v})),A=0;A<zy.length;A++)g=zy[A].k.charAt(0),i.charAt(i.length-1)!==g&&(i+=g);return"DGBEFHACIJK"!==i}}));wy({target:"Array",proto:!0,forced:jy||!Gy||!Ly||!Vy},{sort:function(e){void 0!==e&&xy(e);var g=Ey(this);if(Vy)return void 0===e?Fy(g):Fy(g,e);var t,A,i=[],C=Oy(g);for(A=0;A<C;A++)A in g&&Zy(i,g[A]);for(Ny(i,function(e){return function(g,t){return void 0===t?-1:void 0===g?1:void 0!==e?+e(g,t)||0:Ty(g)>Ty(t)?1:-1}}(e)),t=i.length,A=0;A<t;)g[A]=i[A++];for(;A<C;)delete g[A++];return g}});var Yy,Wy=UA("Array").sort,_y=we,Uy=Wy,Qy=Array.prototype,Hy=function(e){var g=e.sort;return e===Qy||_y(Qy,e)&&g===Qy.sort?Uy:g},Ky=UA("Array").keys,Xy=ui,Jy=ag,qy=we,$y=Ky,eb=Array.prototype,gb={DOMTokenList:!0,NodeList:!0},tb=function(e){var g=e.keys;return e===eb||qy(eb,e)&&g===eb.keys||Jy(gb,Xy(e))?$y:g},Ab=UA("Array").values,ib=ui,Cb=ag,Ib=we,nb=Ab,ob=Array.prototype,rb={DOMTokenList:!0,NodeList:!0},sb=function(e){var g=e.values;return e===ob||Ib(ob,e)&&g===ob.values||Cb(rb,ib(e))?nb:g},ab=UA("Array").entries,lb=ui,db=ag,hb=we,cb=ab,ub=Array.prototype,pb={DOMTokenList:!0,NodeList:!0},fb=function(e){var g=e.entries;return e===ub||hb(ub,e)&&g===ub.entries||db(pb,lb(e))?cb:g},vb=new Uint8Array(16);function mb(){if(!Yy&&!(Yy="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 Yy(vb)}var yb=/^(?:[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 bb(e){return"string"==typeof e&&yb.test(e)}for(var wb,kb=[],xb=0;xb<256;++xb)kb.push((xb+256).toString(16).substr(1));function Eb(e,g,t){var A=(e=e||{}).random||(e.rng||mb)();if(A[6]=15&A[6]|64,A[8]=63&A[8]|128,g){t=t||0;for(var i=0;i<16;++i)g[t+i]=A[i];return g}return function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=(kb[e[g+0]]+kb[e[g+1]]+kb[e[g+2]]+kb[e[g+3]]+"-"+kb[e[g+4]]+kb[e[g+5]]+"-"+kb[e[g+6]]+kb[e[g+7]]+"-"+kb[e[g+8]]+kb[e[g+9]]+"-"+kb[e[g+10]]+kb[e[g+11]]+kb[e[g+12]]+kb[e[g+13]]+kb[e[g+14]]+kb[e[g+15]]).toLowerCase();if(!bb(t))throw TypeError("Stringified UUID is invalid");return t}(A)}function Ob(e,g){var t=kl(e);if(fs){var A=fs(e);g&&(A=_d(A).call(A,(function(g){return Ds(e,g).enumerable}))),t.push.apply(t,A)}return t}function Tb(e){for(var g=1;g<arguments.length;g++){var t,A,i=null!=arguments[g]?arguments[g]:{};g%2?Ll(t=Ob(Object(i),!0)).call(t,(function(g){Ia(e,g,i[g])})):Gs?Qs(e,Gs(i)):Ll(A=Ob(Object(i))).call(A,(function(g){ga(e,g,Ds(i,g))}))}return e}function Db(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}function Nb(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return Rb(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return Rb(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function Rb(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}function Pb(e){return"string"==typeof e||"number"==typeof e}var Sb=function(){function e(g){ta(this,e),Ia(this,"delay",void 0),Ia(this,"max",void 0),Ia(this,"_queue",[]),Ia(this,"_timeout",null),Ia(this,"_extended",null),this.delay=null,this.max=1/0,this.setOptions(g)}return Ca(e,[{key:"setOptions",value:function(e){e&&void 0!==e.delay&&(this.delay=e.delay),e&&void 0!==e.max&&(this.max=e.max),this._flushIfNeeded()}},{key:"destroy",value:function(){if(this.flush(),this._extended){for(var e=this._extended.object,g=this._extended.methods,t=0;t<g.length;t++){var A=g[t];A.original?e[A.name]=A.original:delete e[A.name]}this._extended=null}}},{key:"replace",value:function(e,g){var t=this,A=e[g];if(!A)throw new Error("Method "+g+" undefined");e[g]=function(){for(var e=arguments.length,g=new Array(e),i=0;i<e;i++)g[i]=arguments[i];t.queue({args:g,fn:A,context:this})}}},{key:"queue",value:function(e){"function"==typeof e?this._queue.push({fn:e}):this._queue.push(e),this._flushIfNeeded()}},{key:"_flushIfNeeded",value:function(){var e=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=cc((function(){e.flush()}),this.delay))}},{key:"flush",value:function(){var e,g;Ll(e=dd(g=this._queue).call(g,0)).call(e,(function(e){e.fn.apply(e.context||e.fn,e.args||[])}))}}],[{key:"extend",value:function(g,t){var A=new e(t);if(void 0!==g.flush)throw new Error("Target object already has a property flush");g.flush=function(){A.flush()};var i=[{name:"flush",original:void 0}];if(t&&t.replace)for(var C=0;C<t.replace.length;C++){var I=t.replace[C];i.push({name:I,original:g[I]}),A.replace(g,I)}return A._extended={object:g,methods:i},A}}]),e}(),Mb=function(){function e(){ta(this,e),Ia(this,"_subscribers",{"*":[],add:[],remove:[],update:[]}),Ia(this,"subscribe",e.prototype.on),Ia(this,"unsubscribe",e.prototype.off)}return Ca(e,[{key:"_trigger",value:function(e,g,t){var A,i;if("*"===e)throw new Error("Cannot trigger event *");Ll(A=ll(i=[]).call(i,Il(this._subscribers[e]),Il(this._subscribers["*"]))).call(A,(function(A){A(e,g,null!=t?t:null)}))}},{key:"on",value:function(e,g){"function"==typeof g&&this._subscribers[e].push(g)}},{key:"off",value:function(e,g){var t;this._subscribers[e]=_d(t=this._subscribers[e]).call(t,(function(e){return e!==g}))}}]),e}();wb=sy;var Bb=function(){function e(g){ta(this,e),Ia(this,"_pairs",void 0),this._pairs=g}return Ca(e,[{key:wb,value:zm.mark((function e(){var g,t,A,i,C;return zm.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g=Nb(this._pairs),e.prev=1,g.s();case 3:if((t=g.n()).done){e.next=9;break}return A=tl(t.value,2),i=A[0],C=A[1],e.next=7,[i,C];case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),g.e(e.t0);case 14:return e.prev=14,g.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[1,11,14,17]])}))},{key:"entries",value:zm.mark((function e(){var g,t,A,i,C;return zm.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g=Nb(this._pairs),e.prev=1,g.s();case 3:if((t=g.n()).done){e.next=9;break}return A=tl(t.value,2),i=A[0],C=A[1],e.next=7,[i,C];case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),g.e(e.t0);case 14:return e.prev=14,g.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[1,11,14,17]])}))},{key:"keys",value:zm.mark((function e(){var g,t,A,i;return zm.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g=Nb(this._pairs),e.prev=1,g.s();case 3:if((t=g.n()).done){e.next=9;break}return A=tl(t.value,1),i=A[0],e.next=7,i;case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),g.e(e.t0);case 14:return e.prev=14,g.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[1,11,14,17]])}))},{key:"values",value:zm.mark((function e(){var g,t,A,i;return zm.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g=Nb(this._pairs),e.prev=1,g.s();case 3:if((t=g.n()).done){e.next=9;break}return A=tl(t.value,2),i=A[1],e.next=7,i;case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),g.e(e.t0);case 14:return e.prev=14,g.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[1,11,14,17]])}))},{key:"toIdArray",value:function(){var e;return yl(e=Il(this._pairs)).call(e,(function(e){return e[0]}))}},{key:"toItemArray",value:function(){var e;return yl(e=Il(this._pairs)).call(e,(function(e){return e[1]}))}},{key:"toEntryArray",value:function(){return Il(this._pairs)}},{key:"toObjectMap",value:function(){var e,g=Zh(null),t=Nb(this._pairs);try{for(t.s();!(e=t.n()).done;){var A=tl(e.value,2),i=A[0],C=A[1];g[i]=C}}catch(e){t.e(e)}finally{t.f()}return g}},{key:"toMap",value:function(){return new qv(this._pairs)}},{key:"toIdSet",value:function(){return new ry(this.toIdArray())}},{key:"toItemSet",value:function(){return new ry(this.toItemArray())}},{key:"cache",value:function(){return new e(Il(this._pairs))}},{key:"distinct",value:function(e){var g,t=new ry,A=Nb(this._pairs);try{for(A.s();!(g=A.n()).done;){var i=tl(g.value,2),C=i[0],I=i[1];t.add(e(I,C))}}catch(e){A.e(e)}finally{A.f()}return t}},{key:"filter",value:function(g){var t=this._pairs;return new e(Ia({},sy,zm.mark((function e(){var A,i,C,I,n;return zm.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:A=Nb(t),e.prev=1,A.s();case 3:if((i=A.n()).done){e.next=10;break}if(C=tl(i.value,2),I=C[0],n=C[1],!g(n,I)){e.next=8;break}return e.next=8,[I,n];case 8:e.next=3;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),A.e(e.t0);case 15:return e.prev=15,A.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[1,12,15,18]])}))))}},{key:"forEach",value:function(e){var g,t=Nb(this._pairs);try{for(t.s();!(g=t.n()).done;){var A=tl(g.value,2),i=A[0];e(A[1],i)}}catch(e){t.e(e)}finally{t.f()}}},{key:"map",value:function(g){var t=this._pairs;return new e(Ia({},sy,zm.mark((function e(){var A,i,C,I,n;return zm.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:A=Nb(t),e.prev=1,A.s();case 3:if((i=A.n()).done){e.next=9;break}return C=tl(i.value,2),I=C[0],n=C[1],e.next=7,[I,g(n,I)];case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),A.e(e.t0);case 14:return e.prev=14,A.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])}))))}},{key:"max",value:function(e){var g=ay(this._pairs),t=g.next();if(t.done)return null;for(var A=t.value[1],i=e(t.value[1],t.value[0]);!(t=g.next()).done;){var C=tl(t.value,2),I=C[0],n=C[1],o=e(n,I);o>i&&(i=o,A=n)}return A}},{key:"min",value:function(e){var g=ay(this._pairs),t=g.next();if(t.done)return null;for(var A=t.value[1],i=e(t.value[1],t.value[0]);!(t=g.next()).done;){var C=tl(t.value,2),I=C[0],n=C[1],o=e(n,I);o<i&&(i=o,A=n)}return A}},{key:"reduce",value:function(e,g){var t,A=Nb(this._pairs);try{for(A.s();!(t=A.n()).done;){var i=tl(t.value,2),C=i[0];g=e(g,i[1],C)}}catch(e){A.e(e)}finally{A.f()}return g}},{key:"sort",value:function(g){var t=this;return new e(Ia({},sy,(function(){var e;return ay(Hy(e=Il(t._pairs)).call(e,(function(e,t){var A=tl(e,2),i=A[0],C=A[1],I=tl(t,2),n=I[0],o=I[1];return g(C,o,i,n)})))})))}}]),e}();var zb=function(e){Rm(t,Mb);var g=Db(t);function t(e,A){var i;return ta(this,t),Ia(Om(i=g.call(this)),"flush",void 0),Ia(Om(i),"length",void 0),Ia(Om(i),"_options",void 0),Ia(Om(i),"_data",void 0),Ia(Om(i),"_idProp",void 0),Ia(Om(i),"_queue",null),e&&!cl(e)&&(A=e,e=[]),i._options=A||{},i._data=new qv,i.length=0,i._idProp=i._options.fieldId||"id",e&&e.length&&i.add(e),i.setOptions(A),i}return Ca(t,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(e){e&&void 0!==e.queue&&(!1===e.queue?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=Sb.extend(this,{replace:["add","update","remove"]})),e.queue&&"object"===Cl(e.queue)&&this._queue.setOptions(e.queue)))}},{key:"add",value:function(e,g){var t,A=this,i=[];if(cl(e)){var C=yl(e).call(e,(function(e){return e[A._idProp]}));if(om(C).call(C,(function(e){return A._data.has(e)})))throw new Error("A duplicate id was found in the parameter array.");for(var I=0,n=e.length;I<n;I++)t=this._addItem(e[I]),i.push(t)}else{if(!e||"object"!==Cl(e))throw new Error("Unknown dataType");t=this._addItem(e),i.push(t)}return i.length&&this._trigger("add",{items:i},g),i}},{key:"update",value:function(e,g){var t=this,A=[],i=[],C=[],I=[],n=this._idProp,o=function(e){var g=e[n];if(null!=g&&t._data.has(g)){var o=e,r=NA({},t._data.get(g)),s=t._updateItem(o);i.push(s),I.push(o),C.push(r)}else{var a=t._addItem(e);A.push(a)}};if(cl(e))for(var r=0,s=e.length;r<s;r++)e[r]&&"object"===Cl(e[r])?o(e[r]):console.warn("Ignoring input item, which is not an object at index "+r);else{if(!e||"object"!==Cl(e))throw new Error("Unknown dataType");o(e)}if(A.length&&this._trigger("add",{items:A},g),i.length){var a={items:i,oldData:C,data:I};this._trigger("update",a,g)}return ll(A).call(A,i)}},{key:"updateOnly",value:function(e,g){var t,A=this;cl(e)||(e=[e]);var i=yl(t=yl(e).call(e,(function(e){var g=A._data.get(e[A._idProp]);if(null==g)throw new Error("Updating non-existent items is not allowed.");return{oldData:g,update:e}}))).call(t,(function(e){var g=e.oldData,t=e.update,i=g[A._idProp],C=function(e){for(var g,t=arguments.length,A=new Array(t>1?t-1:0),i=1;i<t;i++)A[i-1]=arguments[i];return $u.apply(void 0,ll(g=[{},e]).call(g,A))}(g,t);return A._data.set(i,C),{id:i,oldData:g,updatedData:C}}));if(i.length){var C={items:yl(i).call(i,(function(e){return e.id})),oldData:yl(i).call(i,(function(e){return e.oldData})),data:yl(i).call(i,(function(e){return e.updatedData}))};return this._trigger("update",C,g),C.items}return[]}},{key:"get",value:function(e,g){var t=void 0,A=void 0,i=void 0;Pb(e)?(t=e,i=g):cl(e)?(A=e,i=g):i=e;var C,I=i&&"Object"===i.returnType?"Object":"Array",n=i&&_d(i),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=Il(tb(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(i&&i.order&&null==t&&this._sort(o,i.order),i&&i.fields){var p=i.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!==(C=r)&&void 0!==C?C:null:o}},{key:"getIds",value:function(e){var g=this._data,t=e&&_d(e),A=e&&e.order,i=Il(tb(g).call(g)),C=[];if(t)if(A){for(var I=[],n=0,o=i.length;n<o;n++){var r=i[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++)C.push(I[a][this._idProp])}else for(var d=0,h=i.length;d<h;d++){var c=i[d],u=this._data.get(c);null!=u&&t(u)&&C.push(u[this._idProp])}else if(A){for(var p=[],f=0,v=i.length;f<v;f++){var m=i[f];p.push(g.get(m))}this._sort(p,A);for(var y=0,b=p.length;y<b;y++)C.push(p[y][this._idProp])}else for(var w=0,k=i.length;w<k;w++){var x=i[w],E=g.get(x);null!=E&&C.push(E[this._idProp])}return C}},{key:"getDataSet",value:function(){return this}},{key:"forEach",value:function(e,g){var t=g&&_d(g),A=this._data,i=Il(tb(A).call(A));if(g&&g.order)for(var C=this.get(g),I=0,n=C.length;I<n;I++){var o=C[I];e(o,o[this._idProp])}else for(var r=0,s=i.length;r<s;r++){var a=i[r],l=this._data.get(a);null==l||t&&!t(l)||e(l,a)}}},{key:"map",value:function(e,g){for(var t=g&&_d(g),A=[],i=this._data,C=Il(tb(i).call(i)),I=0,n=C.length;I<n;I++){var o=C[I],r=this._data.get(o);null==r||t&&!t(r)||A.push(e(r,o))}return g&&g.order&&this._sort(A,g.order),A}},{key:"_filterFields",value:function(e,g){var t;return e?qm(t=cl(g)?g:kl(g)).call(t,(function(g,t){return g[t]=e[t],g}),{}):e}},{key:"_sort",value:function(e,g){if("string"==typeof g){var t=g;Hy(e).call(e,(function(e,g){var A=e[t],i=g[t];return A>i?1:A<i?-1:0}))}else{if("function"!=typeof g)throw new TypeError("Order must be a function or a string");Hy(e).call(e,g)}}},{key:"remove",value:function(e,g){for(var t=[],A=[],i=cl(e)?e:[e],C=0,I=i.length;C<I;C++){var n=this._remove(i[C]);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},g),t}},{key:"_remove",value:function(e){var g;if(Pb(e)?g=e:e&&"object"===Cl(e)&&(g=e[this._idProp]),null!=g&&this._data.has(g)){var t=this._data.get(g)||null;return this._data.delete(g),--this.length,t}return null}},{key:"clear",value:function(e){for(var g,t=Il(tb(g=this._data).call(g)),A=[],i=0,C=t.length;i<C;i++)A.push(this._data.get(t[i]));return this._data.clear(),this.length=0,this._trigger("remove",{items:t,oldData:A},e),t}},{key:"max",value:function(e){var g,t,A=null,i=null,C=Nb(sb(g=this._data).call(g));try{for(C.s();!(t=C.n()).done;){var I=t.value,n=I[e];"number"==typeof n&&(null==i||n>i)&&(A=I,i=n)}}catch(e){C.e(e)}finally{C.f()}return A||null}},{key:"min",value:function(e){var g,t,A=null,i=null,C=Nb(sb(g=this._data).call(g));try{for(C.s();!(t=C.n()).done;){var I=t.value,n=I[e];"number"==typeof n&&(null==i||n<i)&&(A=I,i=n)}}catch(e){C.e(e)}finally{C.f()}return A||null}},{key:"distinct",value:function(e){for(var g=this._data,t=Il(tb(g).call(g)),A=[],i=0,C=0,I=t.length;C<I;C++){for(var n=t[C],o=g.get(n)[e],r=!1,s=0;s<i;s++)if(A[s]==o){r=!0;break}r||void 0===o||(A[i]=o,i++)}return A}},{key:"_addItem",value:function(e){var g=function(e,g){return null==e[g]&&(e[g]=Eb()),e}(e,this._idProp),t=g[this._idProp];if(this._data.has(t))throw new Error("Cannot add item: item with id "+t+" already exists");return this._data.set(t,g),++this.length,t}},{key:"_updateItem",value:function(e){var g=e[this._idProp];if(null==g)throw new Error("Cannot update item: item has no id (item: "+ic(e)+")");var t=this._data.get(g);if(!t)throw new Error("Cannot update item: no item with id "+g+" found");return this._data.set(g,Tb(Tb({},t),e)),g}},{key:"stream",value:function(e){if(e){var g=this._data;return new Bb(Ia({},sy,zm.mark((function t(){var A,i,C,I;return zm.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:A=Nb(e),t.prev=1,A.s();case 3:if((i=A.n()).done){t.next=11;break}if(C=i.value,null==(I=g.get(C))){t.next=9;break}return t.next=9,[C,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 Bb(Ia({},sy,JA(t=fb(this._data)).call(t,this._data)))}}]),t}();function Fb(e,g){return"object"===Cl(g)&&null!==g&&e===g.idProp&&"function"==typeof Ll(g)&&"function"==typeof g.get&&"function"==typeof g.getDataSet&&"function"==typeof g.getIds&&"number"==typeof g.length&&"function"==typeof yl(g)&&"function"==typeof g.off&&"function"==typeof g.on&&"function"==typeof g.stream&&function(e,g){return"object"===Cl(g)&&null!==g&&e===g.idProp&&"function"==typeof g.add&&"function"==typeof g.clear&&"function"==typeof g.distinct&&"function"==typeof Ll(g)&&"function"==typeof g.get&&"function"==typeof g.getDataSet&&"function"==typeof g.getIds&&"number"==typeof g.length&&"function"==typeof yl(g)&&"function"==typeof g.max&&"function"==typeof g.min&&"function"==typeof g.off&&"function"==typeof g.on&&"function"==typeof g.remove&&"function"==typeof g.setOptions&&"function"==typeof g.stream&&"function"==typeof g.update&&"function"==typeof g.updateOnly}(e,g.getDataSet())}var Zb=O,jb=T,Gb=vi,Lb=oh.trim,Vb=G("".charAt),Yb=Zb.parseFloat,Wb=Zb.Symbol,_b=Wb&&Wb.iterator,Ub=1/Yb("\t\n\v\f\r                　\u2028\u2029\ufeff-0")!=-1/0||_b&&!jb((function(){Yb(Object(_b))}))?function(e){var g=Lb(Gb(e)),t=Yb(g);return 0===t&&"-"==Vb(g,0)?-0:t}:Yb;Vt({global:!0,forced:parseFloat!=Ub},{parseFloat:Ub});var Qb=pe.parseFloat,Hb=Vt,Kb=T,Xb=mo.f;Hb({target:"Object",stat:!0,forced:Kb((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:Xb});var Jb=pe.Object,qb=function(e){return Jb.getOwnPropertyNames(e)};function $b(e,g){var t=["node","edge","label"],A=!0,i=Fp(g,"chosen");if("boolean"==typeof i)A=i;else if("object"===Cl(i)){if(-1===Rh(t).call(t,e))throw new Error("choosify: subOption '"+e+"' should be one of '"+t.join("', '")+"'");var C=Fp(g,["chosen",e]);"boolean"!=typeof C&&"function"!=typeof C||(A=C)}return A}function ew(e,g,t){if(e.width<=0||e.height<=0)return!1;if(void 0!==t){var A={x:g.x-t.x,y:g.y-t.y};if(0!==t.angle){var i=-t.angle;g={x:Math.cos(i)*A.x-Math.sin(i)*A.y,y:Math.sin(i)*A.x+Math.cos(i)*A.y}}else g=A}var C=e.x+e.width,I=e.y+e.width;return e.left<g.x&&C>g.x&&e.top<g.y&&I>g.y}function gw(e){return"string"==typeof e&&""!==e}function tw(e,g,t,A){var i=A.x,C=A.y;if("function"==typeof A.distanceToBorder){var I=A.distanceToBorder(e,g),n=Math.sin(g)*I,o=Math.cos(g)*I;o===I?(i+=I,C=A.y):n===I?(i=A.x,C-=I):(i+=o,C-=n)}else A.shape.width>A.shape.height?(i=A.x+.5*A.shape.width,C=A.y-t):(i=A.x+t,C=A.y-.5*A.shape.height);return{x:i,y:C}}var Aw=function(){function e(g){ta(this,e),this.measureText=g,this.current=0,this.width=0,this.height=0,this.lines=[]}return Ca(e,[{key:"_add",value:function(e,g){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";void 0===this.lines[e]&&(this.lines[e]={width:0,height:0,blocks:[]});var A=g;void 0!==g&&""!==g||(A=" ");var i=this.measureText(A,t),C=NA({},sb(i));C.text=g,C.width=i.width,C.mod=t,void 0!==g&&""!==g||(C.width=0),this.lines[e].blocks.push(C),this.lines[e].width+=C.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return void 0===e?0:e.width}},{key:"append",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,g)}},{key:"newLine",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,g),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;e<this.lines.length;e++){var g=this.lines[e],t=0;if(void 0!==g.blocks)for(var A=0;A<g.blocks.length;A++){var i=g.blocks[A];t<i.height&&(t=i.height)}g.height=t}}},{key:"determineLabelSize",value:function(){for(var e=0,g=0,t=0;t<this.lines.length;t++){var A=this.lines[t];A.width>e&&(e=A.width),g+=A.height}this.width=e,this.height=g}},{key:"removeEmptyBlocks",value:function(){for(var e=[],g=0;g<this.lines.length;g++){var t=this.lines[g];if(0!==t.blocks.length&&(g!==this.lines.length-1||0!==t.width)){var A={};NA(A,t),A.blocks=[];for(var i=void 0,C=[],I=0;I<t.blocks.length;I++){var n=t.blocks[I];0!==n.width?C.push(n):void 0===i&&(i=n)}0===C.length&&void 0!==i&&C.push(i),A.blocks=C,e.push(A)}}return e}},{key:"finalize",value:function(){this.determineLineHeights(),this.determineLabelSize();var e=this.removeEmptyBlocks();return{width:this.width,height:this.height,lines:e}}}]),e}(),iw={"<b>":/<b>/,"<i>":/<i>/,"<code>":/<code>/,"</b>":/<\/b>/,"</i>":/<\/i>/,"</code>":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},Cw=function(){function e(g){ta(this,e),this.text=g,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return Ca(e,[{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(e){" "===e&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=e&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return!!/[ \t]/.test(e)&&(this.mono?this.add(e):this.spacing=!0,!0)}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,g){return!(this.mono||this[e]||!this.match(g))&&(this.setTag(e),!0)}},{key:"match",value:function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this.prepareRegExp(e),A=tl(t,2),i=A[0],C=A[1],I=i.test(this.text.substr(this.position,C));return I&&g&&(this.position+=C-1),I}},{key:"parseEndTag",value:function(e,g,t){var A=this.mod()===e;return!(!(A="mono"===e?A&&this.mono:A&&!this.mono)||!this.match(g))&&(void 0!==t?(this.position===this.text.length-1||this.match(t,!1))&&this.unsetTag(e):this.unsetTag(e),!0)}},{key:"replace",value:function(e,g){return!!this.match(e)&&(this.add(g),this.position+=length-1,!0)}},{key:"prepareRegExp",value:function(e){var g,t;if(e instanceof RegExp)t=e,g=1;else{var A=iw[e];t=void 0!==A?A:new RegExp(e),g=e.length}return[t,g]}}]),e}(),Iw=function(){function e(g,t,A,i){var C=this;ta(this,e),this.ctx=g,this.parent=t,this.selected=A,this.hover=i;this.lines=new Aw((function(e,t){if(void 0===e)return 0;var I=C.parent.getFormattingValues(g,A,i,t),n=0;""!==e&&(n=C.ctx.measureText(e).width);return{width:n,values:I}}))}return Ca(e,[{key:"process",value:function(e){if(!gw(e))return this.lines.finalize();var g=this.parent.fontOptions;e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n");var t=String(e).split("\n"),A=t.length;if(g.multi)for(var i=0;i<A;i++){var C=this.splitBlocks(t[i],g.multi);if(void 0!==C)if(0!==C.length){if(g.maxWdt>0)for(var I=0;I<C.length;I++){var n=C[I].mod,o=C[I].text;this.splitStringIntoLines(o,n,!0)}else for(var r=0;r<C.length;r++){var s=C[r].mod,a=C[r].text;this.lines.append(a,s)}this.lines.newLine()}else this.lines.newLine("")}else if(g.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(e){var g="none";return"markdown"===e||"md"===e?g="markdown":!0!==e&&"html"!==e||(g="html"),g}},{key:"splitHtmlBlocks",value:function(e){for(var g=new Cw(e),t=function(e){return!!/&/.test(e)&&(g.replace(g.text,"&lt;","<")||g.replace(g.text,"&amp;","&")||g.add("&"),!0)};g.position<g.text.length;){var A=g.text.charAt(g.position);g.parseWS(A)||/</.test(A)&&(g.parseStartTag("bold","<b>")||g.parseStartTag("ital","<i>")||g.parseStartTag("mono","<code>")||g.parseEndTag("bold","</b>")||g.parseEndTag("ital","</i>")||g.parseEndTag("mono","</code>"))||t(A)||g.add(A),g.position++}return g.emitBlock(),g.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var g=this,t=new Cw(e),A=!0,i=function(e){return!!/\\/.test(e)&&(t.position<g.text.length+1&&(t.position++,e=g.text.charAt(t.position),/ \t/.test(e)?t.spacing=!0:(t.add(e),A=!1)),!0)};t.position<t.text.length;){var C=t.text.charAt(t.position);t.parseWS(C)||i(C)||(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(C),A=!1),t.position++}return t.emitBlock(),t.blocks}},{key:"splitBlocks",value:function(e,g){var t=this.decodeMarkupSystem(g);return"none"===t?[{text:e,mod:"normal"}]:"markdown"===t?this.splitMarkdownBlocks(e):"html"===t?this.splitHtmlBlocks(e):void 0}},{key:"overMaxWidth",value:function(e){var g=this.ctx.measureText(e).width;return this.lines.curWidth()+g>this.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var g="",t=0;t<e.length;){var A=g+(""===g?"":" ")+e[t];if(this.overMaxWidth(A))break;g=A,t++}return t}},{key:"getLongestFitWord",value:function(e){for(var g=0;g<e.length&&!this.overMaxWidth(dl(e).call(e,0,g));)g++;return g}},{key:"splitStringIntoLines",value:function(e){var g=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,g);for(var A=(e=(e=e.replace(/^( +)/g,"$1\r")).replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r")).split("\r");A.length>0;){var i=this.getLongestFit(A);if(0===i){var C=A[0],I=this.getLongestFitWord(C);this.lines.newLine(dl(C).call(C,0,I),g),A[0]=dl(C).call(C,I)}else{var n=i;" "===A[i-1]?i--:" "===A[n]&&n++;var o=dl(A).call(A,0,i).join("");i==A.length&&t?this.lines.append(o,g):this.lines.newLine(o,g),A=dl(A).call(A,n)}}}}]),e}(),nw=["bold","ital","boldital","mono"],ow=function(){function e(g,t){var A=arguments.length>2&&void 0!==arguments[2]&&arguments[2];ta(this,e),this.body=g,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 Ca(e,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),gw(e.label)?this.labelDirty=!0:e.label=void 0,void 0!==e.font&&null!==e.font)if("string"==typeof e.font)this.baseSize=this.fontOptions.size;else if("object"===Cl(e.font)){var g=e.font.size;void 0!==g&&(this.baseSize=g)}}},{key:"initFontOptions",value:function(g){var t=this;wp(nw,(function(e){t.fontOptions[e]={}})),e.parseFontString(this.fontOptions,g)?this.fontOptions.vadjust=0:wp(g,(function(e,g){null!=e&&"object"!==Cl(e)&&(t.fontOptions[g]=e)}))}},{key:"constrain",value:function(e){var g={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},t=Fp(e,"widthConstraint");if("number"==typeof t)g.maxWdt=Number(t),g.minWdt=Number(t);else if("object"===Cl(t)){var A=Fp(e,["widthConstraint","maximum"]);"number"==typeof A&&(g.maxWdt=Number(A));var i=Fp(e,["widthConstraint","minimum"]);"number"==typeof i&&(g.minWdt=Number(i))}var C=Fp(e,"heightConstraint");if("number"==typeof C)g.minHgt=Number(C);else if("object"===Cl(C)){var I=Fp(e,["heightConstraint","minimum"]);"number"==typeof I&&(g.minHgt=Number(I));var n=Fp(e,["heightConstraint","valign"]);"string"==typeof n&&("top"!==n&&"bottom"!==n||(g.valign=n))}return g}},{key:"update",value:function(e,g){this.setOptions(e,!0),this.propagateFonts(g),vp(this.fontOptions,this.constrain(g)),this.fontOptions.chooser=$b("label",g)}},{key:"adjustSizes",value:function(e){var g=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=g,this.fontOptions.minWdt-=g);var t=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=t)}},{key:"addFontOptionsToPile",value:function(e,g){for(var t=0;t<g.length;++t)this.addFontToPile(e,g[t])}},{key:"addFontToPile",value:function(e,g){if(void 0!==g&&void 0!==g.font&&null!==g.font){var t=g.font;e.push(t)}}},{key:"getBasicOptions",value:function(g){for(var t={},A=0;A<g.length;++A){var i=g[A],C={};e.parseFontString(C,i)&&(i=C),wp(i,(function(e,g){void 0!==e&&(Object.prototype.hasOwnProperty.call(t,g)||(-1!==Rh(nw).call(nw,g)?t[g]={}:t[g]=e))}))}return t}},{key:"getFontOption",value:function(g,t,A){for(var i,C=0;C<g.length;++C){var I=g[C];if(Object.prototype.hasOwnProperty.call(I,t)){if(null==(i=I[t]))continue;var n={};if(e.parseFontString(n,i)&&(i=n),Object.prototype.hasOwnProperty.call(i,A))return i[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(e,g){for(var t={},A=["color","size","face","mod","vadjust"],i=0;i<A.length;++i){var C=A[i];t[C]=this.getFontOption(e,g,C)}return t}},{key:"propagateFonts",value:function(e){var g=this,t=[];this.addFontOptionsToPile(t,e),this.fontOptions=this.getBasicOptions(t);for(var A=function(e){var A=nw[e],i=g.fontOptions[A];wp(g.getFontOptions(t,A),(function(e,g){i[g]=e})),i.size=Number(i.size),i.vadjust=Number(i.vadjust)},i=0;i<nw.length;++i)A(i)}},{key:"draw",value:function(e,g,t,A,i){var C=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(e,A,i,g,t,C),this._drawBackground(e),this._drawText(e,g,this.size.yLine,C,I))}}},{key:"_drawBackground",value:function(e){if(void 0!==this.fontOptions.background&&"none"!==this.fontOptions.background){e.fillStyle=this.fontOptions.background;var g=this.getSize();e.fillRect(g.left,g.top,g.width,g.height)}}},{key:"_drawText",value:function(e,g,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle",i=arguments.length>4?arguments[4]:void 0,C=this._setAlignment(e,g,t,A),I=tl(C,2);g=I[0],t=I[1],e.textAlign="left",g-=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];e.font=a.font;var l=this._getColor(a.color,i,a.strokeColor),d=tl(l,2),h=d[0],c=d[1];a.strokeWidth>0&&(e.lineWidth=a.strokeWidth,e.strokeStyle=c,e.lineJoin="round"),e.fillStyle=h,a.strokeWidth>0&&e.strokeText(a.text,g+r,t+a.vadjust),e.fillText(a.text,g+r,t+a.vadjust),r+=a.width}t+=o.height}}}},{key:"_setAlignment",value:function(e,g,t,A){if(this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&!1===this.pointToSelf){g=0,t=0;"top"===this.fontOptions.align?(e.textBaseline="alphabetic",t-=4):"bottom"===this.fontOptions.align?(e.textBaseline="hanging",t+=4):e.textBaseline="middle"}else e.textBaseline=A;return[g,t]}},{key:"_getColor",value:function(e,g,t){var A=e||"#000000",i=t||"#ffffff";if(g<=this.elementOptions.scaling.label.drawThreshold){var C=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-g)));A=xp(A,C),i=xp(i,C)}return[A,i]}},{key:"getTextSize",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._processLabel(e,g,t),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=this.size.left,g=this.size.top-1;if(this.isEdgeLabel){var t=.5*-this.size.width;switch(this.fontOptions.align){case"middle":e=t,g=.5*-this.size.height;break;case"top":e=t,g=-(this.size.height+2);break;case"bottom":e=t,g=2}}return{left:e,top:g,width:this.size.width,height:this.size.height}}},{key:"calculateLabelSize",value:function(e,g,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,C=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";this._processLabel(e,g,t),this.size.left=A-.5*this.size.width,this.size.top=i-.5*this.size.height,this.size.yLine=i+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===C&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,g,t,A){var i=function(e,g,t){return"normal"===g?"mod"===t?"":e[t]:void 0!==e[g][t]?e[g][t]:e[t]},C={color:i(this.fontOptions,A,"color"),size:i(this.fontOptions,A,"size"),face:i(this.fontOptions,A,"face"),mod:i(this.fontOptions,A,"mod"),vadjust:i(this.fontOptions,A,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(g||t)&&("normal"===A&&!0===this.fontOptions.chooser&&this.elementOptions.labelHighlightBold?C.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(C,this.elementOptions.id,g,t));var I="";return void 0!==C.mod&&""!==C.mod&&(I+=C.mod+" "),I+=C.size+"px "+C.face,e.font=I.replace(/"/g,""),C.font=e.font,C.height=C.size,C}},{key:"differentState",value:function(e,g){return e!==this.selectedState||g!==this.hoverState}},{key:"_processLabelText",value:function(e,g,t,A){return new Iw(e,this,g,t).process(A)}},{key:"_processLabel",value:function(e,g,t){if(!1!==this.labelDirty||this.differentState(g,t)){var A=this._processLabelText(e,g,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=g,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(e,g){if(!g||"string"!=typeof g)return!1;var t=g.split(" ");return e.size=+t[0].replace("px",""),e.face=t[1],e.color=t[2],!0}}]),e}(),rw=function(){function e(g,t,A){ta(this,e),this.body=t,this.labelModule=A,this.setOptions(g),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 Ca(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"_setMargins",value:function(e){this.margin={},this.options.margin&&("object"==Cl(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)),e.adjustSizes(this.margin)}},{key:"_distanceToBorder",value:function(e,g){var t=this.options.borderWidth;return e&&this.resize(e),Math.min(Math.abs(this.width/2/Math.cos(g)),Math.abs(this.height/2/Math.sin(g)))+t}},{key:"enableShadow",value:function(e,g){g.shadow&&(e.shadowColor=g.shadowColor,e.shadowBlur=g.shadowSize,e.shadowOffsetX=g.shadowX,e.shadowOffsetY=g.shadowY)}},{key:"disableShadow",value:function(e,g){g.shadow&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"enableBorderDashes",value:function(e,g){if(!1!==g.borderDashes)if(void 0!==e.setLineDash){var t=g.borderDashes;!0===t&&(t=[5,15]),e.setLineDash(t)}else console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,g.borderDashes=!1}},{key:"disableBorderDashes",value:function(e,g){!1!==g.borderDashes&&(void 0!==e.setLineDash?e.setLineDash([0]):(console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,g.borderDashes=!1))}},{key:"needsRefresh",value:function(e,g){return!0===this.refreshNeeded?(this.refreshNeeded=!1,!0):void 0===this.width||this.labelModule.differentState(e,g)}},{key:"initContextForDraw",value:function(e,g){var t=g.borderWidth/this.body.view.scale;e.lineWidth=Math.min(this.width,t),e.strokeStyle=g.borderColor,e.fillStyle=g.color}},{key:"performStroke",value:function(e,g){var t=g.borderWidth/this.body.view.scale;e.save(),t>0&&(this.enableBorderDashes(e,g),e.stroke(),this.disableBorderDashes(e,g)),e.restore()}},{key:"performFill",value:function(e,g){e.save(),e.fillStyle=g.color,this.enableShadow(e,g),wc(e).call(e),this.disableShadow(e,g),e.restore(),this.performStroke(e,g)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,g,t,A,i){void 0!==t&&this.resize(t,A,i),this.left=e-this.width/2,this.top=g-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(e,g,t,A,i){this._updateBoundingBox(e,g,t,A,i)}},{key:"getDimensionsFromLabel",value:function(e,g,t){this.textSize=this.labelModule.getTextSize(e,g,t);var A=this.textSize.width,i=this.textSize.height;return 0===A&&(A=14,i=14),{width:A,height:i}}}]),e}();function sw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var aw=function(e){Rm(t,rw);var g=sw(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i))._setMargins(i),C}return Ca(t,[{key:"resize",value:function(e){var g=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(g,t)){var A=this.getDimensionsFromLabel(e,g,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(e,g,t,A,i,C){this.resize(e,A,i),this.left=g-this.width/2,this.top=t-this.height/2,this.initContextForDraw(e,C),$A(e,this.left,this.top,this.width,this.height,C.borderRadius),this.performFill(e,C),this.updateBoundingBox(g,t,e,A,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,A,i)}},{key:"updateBoundingBox",value:function(e,g,t,A,i){this._updateBoundingBox(e,g,t,A,i);var C=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(C)}},{key:"distanceToBorder",value:function(e,g){e&&this.resize(e);var t=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(g)),Math.abs(this.height/2/Math.sin(g)))+t}}]),t}();function lw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var dw=function(e){Rm(t,rw);var g=lw(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i)).labelOffset=0,C.selected=!1,C}return Ca(t,[{key:"setOptions",value:function(e,g,t){this.options=e,void 0===g&&void 0===t||this.setImages(g,t)}},{key:"setImages",value:function(e,g){g&&this.selected?(this.imageObj=g,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=g)}},{key:"switchImages",value:function(e){var g=e&&!this.selected||!e&&this.selected;if(this.selected=e,void 0!==this.imageObjAlt&&g){var t=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=t}}},{key:"_getImagePadding",value:function(){var e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var g=this.options.imagePadding;"object"==Cl(g)?(e.top=g.top,e.right=g.right,e.bottom=g.bottom,e.left=g.left):(e.top=g,e.right=g,e.bottom=g,e.left=g)}return e}},{key:"_resizeImage",value:function(){var e,g;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),e=2*this.options.size*t,g=2*this.options.size*A}else{var i=this._getImagePadding();e=this.imageObj.width+i.left+i.right,g=this.imageObj.height+i.top+i.bottom}this.width=e,this.height=g,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(e,g,t,A){this.initContextForDraw(e,A),qA(e,g,t,A.size),this.performFill(e,A)}},{key:"_drawImageAtPosition",value:function(e,g){if(0!=this.imageObj.width){e.globalAlpha=void 0!==g.opacity?g.opacity:1,this.enableShadow(e,g);var t=1;!0===this.options.shapeProperties.interpolation&&(t=this.imageObj.width/this.width/this.body.view.scale);var A=this._getImagePadding(),i=this.left+A.left,C=this.top+A.top,I=this.width-A.left-A.right,n=this.height-A.top-A.bottom;this.imageObj.drawImageAtPosition(e,t,i,C,I,n),this.disableShadow(e,g)}}},{key:"_drawImageLabel",value:function(e,g,t,A,i){var C=0;if(void 0!==this.height){C=.5*this.height;var I=this.labelModule.getTextSize(e,A,i);I.lineCount>=1&&(C+=I.height/2)}var n=t+C;this.options.label&&(this.labelOffset=C),this.labelModule.draw(e,g,n,A,i,"hanging")}}]),t}();function hw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var cw=function(e){Rm(t,dw);var g=hw(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i))._setMargins(i),C}return Ca(t,[{key:"resize",value:function(e){var g=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(g,t)){var A=this.getDimensionsFromLabel(e,g,t),i=Math.max(A.width+this.margin.right+this.margin.left,A.height+this.margin.top+this.margin.bottom);this.options.size=i/2,this.width=i,this.height=i,this.radius=this.width/2}}},{key:"draw",value:function(e,g,t,A,i,C){this.resize(e,A,i),this.left=g-this.width/2,this.top=t-this.height/2,this._drawRawCircle(e,g,t,C),this.updateBoundingBox(g,t),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,t,A,i)}},{key:"updateBoundingBox",value:function(e,g){this.boundingBox.top=g-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=g+this.options.size}},{key:"distanceToBorder",value:function(e){return e&&this.resize(e),.5*this.width}}]),t}();function uw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var pw=function(e){Rm(t,dw);var g=uw(t);function t(e,A,i,C,I){var n;return ta(this,t),(n=g.call(this,e,A,i)).setImages(C,I),n}return Ca(t,[{key:"resize",value:function(e){var g=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 i=2*this.options.size;return this.width=i,this.height=i,void(this.radius=.5*this.width)}this.needsRefresh(g,t)&&this._resizeImage()}},{key:"draw",value:function(e,g,t,A,i,C){this.switchImages(A),this.resize();var I=g,n=t;"top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=g,this.top=t,I+=this.width/2,n+=this.height/2):(this.left=g-this.width/2,this.top=t-this.height/2),this._drawRawCircle(e,I,n,C),e.save(),e.clip(),this._drawImageAtPosition(e,C),e.restore(),this._drawImageLabel(e,I,n,A,i),this.updateBoundingBox(g,t)}},{key:"updateBoundingBox",value:function(e,g){"top-left"===this.options.shapeProperties.coordinateOrigin?(this.boundingBox.top=g,this.boundingBox.left=e,this.boundingBox.right=e+2*this.options.size,this.boundingBox.bottom=g+2*this.options.size):(this.boundingBox.top=g-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=g+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(e){return e&&this.resize(e),.5*this.width}}]),t}();function fw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var vw=function(e){Rm(t,rw);var g=fw(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"resize",value:function(e){var g=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(g,t)){var i,C;this.labelModule.getTextSize(e,g,t);var I=2*A.size;this.width=null!==(i=this.customSizeWidth)&&void 0!==i?i:I,this.height=null!==(C=this.customSizeHeight)&&void 0!==C?C:I,this.radius=.5*this.width}}},{key:"_drawShape",value:function(e,g,t,A,i,C,I,n){var o,r=this;return this.resize(e,C,I,n),this.left=A-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,n),(o=g,Object.prototype.hasOwnProperty.call(Ai,o)?Ai[o]:function(e){for(var g=arguments.length,t=new Array(g>1?g-1:0),A=1;A<g;A++)t[A-1]=arguments[A];CanvasRenderingContext2D.prototype[o].call(e,t)})(e,A,i,n.size),this.performFill(e,n),void 0!==this.options.icon&&void 0!==this.options.icon.code&&(e.font=(C?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",e.fillText(this.options.icon.code,A,i)),{drawExternalLabel:function(){if(void 0!==r.options.label){r.labelModule.calculateLabelSize(e,C,I,A,i,"hanging");var g=i+.5*r.height+.5*r.labelModule.size.height;r.labelModule.draw(e,A,g,C,I,"hanging")}r.updateBoundingBox(A,i)}}}},{key:"updateBoundingBox",value:function(e,g){this.boundingBox.top=g-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=g+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 mw(e,g){var t=kl(e);if(fs){var A=fs(e);g&&(A=_d(A).call(A,(function(g){return Ds(e,g).enumerable}))),t.push.apply(t,A)}return t}function yw(e){for(var g=1;g<arguments.length;g++){var t,A,i=null!=arguments[g]?arguments[g]:{};g%2?Ll(t=mw(Object(i),!0)).call(t,(function(g){Ia(e,g,i[g])})):Gs?Qs(e,Gs(i)):Ll(A=mw(Object(i))).call(A,(function(g){ga(e,g,Ds(i,g))}))}return e}function bw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var ww=function(e){Rm(t,vw);var g=bw(t);function t(e,A,i,C){var I;return ta(this,t),(I=g.call(this,e,A,i,C)).ctxRenderer=C,I}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){this.resize(e,A,i,C),this.left=g-this.width/2,this.top=t-this.height/2,e.save();var I=this.ctxRenderer({ctx:e,id:this.options.id,x:g,y:t,state:{selected:A,hover:i},style:yw({},C),label:this.options.label});if(null!=I.drawNode&&I.drawNode(),e.restore(),I.drawExternalLabel){var n=I.drawExternalLabel;I.drawExternalLabel=function(){e.save(),n(),e.restore()}}return I.nodeDimensions&&(this.customSizeWidth=I.nodeDimensions.width,this.customSizeHeight=I.nodeDimensions.height),I}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function kw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var xw=function(e){Rm(t,rw);var g=kw(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i))._setMargins(i),C}return Ca(t,[{key:"resize",value:function(e,g,t){if(this.needsRefresh(g,t)){var A=this.getDimensionsFromLabel(e,g,t).width+this.margin.right+this.margin.left;this.width=A,this.height=A,this.radius=this.width/2}}},{key:"draw",value:function(e,g,t,A,i,C){this.resize(e,A,i),this.left=g-this.width/2,this.top=t-this.height/2,this.initContextForDraw(e,C),gi(e,g-this.width/2,t-this.height/2,this.width,this.height),this.performFill(e,C),this.updateBoundingBox(g,t,e,A,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,A,i)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Ew(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Ow=function(e){Rm(t,vw);var g=Ew(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){return this._drawShape(e,"diamond",4,g,t,A,i,C)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Tw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Dw=function(e){Rm(t,vw);var g=Tw(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){return this._drawShape(e,"circle",2,g,t,A,i,C)}},{key:"distanceToBorder",value:function(e){return e&&this.resize(e),this.options.size}}]),t}();function Nw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Rw=function(e){Rm(t,rw);var g=Nw(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"resize",value:function(e){var g=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(g,t)){var A=this.getDimensionsFromLabel(e,g,t);this.height=2*A.height,this.width=A.width+A.height,this.radius=.5*this.width}}},{key:"draw",value:function(e,g,t,A,i,C){this.resize(e,A,i),this.left=g-.5*this.width,this.top=t-.5*this.height,this.initContextForDraw(e,C),ei(e,this.left,this.top,this.width,this.height),this.performFill(e,C),this.updateBoundingBox(g,t,e,A,i),this.labelModule.draw(e,g,t,A,i)}},{key:"distanceToBorder",value:function(e,g){e&&this.resize(e);var t=.5*this.width,A=.5*this.height,i=Math.sin(g)*t,C=Math.cos(g)*A;return t*A/Math.sqrt(i*i+C*C)}}]),t}();function Pw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Sw=function(e){Rm(t,rw);var g=Pw(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i))._setMargins(i),C}return Ca(t,[{key:"resize",value:function(e,g,t){this.needsRefresh(g,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(e,g,t,A,i,C){var I=this;return this.resize(e,A,i),this.options.icon.size=this.options.icon.size||50,this.left=g-this.width/2,this.top=t-this.height/2,this._icon(e,g,t,A,i,C),{drawExternalLabel:function(){if(void 0!==I.options.label){I.labelModule.draw(e,I.left+I.iconSize.width/2+I.margin.left,t+I.height/2+5,A)}I.updateBoundingBox(g,t)}}}},{key:"updateBoundingBox",value:function(e,g){if(this.boundingBox.top=g-.5*this.options.icon.size,this.boundingBox.left=e-.5*this.options.icon.size,this.boundingBox.right=e+.5*this.options.icon.size,this.boundingBox.bottom=g+.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(e,g,t,A,i,C){var I=Number(this.options.icon.size);void 0!==this.options.icon.code?(e.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(" "),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,C),e.fillText(this.options.icon.code,g,t),this.disableShadow(e,C)):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(e,g){return this._distanceToBorder(e,g)}}]),t}();function Mw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Bw=function(e){Rm(t,dw);var g=Mw(t);function t(e,A,i,C,I){var n;return ta(this,t),(n=g.call(this,e,A,i)).setImages(C,I),n}return Ca(t,[{key:"resize",value:function(e){var g=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 i=2*this.options.size;return this.width=i,void(this.height=i)}this.needsRefresh(g,t)&&this._resizeImage()}},{key:"draw",value:function(e,g,t,A,i,C){e.save(),this.switchImages(A),this.resize();var I=g,n=t;if("top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=g,this.top=t,I+=this.width/2,n+=this.height/2):(this.left=g-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;e.lineWidth=Math.min(this.width,s),e.beginPath();var a=A?this.options.color.highlight.border:i?this.options.color.hover.border:this.options.color.border,l=A?this.options.color.highlight.background:i?this.options.color.hover.background:this.options.color.background;void 0!==C.opacity&&(a=xp(a,C.opacity),l=xp(l,C.opacity)),e.strokeStyle=a,e.fillStyle=l,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),wc(e).call(e),this.performStroke(e,C),e.closePath()}this._drawImageAtPosition(e,C),this._drawImageLabel(e,I,n,A,i),this.updateBoundingBox(g,t),e.restore()}},{key:"updateBoundingBox",value:function(e,g){this.resize(),"top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=e,this.top=g):(this.left=e-this.width/2,this.top=g-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(e,g){return this._distanceToBorder(e,g)}}]),t}();function zw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Fw=function(e){Rm(t,vw);var g=zw(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){return this._drawShape(e,"square",2,g,t,A,i,C)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Zw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var jw=function(e){Rm(t,vw);var g=Zw(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){return this._drawShape(e,"hexagon",4,g,t,A,i,C)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Gw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Lw=function(e){Rm(t,vw);var g=Gw(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){return this._drawShape(e,"star",4,g,t,A,i,C)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Vw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Yw=function(e){Rm(t,rw);var g=Vw(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i))._setMargins(i),C}return Ca(t,[{key:"resize",value:function(e,g,t){this.needsRefresh(g,t)&&(this.textSize=this.labelModule.getTextSize(e,g,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(e,g,t,A,i,C){this.resize(e,A,i),this.left=g-this.width/2,this.top=t-this.height/2,this.enableShadow(e,C),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,A,i),this.disableShadow(e,C),this.updateBoundingBox(g,t,e,A,i)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Ww(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var _w=function(e){Rm(t,vw);var g=Ww(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){return this._drawShape(e,"triangle",3,g,t,A,i,C)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Uw(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Qw=function(e){Rm(t,vw);var g=Uw(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"draw",value:function(e,g,t,A,i,C){return this._drawShape(e,"triangleDown",3,g,t,A,i,C)}},{key:"distanceToBorder",value:function(e,g){return this._distanceToBorder(e,g)}}]),t}();function Hw(e,g){var t=kl(e);if(fs){var A=fs(e);g&&(A=_d(A).call(A,(function(g){return Ds(e,g).enumerable}))),t.push.apply(t,A)}return t}function Kw(e){for(var g=1;g<arguments.length;g++){var t,A,i=null!=arguments[g]?arguments[g]:{};g%2?Ll(t=Hw(Object(i),!0)).call(t,(function(g){Ia(e,g,i[g])})):Gs?Qs(e,Gs(i)):Ll(A=Hw(Object(i))).call(A,(function(g){ga(e,g,Ds(i,g))}))}return e}var Xw=function(){function e(g,t,A,i,C,I){ta(this,e),this.options=Mp(C),this.globalOptions=C,this.defaultOptions=I,this.body=t,this.edges=[],this.id=void 0,this.imagelist=A,this.grouplist=i,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 ow(this.body,this.options,!1),this.setOptions(g)}return Ca(e,[{key:"attachEdge",value:function(e){var g;-1===Rh(g=this.edges).call(g,e)&&this.edges.push(e)}},{key:"detachEdge",value:function(e){var g,t,A=Rh(g=this.edges).call(g,e);-1!=A&&dd(t=this.edges).call(t,A,1)}},{key:"setOptions",value:function(g){var t=this.options.shape;if(g){if(void 0!==g.color&&(this._localColor=g.color),void 0!==g.id&&(this.id=g.id),void 0===this.id)throw new Error("Node must have an id");e.checkMass(g,this.id),void 0!==g.x&&(null===g.x?(this.x=void 0,this.predefinedPosition=!1):(this.x=mh(g.x),this.predefinedPosition=!0)),void 0!==g.y&&(null===g.y?(this.y=void 0,this.predefinedPosition=!1):(this.y=mh(g.y),this.predefinedPosition=!0)),void 0!==g.size&&(this.baseSize=g.size),void 0!==g.value&&(g.value=Qb(g.value)),e.parseOptions(this.options,g,!0,this.globalOptions,this.grouplist);var A=[g,this.options,this.defaultOptions];return this.chooser=$b("node",A),this._load_images(),this.updateLabelModule(g),void 0!==g.opacity&&e.checkOpacity(g.opacity)&&(this.options.opacity=g.opacity),this.updateShape(t),void 0!==g.hidden||void 0!==g.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 e={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?e.borderWidth=this.options.borderWidthSelected:e.borderWidth*=2,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):"function"==typeof this.chooser&&(this.chooser(e,this.options.id,this.selected,this.hover),!1===e.shadow&&(e.shadowColor===this.options.shadow.color&&e.shadowSize===this.options.shadow.size&&e.shadowX===this.options.shadow.x&&e.shadowY===this.options.shadow.y||(e.shadow=!0))):e.shadow=this.options.shadow.enabled,void 0!==this.options.opacity){var g=this.options.opacity;e.borderColor=xp(e.borderColor,g),e.color=xp(e.color,g),e.shadowColor=xp(e.shadowColor,g)}return e}},{key:"updateLabelModule",value:function(g){void 0!==this.options.label&&null!==this.options.label||(this.options.label=""),e.updateGroupOptions(this.options,Kw(Kw({},g),{},{color:g&&g.color||this._localColor||void 0}),this.grouplist);var t=this.grouplist.get(this.options.group,!1),A=[g,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(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case"box":this.shape=new aw(this.options,this.body,this.labelModule);break;case"circle":this.shape=new cw(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new pw(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new ww(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new xw(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new Ow(this.options,this.body,this.labelModule);break;case"dot":this.shape=new Dw(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new Rw(this.options,this.body,this.labelModule);break;case"icon":this.shape=new Sw(this.options,this.body,this.labelModule);break;case"image":this.shape=new Bw(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new Fw(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new jw(this.options,this.body,this.labelModule);break;case"star":this.shape=new Lw(this.options,this.body,this.labelModule);break;case"text":this.shape=new Yw(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new _w(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new Qw(this.options,this.body,this.labelModule);break;default:this.shape=new Rw(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(e,g){return this.shape.distanceToBorder(e,g)}},{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(e,g,t){if(void 0!==this.options.value){var A=this.options.scaling.customScalingFunction(e,g,t,this.options.value),i=this.options.scaling.max-this.options.scaling.min;if(!0===this.options.scaling.label.enabled){var C=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+A*C}this.options.size=this.options.scaling.min+A*i}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}},{key:"draw",value:function(e){var g=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,g)||{}}},{key:"updateBoundingBox",value:function(e){this.shape.updateBoundingBox(this.x,this.y,e)}},{key:"resize",value:function(e){var g=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,g)}},{key:"getItemsOnPoint",value:function(e){var g=[];return this.labelModule.visible()&&ew(this.labelModule.getSize(),e)&&g.push({nodeId:this.id,labelId:0}),ew(this.shape.boundingBox,e)&&g.push({nodeId:this.id}),g}},{key:"isOverlappingWith",value:function(e){return this.shape.left<e.right&&this.shape.left+this.shape.width>e.left&&this.shape.top<e.bottom&&this.shape.top+this.shape.height>e.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.left<e.right&&this.shape.boundingBox.right>e.left&&this.shape.boundingBox.top<e.bottom&&this.shape.boundingBox.bottom>e.top}}],[{key:"checkOpacity",value:function(e){return 0<=e&&e<=1}},{key:"checkCoordinateOrigin",value:function(e){return void 0===e||"center"===e||"top-left"===e}},{key:"updateGroupOptions",value:function(g,t,A){var i;if(void 0!==A){var C=g.group;if(void 0!==t&&void 0!==t.group&&C!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");if("number"==typeof C||"string"==typeof C&&""!=C){var I=A.get(C);void 0!==I.opacity&&void 0===t.opacity&&(e.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=_d(i=qb(t)).call(i,(function(e){return null!=t[e]}));n.push("font"),fp(n,g,I),g.color=Op(g.color)}}}},{key:"parseOptions",value:function(g,t){var A=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},C=arguments.length>4?arguments[4]:void 0,I=["color","fixed","shadow"];if(fp(I,g,t,A),e.checkMass(t),void 0!==g.opacity&&(e.checkOpacity(g.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+g.opacity),g.opacity=void 0)),void 0!==t.opacity&&(e.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&&!e.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Bp(g,t,"shadow",i),void 0!==t.color&&null!==t.color){var n=Op(t.color);up(g.color,n)}else!0===A&&null===t.color&&(g.color=Mp(i.color));void 0!==t.fixed&&null!==t.fixed&&("boolean"==typeof t.fixed?(g.fixed.x=t.fixed,g.fixed.y=t.fixed):(void 0!==t.fixed.x&&"boolean"==typeof t.fixed.x&&(g.fixed.x=t.fixed.x),void 0!==t.fixed.y&&"boolean"==typeof t.fixed.y&&(g.fixed.y=t.fixed.y))),!0===A&&null===t.font&&(g.font=Mp(i.font)),e.updateGroupOptions(g,t,C),void 0!==t.scaling&&Bp(g.scaling,t.scaling,"label",i.scaling)}},{key:"checkMass",value:function(e,g){if(void 0!==e.mass&&e.mass<=0){var t="";void 0!==g&&(t=" in node id: "+g),console.error("%cNegative or zero mass disallowed"+t+", setting mass to 1.","background: #FFeeee; color: #dd0000"),e.mass=1}}}]),e}();function Jw(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return qw(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return qw(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function qw(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}var $w=function(){function e(g,t,A,i){var C,I=this;if(ta(this,e),this.body=g,this.images=t,this.groups=A,this.layoutEngine=i,this.body.functions.createNode=JA(C=this.create).call(C,this),this.nodesListeners={add:function(e,g){I.add(g.items)},update:function(e,g){I.update(g.items,g.data,g.oldData)},remove:function(e,g){I.remove(g.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(e,g,t,A){if(g===e)return.5;var i=1/(g-e);return Math.max(0,(A-e)*i)}},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=Mp(this.defaultOptions),this.bindEventListeners()}return Ca(e,[{key:"bindEventListeners",value:function(){var e,g,t=this;this.body.emitter.on("refreshNodes",JA(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",JA(g=this.refresh).call(g,this)),this.body.emitter.on("destroy",(function(){wp(t.nodesListeners,(function(e,g){t.body.data.nodes&&t.body.data.nodes.off(g,e)})),delete t.body.functions.createNode,delete t.nodesListeners.add,delete t.nodesListeners.update,delete t.nodesListeners.remove,delete t.nodesListeners}))}},{key:"setOptions",value:function(e){if(void 0!==e){if(Xw.parseOptions(this.options,e),void 0!==e.opacity&&(em(e.opacity)||!tm(e.opacity)||e.opacity<0||e.opacity>1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),void 0!==e.shape)for(var g in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,g)&&this.body.nodes[g].updateShape();if(void 0!==e.font||void 0!==e.widthConstraint||void 0!==e.heightConstraint)for(var t=0,A=kl(this.body.nodes);t<A.length;t++){var i=A[t];this.body.nodes[i].updateLabelModule(),this.body.nodes[i].needsRefresh()}if(void 0!==e.size)for(var C in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,C)&&this.body.nodes[C].needsRefresh();void 0===e.hidden&&void 0===e.physics||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=this.body.data.nodes;if(Fb("id",e))this.body.data.nodes=e;else if(cl(e))this.body.data.nodes=new zb,this.body.data.nodes.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.nodes=new zb}if(t&&wp(this.nodesListeners,(function(e,g){t.off(g,e)})),this.body.nodes={},this.body.data.nodes){var A=this;wp(this.nodesListeners,(function(e,g){A.body.data.nodes.on(g,e)}));var i=this.body.data.nodes.getIds();this.add(i,!0)}!1===g&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var g,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=[],i=0;i<e.length;i++){g=e[i];var C=this.body.data.nodes.get(g),I=this.create(C);A.push(I),this.body.nodes[g]=I}this.layoutEngine.positionInitially(A),!1===t&&this.body.emitter.emit("_dataChanged")}},{key:"update",value:function(e,g,t){for(var A=this.body.nodes,i=!1,C=0;C<e.length;C++){var I=e[C],n=A[I],o=g[C];void 0!==n?n.setOptions(o)&&(i=!0):(i=!0,n=this.create(o),A[I]=n)}i||void 0===t||(i=om(g).call(g,(function(e,g){var A=t[g];return A&&A.level!==e.level}))),!0===i?this.body.emitter.emit("_dataChanged"):this.body.emitter.emit("_dataUpdated")}},{key:"remove",value:function(e){for(var g=this.body.nodes,t=0;t<e.length;t++){delete g[e[t]]}this.body.emitter.emit("_dataChanged")}},{key:"create",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xw;return new g(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,g=arguments.length>0&&void 0!==arguments[0]&&arguments[0];wp(this.body.nodes,(function(t,A){var i=e.body.data.nodes.get(A);void 0!==i&&(!0===g&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(i))}))}},{key:"getPositions",value:function(e){var g={};if(void 0!==e){if(!0===cl(e)){for(var t=0;t<e.length;t++)if(void 0!==this.body.nodes[e[t]]){var A=this.body.nodes[e[t]];g[e[t]]={x:Math.round(A.x),y:Math.round(A.y)}}}else if(void 0!==this.body.nodes[e]){var i=this.body.nodes[e];g[e]={x:Math.round(i.x),y:Math.round(i.y)}}}else for(var C=0;C<this.body.nodeIndices.length;C++){var I=this.body.nodes[this.body.nodeIndices[C]];g[this.body.nodeIndices[C]]={x:Math.round(I.x),y:Math.round(I.y)}}return g}},{key:"getPosition",value:function(e){if(null==e)throw new TypeError("No id was specified for getPosition method.");if(null==this.body.nodes[e])throw new ReferenceError("NodeId provided for getPosition does not exist. Provided: ".concat(e));return{x:Math.round(this.body.nodes[e].x),y:Math.round(this.body.nodes[e].y)}}},{key:"storePositions",value:function(){var e,g=[],t=this.body.data.nodes.getDataSet(),A=Jw(t.get());try{for(A.s();!(e=A.n()).done;){var i=e.value,C=i.id,I=this.body.nodes[C],n=Math.round(I.x),o=Math.round(I.y);i.x===n&&i.y===o||g.push({id:C,x:n,y:o})}}catch(e){A.e(e)}finally{A.f()}t.update(g)}},{key:"getBoundingBox",value:function(e){if(void 0!==this.body.nodes[e])return this.body.nodes[e].shape.boundingBox}},{key:"getConnectedNodes",value:function(e,g){var t=[];if(void 0!==this.body.nodes[e])for(var A=this.body.nodes[e],i={},C=0;C<A.edges.length;C++){var I=A.edges[C];"to"!==g&&I.toId==A.id?void 0===i[I.fromId]&&(t.push(I.fromId),i[I.fromId]=!0):"from"!==g&&I.fromId==A.id&&void 0===i[I.toId]&&(t.push(I.toId),i[I.toId]=!0)}return t}},{key:"getConnectedEdges",value:function(e){var g=[];if(void 0!==this.body.nodes[e])for(var t=this.body.nodes[e],A=0;A<t.edges.length;A++)g.push(t.edges[A].id);else console.error("NodeId provided for getConnectedEdges does not exist. Provided: ",e);return g}},{key:"moveNode",value:function(e,g,t){var A=this;void 0!==this.body.nodes[e]?(this.body.nodes[e].x=Number(g),this.body.nodes[e].y=Number(t),cc((function(){A.body.emitter.emit("startSimulation")}),0)):console.error("Node id supplied to moveNode does not exist. Provided: ",e)}}]),e}(),ek=ag,gk=U,tk=ue,Ak=vt,ik=function(e){return void 0!==e&&(ek(e,"value")||ek(e,"writable"))},Ck=V,Ik=UC;Vt({target:"Reflect",stat:!0},{get:function e(g,t){var A,i,C=arguments.length<3?g:arguments[2];return Ak(g)===C?g[t]:(A=Ck.f(g,t))?ik(A)?A.value:void 0===A.get?void 0:gk(A.get,C):tk(i=Ik(g))?e(i,t,C):void 0}});var nk=pe.Reflect.get,ok=Ts;function rk(e,g){for(;!Object.prototype.hasOwnProperty.call(e,g)&&null!==(e=Mm(e)););return e}function sk(){return(sk="undefined"!=typeof Reflect&&nk?nk:function(e,g,t){var A=rk(e,g);if(A){var i=ok(A,g);return i.get?i.get.call(arguments.length<3?e:t):i.value}}).apply(this,arguments)}var ak=Vt,lk=Math.hypot,dk=Math.abs,hk=Math.sqrt;ak({target:"Math",stat:!0,forced:!!lk&&lk(1/0,NaN)!==1/0},{hypot:function(e,g){for(var t,A,i=0,C=0,I=arguments.length,n=0;C<I;)n<(t=dk(arguments[C++]))?(i=i*(A=n/t)*A+1,n=t):i+=t>0?(A=t/n)*A:t;return n===1/0?1/0:n*hk(i)}});var ck=pe.Math.hypot;function uk(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var pk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"transform",value:function(e,g){cl(e)||(e=[e]);for(var t=g.point.x,A=g.point.y,i=g.angle,C=g.length,I=0;I<e.length;++I){var n=e[I],o=n.x*Math.cos(i)-n.y*Math.sin(i),r=n.x*Math.sin(i)+n.y*Math.cos(i);n.x=t+C*o,n.y=A+C*r}}},{key:"drawPath",value:function(e,g){e.beginPath(),e.moveTo(g[0].x,g[0].y);for(var t=1;t<g.length;++t)e.lineTo(g[t].x,g[t].y);e.closePath()}}]),e}(),fk=function(e){Rm(t,pk);var g=uk(t);function t(){return ta(this,t),g.apply(this,arguments)}return Ca(t,null,[{key:"draw",value:function(e,g){if(g.image){e.save(),e.translate(g.point.x,g.point.y),e.rotate(Math.PI/2+g.angle);var t=null!=g.imageWidth?g.imageWidth:g.image.width,A=null!=g.imageHeight?g.imageHeight:g.image.height;g.image.drawImageAtPosition(e,1,-t/2,0,t,A),e.restore()}return!1}}]),t}(),vk=function(e){Rm(t,pk);var g=uk(t);function t(){return ta(this,t),g.apply(this,arguments)}return Ca(t,null,[{key:"draw",value:function(e,g){var t=[{x:0,y:0},{x:-1,y:.3},{x:-.9,y:0},{x:-1,y:-.3}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),t}(),mk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t=[{x:-1,y:0},{x:0,y:.3},{x:-.4,y:0},{x:0,y:-.3}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),e}(),yk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t={x:-.4,y:0};pk.transform(t,g),e.strokeStyle=e.fillStyle,e.fillStyle="rgba(0, 0, 0, 0)";var A=Math.PI,i=g.angle-A/2,C=g.angle+A/2;return e.beginPath(),e.arc(t.x,t.y,.4*g.length,i,C,!1),e.stroke(),!0}}]),e}(),bk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t={x:-.3,y:0};pk.transform(t,g),e.strokeStyle=e.fillStyle,e.fillStyle="rgba(0, 0, 0, 0)";var A=Math.PI,i=g.angle+A/2,C=g.angle+3*A/2;return e.beginPath(),e.arc(t.x,t.y,.4*g.length,i,C,!1),e.stroke(),!0}}]),e}(),wk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t=[{x:.02,y:0},{x:-1,y:.3},{x:-1,y:-.3}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),e}(),kk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t=[{x:0,y:.3},{x:0,y:-.3},{x:-1,y:0}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),e}(),xk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t={x:-.4,y:0};return pk.transform(t,g),qA(e,t.x,t.y,.4*g.length),!0}}]),e}(),Ek=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t=[{x:0,y:.5},{x:0,y:-.5},{x:-.15,y:-.5},{x:-.15,y:.5}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),e}(),Ok=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t=[{x:0,y:.3},{x:0,y:-.3},{x:-.6,y:-.3},{x:-.6,y:.3}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),e}(),Tk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t=[{x:0,y:0},{x:-.5,y:-.3},{x:-1,y:0},{x:-.5,y:.3}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),e}(),Dk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t=[{x:-1,y:.3},{x:-.5,y:0},{x:-1,y:-.3},{x:0,y:0}];return pk.transform(t,g),pk.drawPath(e,t),!0}}]),e}(),Nk=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"draw",value:function(e,g){var t;switch(g.type&&(t=g.type.toLowerCase()),t){case"image":return fk.draw(e,g);case"circle":return xk.draw(e,g);case"box":return Ok.draw(e,g);case"crow":return mk.draw(e,g);case"curve":return yk.draw(e,g);case"diamond":return Tk.draw(e,g);case"inv_curve":return bk.draw(e,g);case"triangle":return wk.draw(e,g);case"inv_triangle":return kk.draw(e,g);case"bar":return Ek.draw(e,g);case"vee":return Dk.draw(e,g);case"arrow":default:return vk.draw(e,g)}}}]),e}();function Rk(e,g){var t=kl(e);if(fs){var A=fs(e);g&&(A=_d(A).call(A,(function(g){return Ds(e,g).enumerable}))),t.push.apply(t,A)}return t}function Pk(e){for(var g=1;g<arguments.length;g++){var t,A,i=null!=arguments[g]?arguments[g]:{};g%2?Ll(t=Rk(Object(i),!0)).call(t,(function(g){Ia(e,g,i[g])})):Gs?Qs(e,Gs(i)):Ll(A=Rk(Object(i))).call(A,(function(g){ga(e,g,Ds(i,g))}))}return e}var Sk=function(){function e(g,t,A){ta(this,e),this._body=t,this._labelModule=A,this.color={},this.colorDirty=!0,this.hoverWidth=1.5,this.selectionWidth=2,this.setOptions(g),this.fromPoint=this.from,this.toPoint=this.to}return Ca(e,[{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(e){this.options=e,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(e,g,t,A){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,g),e.lineWidth=g.width,!1!==g.dashes?this._drawDashedLine(e,g,i):this._drawLine(e,g,i)}},{key:"_drawLine",value:function(e,g,t,A,i){if(this.from!=this.to)this._line(e,g,t,A,i);else{var C=tl(this._getCircleData(e),3),I=C[0],n=C[1],o=C[2];this._circle(e,g,I,n,o)}}},{key:"_drawDashedLine",value:function(e,g,t,A,i){e.lineCap="round";var C=cl(g.dashes)?g.dashes:[5,5];if(void 0!==e.setLineDash){if(e.save(),e.setLineDash(C),e.lineDashOffset=0,this.from!=this.to)this._line(e,g,t);else{var I=tl(this._getCircleData(e),3),n=I[0],o=I[1],r=I[2];this._circle(e,g,n,o,r)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)ti(e,this.from.x,this.from.y,this.to.x,this.to.y,C);else{var s=tl(this._getCircleData(e),3),a=s[0],l=s[1],d=s[2];this._circle(e,g,a,l,d)}this.enableShadow(e,g),e.stroke(),this.disableShadow(e,g)}}},{key:"findBorderPosition",value:function(e,g,t){return this.from!=this.to?this._findBorderPosition(e,g,t):this._findBorderPositionCircle(e,g,t)}},{key:"findBorderPositions",value:function(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};var g,t=tl(dl(g=this._getCircleData(e)).call(g,0,2),2),A=t[0],i=t[1];return{from:this._findBorderPositionCircle(this.from,e,{x:A,y:i,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:A,y:i,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(e){var g=this.options.selfReference.size;void 0!==e&&void 0===this.from.shape.width&&this.from.shape.resize(e);var t=tw(e,this.options.selfReference.angle,g,this.from);return[t.x,t.y,g]}},{key:"_pointOnCircle",value:function(e,g,t,A){var i=2*A*Math.PI;return{x:e+t*Math.cos(i),y:g-t*Math.sin(i)}}},{key:"_findBorderPositionCircle",value:function(e,g,t){var A,i=t.x,C=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(i,C,r,s);var d=Math.atan2(e.y-A.y,e.x-A.x),h=e.distanceToBorder(g,d)+a-Math.sqrt(Math.pow(A.x-e.x,2)+Math.pow(A.y-e.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 Pk(Pk({},A),{},{t:s})}},{key:"getLineWidth",value:function(e,g){return!0===e?Math.max(this.selectionWidth,.3/this._body.view.scale):!0===g?Math.max(this.hoverWidth,.3/this._body.view.scale):Math.max(this.options.width,.3/this._body.view.scale)}},{key:"getColor",value:function(e,g){if(!1!==g.inheritsColor){if("both"===g.inheritsColor&&this.from.id!==this.to.id){var t=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),A=this.from.options.color.highlight.border,i=this.to.options.color.highlight.border;return!1===this.from.selected&&!1===this.to.selected?(A=xp(this.from.options.color.border,g.opacity),i=xp(this.to.options.color.border,g.opacity)):!0===this.from.selected&&!1===this.to.selected?i=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,i),t}return"to"===g.inheritsColor?xp(this.to.options.color.border,g.opacity):xp(this.from.options.color.border,g.opacity)}return xp(g.color,g.opacity)}},{key:"_circle",value:function(e,g,t,A,i){this.enableShadow(e,g);var C=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,e,{x:t,y:A,low:n,high:o,direction:-1}),s=this._findBorderPositionCircle(this.from,e,{x:t,y:A,low:n,high:o,direction:1});C=Math.atan2(r.y-A,r.x-t),I=Math.atan2(s.y-A,s.x-t)}e.beginPath(),e.arc(t,A,i,C,I,!1),e.stroke(),this.disableShadow(e,g)}},{key:"getDistanceToEdge",value:function(e,g,t,A,i,C){if(this.from!=this.to)return this._getDistanceToEdge(e,g,t,A,i,C);var I=tl(this._getCircleData(void 0),3),n=I[0],o=I[1],r=I[2],s=n-i,a=o-C;return Math.abs(Math.sqrt(s*s+a*a)-r)}},{key:"_getDistanceToLine",value:function(e,g,t,A,i,C){var I=t-e,n=A-g,o=((i-e)*I+(C-g)*n)/(I*I+n*n);o>1?o=1:o<0&&(o=0);var r=e+o*I-i,s=g+o*n-C;return Math.sqrt(r*r+s*s)}},{key:"getArrowData",value:function(e,g,t,A,i,C){var I,n,o,r,s,a,l,d=C.width;"from"===g?(o=this.from,r=this.to,s=C.fromArrowScale<0,a=Math.abs(C.fromArrowScale),l=C.fromArrowType):"to"===g?(o=this.to,r=this.from,s=C.toArrowScale<0,a=Math.abs(C.toArrowScale),l=C.toArrowType):(o=this.to,r=this.from,s=C.middleArrowScale<0,a=Math.abs(C.middleArrowScale),l=C.middleArrowType);var h=15*a+3*d;if(o!=r){var c=h/ck(o.x-r.x,o.y-r.y);if("middle"!==g)if(!0===this.options.smooth.enabled){var u=this._findBorderPosition(o,e,{via:t}),p=this.getPoint(u.t+c*("from"===g?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,e);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=tl(this._getCircleData(e),3),b=y[0],w=y[1],k=y[2];if("from"===g){var x=this.options.selfReference.angle,E=this.options.selfReference.angle+Math.PI,O=this._findBorderPositionCircle(this.from,e,{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"===g){var T=this.options.selfReference.angle,D=this.options.selfReference.angle+Math.PI,N=this._findBorderPositionCircle(this.from,e,{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(e,g,t,A,i){e.strokeStyle=this.getColor(e,g),e.fillStyle=e.strokeStyle,e.lineWidth=g.width,Nk.draw(e,i)&&(this.enableShadow(e,g),wc(e).call(e),this.disableShadow(e,g))}},{key:"enableShadow",value:function(e,g){!0===g.shadow&&(e.shadowColor=g.shadowColor,e.shadowBlur=g.shadowSize,e.shadowOffsetX=g.shadowX,e.shadowOffsetY=g.shadowY)}},{key:"disableShadow",value:function(e,g){!0===g.shadow&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,g){if(!1!==g.background){var t={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=g.backgroundColor,e.lineWidth=g.backgroundSize,this.setStrokeDashed(e,g.backgroundDashes),e.stroke(),e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,e.dashes=t.dashes,this.setStrokeDashed(e,g.dashes)}}},{key:"setStrokeDashed",value:function(e,g){if(!1!==g)if(void 0!==e.setLineDash){var t=cl(g)?g:[5,5];e.setLineDash(t)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else void 0!==e.setLineDash?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),e}();function Mk(e,g){var t=kl(e);if(fs){var A=fs(e);g&&(A=_d(A).call(A,(function(g){return Ds(e,g).enumerable}))),t.push.apply(t,A)}return t}function Bk(e){for(var g=1;g<arguments.length;g++){var t,A,i=null!=arguments[g]?arguments[g]:{};g%2?Ll(t=Mk(Object(i),!0)).call(t,(function(g){Ia(e,g,i[g])})):Gs?Qs(e,Gs(i)):Ll(A=Mk(Object(i))).call(A,(function(g){ga(e,g,Ds(i,g))}))}return e}function zk(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Fk=function(e){Rm(t,Sk);var g=zk(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"_findBorderPositionBezier",value:function(e,g){var t,A,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._getViaCoordinates(),C=10,I=.2,n=!1,o=1,r=0,s=this.to,a=this.options.endPointOffset?this.options.endPointOffset.to:0;e.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,i);var d=Math.atan2(s.y-t.y,s.x-t.x),h=s.distanceToBorder(g,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<C);return Bk(Bk({},t),{},{t:A})}},{key:"_getDistanceToBezierEdge",value:function(e,g,t,A,i,C,I){var n,o,r,s,a,l=1e9,d=e,h=g;for(o=1;o<10;o++)r=.1*o,s=Math.pow(1-r,2)*e+2*r*(1-r)*I.x+Math.pow(r,2)*t,a=Math.pow(1-r,2)*g+2*r*(1-r)*I.y+Math.pow(r,2)*A,o>0&&(l=(n=this._getDistanceToLine(d,h,s,a,i,C))<l?n:l),d=s,h=a;return l}},{key:"_bezierCurve",value:function(e,g,t,A){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),null!=t&&null!=t.x?null!=A&&null!=A.x?e.bezierCurveTo(t.x,t.y,A.x,A.y,this.toPoint.x,this.toPoint.y):e.quadraticCurveTo(t.x,t.y,this.toPoint.x,this.toPoint.y):e.lineTo(this.toPoint.x,this.toPoint.y),this.drawBackground(e,g),this.enableShadow(e,g),e.stroke(),this.disableShadow(e,g)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}}]),t}();function Zk(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var jk=function(e){Rm(t,Fk);var g=Zk(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i)).via=C.via,C._boundFunction=function(){C.positionBezierNode()},C._body.emitter.on("_repositionBezierNodes",C._boundFunction),C}return Ca(t,[{key:"setOptions",value:function(e){sk(Mm(t.prototype),"setOptions",this).call(this,e);var g=!1;this.options.physics!==e.physics&&(g=!0),this.options=e,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===g&&(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 e="edgeId:"+this.id,g=this._body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this._body.nodes[e]=g,this.via=g,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(e,g,t){this._bezierCurve(e,g,t)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.via;if(this.from===this.to){var t=this._getCircleData(),A=tl(t,3),i=A[0],C=A[1],I=A[2],n=2*Math.PI*(1-e);return{x:i+I*Math.sin(n),y:C+I-I*(1-Math.cos(n))}}return{x:Math.pow(1-e,2)*this.fromPoint.x+2*e*(1-e)*g.x+Math.pow(e,2)*this.toPoint.x,y:Math.pow(1-e,2)*this.fromPoint.y+2*e*(1-e)*g.y+Math.pow(e,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(e,g){return this._findBorderPositionBezier(e,g,this.via)}},{key:"_getDistanceToEdge",value:function(e,g,t,A,i,C){return this._getDistanceToBezierEdge(e,g,t,A,i,C,this.via)}}]),t}();function Gk(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Lk=function(e){Rm(t,Fk);var g=Gk(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"_line",value:function(e,g,t){this._bezierCurve(e,g,t)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var e,g,t=this.options.smooth.roundness,A=this.options.smooth.type,i=Math.abs(this.from.x-this.to.x),C=Math.abs(this.from.y-this.to.y);if("discrete"===A||"diagonalCross"===A){var I,n;I=n=i<=C?t*C:t*i,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&&(i<=C?o=i<t*C?this.from.x:o:r=C<t*i?this.from.y:r),{x:o,y:r}}if("straightCross"===A){var s=(1-t)*i,a=(1-t)*C;return i<=C?(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)*i;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)*C;return this.from.y<this.to.y&&(d=-d),{x:this.from.x,y:this.to.y+d}}if("curvedCW"===A){i=this.to.x-this.from.x,C=this.from.y-this.to.y;var h=Math.sqrt(i*i+C*C),c=Math.PI,u=(Math.atan2(C,i)+(.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){i=this.to.x-this.from.x,C=this.from.y-this.to.y;var p=Math.sqrt(i*i+C*C),f=Math.PI,v=(Math.atan2(C,i)+(.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)}}e=g=i<=C?t*C:t*i,this.from.x>this.to.x&&(e=-e),this.from.y>=this.to.y&&(g=-g);var m=this.from.x+e,y=this.from.y+g;return i<=C?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(e,g){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._findBorderPositionBezier(e,g,t.via)}},{key:"_getDistanceToEdge",value:function(e,g,t,A,i,C){var I=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,g,t,A,i,C,I)}},{key:"getPoint",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),t=e,A=Math.pow(1-t,2)*this.fromPoint.x+2*t*(1-t)*g.x+Math.pow(t,2)*this.toPoint.x,i=Math.pow(1-t,2)*this.fromPoint.y+2*t*(1-t)*g.y+Math.pow(t,2)*this.toPoint.y;return{x:A,y:i}}}]),t}();function Vk(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Yk=function(e){Rm(t,Fk);var g=Vk(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"_getDistanceToBezierEdge2",value:function(e,g,t,A,i,C,I,n){for(var o=1e9,r=e,s=g,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]*e+a[1]*I.x+a[2]*n.x+a[3]*t,c=a[0]*g+a[1]*I.y+a[2]*n.y+a[3]*A;if(l>0){var u=this._getDistanceToLine(r,s,h,c,i,C);o=u<o?u:o}r=h,s=c}return o}}]),t}();function Wk(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var _k=function(e){Rm(t,Yk);var g=Wk(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"_line",value:function(e,g,t){var A=t[0],i=t[1];this._bezierCurve(e,g,A,i)}},{key:"_getViaCoordinates",value:function(){var e,g,t,A,i=this.from.x-this.to.x,C=this.from.y-this.to.y,I=this.options.smooth.roundness;return(Math.abs(i)>Math.abs(C)||!0===this.options.smooth.forceDirection||"horizontal"===this.options.smooth.forceDirection)&&"vertical"!==this.options.smooth.forceDirection?(g=this.from.y,A=this.to.y,e=this.from.x-I*i,t=this.to.x+I*i):(g=this.from.y-I*C,A=this.to.y+I*C,e=this.from.x,t=this.to.x),[{x:e,y:g},{x:t,y:A}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(e,g){return this._findBorderPositionBezier(e,g)}},{key:"_getDistanceToEdge",value:function(e,g,t,A,i,C){var I=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates(),n=tl(I,2),o=n[0],r=n[1];return this._getDistanceToBezierEdge2(e,g,t,A,i,C,o,r)}},{key:"getPoint",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),t=tl(g,2),A=t[0],i=t[1],C=e,I=[Math.pow(1-C,3),3*C*Math.pow(1-C,2),3*Math.pow(C,2)*(1-C),Math.pow(C,3)],n=I[0]*this.fromPoint.x+I[1]*A.x+I[2]*i.x+I[3]*this.toPoint.x,o=I[0]*this.fromPoint.y+I[1]*A.y+I[2]*i.y+I[3]*this.toPoint.y;return{x:n,y:o}}}]),t}();function Uk(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Qk=function(e){Rm(t,Sk);var g=Uk(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"_line",value:function(e,g){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,g),e.stroke(),this.disableShadow(e,g)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}},{key:"_findBorderPosition",value:function(e,g){var t=this.to,A=this.from;e.id===this.from.id&&(t=this.from,A=this.to);var i=Math.atan2(t.y-A.y,t.x-A.x),C=t.x-A.x,I=t.y-A.y,n=Math.sqrt(C*C+I*I),o=(n-e.distanceToBorder(g,i))/n;return{x:(1-o)*A.x+o*t.x,y:(1-o)*A.y+o*t.y,t:0}}},{key:"_getDistanceToEdge",value:function(e,g,t,A,i,C){return this._getDistanceToLine(e,g,t,A,i,C)}}]),t}(),Hk=function(){function e(g,t,A,i,C){if(ta(this,e),void 0===t)throw new Error("No body provided");this.options=Mp(i),this.globalOptions=i,this.defaultOptions=C,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 ow(this.body,this.options,!0),this.setOptions(g)}return Ca(e,[{key:"setOptions",value:function(g){if(g){var t=void 0!==g.physics&&this.options.physics!==g.physics||void 0!==g.hidden&&(this.options.hidden||!1)!==(g.hidden||!1)||void 0!==g.from&&this.options.from!==g.from||void 0!==g.to&&this.options.to!==g.to;e.parseOptions(this.options,g,!0,this.globalOptions),void 0!==g.id&&(this.id=g.id),void 0!==g.from&&(this.fromId=g.from),void 0!==g.to&&(this.toId=g.to),void 0!==g.title&&(this.title=g.title),void 0!==g.value&&(g.value=Qb(g.value));var A=[g,this.options,this.defaultOptions];return this.chooser=$b("edge",A),this.updateLabelModule(g),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var e=!0===this.options.arrows.to||!0===this.options.arrows.to.enabled,g=!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,i={toArrow:e,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:g,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 C=this.options.selectionWidth;"function"==typeof C?i.width=C(i.width):"number"==typeof C&&(i.width+=C),i.width=Math.max(i.width,.3/this.body.view.scale),i.color=this.options.color.highlight,i.shadow=this.options.shadow.enabled}else if(this.hover){var I=this.options.hoverWidth;"function"==typeof I?i.width=I(i.width):"number"==typeof I&&(i.width+=I),i.width=Math.max(i.width,.3/this.body.view.scale),i.color=this.options.color.hover,i.shadow=this.options.shadow.enabled}}else"function"==typeof this.chooser&&(this.chooser(i,this.options.id,this.selected,this.hover),void 0!==i.color&&(i.inheritsColor=!1),!1===i.shadow&&(i.shadowColor===this.options.shadow.color&&i.shadowSize===this.options.shadow.size&&i.shadowX===this.options.shadow.x&&i.shadowY===this.options.shadow.y||(i.shadow=!0)));else i.shadow=this.options.shadow.enabled,i.width=Math.max(i.width,.3/this.body.view.scale);return i}},{key:"updateLabelModule",value:function(e){var g=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,g),void 0!==this.labelModule.baseSize&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var e=this.options.smooth,g=!1,t=!0;return void 0!==this.edgeType&&((this.edgeType instanceof jk&&!0===e.enabled&&"dynamic"===e.type||this.edgeType instanceof _k&&!0===e.enabled&&"cubicBezier"===e.type||this.edgeType instanceof Lk&&!0===e.enabled&&"dynamic"!==e.type&&"cubicBezier"!==e.type||this.edgeType instanceof Qk&&!1===e.type.enabled)&&(t=!1),!0===t&&(g=this.cleanup())),!0===t?!0===e.enabled?"dynamic"===e.type?(g=!0,this.edgeType=new jk(this.options,this.body,this.labelModule)):"cubicBezier"===e.type?this.edgeType=new _k(this.options,this.body,this.labelModule):this.edgeType=new Lk(this.options,this.body,this.labelModule):this.edgeType=new Qk(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),g}},{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(e,g,t){if(void 0!==this.options.value){var A=this.options.scaling.customScalingFunction(e,g,t,this.options.value),i=this.options.scaling.max-this.options.scaling.min;if(!0===this.options.scaling.label.enabled){var C=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+A*C}this.options.width=this.options.scaling.min+A*i}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(e){var g=this.getFormattingValues();if(!g.hidden){var t=this.edgeType.getViaNode();this.edgeType.drawLine(e,g,this.selected,this.hover,t),this.drawLabel(e,t)}}},{key:"drawArrows",value:function(e){var g=this.getFormattingValues();if(!g.hidden){var t=this.edgeType.getViaNode(),A={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,g.fromArrow&&(A.from=this.edgeType.getArrowData(e,"from",t,this.selected,this.hover,g),!1===g.arrowStrikethrough&&(this.edgeType.fromPoint=A.from.core),g.fromArrowSrc&&(A.from.image=this.imagelist.load(g.fromArrowSrc)),g.fromArrowImageWidth&&(A.from.imageWidth=g.fromArrowImageWidth),g.fromArrowImageHeight&&(A.from.imageHeight=g.fromArrowImageHeight)),g.toArrow&&(A.to=this.edgeType.getArrowData(e,"to",t,this.selected,this.hover,g),!1===g.arrowStrikethrough&&(this.edgeType.toPoint=A.to.core),g.toArrowSrc&&(A.to.image=this.imagelist.load(g.toArrowSrc)),g.toArrowImageWidth&&(A.to.imageWidth=g.toArrowImageWidth),g.toArrowImageHeight&&(A.to.imageHeight=g.toArrowImageHeight)),g.middleArrow&&(A.middle=this.edgeType.getArrowData(e,"middle",t,this.selected,this.hover,g),g.middleArrowSrc&&(A.middle.image=this.imagelist.load(g.middleArrowSrc)),g.middleArrowImageWidth&&(A.middle.imageWidth=g.middleArrowImageWidth),g.middleArrowImageHeight&&(A.middle.imageHeight=g.middleArrowImageHeight)),g.fromArrow&&this.edgeType.drawArrowHead(e,g,this.selected,this.hover,A.from),g.middleArrow&&this.edgeType.drawArrowHead(e,g,this.selected,this.hover,A.middle),g.toArrow&&this.edgeType.drawArrowHead(e,g,this.selected,this.hover,A.to)}}},{key:"drawLabel",value:function(e,g){if(void 0!==this.options.label){var t,A=this.from,i=this.to;if(this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover),A.id!=i.id){this.labelModule.pointToSelf=!1,t=this.edgeType.getPoint(.5,g),e.save();var C=this._getRotation(e);0!=C.angle&&(e.translate(C.x,C.y),e.rotate(C.angle)),this.labelModule.draw(e,t.x,t.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;var I=tw(e,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(e,t.x,t.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var g=[];if(this.labelModule.visible()){var t=this._getRotation();ew(this.labelModule.getSize(),e,t)&&g.push({edgeId:this.id,labelId:0})}var A={left:e.x,top:e.y};return this.isOverlappingWith(A)&&g.push({edgeId:this.id}),g}},{key:"isOverlappingWith",value:function(e){if(this.connected){var g=this.from.x,t=this.from.y,A=this.to.x,i=this.to.y,C=e.left,I=e.top;return this.edgeType.getDistanceToEdge(g,t,A,i,C,I)<10}return!1}},{key:"_getRotation",value:function(e){var g=this.edgeType.getViaNode(),t=this.edgeType.getPoint(.5,g);void 0!==e&&this.labelModule.calculateLabelSize(e,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 i=this.from.y-this.to.y,C=this.from.x-this.to.x,I=Math.atan2(i,C);return(I<-1&&C<0||I>0&&C<0)&&(I+=Math.PI),A.angle=I,A}},{key:"_pointOnCircle",value:function(e,g,t,A){return{x:e+t*Math.cos(A),y:g-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(e,g){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],C=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(pp(C,e,g,t),void 0!==g.endPointOffset&&void 0!==g.endPointOffset.from&&(tm(g.endPointOffset.from)?e.endPointOffset.from=g.endPointOffset.from:(e.endPointOffset.from=void 0!==A.endPointOffset.from?A.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),void 0!==g.endPointOffset&&void 0!==g.endPointOffset.to&&(tm(g.endPointOffset.to)?e.endPointOffset.to=g.endPointOffset.to:(e.endPointOffset.to=void 0!==A.endPointOffset.to?A.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),gw(g.label)?e.label=g.label:gw(e.label)||(e.label=void 0),Bp(e,g,"smooth",A),Bp(e,g,"shadow",A),Bp(e,g,"background",A),void 0!==g.dashes&&null!==g.dashes?e.dashes=g.dashes:!0===t&&null===g.dashes&&(e.dashes=Zh(A.dashes)),void 0!==g.scaling&&null!==g.scaling?(void 0!==g.scaling.min&&(e.scaling.min=g.scaling.min),void 0!==g.scaling.max&&(e.scaling.max=g.scaling.max),Bp(e.scaling,g.scaling,"label",A.scaling)):!0===t&&null===g.scaling&&(e.scaling=Zh(A.scaling)),void 0!==g.arrows&&null!==g.arrows)if("string"==typeof g.arrows){var I=g.arrows.toLowerCase();e.arrows.to.enabled=-1!=Rh(I).call(I,"to"),e.arrows.middle.enabled=-1!=Rh(I).call(I,"middle"),e.arrows.from.enabled=-1!=Rh(I).call(I,"from")}else{if("object"!==Cl(g.arrows))throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ic(g.arrows));Bp(e.arrows,g.arrows,"to",A.arrows),Bp(e.arrows,g.arrows,"middle",A.arrows),Bp(e.arrows,g.arrows,"from",A.arrows)}else!0===t&&null===g.arrows&&(e.arrows=Zh(A.arrows));if(void 0!==g.color&&null!==g.color){var n=dp(g.color)?{color:g.color,highlight:g.color,hover:g.color,inherit:!1,opacity:1}:g.color,o=e.color;if(i)vp(o,A.color,!1,t);else for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&delete o[r];if(dp(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===g.color&&(e.color=Mp(A.color));!0===t&&null===g.font&&(e.font=Mp(A.font)),Object.prototype.hasOwnProperty.call(g,"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}"),e.selfReference.size=g.selfReferenceSize)}}]),e}(),Kk=function(){function e(g,t,A){var i,C=this;ta(this,e),this.body=g,this.images=t,this.groups=A,this.body.functions.createEdge=JA(i=this.create).call(i,this),this.edgesListeners={add:function(e,g){C.add(g.items)},update:function(e,g){C.update(g.items)},remove:function(e,g){C.remove(g.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(e,g,t,A){if(g===e)return.5;var i=1/(g-e);return Math.max(0,(A-e)*i)}},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},vp(this.options,this.defaultOptions),this.bindEventListeners()}return Ca(e,[{key:"bindEventListeners",value:function(){var e,g,t=this;this.body.emitter.on("_forceDisableDynamicCurves",(function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"dynamic"===e&&(e="continuous");var A=!1;for(var i in t.body.edges)if(Object.prototype.hasOwnProperty.call(t.body.edges,i)){var C=t.body.edges[i],I=t.body.data.edges.get(i);if(null!=I){var n=I.smooth;void 0!==n&&!0===n.enabled&&"dynamic"===n.type&&(void 0===e?C.setOptions({smooth:!1}):C.setOptions({smooth:{type:e}}),A=!0)}}!0===g&&!0===A&&t.body.emitter.emit("_dataChanged")})),this.body.emitter.on("_dataUpdated",(function(){t.reconnectEdges()})),this.body.emitter.on("refreshEdges",JA(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",JA(g=this.refresh).call(g,this)),this.body.emitter.on("destroy",(function(){wp(t.edgesListeners,(function(e,g){t.body.data.edges&&t.body.data.edges.off(g,e)})),delete t.body.functions.createEdge,delete t.edgesListeners.add,delete t.edgesListeners.update,delete t.edgesListeners.remove,delete t.edgesListeners}))}},{key:"setOptions",value:function(e){if(void 0!==e){Hk.parseOptions(this.options,e,!0,this.defaultOptions,!0);var g=!1;if(void 0!==e.smooth)for(var t in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,t)&&(g=this.body.edges[t].updateEdgeType()||g);if(void 0!==e.font)for(var A in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,A)&&this.body.edges[A].updateLabelModule();void 0===e.hidden&&void 0===e.physics&&!0!==g||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var g=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=this.body.data.edges;if(Fb("id",e))this.body.data.edges=e;else if(cl(e))this.body.data.edges=new zb,this.body.data.edges.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.edges=new zb}if(A&&wp(this.edgesListeners,(function(e,g){A.off(g,e)})),this.body.edges={},this.body.data.edges){wp(this.edgesListeners,(function(e,t){g.body.data.edges.on(t,e)}));var i=this.body.data.edges.getIds();this.add(i,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),!1===t&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var g=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=this.body.edges,A=this.body.data.edges,i=0;i<e.length;i++){var C=e[i],I=t[C];I&&I.disconnect();var n=A.get(C,{showInternalIds:!0});t[C]=this.create(n)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),!1===g&&this.body.emitter.emit("_dataChanged")}},{key:"update",value:function(e){for(var g=this.body.edges,t=this.body.data.edges,A=!1,i=0;i<e.length;i++){var C=e[i],I=t.get(C),n=g[C];void 0!==n?(n.disconnect(),A=n.setOptions(I)||A,n.connect()):(this.body.edges[C]=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(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(0!==e.length){var t=this.body.edges;wp(e,(function(e){var g=t[e];void 0!==g&&g.remove()})),g&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;wp(this.body.edges,(function(g,t){var A=e.body.data.edges.get(t);void 0!==A&&g.setOptions(A)}))}},{key:"create",value:function(e){return new Hk(e,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,g=this.body.nodes,t=this.body.edges;for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(g[e].edges=[]);for(e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var A=t[e];A.from=null,A.to=null,A.connect()}}},{key:"getConnectedNodes",value:function(e){var g=[];if(void 0!==this.body.edges[e]){var t=this.body.edges[e];void 0!==t.fromId&&g.push(t.fromId),void 0!==t.toId&&g.push(t.toId)}return g}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,g=[];wp(this.body.edges,(function(t,A){var i=e.body.nodes[t.toId],C=e.body.nodes[t.fromId];void 0!==i&&!0===i.isCluster||void 0!==C&&!0===C.isCluster||void 0!==i&&void 0!==C||g.push(A)})),this.remove(g,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(null!=e){var g=this.body.edges,t=[];Ll(e).call(e,(function(e,A){void 0===g[A]&&t.push(A)})),this.add(t,!0)}}}]),e}(),Xk=function(){function e(g,t,A){ta(this,e),this.body=g,this.physicsBody=t,this.barnesHutTree,this.setOptions(A),this._rng=Ap("BARNES HUT SOLVER")}return Ca(e,[{key:"setOptions",value:function(e){this.options=e,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 e,g=this.body.nodes,t=this.physicsBody.physicsNodeIndices,A=t.length,i=this._formBarnesHutTree(g,t);this.barnesHutTree=i;for(var C=0;C<A;C++)(e=g[t[C]]).options.mass>0&&this._getForceContributions(i.root,e)}}},{key:"_getForceContributions",value:function(e,g){this._getForceContribution(e.children.NW,g),this._getForceContribution(e.children.NE,g),this._getForceContribution(e.children.SW,g),this._getForceContribution(e.children.SE,g)}},{key:"_getForceContribution",value:function(e,g){if(e.childrenCount>0){var t=e.centerOfMass.x-g.x,A=e.centerOfMass.y-g.y,i=Math.sqrt(t*t+A*A);i*e.calcSize>this.thetaInversed?this._calculateForces(i,t,A,g,e):4===e.childrenCount?this._getForceContributions(e,g):e.children.data.id!=g.id&&this._calculateForces(i,t,A,g,e)}}},{key:"_calculateForces",value:function(e,g,t,A,i){0===e&&(g=e=.1),this.overlapAvoidanceFactor<1&&A.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*A.shape.radius,e-A.shape.radius));var C=this.options.gravitationalConstant*i.mass*A.options.mass/Math.pow(e,3),I=g*C,n=t*C;this.physicsBody.forces[A.id].x+=I,this.physicsBody.forces[A.id].y+=n}},{key:"_formBarnesHutTree",value:function(e,g){for(var t,A=g.length,i=e[g[0]].x,C=e[g[0]].y,I=e[g[0]].x,n=e[g[0]].y,o=1;o<A;o++){var r=e[g[o]],s=r.x,a=r.y;r.options.mass>0&&(s<i&&(i=s),s>I&&(I=s),a<C&&(C=a),a>n&&(n=a))}var l=Math.abs(I-i)-Math.abs(n-C);l>0?(C-=.5*l,n+=.5*l):(i+=.5*l,I-=.5*l);var d=Math.max(1e-5,Math.abs(I-i)),h=.5*d,c=.5*(i+I),u=.5*(C+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=e[g[f]]).options.mass>0&&this._placeInTree(p.root,t);return p}},{key:"_updateBranchMass",value:function(e,g){var t=e.centerOfMass,A=e.mass+g.options.mass,i=1/A;t.x=t.x*e.mass+g.x*g.options.mass,t.x*=i,t.y=t.y*e.mass+g.y*g.options.mass,t.y*=i,e.mass=A;var C=Math.max(Math.max(g.height,g.radius),g.width);e.maxWidth=e.maxWidth<C?C:e.maxWidth}},{key:"_placeInTree",value:function(e,g,t){1==t&&void 0!==t||this._updateBranchMass(e,g);var A,i=e.children.NW.range;A=i.maxX>g.x?i.maxY>g.y?"NW":"SW":i.maxY>g.y?"NE":"SE",this._placeInRegion(e,g,A)}},{key:"_placeInRegion",value:function(e,g,t){var A=e.children[t];switch(A.childrenCount){case 0:A.children.data=g,A.childrenCount=1,this._updateBranchMass(A,g);break;case 1:A.children.data.x===g.x&&A.children.data.y===g.y?(g.x+=this._rng(),g.y+=this._rng()):(this._splitBranch(A),this._placeInTree(A,g));break;case 4:this._placeInTree(A,g)}}},{key:"_splitBranch",value:function(e){var g=null;1===e.childrenCount&&(g=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),null!=g&&this._placeInTree(e,g)}},{key:"_insertRegion",value:function(e,g){var t,A,i,C,I=.5*e.size;switch(g){case"NW":t=e.range.minX,A=e.range.minX+I,i=e.range.minY,C=e.range.minY+I;break;case"NE":t=e.range.minX+I,A=e.range.maxX,i=e.range.minY,C=e.range.minY+I;break;case"SW":t=e.range.minX,A=e.range.minX+I,i=e.range.minY+I,C=e.range.maxY;break;case"SE":t=e.range.minX+I,A=e.range.maxX,i=e.range.minY+I,C=e.range.maxY}e.children[g]={centerOfMass:{x:0,y:0},mass:0,range:{minX:t,maxX:A,minY:i,maxY:C},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,g){void 0!==this.barnesHutTree&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,g))}},{key:"_drawBranch",value:function(e,g,t){void 0===t&&(t="#FF0000"),4===e.childrenCount&&(this._drawBranch(e.children.NW,g),this._drawBranch(e.children.NE,g),this._drawBranch(e.children.SE,g),this._drawBranch(e.children.SW,g)),g.strokeStyle=t,g.beginPath(),g.moveTo(e.range.minX,e.range.minY),g.lineTo(e.range.maxX,e.range.minY),g.stroke(),g.beginPath(),g.moveTo(e.range.maxX,e.range.minY),g.lineTo(e.range.maxX,e.range.maxY),g.stroke(),g.beginPath(),g.moveTo(e.range.maxX,e.range.maxY),g.lineTo(e.range.minX,e.range.maxY),g.stroke(),g.beginPath(),g.moveTo(e.range.minX,e.range.maxY),g.lineTo(e.range.minX,e.range.minY),g.stroke()}}]),e}(),Jk=function(){function e(g,t,A){ta(this,e),this._rng=Ap("REPULSION SOLVER"),this.body=g,this.physicsBody=t,this.setOptions(A)}return Ca(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,g,t,A,i,C,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++)e=(n=o[r[h]]).x-I.x,g=n.y-I.y,0===(t=Math.sqrt(e*e+g*g))&&(e=t=.1*this._rng()),t<2*a&&(C=t<.5*a?1:l*t+1.3333333333333333,A=e*(C/=t),i=g*C,s[I.id].x-=A,s[I.id].y-=i,s[n.id].x+=A,s[n.id].y+=i)}}}]),e}(),qk=function(){function e(g,t,A){ta(this,e),this.body=g,this.physicsBody=t,this.setOptions(A)}return Ca(e,[{key:"setOptions",value:function(e){this.options=e,this.overlapAvoidanceFactor=Math.max(0,Math.min(1,this.options.avoidOverlap||0))}},{key:"solve",value:function(){for(var e=this.body.nodes,g=this.physicsBody.physicsNodeIndices,t=this.physicsBody.forces,A=this.options.nodeDistance,i=0;i<g.length-1;i++)for(var C=e[g[i]],I=i+1;I<g.length;I++){var n=e[g[I]];if(C.level===n.level){var o=A+this.overlapAvoidanceFactor*((C.shape.radius||0)/2+(n.shape.radius||0)/2),r=n.x-C.x,s=n.y-C.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[C.id].x-=d,t[C.id].y-=h,t[n.id].x+=d,t[n.id].y+=h}}}}]),e}(),$k=function(){function e(g,t,A){ta(this,e),this.body=g,this.physicsBody=t,this.setOptions(A)}return Ca(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,g,t,A,i,C=this.physicsBody.physicsEdgeIndices,I=this.body.edges,n=0;n<C.length;n++)!0===(g=I[C[n]]).connected&&g.toId!==g.fromId&&void 0!==this.body.nodes[g.toId]&&void 0!==this.body.nodes[g.fromId]&&(void 0!==g.edgeType.via?(e=void 0===g.options.length?this.options.springLength:g.options.length,t=g.to,A=g.edgeType.via,i=g.from,this._calculateSpringForce(t,A,.5*e),this._calculateSpringForce(A,i,.5*e)):(e=void 0===g.options.length?1.5*this.options.springLength:g.options.length,this._calculateSpringForce(g.from,g.to,e)))}},{key:"_calculateSpringForce",value:function(e,g,t){var A=e.x-g.x,i=e.y-g.y,C=Math.max(Math.sqrt(A*A+i*i),.01),I=this.options.springConstant*(t-C)/C,n=A*I,o=i*I;void 0!==this.physicsBody.forces[e.id]&&(this.physicsBody.forces[e.id].x+=n,this.physicsBody.forces[e.id].y+=o),void 0!==this.physicsBody.forces[g.id]&&(this.physicsBody.forces[g.id].x-=n,this.physicsBody.forces[g.id].y-=o)}}]),e}(),ex=function(){function e(g,t,A){ta(this,e),this.body=g,this.physicsBody=t,this.setOptions(A)}return Ca(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,g,t,A,i,C,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===(g=s[l[p]]).connected&&(e=void 0===g.options.length?this.options.springLength:g.options.length,t=g.from.x-g.to.x,A=g.from.y-g.to.y,n=0===(n=Math.sqrt(t*t+A*A))?.01:n,i=t*(I=this.options.springConstant*(e-n)/n),C=A*I,g.to.level!=g.from.level?(void 0!==h[g.toId]&&(h[g.toId].springFx-=i,h[g.toId].springFy-=C),void 0!==h[g.fromId]&&(h[g.fromId].springFx+=i,h[g.fromId].springFy+=C)):(void 0!==h[g.toId]&&(h[g.toId].x-=a*i,h[g.toId].y-=a*C),void 0!==h[g.fromId]&&(h[g.fromId].x+=a*i,h[g.fromId].y+=a*C)));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}}}]),e}(),gx=function(){function e(g,t,A){ta(this,e),this.body=g,this.physicsBody=t,this.setOptions(A)}return Ca(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,g,t,A,i=this.body.nodes,C=this.physicsBody.physicsNodeIndices,I=this.physicsBody.forces,n=0;n<C.length;n++){e=-(A=i[C[n]]).x,g=-A.y,t=Math.sqrt(e*e+g*g),this._calculateForces(t,e,g,I,A)}}},{key:"_calculateForces",value:function(e,g,t,A,i){var C=0===e?0:this.options.centralGravity/e;A[i.id].x=g*C,A[i.id].y=t*C}}]),e}();function tx(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Ax=function(e){Rm(t,Xk);var g=tx(t);function t(e,A,i){var C;return ta(this,t),(C=g.call(this,e,A,i))._rng=Ap("FORCE ATLAS 2 BASED REPULSION SOLVER"),C}return Ca(t,[{key:"_calculateForces",value:function(e,g,t,A,i){0===e&&(g=e=.1*this._rng()),this.overlapAvoidanceFactor<1&&A.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*A.shape.radius,e-A.shape.radius));var C=A.edges.length+1,I=this.options.gravitationalConstant*i.mass*A.options.mass*C/Math.pow(e,2),n=g*I,o=t*I;this.physicsBody.forces[A.id].x+=n,this.physicsBody.forces[A.id].y+=o}}]),t}();function ix(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var Cx=function(e){Rm(t,gx);var g=ix(t);function t(e,A,i){return ta(this,t),g.call(this,e,A,i)}return Ca(t,[{key:"_calculateForces",value:function(e,g,t,A,i){if(e>0){var C=i.edges.length+1,I=this.options.centralGravity*C*i.options.mass;A[i.id].x=g*I,A[i.id].y=t*I}}}]),t}(),Ix=function(){function e(g){ta(this,e),this.body=g,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}},NA(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return Ca(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",(function(){e.initPhysics()})),this.body.emitter.on("_layoutFailed",(function(){e.layoutFailed=!0})),this.body.emitter.on("resetPhysics",(function(){e.stopSimulation(),e.ready=!1})),this.body.emitter.on("disablePhysics",(function(){e.physicsEnabled=!1,e.stopSimulation()})),this.body.emitter.on("restorePhysics",(function(){e.setOptions(e.options),!0===e.ready&&e.startSimulation()})),this.body.emitter.on("startSimulation",(function(){!0===e.ready&&e.startSimulation()})),this.body.emitter.on("stopSimulation",(function(){e.stopSimulation()})),this.body.emitter.on("destroy",(function(){e.stopSimulation(!1),e.body.emitter.off()})),this.body.emitter.on("_dataChanged",(function(){e.updatePhysicsData()}))}},{key:"setOptions",value:function(e){if(void 0!==e)if(!1===e)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(!0===e)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,fp(["stabilization"],this.options,e),Bp(this.options,e,"stabilization"),void 0===e.enabled&&(this.options.enabled=!0),!1===this.options.enabled&&(this.physicsEnabled=!1,this.stopSimulation());var g=this.options.wind;g&&(("number"!=typeof g.x||em(g.x))&&(g.x=0),("number"!=typeof g.y||em(g.y))&&(g.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var e;"forceAtlas2Based"===this.options.solver?(e=this.options.forceAtlas2Based,this.nodesSolver=new Ax(this.body,this.physicsBody,e),this.edgesSolver=new $k(this.body,this.physicsBody,e),this.gravitySolver=new Cx(this.body,this.physicsBody,e)):"repulsion"===this.options.solver?(e=this.options.repulsion,this.nodesSolver=new Jk(this.body,this.physicsBody,e),this.edgesSolver=new $k(this.body,this.physicsBody,e),this.gravitySolver=new gx(this.body,this.physicsBody,e)):"hierarchicalRepulsion"===this.options.solver?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new qk(this.body,this.physicsBody,e),this.edgesSolver=new ex(this.body,this.physicsBody,e),this.gravitySolver=new gx(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new Xk(this.body,this.physicsBody,e),this.edgesSolver=new $k(this.body,this.physicsBody,e),this.gravitySolver=new gx(this.body,this.physicsBody,e)),this.modelOptions=e}},{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 e;!0===this.physicsEnabled&&!0===this.options.enabled?(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),void 0===this.viewFunction&&(this.viewFunction=JA(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))):this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.stabilized=!0,!0===e&&this._emitStabilized(),void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,!0===e&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Dl();this.physicsTick(),(Dl()-e<.4*this.simulationInterval||!0===this.runDoubleSpeed)&&!1===this.stabilized&&(this.physicsTick(),this.runDoubleSpeed=!0),!0===this.stabilized&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||!0===this.startedStabilization)&&cc((function(){e.body.emitter.emit("stabilized",{iterations:g}),e.startedStabilization=!1,e.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 e=this.body.nodes,g=this.body.edges;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&!0===e[t].options.physics&&this.physicsBody.physicsNodeIndices.push(e[t].id);for(var A in g)Object.prototype.hasOwnProperty.call(g,A)&&!0===g[A].options.physics&&this.physicsBody.physicsEdgeIndices.push(g[A].id);for(var i=0;i<this.physicsBody.physicsNodeIndices.length;i++){var C=this.physicsBody.physicsNodeIndices[i];this.physicsBody.forces[C]={x:0,y:0},void 0===this.physicsBody.velocities[C]&&(this.physicsBody.velocities[C]={x:0,y:0})}for(var I in this.physicsBody.velocities)void 0===e[I]&&delete this.physicsBody.velocities[I]}},{key:"revert",value:function(){var e=kl(this.previousStates),g=this.body.nodes,t=this.physicsBody.velocities;this.referenceState={};for(var A=0;A<e.length;A++){var i=e[A];void 0!==g[i]?!0===g[i].options.physics&&(this.referenceState[i]={positions:{x:g[i].x,y:g[i].y}},t[i].x=this.previousStates[i].vx,t[i].y=this.previousStates[i].vy,g[i].x=this.previousStates[i].x,g[i].y=this.previousStates[i].y):delete this.previousStates[i]}}},{key:"_evaluateStepQuality",value:function(){var e,g,t=this.body.nodes,A=this.referenceState;for(var i in this.referenceState)if(Object.prototype.hasOwnProperty.call(this.referenceState,i)&&void 0!==t[i]&&(e=t[i].x-A[i].positions.x,g=t[i].y-A[i].positions.y,Math.sqrt(Math.pow(e,2)+Math.pow(g,2))>.3))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,g=0,t=0,A=0;A<e.length;A++){var i=e[A],C=this._performStep(i);g=Math.max(g,C),t+=C}this.adaptiveTimestepEnabled=t/e.length<5,this.stabilized=g<this.options.minVelocity}},{key:"calculateComponentVelocity",value:function(e,g,t){e+=(g-this.modelOptions.damping*e)/t*this.timestep;var A=this.options.maxVelocity||1e9;return Math.abs(e)>A&&(e=e>0?A:-A),e}},{key:"_performStep",value:function(e){var g=this.body.nodes[e],t=this.physicsBody.forces[e];this.options.wind&&(t.x+=this.options.wind.x,t.y+=this.options.wind.y);var A=this.physicsBody.velocities[e];return this.previousStates[e]={x:g.x,y:g.y,vx:A.x,vy:A.y},!1===g.options.fixed.x?(A.x=this.calculateComponentVelocity(A.x,t.x,g.options.mass),g.x+=A.x*this.timestep):(t.x=0,A.x=0),!1===g.options.fixed.y?(A.y=this.calculateComponentVelocity(A.y,t.y,g.options.mass),g.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 e=this.body.nodes;for(var g in e)if(Object.prototype.hasOwnProperty.call(e,g)&&e[g].x&&e[g].y){var t=e[g].options.fixed;this.freezeCache[g]={x:t.x,y:t.y},t.x=!0,t.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var g in e)Object.prototype.hasOwnProperty.call(e,g)&&void 0!==this.freezeCache[g]&&(e[g].options.fixed.x=this.freezeCache[g].x,e[g].options.fixed.y=this.freezeCache[g].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.stabilization.iterations;"number"!=typeof g&&(g=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",g)),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=g,!0===this.options.stabilization.onlyDynamicEdges&&this._freezeNodes(),this.stabilizationIterations=0,cc((function(){return e._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 e=this,g=function(){return!1===e.stabilized&&e.stabilizationIterations<e.targetIterations},t=function(){e.body.emitter.emit("stabilizationProgress",{iterations:e.stabilizationIterations,total:e.targetIterations})};this._startStabilizing()&&t();for(var A,i=0;g()&&i<this.options.stabilization.updateInterval;)this.physicsTick(),i++;(t(),g())?cc(JA(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(e){for(var g=0;g<this.physicsBody.physicsNodeIndices.length;g++){var t=this.physicsBody.physicsNodeIndices[g],A=this.body.nodes[t],i=this.physicsBody.forces[t],C=Math.sqrt(Math.pow(i.x,2)+Math.pow(i.x,2)),I=Math.min(Math.max(5,C),15),n=3*I,o=Np((180-180*Math.min(1,Math.max(0,.03*C)))/360,1,1),r={x:A.x+20*i.x,y:A.y+20*i.y};e.lineWidth=I,e.strokeStyle=o,e.beginPath(),e.moveTo(A.x,A.y),e.lineTo(r.x,r.y),e.stroke();var s=Math.atan2(i.y,i.x);e.fillStyle=o,Nk.draw(e,{type:"arrow",point:r,angle:s,length:n}),wc(e).call(e)}}}]),e}(),nx=function(){function e(){ta(this,e)}return Ca(e,null,[{key:"getRange",value:function(e){var g,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],A=1e9,i=-1e9,C=1e9,I=-1e9;if(t.length>0)for(var n=0;n<t.length;n++)C>(g=e[t[n]]).shape.boundingBox.left&&(C=g.shape.boundingBox.left),I<g.shape.boundingBox.right&&(I=g.shape.boundingBox.right),A>g.shape.boundingBox.top&&(A=g.shape.boundingBox.top),i<g.shape.boundingBox.bottom&&(i=g.shape.boundingBox.bottom);return 1e9===C&&-1e9===I&&1e9===A&&-1e9===i&&(A=0,i=0,C=0,I=0),{minX:C,maxX:I,minY:A,maxY:i}}},{key:"getRangeCore",value:function(e){var g,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],A=1e9,i=-1e9,C=1e9,I=-1e9;if(t.length>0)for(var n=0;n<t.length;n++)C>(g=e[t[n]]).x&&(C=g.x),I<g.x&&(I=g.x),A>g.y&&(A=g.y),i<g.y&&(i=g.y);return 1e9===C&&-1e9===I&&1e9===A&&-1e9===i&&(A=0,i=0,C=0,I=0),{minX:C,maxX:I,minY:A,maxY:i}}},{key:"findCenter",value:function(e){return{x:.5*(e.maxX+e.minX),y:.5*(e.maxY+e.minY)}}},{key:"cloneOptions",value:function(e,g){var t={};return void 0===g||"node"===g?(vp(t,e.options,!0),t.x=e.x,t.y=e.y,t.amountOfConnections=e.edges.length):vp(t,e.options,!0),t}}]),e}();function ox(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var rx=function(e){Rm(t,Xw);var g=ox(t);function t(e,A,i,C,I,n){var o;return ta(this,t),(o=g.call(this,e,A,i,C,I,n)).isCluster=!0,o.containedNodes={},o.containedEdges={},o}return Ca(t,[{key:"_openChildCluster",value:function(e){var g=this,t=this.body.nodes[e];if(void 0===this.containedNodes[e])throw new Error("node with id: "+e+" not in current cluster");if(!t.isCluster)throw new Error("node with id: "+e+" is not a cluster");delete this.containedNodes[e],wp(t.edges,(function(e){delete g.containedEdges[e.id]})),wp(t.containedNodes,(function(e,t){g.containedNodes[t]=e})),t.containedNodes={},wp(t.containedEdges,(function(e,t){g.containedEdges[t]=e})),t.containedEdges={},wp(t.edges,(function(e){wp(g.edges,(function(t){var A,i,C=Rh(A=t.clusteringEdgeReplacingIds).call(A,e.id);-1!==C&&(wp(e.clusteringEdgeReplacingIds,(function(e){t.clusteringEdgeReplacingIds.push(e),g.body.edges[e].edgeReplacedById=t.id})),dd(i=t.clusteringEdgeReplacingIds).call(i,C,1))}))})),t.edges=[]}}]),t}(),sx=function(){function e(g){var t=this;ta(this,e),this.body=g,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},NA(this.options,this.defaultOptions),this.body.emitter.on("_resetData",(function(){t.clusteredNodes={},t.clusteredEdges={}}))}return Ca(e,[{key:"clusterByHubsize",value:function(e,g){void 0===e?e=this._getHubSize():"object"===Cl(e)&&(g=this._checkOptions(e),e=this._getHubSize());for(var t=[],A=0;A<this.body.nodeIndices.length;A++){var i=this.body.nodes[this.body.nodeIndices[A]];i.edges.length>=e&&t.push(i.id)}for(var C=0;C<t.length;C++)this.clusterByConnection(t[C],g,!0);this.body.emitter.emit("_dataChanged")}},{key:"cluster",value:function(){var e=this,g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===g.joinCondition)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");g=this._checkOptions(g);var A={},i={};wp(this.body.nodes,(function(t,C){t.options&&!0===g.joinCondition(t.options)&&(A[C]=t,wp(t.edges,(function(g){void 0===e.clusteredEdges[g.id]&&(i[g.id]=g)})))})),this._cluster(A,i,g,t)}},{key:"clusterByEdgeCount",value:function(e,g){var t=this,A=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];g=this._checkOptions(g);for(var i,C,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,C=[];for(var d=0;d<l.edges.length;d++)i=l.edges[d],void 0===t.clusteredEdges[i.id]&&(i.toId!==i.fromId&&I++,C.push(i));if(I===e){for(var h=function(e){if(void 0===g.joinCondition||null===g.joinCondition)return!0;var t=nx.cloneOptions(e);return g.joinCondition(t)},c=!0,u=0;u<C.length;u++){i=C[u];var p=t._getConnectedId(i,a);if(!h(l)){c=!1;break}s[i.id]=i,r[a]=l,r[p]=t.body.nodes[p],o[a]=!0}if(kl(r).length>0&&kl(s).length>0&&!0===c){var f=function(){for(var e=0;e<n.length;++e)for(var g in r)if(void 0!==n[e].nodes[g])return n[e]}();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,g,!1);!0===A&&this.body.emitter.emit("_dataChanged")}},{key:"clusterOutliers",value:function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(1,e,g)}},{key:"clusterBridges",value:function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(2,e,g)}},{key:"clusterByConnection",value:function(e,g){var t,A=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No nodeId supplied to clusterByConnection!");if(void 0===this.body.nodes[e])throw new Error("The nodeId given to clusterByConnection does not exist!");var i=this.body.nodes[e];void 0===(g=this._checkOptions(g,i)).clusterNodeProperties.x&&(g.clusterNodeProperties.x=i.x),void 0===g.clusterNodeProperties.y&&(g.clusterNodeProperties.y=i.y),void 0===g.clusterNodeProperties.fixed&&(g.clusterNodeProperties.fixed={},g.clusterNodeProperties.fixed.x=i.options.fixed.x,g.clusterNodeProperties.fixed.y=i.options.fixed.y);var C={},I={},n=i.id,o=nx.cloneOptions(i);C[n]=i;for(var r=0;r<i.edges.length;r++){var s=i.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===g.joinCondition)I[s.id]=s,C[a]=this.body.nodes[a];else{var l=nx.cloneOptions(this.body.nodes[a]);!0===g.joinCondition(o,l)&&(I[s.id]=s,C[a]=this.body.nodes[a])}else I[s.id]=s}}var d=yl(t=kl(C)).call(t,(function(e){return C[e].id}));for(var h in C)if(Object.prototype.hasOwnProperty.call(C,h))for(var c=C[h],u=0;u<c.edges.length;u++){var p=c.edges[u];Rh(d).call(d,this._getConnectedId(p,c.id))>-1&&(I[p.id]=p)}this._cluster(C,I,g,A)}},{key:"_createClusterEdges",value:function(e,g,t,A){for(var i,C,I,n,o,r,s=kl(e),a=[],l=0;l<s.length;l++){I=e[C=s[l]];for(var d=0;d<I.edges.length;d++)i=I.edges[d],void 0===this.clusteredEdges[i.id]&&(i.toId==i.fromId?g[i.id]=i:i.toId==C?(n=t.id,r=o=i.fromId):(n=i.toId,o=t.id,r=n),void 0===e[r]&&a.push({edge:i,fromId:o,toId:n}))}for(var h=[],c=function(e){for(var g=0;g<h.length;g++){var t=h[g],A=e.fromId===t.fromId&&e.toId===t.toId,i=e.fromId===t.toId&&e.toId===t.fromId;if(A||i)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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0===e.clusterEdgeProperties&&(e.clusterEdgeProperties={}),void 0===e.clusterNodeProperties&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,g,t){var A=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=[];for(var C in e)Object.prototype.hasOwnProperty.call(e,C)&&void 0!==this.clusteredNodes[C]&&i.push(C);for(var I=0;I<i.length;++I)delete e[i[I]];if(0!=kl(e).length&&(1!=kl(e).length||1==t.clusterNodeProperties.allowSingleNodeCluster)){var n=vp({},t.clusterNodeProperties);if(void 0!==t.processProperties){var o=[];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=nx.cloneOptions(e[r]);o.push(s)}var a=[];for(var l in g)if(Object.prototype.hasOwnProperty.call(g,l)&&"clusterEdge:"!==l.substr(0,12)){var d=nx.cloneOptions(g[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:"+Eb());var h=n.id;void 0===n.label&&(n.label="cluster");var c=void 0;void 0===n.x&&(c=this._getClusterPosition(e),n.x=c.x),void 0===n.y&&(void 0===c&&(c=this._getClusterPosition(e)),n.y=c.y),n.id=h;var u=this.body.functions.createNode(n,rx);u.containedNodes=e,u.containedEdges=g,u.clusterEdgeProperties=t.clusterEdgeProperties,this.body.nodes[n.id]=u,this._clusterEdges(e,g,n,t.clusterEdgeProperties),n.id=void 0,!0===A&&this.body.emitter.emit("_dataChanged")}}},{key:"_backupEdgeOptions",value:function(e){void 0===this.clusteredEdges[e.id]&&(this.clusteredEdges[e.id]={physics:e.options.physics})}},{key:"_restoreEdge",value:function(e){var g=this.clusteredEdges[e.id];void 0!==g&&(e.setOptions({physics:g.physics}),delete this.clusteredEdges[e.id])}},{key:"isCluster",value:function(e){return void 0!==this.body.nodes[e]?!0===this.body.nodes[e].isCluster:(console.error("Node does not exist."),!1)}},{key:"_getClusterPosition",value:function(e){for(var g,t=kl(e),A=e[t[0]].x,i=e[t[0]].x,C=e[t[0]].y,I=e[t[0]].y,n=1;n<t.length;n++)A=(g=e[t[n]]).x<A?g.x:A,i=g.x>i?g.x:i,C=g.y<C?g.y:C,I=g.y>I?g.y:I;return{x:.5*(A+i),y:.5*(C+I)}}},{key:"openCluster",value:function(e,g){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No clusterNodeId supplied to openCluster.");var A=this.body.nodes[e];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:"+e+" is not a valid cluster.");var i=this.findNode(e),C=Rh(i).call(i,e)-1;if(C>=0){var I=i[C],n=this.body.nodes[I];return n._openChildCluster(e),delete this.body.nodes[e],void(!0===t&&this.body.emitter.emit("_dataChanged"))}var o=A.containedNodes,r=A.containedEdges;if(void 0!==g&&void 0!==g.releaseFunction&&"function"==typeof g.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=g.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 wp(o,(function(e){!1===e.options.fixed.x&&(e.x=A.x),!1===e.options.fixed.y&&(e.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,e),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[e],!0===t&&this.body.emitter.emit("_dataChanged")}},{key:"getNodesInCluster",value:function(e){var g=[];if(!0===this.isCluster(e)){var t=this.body.nodes[e].containedNodes;for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&g.push(this.body.nodes[A].id)}return g}},{key:"findNode",value:function(e){for(var g,t=[],A=0;void 0!==this.clusteredNodes[e]&&A<100;){if(void 0===(g=this.body.nodes[e]))return[];t.push(g.id),e=this.clusteredNodes[e].clusterId,A++}return void 0===(g=this.body.nodes[e])?[]:(t.push(g.id),Xl(t).call(t),t)}},{key:"updateClusteredNode",value:function(e,g){if(void 0===e)throw new Error("No clusteredNodeId supplied to updateClusteredNode.");if(void 0===g)throw new Error("No newOptions supplied to updateClusteredNode.");if(void 0===this.body.nodes[e])throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist.");this.body.nodes[e].setOptions(g),this.body.emitter.emit("_dataChanged")}},{key:"updateEdge",value:function(e,g){if(void 0===e)throw new Error("No startEdgeId supplied to updateEdge.");if(void 0===g)throw new Error("No newOptions supplied to updateEdge.");if(void 0===this.body.edges[e])throw new Error("The startEdgeId supplied to updateEdge does not exist.");for(var t=this.getClusteredEdges(e),A=0;A<t.length;A++){this.body.edges[t[A]].setOptions(g)}this.body.emitter.emit("_dataChanged")}},{key:"getClusteredEdges",value:function(e){for(var g=[],t=0;void 0!==e&&void 0!==this.body.edges[e]&&t<100;)g.push(this.body.edges[e].id),e=this.body.edges[e].edgeReplacedById,t++;return Xl(g).call(g),g}},{key:"getBaseEdge",value:function(e){return this.getBaseEdges(e)[0]}},{key:"getBaseEdges",value:function(e){for(var g=[e],t=[],A=[],i=0;g.length>0&&i<100;){var C=g.pop();if(void 0!==C){var I=this.body.edges[C];if(void 0!==I){i++;var n=I.clusteringEdgeReplacingIds;if(void 0===n)A.push(C);else for(var o=0;o<n.length;++o){var r=n[o];-1===Rh(g).call(g,n)&&-1===Rh(t).call(t,n)&&g.push(r)}t.push(C)}}}return A}},{key:"_getConnectedId",value:function(e,g){return e.toId!=g?e.toId:(e.fromId,e.fromId)}},{key:"_getHubSize",value:function(){for(var e=0,g=0,t=0,A=0,i=0;i<this.body.nodeIndices.length;i++){var C=this.body.nodes[this.body.nodeIndices[i]];C.edges.length>A&&(A=C.edges.length),e+=C.edges.length,g+=Math.pow(C.edges.length,2),t+=1}e/=t;var I=(g/=t)-Math.pow(e,2),n=Math.sqrt(I),o=Math.floor(e+2*n);return o>A&&(o=A),o}},{key:"_createClusteredEdge",value:function(e,g,t,A,i){var C=nx.cloneOptions(t,"edge");vp(C,A),C.from=e,C.to=g,C.id="clusterEdge:"+Eb(),void 0!==i&&vp(C,i);var I=this.body.functions.createEdge(C);return I.clusteringEdgeReplacingIds=[t.id],I.connect(),this.body.edges[I.id]=I,I}},{key:"_clusterEdges",value:function(e,g,t,A){if(g instanceof Hk){var i=g,C={};C[i.id]=i,g=C}if(e instanceof Xw){var I=e,n={};n[I.id]=I,e=n}if(null==t)throw new Error("_clusterEdges: parameter clusterNode required");for(var o in void 0===A&&(A=t.clusterEdgeProperties),this._createClusterEdges(e,g,t,A),g)if(Object.prototype.hasOwnProperty.call(g,o)&&void 0!==this.body.edges[o]){var r=this.body.edges[o];this._backupEdgeOptions(r),r.setOptions({physics:!1})}for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this.clusteredNodes[s]={clusterId:t.id,node:this.body.nodes[s]},this.body.nodes[s].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(void 0!==e){var g=this.clusteredNodes[e];if(void 0!==g){var t=g.clusterId;if(void 0!==t)return this.body.nodes[t]}}}},{key:"_filter",value:function(e,g){var t=[];return wp(e,(function(e){g(e)&&t.push(e)})),t}},{key:"_updateState",value:function(){var e,g=this,t=[],A={},i=function(e){wp(g.body.nodes,(function(g){!0===g.isCluster&&e(g)}))};for(e in this.clusteredNodes){if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,e))void 0===this.body.nodes[e]&&t.push(e)}i((function(e){for(var g=0;g<t.length;g++)delete e.containedNodes[t[g]]}));for(var C=0;C<t.length;C++)delete this.clusteredNodes[t[C]];wp(this.clusteredEdges,(function(e){var t=g.body.edges[e];void 0!==t&&t.endPointsValid()||(A[e]=e)})),i((function(e){wp(e.containedEdges,(function(e,g){e.endPointsValid()||A[g]||(A[g]=g)}))})),wp(this.body.edges,(function(e,t){var i=!0,C=e.clusteringEdgeReplacingIds;if(void 0!==C){var I=0;wp(C,(function(e){var t=g.body.edges[e];void 0!==t&&t.endPointsValid()&&(I+=1)})),i=I>0}e.endPointsValid()&&i||(A[t]=t)})),i((function(e){wp(A,(function(t){delete e.containedEdges[t],wp(e.edges,(function(i,C){i.id!==t?i.clusteringEdgeReplacingIds=g._filter(i.clusteringEdgeReplacingIds,(function(e){return!A[e]})):e.edges[C]=null})),e.edges=g._filter(e.edges,(function(e){return null!==e}))}))})),wp(A,(function(e){delete g.clusteredEdges[e]})),wp(A,(function(e){delete g.body.edges[e]})),wp(kl(this.body.edges),(function(e){var t=g.body.edges[e],A=g._isClusteredNode(t.fromId)||g._isClusteredNode(t.toId);if(A!==g._isClusteredEdge(t.id))if(A){var i=g._getClusterNodeForNode(t.fromId);void 0!==i&&g._clusterEdges(g.body.nodes[t.fromId],t,i);var C=g._getClusterNodeForNode(t.toId);void 0!==C&&g._clusterEdges(g.body.nodes[t.toId],t,C)}else delete g._clusterEdges[e],g._restoreEdge(t)}));for(var I=!1,n=!0,o=function(){var e=[];i((function(g){var t=kl(g.containedNodes).length,A=!0===g.options.allowSingleNodeCluster;(A&&t<1||!A&&t<2)&&e.push(g.id)}));for(var t=0;t<e.length;++t)g.openCluster(e[t],{},!1);n=e.length>0,I=I||n};n;)o();I&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return void 0!==this.clusteredNodes[e]}},{key:"_isClusteredEdge",value:function(e){return void 0!==this.clusteredEdges[e]}}]),e}();function ax(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return lx(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return lx(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function lx(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}var dx=function(){function e(g,t){var A;ta(this,e),void 0!==window&&(A=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),window.requestAnimationFrame=void 0===A?function(e){e()}:A,this.body=g,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},NA(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return Ca(e,[{key:"bindEventListeners",value:function(){var e,g=this;this.body.emitter.on("dragStart",(function(){g.dragging=!0})),this.body.emitter.on("dragEnd",(function(){g.dragging=!1})),this.body.emitter.on("zoom",(function(){g.zooming=!0,window.clearTimeout(g.zoomTimeoutId),g.zoomTimeoutId=cc((function(){var e;g.zooming=!1,JA(e=g._requestRedraw).call(e,g)()}),250)})),this.body.emitter.on("_resizeNodes",(function(){g._resizeNodes()})),this.body.emitter.on("_redraw",(function(){!1===g.renderingActive&&g._redraw()})),this.body.emitter.on("_blockRedraw",(function(){g.allowRedraw=!1})),this.body.emitter.on("_allowRedraw",(function(){g.allowRedraw=!0,g.redrawRequested=!1})),this.body.emitter.on("_requestRedraw",JA(e=this._requestRedraw).call(e,this)),this.body.emitter.on("_startRendering",(function(){g.renderRequests+=1,g.renderingActive=!0,g._startRendering()})),this.body.emitter.on("_stopRendering",(function(){g.renderRequests-=1,g.renderingActive=g.renderRequests>0,g.renderTimer=void 0})),this.body.emitter.on("destroy",(function(){g.renderRequests=0,g.allowRedraw=!1,g.renderingActive=!1,!0===g.requiresTimeout?clearTimeout(g.renderTimer):window.cancelAnimationFrame(g.renderTimer),g.body.emitter.off()}))}},{key:"setOptions",value:function(e){if(void 0!==e){pp(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}}},{key:"_requestNextFrame",value:function(e,g){if("undefined"!=typeof window){var t,A=window;return!0===this.requiresTimeout?t=cc(e,g):A.requestAnimationFrame&&(t=A.requestAnimationFrame(e)),t}}},{key:"_startRendering",value:function(){var e;!0===this.renderingActive&&(void 0===this.renderTimer&&(this.renderTimer=this._requestNextFrame(JA(e=this._renderStep).call(e,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 e=this;!0!==this.redrawRequested&&!1===this.renderingActive&&!0===this.allowRedraw&&(this.redrawRequested=!0,this._requestNextFrame((function(){e._redraw(!1)}),0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!0===this.allowRedraw){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var g={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,i=this.canvas.frame.canvas.clientHeight;if(t.clearRect(0,0,A,i),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===e&&(!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 C=this._drawNodes(t,e),I=C.drawExternalLabels;g.drawExternalLabels=I}!1===e&&(!1===this.dragging||!0===this.dragging&&!1===this.options.hideEdgesOnDrag)&&(!1===this.zooming||!0===this.zooming&&!1===this.options.hideEdgesOnZoom)&&this._drawArrows(t),null!=g.drawExternalLabels&&g.drawExternalLabels(),!1===e&&this._drawSelectionBox(t),t.beginPath(),this.body.emitter.emit("afterDrawing",t),t.closePath(),t.restore(),!0===e&&t.clearRect(0,0,A,i)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var g,t=this.body.nodes;for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&((g=t[A]).resize(e),g.updateBoundingBox(e,g.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var g,t,A=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.nodes,C=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<C.length;d++)if((g=i[C[d]]).hover)n.push(C[d]);else if(g.isSelected())I.push(C[d]);else if(!0===A){var h=g.draw(e);null!=h.drawExternalLabel&&l.push(h.drawExternalLabel)}else if(!0===g.isBoundingBoxOverlappingWith(a)){var c=g.draw(e);null!=c.drawExternalLabel&&l.push(c.drawExternalLabel)}else g.updateBoundingBox(e,g.selected);var u=I.length,p=n.length;for(t=0;t<u;t++){var f=(g=i[I[t]]).draw(e);null!=f.drawExternalLabel&&l.push(f.drawExternalLabel)}for(t=0;t<p;t++){var v=(g=i[n[t]]).draw(e);null!=v.drawExternalLabel&&l.push(v.drawExternalLabel)}return{drawExternalLabels:function(){var e,g=ax(l);try{for(g.s();!(e=g.n()).done;){(0,e.value)()}}catch(e){g.e(e)}finally{g.f()}}}}},{key:"_drawEdges",value:function(e){for(var g=this.body.edges,t=this.body.edgeIndices,A=0;A<t.length;A++){var i=g[t[A]];!0===i.connected&&i.draw(e)}}},{key:"_drawArrows",value:function(e){for(var g=this.body.edges,t=this.body.edgeIndices,A=0;A<t.length;A++){var i=g[t[A]];!0===i.connected&&i.drawArrows(e)}}},{key:"_determineBrowserMethod",value:function(){if("undefined"!=typeof window){var e=navigator.userAgent.toLowerCase();this.requiresTimeout=!1,(-1!=Rh(e).call(e,"msie 9.0")||-1!=Rh(e).call(e,"safari")&&Rh(e).call(e,"chrome")<=-1)&&(this.requiresTimeout=!0)}else this.requiresTimeout=!0}},{key:"_drawSelectionBox",value:function(e){if(this.body.selectionBox.show){e.beginPath();var g=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;e.rect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,g,t),e.fillStyle="rgba(151, 194, 252, 0.2)",e.fillRect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,g,t),e.strokeStyle="rgba(151, 194, 252, 1)",e.stroke()}else e.closePath()}}]),e}(),hx=pe.setInterval;function cx(e,g){g.inputHandler=function(e){e.isFirst&&g(e)},e.on("hammer.input",g.inputHandler)}function ux(e,g){return g.inputHandler=function(e){e.isFinal&&g(e)},e.on("hammer.input",g.inputHandler)}var px=function(){function e(g){ta(this,e),this.body=g,this.pixelRatio=1,this.cameraState={},this.initialized=!1,this.canvasViewCenter={},this._cleanupCallbacks=[],this.options={},this.defaultOptions={autoResize:!0,height:"100%",width:"100%"},NA(this.options,this.defaultOptions),this.bindEventListeners()}return Ca(e,[{key:"bindEventListeners",value:function(){var e,g=this;this.body.emitter.once("resize",(function(e){0!==e.width&&(g.body.view.translation.x=.5*e.width),0!==e.height&&(g.body.view.translation.y=.5*e.height)})),this.body.emitter.on("setSize",JA(e=this.setSize).call(e,this)),this.body.emitter.on("destroy",(function(){g.hammerFrame.destroy(),g.hammer.destroy(),g._cleanUp()}))}},{key:"setOptions",value:function(e){var g,t,A,i,C,I=this;if(void 0!==e){pp(["width","height","autoResize"],this.options,e)}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=hx((function(){!0===I.setSize()&&I.body.emitter.emit("_requestRedraw")}),1e3);this._cleanupCallbacks.push((function(){clearInterval(s)}))}var a=JA(n=this._onResize).call(n,this);g=window,t="resize",A=a,g.addEventListener?(void 0===i&&(i=!1),"mousewheel"===t&&Md(C=navigator.userAgent).call(C,"Firefox")&&(t="DOMMouseScroll"),g.addEventListener(t,A,i)):g.attachEvent("on"+t,A),this._cleanupCallbacks.push((function(){!function(e,g,t,A){var i;e.removeEventListener?(void 0===A&&(A=!1),"mousewheel"===g&&Md(i=navigator.userAgent).call(i,"Firefox")&&(g="DOMMouseScroll"),e.removeEventListener(g,t,A)):e.detachEvent("on"+g,t)}(window,"resize",a)}))}}},{key:"_cleanUp",value:function(){var e,g,t;Ll(e=Xl(g=dd(t=this._cleanupCallbacks).call(t,0)).call(g)).call(e,(function(e){try{e()}catch(e){console.error(e)}}))}},{key:"_onResize",value:function(){this.setSize(),this.body.emitter.emit("_redraw")}},{key:"_getCameraState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pixelRatio;!0===this.initialized&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{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 e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,g=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,t=this.cameraState.scale;1!=e&&1!=g?t=.5*this.cameraState.scale*(e+g):1!=e?t=this.cameraState.scale*e:1!=g&&(t=this.cameraState.scale*g),this.body.view.scale=t;var A=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),i={x:A.x-this.cameraState.position.x,y:A.y-this.cameraState.position.y};this.body.view.translation.x+=i.x*this.body.view.scale,this.body.view.translation.y+=i.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if("number"==typeof e)return e+"px";if("string"==typeof e){if(-1!==Rh(e).call(e,"%")||-1!==Rh(e).call(e,"px"))return e;if(-1===Rh(e).call(e,"%"))return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{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 e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}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 e=this;void 0!==this.hammer&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new _p(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:_p.DIRECTION_ALL}),cx(this.hammer,(function(g){e.body.eventListeners.onTouch(g)})),this.hammer.on("tap",(function(g){e.body.eventListeners.onTap(g)})),this.hammer.on("doubletap",(function(g){e.body.eventListeners.onDoubleTap(g)})),this.hammer.on("press",(function(g){e.body.eventListeners.onHold(g)})),this.hammer.on("panstart",(function(g){e.body.eventListeners.onDragStart(g)})),this.hammer.on("panmove",(function(g){e.body.eventListeners.onDrag(g)})),this.hammer.on("panend",(function(g){e.body.eventListeners.onDragEnd(g)})),this.hammer.on("pinch",(function(g){e.body.eventListeners.onPinch(g)})),this.frame.canvas.addEventListener("wheel",(function(g){e.body.eventListeners.onMouseWheel(g)})),this.frame.canvas.addEventListener("mousemove",(function(g){e.body.eventListeners.onMouseMove(g)})),this.frame.canvas.addEventListener("contextmenu",(function(g){e.body.eventListeners.onContext(g)})),this.hammerFrame=new _p(this.frame),ux(this.hammerFrame,(function(g){e.body.eventListeners.onRelease(g)}))}},{key:"setSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.width,g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.height;e=this._prepareValue(e),g=this._prepareValue(g);var t=!1,A=this.frame.canvas.width,i=this.frame.canvas.height,C=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||g!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=g)this._getCameraState(C),this.frame.style.width=e,this.frame.style.height=g,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=e,this.options.height=g,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(C),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(i/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,t}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(void 0===e)throw new Error("Could not get canvax context");var g=1;return"undefined"!=typeof window&&(g=window.devicePixelRatio||1),g/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(void 0===e)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),e}();function fx(e,g){var t=NA({nodes:g,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},null!=e?e:{});if(!cl(t.nodes))throw new TypeError("Nodes has to be an array of ids.");if(0===t.nodes.length&&(t.nodes=g),!("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 vx=function(){function e(g,t){var A,i,C=this;ta(this,e),this.body=g,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",JA(A=this.fit).call(A,this)),this.body.emitter.on("animationFinished",(function(){C.body.emitter.emit("_stopRendering")})),this.body.emitter.on("unlockNode",JA(i=this.releaseNode).call(i,this))}return Ca(e,[{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e}},{key:"fit",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e=fx(e,this.body.nodeIndices);var t,A,i=this.canvas.frame.canvas.clientWidth,C=this.canvas.frame.canvas.clientHeight;if(0===i||0===C)A=1,t=nx.getRange(this.body.nodes,e.nodes);else if(!0===g){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(e,!1);t=nx.getRange(this.body.nodes,e.nodes);var r=this.body.nodeIndices.length;A=12.662/(r+7.4147)+.0964822;var s=Math.min(i/600,C/600);A*=s}else{this.body.emitter.emit("_resizeNodes"),t=nx.getRange(this.body.nodes,e.nodes);var a=1.1*Math.abs(t.maxX-t.minX),l=1.1*Math.abs(t.maxY-t.minY),d=i/a,h=C/l;A=d<=h?d:h}A>e.maxZoomLevel?A=e.maxZoomLevel:A<e.minZoomLevel&&(A=e.minZoomLevel);var c=nx.findCenter(t),u={position:c,scale:A,animation:e.animation};this.moveTo(u)}},{key:"focus",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==this.body.nodes[e]){var t={x:this.body.nodes[e].x,y:this.body.nodes[e].y};g.position=t,g.lockedOnNode=e,this.moveTo(g)}else console.error("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(void 0!==e){if(null!=e.offset){if(null!=e.offset.x){if(e.offset.x=+e.offset.x,!tm(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(null!=e.offset.y){if(e.offset.y=+e.offset.y,!tm(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(null!=e.position){if(null!=e.position.x){if(e.position.x=+e.position.x,!tm(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(null!=e.position.y){if(e.position.y=+e.position.y,!tm(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(null!=e.scale){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;void 0===e.animation&&(e.animation={duration:0}),!1===e.animation&&(e.animation={duration:0}),!0===e.animation&&(e.animation={}),void 0===e.animation.duration&&(e.animation.duration=1e3),void 0===e.animation.easingFunction&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}else e={}}},{key:"animateView",value:function(e){if(void 0!==e){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),!0===e.locked&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),0!=this.easingTime&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var g,t,A=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i=A.x-e.position.x,C=A.y-e.position.y;if(this.targetTranslation={x:this.sourceTranslation.x+i*this.targetScale+e.offset.x,y:this.sourceTranslation.y+C*this.targetScale+e.offset.y},0===e.animation.duration)if(null!=this.lockedOnNodeId)this.viewFunction=JA(g=this._lockedRedraw).call(g,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*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=JA(t=this._transitionRedraw).call(t,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}},{key:"_lockedRedraw",value:function(){var e=this.body.nodes[this.lockedOnNodeId].x,g=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-e,i=t.y-g,C=this.body.view.translation,I={x:C.x+A*this.body.view.scale+this.lockedOnNodeOffset.x,y:C.y+i*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 e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.easingTime+=this.animationSpeed,this.easingTime=!0===e?1:this.easingTime;var g=zp[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*g,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*g,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*g},this.easingTime>=1){var t;if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,null!=this.lockedOnNodeId)this.viewFunction=JA(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})}}]),e}();function mx(e){var g,t=e&&e.preventDefault||!1,A=e&&e.container||window,i={},C={keydown:{},keyup:{}},I={};for(g=97;g<=122;g++)I[String.fromCharCode(g)]={code:g-97+65,shift:!1};for(g=65;g<=90;g++)I[String.fromCharCode(g)]={code:g,shift:!0};for(g=0;g<=9;g++)I[""+g]={code:48+g,shift:!1};for(g=1;g<=12;g++)I["F"+g]={code:111+g,shift:!1};for(g=0;g<=9;g++)I["num"+g]={code:96+g,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(e){r(e,"keydown")},o=function(e){r(e,"keyup")},r=function(e,g){if(void 0!==C[g][e.keyCode]){for(var A=C[g][e.keyCode],i=0;i<A.length;i++)(void 0===A[i].shift||1==A[i].shift&&1==e.shiftKey||0==A[i].shift&&0==e.shiftKey)&&A[i].fn(e);1==t&&e.preventDefault()}};return i.bind=function(e,g,t){if(void 0===t&&(t="keydown"),void 0===I[e])throw new Error("unsupported key: "+e);void 0===C[t][I[e].code]&&(C[t][I[e].code]=[]),C[t][I[e].code].push({fn:g,shift:I[e].shift})},i.bindAll=function(e,g){for(var t in void 0===g&&(g="keydown"),I)I.hasOwnProperty(t)&&i.bind(t,e,g)},i.getKey=function(e){for(var g in I)if(I.hasOwnProperty(g)){if(1==e.shiftKey&&1==I[g].shift&&e.keyCode==I[g].code)return g;if(0==e.shiftKey&&0==I[g].shift&&e.keyCode==I[g].code)return g;if(e.keyCode==I[g].code&&"shift"==g)return g}return"unknown key, currently not supported"},i.unbind=function(e,g,t){if(void 0===t&&(t="keydown"),void 0===I[e])throw new Error("unsupported key: "+e);if(void 0!==g){var A=[],i=C[t][I[e].code];if(void 0!==i)for(var n=0;n<i.length;n++)i[n].fn==g&&i[n].shift==I[e].shift||A.push(C[t][I[e].code][n]);C[t][I[e].code]=A}else C[t][I[e].code]=[]},i.reset=function(){C={keydown:{},keyup:{}}},i.destroy=function(){C={keydown:{},keyup:{}},A.removeEventListener("keydown",n,!0),A.removeEventListener("keyup",o,!0)},A.addEventListener("keydown",n,!0),A.addEventListener("keyup",o,!0),i}ii("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,[encoded data, 5948 characters]');\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,[encoded data, 5948 characters]');\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,[encoded data, 6044 characters]');\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,[encoded data, 6020 characters]');\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,[encoded data, 5788 characters]');\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,[encoded data, 5532 characters]');\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,[encoded data, 5952 characters]');\n  bottom: 50px;\n  right: 15px;\n}\n");var yx=function(){function e(g,t){var A=this;ta(this,e),this.body=g,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 Ca(e,[{key:"setOptions",value:function(e){void 0!==e&&(this.options=e,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 e=0;e<this.navigationHammers.length;e++)this.navigationHammers[e].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 e=this;this.cleanNavigation(),this.navigationDOM={};var g=["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<g.length;A++){this.navigationDOM[g[A]]=document.createElement("div"),this.navigationDOM[g[A]].className="vis-button vis-"+g[A],this.navigationDOM.wrapper.appendChild(this.navigationDOM[g[A]]);var i,C,I=new _p(this.navigationDOM[g[A]]);if("_fit"===t[A])cx(I,JA(i=this._fit).call(i,this));else cx(I,JA(C=this.bindToRedraw).call(C,this,t[A]));this.navigationHammers.push(I)}var n=new _p(this.canvas.frame);ux(n,(function(){e._stopMovement()})),this.navigationHammers.push(n),this.iconsCreated=!0}},{key:"bindToRedraw",value:function(e){var g;void 0===this.boundFunctions[e]&&(this.boundFunctions[e]=JA(g=this[e]).call(g,this),this.body.emitter.on("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_startRendering"))}},{key:"unbindFromRedraw",value:function(e){void 0!==this.boundFunctions[e]&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[e])}},{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 e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),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 e=this.body.view.scale,g=this.body.view.scale*(1+this.options.keyboard.speed.zoom),t=this.body.view.translation,A=g/e,i=(1-A)*this.canvas.canvasViewCenter.x+t.x*A,C=(1-A)*this.canvas.canvasViewCenter.y+t.y*A;this.body.view.scale=g,this.body.view.translation={x:i,y:C},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,g=this.body.view.scale/(1+this.options.keyboard.speed.zoom),t=this.body.view.translation,A=g/e,i=(1-A)*this.canvas.canvasViewCenter.x+t.x*A,C=(1-A)*this.canvas.canvasViewCenter.y+t.y*A;this.body.view.scale=g,this.body.view.translation={x:i,y:C},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e,g,t,A,i,C,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=mx({container:window,preventDefault:!0}):this.keycharm=mx({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),!0===this.activated&&(JA(e=this.keycharm).call(e,"up",(function(){k.bindToRedraw("_moveUp")}),"keydown"),JA(g=this.keycharm).call(g,"down",(function(){k.bindToRedraw("_moveDown")}),"keydown"),JA(t=this.keycharm).call(t,"left",(function(){k.bindToRedraw("_moveLeft")}),"keydown"),JA(A=this.keycharm).call(A,"right",(function(){k.bindToRedraw("_moveRight")}),"keydown"),JA(i=this.keycharm).call(i,"=",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),JA(C=this.keycharm).call(C,"num+",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),JA(I=this.keycharm).call(I,"num-",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),JA(n=this.keycharm).call(n,"-",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),JA(o=this.keycharm).call(o,"[",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),JA(r=this.keycharm).call(r,"]",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),JA(s=this.keycharm).call(s,"pageup",(function(){k.bindToRedraw("_zoomIn")}),"keydown"),JA(a=this.keycharm).call(a,"pagedown",(function(){k.bindToRedraw("_zoomOut")}),"keydown"),JA(l=this.keycharm).call(l,"up",(function(){k.unbindFromRedraw("_moveUp")}),"keyup"),JA(d=this.keycharm).call(d,"down",(function(){k.unbindFromRedraw("_moveDown")}),"keyup"),JA(h=this.keycharm).call(h,"left",(function(){k.unbindFromRedraw("_moveLeft")}),"keyup"),JA(c=this.keycharm).call(c,"right",(function(){k.unbindFromRedraw("_moveRight")}),"keyup"),JA(u=this.keycharm).call(u,"=",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),JA(p=this.keycharm).call(p,"num+",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),JA(f=this.keycharm).call(f,"num-",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup"),JA(v=this.keycharm).call(v,"-",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup"),JA(m=this.keycharm).call(m,"[",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup"),JA(y=this.keycharm).call(y,"]",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),JA(b=this.keycharm).call(b,"pageup",(function(){k.unbindFromRedraw("_zoomIn")}),"keyup"),JA(w=this.keycharm).call(w,"pagedown",(function(){k.unbindFromRedraw("_zoomOut")}),"keyup")))}}]),e}();function bx(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return wx(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return wx(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function wx(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}var kx=function(){function e(g,t,A){var i,C,I,n,o,r,s,a,l,d,h,c,u;ta(this,e),this.body=g,this.canvas=t,this.selectionHandler=A,this.navigationHandler=new yx(g,t),this.body.eventListeners.onTap=JA(i=this.onTap).call(i,this),this.body.eventListeners.onTouch=JA(C=this.onTouch).call(C,this),this.body.eventListeners.onDoubleTap=JA(I=this.onDoubleTap).call(I,this),this.body.eventListeners.onHold=JA(n=this.onHold).call(n,this),this.body.eventListeners.onDragStart=JA(o=this.onDragStart).call(o,this),this.body.eventListeners.onDrag=JA(r=this.onDrag).call(r,this),this.body.eventListeners.onDragEnd=JA(s=this.onDragEnd).call(s,this),this.body.eventListeners.onMouseWheel=JA(a=this.onMouseWheel).call(a,this),this.body.eventListeners.onPinch=JA(l=this.onPinch).call(l,this),this.body.eventListeners.onMouseMove=JA(d=this.onMouseMove).call(d,this),this.body.eventListeners.onRelease=JA(h=this.onRelease).call(h,this),this.body.eventListeners.onContext=JA(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=JA(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,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},NA(this.options,this.defaultOptions),this.bindEventListeners()}return Ca(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("destroy",(function(){clearTimeout(e.popupTimer),delete e.body.functions.getPointer}))}},{key:"setOptions",value:function(e){if(void 0!==e){fp(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),Bp(this.options,e,"keyboard"),e.tooltip&&(NA(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=Op(e.tooltip.color)))}this.navigationHandler.setOptions(this.options)}},{key:"getPointer",value:function(e){return{x:e.x-(g=this.canvas.frame.canvas,g.getBoundingClientRect().left),y:e.y-bp(this.canvas.frame.canvas)};var g}},{key:"onTouch",value:function(e){(new Date).valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=(new Date).valueOf())}},{key:"onTap",value:function(e){var g=this.getPointer(e.center),t=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(g,t),this.selectionHandler.commitAndEmit(g,e),this.selectionHandler.generateClickEvent("click",e,g)}},{key:"onDoubleTap",value:function(e){var g=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,g)}},{key:"onHold",value:function(e){var g=this.getPointer(e.center),t=this.selectionHandler.options.multiselect;this.checkSelectionChanges(g,t),this.selectionHandler.commitAndEmit(g,e),this.selectionHandler.generateClickEvent("click",e,g),this.selectionHandler.generateClickEvent("hold",e,g)}},{key:"onRelease",value:function(e){if((new Date).valueOf()-this.touchTime>10){var g=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,g),this.touchTime=(new Date).valueOf()}}},{key:"onContext",value:function(e){var g=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,g)}},{key:"checkSelectionChanges",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!0===g?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}},{key:"_determineDifference",value:function(e,g){var t=function(e,g){for(var t=[],A=0;A<e.length;A++){var i=e[A];-1===Rh(g).call(g,i)&&t.push(i)}return t};return{nodes:t(e.nodes,g.nodes),edges:t(e.edges,g.edges)}}},{key:"onDragStart",value:function(e){if(!this.drag.dragging){void 0===this.drag.pointer&&this.onTouch(e);var g=this.selectionHandler.getNodeAt(this.drag.pointer);if(this.drag.dragging=!0,this.drag.selection=[],this.drag.translation=NA({},this.body.view.translation),this.drag.nodeId=void 0,e.srcEvent.shiftKey){this.body.selectionBox.show=!0;var t=this.getPointer(e.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!==g&&!0===this.options.dragNodes){this.drag.nodeId=g.id,!1===g.isSelected()&&this.selectionHandler.setSelection({nodes:[g.id]}),this.selectionHandler.generateClickEvent("dragStart",e,this.drag.pointer);var A,i=bx(this.selectionHandler.getSelectedNodes());try{for(i.s();!(A=i.n()).done;){var C=A.value,I={id:C.id,node:C,x:C.x,y:C.y,xFixed:C.options.fixed.x,yFixed:C.options.fixed.y};C.options.fixed.x=!0,C.options.fixed.y=!0,this.drag.selection.push(I)}}catch(e){i.e(e)}finally{i.f()}}else this.selectionHandler.generateClickEvent("dragStart",e,this.drag.pointer,void 0,!0)}}},{key:"onDrag",value:function(e){var g=this;if(!0!==this.drag.pinched){this.body.emitter.emit("unlockNode");var t=this.getPointer(e.center),A=this.drag.selection;if(A&&A.length&&!0===this.options.dragNodes){this.selectionHandler.generateClickEvent("dragging",e,t);var i=t.x-this.drag.pointer.x,C=t.y-this.drag.pointer.y;Ll(A).call(A,(function(e){var t=e.node;!1===e.xFixed&&(t.x=g.canvas._XconvertDOMtoCanvas(g.canvas._XconvertCanvasToDOM(e.x)+i)),!1===e.yFixed&&(t.y=g.canvas._YconvertDOMtoCanvas(g.canvas._YconvertCanvasToDOM(e.y)+C))})),this.body.emitter.emit("startSimulation")}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),void 0===this.drag.pointer)return void this.onDragStart(e);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&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),void 0===this.drag.pointer)return void this.onDragStart(e);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(e){var g=this;if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;var A=this.body.selectionBox.position,i={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)},C=_d(t=this.body.nodeIndices).call(t,(function(e){var t=g.body.nodes[e];return t.x>=i.minX&&t.x<=i.maxX&&t.y>=i.minY&&t.y<=i.maxY}));Ll(C).call(C,(function(e){return g.selectionHandler.selectObject(g.body.nodes[e])}));var I=this.getPointer(e.center);this.selectionHandler.commitAndEmit(I,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var n=this.drag.selection;n&&n.length?(Ll(n).call(n,(function(e){e.node.options.fixed.x=e.xFixed,e.node.options.fixed.y=e.yFixed})),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(e){var g=this.getPointer(e.center);this.drag.pinched=!0,void 0===this.pinch.scale&&(this.pinch.scale=1);var t=this.pinch.scale*e.scale;this.zoom(t,g)}},{key:"zoom",value:function(e,g){if(!0===this.options.zoomView){var t=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);var A=void 0;void 0!==this.drag&&!0===this.drag.dragging&&(A=this.canvas.DOMtoCanvas(this.drag.pointer));var i=this.body.view.translation,C=e/t,I=(1-C)*g.x+i.x*C,n=(1-C)*g.y+i.y*C;if(this.body.view.scale=e,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<e?this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:g}):this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:g})}}},{key:"onMouseWheel",value:function(e){if(!0===this.options.zoomView){if(0!==e.deltaY){var g=this.body.view.scale;g*=1+(e.deltaY<0?1:-1)*(.1*this.options.zoomSpeed);var t=this.getPointer({x:e.clientX,y:e.clientY});this.zoom(g,t)}e.preventDefault()}}},{key:"onMouseMove",value:function(e){var g=this,t=this.getPointer({x:e.clientX,y:e.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())),this.options.keyboard.autoFocus&&!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=cc((function(){return g._checkShowPopup(t)}),this.options.tooltipDelay))),!0===this.options.hover&&this.selectionHandler.hoverObject(e,t)}},{key:"_checkShowPopup",value:function(e){var g=this.canvas._XconvertDOMtoCanvas(e.x),t=this.canvas._YconvertDOMtoCanvas(e.y),A={left:g,top:t,right:g,bottom:t},i=void 0===this.popupObj?void 0:this.popupObj.id,C=!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)&&(C=!0,void 0!==n.getTitle()&&s.push(o[a]));s.length>0&&(this.popupObj=r[s[s.length-1]],C=!0)}if(void 0===this.popupObj&&!1===C){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!==i&&(void 0===this.popup&&(this.popup=new Up(this.canvas.frame)),this.popup.popupTargetType=I,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.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(e){var g=this.selectionHandler._pointerToPositionObject(e),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(g))){var A=this.selectionHandler.getNodeAt(e);t=void 0!==A&&A.id===this.popup.popupTargetId}}else void 0===this.selectionHandler.getNodeAt(e)&&void 0!==this.body.edges[this.popup.popupTargetId]&&(t=this.body.edges[this.popup.popupTargetId].isOverlappingWith(g));!1===t&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),e}(),xx=G,Ex=Mv,Ox=Nf.exports.getWeakData,Tx=vt,Dx=ue,Nx=uv,Rx=dv,Px=ag,Sx=IC.set,Mx=IC.getterFor,Bx=er.find,zx=er.findIndex,Fx=xx([].splice),Zx=0,jx=function(e){return e.frozen||(e.frozen=new Gx)},Gx=function(){this.entries=[]},Lx=function(e,g){return Bx(e.entries,(function(e){return e[0]===g}))};Gx.prototype={get:function(e){var g=Lx(this,e);if(g)return g[1]},has:function(e){return!!Lx(this,e)},set:function(e,g){var t=Lx(this,e);t?t[1]=g:this.entries.push([e,g])},delete:function(e){var g=zx(this.entries,(function(g){return g[0]===e}));return~g&&Fx(this.entries,g,1),!!~g}};var Vx,Yx={getConstructor:function(e,g,t,A){var i=e((function(e,i){Nx(e,C),Sx(e,{type:g,id:Zx++,frozen:void 0}),null!=i&&Rx(i,e[A],{that:e,AS_ENTRIES:t})})),C=i.prototype,I=Mx(g),n=function(e,g,t){var A=I(e),i=Ox(Tx(g),!0);return!0===i?jx(A).set(g,t):i[A.id]=t,e};return Ex(C,{delete:function(e){var g=I(this);if(!Dx(e))return!1;var t=Ox(e);return!0===t?jx(g).delete(e):t&&Px(t,g.id)&&delete t[g.id]},has:function(e){var g=I(this);if(!Dx(e))return!1;var t=Ox(e);return!0===t?jx(g).has(e):t&&Px(t,g.id)}}),Ex(C,t?{get:function(e){var g=I(this);if(Dx(e)){var t=Ox(e);return!0===t?jx(g).get(e):t?t[g.id]:void 0}},set:function(e,g){return n(this,e,g)}}:{add:function(e){return n(this,e,!0)}}),i}},Wx=O,_x=G,Ux=Mv,Qx=Nf.exports,Hx=Pv,Kx=Yx,Xx=ue,Jx=Ff,qx=IC.enforce,$x=ji,eE=!Wx.ActiveXObject&&"ActiveXObject"in Wx,gE=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},tE=Hx("WeakMap",gE,Kx);if($x&&eE){Vx=Kx.getConstructor(gE,"WeakMap",!0),Qx.enable();var AE=tE.prototype,iE=_x(AE.delete),CE=_x(AE.has),IE=_x(AE.get),nE=_x(AE.set);Ux(AE,{delete:function(e){if(Xx(e)&&!Jx(e)){var g=qx(this);return g.frozen||(g.frozen=new Vx),iE(this,e)||g.frozen.delete(e)}return iE(this,e)},has:function(e){if(Xx(e)&&!Jx(e)){var g=qx(this);return g.frozen||(g.frozen=new Vx),CE(this,e)||g.frozen.has(e)}return CE(this,e)},get:function(e){if(Xx(e)&&!Jx(e)){var g=qx(this);return g.frozen||(g.frozen=new Vx),CE(this,e)?IE(this,e):g.frozen.get(e)}return IE(this,e)},set:function(e,g){if(Xx(e)&&!Jx(e)){var t=qx(this);t.frozen||(t.frozen=new Vx),CE(this,e)?nE(this,e,g):t.frozen.set(e,g)}else nE(this,e,g);return this}})}var oE,rE,sE,aE,lE,dE=pe.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 hE(e,g,t,A){if("a"===t&&!A)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof g?e!==g||!A:!g.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?A:"a"===t?A.call(e):A?A.value:g.get(e)}function cE(e,g,t,A,i){if("m"===A)throw new TypeError("Private method is not writable");if("a"===A&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof g?e!==g||!i:!g.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===A?i.call(e,t):i?i.value=t:g.set(e,t),t}function uE(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return pE(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return pE(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function pE(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}function fE(e,g){var t,A=new ry,i=uE(g);try{for(i.s();!(t=i.n()).done;){var C=t.value;e.has(C)||A.add(C)}}catch(e){i.e(e)}finally{i.f()}return A}var vE=function(){function e(){ta(this,e),oE.set(this,new ry),rE.set(this,new ry)}return Ca(e,[{key:"size",get:function(){return hE(this,rE,"f").size}},{key:"add",value:function(){for(var e=arguments.length,g=new Array(e),t=0;t<e;t++)g[t]=arguments[t];for(var A=0,i=g;A<i.length;A++){var C=i[A];hE(this,rE,"f").add(C)}}},{key:"delete",value:function(){for(var e=arguments.length,g=new Array(e),t=0;t<e;t++)g[t]=arguments[t];for(var A=0,i=g;A<i.length;A++){var C=i[A];hE(this,rE,"f").delete(C)}}},{key:"clear",value:function(){hE(this,rE,"f").clear()}},{key:"getSelection",value:function(){return Il(hE(this,rE,"f"))}},{key:"getChanges",value:function(){return{added:Il(fE(hE(this,oE,"f"),hE(this,rE,"f"))),deleted:Il(fE(hE(this,rE,"f"),hE(this,oE,"f"))),previous:Il(new ry(hE(this,oE,"f"))),current:Il(new ry(hE(this,rE,"f")))}}},{key:"commit",value:function(){var e=this.getChanges();cE(this,oE,hE(this,rE,"f"),"f"),cE(this,rE,new ry(hE(this,oE,"f")),"f");var g,t=uE(e.added);try{for(t.s();!(g=t.n()).done;){g.value.select()}}catch(e){t.e(e)}finally{t.f()}var A,i=uE(e.deleted);try{for(i.s();!(A=i.n()).done;){A.value.unselect()}}catch(e){i.e(e)}finally{i.f()}return e}}]),e}();oE=new dE,rE=new dE;var mE=function(){function e(){var g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};ta(this,e),sE.set(this,new vE),aE.set(this,new vE),lE.set(this,void 0),cE(this,lE,g,"f")}return Ca(e,[{key:"sizeNodes",get:function(){return hE(this,sE,"f").size}},{key:"sizeEdges",get:function(){return hE(this,aE,"f").size}},{key:"getNodes",value:function(){return hE(this,sE,"f").getSelection()}},{key:"getEdges",value:function(){return hE(this,aE,"f").getSelection()}},{key:"addNodes",value:function(){var e;(e=hE(this,sE,"f")).add.apply(e,arguments)}},{key:"addEdges",value:function(){var e;(e=hE(this,aE,"f")).add.apply(e,arguments)}},{key:"deleteNodes",value:function(e){hE(this,sE,"f").delete(e)}},{key:"deleteEdges",value:function(e){hE(this,aE,"f").delete(e)}},{key:"clear",value:function(){hE(this,sE,"f").clear(),hE(this,aE,"f").clear()}},{key:"commit",value:function(){for(var e,g,t={nodes:hE(this,sE,"f").commit(),edges:hE(this,aE,"f").commit()},A=arguments.length,i=new Array(A),C=0;C<A;C++)i[C]=arguments[C];return(e=hE(this,lE,"f")).call.apply(e,ll(g=[this,t]).call(g,i)),t}}]),e}();function yE(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return bE(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return bE(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function bE(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}sE=new dE,aE=new dE,lE=new dE;var wE=function(){function e(g,t){var A=this;ta(this,e),this.body=g,this.canvas=t,this._selectionAccumulator=new mE,this.hoverObj={nodes:{},edges:{}},this.options={},this.defaultOptions={multiselect:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0},NA(this.options,this.defaultOptions),this.body.emitter.on("_dataChanged",(function(){A.updateSelection()}))}return Ca(e,[{key:"setOptions",value:function(e){if(void 0!==e){pp(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,e)}}},{key:"selectOnPoint",value:function(e){var g=!1;if(!0===this.options.selectable){var t=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),void 0!==t&&(g=this.selectObject(t)),this.body.emitter.emit("_requestRedraw")}return g}},{key:"selectAdditionalOnPoint",value:function(e){var g=!1;if(!0===this.options.selectable){var t=this.getNodeAt(e)||this.getEdgeAt(e);void 0!==t&&(g=!0,!0===t.isSelected()?this.deselectObject(t):this.selectObject(t),this.body.emitter.emit("_requestRedraw"))}return g}},{key:"_initBaseEvent",value:function(e,g){var t={};return t.pointer={DOM:{x:g.x,y:g.y},canvas:this.canvas.DOMtoCanvas(g)},t.event=e,t}},{key:"generateClickEvent",value:function(e,g,t,A){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],C=this._initBaseEvent(g,t);if(!0===i)C.nodes=[],C.edges=[];else{var I=this.getSelection();C.nodes=I.nodes,C.edges=I.edges}void 0!==A&&(C.previousSelection=A),"click"==e&&(C.items=this.getClickedItems(t)),void 0!==g.controlEdge&&(C.controlEdge=g.controlEdge),this.body.emitter.emit(e,C)}},{key:"selectObject",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.selectConnectedEdges;if(void 0!==e){if(e instanceof Xw){var t;if(!0===g)(t=this._selectionAccumulator).addEdges.apply(t,Il(e.edges));this._selectionAccumulator.addNodes(e)}else this._selectionAccumulator.addEdges(e);return!0}return!1}},{key:"deselectObject",value:function(e){!0===e.isSelected()&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var g=[],t=this.body.nodes,A=0;A<this.body.nodeIndices.length;A++){var i=this.body.nodeIndices[A];t[i].isOverlappingWith(e)&&g.push(i)}return g}},{key:"_pointerToPositionObject",value:function(e){var g=this.canvas.DOMtoCanvas(e);return{left:g.x-1,top:g.y+1,right:g.x+1,bottom:g.y-1}}},{key:"getNodeAt",value:function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this._pointerToPositionObject(e),A=this._getAllNodesOverlappingWith(t);return A.length>0?!0===g?this.body.nodes[A[A.length-1]]:A[A.length-1]:void 0}},{key:"_getEdgesOverlappingWith",value:function(e,g){for(var t=this.body.edges,A=0;A<this.body.edgeIndices.length;A++){var i=this.body.edgeIndices[A];t[i].isOverlappingWith(e)&&g.push(i)}}},{key:"_getAllEdgesOverlappingWith",value:function(e){var g=[];return this._getEdgesOverlappingWith(e,g),g}},{key:"getEdgeAt",value:function(e){for(var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this.canvas.DOMtoCanvas(e),A=10,i=null,C=this.body.edges,I=0;I<this.body.edgeIndices.length;I++){var n=this.body.edgeIndices[I],o=C[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&&(i=n,A=d)}}return null!==i?!0===g?this.body.edges[i]:i:void 0}},{key:"_addToHover",value:function(e){e instanceof Xw?this.hoverObj.nodes[e.id]=e:this.hoverObj.edges[e.id]=e}},{key:"_removeFromSelection",value:function(e){var g;e instanceof Xw?(this._selectionAccumulator.deleteNodes(e),(g=this._selectionAccumulator).deleteEdges.apply(g,Il(e.edges))):this._selectionAccumulator.deleteEdges(e)}},{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(e){for(var g=0;g<e.edges.length;g++){var t=e.edges[g];t.hover=!0,this._addToHover(t)}}},{key:"emitBlurEvent",value:function(e,g,t){var A=this._initBaseEvent(e,g);!0===t.hover&&(t.hover=!1,t instanceof Xw?(A.node=t.id,this.body.emitter.emit("blurNode",A)):(A.edge=t.id,this.body.emitter.emit("blurEdge",A)))}},{key:"emitHoverEvent",value:function(e,g,t){var A=this._initBaseEvent(e,g),i=!1;return!1===t.hover&&(t.hover=!0,this._addToHover(t),i=!0,t instanceof Xw?(A.node=t.id,this.body.emitter.emit("hoverNode",A)):(A.edge=t.id,this.body.emitter.emit("hoverEdge",A))),i}},{key:"hoverObject",value:function(e,g){var t=this.getNodeAt(g);void 0===t&&(t=this.getEdgeAt(g));var A=!1;for(var i in this.hoverObj.nodes)Object.prototype.hasOwnProperty.call(this.hoverObj.nodes,i)&&(void 0===t||t instanceof Xw&&t.id!=i||t instanceof Hk)&&(this.emitBlurEvent(e,g,this.hoverObj.nodes[i]),delete this.hoverObj.nodes[i],A=!0);for(var C in this.hoverObj.edges)Object.prototype.hasOwnProperty.call(this.hoverObj.edges,C)&&(!0===A?(this.hoverObj.edges[C].hover=!1,delete this.hoverObj.edges[C]):(void 0===t||t instanceof Hk&&t.id!=C||t instanceof Xw&&!t.hover)&&(this.emitBlurEvent(e,g,this.hoverObj.edges[C]),delete this.hoverObj.edges[C],A=!0));if(void 0!==t){var I=kl(this.hoverObj.edges).length,n=kl(this.hoverObj.nodes).length;(A||t instanceof Hk&&0===I&&0===n||t instanceof Xw&&0===I&&0===n)&&(A=this.emitHoverEvent(e,g,t)),t instanceof Xw&&!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(e,g){var t=!1,A=this._selectionAccumulator.commit(),i={nodes:A.nodes.previous,edges:A.edges.previous};A.edges.deleted.length>0&&(this.generateClickEvent("deselectEdge",g,e,i),t=!0),A.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",g,e,i),t=!0),A.nodes.added.length>0&&(this.generateClickEvent("selectNode",g,e),t=!0),A.edges.added.length>0&&(this.generateClickEvent("selectEdge",g,e),t=!0),!0===t&&this.generateClickEvent("select",g,e)}},{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 e;return yl(e=this._selectionAccumulator.getNodes()).call(e,(function(e){return e.id}))}},{key:"getSelectedEdgeIds",value:function(){var e;return yl(e=this._selectionAccumulator.getEdges()).call(e,(function(e){return e.id}))}},{key:"setSelection",value:function(e){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((g.unselectAll||void 0===g.unselectAll)&&this.unselectAll(),e.nodes){var t,A=yE(e.nodes);try{for(A.s();!(t=A.n()).done;){var i=t.value,C=this.body.nodes[i];if(!C)throw new RangeError('Node with id "'+i+'" not found');this.selectObject(C,g.highlightEdges)}}catch(e){A.e(e)}finally{A.f()}}if(e.edges){var I,n=yE(e.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(e){n.e(e)}finally{n.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(e){var g=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:g})}},{key:"selectEdges",value:function(e){if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(var g in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,g.id)||this._selectionAccumulator.deleteEdges(g)}},{key:"getClickedItems",value:function(e){for(var g=this.canvas.DOMtoCanvas(e),t=[],A=this.body.nodeIndices,i=this.body.nodes,C=A.length-1;C>=0;C--){var I=i[A[C]].getItemsOnPoint(g);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(g);t.push.apply(t,s)}return t}}]),e}(),kE={};!function(e){function g(e,g){if(!(e instanceof g))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0,e.sort=c;var t=32,A=7,i=256,C=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9];function I(e){return e<1e5?e<100?e<10?0:1:e<1e4?e<1e3?2:3:4:e<1e7?e<1e6?5:6:e<1e9?e<1e8?7:8:9}function n(e,g){if(e===g)return 0;if(~~e===e&&~~g===g){if(0===e||0===g)return e<g?-1:1;if(e<0||g<0){if(g>=0)return-1;if(e>=0)return 1;e=-e,g=-g}var t=I(e),A=I(g),i=0;return t<A?(e*=C[A-t-1],g/=10,i=-1):t>A&&(g*=C[t-A-1],e/=10,i=1),e===g?i:e<g?-1:1}var n=String(e),o=String(g);return n===o?0:n<o?-1:1}function o(e){for(var g=0;e>=t;)g|=1&e,e>>=1;return e+g}function r(e,g,t,A){var i=g+1;if(i===t)return 1;if(A(e[i++],e[g])<0){for(;i<t&&A(e[i],e[i-1])<0;)i++;s(e,g,i)}else for(;i<t&&A(e[i],e[i-1])>=0;)i++;return i-g}function s(e,g,t){for(t--;g<t;){var A=e[g];e[g++]=e[t],e[t--]=A}}function a(e,g,t,A,i){for(A===g&&A++;A<t;A++){for(var C=e[A],I=g,n=A;I<n;){var o=I+n>>>1;i(C,e[o])<0?n=o:I=o+1}var r=A-I;switch(r){case 3:e[I+3]=e[I+2];case 2:e[I+2]=e[I+1];case 1:e[I+1]=e[I];break;default:for(;r>0;)e[I+r]=e[I+r-1],r--}e[I]=C}}function l(e,g,t,A,i,C){var I=0,n=0,o=1;if(C(e,g[t+i])>0){for(n=A-i;o<n&&C(e,g[t+i+o])>0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n),I+=i,o+=i}else{for(n=i+1;o<n&&C(e,g[t+i-o])<=0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n);var r=I;I=i-o,o=i-r}for(I++;I<o;){var s=I+(o-I>>>1);C(e,g[t+s])>0?I=s+1:o=s}return o}function d(e,g,t,A,i,C){var I=0,n=0,o=1;if(C(e,g[t+i])<0){for(n=i+1;o<n&&C(e,g[t+i-o])<0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n);var r=I;I=i-o,o=i-r}else{for(n=A-i;o<n&&C(e,g[t+i+o])>=0;)I=o,(o=1+(o<<1))<=0&&(o=n);o>n&&(o=n),I+=i,o+=i}for(I++;I<o;){var s=I+(o-I>>>1);C(e,g[t+s])<0?o=s:I=s+1}return o}var h=function(){function e(t,C){g(this,e),this.array=null,this.compare=null,this.minGallop=A,this.length=0,this.tmpStorageLength=i,this.stackLength=0,this.runStart=null,this.runLength=null,this.stackSize=0,this.array=t,this.compare=C,this.length=t.length,this.length<2*i&&(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 e.prototype.pushRun=function(e,g){this.runStart[this.stackSize]=e,this.runLength[this.stackSize]=g,this.stackSize+=1},e.prototype.mergeRuns=function(){for(;this.stackSize>1;){var e=this.stackSize-2;if(e>=1&&this.runLength[e-1]<=this.runLength[e]+this.runLength[e+1]||e>=2&&this.runLength[e-2]<=this.runLength[e]+this.runLength[e-1])this.runLength[e-1]<this.runLength[e+1]&&e--;else if(this.runLength[e]>this.runLength[e+1])break;this.mergeAt(e)}},e.prototype.forceMergeRuns=function(){for(;this.stackSize>1;){var e=this.stackSize-2;e>0&&this.runLength[e-1]<this.runLength[e+1]&&e--,this.mergeAt(e)}},e.prototype.mergeAt=function(e){var g=this.compare,t=this.array,A=this.runStart[e],i=this.runLength[e],C=this.runStart[e+1],I=this.runLength[e+1];this.runLength[e]=i+I,e===this.stackSize-3&&(this.runStart[e+1]=this.runStart[e+2],this.runLength[e+1]=this.runLength[e+2]),this.stackSize--;var n=d(t[C],t,A,i,0,g);A+=n,0!=(i-=n)&&0!==(I=l(t[A+i-1],t,C,I,I-1,g))&&(i<=I?this.mergeLow(A,i,C,I):this.mergeHigh(A,i,C,I))},e.prototype.mergeLow=function(e,g,t,i){var C=this.compare,I=this.array,n=this.tmp,o=0;for(o=0;o<g;o++)n[o]=I[e+o];var r=0,s=t,a=e;if(I[a++]=I[s++],0!=--i)if(1!==g){for(var h=this.minGallop;;){var c=0,u=0,p=!1;do{if(C(I[s],n[r])<0){if(I[a++]=I[s++],u++,c=0,0==--i){p=!0;break}}else if(I[a++]=n[r++],c++,u=0,1==--g){p=!0;break}}while((c|u)<h);if(p)break;do{if(0!==(c=d(I[s],n,r,g,0,C))){for(o=0;o<c;o++)I[a+o]=n[r+o];if(a+=c,r+=c,(g-=c)<=1){p=!0;break}}if(I[a++]=I[s++],0==--i){p=!0;break}if(0!==(u=l(n[r],I,s,i,0,C))){for(o=0;o<u;o++)I[a+o]=I[s+o];if(a+=u,s+=u,0==(i-=u)){p=!0;break}}if(I[a++]=n[r++],1==--g){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===g){for(o=0;o<i;o++)I[a+o]=I[s+o];I[a+i]=n[r]}else{if(0===g)throw new Error("mergeLow preconditions were not respected");for(o=0;o<g;o++)I[a+o]=n[r+o]}}else{for(o=0;o<i;o++)I[a+o]=I[s+o];I[a+i]=n[r]}else for(o=0;o<g;o++)I[a+o]=n[r+o]},e.prototype.mergeHigh=function(e,g,t,i){var C=this.compare,I=this.array,n=this.tmp,o=0;for(o=0;o<i;o++)n[o]=I[t+o];var r=e+g-1,s=i-1,a=t+i-1,h=0,c=0;if(I[a--]=I[r--],0!=--g)if(1!==i){for(var u=this.minGallop;;){var p=0,f=0,v=!1;do{if(C(n[s],I[r])<0){if(I[a--]=I[r--],p++,f=0,0==--g){v=!0;break}}else if(I[a--]=n[s--],f++,p=0,1==--i){v=!0;break}}while((p|f)<u);if(v)break;do{if(0!=(p=g-d(n[s],I,e,g,g-1,C))){for(g-=p,c=1+(a-=p),h=1+(r-=p),o=p-1;o>=0;o--)I[c+o]=I[h+o];if(0===g){v=!0;break}}if(I[a--]=n[s--],1==--i){v=!0;break}if(0!=(f=i-l(I[r],n,0,i,i-1,C))){for(i-=f,c=1+(a-=f),h=1+(s-=f),o=0;o<f;o++)I[c+o]=n[h+o];if(i<=1){v=!0;break}}if(I[a--]=I[r--],0==--g){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===i){for(c=1+(a-=g),h=1+(r-=g),o=g-1;o>=0;o--)I[c+o]=I[h+o];I[a]=n[s]}else{if(0===i)throw new Error("mergeHigh preconditions were not respected");for(h=a-(i-1),o=0;o<i;o++)I[h+o]=n[o]}}else{for(c=1+(a-=g),h=1+(r-=g),o=g-1;o>=0;o--)I[c+o]=I[h+o];I[a]=n[s]}else for(h=a-(i-1),o=0;o<i;o++)I[h+o]=n[o]},e}();function c(e,g,A,i){if(!Array.isArray(e))throw new TypeError("Can only sort arrays");g?"function"!=typeof g&&(i=A,A=g,g=n):g=n,A||(A=0),i||(i=e.length);var C=i-A;if(!(C<2)){var I=0;if(C<t)a(e,A,i,A+(I=r(e,A,i,g)),g);else{var s=new h(e,g),l=o(C);do{if((I=r(e,A,i,g))<l){var d=C;d>l&&(d=l),a(e,A,A+d,A+I,g),I=d}s.pushRun(A,I),s.mergeRuns(),C-=I,A+=I}while(0!==C);s.forceMergeRuns()}}}}(kE);var xE=kE;function EE(e){var g=function(){if("undefined"==typeof Reflect||!Em)return!1;if(Em.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Em(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,A=Mm(e);if(g){var i=Mm(this).constructor;t=Em(A,arguments,i)}else t=A.apply(this,arguments);return Pm(this,t)}}var OE=function(){function e(){ta(this,e)}return Ca(e,[{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(e){return this.fake_use(e),this.abstract()}},{key:"setPosition",value:function(e,g){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;this.fake_use(e,g,t),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,g){this.fake_use(e,g),this.abstract()}},{key:"shift",value:function(e,g){this.fake_use(e,g),this.abstract()}}]),e}(),TE=function(e){Rm(t,OE);var g=EE(t);function t(e){var A;return ta(this,t),(A=g.call(this)).layout=e,A}return Ca(t,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(e){return e.x}},{key:"setPosition",value:function(e,g){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==t&&this.layout.hierarchical.addToOrdering(e,t),e.x=g}},{key:"getTreeSize",value:function(e){var g=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:g.min_x,max:g.max_x}}},{key:"sort",value:function(e){xE.sort(e,(function(e,g){return e.x-g.x}))}},{key:"fix",value:function(e,g){e.y=this.layout.options.hierarchical.levelSeparation*g,e.options.fixed.y=!0}},{key:"shift",value:function(e,g){this.layout.body.nodes[e].x+=g}}]),t}(),DE=function(e){Rm(t,OE);var g=EE(t);function t(e){var A;return ta(this,t),(A=g.call(this)).layout=e,A}return Ca(t,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(e){return e.y}},{key:"setPosition",value:function(e,g){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==t&&this.layout.hierarchical.addToOrdering(e,t),e.y=g}},{key:"getTreeSize",value:function(e){var g=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:g.min_y,max:g.max_y}}},{key:"sort",value:function(e){xE.sort(e,(function(e,g){return e.y-g.y}))}},{key:"fix",value:function(e,g){e.x=this.layout.options.hierarchical.levelSeparation*g,e.options.fixed.x=!0}},{key:"shift",value:function(e,g){this.layout.body.nodes[e].y+=g}}]),t}(),NE=er.every;Vt({target:"Array",proto:!0,forced:!Rl("every")},{every:function(e){return NE(this,e,arguments.length>1?arguments[1]:void 0)}});var RE=UA("Array").every,PE=we,SE=RE,ME=Array.prototype,BE=function(e){var g=e.every;return e===ME||PE(ME,e)&&g===ME.every?SE:g};function zE(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return FE(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return FE(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function FE(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}function ZE(e,g){var t=new ry;return Ll(e).call(e,(function(e){var g;Ll(g=e.edges).call(g,(function(e){e.connected&&t.add(e)}))})),Ll(t).call(t,(function(e){var t=e.from.id,A=e.to.id;null==g[t]&&(g[t]=0),(null==g[A]||g[t]>=g[A])&&(g[A]=g[t]+1)})),g}function jE(e,g,t,A){var i,C,I=Zh(null),n=qm(i=Il(sb(A).call(A))).call(i,(function(e,g){return e+1+g.edges.length}),0),o=t+"Id",r="to"===t?1:-1,s=zE(A);try{var a=function(){var i=tl(C.value,2),s=i[0],a=i[1];if(!A.has(s)||!e(a))return"continue";I[s]=0;for(var l=[a],d=0,h=void 0,c=function(){var e,i;if(!A.has(s))return"continue";var C=I[h.id]+r;if(Ll(e=_d(i=h.edges).call(i,(function(e){return e.connected&&e.to!==e.from&&e[t]!==h&&A.has(e.toId)&&A.has(e.fromId)}))).call(e,(function(e){var A=e[o],i=I[A];(null==i||g(C,i))&&(I[A]=C,l.push(e[t]))})),d>n)return{v:{v:ZE(A,I)}};++d};h=l.pop();){var u=c();if("continue"!==u&&"object"===Cl(u))return u.v}};for(s.s();!(C=s.n()).done;){var l=a();if("continue"!==l&&"object"===Cl(l))return l.v}}catch(e){s.e(e)}finally{s.f()}return I}var GE=function(){function e(){ta(this,e),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return Ca(e,[{key:"addRelation",value:function(e,g){void 0===this.childrenReference[e]&&(this.childrenReference[e]=[]),this.childrenReference[e].push(g),void 0===this.parentReference[g]&&(this.parentReference[g]=[]),this.parentReference[g].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1)return void(this.isTree=!1);this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,g){void 0!==g&&void 0===this.trees[e.id]&&(this.trees[e.id]=g,this.treeIndex=Math.max(g,this.treeIndex))}},{key:"ensureLevel",value:function(e){void 0===this.levels[e]&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var g=this,t={};return function e(A){if(void 0!==t[A])return t[A];var i=g.levels[A];if(g.childrenReference[A]){var C=g.childrenReference[A];if(C.length>0)for(var I=0;I<C.length;I++)i=Math.max(i,e(C[I]))}return t[A]=i,i}(e)}},{key:"levelDownstream",value:function(e,g){void 0===this.levels[g.id]&&(void 0===this.levels[e.id]&&(this.levels[e.id]=0),this.levels[g.id]=this.levels[e.id]+1)}},{key:"setMinLevelToZero",value:function(e){var g=1e9;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&void 0!==this.levels[t]&&(g=Math.min(this.levels[t],g));for(var A in e)Object.prototype.hasOwnProperty.call(e,A)&&void 0!==this.levels[A]&&(this.levels[A]-=g)}},{key:"getTreeSize",value:function(e,g){var t=1e9,A=-1e9,i=1e9,C=-1e9;for(var I in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,I)&&this.trees[I]===g){var n=e[I];t=Math.min(n.x,t),A=Math.max(n.x,A),i=Math.min(n.y,i),C=Math.max(n.y,C)}return{min_x:t,max_x:A,min_y:i,max_y:C}}},{key:"hasSameParent",value:function(e,g){var t=this.parentReference[e.id],A=this.parentReference[g.id];if(void 0===t||void 0===A)return!1;for(var i=0;i<t.length;i++)for(var C=0;C<A.length;C++)if(t[i]==A[C])return!0;return!1}},{key:"inSameSubNetwork",value:function(e,g){return this.trees[e.id]===this.trees[g.id]}},{key:"getLevels",value:function(){return kl(this.distributionOrdering)}},{key:"addToOrdering",value:function(e,g){void 0===this.distributionOrdering[g]&&(this.distributionOrdering[g]=[]);var t=!1,A=this.distributionOrdering[g];for(var i in A)if(A[i]===e){t=!0;break}t||(this.distributionOrdering[g].push(e),this.distributionIndex[e.id]=this.distributionOrdering[g].length-1)}}]),e}(),LE=function(){function e(g){ta(this,e),this.body=g,this._resetRNG(Math.random()+":"+Dl()),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"}},NA(this.options,this.defaultOptions),this.bindEventListeners()}return Ca(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("_dataChanged",(function(){e.setupHierarchicalLayout()})),this.body.emitter.on("_dataLoaded",(function(){e.layoutNetwork()})),this.body.emitter.on("_resetHierarchicalLayout",(function(){e.setupHierarchicalLayout()})),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",(function(){if(!0===e.options.hierarchical.enabled){var g=e.direction.curveType();e.body.emitter.emit("_forceDisableDynamicCurves",g,!1)}}))}},{key:"setOptions",value:function(e,g){if(void 0!==e){var t=this.options.hierarchical,A=t.enabled;if(pp(["randomSeed","improvedLayout","clusterThreshold"],this.options,e),Bp(this.options,e,"hierarchical"),void 0!==e.randomSeed&&this._resetRNG(e.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(g);if(!0===A)return this.body.emitter.emit("refresh"),vp(g,this.optionsBackup)}return g}},{key:"_resetRNG",value:function(e){this.initialRandomSeed=e,this._rng=Ap(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(!0===this.options.hierarchical.enabled){var g=this.optionsBackup.physics;void 0===e.physics||!0===e.physics?(e.physics={enabled:void 0===g.enabled||g.enabled,solver:"hierarchicalRepulsion"},g.enabled=void 0===g.enabled||g.enabled,g.solver=g.solver||"barnesHut"):"object"===Cl(e.physics)?(g.enabled=void 0===e.physics.enabled||e.physics.enabled,g.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):!1!==e.physics&&(g.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var t=this.direction.curveType();if(void 0===e.edges)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(void 0===e.edges.smooth)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if("boolean"==typeof e.edges.smooth)this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:t};else{var A=e.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}},e.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 e}},{key:"positionInitially",value:function(e){if(!0!==this.options.hierarchical.enabled){this._resetRNG(this.initialRandomSeed);for(var g=e.length+50,t=0;t<e.length;t++){var A=e[t],i=2*Math.PI*this._rng();void 0===A.x&&(A.x=g*Math.cos(i)),void 0===A.y&&(A.y=g*Math.sin(i))}}}},{key:"layoutNetwork",value:function(){if(!0!==this.options.hierarchical.enabled&&!0===this.options.improvedLayout){for(var e=this.body.nodeIndices,g=0,t=0;t<e.length;t++){!0===this.body.nodes[e[t]].predefinedPosition&&(g+=1)}if(g<.5*e.length){var A=0,i=this.options.clusterThreshold,C={clusterNodeProperties:{shape:"ellipse",label:"",group:"",font:{multi:!1}},clusterEdgeProperties:{label:"",font:{multi:!1},smooth:{enabled:!1}}};if(e.length>i){for(var I=e.length;e.length>i&&A<=10;){A+=1;var n=e.length;if(A%3==0?this.body.modules.clustering.clusterBridges(C):this.body.modules.clustering.clusterOutliers(C),n==e.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(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var o=0;o<e.length;o++){var r=this.body.nodes[e[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 e=nx.getRangeCore(this.body.nodes,this.body.nodeIndices),g=nx.findCenter(e),t=0;t<this.body.nodeIndices.length;t++){var A=this.body.nodes[this.body.nodeIndices[t]];A.x-=g.x,A.y-=g.y}}},{key:"_declusterAll",value:function(){for(var e=!0;!0===e;){e=!1;for(var g=0;g<this.body.nodeIndices.length;g++)!0===this.body.nodes[this.body.nodeIndices[g]].isCluster&&(e=!0,this.body.modules.clustering.openCluster(this.body.nodeIndices[g],{},!1));!0===e&&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 e,g,t=!1,A=!1;for(g in this.lastNodeOnLevel={},this.hierarchical=new GE,this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,g)&&(void 0!==(e=this.body.nodes[g]).options.level?(t=!0,this.hierarchical.levels[g]=e.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 i=this.options.hierarchical.sortMethod;"hubsize"===i?this._determineLevelsByHubsize():"directed"===i?this._determineLevelsDirected():"custom"===i&&this._determineLevelsCustomCallback()}for(var C in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,C)&&this.hierarchical.ensureLevel(C);var I=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(I),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,g=!1,t={},A=function(g,t){var A=e.hierarchical.trees;for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&A[i]===g&&e.direction.shift(i,t)},i=function(){for(var g=[],t=0;t<e.hierarchical.numTrees();t++)g.push(e.direction.getTreeSize(t));return g},C=function g(t,A){if(!A[t.id]&&(A[t.id]=!0,e.hierarchical.childrenReference[t.id])){var i=e.hierarchical.childrenReference[t.id];if(i.length>0)for(var C=0;C<i.length;C++)g(e.body.nodes[i[C]],A)}},I=function(g){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e9,A=1e9,i=1e9,C=1e9,I=-1e9;for(var n in g)if(Object.prototype.hasOwnProperty.call(g,n)){var o=e.body.nodes[n],r=e.hierarchical.levels[o.id],s=e.direction.getPosition(o),a=e._getSpaceAroundNode(o,g),l=tl(a,2),d=l[0],h=l[1];A=Math.min(d,A),i=Math.min(h,i),r<=t&&(C=Math.min(s,C),I=Math.max(s,I))}return[C,I,A,i]},n=function(g,t){var A=e.hierarchical.getMaxLevel(g.id),i=e.hierarchical.getMaxLevel(t.id);return Math.min(A,i)},o=function(g,t,A){for(var i=e.hierarchical,C=0;C<t.length;C++){var I=t[C],n=i.distributionOrdering[I];if(n.length>1)for(var o=0;o<n.length-1;o++){var r=n[o],s=n[o+1];i.hasSameParent(r,s)&&i.inSameSubNetwork(r,s)&&g(r,s,A)}}},r=function(t,A){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=e.direction.getPosition(t),r=e.direction.getPosition(A),s=Math.abs(r-o),a=e.options.hierarchical.nodeSpacing;if(s>a){var l={},d={};C(t,l),C(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&&(e._shiftBlock(A.id,y),g=!0,!0===i&&e._centerParent(A))}}},s=function(A,i){for(var n=i.id,o=i.edges,r=e.hierarchical.levels[i.id],s=e.options.hierarchical.levelSeparation*e.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,e.hierarchical.levels[c.id]<r&&l.push(h)}}var u=function(g,t){for(var A=0,i=0;i<t.length;i++)if(void 0!==a[t[i].id]){var C=e.direction.getPosition(a[t[i].id])-g;A+=C/Math.sqrt(C*C+s)}return A},p=function(g,t){for(var A=0,i=0;i<t.length;i++)if(void 0!==a[t[i].id]){var C=e.direction.getPosition(a[t[i].id])-g;A-=s*Math.pow(C*C+s,-1.5)}return A},f=function(g,t){for(var A=e.direction.getPosition(i),C={},I=0;I<g;I++){var n=u(A,t),o=p(A,t);if(void 0!==C[A-=Math.max(-40,Math.min(40,Math.round(n/o)))])break;C[A]=I}return A},v=f(A,l);!function(A){var n=e.direction.getPosition(i);if(void 0===t[i.id]){var o={};C(i,o),t[i.id]=o}var r=I(t[i.id]),s=r[2],a=r[3],l=A-n,d=0;l>0?d=Math.min(l,a-e.options.hierarchical.nodeSpacing):l<0&&(d=-Math.min(-l,s-e.options.hierarchical.nodeSpacing)),0!=d&&(e._shiftBlock(i.id,d),g=!0)}(v),function(t){var A=e.direction.getPosition(i),C=tl(e._getSpaceAroundNode(i),2),I=C[0],n=C[1],o=t-A,r=A;o>0?r=Math.min(A+(n-e.options.hierarchical.nodeSpacing),t):o<0&&(r=Math.max(A-(I-e.options.hierarchical.nodeSpacing),t)),r!==A&&(e.direction.setPosition(i,r),g=!0)}(v=f(A,o))};!0===this.options.hierarchical.blockShifting&&(function(t){var A=e.hierarchical.getLevels();A=Xl(A).call(A);for(var i=0;i<t&&(g=!1,o(r,A,!0),!0===g);i++);}(5),function(){for(var g in e.body.nodes)Object.prototype.hasOwnProperty.call(e.body.nodes,g)&&e._centerParent(e.body.nodes[g])}()),!0===this.options.hierarchical.edgeMinimization&&function(t){var A=e.hierarchical.getLevels();A=Xl(A).call(A);for(var i=0;i<t;i++){g=!1;for(var C=0;C<A.length;C++)for(var I=A[C],n=e.hierarchical.distributionOrdering[I],o=0;o<n.length;o++)s(1e3,n[o]);if(!0!==g)break}}(20),!0===this.options.hierarchical.parentCentralization&&function(){var g=e.hierarchical.getLevels();g=Xl(g).call(g);for(var t=0;t<g.length;t++)for(var A=g[t],i=e.hierarchical.distributionOrdering[A],C=0;C<i.length;C++)e._centerParent(i[C])}(),function(){for(var g=i(),t=0,C=0;C<g.length-1;C++){t+=g[C].max-g[C+1].min+e.options.hierarchical.treeSpacing,A(C+1,t)}}()}},{key:"_getSpaceAroundNode",value:function(e,g){var t=!0;void 0===g&&(t=!1);var A=this.hierarchical.levels[e.id];if(void 0!==A){var i=this.hierarchical.distributionIndex[e.id],C=this.direction.getPosition(e),I=this.hierarchical.distributionOrdering[A],n=1e9,o=1e9;if(0!==i){var r=I[i-1];if(!0===t&&void 0===g[r.id]||!1===t)n=C-this.direction.getPosition(r)}if(i!=I.length-1){var s=I[i+1];if(!0===t&&void 0===g[s.id]||!1===t){var a=this.direction.getPosition(s);o=Math.min(o,a-C)}}return[n,o]}return[0,0]}},{key:"_centerParent",value:function(e){if(this.hierarchical.parentReference[e.id])for(var g=this.hierarchical.parentReference[e.id],t=0;t<g.length;t++){var A=g[t],i=this.body.nodes[A],C=this.hierarchical.childrenReference[A];if(void 0!==C){var I=this._getCenterPosition(C),n=this.direction.getPosition(i),o=tl(this._getSpaceAroundNode(i),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(i,I)}}}},{key:"_placeNodesByHierarchy",value:function(e){for(var g in this.positionedNodes={},e)if(Object.prototype.hasOwnProperty.call(e,g)){var t,A=kl(e[g]);A=this._indexArrayToNodes(A),Hy(t=this.direction).call(t,A);for(var i=0,C=0;C<A.length;C++){var I=A[C];if(void 0===this.positionedNodes[I.id]){var n=this.options.hierarchical.nodeSpacing,o=n*i;i>0&&(o=this.direction.getPosition(A[C-1])+n),this.direction.setPosition(I,o,g),this._validatePositionAndContinue(I,g,o),i++}}}}},{key:"_placeBranchNodes",value:function(e,g){var t,A=this.hierarchical.childrenReference[e];if(void 0!==A){for(var i=[],C=0;C<A.length;C++)i.push(this.body.nodes[A[C]]);Hy(t=this.direction).call(t,i);for(var I=0;I<i.length;I++){var n=i[I],o=this.hierarchical.levels[n.id];if(!(o>g&&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[e]):this.direction.getPosition(i[I-1])+r,this.direction.setPosition(n,s,o),this._validatePositionAndContinue(n,o,s)}var a=this._getCenterPosition(i);this.direction.setPosition(this.body.nodes[e],a,g)}}},{key:"_validatePositionAndContinue",value:function(e,g,t){if(this.hierarchical.isTree){if(void 0!==this.lastNodeOnLevel[g]){var A=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[g]]);if(t-A<this.options.hierarchical.nodeSpacing){var i=A+this.options.hierarchical.nodeSpacing-t,C=this._findCommonParent(this.lastNodeOnLevel[g],e.id);this._shiftBlock(C.withChild,i)}}this.lastNodeOnLevel[g]=e.id,this.positionedNodes[e.id]=!0,this._placeBranchNodes(e.id,g)}}},{key:"_indexArrayToNodes",value:function(e){for(var g=[],t=0;t<e.length;t++)g.push(this.body.nodes[e[t]]);return g}},{key:"_getDistribution",value:function(){var e,g,t={};for(e in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,e)){g=this.body.nodes[e];var A=void 0===this.hierarchical.levels[e]?0:this.hierarchical.levels[e];this.direction.fix(g,A),void 0===t[A]&&(t[A]={}),t[A][e]=g}return t}},{key:"_getActiveEdges",value:function(e){var g=this,t=[];return wp(e.edges,(function(e){var A;-1!==Rh(A=g.body.edgeIndices).call(A,e.id)&&t.push(e)})),t}},{key:"_getHubSizes",value:function(){var e=this,g={};wp(this.body.nodeIndices,(function(t){var A=e.body.nodes[t],i=e._getActiveEdges(A).length;g[i]=!0}));var t=[];return wp(g,(function(e){t.push(Number(e))})),Hy(xE).call(xE,t,(function(e,g){return g-e})),t}},{key:"_determineLevelsByHubsize",value:function(){for(var e=this,g=function(g,t){e.hierarchical.levelDownstream(g,t)},t=this._getHubSizes(),A=function(A){var i=t[A];if(0===i)return"break";wp(e.body.nodeIndices,(function(t){var A=e.body.nodes[t];i===e._getActiveEdges(A).length&&e._crawlNetwork(g,t)}))},i=0;i<t.length;++i){if("break"===A(i))break}}},{key:"_determineLevelsCustomCallback",value:function(){var e=this;this._crawlNetwork((function(g,t,A){var i=e.hierarchical.levels[g.id];void 0===i&&(i=e.hierarchical.levels[g.id]=1e5);var C=(nx.cloneOptions(g,"node"),nx.cloneOptions(t,"node"),void nx.cloneOptions(A,"edge"));e.hierarchical.levels[t.id]=i+C})),this.hierarchical.setMinLevelToZero(this.body.nodes)}},{key:"_determineLevelsDirected",value:function(){var e,g=this,t=qm(e=this.body.nodeIndices).call(e,(function(e,t){return e.set(t,g.body.nodes[t]),e}),new qv);"roots"===this.options.hierarchical.shakeTowards?this.hierarchical.levels=function(e){return jE((function(g){var t,A;return BE(t=_d(A=g.edges).call(A,(function(g){return e.has(g.toId)}))).call(t,(function(e){return e.from===g}))}),(function(e,g){return g<e}),"to",e)}(t):this.hierarchical.levels=function(e){return jE((function(g){var t,A;return BE(t=_d(A=g.edges).call(A,(function(g){return e.has(g.toId)}))).call(t,(function(e){return e.to===g}))}),(function(e,g){return g>e}),"from",e)}(t),this.hierarchical.setMinLevelToZero(this.body.nodes)}},{key:"_generateMap",value:function(){var e=this;this._crawlNetwork((function(g,t){e.hierarchical.levels[t.id]>e.hierarchical.levels[g.id]&&e.hierarchical.addRelation(g.id,t.id)})),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,g=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0,A={},i=function t(i,C){if(void 0===A[i.id]){var I;e.hierarchical.setTreeIndex(i,C),A[i.id]=!0;for(var n=e._getActiveEdges(i),o=0;o<n.length;o++){var r=n[o];!0===r.connected&&(I=r.toId==i.id?r.from:r.to,i.id!=I.id&&(g(i,I,r),t(I,C)))}}};if(void 0===t)for(var C=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];i(o,C),C+=1}}else{var r=this.body.nodes[t];if(void 0===r)return void console.error("Node not found:",t);i(r)}}},{key:"_shiftBlock",value:function(e,g){var t=this,A={};!function e(i){if(!A[i]){A[i]=!0,t.direction.shift(i,g);var C=t.hierarchical.childrenReference[i];if(void 0!==C)for(var I=0;I<C.length;I++)e(C[I])}}(e)}},{key:"_findCommonParent",value:function(e,g){var t=this,A={};return function e(g,A){var i=t.hierarchical.parentReference[A];if(void 0!==i)for(var C=0;C<i.length;C++){var I=i[C];g[I]=!0,e(g,I)}}(A,e),function e(g,A){var i=t.hierarchical.parentReference[A];if(void 0!==i)for(var C=0;C<i.length;C++){var I=i[C];if(void 0!==g[I])return{foundParent:I,withChild:A};var n=e(g,I);if(null!==n.foundParent)return n}return{foundParent:null,withChild:A}}(A,g)}},{key:"setDirectionStrategy",value:function(){var e="UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction;this.direction=e?new TE(this):new DE(this)}},{key:"_getCenterPosition",value:function(e){for(var g=1e9,t=-1e9,A=0;A<e.length;A++){var i=void 0;if(void 0!==e[A].id)i=e[A];else{var C=e[A];i=this.body.nodes[C]}var I=this.direction.getPosition(i);g=Math.min(g,I),t=Math.max(t,I)}return.5*(g+t)}}]),e}();function VE(e,g){var t=void 0!==nl&&ho(e)||e["@@iterator"];if(!t){if(cl(e)||(t=function(e,g){var t;if(!e)return;if("string"==typeof e)return YE(e,g);var A=dl(t=Object.prototype.toString.call(e)).call(t,8,-1);"Object"===A&&e.constructor&&(A=e.constructor.name);if("Map"===A||"Set"===A)return Xn(e);if("Arguments"===A||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return YE(e,g)}(e))||g&&e&&"number"==typeof e.length){t&&(e=t);var A=0,i=function(){};return{s:i,n:function(){return A>=e.length?{done:!0}:{done:!1,value:e[A++]}},e:function(e){throw e},f:i}}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 C,I=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return I=e.done,e},e:function(e){n=!0,C=e},f:function(){try{I||null==t.return||t.return()}finally{if(n)throw C}}}}function YE(e,g){(null==g||g>e.length)&&(g=e.length);for(var t=0,A=new Array(g);t<g;t++)A[t]=e[t];return A}ii("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,[encoded data, 24404 characters]');\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,[encoded data, 27736 characters]');\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,[encoded data, 28000 characters]');\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,[encoded data, 28024 characters]');\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,[encoded data, 27688 characters]');\n}\n\ndiv.vis-network div.vis-manipulation button.vis-button.vis-delete {\n  background-image: url('data:image/png;base64,[encoded data, 27976 characters]');\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 WE=function(){function e(g,t,A,i){var C,I,n=this;ta(this,e),this.body=g,this.canvas=t,this.selectionHandler=A,this.interactionHandler=i,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}},NA(this.options,this.defaultOptions),this.body.emitter.on("destroy",(function(){n._clean()})),this.body.emitter.on("_dataChanged",JA(C=this._restore).call(C,this)),this.body.emitter.on("_resetData",JA(I=this._restore).call(I,this))}return Ca(e,[{key:"_restore",value:function(){!1!==this.inMode&&(!0===this.options.initiallyActive?this.enableEditMode():this.disableEditMode())}},{key:"setOptions",value:function(e,g,t){void 0!==g&&(void 0!==g.locale?this.options.locale=g.locale:this.options.locale=t.locale,void 0!==g.locales?this.options.locales=g.locales:this.options.locales=t.locales),void 0!==e&&("boolean"==typeof e?this.options.enabled=e:(this.options.enabled=!0,vp(this.options,e)),!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 e,g;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";var t=this.selectionHandler.getSelectedNodeCount(),A=this.selectionHandler.getSelectedEdgeCount(),i=t+A,C=this.options.locales[this.options.locale],I=!1;!1!==this.options.addNode&&(this._createAddNodeButton(C),I=!0),!1!==this.options.addEdge&&(!0===I?this._createSeperator(1):I=!0,this._createAddEdgeButton(C)),1===t&&"function"==typeof this.options.editNode?(!0===I?this._createSeperator(2):I=!0,this._createEditNodeButton(C)):1===A&&0===t&&!1!==this.options.editEdge&&(!0===I?this._createSeperator(3):I=!0,this._createEditEdgeButton(C)),0!==i&&(t>0&&!1!==this.options.deleteNode||0===t&&!1!==this.options.deleteEdge)&&(!0===I&&this._createSeperator(4),this._createDeleteButton(C)),this._bindElementEvents(this.closeDiv,JA(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",JA(g=this.showManipulatorToolbar).call(g,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var e;if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addNode",!0===this.guiEnabled){var g,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,JA(g=this.toggleEditMode).call(g,this))}this._temporaryBindEvent("click",JA(e=this._performAddNode).call(e,this))}},{key:"editNode",value:function(){var e=this;!0!==this.editMode&&this.enableEditMode(),this._clean();var g=this.selectionHandler.getSelectedNodes()[0];if(void 0!==g){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!==g.isCluster){var t=vp({},g.options,!1);if(t.x=g.x,t.y=g.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(g){null!=g&&"editNode"===e.inMode&&e.body.data.nodes.getDataSet().update(g),e.showManipulatorToolbar()}))}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError)}else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var e,g,t,A,i;if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addEdge",!0===this.guiEnabled){var C,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,JA(C=this.toggleEditMode).call(C,this))}this._temporaryBindUI("onTouch",JA(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",JA(g=this._finishConnect).call(g,this)),this._temporaryBindUI("onDrag",JA(t=this._dragControlNode).call(t,this)),this._temporaryBindUI("onRelease",JA(A=this._finishConnect).call(A,this)),this._temporaryBindUI("onDragStart",JA(i=this._dragStartEdge).call(i,this)),this._temporaryBindUI("onHold",(function(){}))}},{key:"editEdgeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="editEdge","object"!==Cl(this.options.editEdge)||"function"!=typeof this.options.editEdge.editWithoutDrag||(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],void 0===this.edgeBeingEditedId)){if(!0===this.guiEnabled){var e,g=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(g),this._createSeperator(),this._createDescription(g.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,JA(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],void 0!==this.edgeBeingEditedId){var t,A,i,C,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",JA(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",(function(){})),this._temporaryBindUI("onHold",(function(){})),this._temporaryBindUI("onDragStart",JA(A=this._controlNodeDragStart).call(A,this)),this._temporaryBindUI("onDrag",JA(i=this._controlNodeDrag).call(i,this)),this._temporaryBindUI("onDragEnd",JA(C=this._controlNodeDragEnd).call(C,this)),this._temporaryBindUI("onMouseMove",(function(){})),this._temporaryBindEvent("beforeDrawing",(function(e){var g=I.edgeType.findBorderPositions(e);!1===n.selected&&(n.x=g.from.x,n.y=g.from.y),!1===o.selected&&(o.x=g.to.x,o.y=g.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 e=this;!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="delete";var g=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds(),A=void 0;if(g.length>0){for(var i=0;i<g.length;i++)if(!0===this.body.nodes[g[i]].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 C={nodes:g,edges:t};if(2!==A.length)throw new Error("The function for delete does not support two arguments (data, callback)");A(C,(function(g){null!=g&&"delete"===e.inMode?(e.body.data.edges.getDataSet().remove(g.edges),e.body.data.nodes.getDataSet().remove(g.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(g),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 e,g;(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!==(e=null===(g=this.options.locales[this.options.locale])||void 0===g?void 0:g.close)&&void 0!==e?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}},{key:"_getNewTargetNode",value:function(e,g){var t=vp({},this.options.controlNodeStyle);t.id="targetNode"+Eb(),t.hidden=!1,t.physics=!1,t.x=e,t.y=g;var A=this.body.functions.createNode(t);return A.shape.boundingBox={left:e,right:e,top:g,bottom:g},A}},{key:"_createEditButton",value:function(){var e;this._clean(),this.manipulationDOM={},lp(this.editModeDiv);var g=this.options.locales[this.options.locale],t=this._createButton("editMode","vis-edit vis-edit-mode",g.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(t),this._bindElementEvents(t,JA(e=this.toggleEditMode).call(e,this))}},{key:"_clean",value:function(){this.inMode=!1,!0===this.guiEnabled&&(lp(this.editModeDiv),lp(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var e,g,t=VE(dd(e=this._domEventListenerCleanupQueue).call(e,0));try{for(t.s();!(g=t.n()).done;){(0,g.value)()}}catch(e){t.e(e)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),lp(this.manipulationDiv),lp(this.editModeDiv),lp(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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var g,t=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,JA(g=this.addNodeMode).call(g,this))}},{key:"_createAddEdgeButton",value:function(e){var g,t=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,JA(g=this.addEdgeMode).call(g,this))}},{key:"_createEditNodeButton",value:function(e){var g,t=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,JA(g=this.editNode).call(g,this))}},{key:"_createEditEdgeButton",value:function(e){var g,t=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,JA(g=this.editEdgeMode).call(g,this))}},{key:"_createDeleteButton",value:function(e){var g,t;t=this.options.rtl?"vis-delete-rtl":"vis-delete";var A=this._createButton("delete",t,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(A),this._bindElementEvents(A,JA(g=this.deleteSelected).call(g,this))}},{key:"_createBackButton",value:function(e){var g,t=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(t),this._bindElementEvents(t,JA(g=this.showManipulatorToolbar).call(g,this))}},{key:"_createButton",value:function(e,g,t){var A=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+g,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=A,this.manipulationDOM[e+"Label"].innerText=t,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(e,g){this.temporaryEventFunctions.push({event:e,boundFunction:g}),this.body.emitter.on(e,g)}},{key:"_temporaryBindUI",value:function(e,g){if(void 0===this.body.eventListeners[e])throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ic(kl(this.body.eventListeners)));this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=g}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e<this.temporaryEventFunctions.length;e++){var g=this.temporaryEventFunctions[e].event,t=this.temporaryEventFunctions[e].boundFunction;this.body.emitter.off(g,t)}this.temporaryEventFunctions=[]}},{key:"_bindElementEvents",value:function(e,g){var t=new _p(e,{});cx(t,g),this._domEventListenerCleanupQueue.push((function(){t.destroy()}));var A=function(e){var t=e.keyCode,A=e.key;"Enter"!==A&&" "!==A&&13!==t&&32!==t||g()};e.addEventListener("keyup",A,!1),this._domEventListenerCleanupQueue.push((function(){e.removeEventListener("keyup",A,!1)}))}},{key:"_cleanupTemporaryNodesAndEdges",value:function(){for(var e=0;e<this.temporaryIds.edges.length;e++){var g;this.body.edges[this.temporaryIds.edges[e]].disconnect(),delete this.body.edges[this.temporaryIds.edges[e]];var t,A=Rh(g=this.body.edgeIndices).call(g,this.temporaryIds.edges[e]);if(-1!==A)dd(t=this.body.edgeIndices).call(t,A,1)}for(var i=0;i<this.temporaryIds.nodes.length;i++){var C;delete this.body.nodes[this.temporaryIds.nodes[i]];var I,n=Rh(C=this.body.nodeIndices).call(C,this.temporaryIds.nodes[i]);if(-1!==n)dd(I=this.body.nodeIndices).call(I,n,1)}this.temporaryIds={nodes:[],edges:[]}}},{key:"_controlNodeTouch",value:function(e){this.selectionHandler.unselectAll(),this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=NA({},this.body.view.translation)}},{key:"_controlNodeDragStart",value:function(){var e=this.lastTouch,g=this.selectionHandler._pointerToPositionObject(e),t=this.body.nodes[this.temporaryIds.nodes[0]],A=this.body.nodes[this.temporaryIds.nodes[1]],i=this.body.edges[this.edgeBeingEditedId];this.selectedControlNode=void 0;var C=t.isOverlappingWith(g),I=A.isOverlappingWith(g);!0===C?(this.selectedControlNode=t,i.edgeType.from=t):!0===I&&(this.selectedControlNode=A,i.edgeType.to=A),void 0!==this.selectedControlNode&&this.selectionHandler.selectObject(this.selectedControlNode),this.body.emitter.emit("_redraw")}},{key:"_controlNodeDrag",value:function(e){this.body.emitter.emit("disablePhysics");var g=this.body.functions.getPointer(e.center),t=this.canvas.DOMtoCanvas(g);void 0!==this.selectedControlNode?(this.selectedControlNode.x=t.x,this.selectedControlNode.y=t.y):this.interactionHandler.onDrag(e),this.body.emitter.emit("_redraw")}},{key:"_controlNodeDragEnd",value:function(e){var g=this.body.functions.getPointer(e.center),t=this.selectionHandler._pointerToPositionObject(g),A=this.body.edges[this.edgeBeingEditedId];if(void 0!==this.selectedControlNode){this.selectionHandler.unselectAll();for(var i=this.selectionHandler._getAllNodesOverlappingWith(t),C=void 0,I=i.length-1;I>=0;I--)if(i[I]!==this.selectedControlNode.id){C=this.body.nodes[i[I]];break}if(void 0!==C&&void 0!==this.selectedControlNode)if(!0===C.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(C.id,A.to.id):this._performEditEdge(A.from.id,C.id)}else A.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if((new Date).valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=NA({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var g=this.lastTouch,t=this.selectionHandler.getNodeAt(g);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 i=this.body.functions.createEdge({id:"connectionEdge"+Eb(),from:t.id,to:A.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[i.id]=i,this.body.edgeIndices.push(i.id),this.temporaryIds.nodes.push(A.id),this.temporaryIds.edges.push(i.id)}this.touchTime=(new Date).valueOf()}}},{key:"_dragControlNode",value:function(e){var g=this.body.functions.getPointer(e.center),t=this.selectionHandler._pointerToPositionObject(g),A=void 0;void 0!==this.temporaryIds.edges[0]&&(A=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var i=this.selectionHandler._getAllNodesOverlappingWith(t),C=void 0,I=i.length-1;I>=0;I--){var n;if(-1===Rh(n=this.temporaryIds.nodes).call(n,i[I])){C=this.body.nodes[i[I]];break}}if(e.controlEdge={from:A,to:C?C.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,g),void 0!==this.temporaryIds.nodes[0]){var o=this.body.nodes[this.temporaryIds.nodes[0]];o.x=this.canvas._XconvertDOMtoCanvas(g.x),o.y=this.canvas._YconvertDOMtoCanvas(g.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}},{key:"_finishConnect",value:function(e){var g=this.body.functions.getPointer(e.center),t=this.selectionHandler._pointerToPositionObject(g),A=void 0;void 0!==this.temporaryIds.edges[0]&&(A=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var i=this.selectionHandler._getAllNodesOverlappingWith(t),C=void 0,I=i.length-1;I>=0;I--){var n;if(-1===Rh(n=this.temporaryIds.nodes).call(n,i[I])){C=this.body.nodes[i[I]];break}}this._cleanupTemporaryNodesAndEdges(),void 0!==C&&(!0===C.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[C.id]&&this._performAddEdge(A,C.id)),e.controlEdge={from:A,to:C?C.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,g),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var g=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,g,void 0,!0)}},{key:"_performAddNode",value:function(e){var g=this,t={id:Eb(),x:e.pointer.canvas.x,y:e.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(e){null!=e&&"addNode"===g.inMode&&g.body.data.nodes.getDataSet().add(e),g.showManipulatorToolbar()}))}else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,g){var t=this,A={from:e,to:g};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(e){null!=e&&"addEdge"===t.inMode&&(t.body.data.edges.getDataSet().add(e),t.selectionHandler.unselectAll(),t.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().add(A),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,g){var t=this,A={id:this.edgeBeingEditedId,from:e,to:g,label:this.body.data.edges.get(this.edgeBeingEditedId).label},i=this.options.editEdge;if("object"===Cl(i)&&(i=i.editWithoutDrag),"function"==typeof i){if(2!==i.length)throw new Error("The function for edit does not support two arguments (data, callback)");i(A,(function(e){null==e||"editEdge"!==t.inMode?(t.body.edges[A.id].updateEdgeType(),t.body.emitter.emit("_redraw"),t.showManipulatorToolbar()):(t.body.data.edges.getDataSet().update(e),t.selectionHandler.unselectAll(),t.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().update(A),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),e}(),_E="string",UE="boolean",QE="number",HE="object",KE=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],XE={borderWidth:{number:QE},borderWidthSelected:{number:QE,undefined:"undefined"},brokenImage:{string:_E,undefined:"undefined"},chosen:{label:{boolean:UE,function:"function"},node:{boolean:UE,function:"function"},__type__:{object:HE,boolean:UE}},color:{border:{string:_E},background:{string:_E},highlight:{border:{string:_E},background:{string:_E},__type__:{object:HE,string:_E}},hover:{border:{string:_E},background:{string:_E},__type__:{object:HE,string:_E}},__type__:{object:HE,string:_E}},opacity:{number:QE,undefined:"undefined"},fixed:{x:{boolean:UE},y:{boolean:UE},__type__:{object:HE,boolean:UE}},font:{align:{string:_E},color:{string:_E},size:{number:QE},face:{string:_E},background:{string:_E},strokeWidth:{number:QE},strokeColor:{string:_E},vadjust:{number:QE},multi:{boolean:UE,string:_E},bold:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},boldital:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},ital:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},mono:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},__type__:{object:HE,string:_E}},group:{string:_E,number:QE,undefined:"undefined"},heightConstraint:{minimum:{number:QE},valign:{string:_E},__type__:{object:HE,boolean:UE,number:QE}},hidden:{boolean:UE},icon:{face:{string:_E},code:{string:_E},size:{number:QE},color:{string:_E},weight:{string:_E,number:QE},__type__:{object:HE}},id:{string:_E,number:QE},image:{selected:{string:_E,undefined:"undefined"},unselected:{string:_E,undefined:"undefined"},__type__:{object:HE,string:_E}},imagePadding:{top:{number:QE},right:{number:QE},bottom:{number:QE},left:{number:QE},__type__:{object:HE,number:QE}},label:{string:_E,undefined:"undefined"},labelHighlightBold:{boolean:UE},level:{number:QE,undefined:"undefined"},margin:{top:{number:QE},right:{number:QE},bottom:{number:QE},left:{number:QE},__type__:{object:HE,number:QE}},mass:{number:QE},physics:{boolean:UE},scaling:{min:{number:QE},max:{number:QE},label:{enabled:{boolean:UE},min:{number:QE},max:{number:QE},maxVisible:{number:QE},drawThreshold:{number:QE},__type__:{object:HE,boolean:UE}},customScalingFunction:{function:"function"},__type__:{object:HE}},shadow:{enabled:{boolean:UE},color:{string:_E},size:{number:QE},x:{number:QE},y:{number:QE},__type__:{object:HE,boolean:UE}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:UE,array:"array"},borderRadius:{number:QE},interpolation:{boolean:UE},useImageSize:{boolean:UE},useBorderWithImage:{boolean:UE},coordinateOrigin:{string:["center","top-left"]},__type__:{object:HE}},size:{number:QE},title:{string:_E,dom:"dom",undefined:"undefined"},value:{number:QE,undefined:"undefined"},widthConstraint:{minimum:{number:QE},maximum:{number:QE},__type__:{object:HE,boolean:UE,number:QE}},x:{number:QE},y:{number:QE},__type__:{object:HE}},JE={configure:{enabled:{boolean:UE},filter:{boolean:UE,string:_E,array:"array",function:"function"},container:{dom:"dom"},showButton:{boolean:UE},__type__:{object:HE,boolean:UE,string:_E,array:"array",function:"function"}},edges:{arrows:{to:{enabled:{boolean:UE},scaleFactor:{number:QE},type:{string:KE},imageHeight:{number:QE},imageWidth:{number:QE},src:{string:_E},__type__:{object:HE,boolean:UE}},middle:{enabled:{boolean:UE},scaleFactor:{number:QE},type:{string:KE},imageWidth:{number:QE},imageHeight:{number:QE},src:{string:_E},__type__:{object:HE,boolean:UE}},from:{enabled:{boolean:UE},scaleFactor:{number:QE},type:{string:KE},imageWidth:{number:QE},imageHeight:{number:QE},src:{string:_E},__type__:{object:HE,boolean:UE}},__type__:{string:["from","to","middle"],object:HE}},endPointOffset:{from:{number:QE},to:{number:QE},__type__:{object:HE,number:QE}},arrowStrikethrough:{boolean:UE},background:{enabled:{boolean:UE},color:{string:_E},size:{number:QE},dashes:{boolean:UE,array:"array"},__type__:{object:HE,boolean:UE}},chosen:{label:{boolean:UE,function:"function"},edge:{boolean:UE,function:"function"},__type__:{object:HE,boolean:UE}},color:{color:{string:_E},highlight:{string:_E},hover:{string:_E},inherit:{string:["from","to","both"],boolean:UE},opacity:{number:QE},__type__:{object:HE,string:_E}},dashes:{boolean:UE,array:"array"},font:{color:{string:_E},size:{number:QE},face:{string:_E},background:{string:_E},strokeWidth:{number:QE},strokeColor:{string:_E},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:QE},multi:{boolean:UE,string:_E},bold:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},boldital:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},ital:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},mono:{color:{string:_E},size:{number:QE},face:{string:_E},mod:{string:_E},vadjust:{number:QE},__type__:{object:HE,string:_E}},__type__:{object:HE,string:_E}},hidden:{boolean:UE},hoverWidth:{function:"function",number:QE},label:{string:_E,undefined:"undefined"},labelHighlightBold:{boolean:UE},length:{number:QE,undefined:"undefined"},physics:{boolean:UE},scaling:{min:{number:QE},max:{number:QE},label:{enabled:{boolean:UE},min:{number:QE},max:{number:QE},maxVisible:{number:QE},drawThreshold:{number:QE},__type__:{object:HE,boolean:UE}},customScalingFunction:{function:"function"},__type__:{object:HE}},selectionWidth:{function:"function",number:QE},selfReferenceSize:{number:QE},selfReference:{size:{number:QE},angle:{number:QE},renderBehindTheNode:{boolean:UE},__type__:{object:HE}},shadow:{enabled:{boolean:UE},color:{string:_E},size:{number:QE},x:{number:QE},y:{number:QE},__type__:{object:HE,boolean:UE}},smooth:{enabled:{boolean:UE},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:QE},forceDirection:{string:["horizontal","vertical","none"],boolean:UE},__type__:{object:HE,boolean:UE}},title:{string:_E,undefined:"undefined"},width:{number:QE},widthConstraint:{maximum:{number:QE},__type__:{object:HE,boolean:UE,number:QE}},value:{number:QE,undefined:"undefined"},__type__:{object:HE}},groups:{useDefaultGroups:{boolean:UE},__any__:XE,__type__:{object:HE}},interaction:{dragNodes:{boolean:UE},dragView:{boolean:UE},hideEdgesOnDrag:{boolean:UE},hideEdgesOnZoom:{boolean:UE},hideNodesOnDrag:{boolean:UE},hover:{boolean:UE},keyboard:{enabled:{boolean:UE},speed:{x:{number:QE},y:{number:QE},zoom:{number:QE},__type__:{object:HE}},bindToWindow:{boolean:UE},autoFocus:{boolean:UE},__type__:{object:HE,boolean:UE}},multiselect:{boolean:UE},navigationButtons:{boolean:UE},selectable:{boolean:UE},selectConnectedEdges:{boolean:UE},hoverConnectedEdges:{boolean:UE},tooltipDelay:{number:QE},zoomView:{boolean:UE},zoomSpeed:{number:QE},__type__:{object:HE}},layout:{randomSeed:{undefined:"undefined",number:QE,string:_E},improvedLayout:{boolean:UE},clusterThreshold:{number:QE},hierarchical:{enabled:{boolean:UE},levelSeparation:{number:QE},nodeSpacing:{number:QE},treeSpacing:{number:QE},blockShifting:{boolean:UE},edgeMinimization:{boolean:UE},parentCentralization:{boolean:UE},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:HE,boolean:UE}},__type__:{object:HE}},manipulation:{enabled:{boolean:UE},initiallyActive:{boolean:UE},addNode:{boolean:UE,function:"function"},addEdge:{boolean:UE,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:HE,boolean:UE,function:"function"}},deleteNode:{boolean:UE,function:"function"},deleteEdge:{boolean:UE,function:"function"},controlNodeStyle:XE,__type__:{object:HE,boolean:UE}},nodes:XE,physics:{enabled:{boolean:UE},barnesHut:{theta:{number:QE},gravitationalConstant:{number:QE},centralGravity:{number:QE},springLength:{number:QE},springConstant:{number:QE},damping:{number:QE},avoidOverlap:{number:QE},__type__:{object:HE}},forceAtlas2Based:{theta:{number:QE},gravitationalConstant:{number:QE},centralGravity:{number:QE},springLength:{number:QE},springConstant:{number:QE},damping:{number:QE},avoidOverlap:{number:QE},__type__:{object:HE}},repulsion:{centralGravity:{number:QE},springLength:{number:QE},springConstant:{number:QE},nodeDistance:{number:QE},damping:{number:QE},__type__:{object:HE}},hierarchicalRepulsion:{centralGravity:{number:QE},springLength:{number:QE},springConstant:{number:QE},nodeDistance:{number:QE},damping:{number:QE},avoidOverlap:{number:QE},__type__:{object:HE}},maxVelocity:{number:QE},minVelocity:{number:QE},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:UE},iterations:{number:QE},updateInterval:{number:QE},onlyDynamicEdges:{boolean:UE},fit:{boolean:UE},__type__:{object:HE,boolean:UE}},timestep:{number:QE},adaptiveTimestep:{boolean:UE},wind:{x:{number:QE},y:{number:QE},__type__:{object:HE}},__type__:{object:HE,boolean:UE}},autoResize:{boolean:UE},clickToUse:{boolean:UE},locale:{string:_E},locales:{__any__:{any:"any"},__type__:{object:HE}},height:{string:_E},width:{string:_E},__type__:{object:HE}},qE={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,autoFocus:!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]}}},$E=function(e,g,t){var A;return!(!Md(e).call(e,"physics")||!Md(A=qE.physics.solver).call(A,g)||t.physics.solver===g||"wind"===g)},eO=function(){function e(){ta(this,e)}return Ca(e,[{key:"getDistances",value:function(e,g,t){for(var A={},i=e.edges,C=0;C<g.length;C++){var I={};A[g[C]]=I;for(var n=0;n<g.length;n++)I[g[n]]=C==n?0:1e9}for(var o=0;o<t.length;o++){var r=i[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=g.length,a=0;a<s;a++)for(var l=g[a],d=A[l],h=0;h<s-1;h++)for(var c=g[h],u=A[c],p=h+1;p<s;p++){var f=g[p],v=A[f],m=Math.min(u[f],u[l]+d[f]);u[f]=m,v[c]=m}return A}}]),e}(),gO=function(){function e(g,t,A){ta(this,e),this.body=g,this.springLength=t,this.springConstant=A,this.distanceSolver=new eO}return Ca(e,[{key:"setOptions",value:function(e){e&&(e.springLength&&(this.springLength=e.springLength),e.springConstant&&(this.springConstant=e.springConstant))}},{key:"solve",value:function(e,g){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],A=this.distanceSolver.getDistances(this.body,e,g);this._createL_matrix(A),this._createK_matrix(A),this._createE_matrix();for(var i=.01,C=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>i&&I<n;){I+=1;var c=this._getHighestEnergyNode(t),u=tl(c,4);for(s=u[0],r=u[1],a=u[2],l=u[3],d=r,h=0;d>C&&h<o;){h+=1,this._moveNode(s,a,l);var p=this._getEnergy(s),f=tl(p,3);d=f[0],a=f[1],l=f[2]}}}},{key:"_getHighestEnergyNode",value:function(e){for(var g=this.body.nodeIndices,t=this.body.nodes,A=0,i=g[0],C=0,I=0,n=0;n<g.length;n++){var o=g[n];if(!0!==t[o].predefinedPosition||!0===t[o].isCluster&&!0===e||!0!==t[o].options.fixed.x||!0!==t[o].options.fixed.y){var r=tl(this._getEnergy(o),3),s=r[0],a=r[1],l=r[2];A<s&&(A=s,i=o,C=a,I=l)}}return[i,A,C,I]}},{key:"_getEnergy",value:function(e){var g=tl(this.E_sums[e],2),t=g[0],A=g[1];return[Math.sqrt(Math.pow(t,2)+Math.pow(A,2)),t,A]}},{key:"_moveNode",value:function(e,g,t){for(var A=this.body.nodeIndices,i=this.body.nodes,C=0,I=0,n=0,o=i[e].x,r=i[e].y,s=this.K_matrix[e],a=this.L_matrix[e],l=0;l<A.length;l++){var d=A[l];if(d!==e){var h=i[d].x,c=i[d].y,u=s[d],p=a[d],f=1/Math.pow(Math.pow(o-h,2)+Math.pow(r-c,2),1.5);C+=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=(g/C+t/I)/(I/C-n/I),m=-(I*v+g)/C;i[e].x+=m,i[e].y+=v,this._updateE_matrix(e)}},{key:"_createL_matrix",value:function(e){var g=this.body.nodeIndices,t=this.springLength;this.L_matrix=[];for(var A=0;A<g.length;A++){this.L_matrix[g[A]]={};for(var i=0;i<g.length;i++)this.L_matrix[g[A]][g[i]]=t*e[g[A]][g[i]]}}},{key:"_createK_matrix",value:function(e){var g=this.body.nodeIndices,t=this.springConstant;this.K_matrix=[];for(var A=0;A<g.length;A++){this.K_matrix[g[A]]={};for(var i=0;i<g.length;i++)this.K_matrix[g[A]][g[i]]=t*Math.pow(e[g[A]][g[i]],-2)}}},{key:"_createE_matrix",value:function(){var e=this.body.nodeIndices,g=this.body.nodes;this.E_matrix={},this.E_sums={};for(var t=0;t<e.length;t++)this.E_matrix[e[t]]=[];for(var A=0;A<e.length;A++){for(var i=e[A],C=g[i].x,I=g[i].y,n=0,o=0,r=A;r<e.length;r++){var s=e[r];if(s!==i){var a=g[s].x,l=g[s].y,d=1/Math.sqrt(Math.pow(C-a,2)+Math.pow(I-l,2));this.E_matrix[i][r]=[this.K_matrix[i][s]*(C-a-this.L_matrix[i][s]*(C-a)*d),this.K_matrix[i][s]*(I-l-this.L_matrix[i][s]*(I-l)*d)],this.E_matrix[s][A]=this.E_matrix[i][r],n+=this.E_matrix[i][r][0],o+=this.E_matrix[i][r][1]}}this.E_sums[i]=[n,o]}}},{key:"_updateE_matrix",value:function(e){for(var g=this.body.nodeIndices,t=this.body.nodes,A=this.E_matrix[e],i=this.K_matrix[e],C=this.L_matrix[e],I=t[e].x,n=t[e].y,o=0,r=0,s=0;s<g.length;s++){var a=g[s];if(a!==e){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=i[a]*(I-c-C[a]*(I-c)*p),v=i[a]*(n-u-C[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[e]=[o,r]}}]),e}();function tO(e,g,t){var A,i,C,I,n=this;if(!(this instanceof tO))throw new SyntaxError("Constructor must be called with the new operator");this.options={},this.defaultOptions={locale:"en",locales:Of,clickToUse:!1},NA(this.options,this.defaultOptions),this.body={container:e,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:JA(A=this.on).call(A,this),off:JA(i=this.off).call(i,this),emit:JA(C=this.emit).call(C,this),once:JA(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 Df((function(){return n.body.emitter.emit("_requestRedraw")})),this.groups=new $v,this.canvas=new px(this.body),this.selectionHandler=new wE(this.body,this.canvas),this.interactionHandler=new kx(this.body,this.canvas,this.selectionHandler),this.view=new vx(this.body,this.canvas),this.renderer=new dx(this.body,this.canvas),this.physics=new Ix(this.body),this.layoutEngine=new LE(this.body),this.clustering=new sx(this.body),this.manipulation=new WE(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new $w(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new Kk(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new gO(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(t),this.setData(g)}Ii(tO.prototype),tO.prototype.setOptions=function(e){var g=this;if(null===e&&(e=void 0),void 0!==e){!0===Qp.validate(e,JE)&&console.error("%cErrors have been found in the supplied options object.","background: #FFeeee; color: #dd0000");if(pp(["locale","locales","clickToUse"],this.options,e),void 0!==e.locale&&(e.locale=function(e,g){try{var t=tl(g.split(/[-_ /]/,2),2),A=t[0],i=t[1],C=null!=A?A.toLowerCase():null,I=null!=i?i.toUpperCase():null;if(C&&I){var n,o=C+"-"+I;if(Object.prototype.hasOwnProperty.call(e,o))return o;console.warn(ll(n="Unknown variant ".concat(I," of language ")).call(n,C,"."))}if(C){var r=C;if(Object.prototype.hasOwnProperty.call(e,r))return r;console.warn("Unknown language ".concat(C))}return console.warn("Unknown locale ".concat(g,", falling back to English.")),"en"}catch(e){return console.error(e),console.warn("Unexpected error while normalizing locale ".concat(g,", falling back to English.")),"en"}}(e.locales||this.options.locales,e.locale)),e=this.layoutEngine.setOptions(e.layout,e),this.canvas.setOptions(e),this.groups.setOptions(e.groups),this.nodesHandler.setOptions(e.nodes),this.edgesHandler.setOptions(e.edges),this.physics.setOptions(e.physics),this.manipulation.setOptions(e.manipulation,e,this.options),this.interactionHandler.setOptions(e.interaction),this.renderer.setOptions(e.interaction),this.selectionHandler.setOptions(e.interaction),void 0!==e.groups&&this.body.emitter.emit("refreshNodes"),"configure"in e&&(this.configurator||(this.configurator=new Wp(this,this.body.container,qE,this.canvas.pixelRatio,$E)),this.configurator.setOptions(e.configure)),this.configurator&&!0===this.configurator.options.enabled){var t={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};vp(t.nodes,this.nodesHandler.options),vp(t.edges,this.edgesHandler.options),vp(t.layout,this.layoutEngine.options),vp(t.interaction,this.selectionHandler.options),vp(t.interaction,this.renderer.options),vp(t.interaction,this.interactionHandler.options),vp(t.manipulation,this.manipulation.options),vp(t.physics,this.physics.options),vp(t.global,this.canvas.options),vp(t.global,this.options),this.configurator.setModuleOptions(t)}void 0!==e.clickToUse?!0===e.clickToUse?void 0===this.activator&&(this.activator=new Yp(this.canvas.frame),this.activator.on("change",(function(){g.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")}},tO.prototype._updateVisibleIndices=function(){var e=this.body.nodes,g=this.body.edges;for(var t in this.body.nodeIndices=[],this.body.edgeIndices=[],e)Object.prototype.hasOwnProperty.call(e,t)&&(this.clustering._isClusteredNode(t)||!1!==e[t].options.hidden||this.body.nodeIndices.push(e[t].id));for(var A in g)if(Object.prototype.hasOwnProperty.call(g,A)){var i=g[A],C=e[i.fromId],I=e[i.toId],n=void 0!==C&&void 0!==I;!this.clustering._isClusteredEdge(A)&&!1===i.options.hidden&&n&&!1===C.options.hidden&&!1===I.options.hidden&&this.body.edgeIndices.push(i.id)}},tO.prototype.bindEventListeners=function(){var e=this;this.body.emitter.on("_dataChanged",(function(){e.edgesHandler._updateState(),e.body.emitter.emit("_dataUpdated")})),this.body.emitter.on("_dataUpdated",(function(){e.clustering._updateState(),e._updateVisibleIndices(),e._updateValueRange(e.body.nodes),e._updateValueRange(e.body.edges),e.body.emitter.emit("startSimulation"),e.body.emitter.emit("_requestRedraw")}))},tO.prototype.setData=function(e){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),e&&e.dot&&(e.nodes||e.edges))throw new SyntaxError('Data must contain either parameter "dot" or  parameter pair "nodes" and "edges", but not both.');if(this.setOptions(e&&e.options),e&&e.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 g=Ef(e.dot);this.setData(g)}else if(e&&e.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(e,g){var t,A={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};null!=g&&(null!=g.fixed&&(A.nodes.fixed=g.fixed),null!=g.parseColor&&(A.nodes.parseColor=g.parseColor),null!=g.inheritColor&&(A.edges.inheritColor=g.inheritColor));var i=e.edges,C=yl(i).call(i,(function(e){var g={from:e.source,id:e.id,to:e.target};return null!=e.attributes&&(g.attributes=e.attributes),null!=e.label&&(g.label=e.label),null!=e.attributes&&null!=e.attributes.title&&(g.title=e.attributes.title),"Directed"===e.type&&(g.arrows="to"),e.color&&!1===A.edges.inheritColor&&(g.color=e.color),g}));return{nodes:yl(t=e.nodes).call(t,(function(e){var g={id:e.id,fixed:A.nodes.fixed&&null!=e.x&&null!=e.y};return null!=e.attributes&&(g.attributes=e.attributes),null!=e.label&&(g.label=e.label),null!=e.size&&(g.size=e.size),null!=e.attributes&&null!=e.attributes.title&&(g.title=e.attributes.title),null!=e.title&&(g.title=e.title),null!=e.x&&(g.x=e.x),null!=e.y&&(g.y=e.y),null!=e.color&&(!0===A.nodes.parseColor?g.color=e.color:g.color={background:e.color,border:e.color,highlight:{background:e.color,border:e.color},hover:{background:e.color,border:e.color}}),g})),edges:C}}(e.gephi);this.setData(t)}else this.nodesHandler.setData(e&&e.nodes,!0),this.edgesHandler.setData(e&&e.edges,!0),this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},tO.prototype.destroy=function(){for(var e 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,e)&&delete this.body.nodes[e];for(var g in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,g)&&delete this.body.edges[g];lp(this.body.container)},tO.prototype._updateValueRange=function(e){var g,t=void 0,A=void 0,i=0;for(g in e)if(Object.prototype.hasOwnProperty.call(e,g)){var C=e[g].getValue();void 0!==C&&(t=void 0===t?C:Math.min(C,t),A=void 0===A?C:Math.max(C,A),i+=C)}if(void 0!==t&&void 0!==A)for(g in e)Object.prototype.hasOwnProperty.call(e,g)&&e[g].setValueRange(t,A,i)},tO.prototype.isActive=function(){return!this.activator||this.activator.active},tO.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},tO.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},tO.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},tO.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},tO.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},tO.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},tO.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},tO.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},tO.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},tO.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},tO.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},tO.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},tO.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},tO.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},tO.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},tO.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},tO.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},tO.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},tO.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},tO.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},tO.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},tO.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},tO.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},tO.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},tO.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},tO.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},tO.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},tO.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},tO.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},tO.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},tO.prototype.getConnectedNodes=function(e){return void 0!==this.body.nodes[e]?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},tO.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},tO.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},tO.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},tO.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},tO.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},tO.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},tO.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},tO.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},tO.prototype.getNodeAt=function(){var e=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},tO.prototype.getEdgeAt=function(){var e=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},tO.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},tO.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},tO.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},tO.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},tO.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},tO.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},tO.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},tO.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},tO.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},tO.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},tO.prototype.getOptionsFromConfigurator=function(){var e={};return this.configurator&&(e=this.configurator.getOptions.apply(this.configurator)),e};
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let AO=class extends a{constructor(){super(),this.pipelineConfigPath="config.json",this.pipelineComponentDetailPath="components.json"}async _downloadPipelineConfig(e){try{const g=await window.backendaiclient.vfolder.download(this.pipelineConfigPath,e,!1,!0);return await g.json()}catch(e){console.error(e),this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0)}}async _uploadFile(e,g,t){return new Promise(((A,i)=>{globalThis.backendaiclient.vfolder.create_upload_session(e,g,t).then((t=>{new w.Upload(g,{endpoint:t,retryDelays:[0,3e3,5e3,1e4,2e4],uploadUrl:t,chunksize:15728640,metadata:{filename:e,filetype:g.type},onError:e=>{console.error("upload failed:"+e),this.notification.text=e,this.notification.show(!0),i(new Error(e))},onSuccess:()=>{console.log(`${e} uploaded`),A(!0)}}).start()})).catch((e=>{console.error(e),this.notification.text=e,this.notification.show(!0),i(new Error(e))}))}))}};t([r({type:String})],AO.prototype,"pipelineConfigPath",void 0),t([r({type:String})],AO.prototype,"pipelineComponentDetailPath",void 0),AO=t([s("backend-ai-pipeline-common")],AO);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let iO=class extends AO{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(e){await this.updateComplete,!1!==e&&(void 0!==window.backendaiclient&&null!==window.backendaiclient&&!1!==window.backendaiclient.ready||document.addEventListener("backend-ai-connected",(async()=>{}),!0))}openComponentAddDialog(e,g,t,A){if(!e||""===e)return this.notification.text=d("pipeline.NoPipelineSelected"),void this.notification.show();this.componentCreateMode="create",this.pipelineSelectedName=e,this.componentNodes=g,this.componentEdges=t,this.selectedNodes=A,this.shadowRoot.querySelector("#component-add-dialog").show()}openComponentUpdateDialog(e,g,t,A){return e&&""!==e?A?(this.componentCreateMode="update",this.pipelineSelectedName=e,this.componentNodes=g,this.componentEdges=t,this.selectedNodes=[A.id],this._fillComponentAddDialogFields(A),void this.shadowRoot.querySelector("#component-add-dialog").show()):(this.notification.text=d("pipeline.Component.NoComponentSelected"),void this.notification.show()):(this.notification.text=d("pipeline.NoPipelineSelected"),void this.notification.show())}openComponentDeleteDialog(e,g,t,A){return e&&""!==e?!A||A.length<1?(this.notification.text=d("pipeline.Component.NoComponentSelected"),void this.notification.show()):(this.pipelineSelectedName=e,this.componentNodes=g,this.componentEdges=t,this.selectedNodes=A,void this.shadowRoot.querySelector("#component-delete-dialog").show()):(this.notification.text=d("pipeline.NoPipelineSelected"),void this.notification.show())}_hideComponentAddDialog(){this.shadowRoot.querySelector("#component-add-dialog").hide()}_hideComponentDeleteDialog(){this.shadowRoot.querySelector("#component-delete-dialog").hide()}async connectTwoNodes(e,g,t,A){if(2!==A.length)return this.notification.text=d("pipeline.Component.NoComponentSelected"),void this.notification.show();let i=-1;const C=A[0],I=A[1];for(let e=0;e<t.length;e++)if(t[e].from===C&&t[e].to===I||t[e].from===I&&t[e].to===C){i=e;break}i>0?t.splice(i,1):t.push({from:C,to:I});const n={nodes:g,edges:t};this.spinner.show(),await this._uploadPipelineComponents(e,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(e){e||(e={});const g=this.shadowRoot.querySelector("#component-add-dialog");g.querySelector("#component-name").value=e.title||"",g.querySelector("#component-description").value=e.description||"",g.querySelector("#component-path").value=e.path||"",g.querySelector("#component-cpu").value=e.cpu||"1",g.querySelector("#component-mem").value=e.mem||"1",g.querySelector("#component-gpu").value=e.gpu||"0"}async _addComponent(){const e=this.shadowRoot.querySelector("#component-name").value,g=this.shadowRoot.querySelector("#component-description").value,t=this.shadowRoot.querySelector("#component-path").value;if(!e||!t)return this.notification.text=d("pipeline.ComponentDialog.NamePathRequired"),void this.notification.show();const A=window.backendaiclient.slugify(t),i=this.shadowRoot.querySelector("#component-cpu").value,C=this.shadowRoot.querySelector("#component-mem").value;let I=this.shadowRoot.querySelector("#component-gpu").value;if(i<1)return this.notification.text=d("pipeline.ComponentDialog.CPUNotEnough"),void this.notification.show();if(C<.1)return this.notification.text=d("pipeline.ComponentDialog.MemoryNotEnough"),void this.notification.show();I||(I=0);const n={id:"",title:e,label:e,description:g,path:A,cpu:i,mem:C,gpu:I,executed:!1};if("create"===this.componentCreateMode){const e=`component-${window.backendaiclient.generateSessionId(8,!0)}`;n.id=e,this.componentNodes.push(n),this.selectedNodes&&this.selectedNodes.length>0&&this.selectedNodes.forEach((e=>{this.componentEdges.push({from:e,to:n.id})}))}else{n.id=this.selectedNodes[0];for(let e=0;e<this.componentNodes.length;e++)if(n.id===this.componentNodes[e].id){this.componentNodes[e]=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((e=>{for(let g=0;g<this.componentNodes.length;g++)if(e===this.componentNodes[g].id){this.componentNodes.splice(g,1);break}const g=[];for(let t=0;t<this.componentEdges.length;t++)e!==this.componentEdges[t].from&&e!=this.componentEdges[t].to||g.push(t);if(g.length>0)for(let e=g.length-1;e>=0;e--)this.componentEdges.splice(g[e],1)}));const e={nodes:this.componentNodes,edges:this.componentEdges};this.spinner.show(),await this._uploadPipelineComponents(this.pipelineSelectedName,e),this._hideComponentDeleteDialog(),this.spinner.hide();const g=new CustomEvent("backend-ai-pipeline-component-deleted",{detail:{nodes:e.nodes,edges:e.edges}});this.dispatchEvent(g)}async _uploadPipelineComponents(e,g){const t=new Blob([JSON.stringify(g,null,2)],{type:"application/json"});try{await this._uploadFile(this.pipelineComponentDetailPath,t,e)}catch(e){console.error(e),this.spinner.hide(),this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0)}}static get styles(){return[h,c,u,p,f,v`
        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 m`
      <backend-ai-dialog id="component-add-dialog" fixed backdrop>
        <span slot="title">
          ${"create"===this.componentCreateMode?y("pipeline.ComponentDialog.CreateTitle"):y("pipeline.ComponentDialog.UpdateTitle")}
        </span>
        <div slot="content" class="layout verticlal" style="width:450px">
          <mwc-textfield id="component-name" type="text" autofocus
              label="${y("pipeline.ComponentDialog.Name")}" maxLength="30"></mwc-textfield>
          <mwc-textfield id="component-description" type="text"
              label="${y("pipeline.ComponentDialog.Description")}" maxLength="200"></mwc-textfield>
          <mwc-textfield id="component-path" type="text"
              label="${y("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="${y("button.Cancel")}"
              @click="${this._hideComponentAddDialog}"></mwc-button>
          <mwc-button unelevated
              label="${"create"===this.componentCreateMode?y("button.Add"):y("button.Update")}"
              @click="${this._addComponent}"></mwc-button>
        </div>
      </backend-ai-dialog>

      <backend-ai-dialog id="component-delete-dialog" fixed backdrop blockscrolling>
        <span slot="title">${y("pipeline.ComponentDialog.DeleteTitle")}</span>
        <div slot="content" class="layout vertical">
          <p>${y("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="${y("button.Cancel")}"
              @click="${this._hideComponentDeleteDialog}"></mwc-button>
          <mwc-button unelevated
              label="${y("button.Delete")}"
              @click="${this._deleteComponent}"></mwc-button>
        </div>
      </backend-ai-dialog>

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

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([r({type:Object})],CO.prototype,"spinner",void 0),t([r({type:Object})],CO.prototype,"notification",void 0),t([r({type:String})],CO.prototype,"pipelineSelectedName",void 0),t([r({type:String})],CO.prototype,"pipelineFolderName",void 0),CO=t([s("backend-ai-pipeline-runner")],CO);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let IO=class extends AO{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(e){await this.updateComplete,!1!==e&&(void 0!==window.backendaiclient&&null!==window.backendaiclient&&!1!==window.backendaiclient.ready||document.addEventListener("backend-ai-connected",(async()=>{}),!0))}_initEventHandlers(){const e=e=>{e.stopPropagation(),this.nodes=e.detail.nodes.slice(),this.edges=e.detail.edges.slice(),this.network.setData({nodes:this.nodes,edges:this.edges})};this.componentCreate.addEventListener("backend-ai-pipeline-component-created",(g=>{e(g)})),this.componentCreate.addEventListener("backend-ai-pipeline-component-updated",(g=>{e(g)})),this.componentCreate.addEventListener("backend-ai-pipeline-component-deleted",(g=>{e(g)})),this.componentCreate.addEventListener("backend-ai-pipeline-component-connection-updated",(g=>{e(g)}))}_initNetwork(){const e={nodes:this.nodes,edges:this.edges};this.networkContainer=this.shadowRoot.querySelector("#component-network"),this.network=new tO(this.networkContainer,e,this.networkOptions),this.network.on("click",(e=>{this.componentsSelected=e.nodes})),this.network.on("doubleClick",(e=>{1===e.nodes.length&&this._editComponentCode()}))}async pipelineChanged(){const{nodes:e,edges:g}=await this._fetchPipelineComponents();this.nodes=e||[],this.edges=g||[],this.network.setData({nodes:e,edges:g});const t={};this.nodes.forEach((e=>t[e.id]=e)),this.nodeInfo=t}async _fetchPipelineComponents(e=""){""!==e&&e||(e=this.pipelineSelectedName);try{this.spinner.show();const g=await window.backendaiclient.vfolder.download(this.pipelineComponentDetailPath,e,!1,!0);return await g.json()}catch(e){console.error(e),this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0)}finally{this.spinner.hide()}}_openComponentAddDialog(){let e=null;this.componentsSelected.length>0&&(e=this.componentsSelected),this.componentCreate.openComponentAddDialog(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),e)}_openComponentUpdateDialog(){if(1!==this.componentsSelected.length)return this.notification.text=d("pipeline.Component.NoComponentSelected"),void this.notification.show();const e=this.componentsSelected[0],g=this.network.body.data.nodes.get(e);this.componentCreate.openComponentUpdateDialog(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),g)}_openComponentDeleteDialog(){if(this.componentsSelected.length<1)return this.notification.text=d("pipeline.Component.NoComponentSelected"),void this.notification.show();const e=this.componentsSelected.slice();this.componentCreate.openComponentDeleteDialog(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),e)}_connectTwoComponents(){if(2!==this.componentsSelected.length)return this.notification.text=d("pipeline.Component.NoComponentSelected"),void this.notification.show();const e=this.componentsSelected.slice();this.componentCreate.connectTwoNodes(this.pipelineSelectedName,this.nodes.slice(),this.edges.slice(),e)}_editComponentCode(){if(1!==this.componentsSelected.length)return this.notification.text=d("pipeline.Component.NoComponentSelected"),void this.notification.show();const e=this.componentsSelected[0],g=this.network.body.data.nodes.get(e);this.pipelineRunner.editCode(this.pipelineSelectedName,g)}_runPipeline(){}static get styles(){return[h,c,u,p,f,v`
        #component-network {
          // min-height: 500px;
        }
      `]}render(){return m`
      <div class="card" elevation="0">
        <div class="layout horizontal center wrap" style="margin:0.2em">
          <mwc-button outlined id="add-component-btn" icon="add"
              label="${y("button.Add")}" @click="${()=>this._openComponentAddDialog()}">
          </mwc-button>
          ${1===this.componentsSelected.length?m`
            <mwc-button dense outlined id="update-component-btn" icon="edit"
                label="${y("button.Edit")}" @click="${()=>this._openComponentUpdateDialog()}">
            </mwc-button>
          `:m``}
          ${this.componentsSelected.length>0?m`
            <mwc-button dense outlined id="delete-component-btn" icon="delete"
                label="${y("button.Delete")}" @click="${()=>this._openComponentDeleteDialog()}">
            </mwc-button>
          `:m``}
          ${2===this.componentsSelected.length?m`
            <mwc-button dense outlined id="connect-component-btn" icon="trending_up"
                label="${y("pipeline.Component.Connect")}" @click="${()=>this._connectTwoComponents()}">
            </mwc-button>
          `:m``}
          <span class="flex"></span>
          <mwc-button raised id="run-pipeline-btn" icon="play_arrow"
              label="${y("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([r({type:Object})],IO.prototype,"spinner",void 0),t([r({type:Object})],IO.prototype,"notification",void 0),t([r({type:Object})],IO.prototype,"componentCreate",void 0),t([r({type:Object})],IO.prototype,"pipelineRunner",void 0),t([r({type:String})],IO.prototype,"pipelineSelectedName",void 0),t([r({type:Object})],IO.prototype,"pipelineSelectedConfig",void 0),t([r({type:Array})],IO.prototype,"network",void 0),t([r({type:Array})],IO.prototype,"networkOptions",void 0),t([r({type:Object})],IO.prototype,"networkContainer",void 0),t([r({type:Array})],IO.prototype,"nodes",void 0),t([r({type:Array})],IO.prototype,"edges",void 0),t([r({type:Object})],IO.prototype,"nodeInfo",void 0),t([r({type:Array})],IO.prototype,"componentsSelected",void 0),IO=t([s("backend-ai-pipeline-component-view")],IO);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let nO=class extends AO{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((e=>e.json())).then((e=>{this.imageInfo=e.imageInfo;for(const e in this.imageInfo)({}).hasOwnProperty.call(this.imageInfo,e)&&(this.tags[e]=[],"name"in this.imageInfo[e]&&(this.aliases[e]=this.imageInfo[e].name,this.imageNames[e]=this.imageInfo[e].name),"label"in this.imageInfo[e]&&this.imageInfo[e].label.forEach((g=>{"category"in g||this.tags[e].push(g.tag)})))})),this.shadowRoot.querySelector("#pipeline-environment").addEventListener("selected",this.updateLanguage.bind(this)),this._refreshImageList()}updateLanguage(){const e=this.shadowRoot.querySelector("#pipeline-environment").selected;if(null===e)return;const g=e.id;this._updateVersions(g)}_updateVersions(e){const g=this.shadowRoot.querySelector("#pipeline-environment-tag");if(e in this.supports){const g=this.supports[e];g.sort(),g.reverse(),this.versions=g}void 0!==this.versions&&(g.value=this.versions[0],g.selectedText=g.value)}async _fetchResourceGroup(){const e=window.backendaiclient.current_group||null,g=await window.backendaiclient.scalingGroup.list(e);this.scalingGroups=g.scaling_groups,this.scalingGroup=g.scaling_groups[0].name}_refreshImageList(){window.backendaiclient.image.list(["name","humanized_name","tag","registry","digest","installed","resource_limits { key min max }"],!0).then((e=>{const g=[];Object.keys(e.images).map(((t,A)=>{const i=e.images[t];!0===i.installed&&g.push(i)})),0!==g.length&&(this.images=g,this.supports={},Object.keys(this.images).map(((e,g)=>{const t=this.images[e],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((e=>{console.error(e),e&&e.message&&(this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0))}))}_updateEnvironment(){const e=Object.keys(this.supports);void 0!==e&&(e.sort(),this.languages=[],e.forEach(((e,g)=>{if(!Object.keys(this.aliases).includes(e)){const g=this._guessHumanizedNames(e);this.aliases[e]=null!==g?g:e}const t=e.split("/"),A=t[0];let i,C;2==t.length?(i="",C=t[1]):(i=t[1],C=t[2]);const I=this.aliases[e];let n;n=void 0!==I?I.split(" (")[0]:C;let o=[];C in this.tags&&(o=o.concat(this.tags[C])),""!=i&&o.push(i),this.languages.push({name:e,registry:A,prefix:i,kernelname:C,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(e){const g=this.imageNames;let t="",A=null,i="abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()";return Object.keys(g).forEach(((C,I)=>{const n=e.split("/");t=2==n.length?n[1]:n[2],(t===C||""===t&&e.endsWith(C)&&C.length<i.length)&&(A=g[C],i=C)})),A}_initAliases(){for(const e in this.aliases)({}).hasOwnProperty.call(this.aliases,e)&&(this.aliases[this.aliases[e]]=e)}_openPipelineCreateDialog(){this.selectDefaultLanguage(),this._fetchResourceGroup(),this._fillPipelineCreateDialogFields(null),this.pipelineCreateMode="create",window.backendaiclient.vfolder.list_hosts().then((e=>{const g=this.shadowRoot.querySelector("#pipeline-folder-host");this.vhosts=e.allowed.slice(),this.vhost=e.default,g.value=this.vhost})).catch((e=>{console.error(e),e&&e.message&&(this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0))})),this.shadowRoot.querySelector("#pipeline-create-dialog").show()}async _openPipelineUpdateDialog(e){if(this.pipelineFolderName=e,!this.pipelineFolderName)return this.notification.text=d("pipeline.NoPipelineSelected"),void this.notification.show();this._fetchResourceGroup();const g=await this._downloadPipelineConfig(this.pipelineFolderName);this.pipelineCreateMode="update",window.backendaiclient.vfolder.list_hosts().then((e=>{const t=this.shadowRoot.querySelector("#pipeline-folder-host");this.vhosts=e.allowed.slice(),this.vhost=g.folder_host,t.value=this.vhost,this._fillPipelineCreateDialogFields(g)})).catch((e=>{console.error(e),e&&e.message&&(this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0))})),this._fillPipelineCreateDialogFields(g),this.shadowRoot.querySelector("#pipeline-create-dialog").show()}_openPipelineDeleteDialog(e){if(this.pipelineFolderName=e,!this.pipelineFolderName)return this.notification.text=d("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(e){e||(e={});const g=this.shadowRoot.querySelector("#pipeline-create-dialog");g.querySelector("#pipeline-title").value=e.title||"",g.querySelector("#pipeline-description").value=e.description||"",e.environment&&(g.querySelector("#pipeline-environment").value=e.environment),e.version&&(g.querySelector("#pipeline-environment-tag").value=e.version),e.scaling_group&&(g.querySelector("#pipeline-scaling-group").value=e.scaling_group),e.folder_host&&(g.querySelector("#pipeline-folder-host").value=e.folder_host)}async _createPipeline(){const e=this.shadowRoot.querySelector("#pipeline-title").value,g=this.shadowRoot.querySelector("#pipeline-description").value,t=this.shadowRoot.querySelector("#pipeline-environment").value,A=this.shadowRoot.querySelector("#pipeline-environment-tag").value,i=this.shadowRoot.querySelector("#pipeline-scaling-group").value,C=this.shadowRoot.querySelector("#pipeline-folder-host").value,I=`pipeline-${window.backendaiclient.slugify(e)}-${window.backendaiclient.generateSessionId(8,!0)}`;if(!(e&&t&&A&&i&&C))return this.notification.text=d("pipeline.PipelineDialog.FillAllInputFields"),void this.notification.show();const n={title:e,description:g,environment:t,version:A,scaling_group:i,folder_host:C};if(this.spinner.show(),"create"===this.pipelineCreateMode)try{await window.backendaiclient.vfolder.create(I,C);const e=this._uploadPipelineConfig(I,n),g=this._uploadPipelineComponents(I,{});await Promise.all([e,g]);const t=new CustomEvent("backend-ai-pipeline-created",{detail:I});this.dispatchEvent(t),this._hidePipelineCreateDialog(),this.spinner.hide(),this.notification.text=d("pipeline.PipelineCreated"),this.notification.show()}catch(e){console.error(e),e&&e.message&&(this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0)),this.spinner.hide()}else try{await this._uploadPipelineConfig(this.pipelineFolderName,n);const e=new CustomEvent("backend-ai-pipeline-updated",{detail:this.pipelineFolderName});this.dispatchEvent(e),this._hidePipelineCreateDialog(),this.spinner.hide()}catch(e){console.error(e),e&&e.message&&(this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0)),this.spinner.hide()}}_deletePipeline(){globalThis.backendaiclient.vfolder.delete(this.pipelineFolderName).then((e=>{const g=new CustomEvent("backend-ai-pipeline-deleted",{detail:this.pipelineFolderName});this.dispatchEvent(g),this._hidePipelineDeleteDialog(),this.notification.text=d("pipeline.PipelineDeleted"),this.notification.show()})).catch((e=>{console.log(e),e&&e.message&&(this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0,e))}))}async _uploadPipelineConfig(e,g){const t=new Blob([JSON.stringify(g,null,2)],{type:"application/json"});await this._uploadFile(this.pipelineConfigPath,t,e)}async _uploadPipelineComponents(e,g){const t=this.pipelineComponentDetailPath,A=new Blob([JSON.stringify(g,null,2)],{type:"application/json"});try{this.spinner.show(),await this._uploadFile(t,A,e),this.spinner.hide()}catch(e){console.error(e),this.spinner.hide(),this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0)}}static get styles(){return[h,c,u,p,f,v`
        .warning {
          color: red;
        }
      `]}render(){return m`
      <div class="card" elevation="0">
      </div>

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

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

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([r({type:Object})],nO.prototype,"spinner",void 0),t([r({type:Object})],nO.prototype,"notification",void 0),t([r({type:Object})],nO.prototype,"tags",void 0),t([r({type:Array})],nO.prototype,"languages",void 0),t([r({type:String})],nO.prototype,"defaultLanguage",void 0),t([r({type:Array})],nO.prototype,"versions",void 0),t([r({type:String})],nO.prototype,"scalingGroup",void 0),t([r({type:Array})],nO.prototype,"scalingGroups",void 0),t([r({type:String})],nO.prototype,"vhost",void 0),t([r({type:Array})],nO.prototype,"vhosts",void 0),t([r({type:Object})],nO.prototype,"images",void 0),t([r({type:Object})],nO.prototype,"imageInfo",void 0),t([r({type:Object})],nO.prototype,"imageNames",void 0),t([r({type:Object})],nO.prototype,"resourceLimits",void 0),t([r({type:Object})],nO.prototype,"supports",void 0),t([r({type:Object})],nO.prototype,"aliases",void 0),t([r({type:String})],nO.prototype,"pipelineCreateMode",void 0),t([r({type:String})],nO.prototype,"pipelineFolderName",void 0),nO=t([s("backend-ai-pipeline-create")],nO);
/**
 @license
 Copyright (c) 2015-2020 Lablup Inc. All rights reserved.
 */
let oO=class extends AO{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(e){console.log(e),localStorage.removeItem("backendaiconsole.pipeline.selectedName"),localStorage.removeItem("backendaiconsole.pipeline.selectedConfig")}}firstUpdated(){this.spinner=this.shadowRoot.querySelector("#loading-spinner")}async _viewStateChanged(e){await this.updateComplete,!1!==e&&(void 0===window.backendaiclient||null===window.backendaiclient||!1===window.backendaiclient.ready?document.addEventListener("backend-ai-connected",(async()=>{this._fetchPipelineFolders()}),!0):this._fetchPipelineFolders())}async changePipeline(e){await this._fetchPipelineFolders(),this.pipelineSelectedName=e,this.pipelineSelectedConfig=this.pipelineFolders[e].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(e){const g=e.target.value;if(!g)return;this.pipelineSelectedName=g,this.pipelineSelectedConfig=this.pipelineFolders[g].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 e=await window.backendaiclient.vfolder.list(),g={},t=[];return e.forEach((e=>{if(e.name.startsWith("pipeline-")){const A=this._downloadPipelineConfig(e.name).then((t=>{e.config=t,g[e.name]=e}));t.push(A)}})),Promise.all(t).then((()=>{this.pipelineFolders=g,this.spinner.hide()}))}catch(e){console.error(e),this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0),this.spinner.hide()}}static get styles(){return[h,c,u,p,f,v`
        :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 m`
      <div class="card" elevation="0">
        <h3 class="horizontal center layout wrap">
          <mwc-select id="pipeline-selector" outlined label="${y("pipeline.SelectPipeline")}"
              @change="${this._pipelineChanged}">
            ${Object.keys(this.pipelineFolders).map((e=>m`
              <mwc-list-item class="pipeline-item" value="${e}"
                  ?selected="${e===this.pipelineSelectedName}"
                  folder-id="${this.pipelineFolders[e].id}"
                  folder-host="${this.pipelineFolders[e].host}">
                <span>${this.pipelineFolders[e].config.title}</span>
              </mwc-list-item>
            `))}
          </mwc-select>
          <div id="pipeline-description" class="layout vertical">
            ${this.pipelineSelectedConfig&&this.pipelineSelectedConfig.description?m`
              <span>${this.pipelineSelectedConfig.description}</span>
            `:m``}
            ${this.pipelineSelectedConfig&&this.pipelineSelectedConfig.environment?m`
              <span class="indicator monospace">${this.pipelineSelectedConfig.environment+":"+this.pipelineSelectedConfig.version}</span>
            `:m``}
          </div>
        </h3>
      </div>

      <lablup-loading-spinner id="loading-spinner"></lablup-loading-spinner>
    `}};t([r({type:Object})],oO.prototype,"spinner",void 0),t([r({type:Array})],oO.prototype,"pipelineFolders",void 0),t([r({type:String})],oO.prototype,"pipelineSelectedName",void 0),t([r({type:Object})],oO.prototype,"pipelineSelectedConfig",void 0),oO=t([s("backend-ai-pipeline-list")],oO);
/**
 @license
 Copyright (c) 2015-2019 Lablup Inc. All rights reserved.
 */
let rO=class extends a{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[h,c,u,p,f,v`
        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(e){await this.updateComplete,!1!==e&&(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",(e=>{e.stopPropagation();const g=e.detail;this.pipelineList.changePipeline(g)})),this.pipelineCreate.addEventListener("backend-ai-pipeline-updated",(e=>{e.stopPropagation();const g=e.detail;this.pipelineList.changePipeline(g)})),this.pipelineCreate.addEventListener("backend-ai-pipeline-deleted",(e=>{e.stopPropagation(),this.pipelineList.deselectPipeline()})),this.pipelineList.addEventListener("backend-ai-pipeline-changed",(e=>{e.stopPropagation(),this.pipelineComponent.pipelineSelectedName=e.detail.pipelineSelectedName,this.pipelineComponent.pipelineSelectedConfig=e.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 e=`${this.pipelineComponents[this.selectedComponentIndex].path}/main.py`,g=this.shadowRoot.querySelector("#codemirror-editor").getValue(),t=new Blob([g],{type:"plain/text"});await this._uploadFile(e,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(e,g,t){}_uploadPipelineComponents(e,g){}_ensureComponentMainCode(e){}_hideCodeDialog(){this.selectedComponentIndex=-1;this.shadowRoot.querySelector("#codemirror-dialog").hide()}async _saveCodeAndCloseDialog(){await this._saveCode(),this._hideCodeDialog()}_subscribeKernelEventStream(e,g,t,A){const i=window.backendaiclient._config.endpoint+`/func/events/session?sessionName=${e}`,C=new EventSource(i,{withCredentials:!0});let I;return this.spinner.show(),C.addEventListener("kernel_pulling",(e=>{this.notification.text="Pulling kernel image. This may take several minutes...",this.notification.show()})),C.addEventListener("session_started",(e=>{const g=JSON.parse(e.data);this.notification.text=`Session started (${g.sessionName}). Running component...`,this.notification.show()})),C.addEventListener("session_success",(async e=>{t.executed=!0,this.pipelineComponents[g]=t,await this._uploadPipelineComponents(this.pipelineFolderName,this.pipelineComponents),this.pipelineComponents=this.pipelineComponents.slice(),I=!0})),C.addEventListener("session_failure",(e=>{I=!1})),C.addEventListener("session_terminated",(async e=>{const g=JSON.parse(e.data),i=await window.backendaiclient.getTaskLogs(A);console.log(i.substring(0,500));const n=`${t.path}/execution_logs.txt`,o=new Blob([i],{type:"plain/text"});if(await this._uploadFile(n,o,this.pipelineFolderName),C.close(),this.notification.text=I?`Execution succeed (${g.sessionName})`:`Execution error (${g.sessionName})`,this.notification.show(),this.spinner.hide(),I&&this.componentsToBeRun.length>0){const e=this.componentsToBeRun.shift(),g=this.pipelineComponents.map((e=>e.id)).indexOf(e);g<0?this.componentsToBeRun=[]:this._runComponent(g)}I=void 0})),C}async _runComponent(e){if(e<0)return this.notification.text="Invalid component",void this.notification.show();for(let g=0;g<e;g++){if(!this.pipelineComponents[g].executed)return this.notification.text="Run previous component(s) first",void this.notification.show()}const g=this.pipelineConfig,t=this.pipelineComponents[e],A=`${g.environment}:${g.version}`,i={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 C;this.spinner.show(),await this._ensureComponentMainCode(t);try{const g=await window.backendaiclient.createKernel(A,void 0,i),I=g.sessionId,n=g.sessionName;let o;for(let e=0;e<10;e++){const e=await window.backendaiclient.computeSession.get(["id"],I);if(e.compute_session&&e.compute_session.id){o=e.compute_session.id;break}await new Promise((e=>setTimeout(e,1e3)))}if(!o)throw new Error("Unable to get information on compute session");C=this._subscribeKernelEventStream(n,e,t,o)}catch(e){console.error(e),C&&C.close(),this.componentsToBeRun=[],this.spinner.hide(),this.notification.text=l.relieve(e.title),this.notification.detail=e.message,this.notification.show(!0)}}async _showComponentLogs(e){if(e<0)return this.notification.text="Invalid component",void this.notification.show();const g=`${this.pipelineComponents[e].path}/execution_logs.txt`;try{const t=await window.backendaiclient.vfolder.download(g,this.pipelineFolderName),A=await t.text(),i=window.open("",`Component ${e} log`,"width=800,height=600");i&&(i.document.body.innerHTML=`<pre style="color:#ccc; background:#222; padding:1em; overflow:auto;">${A}</pre>`)}catch(e){console.error(e),e.title&&"404"===e.title.split(" ")[0]?(this.notification.text="No logs for this component",this.notification.detail=e.message,this.notification.show(!0)):(this.notification.text=l.relieve(e.title),this.notification.detail=e.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(((e,g)=>{e.executed=!1,this.pipelineComponents[g]=e})),await this._uploadPipelineComponents(this.pipelineFolderName,this.pipelineComponents),this.spinner.show();const e=this.pipelineComponents.map((e=>e.id));this.componentsToBeRun=e,this.componentsToBeRun.shift(),await this._runComponent(0)}render(){return m`
      <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="${y("pipeline.List")}">
                </mwc-tab>
                <mwc-tab style="display:none" aria-label="running-lists"
                    label="${y("pipeline.Running")}">
                </mwc-tab>
                <mwc-tab style="display:none" aria-label="finished-lists"
                    label="${y("pipeline.Finished")}">
                </mwc-tab>
              </mwc-tab-bar>
              <span class="flex"></span>
              <mwc-button outlined id="delete-pipeline" icon="delete"
                  label="${y("button.Delete")}" @click="${()=>this._openPipelineDeleteDialog()}">
              </mwc-button>
              <mwc-button outlined id="edit-pipeline" icon="edit"
                  label="${y("button.Edit")}" @click="${()=>this._openPipelineUpdateDialog()}">
              </mwc-button>
              <mwc-button dense raised id="add-pipeline" icon="add"
                  label="${y("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?m`
                          <span>Environment: ${this.pipelineConfig.environment}:${this.pipelineConfig.version}</span>
                        `:""}
                        ${this.pipelineConfig.scaling_group?m`
                          <span>Scaling group: ${this.pipelineConfig.scaling_group}</span>
                        `:""}
                        ${this.pipelineConfig.folder_host?m`
                          <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?m`
                        <mwc-list-item>No components.</mwc-list-item>
                      `:m`
                        <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="${y("button.Save")}"
              @click="${this._saveCode}"></mwc-button>
        </div>
      </backend-ai-dialog>

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