"+this.endline(e,t,n),t.state=r.InsideTag,v=e.children,d=0,p=v.length;d",m&&t.suppressPrettyCount--,g+=this.endline(e,t,n),t.state=r.None}else g+=">",t.state=r.InsideTag,t.suppressPrettyCount++,m=!0,g+=this.writeChildNode(c,t,n+1),t.suppressPrettyCount--,m=!1,t.state=r.CloseTag,g+=""+e.name+">"+this.endline(e,t,n);return this.closeNode(e,t,n),g},e.prototype.writeChildNode=function(e,t,r){switch(e.type){case i.CData:return this.cdata(e,t,r);case i.Comment:return this.comment(e,t,r);case i.Element:return this.element(e,t,r);case i.Raw:return this.raw(e,t,r);case i.Text:return this.text(e,t,r);case i.ProcessingInstruction:return this.processingInstruction(e,t,r);case i.Dummy:return"";case i.Declaration:return this.declaration(e,t,r);case i.DocType:return this.docType(e,t,r);case i.AttributeDeclaration:return this.dtdAttList(e,t,r);case i.ElementDeclaration:return this.dtdElement(e,t,r);case i.EntityDeclaration:return this.dtdEntity(e,t,r);case i.NotationDeclaration:return this.dtdNotation(e,t,r);default:throw new Error("Unknown XML node type: "+e.constructor.name)}},e.prototype.processingInstruction=function(e,t,i){var n;return this.openNode(e,t,i),t.state=r.OpenTag,n=this.indent(e,t,i)+"",t.state=r.InsideTag,n+=e.target,e.value&&(n+=" "+e.value),t.state=r.CloseTag,n+=t.spaceBeforeSlash+"?>",n+=this.endline(e,t,i),t.state=r.None,this.closeNode(e,t,i),n},e.prototype.raw=function(e,t,i){var n;return this.openNode(e,t,i),t.state=r.OpenTag,n=this.indent(e,t,i),t.state=r.InsideTag,n+=e.value,t.state=r.CloseTag,n+=this.endline(e,t,i),t.state=r.None,this.closeNode(e,t,i),n},e.prototype.text=function(e,t,i){var n;return this.openNode(e,t,i),t.state=r.OpenTag,n=this.indent(e,t,i),t.state=r.InsideTag,n+=e.value,t.state=r.CloseTag,n+=this.endline(e,t,i),t.state=r.None,this.closeNode(e,t,i),n},e.prototype.dtdAttList=function(e,t,i){var n;return this.openNode(e,t,i),t.state=r.OpenTag,n=this.indent(e,t,i)+""+this.endline(e,t,i),t.state=r.None,this.closeNode(e,t,i),n},e.prototype.dtdElement=function(e,t,i){var n;return this.openNode(e,t,i),t.state=r.OpenTag,n=this.indent(e,t,i)+""+this.endline(e,t,i),t.state=r.None,this.closeNode(e,t,i),n},e.prototype.dtdEntity=function(e,t,i){var n;return this.openNode(e,t,i),t.state=r.OpenTag,n=this.indent(e,t,i)+""+this.endline(e,t,i),t.state=r.None,this.closeNode(e,t,i),n},e.prototype.dtdNotation=function(e,t,i){var n;return this.openNode(e,t,i),t.state=r.OpenTag,n=this.indent(e,t,i)+""+this.endline(e,t,i),t.state=r.None,this.closeNode(e,t,i),n},e.prototype.openNode=function(e,t,i){},e.prototype.closeNode=function(e,t,i){},e.prototype.openAttribute=function(e,t,i){},e.prototype.closeAttribute=function(e,t,i){},e}()}).call(this)},{"./NodeType":498,"./Utility":499,"./WriterState":500,"./XMLCData":502,"./XMLComment":504,"./XMLDTDAttList":509,"./XMLDTDElement":510,"./XMLDTDEntity":511,"./XMLDTDNotation":512,"./XMLDeclaration":513,"./XMLDocType":514,"./XMLDummy":517,"./XMLElement":518,"./XMLProcessingInstruction":522,"./XMLRaw":523,"./XMLText":527}],529:[function(e,t,i){(function(){var i,r,n,s,o,a,l,c,u,d;d=e("./Utility"),c=d.assign,u=d.isFunction,n=e("./XMLDOMImplementation"),s=e("./XMLDocument"),o=e("./XMLDocumentCB"),l=e("./XMLStringWriter"),a=e("./XMLStreamWriter"),i=e("./NodeType"),r=e("./WriterState"),t.exports.create=function(e,t,i,r){var n,o;if(null==e)throw new Error("Root element needs a name.");return r=c({},t,i,r),n=new s(r),o=n.element(e),r.headless||(n.declaration(r),null==r.pubID&&null==r.sysID||n.dtd(r)),o},t.exports.begin=function(e,t,i){var r;return u(e)&&(r=[e,t],t=r[0],i=r[1],e={}),t?new o(e,t,i):new s(e)},t.exports.stringWriter=function(e){return new l(e)},t.exports.streamWriter=function(e,t){return new a(e,t)},t.exports.implementation=new n,t.exports.nodeType=i,t.exports.writerState=r}).call(this)},{"./NodeType":498,"./Utility":499,"./WriterState":500,"./XMLDOMImplementation":507,"./XMLDocument":515,"./XMLDocumentCB":516,"./XMLStreamWriter":524,"./XMLStringWriter":525}],530:[function(e,t,i){t.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var e={},t=0;tl?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var i=1732584193,r=-271733879,n=-1732584194,s=271733878,d=0;d>16)+(t>>16)+(i>>16);return r<<16|65535&i}function d(e,t){return e<>>32-t}t.exports=function(e){return r.hash(e,n,16)}},{"./helpers":532}],534:[function(e,t,i){"use strict";var r=e("./helpers");function n(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var i=Array(80),r=1732584193,n=-271733879,c=-1732584194,u=271733878,d=-1009589776,h=0;h>16)+(t>>16)+(i>>16);return r<<16|65535&i}function l(e,t){return e<>>32-t}t.exports=function(e){return r.hash(e,n,20,!0)}},{"./helpers":532}],535:[function(e,t,i){"use strict";var r=e("./helpers"),n=function(e,t){var i=(65535&e)+(65535&t),r=(e>>16)+(t>>16)+(i>>16);return r<<16|65535&i},s=function(e,t){return e>>>t|e<<32-t},o=function(e,t){return e>>>t},a=function(e,t,i){return e&t^~e&i},l=function(e,t,i){return e&t^e&i^t&i},c=function(e){return s(e,2)^s(e,13)^s(e,22)},u=function(e){return s(e,6)^s(e,11)^s(e,25)},d=function(e){return s(e,7)^s(e,18)^o(e,3)},h=function(e){return s(e,17)^s(e,19)^o(e,10)},p=function(e,t){var i,r,s,o,p,f,m,g,y,b,v=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),w=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),x=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var _=0;_e._pos){var s=r.substr(e._pos);if("x-user-defined"===e._charset){for(var o=new n(s.length),a=0;ae._pos&&(e.push(new n(new Uint8Array(c.result.slice(e._pos)))),e._pos=c.result.byteLength)},c.onload=function(){e.push(null)},c.readAsArrayBuffer(r);break}e._xhr.readyState===l.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this)}).call(this,e("_process"),"undefined"!==typeof t?t:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},e("buffer").Buffer)},{"./capability":540,_process:538,buffer:103,"core-js/modules/es.array-buffer.slice.js":309,"core-js/modules/es.array.iterator.js":316,"core-js/modules/es.array.slice.js":319,"core-js/modules/es.object.to-string.js":329,"core-js/modules/es.promise.js":333,"core-js/modules/es.regexp.exec.js":338,"core-js/modules/es.string.match.js":344,"core-js/modules/es.string.split.js":347,"core-js/modules/es.typed-array.copy-within.js":356,"core-js/modules/es.typed-array.every.js":357,"core-js/modules/es.typed-array.fill.js":358,"core-js/modules/es.typed-array.filter.js":359,"core-js/modules/es.typed-array.find-index.js":360,"core-js/modules/es.typed-array.find.js":361,"core-js/modules/es.typed-array.for-each.js":362,"core-js/modules/es.typed-array.includes.js":363,"core-js/modules/es.typed-array.index-of.js":364,"core-js/modules/es.typed-array.iterator.js":365,"core-js/modules/es.typed-array.join.js":366,"core-js/modules/es.typed-array.last-index-of.js":367,"core-js/modules/es.typed-array.map.js":368,"core-js/modules/es.typed-array.reduce-right.js":369,"core-js/modules/es.typed-array.reduce.js":370,"core-js/modules/es.typed-array.reverse.js":371,"core-js/modules/es.typed-array.set.js":372,"core-js/modules/es.typed-array.slice.js":373,"core-js/modules/es.typed-array.some.js":374,"core-js/modules/es.typed-array.sort.js":375,"core-js/modules/es.typed-array.subarray.js":376,"core-js/modules/es.typed-array.to-locale-string.js":377,"core-js/modules/es.typed-array.to-string.js":378,"core-js/modules/es.typed-array.uint8-array.js":379,"core-js/modules/web.dom-collections.for-each.js":380,inherits:407,"readable-stream":463}],543:[function(e,t,i){"use strict";var r=e("@babel/runtime/helpers/interopRequireDefault"),n=r(e("@babel/runtime/helpers/typeof"));e("core-js/modules/es.regexp.exec.js"),e("core-js/modules/es.string.search.js"),e("core-js/modules/es.array.concat.js"),e("core-js/modules/es.string.split.js"),e("core-js/modules/es.string.replace.js"),e("core-js/modules/es.array.join.js"),e("core-js/modules/es.string.trim.js"),e("core-js/modules/es.string.match.js"),e("core-js/modules/es.array.slice.js"),e("core-js/modules/es.object.keys.js"),e("core-js/modules/es.array.splice.js");var s=e("punycode"),o=e("./util");function a(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}i.parse=j,i.resolve=k,i.resolveObject=S,i.format=C,i.Url=a;var l=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],h=["{","}","|","\\","^","`"].concat(d),p=["'"].concat(h),f=["%","/","?",";","#"].concat(p),m=["/","?","#"],g=255,y=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=e("querystring");function j(e,t,i){if(e&&o.isObject(e)&&e instanceof a)return e;var r=new a;return r.parse(e,t,i),r}function C(e){return o.isString(e)&&(e=j(e)),e instanceof a?e.format():a.prototype.format.call(e)}function k(e,t){return j(e,!1,!0).resolve(t)}function S(e,t){return e?j(e,!1,!0).resolveObject(t):t}a.prototype.parse=function(e,t,i){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+(0,n.default)(e));var r=e.indexOf("?"),a=-1!==r&&r127?F+="x":F+=P[M];if(!F.match(y)){var B=I.slice(0,D),z=I.slice(D+1),U=P.match(b);U&&(B.push(U[1]),z.unshift(U[2])),z.length&&(h="/"+z.join(".")+h),this.hostname=B.join(".");break}}}this.hostname.length>g?this.hostname="":this.hostname=this.hostname.toLowerCase(),N||(this.hostname=s.toASCII(this.hostname));var q=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+q,this.href+=this.host,N&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!v[k])for(D=0,R=p.length;D0)&&i.host.split("@");k&&(i.auth=k.shift(),i.host=i.hostname=k.shift())}return i.search=e.search,i.query=e.query,o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!j.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var S=j.slice(-1)[0],T=(i.host||e.host||j.length>1)&&("."===S||".."===S)||""===S,E=0,O=j.length;O>=0;O--)S=j[O],"."===S?j.splice(O,1):".."===S?(j.splice(O,1),E++):E&&(j.splice(O,1),E--);if(!v&&!_)for(;E--;E)j.unshift("..");!v||""===j[0]||j[0]&&"/"===j[0].charAt(0)||j.unshift(""),T&&"/"!==j.join("/").substr(-1)&&j.push("");var D=""===j[0]||j[0]&&"/"===j[0].charAt(0);if(C){i.hostname=i.host=D?"":j.length?j.shift():"";k=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");k&&(i.auth=k.shift(),i.host=i.hostname=k.shift())}return v=v||i.host&&j.length,v&&!D&&j.unshift(""),j.length?i.pathname=j.join("/"):(i.pathname=null,i.path=null),o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},a.prototype.parseHost=function(){var e=this.host,t=c.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":544,"@babel/runtime/helpers/interopRequireDefault":86,"@babel/runtime/helpers/typeof":91,"core-js/modules/es.array.concat.js":310,"core-js/modules/es.array.join.js":317,"core-js/modules/es.array.slice.js":319,"core-js/modules/es.array.splice.js":321,"core-js/modules/es.object.keys.js":328,"core-js/modules/es.regexp.exec.js":338,"core-js/modules/es.string.match.js":344,"core-js/modules/es.string.replace.js":345,"core-js/modules/es.string.search.js":346,"core-js/modules/es.string.split.js":347,"core-js/modules/es.string.trim.js":349,punycode:443,querystring:451}],544:[function(e,t,i){"use strict";var r=e("@babel/runtime/helpers/interopRequireDefault"),n=r(e("@babel/runtime/helpers/typeof"));t.exports={isString:function(e){return"string"===typeof e},isObject:function(e){return"object"===(0,n.default)(e)&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{"@babel/runtime/helpers/interopRequireDefault":86,"@babel/runtime/helpers/typeof":91}],545:[function(e,t,i){"use strict";e("core-js/modules/es.number.constructor.js"),i.encodeURIComponent=function(e){try{return encodeURIComponent(e)}catch(t){return e}},i.escape=e("escape-html"),i.timestamp=function(e){if(e){var t=e;return"string"===typeof t&&(t=Number(t)),10===String(e).length&&(t*=1e3),new Date(t)}return Math.round(Date.now()/1e3)}},{"core-js/modules/es.number.constructor.js":324,"escape-html":385}],546:[function(e,t,i){(function(t,r){(function(){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),s=n(e("@babel/runtime/helpers/typeof"));e("core-js/modules/es.string.trim.js"),e("core-js/modules/es.object.to-string.js"),e("core-js/modules/es.promise.js"),e("core-js/modules/es.regexp.exec.js"),e("core-js/modules/es.function.name.js"),e("core-js/modules/es.array.concat.js");var o=e("util"),a=e("url"),l=e("http"),c=e("https"),u=e("debug")("urllib"),d=e("humanize-ms"),h=0,p=Math.pow(2,31)-10,f=/^https?:\/\//i;function m(e,t){return void 0===e?t:e}function g(e){return e?e.split(";")[0].trim().toLowerCase():""}function y(e,t){return function(i,r,n){if(i)return t(i);e({data:r,status:n.statusCode,headers:n.headers,res:n})}}i.TIMEOUTS=[d("300s"),d("300s")];var b=["json","text"];i.request=function(e,t,r){return 2===arguments.length&&"function"===typeof t&&(r=t,t=null),"function"===typeof r?i.requestWithCallback(e,t,r):new Promise((function(r,n){i.requestWithCallback(e,t,y(r,n))}))},i.requestWithCallback=function(e,n,y){if(!e||"string"!==typeof e&&"object"!==(0,s.default)(e)){var v=o.format("expect request url to be a string or a http request options, but got %j",e);throw new Error(v)}2===arguments.length&&"function"===typeof n&&(y=n,n=null),n=n||{},h>=p&&(h=0);var w=++h;n.requestUrls=n.requestUrls||[];var x={requestId:w,url:e,args:n,ctx:n.ctx};n.emitter&&n.emitter.emit("request",x),n.timeout=n.timeout||i.TIMEOUTS,n.maxRedirects=n.maxRedirects||10,n.streaming=n.streaming||n.customResponse;var _,j=Date.now();"string"===typeof e?(f.test(e)||(e="https://"+e),_=a.parse(e)):_=e;var C=(n.type||n.method||_.method||"GET").toUpperCase(),k=_.port||80,S=l,T=m(n.agent,i.agent),E=n.fixJSONCtlChars;"https:"===_.protocol&&(S=c,T=m(n.httpsAgent,i.httpsAgent),_.port||(k=443));var O={host:_.hostname||_.host||"localhost",path:_.path||"/",method:C,port:k,agent:T,headers:n.headers||{},lookup:n.lookup};Array.isArray(n.timeout)?O.requestTimeout=n.timeout[n.timeout.length-1]:"undefined"!==typeof n.timeout&&(O.requestTimeout=n.timeout);var D=n.auth||_.auth;D&&(O.auth=D);var A=n.content||n.data,N="GET"===C||"HEAD"===C||n.dataAsQueryString;if(!n.content&&A&&"string"!==typeof A&&!r.isBuffer(A))if(N)A=n.nestedQuerystring?qs.stringify(A):querystring.stringify(A);else{var I=O.headers["Content-Type"]||O.headers["content-type"];I||(I="json"===n.contentType?"application/json":"application/x-www-form-urlencoded",O.headers["Content-Type"]=I),A="application/json"===g(I)?JSON.stringify(A):n.nestedQuerystring?qs.stringify(A):querystring.stringify(A)}N&&A&&(O.path+=(_.query?"&":"?")+A,A=null);var R=0;if(A){var P=A.length;r.isBuffer(A)||(P=r.byteLength(A)),R=O.headers["Content-Length"]=P}"json"===n.dataType&&(O.headers.Accept="application/json"),"function"===typeof n.beforeRequest&&n.beforeRequest(O);var F=null,M=null,L=null,B=!1,z=!1,U=0,q=-1,V=!1,W="",H="",G=null;function $(){F&&(clearTimeout(F),F=null)}function X(){M&&(clearTimeout(M),M=null)}function K(i,r,s){if(X(),!y)return console.warn("[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!",Date(),w,t.pid,O.method,e),void(i&&console.warn("[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s",Date(),w,t.pid,i.name,i.message,i.stack));var o=y;y=null;var a={};s&&(q=s.statusCode,a=s.headers);var l=Date.now()-j;G&&(G.contentDownload=l),u("[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j",l,U,q,O.method,O.host,O.path,z,G);var c={status:q,statusCode:q,headers:a,size:U,aborted:V,rt:l,keepAliveSocket:z,data:r,requestUrls:n.requestUrls,timing:G,remoteAddress:W,remotePort:H};if(i){var d="";T&&"function"===typeof T.getCurrentStatus&&(d=", agent status: "+JSON.stringify(T.getCurrentStatus())),i.message+=", "+O.method+" "+e+" "+q+" (connected: "+B+", keepalive socket: "+z+d+")\nheaders: "+JSON.stringify(a),i.data=r,i.path=O.path,i.status=q,i.headers=a,i.res=c}o(i,r,n.streaming?s:c),n.emitter&&(x.url=e,x.socket=ee&&ee.connection,x.options=O,x.size=R,n.emitter.emit("response",{requestId:w,error:i,ctx:n.ctx,req:x,res:c}))}function Y(t){var r=null;if(n.followRedirect&&statuses.redirect[t.statusCode]){n._followRedirectCount=(n._followRedirectCount||0)+1;var s=t.headers.location;if(s){if(!(n._followRedirectCount>n.maxRedirects)){var o=n.formatRedirectUrl?n.formatRedirectUrl(e,s):a.resolve(e,s);u("Request#%d %s: `redirected` from %s to %s",w,O.path,e,o),X(),n.headers&&n.headers.Host&&f.test(s)&&(n.headers.Host=null);var l=y;return y=null,i.requestWithCallback(o,n,l),{redirect:!0,error:null}}r=new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+e),r.name="MaxRedirectError"}else r=new Error("Got statusCode "+t.statusCode+" but cannot resolve next location from headers"),r.name="FollowRedirectError"}return{redirect:!1,error:r}}function J(e,t,i){var r=e.headers["content-encoding"];return i(null,t,r)}n.timing&&(G={queuing:0,dnslookup:0,connected:0,requestSent:0,waiting:0,contentDownload:0}),n.gzip&&(O.headers["Accept-Encoding"]||O.headers["accept-encoding"]||(O.headers["Accept-Encoding"]="gzip"));var Q,Z,ee,te=n.writeStream;function ie(t){if(G&&(G.waiting=Date.now()-j),u("Request#%d %s `req response` event emit: status %d, headers: %j",w,e,t.statusCode,t.headers),n.streaming){var i=Y(t);return i.redirect?void t.resume():i.error?(t.resume(),K(i.error,null,t)):K(null,null,t)}if(t.on("close",(function(){u("Request#%d %s: `res close` event emit, total size %d",w,e,U)})),t.on("error",(function(){u("Request#%d %s: `res error` event emit, total size %d",w,e,U)})),t.on("aborted",(function(){V=!0,u("Request#%d %s: `res aborted` event emit, total size %d",w,e,U)})),te){var s=Y(t);return s.redirect?void t.resume():s.error?(t.resume(),te.end(),K(s.error,null,t)):(!1===n.consumeWriteStream?t.on("end",K.bind(null,null,null,t)):te.on("close",(function(){u("Request#%d %s: writeStream close event emitted",w,e),K(L||null,null,t)})),t.pipe(te))}var o=[];t.on("data",(function(t){u("Request#%d %s: `res data` event emit, size %d",w,e,t.length),U+=t.length,o.push(t)})),t.on("end",(function(){var i=r.concat(o,U);if(u("Request#%d %s: `res end` event emit, total size %d, _dumped: %s",w,e,U,t._dumped),L)return K(L,i,t);var s=Y(t);if(s.error)return K(s.error,i,t);s.redirect||J(t,i,(function(r,s,o){if(r)return K(r,i,t);if(!o&&b.indexOf(n.dataType)>=0){try{s=decodeBodyByCharset(s,t)}catch(l){return u("decodeBodyByCharset error: %s",l),K(null,s,t)}if("json"===n.dataType)if(0===U)s=null;else{var a=parseJSON(s,E);a.error?r=a.error:s=a.data}}V&&u("Request#%d %s: Remote socket was terminated before `response.end()` was called",w,e),K(r,s,t)}))}))}function re(){u("Connect timer ticking, timeout: %d",Q),F=setTimeout((function(){F=null,-1===q&&(q=-2);var t="Connect timeout for "+Q+"ms",i="ConnectionTimeoutError";ee.socket||(i="SocketAssignTimeoutError",t+=", working sockets is full"),L=new Error(t),L.name=i,L.requestId=w,u("ConnectTimeout: Request#%d %s %s: %s, connected: %s",w,e,L.name,t,B),se()}),Q)}function ne(){u("Response timer ticking, timeout: %d",Z),M=setTimeout((function(){M=null;var t="Response timeout for "+Z+"ms",i="ResponseTimeoutError";L=new Error(t),L.name=i,L.requestId=w,u("ResponseTimeout: Request#%d %s %s: %s, connected: %s",w,e,L.name,t,B),se()}),Z)}u("Request#%d %s %s with headers %j, options.path: %s",w,C,e,O.headers,O.path),n.requestUrls.push(e),Array.isArray(n.timeout)?(Q=d(n.timeout[0]),Z=d(n.timeout[1])):Q=Z=d(n.timeout),u("ConnectTimeout: %d, ResponseTimeout: %d",Q,Z),O.mode=n.mode?n.mode:"";try{ee=S.request(O,ie)}catch(oe){return K(oe)}function se(){u("Request#%d %s abort, connected: %s",w,e,B),ee.socket||(L.noSocket=!0,K(L)),ee.abort()}return"undefined"===typeof window?re():ee.on("requestTimeout",(function(){-1===q&&(q=-2);var e="Connect timeout for "+Q+"ms",t="ConnectionTimeoutError";L=new Error(e),L.name=t,L.requestId=w,se()})),G&&ee.on("finish",(function(){G.requestSent=Date.now()-j})),ee.once("socket",(function(t){G&&(G.queuing=Date.now()-j);var i=t.readyState;if("opening"===i)return t.once("lookup",(function(t,i,r){u("Request#%d %s lookup: %s, %s, %s",w,e,t,i,r),G&&(G.dnslookup=Date.now()-j),i&&(W=i)})),void t.once("connect",(function(){G&&(G.connected=Date.now()-j),$(),ne(),u("Request#%d %s new socket connected",w,e),B=!0,W||(W=t.remoteAddress),H=t.remotePort}));u("Request#%d %s reuse socket connected, readyState: %s",w,e,i),B=!0,z=!0,W||(W=t.remoteAddress),H=t.remotePort,$(),ne()})),ee.on("error",(function(t){"Error"!==t.name&&"TypeError"!==t.name||(t.name=B?"ResponseError":"RequestError"),t.message+=' (req "error")',u("Request#%d %s `req error` event emit, %s: %s",w,e,t.name,t.message),K(L||t)})),te&&te.once("error",(function(t){t.message+=' (writeStream "error")',L=t,u("Request#%d %s `writeStream error` event emit, %s: %s",w,e,t.name,t.message),se()})),n.stream?(n.stream.pipe(ee),n.stream.once("error",(function(t){t.message+=' (stream "error")',L=t,u("Request#%d %s `readStream error` event emit, %s: %s",w,e,t.name,t.message),se()}))):ee.end(A),ee.requestId=w,ee}}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{"@babel/runtime/helpers/interopRequireDefault":86,"@babel/runtime/helpers/typeof":91,_process:538,buffer:103,"core-js/modules/es.array.concat.js":310,"core-js/modules/es.function.name.js":322,"core-js/modules/es.object.to-string.js":329,"core-js/modules/es.promise.js":333,"core-js/modules/es.regexp.exec.js":338,"core-js/modules/es.string.trim.js":349,debug:536,http:539,https:398,"humanize-ms":399,url:543,util:489}]},{},[1])(1)}))})(window)},f3ea:function(e,t,i){},f522:function(e,t,i){"use strict";i.r(t);var r=function(){var e=this,t=e._self._c;return t("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],class:"1"==e.echartsType?"module_wrap box_border":"module_wrap module_wrap2 box_border",attrs:{"element-loading-text":"数据加载中","element-loading-spinner":"el-icon-loading","element-loading-background":"transparent"}},[t("div",{staticClass:"box_title box_title_radio"},[t("span",[e._v("事故省风险案件"+e._s("1"==e.echartsType?"":"占比")+"排行榜")]),"1"==e.echartsType?t("div",{staticClass:"radio_group"},[t("span",{staticStyle:{"margin-right":"10px"}},[t("el-radio-group",{attrs:{size:"mini"},on:{change:e.radioChange},model:{value:e.radio,callback:function(t){e.radio=t},expression:"radio"}},[t("el-radio-button",{attrs:{label:"数量"}}),t("el-radio-button",{attrs:{label:"金额"}})],1)],1),t("span",[t("el-radio-group",{attrs:{size:"mini"},on:{change:e.radioChange1},model:{value:e.radio1,callback:function(t){e.radio1=t},expression:"radio1"}},[t("el-radio-button",{attrs:{label:"全国"}}),t("el-radio-button",{attrs:{label:"前15"}})],1)],1)]):e._e()]),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.loading,expression:"!loading"}],staticStyle:{height:"100%"}},["1"==e.echartsType?t("div",{attrs:{id:"case_bar"}}):t("div",{attrs:{id:"case_bar2"}})])])},n=[],s=(i("f16c"),i("45d2"),i("8160"),i("ada4")),o={name:"ProvinceRisk",props:{isCollapse:{type:Boolean,default:!0},navForm:{type:Object,default:{}},echartsType:{type:String,default:""}},watch:{isCollapse(){setTimeout(()=>{this.myChart&&this.myChart.resize()},600)},navForm:{deep:!0,handler(e){this.getData()}}},data(){return{topDays:[],newNumber:0,myChart:null,yAxisData1:[],yAxisData2:[],sumSeriesData1:[],sumSeriesData2:[],numSeriesData1:[],numSeriesData2:[],option:"",radio:"数量",radio1:"前15",tmpCasesNumTopTen:null,loading:!0}},mounted(){this.role=localStorage.getItem("role"),window.addEventListener("resize",()=>{this.myChart&&this.myChart.resize()})},methods:{getData(){this.loading=!0;let e=null;switch(this.echartsType){case"1":e="/large/data/screen/getProvinceCasesNumTopTen";break;case"2":e="/large/data/screen/getProvinceCasesRatioTopTen";break;default:break}e&&this.instance({method:"post",url:e,data:this.navForm,headers:{"Content-Type":"application/json;charset=UTF-8"}}).then(e=>{if(this.loading=!1,1==e.data.code){let t=e.data.data;this.tmpCasesNumTopTen=t,1==this.echartsType?this.loadCharts(t):this.loadCharts2(t)}})},radioChange(){this.option&&("数量"==this.radio?(this.option.yAxis.data=this.yAxisData1,this.option.series[0].data=this.numSeriesData1,this.option.series[0].name="风险案件数量"):(this.option.yAxis.data=this.yAxisData2,this.option.series[0].data=this.sumSeriesData1,this.option.series[0].name="风险案件金额"),setTimeout(()=>{this.myChart.setOption(this.option)},100))},radioChange1(){let e=JSON.parse(JSON.stringify(this.numSeriesData1)),t=JSON.parse(JSON.stringify(this.sumSeriesData1)),i=JSON.parse(JSON.stringify(this.yAxisData1)),r=JSON.parse(JSON.stringify(this.yAxisData2));"前15"==this.radio1?"数量"==this.radio?(this.option.xAxis[0].data=i.slice(0,15),this.option.yAxis.data=i.slice(0,15),this.option.series[0].data=e.slice(0,15),this.option.series[0].name="风险案件数量"):(this.option.xAxis[0].data=i.slice(0,15),this.option.yAxis.data=r.slice(0,15),this.option.series[0].data=t.slice(0,15),this.option.series[0].name="风险案件金额"):"数量"==this.radio?(this.option.xAxis[0].data=i,this.option.yAxis.data=i,this.option.series[0].data=e,this.option.series[0].name="风险案件数量"):(this.option.xAxis[0].data=i,this.option.yAxis.data=r,this.option.series[0].data=t,this.option.series[0].name="风险案件金额"),setTimeout(()=>{this.myChart.setOption(this.option)},100)},loadCharts(e){let t=this;var i=document.getElementById("case_bar");i&&(this.myChart=s["init"](i,null,{renderer:"svg"}),this.yAxisData1=[],this.sumSeriesData1=[],this.sumSeriesData2=[],this.yAxisData2=[],this.numSeriesData1=[],this.numSeriesData2=[],e.caseRiskNum.forEach((e,t)=>{this.yAxisData1.push(e.name),this.numSeriesData1.push(e.caseNum),this.numSeriesData2.push(e.totalCaseNum)}),e.caseRiskMoney.forEach((e,t)=>{this.yAxisData2.push(e.name),this.sumSeriesData1.push(e.amountCaseFiled),this.sumSeriesData2.push(e.totalPayAmount)}),this.option={tooltip:{trigger:"axis",confine:!0,formatter(i){let r="",n="",s="";return"数量"==t.radio?(e.caseRiskNum.forEach((e,t)=>{i[0].name==e.name&&(r=e.name,n=e.caseNum,s=e.totalCaseNum)}),r+"风险案件数量:"+n+"总案件数量:"+s):(e.caseRiskMoney.forEach((e,t)=>{i[0].name==e.name&&(r=e.name,n=e.amountCaseFiled,s=e.totalPayAmount)}),r+"风险案件金额:"+n+"总案件金额:"+s)},axisPointer:{type:"shadow"}},grid:{left:"2%",right:"4%",top:"4%",bottom:"4%",containLabel:!0},xAxis:[{type:"category",axisTick:{alignWithLabel:!0},axisLabel:{showMaxLabel:!0,rotate:40,textStyle:{color:"#fff"},width:60,overflow:"truncate",ellipsis:"..."},data:this.yAxisData1}],yAxis:[{type:"value",splitLine:{show:!1},axisLabel:{showMaxLabel:!0,textStyle:{color:"#fff"}},data:this.yAxisData1}],series:[{name:"风险案件数量",type:"bar",itemStyle:{color:"1"==this.echartsType?new s["graphic"].LinearGradient(0,0,1,0,[{offset:0,color:"#FFFFFF"},{offset:1,color:"#ED86C7"}]):new s["graphic"].LinearGradient(0,0,1,0,[{offset:0,color:"#FFFFFF"},{offset:1,color:"#A574F3"}])},stack:"total",barMaxWidth:"40%",data:this.numSeriesData1}]},this.myChart.setOption(this.option),this.radioChange1())},loadCharts2(e){var t=document.getElementById("case_bar2");t&&(this.myChart=s["init"](t,null,{renderer:"svg"}),this.yAxisData1=[],this.sumSeriesData1=[],this.sumSeriesData2=[],this.yAxisData2=[],this.numSeriesData1=[],this.numSeriesData2=[],e.caseRiskNum.forEach((e,t)=>{this.yAxisData1.push(e.name),this.numSeriesData1.push(e.caseNumRatio),this.numSeriesData2.push(e.totalCaseNum)}),this.option={tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},grid:{left:"2%",right:"4%",top:"15%",bottom:"4%",containLabel:!0},xAxis:[{type:"category",axisTick:{alignWithLabel:!0},axisLabel:{showMaxLabel:!0,rotate:40,textStyle:{color:"#fff"},width:60,overflow:"truncate",ellipsis:"..."},data:this.yAxisData1}],yAxis:[{type:"value",splitLine:{show:!1},axisLabel:{showMaxLabel:!0,textStyle:{color:"#fff"}},data:this.yAxisData1}],series:[{name:"风险案件占比",type:"bar",itemStyle:{color:new s["graphic"].LinearGradient(0,0,1,0,[{offset:0,color:"#FFFFFF"},{offset:1,color:"#D473EC"}])},tooltip:{valueFormatter:function(e){return e+" %"}},stack:"total",barMaxWidth:"40%",data:this.numSeriesData1}]},this.myChart.setOption(this.option))}},updated(){this.myChart&&this.myChart.resize()}},a=o,l=(i("3ba8"),i("1805")),c=Object(l["a"])(a,r,n,!1,null,"f8ecae74",null);t["default"]=c.exports},f597:function(e,t,i){},f8ab:function(e,t,i){"use strict";i.r(t);var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"home"},[t("div",{staticClass:"main"},[t("div",{staticClass:"search_box"},[t("div",{staticClass:"search_input"},[t("el-input",{attrs:{placeholder:"请输入案件号",clearable:""},model:{value:e.search,callback:function(t){e.search=t},expression:"search"}}),e.isValid?t("el-button",{attrs:{type:"primary"},on:{click:e.getVehicleData}},[e._v("搜索")]):e._e()],1),e._m(0),e.isValid?e._e():t("div",{staticStyle:{"margin-top":"0.3rem"}},[t("div",{staticClass:"search_input"},[t("el-input",{attrs:{placeholder:"请输入VIN码",clearable:""},model:{value:e.vin,callback:function(t){e.vin=t},expression:"vin"}}),t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.getVehicleData(2)}}},[e._v("搜索")])],1),e._m(1)])]),e.tableData.length>0?t("div",{staticClass:"result_box"},[t("p",{staticClass:"small_title"},[e._v("查询结果")]),t("div",{staticClass:"brand_box"},[t("div",{staticClass:"brand_detail"},[t("p",[e._v(e._s(e.tableData[0].amBrandName+"-"+e.tableData[0].amSeriesName))]),t("ul",[t("li",[e._v("VIN年份:"+e._s(e.tableData[0].amVinYear))]),t("li",[e._v("一级分类:"+e._s(e.tableData[0].vehCateOneNames))]),t("li",[e._v("二级分类:"+e._s(e.tableData[0].vehCateTwoNames))]),t("li",[e._v("厂商类型:"+e._s(e.tableData[0].importFlag))]),t("li",[e._v("国别:"+e._s(e.tableData[0].countriesName))]),t("li",[e._v("变速箱:"+e._s(e.tableData[0].gearboxType))]),t("li",[e._v("排量:"+e._s(e.tableData[0].engineDesc))]),t("li",[e._v("驱动形式:"+e._s(e.tableData[0].drivenType))])])])]),t("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableData,size:"small","empty-text":"暂无数据"},on:{"row-click":e.clickRow}},[t("el-table-column",{attrs:{align:"center",prop:"amVehicleName",label:"销售车型名称"}}),t("el-table-column",{attrs:{align:"center",prop:"amBrandName",label:"品牌"}}),t("el-table-column",{attrs:{align:"center",prop:"amSeriesName",label:"车系"}}),t("el-table-column",{attrs:{align:"center",prop:"drivenType",label:"驱动形式"}}),t("el-table-column",{attrs:{align:"center",label:"厂家指导价"},scopedSlots:e._u([{key:"default",fn:function(i){return[t("div",[e._v(e._s(i.row.price)+"元")])]}}],null,!1,3084909748)})],1)],1):t("div",{staticClass:"empty_box"},[e._m(2),t("p",[e._v("请输入案件号")])])]),t("el-dialog",{attrs:{visible:e.modalVisible,"modal-append-to-body":!1,"close-on-click-modal":!1,"before-close":e.beforeClose,title:"请选择维修渠道",width:"5.4rem",center:"",top:"25vh"},on:{"update:visible":function(t){e.modalVisible=t}}},[t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.handleDialogBtn(1)}}},[e._v("修理厂维修")]),t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.handleDialogBtn(2)}}},[e._v("4S店维修")])],1)])],1)},n=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"demo_num"},[t("div",[t("img",{attrs:{src:i("8524")}})]),t("span",[e._v("示例案件号:812020080703202208051000193")])])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"demo_num"},[t("div",[t("img",{attrs:{src:i("8524")}})]),t("span",[e._v("示例VIN码:LGBH12E20HY420076")])])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"empty_img"},[t("img",{attrs:{src:i("d188")}})])}],s=(i("f16c"),{name:"carDamage",components:{},data(){return{caseNo:"",iframeSrc:"",isValid:!0,modalVisible:!1,checkedRow:{},tableData:[],jobNo:"",role:"",search:"",vin:""}},methods:{getVehicleData(e){return this.search?2!=e||this.vin?(this.tableData=[],void this.instance({method:"post",url:"/easyepc/analysisVinByCaseNo",data:{searchWord:this.search,jobNo:this.jobNo,role:this.role,vin:this.vin},headers:{}}).then(e=>{1==e.data.code?this.tableData=e.data.data:0==e.data.code?this.$message.error(e.data.message):2==e.data.code&&(this.$message.error(e.data.message),this.isValid=!1)})):(this.$message.error("抱歉,请输入VIN码!"),!1):(this.$message.error("抱歉,请输入案件号!"),!1)},clickRow(e){1==e.reportedOrNot&&this.$notify({title:"警告",message:"当前车辆已被报价",duration:0,type:"warning"}),this.modalVisible=!0,this.checkedRow=e},beforeClose(){this.modalVisible=!1,this.$notify.closeAll()},handleDialogBtn(e){this.modalVisible=!1,this.$notify.closeAll(),localStorage.setItem("vehicleDetail",JSON.stringify(this.checkedRow)),this.$router.push({path:"/calculatorTool/carDamageDetail",query:{vid:this.checkedRow.amVehicleId,caseNo:this.search,type:e,jobNo:this.jobNo}})}},mounted(){this.caseNo=this.$route.query.caseNo,this.caseNo&&(this.search=this.caseNo,this.getVehicleData());var e=localStorage.getItem("userInfo");e&&(e=JSON.parse(e),this.jobNo=e.jobNo,this.role=e.role);let t=this.$route.query.vid;t&&(this.search=t,this.getVehicleData())}}),o=s,a=(i("0a11"),i("1805")),l=Object(a["a"])(o,r,n,!1,null,"beb15554",null);t["default"]=l.exports},f9a0:function(e,t,i){"use strict";i("5b8b")},fa13:function(e,t,i){},fc27:function(e,t,i){e.exports=i.p+"img/wraning_icon.b1a63a56.png"},fd41:function(e,t,i){"use strict";i("0318")},fe11:function(e,t,i){"use strict";i.r(t);var r=function(){var e=this,t=e._self._c;return t("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"module_wrap box_border",attrs:{"element-loading-text":"数据加载中","element-loading-spinner":"el-icon-loading","element-loading-background":"transparent"}},[t("div",{staticClass:"box_title"},[e._v("公估公司接案量统计")]),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.loading,expression:"!loading"}],staticStyle:{height:"100%"}},[t("div",{attrs:{id:"rate_pie"}}),e.tableData.length>0?t("div",{staticClass:"tables_box"},[t("el-table",{attrs:{data:[e.tableData[0]],"max-height":"200"}},e._l(e.tableData,(function(i,r){return t("el-table-column",{key:r,attrs:{label:i.assessor,width:"全国"==e.province?"":"100"},scopedSlots:e._u([{key:"default",fn:function(r){return[e._e(),t("p",[e._v(e._s(i.assessorRatio?i.assessorRatio:"0")+" %")]),t("p",[e._v(e._s(i.assessorCaseNum?i.assessorCaseNum:"0")+" 件")])]}}],null,!0)})})),1)],1):e._e()])])},n=[],s=(i("f16c"),i("45d2"),i("8160"),i("ada4")),o={name:"CaseRate",props:{isCollapse:{type:Boolean,default:!0},navForm:{type:Object,default:{}}},watch:{isCollapse(){setTimeout(()=>{this.myChart&&this.myChart.resize()},600)},navForm:{deep:!0,handler(e){this.province=e.accidentProvince,this.getData()}}},data(){return{topDays:[],newNumber:0,myChart:"",tableData:[],loading:!0,province:""}},mounted(){this.role=localStorage.getItem("role"),this.getData(),window.addEventListener("resize",()=>{this.myChart&&setTimeout(()=>{this.myChart.resize()},500)})},methods:{getData(){this.loading=!0,this.instance({method:"post",url:"/large/data/screen/meituanAssessorCaseNum",data:this.navForm,headers:{"Content-Type":"application/json;charset=UTF-8"}}).then(e=>{if(this.loading=!1,1==e.data.code){let t=e.data.data;t.length>0&&this.loadCharts(t)}})},loadCharts(e){var t=document.getElementById("rate_pie");if(!t)return;this.myChart=s["init"](t,null,{renderer:"svg"});let i=[],r=[];e.forEach((e,t)=>{i.push(e.assessor),r.push(e.assessorRatio)}),this.tableData=e;var n={tooltip:{trigger:"axis",axisPointer:{type:"none"},formatter:function(t){let i=t[0].dataIndex;return t[0].name+"
接案率:"+t[0].value+"%
接案案件量:"+e[i].assessorCaseNum+"件"}},xAxis:{data:i,axisTick:{show:!1},axisLine:{show:!1},axisLabel:{color:"#fff",rotate:30}},yAxis:{splitLine:{show:!1},axisTick:{show:!1},axisLine:{show:!1},axisLabel:{show:!1}},grid:{top:"20",bottom:"0",left:"10",right:"10",containLabel:!0},color:["#5FB3D7"],series:[{name:"hill",type:"pictorialBar",barCategoryGap:"-40%",label:{position:"top",color:"#fff",formatter:"{c}%"},symbol:"path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z",itemStyle:{},barWidth:"80%",emphasis:{itemStyle:{opacity:1}},data:r,z:10}]};this.myChart.setOption(n)}},updated(){this.myChart&&this.myChart.resize()}},a=o,l=(i("b6ee"),i("1805")),c=Object(l["a"])(a,r,n,!1,null,"bfcf48ec",null);t["default"]=c.exports},ff74:function(e,t,i){"use strict";i.r(t);var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"content"},[t("el-radio-group",{staticClass:"map_tab",staticStyle:{"margin-bottom":"30px"},on:{change:e.tabsChange},model:{value:e.radio,callback:function(t){e.radio=t},expression:"radio"}},[t("el-radio-button",{attrs:{label:"1"}},[e._v("风险案件分布")]),t("el-radio-button",{attrs:{label:"2"}},[e._v("报案时效性分布")])],1),t("div",{attrs:{id:"container3",tabindex:"0"}})],1)},n=[],s=(i("f16c"),i("45d2"),i("8160"),i("9052"),i("ada4")),o=i("6032"),a={name:"ChinaMap3",props:{isCollapse:{type:Boolean,default:!0},navForm:{type:Object,default:{}}},watch:{isCollapse:{handler(e){e&&this.listenResize(),this.initChartsMap()},immediate:!0},navForm:{deep:!0,handler(e){this.getData()}}},data(){return{map:"",loca:"",chart:null,origin:"",checkedPoint:[],mapData:{},radio:"1",tabsActive:1,myChartMap:"",provinceCount:[],realTimeData:[],cityCount:[],nowVehicleData:{}}},mounted(){this,this.origin=window.location.origin,this.role=localStorage.getItem("role"),this.userInfo=JSON.parse(localStorage.getItem("userInfo")),window.addEventListener("resize",this.listenResize)},beforeDestroy(){window.removeEventListener("resize",this.listenResize)},methods:{listenResize(){this.myChartMap&&setTimeout(()=>{this.myChartMap.resize()},600)},linkVehicleMap(e){if(this.userInfo.batchId||0==this.role)return!1;let t=this.$router.resolve({path:"/VehicleMap",query:{deviceNumber:e.deviceNumber,startTime:e.tripStartTime,endTime:e.tripEndTime}});window.open(t.href,"_blank")},getLatestTrip(){this.realTimeData=[],this.instance.get("/homepage/getLatestTrip",{params:{companyId:this.userInfo.company}}).then(e=>{1==e.data.code&&this.initRouteData(e.data.data)})},getLatestTripByProvince(e){this.realTimeData=[],this.instance.get("/homepage/getLatestTripByProvince",{params:{companyId:this.userInfo.company,provinceName:e}}).then(e=>{1==e.data.code&&this.initRouteData(e.data.data)})},initRouteData(e){var t=e.length;if(t>0){for(var i=0;i{this.mapData=e.data.data;var t=[],i=[];this.mapData.cityDatas.length>0&&(this.mapData.cityDatas.forEach((e,i)=>{var r={name:e.cityName,parent:e.provinceName,value:e.caseNum,durationTime:e.durationTime,level:1,avgRiskValue:e.avgRiskValue,insuredNo:e.insuredNo,riskPointsNo:e.riskPointsNo};t.push(r)}),this.cityCount=t),this.mapData.provinceDatas.length>0&&(this.mapData.provinceDatas.forEach((e,t)=>{var r={name:e.cityName,parent:e.provinceName,value:e.caseNum,level:1,durationTime:e.durationTime,avgRiskValue:e.avgRiskValue,insuredNo:e.insuredNo,riskPointsNo:e.riskPointsNo};i.push(r)}),this.provinceCount=i),this.initChartsMap()})},createMap(e,t){var i=this;s["extendsMap"]=function(e,t){i.chart=s["init"](document.getElementById(e),null,{renderer:"svg"});var r={},n={mapName:"china",goDown:!1,bgColor:"#404a59",activeArea:[],data:[],callback:function(e,t,i){}};t&&(t=s["util"].extend(n,t));var a=[t.mapName],l=0,c={leftPlus:115,leftCur:150,left:198,top:240},u=[[0,0],[8,11],[0,22]],d={font:'18px "Microsoft YaHei", sans-serif',textColor:"#30FBFE",lineColor:"#30FBFE"},h={resetOption:function(e,i,r){var n=this.createBreadcrumb(r),s=a.indexOf(r),o=i.graphic.length;if(s<0){if(i.graphic.push(n),i.graphic[0].children[0].shape.x2=145,i.graphic[0].children[1].shape.x2=145,i.graphic.length>2){for(var u,d=[],p=0;pt.name==e.name);return-1!=s?"城市:"+n[s].name+"
案件数:"+n[s].value+"万件
案均时差:"+n[s].durationTime+"分":e.name}return 1==i.radio?"城市:"+e.data.name+"
案件数:"+e.data.num+"件":"城市:"+e.data.name+"
案均时差:"+e.data.durationTime+"天"}},label:{show:!0,color:"#fff"},itemStyle:{borderColor:"#2ff7fb",borderWidth:1,opacity:1,areaColor:{type:"radial",x:.5,y:.5,r:.8,colorStops:[{offset:0,color:"RGBA(0, 36, 109, 0.5)"},{offset:1,color:"RGBA(0, 36, 109, 0.7)"}],globalCoord:!1}},emphasis:{itemStyle:{areaColor:"rgba(0, 69, 109, 0.8)",borderWidth:0},label:{color:"#fff"}}},series:[{type:"effectScatter",coordinateSystem:"geo",showEffectOn:"emphasis",rippleEffect:{period:5,scale:2.5},itemStyle:{opacity:.9,color:"#E29550",shadowBlur:10,shadowColor:"#333"},symbolSize(e,i){var r=e[2],n=t.data[0].value,s=6;return s=r<.4*n?6:r<.7*n?8:10,s},zlevel:1,data:h.initSeriesData(t.data)}]};return i.chart.setOption(p),i.chart.on("click",(function(e){var n="china"==a[l]?"中国":a[l],c=this;if(t.goDown&&e.name!==n&&o["a"][e.name]){var u=o["a"][e.name];i.$axios.get(i.origin+"/"+u).then(t=>{r=t.data,s["registerMap"](e.name,r),h.resetOption(c,p,e.name)})}"中国"!=n&&h.resetOption(i.chart,p,"china")})),i.chart.setMap=function(e){var t=this;e.indexOf("市")<0&&(e+="市");var n=o["a"][e];if(n){var a=n;i.$axios.get(a).then(i=>{r=i.data,s["registerMap"](e,r),h.resetOption(t,p,e)})}},i.chart},i.myChartMap=s["extendsMap"](e,t)},initChartsMap(){var e=this;e.$axios.get("/map/data-china.json").then(t=>{s["registerMap"]("china",t.data),e.chart&&e.chart.dispose(),e.createMap("container3",{bgColor:"transparent",mapName:"china",goDown:!1,callback:function(e,t,i){},data:e.cityCount})})},appendScript(e){var t=document.createElement("script");t.charset="utf-8",t.src=e,document.head.appendChild(t)}}},l=a,c=(i("385f"),i("1805")),u=Object(c["a"])(l,r,n,!1,null,"78a29d92",null);t["default"]=u.exports},ffb0:function(e,t,i){(function(e){
/**
* vis-network
* https://visjs.github.io/vis-network/
*
* A dynamic, browser-based visualization library.
*
* @version 9.1.13
* @date 2025-06-28T12:44:34.651Z
*
* @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.
*/
!function(e,i){i(t)}(0,(function(t){"use strict";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n=function(e){return e&&e.Math===Math&&e},s=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i&&i)||function(){return this}()||i||Function("return this")(),o=function(e){try{return!!e()}catch(e){return!0}},a=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),l=a,c=Function.prototype,u=c.apply,d=c.call,h="object"==typeof Reflect&&Reflect.apply||(l?d.bind(u):function(){return d.apply(u,arguments)}),p=a,f=Function.prototype,m=f.call,g=p&&f.bind.bind(m,m),y=p?g:function(e){return function(){return m.apply(e,arguments)}},b=y,v=b({}.toString),w=b("".slice),x=function(e){return w(v(e),8,-1)},_=x,j=y,C=function(e){if("Function"===_(e))return j(e)},k="object"==typeof document&&document.all,S={all:k,IS_HTMLDDA:void 0===k&&void 0!==k},T=S.all,E=S.IS_HTMLDDA?function(e){return"function"==typeof e||e===T}:function(e){return"function"==typeof e},O={},D=!o((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),A=a,N=Function.prototype.call,I=A?N.bind(N):function(){return N.apply(N,arguments)},R={},P={}.propertyIsEnumerable,F=Object.getOwnPropertyDescriptor,M=F&&!P.call({1:2},1);R.f=M?function(e){var t=F(this,e);return!!t&&t.enumerable}:P;var L,B,z=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},U=o,q=x,V=Object,W=y("".split),H=U((function(){return!V("z").propertyIsEnumerable(0)}))?function(e){return"String"===q(e)?W(e,""):V(e)}:V,G=function(e){return null==e},$=G,X=TypeError,K=function(e){if($(e))throw new X("Can't call method on "+e);return e},Y=H,J=K,Q=function(e){return Y(J(e))},Z=E,ee=S.all,te=S.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Z(e)||e===ee}:function(e){return"object"==typeof e?null!==e:Z(e)},ie={},re=ie,ne=s,se=E,oe=function(e){return se(e)?e:void 0},ae=function(e,t){return arguments.length<2?oe(re[e])||oe(ne[e]):re[e]&&re[e][t]||ne[e]&&ne[e][t]},le=y({}.isPrototypeOf),ce="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ue=s,de=ce,he=ue.process,pe=ue.Deno,fe=he&&he.versions||pe&&pe.version,me=fe&&fe.v8;me&&(B=(L=me.split("."))[0]>0&&L[0]<4?1:+(L[0]+L[1])),!B&&de&&(!(L=de.match(/Edge\/(\d+)/))||L[1]>=74)&&(L=de.match(/Chrome\/(\d+)/))&&(B=+L[1]);var ge=B,ye=ge,be=o,ve=s.String,we=!!Object.getOwnPropertySymbols&&!be((function(){var e=Symbol("symbol detection");return!ve(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ye&&ye<41})),xe=we&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,_e=ae,je=E,Ce=le,ke=Object,Se=xe?function(e){return"symbol"==typeof e}:function(e){var t=_e("Symbol");return je(t)&&Ce(t.prototype,ke(e))},Te=String,Ee=function(e){try{return Te(e)}catch(e){return"Object"}},Oe=E,De=Ee,Ae=TypeError,Ne=function(e){if(Oe(e))return e;throw new Ae(De(e)+" is not a function")},Ie=Ne,Re=G,Pe=function(e,t){var i=e[t];return Re(i)?void 0:Ie(i)},Fe=I,Me=E,Le=te,Be=TypeError,ze={exports:{}},Ue=s,qe=Object.defineProperty,Ve=function(e,t){try{qe(Ue,e,{value:t,configurable:!0,writable:!0})}catch(r){Ue[e]=t}return t},We="__core-js_shared__",He=s[We]||Ve(We,{}),Ge=He;(ze.exports=function(e,t){return Ge[e]||(Ge[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var $e=ze.exports,Xe=K,Ke=Object,Ye=function(e){return Ke(Xe(e))},Je=Ye,Qe=y({}.hasOwnProperty),Ze=Object.hasOwn||function(e,t){return Qe(Je(e),t)},et=y,tt=0,it=Math.random(),rt=et(1..toString),nt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+rt(++tt+it,36)},st=$e,ot=Ze,at=nt,lt=we,ct=xe,ut=s.Symbol,dt=st("wks"),ht=ct?ut.for||ut:ut&&ut.withoutSetter||at,pt=function(e){return ot(dt,e)||(dt[e]=lt&&ot(ut,e)?ut[e]:ht("Symbol."+e)),dt[e]},ft=I,mt=te,gt=Se,yt=Pe,bt=function(e,t){var i,r;if("string"===t&&Me(i=e.toString)&&!Le(r=Fe(i,e)))return r;if(Me(i=e.valueOf)&&!Le(r=Fe(i,e)))return r;if("string"!==t&&Me(i=e.toString)&&!Le(r=Fe(i,e)))return r;throw new Be("Can't convert object to primitive value")},vt=TypeError,wt=pt("toPrimitive"),xt=function(e,t){if(!mt(e)||gt(e))return e;var i,r=yt(e,wt);if(r){if(void 0===t&&(t="default"),i=ft(r,e,t),!mt(i)||gt(i))return i;throw new vt("Can't convert object to primitive value")}return void 0===t&&(t="number"),bt(e,t)},_t=Se,jt=function(e){var t=xt(e,"string");return _t(t)?t:t+""},Ct=te,kt=s.document,St=Ct(kt)&&Ct(kt.createElement),Tt=function(e){return St?kt.createElement(e):{}},Et=Tt,Ot=!D&&!o((function(){return 7!==Object.defineProperty(Et("div"),"a",{get:function(){return 7}}).a})),Dt=D,At=I,Nt=R,It=z,Rt=Q,Pt=jt,Ft=Ze,Mt=Ot,Lt=Object.getOwnPropertyDescriptor;O.f=Dt?Lt:function(e,t){if(e=Rt(e),t=Pt(t),Mt)try{return Lt(e,t)}catch(e){}if(Ft(e,t))return It(!At(Nt.f,e,t),e[t])};var Bt=o,zt=E,Ut=/#|\.prototype\./,qt=function(e,t){var i=Wt[Vt(e)];return i===Gt||i!==Ht&&(zt(t)?Bt(t):!!t)},Vt=qt.normalize=function(e){return String(e).replace(Ut,".").toLowerCase()},Wt=qt.data={},Ht=qt.NATIVE="N",Gt=qt.POLYFILL="P",$t=qt,Xt=Ne,Kt=a,Yt=C(C.bind),Jt=function(e,t){return Xt(e),void 0===t?e:Kt?Yt(e,t):function(){return e.apply(t,arguments)}},Qt={},Zt=D&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ei=te,ti=String,ii=TypeError,ri=function(e){if(ei(e))return e;throw new ii(ti(e)+" is not an object")},ni=D,si=Ot,oi=Zt,ai=ri,li=jt,ci=TypeError,ui=Object.defineProperty,di=Object.getOwnPropertyDescriptor,hi="enumerable",pi="configurable",fi="writable";Qt.f=ni?oi?function(e,t,i){if(ai(e),t=li(t),ai(i),"function"==typeof e&&"prototype"===t&&"value"in i&&fi in i&&!i[fi]){var r=di(e,t);r&&r[fi]&&(e[t]=i.value,i={configurable:pi in i?i[pi]:r[pi],enumerable:hi in i?i[hi]:r[hi],writable:!1})}return ui(e,t,i)}:ui:function(e,t,i){if(ai(e),t=li(t),ai(i),si)try{return ui(e,t,i)}catch(e){}if("get"in i||"set"in i)throw new ci("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var mi=Qt,gi=z,yi=D?function(e,t,i){return mi.f(e,t,gi(1,i))}:function(e,t,i){return e[t]=i,e},bi=s,vi=h,wi=C,xi=E,_i=O.f,ji=$t,Ci=ie,ki=Jt,Si=yi,Ti=Ze,Ei=function(e){var t=function(i,r,n){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(i);case 2:return new e(i,r)}return new e(i,r,n)}return vi(e,this,arguments)};return t.prototype=e.prototype,t},Oi=function(e,t){var i,r,n,s,o,a,l,c,u,d=e.target,h=e.global,p=e.stat,f=e.proto,m=h?bi:p?bi[d]:(bi[d]||{}).prototype,g=h?Ci:Ci[d]||Si(Ci,d,{})[d],y=g.prototype;for(s in t)r=!(i=ji(h?s:d+(p?".":"#")+s,e.forced))&&m&&Ti(m,s),a=g[s],r&&(l=e.dontCallGetSet?(u=_i(m,s))&&u.value:m[s]),o=r&&l?l:t[s],r&&typeof a==typeof o||(c=e.bind&&r?ki(o,bi):e.wrap&&r?Ei(o):f&&xi(o)?wi(o):o,(e.sham||o&&o.sham||a&&a.sham)&&Si(c,"sham",!0),Si(g,s,c),f&&(Ti(Ci,n=d+"Prototype")||Si(Ci,n,{}),Si(Ci[n],s,o),e.real&&y&&(i||!y[s])&&Si(y,s,o)))},Di=Math.ceil,Ai=Math.floor,Ni=Math.trunc||function(e){var t=+e;return(t>0?Ai:Di)(t)},Ii=function(e){var t=+e;return t!=t||0===t?0:Ni(t)},Ri=Ii,Pi=Math.max,Fi=Math.min,Mi=function(e,t){var i=Ri(e);return i<0?Pi(i+t,0):Fi(i,t)},Li=Ii,Bi=Math.min,zi=function(e){return e>0?Bi(Li(e),9007199254740991):0},Ui=function(e){return zi(e.length)},qi=Q,Vi=Mi,Wi=Ui,Hi=function(e){return function(t,i,r){var n,s=qi(t),o=Wi(s),a=Vi(r,o);if(e&&i!=i){for(;o>a;)if((n=s[a++])!=n)return!0}else for(;o>a;a++)if((e||a in s)&&s[a]===i)return e||a||0;return!e&&-1}},Gi={includes:Hi(!0),indexOf:Hi(!1)},$i={},Xi=Ze,Ki=Q,Yi=Gi.indexOf,Ji=$i,Qi=y([].push),Zi=function(e,t){var i,r=Ki(e),n=0,s=[];for(i in r)!Xi(Ji,i)&&Xi(r,i)&&Qi(s,i);for(;t.length>n;)Xi(r,i=t[n++])&&(~Yi(s,i)||Qi(s,i));return s},er=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],tr=Zi,ir=er,rr=Object.keys||function(e){return tr(e,ir)},nr={};nr.f=Object.getOwnPropertySymbols;var sr=D,or=y,ar=I,lr=o,cr=rr,ur=nr,dr=R,hr=Ye,pr=H,fr=Object.assign,mr=Object.defineProperty,gr=or([].concat),yr=!fr||lr((function(){if(sr&&1!==fr({b:1},fr(mr({},"a",{enumerable:!0,get:function(){mr(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol("assign detection"),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!==fr({},e)[i]||cr(fr({},t)).join("")!==r}))?function(e,t){for(var i=hr(e),r=arguments.length,n=1,s=ur.f,o=dr.f;r>n;)for(var a,l=pr(arguments[n++]),c=s?gr(cr(l),s(l)):cr(l),u=c.length,d=0;u>d;)a=c[d++],sr&&!ar(o,l,a)||(i[a]=l[a]);return i}:fr,br=yr;Oi({target:"Object",stat:!0,arity:2,forced:Object.assign!==br},{assign:br});var vr=r(ie.Object.assign),wr=y([].slice),xr=y,_r=Ne,jr=te,Cr=Ze,kr=wr,Sr=a,Tr=Function,Er=xr([].concat),Or=xr([].join),Dr={},Ar=Sr?Tr.bind:function(e){var t=_r(this),i=t.prototype,r=kr(arguments,1),n=function(){var i=Er(r,kr(arguments));return this instanceof n?function(e,t,i){if(!Cr(Dr,t)){for(var r=[],n=0;n=.1;)f=+s[d++%o],f>u&&(f=u),p=Math.sqrt(f*f/(1+c*c)),p=a<0?-p:p,t+=p,i+=c*p,!0===h?e.lineTo(t,i):e.moveTo(t,i),u-=f,h=!h}const Gr={circle:Ur,dashedLine:Hr,database:Wr,diamond:function(e,t,i,r){e.beginPath(),e.lineTo(t,i+r),e.lineTo(t+r,i),e.lineTo(t,i-r),e.lineTo(t-r,i),e.closePath()},ellipse:Vr,ellipse_vis:Vr,hexagon:function(e,t,i,r){e.beginPath();const n=2*Math.PI/6;e.moveTo(t+r,i);for(let s=1;s<6;s++)e.lineTo(t+r*Math.cos(n*s),i+r*Math.sin(n*s));e.closePath()},roundRect:qr,square:function(e,t,i,r){e.beginPath(),e.rect(t-r,i-r,2*r,2*r),e.closePath()},star:function(e,t,i,r){e.beginPath(),i+=.1*(r*=.82);for(let n=0;n<10;n++){const s=n%2==0?1.3*r:.5*r;e.lineTo(t+s*Math.sin(2*n*Math.PI/10),i-s*Math.cos(2*n*Math.PI/10))}e.closePath()},triangle:function(e,t,i,r){e.beginPath(),i+=.275*(r*=1.15);const n=2*r,s=n/2,o=Math.sqrt(3)/6*n,a=Math.sqrt(n*n-s*s);e.moveTo(t,i-(a-o)),e.lineTo(t+s,i+o),e.lineTo(t-s,i+o),e.lineTo(t,i-(a-o)),e.closePath()},triangleDown:function(e,t,i,r){e.beginPath(),i-=.275*(r*=1.15);const n=2*r,s=n/2,o=Math.sqrt(3)/6*n,a=Math.sqrt(n*n-s*s);e.moveTo(t,i+(a-o)),e.lineTo(t+s,i-o),e.lineTo(t-s,i-o),e.lineTo(t,i+(a-o)),e.closePath()}};var $r={exports:{}};!function(e){function t(e){if(e)return function(e){for(var i in t.prototype)e[i]=t.prototype[i];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n=0;n9007199254740991)throw Jr("Maximum allowed index exceeded");return e},Zr=jt,en=Qt,tn=z,rn=function(e,t,i){var r=Zr(t);r in e?en.f(e,r,tn(0,i)):e[r]=i},nn={};nn[pt("toStringTag")]="z";var sn="[object z]"===String(nn),on=sn,an=E,ln=x,cn=pt("toStringTag"),un=Object,dn="Arguments"===ln(function(){return arguments}()),hn=on?ln:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=un(e),cn))?i:dn?ln(t):"Object"===(r=ln(t))&&an(t.callee)?"Arguments":r},pn=E,fn=He,mn=y(Function.toString);pn(fn.inspectSource)||(fn.inspectSource=function(e){return mn(e)});var gn=fn.inspectSource,yn=y,bn=o,vn=E,wn=hn,xn=gn,_n=function(){},jn=[],Cn=ae("Reflect","construct"),kn=/^\s*(?:class|function)\b/,Sn=yn(kn.exec),Tn=!kn.test(_n),En=function(e){if(!vn(e))return!1;try{return Cn(_n,jn,e),!0}catch(e){return!1}},On=function(e){if(!vn(e))return!1;switch(wn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Tn||!!Sn(kn,xn(e))}catch(e){return!0}};On.sham=!0;var Dn=!Cn||bn((function(){var e;return En(En.call)||!En(Object)||!En((function(){e=!0}))||e}))?On:En,An=Yr,Nn=Dn,In=te,Rn=pt("species"),Pn=Array,Fn=function(e){var t;return An(e)&&(t=e.constructor,(Nn(t)&&(t===Pn||An(t.prototype))||In(t)&&null===(t=t[Rn]))&&(t=void 0)),void 0===t?Pn:t},Mn=function(e,t){return new(Fn(e))(0===t?0:t)},Ln=o,Bn=ge,zn=pt("species"),Un=function(e){return Bn>=51||!Ln((function(){var t=[];return(t.constructor={})[zn]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},qn=Oi,Vn=o,Wn=Yr,Hn=te,Gn=Ye,$n=Ui,Xn=Qr,Kn=rn,Yn=Mn,Jn=Un,Qn=ge,Zn=pt("isConcatSpreadable"),es=Qn>=51||!Vn((function(){var e=[];return e[Zn]=!1,e.concat()[0]!==e})),ts=function(e){if(!Hn(e))return!1;var t=e[Zn];return void 0!==t?!!t:Wn(e)};qn({target:"Array",proto:!0,arity:1,forced:!es||!Jn("concat")},{concat:function(e){var t,i,r,n,s,o=Gn(this),a=Yn(o,0),l=0;for(t=-1,r=arguments.length;to;)ls.f(e,i=n[o++],r[i]);return e};var hs,ps=ae("document","documentElement"),fs=nt,ms=$e("keys"),gs=function(e){return ms[e]||(ms[e]=fs(e))},ys=ri,bs=ss,vs=er,ws=$i,xs=ps,_s=Tt,js="prototype",Cs="script",ks=gs("IE_PROTO"),Ss=function(){},Ts=function(e){return"<"+Cs+">"+e+""+Cs+">"},Es=function(e){e.write(Ts("")),e.close();var t=e.parentWindow.Object;return e=null,t},Os=function(){try{hs=new ActiveXObject("htmlfile")}catch(e){}var e,t,i;Os="undefined"!=typeof document?document.domain&&hs?Es(hs):(t=_s("iframe"),i="java"+Cs+":",t.style.display="none",xs.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Ts("document.F=Object")),e.close(),e.F):Es(hs);for(var r=vs.length;r--;)delete Os[js][vs[r]];return Os()};ws[ks]=!0;var Ds=Object.create||function(e,t){var i;return null!==e?(Ss[js]=ys(e),i=new Ss,Ss[js]=null,i[ks]=e):i=Os(),void 0===t?i:bs.f(i,t)},As={},Ns=Zi,Is=er.concat("length","prototype");As.f=Object.getOwnPropertyNames||function(e){return Ns(e,Is)};var Rs={},Ps=Mi,Fs=Ui,Ms=rn,Ls=Array,Bs=Math.max,zs=function(e,t,i){for(var r=Fs(e),n=Ps(t,r),s=Ps(void 0===i?r:i,r),o=Ls(Bs(s-n,0)),a=0;nb;b++)if((a||b in m)&&(p=g(h=m[b],b,f),e))if(t)w[b]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return b;case 2:Vo(w,h)}else switch(e){case 4:return!1;case 7:Vo(w,h)}return s?-1:r||n?n:w}},Ho={forEach:Wo(0),map:Wo(1),filter:Wo(2),some:Wo(3),every:Wo(4),find:Wo(5),findIndex:Wo(6),filterReject:Wo(7)},Go=Oi,$o=s,Xo=I,Ko=y,Yo=D,Jo=we,Qo=o,Zo=Ze,ea=le,ta=ri,ia=Q,ra=jt,na=ns,sa=z,oa=Ds,aa=rr,la=As,ca=Rs,ua=nr,da=O,ha=Qt,pa=ss,fa=R,ma=$s,ga=Ks,ya=$e,ba=$i,va=nt,wa=pt,xa=Ys,_a=so,ja=uo,Ca=wo,ka=Mo,Sa=Ho.forEach,Ta=gs("hidden"),Ea="Symbol",Oa="prototype",Da=ka.set,Aa=ka.getterFor(Ea),Na=Object[Oa],Ia=$o.Symbol,Ra=Ia&&Ia[Oa],Pa=$o.RangeError,Fa=$o.TypeError,Ma=$o.QObject,La=da.f,Ba=ha.f,za=ca.f,Ua=fa.f,qa=Ko([].push),Va=ya("symbols"),Wa=ya("op-symbols"),Ha=ya("wks"),Ga=!Ma||!Ma[Oa]||!Ma[Oa].findChild,$a=function(e,t,i){var r=La(Na,t);r&&delete Na[t],Ba(e,t,i),r&&e!==Na&&Ba(Na,t,r)},Xa=Yo&&Qo((function(){return 7!==oa(Ba({},"a",{get:function(){return Ba(this,"a",{value:7}).a}})).a}))?$a:Ba,Ka=function(e,t){var i=Va[e]=oa(Ra);return Da(i,{type:Ea,tag:e,description:t}),Yo||(i.description=t),i},Ya=function(e,t,i){e===Na&&Ya(Wa,t,i),ta(e);var r=ra(t);return ta(i),Zo(Va,r)?(i.enumerable?(Zo(e,Ta)&&e[Ta][r]&&(e[Ta][r]=!1),i=oa(i,{enumerable:sa(0,!1)})):(Zo(e,Ta)||Ba(e,Ta,sa(1,{})),e[Ta][r]=!0),Xa(e,r,i)):Ba(e,r,i)},Ja=function(e,t){ta(e);var i=ia(t),r=aa(i).concat(tl(i));return Sa(r,(function(t){Yo&&!Xo(Qa,i,t)||Ya(e,t,i[t])})),e},Qa=function(e){var t=ra(e),i=Xo(Ua,this,t);return!(this===Na&&Zo(Va,t)&&!Zo(Wa,t))&&(!(i||!Zo(this,t)||!Zo(Va,t)||Zo(this,Ta)&&this[Ta][t])||i)},Za=function(e,t){var i=ia(e),r=ra(t);if(i!==Na||!Zo(Va,r)||Zo(Wa,r)){var n=La(i,r);return!n||!Zo(Va,r)||Zo(i,Ta)&&i[Ta][r]||(n.enumerable=!0),n}},el=function(e){var t=za(ia(e)),i=[];return Sa(t,(function(e){Zo(Va,e)||Zo(ba,e)||qa(i,e)})),i},tl=function(e){var t=e===Na,i=za(t?Wa:ia(e)),r=[];return Sa(i,(function(e){!Zo(Va,e)||t&&!Zo(Na,e)||qa(r,Va[e])})),r};Jo||(Ia=function(){if(ea(Ra,this))throw new Fa("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?na(arguments[0]):void 0,t=va(e),i=function(e){this===Na&&Xo(i,Wa,e),Zo(this,Ta)&&Zo(this[Ta],t)&&(this[Ta][t]=!1);var r=sa(1,e);try{Xa(this,t,r)}catch(e){if(!(e instanceof Pa))throw e;$a(this,t,r)}};return Yo&&Ga&&Xa(Na,t,{configurable:!0,set:i}),Ka(t,e)},ma(Ra=Ia[Oa],"toString",(function(){return Aa(this).tag})),ma(Ia,"withoutSetter",(function(e){return Ka(va(e),e)})),fa.f=Qa,ha.f=Ya,pa.f=Ja,da.f=Za,la.f=ca.f=el,ua.f=tl,xa.f=function(e){return Ka(wa(e),e)},Yo&&ga(Ra,"description",{configurable:!0,get:function(){return Aa(this).description}})),Go({global:!0,constructor:!0,wrap:!0,forced:!Jo,sham:!Jo},{Symbol:Ia}),Sa(aa(Ha),(function(e){_a(e)})),Go({target:Ea,stat:!0,forced:!Jo},{useSetter:function(){Ga=!0},useSimple:function(){Ga=!1}}),Go({target:"Object",stat:!0,forced:!Jo,sham:!Yo},{create:function(e,t){return void 0===t?oa(e):Ja(oa(e),t)},defineProperty:Ya,defineProperties:Ja,getOwnPropertyDescriptor:Za}),Go({target:"Object",stat:!0,forced:!Jo},{getOwnPropertyNames:el}),ja(),Ca(Ia,Ea),ba[Ta]=!0;var il=we&&!!Symbol.for&&!!Symbol.keyFor,rl=Oi,nl=ae,sl=Ze,ol=ns,al=$e,ll=il,cl=al("string-to-symbol-registry"),ul=al("symbol-to-string-registry");rl({target:"Symbol",stat:!0,forced:!ll},{for:function(e){var t=ol(e);if(sl(cl,t))return cl[t];var i=nl("Symbol")(t);return cl[t]=i,ul[i]=t,i}});var dl=Oi,hl=Ze,pl=Se,fl=Ee,ml=il,gl=$e("symbol-to-string-registry");dl({target:"Symbol",stat:!0,forced:!ml},{keyFor:function(e){if(!pl(e))throw new TypeError(fl(e)+" is not a symbol");if(hl(gl,e))return gl[e]}});var yl=Yr,bl=E,vl=x,wl=ns,xl=y([].push),_l=Oi,jl=ae,Cl=h,kl=I,Sl=y,Tl=o,El=E,Ol=Se,Dl=wr,Al=function(e){if(bl(e))return e;if(yl(e)){for(var t=e.length,i=[],r=0;r=t.length)return e.target=void 0,iu(void 0,!0);switch(i){case"keys":return iu(r,!1);case"values":return iu(t[r],!1)}return iu([r,t[r]],!1)}),"values"),Zc.Arguments=Zc.Array;var ou={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},au=s,lu=hn,cu=yi,uu=ic,du=pt("toStringTag");for(var hu in ou){var pu=au[hu],fu=pu&&pu.prototype;fu&&lu(fu)!==du&&cu(fu,du,hu),uu[hu]=uu.Array}var mu=tc,gu=r(mu),yu=Oi,bu=Yr,vu=Dn,wu=te,xu=Mi,_u=Ui,ju=Q,Cu=rn,ku=pt,Su=wr,Tu=Un("slice"),Eu=ku("species"),Ou=Array,Du=Math.max;yu({target:"Array",proto:!0,forced:!Tu},{slice:function(e,t){var i,r,n,s=ju(this),o=_u(s),a=xu(e,o),l=xu(void 0===t?o:t,o);if(bu(s)&&(i=s.constructor,(vu(i)&&(i===Ou||bu(i.prototype))||wu(i)&&null===(i=i[Eu]))&&(i=void 0),i===Ou||void 0===i))return Su(s,a,l);for(r=new(void 0===i?Ou:i)(Du(l-a,0)),n=0;a1?arguments[1]:void 0)}});var Gu=Rr("Array").map,$u=le,Xu=Gu,Ku=Array.prototype,Yu=function(e){var t=e.map;return e===Ku||$u(Ku,e)&&t===Ku.map?Xu:t},Ju=r(Yu),Qu=Ye,Zu=rr;Oi({target:"Object",stat:!0,forced:o((function(){Zu(1)}))},{keys:function(e){return Zu(Qu(e))}});var ed=r(ie.Object.keys),td=Oi,id=Date,rd=y(id.prototype.getTime);td({target:"Date",stat:!0},{now:function(){return rd(new id)}});var nd=r(ie.Date.now),sd=o,od=function(e,t){var i=[][e];return!!i&&sd((function(){i.call(null,t||function(){return 1},1)}))},ad=Ho.forEach,ld=od("forEach")?[].forEach:function(e){return ad(this,e,arguments.length>1?arguments[1]:void 0)};Oi({target:"Array",proto:!0,forced:[].forEach!==ld},{forEach:ld});var cd=Rr("Array").forEach,ud=hn,dd=Ze,hd=le,pd=cd,fd=Array.prototype,md={DOMTokenList:!0,NodeList:!0},gd=function(e){var t=e.forEach;return e===fd||hd(fd,e)&&t===fd.forEach||dd(md,ud(e))?pd:t},yd=r(gd),bd=Oi,vd=Yr,wd=y([].reverse),xd=[1,2];bd({target:"Array",proto:!0,forced:String(xd)===String(xd.reverse())},{reverse:function(){return vd(this)&&(this.length=this.length),wd(this)}});var _d=Rr("Array").reverse,jd=le,Cd=_d,kd=Array.prototype,Sd=function(e){var t=e.reverse;return e===kd||jd(kd,e)&&t===kd.reverse?Cd:t},Td=r(Sd),Ed=D,Od=Yr,Dd=TypeError,Ad=Object.getOwnPropertyDescriptor,Nd=Ed&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}(),Id=Ee,Rd=TypeError,Pd=function(e,t){if(!delete e[t])throw new Rd("Cannot delete property "+Id(t)+" of "+Id(e))},Fd=Oi,Md=Ye,Ld=Mi,Bd=Ii,zd=Ui,Ud=Nd?function(e,t){if(Od(e)&&!Ad(e,"length").writable)throw new Dd("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},qd=Qr,Vd=Mn,Wd=rn,Hd=Pd,Gd=Un("splice"),$d=Math.max,Xd=Math.min;Fd({target:"Array",proto:!0,forced:!Gd},{splice:function(e,t){var i,r,n,s,o,a,l=Md(this),c=zd(l),u=Ld(e,c),d=arguments.length;for(0===d?i=r=0:1===d?(i=0,r=c-u):(i=d-2,r=Xd($d(Bd(t),0),c-u)),qd(c+i-r),n=Vd(l,r),s=0;sc-r+i;s--)Hd(l,s-1)}else if(i>r)for(s=c-r;s>u;s--)a=s+i-1,(o=s+r-1)in l?l[a]=l[o]:Hd(l,a);for(s=0;s1?arguments[1]:void 0)}});var ih=Rr("Array").includes,rh=te,nh=x,sh=pt("match"),oh=function(e){var t;return rh(e)&&(void 0!==(t=e[sh])?!!t:"RegExp"===nh(e))},ah=TypeError,lh=pt("match"),ch=Oi,uh=function(e){if(oh(e))throw new ah("The method doesn't accept regular expressions");return e},dh=K,hh=ns,ph=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[lh]=!1,"/./"[e](t)}catch(e){}}return!1},fh=y("".indexOf);ch({target:"String",proto:!0,forced:!ph("includes")},{includes:function(e){return!!~fh(hh(dh(this)),hh(uh(e)),arguments.length>1?arguments[1]:void 0)}});var mh=Rr("String").includes,gh=le,yh=ih,bh=mh,vh=Array.prototype,wh=String.prototype,xh=function(e){var t=e.includes;return e===vh||gh(vh,e)&&t===vh.includes?yh:"string"==typeof e||e===wh||gh(wh,e)&&t===wh.includes?bh:t},_h=r(xh),jh=Ye,Ch=yc,kh=cc;Oi({target:"Object",stat:!0,forced:o((function(){Ch(1)})),sham:!kh},{getPrototypeOf:function(e){return Ch(jh(e))}});var Sh=r(ie.Object.getPrototypeOf),Th=Rr("Array").concat,Eh=le,Oh=Th,Dh=Array.prototype,Ah=function(e){var t=e.concat;return e===Dh||Eh(Dh,e)&&t===Dh.concat?Oh:t},Nh=r(Ah),Ih=Ho.filter;Oi({target:"Array",proto:!0,forced:!Un("filter")},{filter:function(e){return Ih(this,e,arguments.length>1?arguments[1]:void 0)}});var Rh=Rr("Array").filter,Ph=le,Fh=Rh,Mh=Array.prototype,Lh=function(e){var t=e.filter;return e===Mh||Ph(Mh,e)&&t===Mh.filter?Fh:t},Bh=r(Lh),zh=D,Uh=o,qh=y,Vh=yc,Wh=rr,Hh=Q,Gh=qh(R.f),$h=qh([].push),Xh=zh&&Uh((function(){var e=Object.create(null);return e[2]=2,!Gh(e,2)})),Kh=function(e){return function(t){for(var i,r=Hh(t),n=Wh(r),s=Xh&&null===Vh(r),o=n.length,a=0,l=[];o>a;)i=n[a++],zh&&!(s?i in r:Gh(r,i))||$h(l,e?[i,r[i]]:r[i]);return l}},Yh={entries:Kh(!0),values:Kh(!1)},Jh=Yh.values;Oi({target:"Object",stat:!0},{values:function(e){return Jh(e)}});var Qh=r(ie.Object.values),Zh="\t\n\v\f\r \u2028\u2029\ufeff",ep=K,tp=ns,ip=Zh,rp=y("".replace),np=RegExp("^["+ip+"]+"),sp=RegExp("(^|[^"+ip+"])["+ip+"]+$"),op=function(e){return function(t){var i=tp(ep(t));return 1&e&&(i=rp(i,np,"")),2&e&&(i=rp(i,sp,"$1")),i}},ap={start:op(1),end:op(2),trim:op(3)},lp=s,cp=o,up=y,dp=ns,hp=ap.trim,pp=Zh,fp=lp.parseInt,mp=lp.Symbol,gp=mp&&mp.iterator,yp=/^[+-]?0x/i,bp=up(yp.exec),vp=8!==fp(pp+"08")||22!==fp(pp+"0x16")||gp&&!cp((function(){fp(Object(gp))}))?function(e,t){var i=hp(dp(e));return fp(i,t>>>0||(bp(yp,i)?16:10))}:fp;Oi({global:!0,forced:parseInt!==vp},{parseInt:vp});var wp=r(ie.parseInt),xp=Oi,_p=Gi.indexOf,jp=od,Cp=C([].indexOf),kp=!!Cp&&1/Cp([1],1,-0)<0;xp({target:"Array",proto:!0,forced:kp||!jp("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return kp?Cp(this,e,t)||0:_p(this,e,t)}});var Sp=Rr("Array").indexOf,Tp=le,Ep=Sp,Op=Array.prototype,Dp=function(e){var t=e.indexOf;return e===Op||Tp(Op,e)&&t===Op.indexOf?Ep:t},Ap=r(Dp),Np=Yh.entries;Oi({target:"Object",stat:!0},{entries:function(e){return Np(e)}});var Ip=r(ie.Object.entries);Oi({target:"Object",stat:!0,sham:!D},{create:Ds});var Rp=ie.Object,Pp=r((function(e,t){return Rp.create(e,t)})),Fp=ie,Mp=h;Fp.JSON||(Fp.JSON={stringify:JSON.stringify});var Lp=function(e,t,i){return Mp(Fp.JSON.stringify,null,arguments)},Bp=r(Lp),zp="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,Up=TypeError,qp=s,Vp=h,Wp=E,Hp=zp,Gp=ce,$p=wr,Xp=function(e,t){if(ei,o=Wp(r)?r:Kp(r),a=s?$p(arguments,i):[],l=s?function(){Vp(o,this,a)}:o;return t?e(l,n):e(l)}:e},Qp=Oi,Zp=s,ef=Jp(Zp.setInterval,!0);Qp({global:!0,bind:!0,forced:Zp.setInterval!==ef},{setInterval:ef});var tf=Oi,rf=s,nf=Jp(rf.setTimeout,!0);tf({global:!0,bind:!0,forced:rf.setTimeout!==nf},{setTimeout:nf});var sf=r(ie.setTimeout),of=Ye,af=Mi,lf=Ui,cf=function(e){for(var t=of(this),i=lf(t),r=arguments.length,n=af(r>1?arguments[1]:void 0,i),s=r>2?arguments[2]:void 0,o=void 0===s?i:af(s,i);o>n;)t[n++]=e;return t};Oi({target:"Array",proto:!0},{fill:cf});var uf,df=Rr("Array").fill,hf=le,pf=df,ff=Array.prototype,mf=function(e){var t=e.fill;return e===ff||hf(ff,e)&&t===ff.fill?pf:t},gf=r(mf);function yf(){return yf=Object.assign||function(e){for(var t=1;t-1}var sm=function(){function e(e,t){this.manager=e,this.set(t)}var t=e.prototype;return t.set=function(e){e===Df&&(e=this.compute()),Of&&this.manager.element.style&&Ff[e]&&(this.manager.element.style[Ef]=e),this.actions=e.toLowerCase().trim()},t.update=function(){this.set(this.manager.options.touchAction)},t.compute=function(){var e=[];return im(this.manager.recognizers,(function(t){rm(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(nm(e,If))return If;var t=nm(e,Rf),i=nm(e,Pf);return t&&i?If:t||i?t?Rf:Pf:nm(e,Nf)?Nf:Af}(e.join(" "))},t.preventDefaults=function(e){var t=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var r=this.actions,n=nm(r,If)&&!Ff[If],s=nm(r,Pf)&&!Ff[Pf],o=nm(r,Rf)&&!Ff[Rf];if(n){var a=1===e.pointers.length,l=e.distance<2,c=e.deltaTime<250;if(a&&l&&c)return}if(!o||!s)return n||s&&i&Jf||o&&i&Qf?this.preventSrc(t):void 0}},t.preventSrc=function(e){this.manager.session.prevented=!0,e.preventDefault()},e}();function om(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function am(e){var t=e.length;if(1===t)return{x:Cf(e[0].clientX),y:Cf(e[0].clientY)};for(var i=0,r=0,n=0;n=kf(t)?e<0?$f:Xf:t<0?Kf:Yf}function hm(e,t,i){return{x:t/e||0,y:i/e||0}}function pm(e,t){var i=e.session,r=t.pointers,n=r.length;i.firstInput||(i.firstInput=lm(t)),n>1&&!i.firstMultiple?i.firstMultiple=lm(t):1===n&&(i.firstMultiple=!1);var s=i.firstInput,o=i.firstMultiple,a=o?o.center:s.center,l=t.center=am(r);t.timeStamp=Sf(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=um(a,l),t.distance=cm(a,l),function(e,t){var i=t.center,r=e.offsetDelta||{},n=e.prevDelta||{},s=e.prevInput||{};t.eventType!==Vf&&s.eventType!==Wf||(n=e.prevDelta={x:s.deltaX||0,y:s.deltaY||0},r=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=n.x+(i.x-r.x),t.deltaY=n.y+(i.y-r.y)}(i,t),t.offsetDirection=dm(t.deltaX,t.deltaY);var c,u,d=hm(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=kf(d.x)>kf(d.y)?d.x:d.y,t.scale=o?(c=o.pointers,cm((u=r)[0],u[1],tm)/cm(c[0],c[1],tm)):1,t.rotation=o?function(e,t){return um(t[1],t[0],tm)+um(e[1],e[0],tm)}(o.pointers,r):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,function(e,t){var i,r,n,s,o=e.lastInterval||t,a=t.timeStamp-o.timeStamp;if(t.eventType!==Hf&&(a>qf||void 0===o.velocity)){var l=t.deltaX-o.deltaX,c=t.deltaY-o.deltaY,u=hm(a,l,c);r=u.x,n=u.y,i=kf(u.x)>kf(u.y)?u.x:u.y,s=dm(l,c),e.lastInterval=t}else i=o.velocity,r=o.velocityX,n=o.velocityY,s=o.direction;t.velocity=i,t.velocityX=r,t.velocityY=n,t.direction=s}(i,t);var h,p=e.element,f=t.srcEvent;om(h=f.composedPath?f.composedPath()[0]:f.path?f.path[0]:f.target,p)&&(p=h),t.target=p}function fm(e,t,i){var r=i.pointers.length,n=i.changedPointers.length,s=t&Vf&&r-n==0,o=t&(Wf|Hf)&&r-n==0;i.isFirst=!!s,i.isFinal=!!o,s&&(e.session={}),i.eventType=t,pm(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function mm(e){return e.trim().split(/\s+/g)}function gm(e,t,i){im(mm(t),(function(t){e.addEventListener(t,i,!1)}))}function ym(e,t,i){im(mm(t),(function(t){e.removeEventListener(t,i,!1)}))}function bm(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||window}var vm=function(){function e(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){rm(e.options.enable,[e])&&i.handler(t)},this.init()}var t=e.prototype;return t.handler=function(){},t.init=function(){this.evEl&&gm(this.element,this.evEl,this.domHandler),this.evTarget&&gm(this.target,this.evTarget,this.domHandler),this.evWin&&gm(bm(this.element),this.evWin,this.domHandler)},t.destroy=function(){this.evEl&&ym(this.element,this.evEl,this.domHandler),this.evTarget&&ym(this.target,this.evTarget,this.domHandler),this.evWin&&ym(bm(this.element),this.evWin,this.domHandler)},e}();function wm(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var r=0;ri[t]})):r.sort()),r}var Em={touchstart:Vf,touchmove:2,touchend:Wf,touchcancel:Hf},Om=function(e){function t(){var i;return t.prototype.evTarget="touchstart touchmove touchend touchcancel",(i=e.apply(this,arguments)||this).targetIds={},i}return bf(t,e),t.prototype.handler=function(e){var t=Em[e.type],i=Dm.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:zf,srcEvent:e})},t}(vm);function Dm(e,t){var i,r,n=Sm(e.touches),s=this.targetIds;if(t&(2|Vf)&&1===n.length)return s[n[0].identifier]=!0,[n,n];var o=Sm(e.changedTouches),a=[],l=this.target;if(r=n.filter((function(e){return om(e.target,l)})),t===Vf)for(i=0;i-1&&r.splice(e,1)}),Im)}}function Pm(e,t){e&Vf?(this.primaryTouch=t.changedPointers[0].identifier,Rm.call(this,t)):e&(Wf|Hf)&&Rm.call(this,t)}function Fm(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,r=0;r-1&&this.requireFail.splice(t,1),this},t.hasRequireFailures=function(){return this.requireFail.length>0},t.canRecognizeWith=function(e){return!!this.simultaneous[e.id]},t.emit=function(e){var t=this,i=this.state;function r(i){t.manager.emit(i,e)}i<8&&r(t.options.event+qm(i)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),i>=8&&r(t.options.event+qm(i))},t.tryEmit=function(e){if(this.canEmit())return this.emit(e);this.state=Bm},t.canEmit=function(){for(var e=0;et.threshold&&n&t.direction},i.attrTest=function(e){return Hm.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},i.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var i=Gm(t.direction);i&&(t.additionalEvent=this.options.event+i),e.prototype.emit.call(this,t)},t}(Hm),Xm=function(e){function t(t){return void 0===t&&(t={}),e.call(this,yf({event:"swipe",threshold:10,velocity:.3,direction:Jf|Qf,pointers:1},t))||this}bf(t,e);var i=t.prototype;return i.getTouchAction=function(){return $m.prototype.getTouchAction.call(this)},i.attrTest=function(t){var i,r=this.options.direction;return r&(Jf|Qf)?i=t.overallVelocity:r&Jf?i=t.overallVelocityX:r&Qf&&(i=t.overallVelocityY),e.prototype.attrTest.call(this,t)&&r&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers===this.options.pointers&&kf(i)>this.options.velocity&&t.eventType&Wf},i.emit=function(e){var t=Gm(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)},t}(Hm),Km=function(e){function t(t){return void 0===t&&(t={}),e.call(this,yf({event:"pinch",threshold:0,pointers:2},t))||this}bf(t,e);var i=t.prototype;return i.getTouchAction=function(){return[If]},i.attrTest=function(t){return e.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},i.emit=function(t){if(1!==t.scale){var i=t.scale<1?"in":"out";t.additionalEvent=this.options.event+i}e.prototype.emit.call(this,t)},t}(Hm),Ym=function(e){function t(t){return void 0===t&&(t={}),e.call(this,yf({event:"rotate",threshold:0,pointers:2},t))||this}bf(t,e);var i=t.prototype;return i.getTouchAction=function(){return[If]},i.attrTest=function(t){return e.prototype.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)},t}(Hm),Jm=function(e){function t(t){var i;return void 0===t&&(t={}),(i=e.call(this,yf({event:"press",pointers:1,time:251,threshold:9},t))||this)._timer=null,i._input=null,i}bf(t,e);var i=t.prototype;return i.getTouchAction=function(){return[Af]},i.process=function(e){var t=this,i=this.options,r=e.pointers.length===i.pointers,n=e.distancei.time;if(this._input=e,!n||!r||e.eventType&(Wf|Hf)&&!s)this.reset();else if(e.eventType&Vf)this.reset(),this._timer=setTimeout((function(){t.state=8,t.tryEmit()}),i.time);else if(e.eventType&Wf)return 8;return Bm},i.reset=function(){clearTimeout(this._timer)},i.emit=function(e){8===this.state&&(e&&e.eventType&Wf?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=Sf(),this.manager.emit(this.options.event,this._input)))},t}(Vm),Qm={domEvents:!1,touchAction:Df,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Zm=[[Ym,{enable:!1}],[Km,{enable:!1},["rotate"]],[Xm,{direction:Jf}],[$m,{direction:Jf},["swipe"]],[Wm],[Wm,{event:"doubletap",taps:2},["tap"]],[Jm]];function eg(e,t){var i,r=e.element;r.style&&(im(e.options.cssProps,(function(n,s){i=Tf(r.style,s),t?(e.oldCssProps[i]=r.style[i],r.style[i]=n):r.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}var tg=function(){function e(e,t){var i,r=this;this.options=xf({},Qm,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((i=this).options.inputClass||(Lf?km:Bf?Om:Mf?Mm:Nm))(i,fm),this.touchAction=new sm(this,this.options.touchAction),eg(this,!0),im(this.options.recognizers,(function(e){var t=r.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}var t=e.prototype;return t.set=function(e){return xf(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},t.stop=function(e){this.session.stopped=e?2:1},t.recognize=function(e){var t=this.session;if(!t.stopped){var i;this.touchAction.preventDefaults(e);var r=this.recognizers,n=t.curRecognizer;(!n||n&&8&n.state)&&(t.curRecognizer=null,n=null);for(var s=0;s\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=window.console&&(window.console.warn||window.console.log);return n&&n.call(window.console,r,i),e.apply(this,arguments)}}var og=sg((function(e,t,i){for(var r=Object.keys(t),n=0;n1?t-1:0),r=1;r2)return mg(fg(t[0],t[1]),...Fu(t).call(t,2));const r=t[0],n=t[1];if(r instanceof Date&&n instanceof Date)return r.setTime(n.getTime()),r;for(const s of Vu(n))Object.prototype.propertyIsEnumerable.call(n,s)&&(n[s]===hg?delete r[s]:null===r[s]||null===n[s]||"object"!=typeof r[s]||"object"!=typeof n[s]||Wu(r[s])||Wu(n[s])?r[s]=gg(n[s]):r[s]=mg(r[s],n[s]));return r}function gg(e){return Wu(e)?Ju(e).call(e,e=>gg(e)):"object"==typeof e&&null!==e?e instanceof Date?new Date(e.getTime()):mg({},e):e}function yg(e){for(const t of ed(e))e[t]===hg?delete e[t]:"object"==typeof e[t]&&null!==e[t]&&yg(e[t])}function bg(){for(var e=arguments.length,t=new Array(e),i=0;i>>0,t-=e,t*=e,e=t>>>0,t-=e,e+=4294967296*t}return 2.3283064365386963e-10*(e>>>0)}}();let t=e(" "),i=e(" "),r=e(" ");for(let n=0;n{const e=2091639*t+2.3283064365386963e-10*n;return t=i,i=r,r=e-(n=0|e)};return s.uint32=()=>4294967296*s(),s.fract53=()=>s()+11102230246251565e-32*(2097152*s()|0),s.algorithm="Alea",s.seed=e,s.version="0.9",s}(t.length?t:[nd()])}const vg="undefined"!=typeof window?window.Hammer||dg:function(){return function(){const e=()=>{};return{on:e,off:e,destroy:e,emit:e,get:()=>({set:e})}}()};function wg(e){var t;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(()=>{this._dom.overlay.parentNode.removeChild(this._dom.overlay)});const i=vg(this._dom.overlay);i.on("tap",zr(t=this._onTapOverlay).call(t,this)),this._cleanupQueue.push(()=>{i.destroy()});const r=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];yd(r).call(r,e=>{i.on(e,e=>{e.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=t=>{(function(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1})(t.target,e)||this.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(()=>{document.body.removeEventListener("click",this._onClick)})),this._escListener=e=>{("key"in e?"Escape"===e.key:27===e.keyCode)&&this.deactivate()}}Xr(wg.prototype),wg.current=null,wg.prototype.destroy=function(){this.deactivate();for(const i of Td(e=eh(t=this._cleanupQueue).call(t,0)).call(e)){var e,t;i()}},wg.prototype.activate=function(){wg.current&&wg.current.deactivate(),wg.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)},wg.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")},wg.prototype._onTapOverlay=function(e){this.activate(),e.srcEvent.stopPropagation()};const xg=/^\/?Date\((-?\d+)/i,_g=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,jg=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Cg=/^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,kg=/^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 Sg(e){return e instanceof Number||"number"==typeof e}function Tg(e){if(e)for(;!0===e.hasChildNodes();){const t=e.firstChild;t&&(Tg(t),e.removeChild(t))}}function Eg(e){return e instanceof String||"string"==typeof e}function Og(e){return"object"==typeof e&&null!==e}function Dg(e,t,i,r){let n=!1;!0===r&&(n=null===t[i]&&void 0!==e[i]),n?delete e[i]:e[i]=t[i]}function Ag(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(const r in e)if(void 0!==t[r])if(null===t[r]||"object"!=typeof t[r])Dg(e,t,r,i);else{const n=e[r],s=t[r];Og(n)&&Og(s)&&Ag(n,s,i)}}const Ng=vr;function Ig(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(Wu(i))throw new TypeError("Arrays are not supported by deepExtend");for(let n=0;n3&&void 0!==arguments[3]&&arguments[3];if(Wu(i))throw new TypeError("Arrays are not supported by deepExtend");for(const n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&!_h(e).call(e,n))if(i[n]&&i[n].constructor===Object)void 0===t[n]&&(t[n]={}),t[n].constructor===Object?Pg(t[n],i[n]):Dg(t,i,n,r);else if(Wu(i[n])){t[n]=[];for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)||!0===i)if("object"==typeof t[s]&&null!==t[s]&&Sh(t[s])===Object.prototype)void 0===e[s]?e[s]=Pg({},t[s],i):"object"==typeof e[s]&&null!==e[s]&&Sh(e[s])===Object.prototype?Pg(e[s],t[s],i):Dg(e,t,s,r);else if(Wu(t[s])){var n;e[s]=Fu(n=t[s]).call(n)}else Dg(e,t,s,r);return e}function Fg(e,t){return[...e,t]}function Mg(e){return Fu(e).call(e)}function Lg(e){return e.getBoundingClientRect().left}function Bg(e){return e.getBoundingClientRect().top}function zg(e,t){if(Wu(e)){const i=e.length;for(let r=0;r("function"==typeof e&&(e=e()),null!=e?0!=e:t||null),asNumber:(e,t)=>("function"==typeof e&&(e=e()),null!=e?Number(e)||t||null:t||null),asString:(e,t)=>("function"==typeof e&&(e=e()),null!=e?String(e):t||null),asSize:(e,t)=>("function"==typeof e&&(e=e()),Eg(e)?e:Sg(e)?e+"px":t||null),asElement:(e,t)=>("function"==typeof e&&(e=e()),e||t||null)};function Vg(e){let t;switch(e.length){case 3:case 4:return t=jg.exec(e),t?{r:wp(t[1]+t[1],16),g:wp(t[2]+t[2],16),b:wp(t[3]+t[3],16)}:null;case 6:case 7:return t=_g.exec(e),t?{r:wp(t[1],16),g:wp(t[2],16),b:wp(t[3],16)}:null;default:return null}}function Wg(e,t){if(_h(e).call(e,"rgba"))return e;if(_h(e).call(e,"rgb")){const i=e.substr(Ap(e).call(e,"(")+1).replace(")","").split(",");return"rgba("+i[0]+","+i[1]+","+i[2]+","+t+")"}{const i=Vg(e);return null==i?e:"rgba("+i.r+","+i.g+","+i.b+","+t+")"}}function Hg(e,t,i){var r;return"#"+Fu(r=((1<<24)+(e<<16)+(t<<8)+i).toString(16)).call(r,1)}function Gg(e,t){if(Eg(e)){let t=e;if(Zg(t)){var i;const e=Ju(i=t.substr(4).substr(0,t.length-5).split(",")).call(i,(function(e){return wp(e)}));t=Hg(e[0],e[1],e[2])}if(!0===Qg(t)){const e=Jg(t),i={h:e.h,s:.8*e.s,v:Math.min(1,1.02*e.v)},r={h:e.h,s:Math.min(1,1.25*e.s),v:.8*e.v},n=Yg(r.h,r.s,r.v),s=Yg(i.h,i.s,i.v);return{background:t,border:n,highlight:{background:s,border:n},hover:{background:s,border:n}}}return{background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}return t?{background:e.background||t.background,border:e.border||t.border,highlight:Eg(e.highlight)?{border:e.highlight,background:e.highlight}:{background:e.highlight&&e.highlight.background||t.highlight.background,border:e.highlight&&e.highlight.border||t.highlight.border},hover:Eg(e.hover)?{border:e.hover,background:e.hover}:{border:e.hover&&e.hover.border||t.hover.border,background:e.hover&&e.hover.background||t.hover.background}}:{background:e.background||void 0,border:e.border||void 0,highlight:Eg(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:Eg(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 $g(e,t,i){e/=255,t/=255,i/=255;const r=Math.min(e,Math.min(t,i)),n=Math.max(e,Math.max(t,i));return r===n?{h:0,s:0,v:r}:{h:60*((e===r?3:i===r?1:5)-(e===r?t-i:i===r?e-t:i-e)/(n-r))/360,s:(n-r)/n,v:n}}function Xg(e){const t=document.createElement("div"),i={};t.style.cssText=e;for(let r=0;r3&&void 0!==arguments[3]?arguments[3]:{};const n=function(e){return null!=e},s=function(e){return null!==e&&"object"==typeof e};if(!s(e))throw new Error("Parameter mergeTarget must be an object");if(!s(t))throw new Error("Parameter options must be an object");if(!n(i))throw new Error("Parameter option must have a value");if(!s(r))throw new Error("Parameter globalOptions must be an object");const o=t[i],a=s(r)&&!function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(r)?r[i]:void 0,l=a?a.enabled:void 0;if(void 0===o)return;if("boolean"==typeof o)return s(e[i])||(e[i]={}),void(e[i].enabled=o);if(null===o&&!s(e[i])){if(!n(a))return;e[i]=Pp(a)}if(!s(o))return;let c=!0;void 0!==o.enabled?c=o.enabled:void 0!==l&&(c=a.enabled),function(e,t,i){s(e[i])||(e[i]={});const r=t[i],n=e[i];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])}(e,t,i),e[i].enabled=c}const ry={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};function ny(e,t){let i;Wu(t)||(t=[t]);for(const r of e)if(r){i=r[t[0]];for(let e=1;e0&&void 0!==arguments[0]?arguments[0]:1;this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=()=>{},this.closeCallback=()=>{},this._create()}insertTo(e){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}setUpdateCallback(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=e}setCloseCallback(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=e}_isColorString(e){if("string"==typeof e)return sy[e]}setColor(e){let t,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"===e)return;const r=this._isColorString(e);if(void 0!==r&&(e=r),!0===Eg(e)){if(!0===Zg(e)){const 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===ey(e)){const i=e.substr(5).substr(0,e.length-6).split(",");t={r:i[0],g:i[1],b:i[2],a:i[3]}}else if(!0===Qg(e)){const i=Vg(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){const i=void 0!==e.a?e.a:"1.0";t={r:e.r,g:e.g,b:e.b,a:i}}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: "+Bp(e));this._setColor(t,i)}show(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}_hide(){!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.previousColor=vr({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",sf(()=>{void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0)},0)}_save(){this.updateCallback(this.color),this.applied=!1,this._hide()}_apply(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}_loadLast(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}_setColor(e){!0===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(this.initialColor=vr({},e)),this.color=e;const t=$g(e.r,e.g,e.b),i=2*Math.PI,r=this.r*t.s,n=this.centerCoordinates.x+r*Math.sin(i*t.h),s=this.centerCoordinates.y+r*Math.cos(i*t.h);this.colorPickerSelector.style.left=n-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=s-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}_setOpacity(e){this.color.a=e/100,this._updatePicker(this.color)}_setBrightness(e){const t=$g(this.color.r,this.color.g,this.color.b);t.v=e/100;const i=Kg(t.h,t.s,t.v);i.a=this.color.a,this.color=i,this._updatePicker()}_updatePicker(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color;const t=$g(e.r,e.g,e.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);const r=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,r,n),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-t.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),gf(i).call(i),this.brightnessRange.value=100*t.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+")"}_setSize(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}_create(){var e,t,i,r;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){const e=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{const 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.colorPickerCanvas.appendChild(e)}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);const n=this;this.opacityRange.onchange=function(){n._setOpacity(this.value)},this.opacityRange.oninput=function(){n._setOpacity(this.value)},this.brightnessRange.onchange=function(){n._setBrightness(this.value)},this.brightnessRange.oninput=function(){n._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=zr(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=zr(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=zr(i=this._save).call(i,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=zr(r=this._loadLast).call(r,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)}_bindHammer(){this.drag={},this.pinch={},this.hammer=new vg(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",e=>{e.isFirst&&this._moveSelector(e)}),this.hammer.on("tap",e=>{this._moveSelector(e)}),this.hammer.on("panstart",e=>{this._moveSelector(e)}),this.hammer.on("panmove",e=>{this._moveSelector(e)}),this.hammer.on("panend",e=>{this._moveSelector(e)})}_generateHueCircle(){if(!1===this.generated){const 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);const t=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;let r,n,s,o;e.clearRect(0,0,t,i),this.centerCoordinates={x:.5*t,y:.5*i},this.r=.49*t;const a=2*Math.PI/360,l=1/360,c=1/this.r;let u;for(s=0;s<360;s++)for(o=0;o3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:()=>!1;this.parent=e,this.changedOptions=[],this.container=t,this.allowCreation=!1,this.hideOption=n,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},vr(this.options,this.defaultOptions),this.configureOptions=i,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new oy(r),this.wrapper=void 0}setOptions(e){if(void 0!==e){this.popupHistory={},this._removePopup();let t=!0;if("string"==typeof e)this.options.filter=e;else if(Wu(e))this.options.filter=e.join();else if("object"==typeof e){if(null==e)throw new TypeError("options cannot be null");void 0!==e.container&&(this.options.container=e.container),void 0!==Bh(e)&&(this.options.filter=Bh(e)),void 0!==e.showButton&&(this.options.showButton=e.showButton),void 0!==e.enabled&&(t=e.enabled)}else"boolean"==typeof e?(this.options.filter=!0,t=e):"function"==typeof e&&(this.options.filter=e,t=!0);!1===Bh(this.options)&&(t=!1),this.options.enabled=t}this._clean()}setModuleOptions(e){this.moduleOptions=e,!0===this.options.enabled&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}_create(){this._clean(),this.changedOptions=[];const e=Bh(this.options);let t=0,i=!1;for(const r in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,r)&&(this.allowCreation=!1,i=!1,"function"==typeof e?(i=e(r,[]),i=i||this._handleObject(this.configureOptions[r],[r],!0)):!0!==e&&-1===Ap(e).call(e,r)||(i=!0),!1!==i&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(r),this._handleObject(this.configureOptions[r],[r])),t++);this._makeButton(),this._push()}_push(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(let e=0;e1?t-1:0),r=1;r{n.appendChild(e)}),this.domElements.push(n),this.domElements.length}return 0}_makeHeader(e){const t=document.createElement("div");t.className="vis-configuration vis-config-header",t.innerText=e,this._makeItem([],t)}_makeLabel(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=document.createElement("div");if(r.className="vis-configuration vis-config-label vis-config-s"+t.length,!0===i){for(;r.firstChild;)r.removeChild(r.firstChild);r.appendChild(ay("i","b",e))}else r.innerText=e+":";return r}_makeDropdown(e,t,i){const r=document.createElement("select");r.className="vis-configuration vis-config-select";let n=0;void 0!==t&&-1!==Ap(e).call(e,t)&&(n=Ap(e).call(e,t));for(let a=0;as&&1!==s&&(a.max=Math.ceil(t*e),c=a.max,l="range increased"),a.value=t}else a.value=r;const u=document.createElement("input");u.className="vis-configuration vis-config-rangeinput",u.value=a.value;const d=this;a.onchange=function(){u.value=this.value,d._update(Number(this.value),i)},a.oninput=function(){u.value=this.value};const h=this._makeLabel(i[i.length-1],i),p=this._makeItem(i,h,a,u);""!==l&&this.popupHistory[p]!==c&&(this.popupHistory[p]=c,this._setupPopup(l,p))}_makeButton(){if(!0===this.options.showButton){const e=document.createElement("div");e.className="vis-configuration vis-config-button",e.innerText="generate options",e.onclick=()=>{this._printOptions()},e.onmouseover=()=>{e.className="vis-configuration vis-config-button hover"},e.onmouseout=()=>{e.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(e)}}_setupPopup(e,t){if(!0===this.initialized&&!0===this.allowCreation&&this.popupCounter{this._removePopup()},this.popupCounter+=1,this.popupDiv={html:i,index:t}}}_removePopup(){void 0!==this.popupDiv.html&&(this.popupDiv.html.parentNode.removeChild(this.popupDiv.html),clearTimeout(this.popupDiv.hideTimeout),clearTimeout(this.popupDiv.deleteTimeout),this.popupDiv={})}_showPopupIfNeeded(){if(void 0!==this.popupDiv.html){const e=this.domElements[this.popupDiv.index].getBoundingClientRect();this.popupDiv.html.style.left=e.left+"px",this.popupDiv.html.style.top=e.top-30+"px",document.body.appendChild(this.popupDiv.html),this.popupDiv.hideTimeout=sf(()=>{this.popupDiv.html.style.opacity=0},1500),this.popupDiv.deleteTimeout=sf(()=>{this._removePopup()},1800)}}_makeCheckbox(e,t,i){const r=document.createElement("input");r.type="checkbox",r.className="vis-configuration vis-config-checkbox",r.checked=e,void 0!==t&&(r.checked=t,t!==e&&("object"==typeof e?t!==e.enabled&&this.changedOptions.push({path:i,value:t}):this.changedOptions.push({path:i,value:t})));const n=this;r.onchange=function(){n._update(this.checked,i)};const s=this._makeLabel(i[i.length-1],i);this._makeItem(i,s,r)}_makeTextInput(e,t,i){const r=document.createElement("input");r.type="text",r.className="vis-configuration vis-config-text",r.value=t,t!==e&&this.changedOptions.push({path:i,value:t});const n=this;r.onchange=function(){n._update(this.value,i)};const s=this._makeLabel(i[i.length-1],i);this._makeItem(i,s,r)}_makeColorField(e,t,i){const r=e[1],n=document.createElement("div");"none"!==(t=void 0===t?r:t)?(n.className="vis-configuration vis-config-colorBlock",n.style.backgroundColor=t):n.className="vis-configuration vis-config-colorBlock none",t=void 0===t?r:t,n.onclick=()=>{this._showColorPicker(t,n,i)};const s=this._makeLabel(i[i.length-1],i);this._makeItem(i,s,n)}_showColorPicker(e,t,i){t.onclick=function(){},this.colorPicker.insertTo(t),this.colorPicker.show(),this.colorPicker.setColor(e),this.colorPicker.setUpdateCallback(e=>{const r="rgba("+e.r+","+e.g+","+e.b+","+e.a+")";t.style.backgroundColor=r,this._update(r,i)}),this.colorPicker.setCloseCallback(()=>{t.onclick=()=>{this._showColorPicker(e,t,i)}})}_handleObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!1;const n=Bh(this.options);let s=!1;for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)){r=!0;const a=e[o],l=Fg(t,o);if("function"==typeof n&&(r=n(o,t),!1===r&&!Wu(a)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,r=this._handleObject(a,l,!0),this.allowCreation=!1===i)),!1!==r){s=!0;const e=this._getValue(l);if(Wu(a))this._handleArray(a,e,l);else if("string"==typeof a)this._makeTextInput(a,e,l);else if("boolean"==typeof a)this._makeCheckbox(a,e,l);else if(a instanceof Object){if(!this.hideOption(t,o,this.moduleOptions))if(void 0!==a.enabled){const e=Fg(l,"enabled"),t=this._getValue(e);if(!0===t){const e=this._makeLabel(o,l,!0);this._makeItem(l,e),s=this._handleObject(a,l)||s}else this._makeCheckbox(a,t,l)}else{const e=this._makeLabel(o,l,!0);this._makeItem(l,e),s=this._handleObject(a,l)||s}}else console.error("dont know how to handle",a,o,l)}}return s}_handleArray(e,t,i){"string"==typeof e[0]&&"color"===e[0]?(this._makeColorField(e,t,i),e[1]!==t&&this.changedOptions.push({path:i,value:t})):"string"==typeof e[0]?(this._makeDropdown(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:t})):"number"==typeof e[0]&&(this._makeRange(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:Number(t)}))}_update(e,t){const i=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}_constructOptions(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i;e="false"!==(e="true"===e||e)&&e;for(let n=0;nr-this.padding&&(i=!0),n=i?this.x-t:this.x,s=o?this.y-e:this.y}else s=this.y-e,s+e+this.padding>i&&(s=i-e-this.padding),sr&&(n=r-t-this.padding),ns.distance?" in "+e.printLocation(n.path,t,"")+"Perhaps it was misplaced? Matching option found at: "+e.printLocation(s.path,s.closestMatch,""):n.distance<=8?'. Did you mean "'+n.closestMatch+'"?'+e.printLocation(n.path,t):". Did you mean one of these: "+e.print(ed(i))+e.printLocation(r,t),console.error('%cUnknown option detected: "'+t+'"'+o,uy),cy=!0}static findInOptions(t,i,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1e9,o="",a=[];const l=t.toLowerCase();let c;for(const d in i){let h;if(void 0!==i[d].__type__&&!0===n){const n=e.findInOptions(t,i[d],Fg(r,d));s>n.distance&&(o=n.closestMatch,a=n.path,s=n.distance,c=n.indexMatch)}else{var u;-1!==Ap(u=d.toLowerCase()).call(u,l)&&(c=d),h=e.levenshteinDistance(t,d),s>h&&(o=d,a=Mg(r),s=h)}}return{closestMatch:o,path:a,distance:s,indexMatch:c}}static printLocation(e,t){let i="\n\n"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n")+"options = {\n";for(let r=0;r0)return"before"==r?Math.max(0,l-1):l;if(n(o,t)<0&&n(a,t)>0)return"before"==r?l:Math.min(e.length-1,l+1);n(o,t)<0?u=l+1:d=l-1,c++}return-1},bridgeObject:ty,copyAndExtendArray:Fg,copyArray:Mg,deepExtend:Pg,deepObjectAssign:fg,easingFunctions:ry,equalArray:function(e,t){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i0&&void 0!==arguments[0]?arguments[0]:window.event,t=null;return e&&(e.target?t=e.target:e.srcElement&&(t=e.srcElement)),t instanceof Element&&(null==t.nodeType||3!=t.nodeType||(t=t.parentNode,t instanceof Element))?t:null},getType:function(e){const t=typeof e;return"object"===t?null===e?"null":e instanceof Boolean?"Boolean":e instanceof Number?"Number":e instanceof String?"String":Wu(e)?"Array":e instanceof Date?"Date":"Object":"number"===t?"Number":"boolean"===t?"Boolean":"string"===t?"String":void 0===t?"undefined":t},hasParent:function(e,t){let i=e;for(;i;){if(i===t)return!0;if(!i.parentNode)return!1;i=i.parentNode}return!1},hexToHSV:Jg,hexToRGB:Vg,insertSort:function(e,t){for(let i=0;i0&&t(r,e[n-1])<0;n--)e[n]=e[n-1];e[n]=r}return e},isDate:function(e){if(e instanceof Date)return!0;if(Eg(e)){if(xg.exec(e))return!0;if(!isNaN(Date.parse(e)))return!0}return!1},isNumber:Sg,isObject:Og,isString:Eg,isValidHex:Qg,isValidRGB:Zg,isValidRGBA:ey,mergeOptions:iy,option:qg,overrideOpacity:Wg,parseColor:Gg,preventDefault:function(e){e||(e=window.event),e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},pureDeepObjectAssign:pg,recursiveDOMDelete:Tg,removeClassName:function(e,t){let i=e.className.split(" ");const r=t.split(" ");i=Bh(i).call(i,(function(e){return!_h(r).call(r,e)})),e.className=i.join(" ")},removeCssText:function(e,t){const i=Xg(t);for(const r of ed(i))e.style.removeProperty(r)},selectiveBridgeObject:function(e,t){if(null!==t&&"object"==typeof t){const i=Pp(t);for(let r=0;r2?i-2:0),n=2;n{t||(t=!0,requestAnimationFrame(()=>{t=!1,e()}))}},toArray:Ug,topMost:ny,updateProperty:function(e,t,i){return e[t]!==i&&(e[t]=i,!0)}});function vy(e){return Cy=e,function(){var e={};if(ky=0,Sy=Cy.charAt(0),My(),"strict"===Ty&&(e.strict=!0,My()),"graph"!==Ty&&"digraph"!==Ty||(e.type=Ty,My()),Ey===_y.IDENTIFIER&&(e.id=Ty,My()),"{"!=Ty)throw Vy("Angle bracket { expected");if(My(),Ly(e),"}"!=Ty)throw Vy("Angle bracket } expected");if(My(),""!==Ty)throw Vy("End of file expected");return My(),delete e.node,delete e.edge,delete e.graph,e}()}var wy={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},xy=Pp(wy);xy.color="color.color",xy.style="dashes";var _y={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},jy={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},Cy="",ky=0,Sy="",Ty="",Ey=_y.NULL;function Oy(){ky++,Sy=Cy.charAt(ky)}function Dy(){return Cy.charAt(ky+1)}function Ay(e){var t=e.charCodeAt(0);return t<47?35===t||46===t:t<59?t>47:t<91?t>64:t<96?95===t:t<123&&t>96}function Ny(e,t){if(e||(e={}),t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function Iy(e,t,i){for(var r=t.split("."),n=e;r.length;){var s=r.shift();r.length?(n[s]||(n[s]={}),n=n[s]):n[s]=i}}function Ry(e,t){for(var i,r,n=null,s=[e],o=e;o.parent;)s.push(o.parent),o=o.parent;if(o.nodes)for(i=0,r=o.nodes.length;i=0;i--){var a,l=s[i];l.nodes||(l.nodes=[]),-1===Ap(a=l.nodes).call(a,n)&&l.nodes.push(n)}t.attr&&(n.attr=Ny(n.attr,t.attr))}function Py(e,t){if(e.edges||(e.edges=[]),e.edges.push(t),e.edge){var i=Ny({},e.edge);t.attr=Ny(i,t.attr)}}function Fy(e,t,i,r,n){var s={from:t,to:i,type:r};return e.edge&&(s.attr=Ny({},e.edge)),s.attr=Ny(s.attr||{},n),null!=n&&n.hasOwnProperty("arrows")&&null!=n.arrows&&(s.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),s}function My(){for(Ey=_y.NULL,Ty="";" "===Sy||"\t"===Sy||"\n"===Sy||"\r"===Sy;)Oy();do{var e=!1;if("#"===Sy){for(var t=ky-1;" "===Cy.charAt(t)||"\t"===Cy.charAt(t);)t--;if("\n"===Cy.charAt(t)||""===Cy.charAt(t)){for(;""!=Sy&&"\n"!=Sy;)Oy();e=!0}}if("/"===Sy&&"/"===Dy()){for(;""!=Sy&&"\n"!=Sy;)Oy();e=!0}if("/"===Sy&&"*"===Dy()){for(;""!=Sy;){if("*"===Sy&&"/"===Dy()){Oy(),Oy();break}Oy()}e=!0}for(;" "===Sy||"\t"===Sy||"\n"===Sy||"\r"===Sy;)Oy()}while(e);if(""!==Sy){var i=Sy+Dy();if(jy[i])return Ey=_y.DELIMITER,Ty=i,Oy(),void Oy();if(jy[Sy])return Ey=_y.DELIMITER,Ty=Sy,void Oy();if(Ay(Sy)||"-"===Sy){for(Ty+=Sy,Oy();Ay(Sy);)Ty+=Sy,Oy();return"false"===Ty?Ty=!1:"true"===Ty?Ty=!0:isNaN(Number(Ty))||(Ty=Number(Ty)),void(Ey=_y.IDENTIFIER)}if('"'===Sy){for(Oy();""!=Sy&&('"'!=Sy||'"'===Sy&&'"'===Dy());)'"'===Sy?(Ty+=Sy,Oy()):"\\"===Sy&&"n"===Dy()?(Ty+="\n",Oy()):Ty+=Sy,Oy();if('"'!=Sy)throw Vy('End of string " expected');return Oy(),void(Ey=_y.IDENTIFIER)}for(Ey=_y.UNKNOWN;""!=Sy;)Ty+=Sy,Oy();throw new SyntaxError('Syntax error in part "'+Wy(Ty,30)+'"')}Ey=_y.DELIMITER}function Ly(e){for(;""!==Ty&&"}"!=Ty;)By(e),";"===Ty&&My()}function By(e){var t=zy(e);if(t)Uy(e,t);else{var i=function(e){return"node"===Ty?(My(),e.node=qy(),"node"):"edge"===Ty?(My(),e.edge=qy(),"edge"):"graph"===Ty?(My(),e.graph=qy(),"graph"):null}(e);if(!i){if(Ey!=_y.IDENTIFIER)throw Vy("Identifier expected");var r=Ty;if(My(),"="===Ty){if(My(),Ey!=_y.IDENTIFIER)throw Vy("Identifier expected");e[r]=Ty,My()}else!function(e,t){var i={id:t},r=qy();r&&(i.attr=r),Ry(e,i),Uy(e,t)}(e,r)}}}function zy(e){var t=null;if("subgraph"===Ty&&((t={}).type="subgraph",My(),Ey===_y.IDENTIFIER&&(t.id=Ty,My())),"{"===Ty){if(My(),t||(t={}),t.parent=e,t.node=e.node,t.edge=e.edge,t.graph=e.graph,Ly(t),"}"!=Ty)throw Vy("Angle bracket } expected");My(),delete t.node,delete t.edge,delete t.graph,delete t.parent,e.subgraphs||(e.subgraphs=[]),e.subgraphs.push(t)}return t}function Uy(e,t){for(;"->"===Ty||"--"===Ty;){var i,r=Ty;My();var n=zy(e);if(n)i=n;else{if(Ey!=_y.IDENTIFIER)throw Vy("Identifier or subgraph expected");Ry(e,{id:i=Ty}),My()}Py(e,Fy(e,t,i,r,qy())),t=i}}function qy(){for(var e,t,i=null,r={dashed:!0,solid:!1,dotted:[1,5]},n={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},s=new Array,o=new Array;"["===Ty;){for(My(),i={};""!==Ty&&"]"!=Ty;){if(Ey!=_y.IDENTIFIER)throw Vy("Attribute name expected");var a=Ty;if(My(),"="!=Ty)throw Vy("Equal sign = expected");if(My(),Ey!=_y.IDENTIFIER)throw Vy("Attribute value expected");var l=Ty;"style"===a&&(l=r[l]),"arrowhead"===a&&(a="arrows",l={to:{enabled:!0,type:n[l]}}),"arrowtail"===a&&(a="arrows",l={from:{enabled:!0,type:n[l]}}),s.push({attr:i,name:a,value:l}),o.push(a),My(),","==Ty&&My()}if("]"!=Ty)throw Vy("Bracket ] expected");My()}if(_h(o).call(o,"dir")){var c={arrows:{}};for(e=0;e"===e.type&&(t.arrows="to"),t};yd(n=i.edges).call(n,(function(e){var t,i,n,o,a,l,c;t=e.from instanceof Object?e.from.nodes:{id:e.from},i=e.to instanceof Object?e.to.nodes:{id:e.to},e.from instanceof Object&&e.from.edges&&yd(n=e.from.edges).call(n,(function(e){var t=s(e);r.edges.push(t)})),a=i,l=function(t,i){var n=Fy(r,t.id,i.id,e.type,e.attr),o=s(n);r.edges.push(o)},Wu(o=t)?yd(o).call(o,(function(e){Wu(a)?yd(a).call(a,(function(t){l(e,t)})):l(e,a)})):Wu(a)?yd(a).call(a,(function(e){l(o,e)})):l(o,a),e.to instanceof Object&&e.to.edges&&yd(c=e.to.edges).call(c,(function(e){var t=s(e);r.edges.push(t)}))}))}return i.attr&&(r.options=i.attr),r}var Xy=Object.freeze({__proto__:null,DOTToGraph:$y,parseDOT:vy});function Ky(e,t){var i;const r={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};null!=t&&(null!=t.fixed&&(r.nodes.fixed=t.fixed),null!=t.parseColor&&(r.nodes.parseColor=t.parseColor),null!=t.inheritColor&&(r.edges.inheritColor=t.inheritColor));const n=e.edges,s=Ju(n).call(n,e=>{const t={from:e.source,id:e.id,to:e.target};return null!=e.attributes&&(t.attributes=e.attributes),null!=e.label&&(t.label=e.label),null!=e.attributes&&null!=e.attributes.title&&(t.title=e.attributes.title),"Directed"===e.type&&(t.arrows="to"),e.color&&!1===r.edges.inheritColor&&(t.color=e.color),t});return{nodes:Ju(i=e.nodes).call(i,e=>{const t={id:e.id,fixed:r.nodes.fixed&&null!=e.x&&null!=e.y};return null!=e.attributes&&(t.attributes=e.attributes),null!=e.label&&(t.label=e.label),null!=e.size&&(t.size=e.size),null!=e.attributes&&null!=e.attributes.title&&(t.title=e.attributes.title),null!=e.title&&(t.title=e.title),null!=e.x&&(t.x=e.x),null!=e.y&&(t.y=e.y),null!=e.color&&(!0===r.nodes.parseColor?t.color=e.color:t.color={background:e.color,border:e.color,highlight:{background:e.color,border:e.color},hover:{background:e.color,border:e.color}}),t}),edges:s}}var Yy=Object.freeze({__proto__:null,parseGephi:Ky}),Jy=Object.freeze({__proto__:null,cn:{addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},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"},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"},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"},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"},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"},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:"Редактировать узел"},uk:{addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"}});class Qy{constructor(){this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}init(){if(this.initialized())return;this.src=this.image.src;const e=this.image.width,t=this.image.height;this.width=e,this.height=t;const i=Math.floor(t/2),r=Math.floor(t/4),n=Math.floor(t/8),s=Math.floor(t/16),o=Math.floor(e/2),a=Math.floor(e/4),l=Math.floor(e/8),c=Math.floor(e/16);this.canvas.width=3*a,this.canvas.height=i,this.coordinates=[[0,0,o,i],[o,0,a,r],[o,r,l,n],[5*l,r,c,s]],this._fillMipMap()}initialized(){return void 0!==this.coordinates}_fillMipMap(){const e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(let i=1;i2){t*=.5;let o=0;for(;t>2&&o=this.NUM_ITERATIONS&&(o=this.NUM_ITERATIONS-1);const a=this.coordinates[o];e.drawImage(this.canvas,a[0],a[1],a[2],a[3],i,r,n,s)}else e.drawImage(this.image,i,r,n,s)}}class Zy{constructor(e){this.images={},this.imageBroken={},this.callback=e}_tryloadBrokenUrl(e,t,i){void 0!==e&&void 0!==i&&(void 0!==t?(i.image.onerror=()=>{console.error("Could not load brokenImage:",t)},i.image.src=t):console.warn("No broken url image defined"))}_redrawWithImage(e){this.callback&&this.callback(e)}load(e,t){const i=this.images[e];if(i)return i;const r=new Qy;return this.images[e]=r,r.image.onload=()=>{this._fixImageCoordinates(r.image),r.init(),this._redrawWithImage(r)},r.image.onerror=()=>{console.error("Could not load image:",e),this._tryloadBrokenUrl(e,t,r)},r.image.src=e,r}_fixImageCoordinates(e){0===e.width&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}var eb={exports:{}},tb=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),ib=o,rb=te,nb=x,sb=tb,ob=Object.isExtensible,ab=ib((function(){ob(1)}))||sb?function(e){return!!rb(e)&&(!sb||"ArrayBuffer"!==nb(e))&&(!ob||ob(e))}:ob,lb=!o((function(){return Object.isExtensible(Object.preventExtensions({}))})),cb=Oi,ub=y,db=$i,hb=te,pb=Ze,fb=Qt.f,mb=As,gb=Rs,yb=ab,bb=lb,vb=!1,wb=nt("meta"),xb=0,_b=function(e){fb(e,wb,{value:{objectID:"O"+xb++,weakData:{}}})},jb=eb.exports={enable:function(){jb.enable=function(){},vb=!0;var e=mb.f,t=ub([].splice),i={};i[wb]=1,e(i).length&&(mb.f=function(i){for(var r=e(i),n=0,s=r.length;ns;s++)if((a=y(e[s]))&&Yb(iv,a))return a;return new tv(!1)}r=Jb(e,n)}for(l=h?e.next:r.next;!(c=Hb(l,r)).done;){try{a=y(c.value)}catch(e){Zb(r,"throw",e)}if("object"==typeof a&&a&&Yb(iv,a))return a}return new tv(!1)},nv=le,sv=TypeError,ov=function(e,t){if(nv(t,e))return e;throw new sv("Incorrect invocation")},av=Oi,lv=s,cv=Cb,uv=o,dv=yi,hv=rv,pv=ov,fv=E,mv=te,gv=G,yv=wo,bv=Qt.f,vv=Ho.forEach,wv=D,xv=Mo.set,_v=Mo.getterFor,jv=function(e,t,i){var r,n=-1!==e.indexOf("Map"),s=-1!==e.indexOf("Weak"),o=n?"set":"add",a=lv[e],l=a&&a.prototype,c={};if(wv&&fv(a)&&(s||l.forEach&&!uv((function(){(new a).entries().next()})))){var u=(r=t((function(t,i){xv(pv(t,u),{type:e,collection:new a}),gv(i)||hv(i,t[o],{that:t,AS_ENTRIES:n})}))).prototype,d=_v(e);vv(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"===e||"set"===e;!(e in l)||s&&"clear"===e||dv(u,e,(function(i,r){var n=d(this).collection;if(!t&&s&&!mv(i))return"get"===e&&void 0;var o=n[e](0===i?0:i,r);return t?this:o}))})),s||bv(u,"size",{configurable:!0,get:function(){return d(this).collection.size}})}else r=i.getConstructor(t,e,n,o),cv.enable();return yv(r,e,!1,!0),c[e]=r,av({global:!0,forced:!0},c),s||i.setStrong(r,e,n),r},Cv=$s,kv=function(e,t,i){for(var r in t)i&&i.unsafe&&e[r]?e[r]=t[r]:Cv(e,r,t[r],i);return e},Sv=ae,Tv=Ks,Ev=D,Ov=pt("species"),Dv=Ds,Av=Ks,Nv=kv,Iv=Jt,Rv=ov,Pv=G,Fv=rv,Mv=Yc,Lv=Jc,Bv=function(e){var t=Sv(e);Ev&&t&&!t[Ov]&&Tv(t,Ov,{configurable:!0,get:function(){return this}})},zv=D,Uv=Cb.fastKey,qv=Mo.set,Vv=Mo.getterFor,Wv={getConstructor:function(e,t,i,r){var n=e((function(e,n){Rv(e,s),qv(e,{type:t,index:Dv(null),first:void 0,last:void 0,size:0}),zv||(e.size=0),Pv(n)||Fv(n,e[r],{that:e,AS_ENTRIES:i})})),s=n.prototype,o=Vv(t),a=function(e,t,i){var r,n,s=o(e),a=l(e,t);return a?a.value=i:(s.last=a={index:n=Uv(t,!0),key:t,value:i,previous:r=s.last,next:void 0,removed:!1},s.first||(s.first=a),r&&(r.next=a),zv?s.size++:e.size++,"F"!==n&&(s.index[n]=a)),e},l=function(e,t){var i,r=o(e),n=Uv(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key===t)return i};return Nv(s,{clear:function(){for(var e=o(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,zv?e.size=0:this.size=0},delete:function(e){var t=this,i=o(t),r=l(t,e);if(r){var n=r.next,s=r.previous;delete i.index[r.index],r.removed=!0,s&&(s.next=n),n&&(n.previous=s),i.first===r&&(i.first=n),i.last===r&&(i.last=s),zv?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=o(this),r=Iv(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!l(this,e)}}),Nv(s,i?{get:function(e){var t=l(this,e);return t&&t.value},set:function(e,t){return a(this,0===e?0:e,t)}}:{add:function(e){return a(this,e=0===e?0:e,e)}}),zv&&Av(s,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=Vv(t),s=Vv(r);Mv(e,t,(function(e,t){qv(this,{type:r,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=s(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?Lv("keys"===t?i.key:"values"===t?i.value:[i.key,i.value],!1):(e.target=void 0,Lv(void 0,!0))}),i?"entries":"values",!i,!0),Bv(t)}};jv("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Wv);var Hv=y,Gv=Ii,$v=ns,Xv=K,Kv=Hv("".charAt),Yv=Hv("".charCodeAt),Jv=Hv("".slice),Qv=function(e){return function(t,i){var r,n,s=$v(Xv(t)),o=Gv(i),a=s.length;return o<0||o>=a?e?"":void 0:(r=Yv(s,o))<55296||r>56319||o+1===a||(n=Yv(s,o+1))<56320||n>57343?e?Kv(s,o):r:e?Jv(s,o,o+2):n-56320+(r-55296<<10)+65536}},Zv={codeAt:Qv(!1),charAt:Qv(!0)}.charAt,ew=ns,tw=Mo,iw=Yc,rw=Jc,nw="String Iterator",sw=tw.set,ow=tw.getterFor(nw);iw(String,"String",(function(e){sw(this,{type:nw,string:ew(e),index:0})}),(function(){var e,t=ow(this),i=t.string,r=t.index;return r>=i.length?rw(void 0,!0):(e=Zv(i,r),t.index+=e.length,rw(e,!1))}));var aw=r(ie.Map);class lw{constructor(){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},vr(this.options,this.defaultOptions)}setOptions(e){const t=["useDefaultGroups"];if(void 0!==e)for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&-1===Ap(t).call(t,i)){const t=e[i];this.add(i,t)}}clear(){this._groups=new aw,this._groupNames=[]}get(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._groups.get(e);if(void 0===i&&t)if(!1===this.options.useDefaultGroups&&this._groupNames.length>0){const t=this._groupIndex%this._groupNames.length;++this._groupIndex,i={},i.color=this._groups.get(this._groupNames[t]),this._groups.set(e,i)}else{const t=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,i={},i.color=this._defaultGroups[t],this._groups.set(e,i)}return i}add(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}Oi({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var cw=r(ie.Number.isNaN),uw=s.isFinite,dw=Number.isFinite||function(e){return"number"==typeof e&&uw(e)};Oi({target:"Number",stat:!0},{isFinite:dw});var hw=r(ie.Number.isFinite),pw=Ho.some;Oi({target:"Array",proto:!0,forced:!od("some")},{some:function(e){return pw(this,e,arguments.length>1?arguments[1]:void 0)}});var fw=Rr("Array").some,mw=le,gw=fw,yw=Array.prototype,bw=function(e){var t=e.some;return e===yw||mw(yw,e)&&t===yw.some?gw:t},vw=r(bw),ww=r(ie.Object.getOwnPropertySymbols),xw={exports:{}},_w=Oi,jw=o,Cw=Q,kw=O.f,Sw=D;_w({target:"Object",stat:!0,forced:!Sw||jw((function(){kw(1)})),sham:!Sw},{getOwnPropertyDescriptor:function(e,t){return kw(Cw(e),t)}});var Tw=ie.Object,Ew=xw.exports=function(e,t){return Tw.getOwnPropertyDescriptor(e,t)};Tw.getOwnPropertyDescriptor.sham&&(Ew.sham=!0);var Ow=r(xw.exports),Dw=qu,Aw=Q,Nw=O,Iw=rn;Oi({target:"Object",stat:!0,sham:!D},{getOwnPropertyDescriptors:function(e){for(var t,i,r=Aw(e),n=Nw.f,s=Dw(r),o={},a=0;s.length>a;)void 0!==(i=n(r,t=s[a++]))&&Iw(o,t,i);return o}});var Rw=r(ie.Object.getOwnPropertyDescriptors),Pw={exports:{}},Fw=Oi,Mw=D,Lw=ss.f;Fw({target:"Object",stat:!0,forced:Object.defineProperties!==Lw,sham:!Mw},{defineProperties:Lw});var Bw=ie.Object,zw=Pw.exports=function(e,t){return Bw.defineProperties(e,t)};Bw.defineProperties.sham&&(zw.sham=!0);var Uw=r(Pw.exports),qw={exports:{}},Vw=Oi,Ww=D,Hw=Qt.f;Vw({target:"Object",stat:!0,forced:Object.defineProperty!==Hw,sham:!Ww},{defineProperty:Hw});var Gw=ie.Object,$w=qw.exports=function(e,t,i){return Gw.defineProperty(e,t,i)};Gw.defineProperty.sham&&($w.sham=!0);var Xw=qw.exports,Kw=r(Xw),Yw=pt,Jw=Qt.f,Qw=Yw("metadata"),Zw=Function.prototype;void 0===Zw[Qw]&&Jw(Zw,Qw,{value:null}),so("asyncDispose"),so("dispose"),so("metadata");var ex=mu,tx=y,ix=ae("Symbol"),rx=ix.keyFor,nx=tx(ix.prototype.valueOf),sx=ix.isRegisteredSymbol||function(e){try{return void 0!==rx(nx(e))}catch(e){return!1}};Oi({target:"Symbol",stat:!0},{isRegisteredSymbol:sx});for(var ox=$e,ax=ae,lx=y,cx=Se,ux=pt,dx=ax("Symbol"),hx=dx.isWellKnownSymbol,px=ax("Object","getOwnPropertyNames"),fx=lx(dx.prototype.valueOf),mx=ox("wks"),gx=0,yx=px(dx),bx=yx.length;gx=0:a>l;l+=c)l in o&&(n=i(n,o[l],l,s));return n}},Rx={left:Ix(!1),right:Ix(!0)},Px="process"===x(s.process),Fx=Rx.left;Oi({target:"Array",proto:!0,forced:!Px&&ge>79&&ge<83||!od("reduce")},{reduce:function(e){var t=arguments.length;return Fx(this,e,t,t>1?arguments[1]:void 0)}});var Mx=Rr("Array").reduce,Lx=le,Bx=Mx,zx=Array.prototype,Ux=function(e){var t=e.reduce;return e===zx||Lx(zx,e)&&t===zx.reduce?Bx:t},qx=r(Ux),Vx=Yr,Wx=Ui,Hx=Qr,Gx=Jt,$x=function(e,t,i,r,n,s,o,a){for(var l,c,u=n,d=0,h=!!o&&Gx(o,a);d0&&Vx(l)?(c=Wx(l),u=$x(e,t,l,c,u,s-1)-1):(Hx(u+1),e[u]=l),u++),d++;return u},Xx=$x,Kx=Ne,Yx=Ye,Jx=Ui,Qx=Mn;Oi({target:"Array",proto:!0},{flatMap:function(e){var t,i=Yx(this),r=Jx(i);return Kx(e),(t=Qx(i,0)).length=Xx(t,i,i,r,0,1,e,arguments.length>1?arguments[1]:void 0),t}});var Zx=Rr("Array").flatMap,e_=le,t_=Zx,i_=Array.prototype,r_=function(e){var t=e.flatMap;return e===i_||e_(i_,e)&&t===i_.flatMap?t_:t},n_=r(r_),s_=r(_x);jv("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Wv);var o_=r(ie.Set),a_=r(zb),l_=zs,c_=Math.floor,u_=function(e,t){var i=e.length,r=c_(i/2);return i<8?d_(e,t):h_(e,u_(l_(e,0,r),t),u_(l_(e,r),t),t)},d_=function(e,t){for(var i,r,n=e.length,s=1;s0;)e[r]=e[--r];r!==s++&&(e[r]=i)}return e},h_=function(e,t,i,r){for(var n=t.length,s=i.length,o=0,a=0;o3)){if(D_)return!0;if(N_)return N_<603;var e,t,i,r,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)I_.push({k:t+r,v:i})}for(I_.sort((function(e,t){return t.v-e.v})),r=0;rk_(i)?1:-1}}(e)),i=j_(n),r=0;rt(e),e)}_add(e,t){null!=t&&this._target.add(this._transformItems(this._source.get(t.items)))}_update(e,t){null!=t&&this._target.update(this._transformItems(this._source.get(t.items)))}_remove(e,t){null!=t&&this._target.remove(this._transformItems(t.oldData))}}class Oj{constructor(e){Tx(this,"_source",void 0),Tx(this,"_transformers",[]),this._source=e}filter(e){return this._transformers.push(t=>Bh(t).call(t,e)),this}map(e){return this._transformers.push(t=>Ju(t).call(t,e)),this}flatMap(e){return this._transformers.push(t=>n_(t).call(t,e)),this}to(e){return new Ej(this._source,this._transformers,e)}}function Dj(e){return"string"==typeof e||"number"==typeof e}class Aj{constructor(e){Tx(this,"delay",void 0),Tx(this,"max",void 0),Tx(this,"_queue",[]),Tx(this,"_timeout",null),Tx(this,"_extended",null),this.delay=null,this.max=1/0,this.setOptions(e)}setOptions(e){e&&void 0!==e.delay&&(this.delay=e.delay),e&&void 0!==e.max&&(this.max=e.max),this._flushIfNeeded()}static extend(e,t){const i=new Aj(t);if(void 0!==e.flush)throw new Error("Target object already has a property flush");e.flush=()=>{i.flush()};const r=[{name:"flush",original:void 0}];if(t&&t.replace)for(let n=0;nthis.max&&this.flush(),null!=this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&"number"==typeof this.delay&&(this._timeout=sf(()=>{this.flush()},this.delay))}flush(){var e,t;yd(e=eh(t=this._queue).call(t,0)).call(e,e=>{e.fn.apply(e.context||e.fn,e.args||[])})}}class Nj{constructor(){Tx(this,"_subscribers",{"*":[],add:[],remove:[],update:[]}),Tx(this,"subscribe",Nj.prototype.on),Tx(this,"unsubscribe",Nj.prototype.off)}_trigger(e,t,i){var r;if("*"===e)throw new Error("Cannot trigger event *");yd(r=[...this._subscribers[e],...this._subscribers["*"]]).call(r,r=>{r(e,t,null!=i?i:null)})}on(e,t){"function"==typeof t&&this._subscribers[e].push(t)}off(e,t){var i;this._subscribers[e]=Bh(i=this._subscribers[e]).call(i,e=>e!==t)}}class Ij{constructor(e){Tx(this,"_pairs",void 0),this._pairs=e}*[s_](){for(const[e,t]of this._pairs)yield[e,t]}*entries(){for(const[e,t]of this._pairs)yield[e,t]}*keys(){for(const[e]of this._pairs)yield e}*values(){for(const[,e]of this._pairs)yield e}toIdArray(){var e;return Ju(e=[...this._pairs]).call(e,e=>e[0])}toItemArray(){var e;return Ju(e=[...this._pairs]).call(e,e=>e[1])}toEntryArray(){return[...this._pairs]}toObjectMap(){const e=Pp(null);for(const[t,i]of this._pairs)e[t]=i;return e}toMap(){return new aw(this._pairs)}toIdSet(){return new o_(this.toIdArray())}toItemSet(){return new o_(this.toItemArray())}cache(){return new Ij([...this._pairs])}distinct(e){const t=new o_;for(const[i,r]of this._pairs)t.add(e(r,i));return t}filter(e){const t=this._pairs;return new Ij({*[s_](){for(const[i,r]of t)e(r,i)&&(yield[i,r])}})}forEach(e){for(const[t,i]of this._pairs)e(i,t)}map(e){const t=this._pairs;return new Ij({*[s_](){for(const[i,r]of t)yield[i,e(r,i)]}})}max(e){const t=a_(this._pairs);let i=t.next();if(i.done)return null;let r=i.value[1],n=e(i.value[1],i.value[0]);for(;!(i=t.next()).done;){const[t,s]=i.value,o=e(s,t);o>n&&(n=o,r=s)}return r}min(e){const t=a_(this._pairs);let i=t.next();if(i.done)return null;let r=i.value[1],n=e(i.value[1],i.value[0]);for(;!(i=t.next()).done;){const[t,s]=i.value,o=e(s,t);o{var t;return a_(H_(t=[...this._pairs]).call(t,(t,i)=>{let[r,n]=t,[s,o]=i;return e(n,o,r,s)}))}})}}class Rj extends Nj{get idProp(){return this._idProp}constructor(e,t){super(),Tx(this,"flush",void 0),Tx(this,"length",void 0),Tx(this,"_options",void 0),Tx(this,"_data",void 0),Tx(this,"_idProp",void 0),Tx(this,"_queue",null),e&&!Wu(e)&&(t=e,e=[]),this._options=t||{},this._data=new aw,this.length=0,this._idProp=this._options.fieldId||"id",e&&e.length&&this.add(e),this.setOptions(t)}setOptions(e){e&&void 0!==e.queue&&(!1===e.queue?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=Aj.extend(this,{replace:["add","update","remove"]})),e.queue&&"object"==typeof e.queue&&this._queue.setOptions(e.queue)))}add(e,t){const i=[];let r;if(Wu(e)){const t=Ju(e).call(e,e=>e[this._idProp]);if(vw(t).call(t,e=>this._data.has(e)))throw new Error("A duplicate id was found in the parameter array.");for(let n=0,s=e.length;n{const t=e[o];if(null!=t&&this._data.has(t)){const i=e,o=vr({},this._data.get(t)),a=this._updateItem(i);r.push(a),s.push(i),n.push(o)}else{const t=this._addItem(e);i.push(t)}};if(Wu(e))for(let l=0,c=e.length;l{const t=this._data.get(e[this._idProp]);if(null==t)throw new Error("Updating non-existent items is not allowed.");return{oldData:t,update:e}})).call(i,e=>{let{oldData:t,update:i}=e;const r=t[this._idProp],n=pg(t,i);return this._data.set(r,n),{id:r,oldData:t,updatedData:n}});if(r.length){const e={items:Ju(r).call(r,e=>e.id),oldData:Ju(r).call(r,e=>e.oldData),data:Ju(r).call(r,e=>e.updatedData)};return this._trigger("update",e,t),e.items}return[]}get(e,t){let i,r,n;Dj(e)?(i=e,n=t):Wu(e)?(r=e,n=t):n=e;const s=n&&"Object"===n.returnType?"Object":"Array",o=n&&Bh(n),a=[];let l,c,u;if(null!=i)l=this._data.get(i),l&&o&&!o(l)&&(l=void 0);else if(null!=r)for(let p=0,f=r.length;p(t[i]=e[i],t),{}):e}_sort(e,t){if("string"==typeof t){const i=t;H_(e).call(e,(e,t)=>{const r=e[i],n=t[i];return r>n?1:ri)&&(t=n,i=s)}return t||null}min(e){let t=null,i=null;for(const n of cj(r=this._data).call(r)){var r;const s=n[e];"number"==typeof s&&(null==i||ss(e)&&o(e)),null==r?this._data.get(n):this._data.get(r,n)}getIds(e){if(this._data.length){const t=Bh(this._options),i=null!=e?Bh(e):null;let r;return r=i?t?e=>t(e)&&i(e):i:t,this._data.getIds({filter:r,order:e&&e.order})}return[]}forEach(e,t){if(this._data){var i;const r=Bh(this._options),n=t&&Bh(t);let s;s=n?r?function(e){return r(e)&&n(e)}:n:r,yd(i=this._data).call(i,e,{filter:s,order:t&&t.order})}}map(e,t){if(this._data){var i;const r=Bh(this._options),n=t&&Bh(t);let s;return s=n?r?e=>r(e)&&n(e):n:r,Ju(i=this._data).call(i,e,{filter:s,order:t&&t.order})}return[]}getDataSet(){return this._data.getDataSet()}stream(e){var t;return this._data.stream(e||{[s_]:zr(t=ej(this._ids)).call(t,this._ids)})}dispose(){var e;null!==(e=this._data)&&void 0!==e&&e.off&&this._data.off("*",this._listener);const t="This data view has already been disposed of.",i={get:()=>{throw new Error(t)},set:()=>{throw new Error(t)},configurable:!1};for(const r of Vu(Pj.prototype))vj(this,r,i)}_onEvent(e,t,i){if(!t||!t.items||!this._data)return;const r=t.items,n=[],s=[],o=[],a=[],l=[],c=[];switch(e){case"add":for(let e=0,t=r.length;et.x&&e.topt.y}function nC(e){return"string"==typeof e&&""!==e}function sC(e,t,i,r){let n=r.x,s=r.y;if("function"==typeof r.distanceToBorder){const i=r.distanceToBorder(e,t),o=Math.sin(t)*i,a=Math.cos(t)*i;a===i?(n+=i,s=r.y):o===i?(n=r.x,s-=i):(n+=a,s-=o)}else r.shape.width>r.shape.height?(n=r.x+.5*r.shape.width,s=r.y-i):(n=r.x+i,s=r.y-.5*r.shape.height);return{x:n,y:s}}class oC{constructor(e){this.measureText=e,this.current=0,this.width=0,this.height=0,this.lines=[]}_add(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";void 0===this.lines[e]&&(this.lines[e]={width:0,height:0,blocks:[]});let r=t;void 0!==t&&""!==t||(r=" ");const n=this.measureText(r,i),s=vr({},cj(n));s.text=t,s.width=n.width,s.mod=i,void 0!==t&&""!==t||(s.width=0),this.lines[e].blocks.push(s),this.lines[e].width+=s.width}curWidth(){const e=this.lines[this.current];return void 0===e?0:e.width}append(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,t)}newLine(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,t),this.current++}determineLineHeights(){for(let e=0;ee&&(e=r.width),t+=r.height}this.width=e,this.height=t}removeEmptyBlocks(){const e=[];for(let t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/};class lC{constructor(e){this.text=e,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}mod(){return 0===this.modStack.length?"normal":this.modStack[0]}modName(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":this.bold&&this.ital?"boldital":this.bold?"bold":this.ital?"ital":void 0}emitBlock(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}add(e){" "===e&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=e&&(this.buffer+=e)}parseWS(e){return!!/[ \t]/.test(e)&&(this.mono?this.add(e):this.spacing=!0,!0)}setTag(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}unsetTag(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}parseStartTag(e,t){return!(this.mono||this[e]||!this.match(t))&&(this.setTag(e),!0)}match(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const[i,r]=this.prepareRegExp(e),n=i.test(this.text.substr(this.position,r));return n&&t&&(this.position+=r-1),n}parseEndTag(e,t,i){let r=this.mod()===e;return r="mono"===e?r&&this.mono:r&&!this.mono,!(!r||!this.match(t))&&(void 0!==i?(this.position===this.text.length-1||this.match(i,!1))&&this.unsetTag(e):this.unsetTag(e),!0)}replace(e,t){return!!this.match(e)&&(this.add(t),this.position+=length-1,!0)}prepareRegExp(e){let t,i;if(e instanceof RegExp)i=e,t=1;else{const r=aC[e];i=void 0!==r?r:new RegExp(e),t=e.length}return[i,t]}}class cC{constructor(e,t,i,r){this.ctx=e,this.parent=t,this.selected=i,this.hover=r,this.lines=new oC((t,n)=>{if(void 0===t)return 0;const s=this.parent.getFormattingValues(e,i,r,n);let o=0;return""!==t&&(o=this.ctx.measureText(t).width),{width:o,values:s}})}process(e){if(!nC(e))return this.lines.finalize();const t=this.parent.fontOptions;e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n");const i=String(e).split("\n"),r=i.length;if(t.multi)for(let n=0;n0)for(let t=0;t0)for(let n=0;n!!/&/.test(e)&&(t.replace(t.text,"<","<")||t.replace(t.text,"&","&")||t.add("&"),!0);for(;t.position")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||i(e)||t.add(e),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){const t=new lC(e);let i=!0;const r=e=>!!/\\/.test(e)&&(t.positionthis.parent.fontOptions.maxWdt}getLongestFit(e){let t="",i=0;for(;i1&&void 0!==arguments[1]?arguments[1]:"normal",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t);let r=(e=(e=e.replace(/^( +)/g,"$1\r")).replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r")).split("\r");for(;r.length>0;){let e=this.getLongestFit(r);if(0===e){const e=r[0],i=this.getLongestFitWord(e);this.lines.newLine(Fu(e).call(e,0,i),t),r[0]=Fu(e).call(e,i)}else{let n=e;" "===r[e-1]?e--:" "===r[n]&&n++;const s=Fu(r).call(r,0,e).join("");e==r.length&&i?this.lines.append(s,t):this.lines.newLine(s,t),r=Fu(r).call(r,n)}}}}const uC=["bold","ital","boldital","mono"];class dC{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=i}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),nC(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"==typeof e.font){const t=e.font.size;void 0!==t&&(this.baseSize=t)}}initFontOptions(e){zg(uC,e=>{this.fontOptions[e]={}}),dC.parseFontString(this.fontOptions,e)?this.fontOptions.vadjust=0:zg(e,(e,t)=>{null!=e&&"object"!=typeof e&&(this.fontOptions[t]=e)})}static parseFontString(e,t){if(!t||"string"!=typeof t)return!1;const i=t.split(" ");return e.size=+i[0].replace("px",""),e.face=i[1],e.color=i[2],!0}constrain(e){const t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},i=ny(e,"widthConstraint");if("number"==typeof i)t.maxWdt=Number(i),t.minWdt=Number(i);else if("object"==typeof i){const i=ny(e,["widthConstraint","maximum"]);"number"==typeof i&&(t.maxWdt=Number(i));const r=ny(e,["widthConstraint","minimum"]);"number"==typeof r&&(t.minWdt=Number(r))}const r=ny(e,"heightConstraint");if("number"==typeof r)t.minHgt=Number(r);else if("object"==typeof r){const i=ny(e,["heightConstraint","minimum"]);"number"==typeof i&&(t.minHgt=Number(i));const r=ny(e,["heightConstraint","valign"]);"string"==typeof r&&("top"!==r&&"bottom"!==r||(t.valign=r))}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),Pg(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=iC("label",t)}adjustSizes(e){const t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);const i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}addFontOptionsToPile(e,t){for(let i=0;i{void 0!==e&&(Object.prototype.hasOwnProperty.call(t,i)||(-1!==Ap(uC).call(uC,i)?t[i]={}:t[i]=e))})}return t}getFontOption(e,t,i){let r;for(let n=0;n{r[t]=e}),r.size=Number(r.size),r.vadjust=Number(r.vadjust)}}draw(e,t,i,r,n){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";if(void 0===this.elementOptions.label)return;let o=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&o=this.elementOptions.scaling.label.maxVisible&&(o=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,r,n,t,i,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,o))}_drawBackground(e){if(void 0!==this.fontOptions.background&&"none"!==this.fontOptions.background){e.fillStyle=this.fontOptions.background;const t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle",n=arguments.length>4?arguments[4]:void 0;[t,i]=this._setAlignment(e,t,i,r),e.textAlign="left",t-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&("top"===this.fontOptions.valign&&(i-=(this.size.height-this.size.labelHeight)/2),"bottom"===this.fontOptions.valign&&(i+=(this.size.height-this.size.labelHeight)/2));for(let s=0;s0&&(e.lineWidth=a.strokeWidth,e.strokeStyle=c,e.lineJoin="round"),e.fillStyle=l,a.strokeWidth>0&&e.strokeText(a.text,t+s,i+a.vadjust),e.fillText(a.text,t+s,i+a.vadjust),s+=a.width}i+=r.height}}}_setAlignment(e,t,i,r){if(this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&!1===this.pointToSelf){t=0,i=0;const r=2;"top"===this.fontOptions.align?(e.textBaseline="alphabetic",i-=2*r):"bottom"===this.fontOptions.align?(e.textBaseline="hanging",i+=2*r):e.textBaseline="middle"}else e.textBaseline=r;return[t,i]}_getColor(e,t,i){let r=e||"#000000",n=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){const e=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));r=Wg(r,e),n=Wg(n,e)}return[r,n]}getTextSize(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let e=this.size.left,t=this.size.top-1;if(this.isEdgeLabel){const i=.5*-this.size.width;switch(this.fontOptions.align){case"middle":e=i,t=.5*-this.size.height;break;case"top":e=i,t=-(this.size.height+2);break;case"bottom":e=i,t=2}}return{left:e,top:t,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";this._processLabel(e,t,i),this.size.left=r-.5*this.size.width,this.size.top=n-.5*this.size.height,this.size.yLine=n+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===s&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,i,r){const n=function(e,t,i){return"normal"===t?"mod"===i?"":e[i]:void 0!==e[t][i]?e[t][i]:e[i]},s={color:n(this.fontOptions,r,"color"),size:n(this.fontOptions,r,"size"),face:n(this.fontOptions,r,"face"),mod:n(this.fontOptions,r,"mod"),vadjust:n(this.fontOptions,r,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||i)&&("normal"===r&&!0===this.fontOptions.chooser&&this.elementOptions.labelHighlightBold?s.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(s,this.elementOptions.id,t,i));let o="";return void 0!==s.mod&&""!==s.mod&&(o+=s.mod+" "),o+=s.size+"px "+s.face,e.font=o.replace(/"/g,""),s.font=e.font,s.height=s.size,s}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,i,r){return new cC(e,this,t,i).process(r)}_processLabel(e,t,i){if(!1===this.labelDirty&&!this.differentState(t,i))return;const r=this._processLabelText(e,t,i,this.elementOptions.label);this.fontOptions.minWdt>0&&r.width0&&r.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),gf(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,i,r,n){void 0!==i&&this.resize(i,r,n),this.left=e-this.width/2,this.top=t-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}updateBoundingBox(e,t,i,r,n){this._updateBoundingBox(e,t,i,r,n)}getDimensionsFromLabel(e,t,i){this.textSize=this.labelModule.getTextSize(e,t,i);let r=this.textSize.width,n=this.textSize.height;return 0===r&&(r=14,n=14),{width:r,height:n}}}let pC=class extends hC{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const r=this.getDimensionsFromLabel(e,t,i);this.width=r.width+this.margin.right+this.margin.left,this.height=r.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,i,r,n,s){this.resize(e,r,n),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),qr(e,this.left,this.top,this.width,this.height,s.borderRadius),this.performFill(e,s),this.updateBoundingBox(t,i,e,r,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,n)}updateBoundingBox(e,t,i,r,n){this._updateBoundingBox(e,t,i,r,n);const s=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(s)}distanceToBorder(e,t){e&&this.resize(e);const i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}};class fC extends hC{constructor(e,t,i){super(e,t,i),this.labelOffset=0,this.selected=!1}setOptions(e,t,i){this.options=e,void 0===t&&void 0===i||this.setImages(t,i)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){const t=e&&!this.selected||!e&&this.selected;if(this.selected=e,void 0!==this.imageObjAlt&&t){const e=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=e}}_getImagePadding(){const e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){const t=this.options.imagePadding;"object"==typeof t?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(!1===this.options.shapeProperties.useImageSize){let i=1,r=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?i=this.imageObj.width/this.imageObj.height:r=this.imageObj.height/this.imageObj.width),e=2*this.options.size*i,t=2*this.options.size*r}else{const i=this._getImagePadding();e=this.imageObj.width+i.left+i.right,t=this.imageObj.height+i.top+i.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,i,r){this.initContextForDraw(e,r),Ur(e,t,i,r.size),this.performFill(e,r)}_drawImageAtPosition(e,t){if(0!=this.imageObj.width){e.globalAlpha=void 0!==t.opacity?t.opacity:1,this.enableShadow(e,t);let i=1;!0===this.options.shapeProperties.interpolation&&(i=this.imageObj.width/this.width/this.body.view.scale);const r=this._getImagePadding(),n=this.left+r.left,s=this.top+r.top,o=this.width-r.left-r.right,a=this.height-r.top-r.bottom;this.imageObj.drawImageAtPosition(e,i,n,s,o,a),this.disableShadow(e,t)}}_drawImageLabel(e,t,i,r,n){let s=0;if(void 0!==this.height){s=.5*this.height;const t=this.labelModule.getTextSize(e,r,n);t.lineCount>=1&&(s+=t.height/2)}const o=i+s;this.options.label&&(this.labelOffset=s),this.labelModule.draw(e,t,o,r,n,"hanging")}}let mC=class extends fC{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const r=this.getDimensionsFromLabel(e,t,i),n=Math.max(r.width+this.margin.right+this.margin.left,r.height+this.margin.top+this.margin.bottom);this.options.size=n/2,this.width=n,this.height=n,this.radius=this.width/2}}draw(e,t,i,r,n,s){this.resize(e,r,n),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,s),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,r,n)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),.5*this.width}};class gC extends fC{constructor(e,t,i,r,n){super(e,t,i),this.setImages(r,n)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height){const e=2*this.options.size;return this.width=e,this.height=e,void(this.radius=.5*this.width)}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,r,n,s){this.switchImages(r),this.resize();let o=t,a=i;"top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=t,this.top=i,o+=this.width/2,a+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this._drawRawCircle(e,o,a,s),e.save(),e.clip(),this._drawImageAtPosition(e,s),e.restore(),this._drawImageLabel(e,o,a,r,n),this.updateBoundingBox(t,i)}updateBoundingBox(e,t){"top-left"===this.options.shapeProperties.coordinateOrigin?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+2*this.options.size,this.boundingBox.bottom=t+2*this.options.size):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+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)}distanceToBorder(e){return e&&this.resize(e),.5*this.width}}class yC extends hC{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){var n,s;this.labelModule.getTextSize(e,t,i);const o=2*r.size;this.width=null!==(n=this.customSizeWidth)&&void 0!==n?n:o,this.height=null!==(s=this.customSizeHeight)&&void 0!==s?s:o,this.radius=.5*this.width}}_drawShape(e,t,i,r,n,s,o,a){var l;return this.resize(e,s,o,a),this.left=r-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,a),(l=t,Object.prototype.hasOwnProperty.call(Gr,l)?Gr[l]:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r{if(void 0!==this.options.label){this.labelModule.calculateLabelSize(e,s,o,r,n,"hanging");const t=n+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,r,t,s,o,"hanging")}this.updateBoundingBox(r,n)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+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))}}function bC(e,t){var i=ed(e);if(ww){var r=ww(e);t&&(r=Bh(r).call(r,(function(t){return Ow(e,t).enumerable}))),i.push.apply(i,r)}return i}function vC(e){for(var t=1;t{e.save(),t(),e.restore()}}return o.nodeDimensions&&(this.customSizeWidth=o.nodeDimensions.width,this.customSizeHeight=o.nodeDimensions.height),o}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class xC extends hC{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){if(this.needsRefresh(t,i)){const r=this.getDimensionsFromLabel(e,t,i).width+this.margin.right+this.margin.left;this.width=r,this.height=r,this.radius=this.width/2}}draw(e,t,i,r,n,s){this.resize(e,r,n),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),Wr(e,t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,r,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,n)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let _C=class extends yC{constructor(e,t,i){super(e,t,i)}draw(e,t,i,r,n,s){return this._drawShape(e,"diamond",4,t,i,r,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class jC extends yC{constructor(e,t,i){super(e,t,i)}draw(e,t,i,r,n,s){return this._drawShape(e,"circle",2,t,i,r,n,s)}distanceToBorder(e){return e&&this.resize(e),this.options.size}}class CC extends hC{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const r=this.getDimensionsFromLabel(e,t,i);this.height=2*r.height,this.width=r.width+r.height,this.radius=.5*this.width}}draw(e,t,i,r,n,s){this.resize(e,r,n),this.left=t-.5*this.width,this.top=i-.5*this.height,this.initContextForDraw(e,s),Vr(e,this.left,this.top,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,r,n),this.labelModule.draw(e,t,i,r,n)}distanceToBorder(e,t){e&&this.resize(e);const i=.5*this.width,r=.5*this.height,n=Math.sin(t)*i,s=Math.cos(t)*r;return i*r/Math.sqrt(n*n+s*s)}}class kC extends hC{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(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)}draw(e,t,i,r,n,s){return this.resize(e,r,n),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,r,n,s),{drawExternalLabel:()=>{if(void 0!==this.options.label){const t=5;this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+t,r)}this.updateBoundingBox(t,i)}}}updateBoundingBox(e,t){if(this.boundingBox.top=t-.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=t+.5*this.options.icon.size,void 0!==this.options.label&&this.labelModule.size.width>0){const e=5;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+e)}}_icon(e,t,i,r,n,s){const o=Number(this.options.icon.size);void 0!==this.options.icon.code?(e.font=[null!=this.options.icon.weight?this.options.icon.weight:r?"bold":"",(null!=this.options.icon.weight&&r?5:0)+o+"px",this.options.icon.face].join(" "),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,s),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,s)):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.")}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let SC=class extends fC{constructor(e,t,i,r,n){super(e,t,i),this.setImages(r,n)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height){const e=2*this.options.size;return this.width=e,void(this.height=e)}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,r,n,s){e.save(),this.switchImages(r),this.resize();let o=t,a=i;if("top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=t,this.top=i,o+=this.width/2,a+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),!0===this.options.shapeProperties.useBorderWithImage){const t=this.options.borderWidth,i=this.options.borderWidthSelected||2*this.options.borderWidth,o=(r?i:t)/this.body.view.scale;e.lineWidth=Math.min(this.width,o),e.beginPath();let a=r?this.options.color.highlight.border:n?this.options.color.hover.border:this.options.color.border,l=r?this.options.color.highlight.background:n?this.options.color.hover.background:this.options.color.background;void 0!==s.opacity&&(a=Wg(a,s.opacity),l=Wg(l,s.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),gf(e).call(e),this.performStroke(e,s),e.closePath()}this._drawImageAtPosition(e,s),this._drawImageLabel(e,o,a,r,n),this.updateBoundingBox(t,i),e.restore()}updateBoundingBox(e,t){this.resize(),"top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-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))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class TC extends yC{constructor(e,t,i){super(e,t,i)}draw(e,t,i,r,n,s){return this._drawShape(e,"square",2,t,i,r,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class EC extends yC{constructor(e,t,i){super(e,t,i)}draw(e,t,i,r,n,s){return this._drawShape(e,"hexagon",4,t,i,r,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class OC extends yC{constructor(e,t,i){super(e,t,i)}draw(e,t,i,r,n,s){return this._drawShape(e,"star",4,t,i,r,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class DC extends hC{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),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)}draw(e,t,i,r,n,s){this.resize(e,r,n),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,n),this.disableShadow(e,s),this.updateBoundingBox(t,i,e,r,n)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let AC=class extends yC{constructor(e,t,i){super(e,t,i)}draw(e,t,i,r,n,s){return this._drawShape(e,"triangle",3,t,i,r,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class NC extends yC{constructor(e,t,i){super(e,t,i)}draw(e,t,i,r,n,s){return this._drawShape(e,"triangleDown",3,t,i,r,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}function IC(e,t){var i=ed(e);if(ww){var r=ww(e);t&&(r=Bh(r).call(r,(function(t){return Ow(e,t).enumerable}))),i.push.apply(i,r)}return i}function RC(e){for(var t=1;tnull!=t[e]);o.push("font"),Rg(o,e,s),e.color=Gg(e.color)}static parseOptions(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=arguments.length>4?arguments[4]:void 0;if(Rg(["color","fixed","shadow"],e,t,i),PC.checkMass(t),void 0!==e.opacity&&(PC.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),void 0!==t.opacity&&(PC.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&&!PC.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),iy(e,t,"shadow",r),void 0!==t.color&&null!==t.color){const i=Gg(t.color);Ag(e.color,i)}else!0===i&&null===t.color&&(e.color=ty(r.color));void 0!==t.fixed&&null!==t.fixed&&("boolean"==typeof t.fixed?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(void 0!==t.fixed.x&&"boolean"==typeof t.fixed.x&&(e.fixed.x=t.fixed.x),void 0!==t.fixed.y&&"boolean"==typeof t.fixed.y&&(e.fixed.y=t.fixed.y))),!0===i&&null===t.font&&(e.font=ty(r.font)),PC.updateGroupOptions(e,t,n),void 0!==t.scaling&&iy(e.scaling,t.scaling,"label",r.scaling)}getFormattingValues(){const 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){const t=this.options.opacity;e.borderColor=Wg(e.borderColor,t),e.color=Wg(e.color,t),e.shadowColor=Wg(e.shadowColor,t)}return e}updateLabelModule(e){void 0!==this.options.label&&null!==this.options.label||(this.options.label=""),PC.updateGroupOptions(this.options,RC(RC({},e),{},{color:e&&e.color||this._localColor||void 0}),this.grouplist);const t=this.grouplist.get(this.options.group,!1),i=[e,this.options,t,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,i),void 0!==this.labelModule.baseSize&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(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 pC(this.options,this.body,this.labelModule);break;case"circle":this.shape=new mC(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new gC(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new wC(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new xC(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new _C(this.options,this.body,this.labelModule);break;case"dot":this.shape=new jC(this.options,this.body,this.labelModule);break;case"ellipse":default:this.shape=new CC(this.options,this.body,this.labelModule);break;case"icon":this.shape=new kC(this.options,this.body,this.labelModule);break;case"image":this.shape=new SC(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new TC(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new EC(this.options,this.body,this.labelModule);break;case"star":this.shape=new OC(this.options,this.body,this.labelModule);break;case"text":this.shape=new DC(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new AC(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new NC(this.options,this.body,this.labelModule)}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,i){if(void 0!==this.options.value){const r=this.options.scaling.customScalingFunction(e,t,i,this.options.value),n=this.options.scaling.max-this.options.scaling.min;if(!0===this.options.scaling.label.enabled){const e=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+r*e}this.options.size=this.options.scaling.min+r*n}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){const t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){const t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){const t=[];return this.labelModule.visible()&&rC(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),rC(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.lefte.left&&this.shape.tope.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}static checkMass(e,t){if(void 0!==e.mass&&e.mass<=0){let i="";void 0!==t&&(i=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+i+", setting mass to 1.",gy),e.mass=1}}}class FC{constructor(e,t,i,r){var n;if(this.body=e,this.images=t,this.groups=i,this.layoutEngine=r,this.body.functions.createNode=zr(n=this.create).call(n,this),this.nodesListeners={add:(e,t)=>{this.add(t.items)},update:(e,t)=>{this.update(t.items,t.data,t.oldData)},remove:(e,t)=>{this.remove(t.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,t,i,r){if(t===e)return.5;{const i=1/(t-e);return Math.max(0,(r-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=ty(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on("refreshNodes",zr(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",zr(t=this.refresh).call(t,this)),this.body.emitter.on("destroy",()=>{zg(this.nodesListeners,(e,t)=>{this.body.data.nodes&&this.body.data.nodes.off(t,e)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(void 0!==e){if(PC.parseOptions(this.options,e),void 0!==e.opacity&&(cw(e.opacity)||!hw(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(const e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].updateShape();if(void 0!==e.font||void 0!==e.widthConstraint||void 0!==e.heightConstraint)for(const e of ed(this.body.nodes))this.body.nodes[e].updateLabelModule(),this.body.nodes[e].needsRefresh();if(void 0!==e.size)for(const e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].needsRefresh();void 0===e.hidden&&void 0===e.physics||this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.body.data.nodes;if(Mj("id",e))this.body.data.nodes=e;else if(Wu(e))this.body.data.nodes=new Rj,this.body.data.nodes.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.nodes=new Rj}if(i&&zg(this.nodesListeners,(function(e,t){i.off(t,e)})),this.body.nodes={},this.body.data.nodes){const e=this;zg(this.nodesListeners,(function(t,i){e.body.data.nodes.on(i,t)}));const t=this.body.data.nodes.getIds();this.add(t,!0)}!1===t&&this.body.emitter.emit("_dataChanged")}add(e){let t,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=[];for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:PC)(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];zg(this.body.nodes,(t,i)=>{const r=this.body.data.nodes.get(i);void 0!==r&&(!0===e&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(r))})}getPositions(e){const t={};if(void 0!==e){if(!0===Wu(e)){for(let i=0;i{this.body.emitter.emit("startSimulation")},0)):console.error("Node id supplied to moveNode does not exist. Provided: ",e)}}var MC=Oi,LC=Math.hypot,BC=Math.abs,zC=Math.sqrt;MC({target:"Math",stat:!0,arity:2,forced:!!LC&&LC(1/0,NaN)!==1/0},{hypot:function(e,t){for(var i,r,n=0,s=0,o=arguments.length,a=0;s0?(r=i/a)*r:i;return a===1/0?1/0:a*zC(n)}});var UC=r(ie.Math.hypot);class qC{static transform(e,t){Wu(e)||(e=[e]);const i=t.point.x,r=t.point.y,n=t.angle,s=t.length;for(let o=0;o4&&void 0!==arguments[4]?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,!1!==t.dashes?this._drawDashedLine(e,t,n):this._drawLine(e,t,n)}_drawLine(e,t,i,r,n){if(this.from!=this.to)this._line(e,t,i,r,n);else{const[i,r,n]=this._getCircleData(e);this._circle(e,t,i,r,n)}}_drawDashedLine(e,t,i,r,n){e.lineCap="round";const s=Wu(t.dashes)?t.dashes:[5,5];if(void 0!==e.setLineDash){if(e.save(),e.setLineDash(s),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,i);else{const[i,r,n]=this._getCircleData(e);this._circle(e,t,i,r,n)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)Hr(e,this.from.x,this.from.y,this.to.x,this.to.y,s);else{const[i,r,n]=this._getCircleData(e);this._circle(e,t,i,r,n)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,i){return this.from!=this.to?this._findBorderPosition(e,t,i):this._findBorderPositionCircle(e,t,i)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;const[i,r]=Fu(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:i,y:r,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:i,y:r,low:.6,high:.8,direction:1})}}}_getCircleData(e){const t=this.options.selfReference.size;void 0!==e&&void 0===this.from.shape.width&&this.from.shape.resize(e);const i=sC(e,this.options.selfReference.angle,t,this.from);return[i.x,i.y,t]}_pointOnCircle(e,t,i,r){const n=2*r*Math.PI;return{x:e+i*Math.cos(n),y:t-i*Math.sin(n)}}_findBorderPositionCircle(e,t,i){const r=i.x,n=i.y;let s=i.low,o=i.high;const a=i.direction,l=this.options.selfReference.size;let c,u=.5*(s+o),d=0;!0===this.options.arrowStrikethrough&&(-1===a?d=this.options.endPointOffset.from:1===a&&(d=this.options.endPointOffset.to));let h=0;do{u=.5*(s+o),c=this._pointOnCircle(r,n,l,u);const i=Math.atan2(e.y-c.y,e.x-c.x),p=e.distanceToBorder(t,i)+d-Math.sqrt(Math.pow(c.x-e.x,2)+Math.pow(c.y-e.y,2));if(Math.abs(p)<.05)break;p>0?a>0?s=u:o=u:a>0?o=u:s=u,++h}while(s<=o&&h<10);return rk(rk({},c),{},{t:u})}getLineWidth(e,t){return!0===e?Math.max(this.selectionWidth,.3/this._body.view.scale):!0===t?Math.max(this.hoverWidth,.3/this._body.view.scale):Math.max(this.options.width,.3/this._body.view.scale)}getColor(e,t){if(!1!==t.inheritsColor){if("both"===t.inheritsColor&&this.from.id!==this.to.id){const i=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y);let r=this.from.options.color.highlight.border,n=this.to.options.color.highlight.border;return!1===this.from.selected&&!1===this.to.selected?(r=Wg(this.from.options.color.border,t.opacity),n=Wg(this.to.options.color.border,t.opacity)):!0===this.from.selected&&!1===this.to.selected?n=this.to.options.color.border:!1===this.from.selected&&!0===this.to.selected&&(r=this.from.options.color.border),i.addColorStop(0,r),i.addColorStop(1,n),i}return"to"===t.inheritsColor?Wg(this.to.options.color.border,t.opacity):Wg(this.from.options.color.border,t.opacity)}return Wg(t.color,t.opacity)}_circle(e,t,i,r,n){this.enableShadow(e,t);let s=0,o=2*Math.PI;if(!this.options.selfReference.renderBehindTheNode){const t=this.options.selfReference.angle,n=this.options.selfReference.angle+Math.PI,a=this._findBorderPositionCircle(this.from,e,{x:i,y:r,low:t,high:n,direction:-1}),l=this._findBorderPositionCircle(this.from,e,{x:i,y:r,low:t,high:n,direction:1});s=Math.atan2(a.y-r,a.x-i),o=Math.atan2(l.y-r,l.x-i)}e.beginPath(),e.arc(i,r,n,s,o,!1),e.stroke(),this.disableShadow(e,t)}getDistanceToEdge(e,t,i,r,n,s){if(this.from!=this.to)return this._getDistanceToEdge(e,t,i,r,n,s);{const[e,t,i]=this._getCircleData(void 0),r=e-n,o=t-s;return Math.abs(Math.sqrt(r*r+o*o)-i)}}_getDistanceToLine(e,t,i,r,n,s){const o=i-e,a=r-t;let l=((n-e)*o+(s-t)*a)/(o*o+a*a);l>1?l=1:l<0&&(l=0);const c=e+l*o-n,u=t+l*a-s;return Math.sqrt(c*c+u*u)}getArrowData(e,t,i,r,n,s){let o,a,l,c,u,d,h;const p=s.width;"from"===t?(l=this.from,c=this.to,u=s.fromArrowScale<0,d=Math.abs(s.fromArrowScale),h=s.fromArrowType):"to"===t?(l=this.to,c=this.from,u=s.toArrowScale<0,d=Math.abs(s.toArrowScale),h=s.toArrowType):(l=this.to,c=this.from,u=s.middleArrowScale<0,d=Math.abs(s.middleArrowScale),h=s.middleArrowType);const f=15*d+3*p;if(l!=c){const r=f/UC(l.x-c.x,l.y-c.y);if("middle"!==t)if(!0===this.options.smooth.enabled){const n=this._findBorderPosition(l,e,{via:i}),s=this.getPoint(n.t+r*("from"===t?1:-1),i);o=Math.atan2(n.y-s.y,n.x-s.x),a=n}else o=Math.atan2(l.y-c.y,l.x-c.x),a=this._findBorderPosition(l,e);else{const e=(u?-r:r)/2,t=this.getPoint(.5+e,i),n=this.getPoint(.5-e,i);o=Math.atan2(t.y-n.y,t.x-n.x),a=this.getPoint(.5,i)}}else{const[i,r,n]=this._getCircleData(e);if("from"===t){const t=this.options.selfReference.angle,n=this.options.selfReference.angle+Math.PI,s=this._findBorderPositionCircle(this.from,e,{x:i,y:r,low:t,high:n,direction:-1});o=-2*s.t*Math.PI+1.5*Math.PI+.1*Math.PI,a=s}else if("to"===t){const t=this.options.selfReference.angle,n=this.options.selfReference.angle+Math.PI,s=this._findBorderPositionCircle(this.from,e,{x:i,y:r,low:t,high:n,direction:1});o=-2*s.t*Math.PI+1.5*Math.PI-1.1*Math.PI,a=s}else{const e=this.options.selfReference.angle/(2*Math.PI);a=this._pointOnCircle(i,r,n,e),o=-2*e*Math.PI+1.5*Math.PI+.1*Math.PI}}return{point:a,core:{x:a.x-.9*f*Math.cos(o),y:a.y-.9*f*Math.sin(o)},angle:o,length:f,type:h}}drawArrowHead(e,t,i,r,n){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,tk.draw(e,n)&&(this.enableShadow(e,t),gf(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){!0===t.shadow&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){!0===t.shadow&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(!1!==t.background){const i={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=i.strokeStyle,e.lineWidth=i.lineWidth,e.dashes=i.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(!1!==t)if(void 0!==e.setLineDash){const i=Wu(t)?t:[5,5];e.setLineDash(i)}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.")}}function sk(e,t){var i=ed(e);if(ww){var r=ww(e);t&&(r=Bh(r).call(r,(function(t){return Ow(e,t).enumerable}))),i.push.apply(i,r)}return i}function ok(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:this._getViaCoordinates(),s=!1,o=1,a=0,l=this.to,c=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(l=this.from,s=!0,c=this.options.endPointOffset?this.options.endPointOffset.from:0),!1===this.options.arrowStrikethrough&&(c=0);let u=0;do{r=.5*(a+o),i=this.getPoint(r,n);const e=Math.atan2(l.y-i.y,l.x-i.x),d=l.distanceToBorder(t,e)+c-Math.sqrt(Math.pow(i.x-l.x,2)+Math.pow(i.y-l.y,2));if(Math.abs(d)<.2)break;d<0?!1===s?a=r:o=r:!1===s?o=r:a=r,++u}while(a<=o&&u<10);return ok(ok({},i),{},{t:r})}_getDistanceToBezierEdge(e,t,i,r,n,s,o){let a,l,c,u,d,h=1e9,p=e,f=t;for(l=1;l<10;l++)c=.1*l,u=Math.pow(1-c,2)*e+2*c*(1-c)*o.x+Math.pow(c,2)*i,d=Math.pow(1-c,2)*t+2*c*(1-c)*o.y+Math.pow(c,2)*r,l>0&&(a=this._getDistanceToLine(p,f,u,d,n,s),h=a{this.positionBezierNode()},this._body.emitter.on("_repositionBezierNodes",this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!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===t&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){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})}cleanup(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),void 0!==this.via&&(delete this._body.nodes[this.via.id],this.via=void 0,!0)}setupSupportNode(){if(void 0===this.via){const e="edgeId:"+this.id,t=this._body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){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)}_line(e,t,i){this._bezierCurve(e,t,i)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.via;if(this.from===this.to){const[t,i,r]=this._getCircleData(),n=2*Math.PI*(1-e);return{x:t+r*Math.sin(n),y:i+r-r*(1-Math.cos(n))}}return{x:Math.pow(1-e,2)*this.fromPoint.x+2*e*(1-e)*t.x+Math.pow(e,2)*this.toPoint.x,y:Math.pow(1-e,2)*this.fromPoint.y+2*e*(1-e)*t.y+Math.pow(e,2)*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,i,r,n,s){return this._getDistanceToBezierEdge(e,t,i,r,n,s,this.via)}}class ck extends ak{constructor(e,t,i){super(e,t,i)}_line(e,t,i){this._bezierCurve(e,t,i)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){const e=this.options.smooth.roundness,t=this.options.smooth.type;let i=Math.abs(this.from.x-this.to.x),r=Math.abs(this.from.y-this.to.y);if("discrete"===t||"diagonalCross"===t){let n,s;n=s=i<=r?e*r:e*i,this.from.x>this.to.x&&(n=-n),this.from.y>=this.to.y&&(s=-s);let o=this.from.x+n,a=this.from.y+s;return"discrete"===t&&(i<=r?o=ithis.to.x&&(t=-t),this.from.y>=this.to.y&&(n=-n);let s=this.from.x+t,o=this.from.y+n;return i<=r?s=this.from.x<=this.to.x?this.to.xs?this.to.x:s:o=this.from.y>=this.to.y?this.to.y>o?this.to.y:o:this.to.y2&&void 0!==arguments[2]?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}_getDistanceToEdge(e,t,i,r,n,s){let o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,r,n,s,o)}getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates();const i=e;return{x:Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,y:Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y}}}class uk extends ak{constructor(e,t,i){super(e,t,i)}_getDistanceToBezierEdge2(e,t,i,r,n,s,o,a){let l=1e9,c=e,u=t;const d=[0,0,0,0];for(let h=1;h<10;h++){const p=.1*h;d[0]=Math.pow(1-p,3),d[1]=3*p*Math.pow(1-p,2),d[2]=3*Math.pow(p,2)*(1-p),d[3]=Math.pow(p,3);const f=d[0]*e+d[1]*o.x+d[2]*a.x+d[3]*i,m=d[0]*t+d[1]*o.y+d[2]*a.y+d[3]*r;if(h>0){const e=this._getDistanceToLine(c,u,f,m,n,s);l=eMath.abs(t)||!0===this.options.smooth.forceDirection||"horizontal"===this.options.smooth.forceDirection)&&"vertical"!==this.options.smooth.forceDirection?(r=this.from.y,s=this.to.y,i=this.from.x-o*e,n=this.to.x+o*e):(r=this.from.y-o*t,s=this.to.y+o*t,i=this.from.x,n=this.to.x),[{x:i,y:r},{x:n,y:s}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,i,r,n,s){let[o,a]=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,i,r,n,s,o,a)}getPoint(e){let[t,i]=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates();const r=e,n=[Math.pow(1-r,3),3*r*Math.pow(1-r,2),3*Math.pow(r,2)*(1-r),Math.pow(r,3)];return{x:n[0]*this.fromPoint.x+n[1]*t.x+n[2]*i.x+n[3]*this.toPoint.x,y:n[0]*this.fromPoint.y+n[1]*t.y+n[2]*i.y+n[3]*this.toPoint.y}}}class hk extends nk{constructor(e,t,i){super(e,t,i)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let i=this.to,r=this.from;e.id===this.from.id&&(i=this.from,r=this.to);const n=Math.atan2(i.y-r.y,i.x-r.x),s=i.x-r.x,o=i.y-r.y,a=Math.sqrt(s*s+o*o),l=(a-e.distanceToBorder(t,n))/a;return{x:(1-l)*r.x+l*i.x,y:(1-l)*r.y+l*i.y,t:0}}_getDistanceToEdge(e,t,i,r,n,s){return this._getDistanceToLine(e,t,i,r,n,s)}}class pk{constructor(e,t,i,r,n){if(void 0===t)throw new Error("No body provided");this.options=ty(r),this.globalOptions=r,this.defaultOptions=n,this.body=t,this.imagelist=i,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 dC(this.body,this.options,!0),this.setOptions(e)}setOptions(e){if(!e)return;let t=void 0!==e.physics&&this.options.physics!==e.physics||void 0!==e.hidden&&(this.options.hidden||!1)!==(e.hidden||!1)||void 0!==e.from&&this.options.from!==e.from||void 0!==e.to&&this.options.to!==e.to;pk.parseOptions(this.options,e,!0,this.globalOptions),void 0!==e.id&&(this.id=e.id),void 0!==e.from&&(this.fromId=e.from),void 0!==e.to&&(this.toId=e.to),void 0!==e.title&&(this.title=e.title),void 0!==e.value&&(e.value=Kj(e.value));const i=[e,this.options,this.defaultOptions];return this.chooser=iC("edge",i),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}static parseOptions(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(Ig(["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"],e,t,i),void 0!==t.endPointOffset&&void 0!==t.endPointOffset.from&&(hw(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=void 0!==r.endPointOffset.from?r.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),void 0!==t.endPointOffset&&void 0!==t.endPointOffset.to&&(hw(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=void 0!==r.endPointOffset.to?r.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),nC(t.label)?e.label=t.label:nC(e.label)||(e.label=void 0),iy(e,t,"smooth",r),iy(e,t,"shadow",r),iy(e,t,"background",r),void 0!==t.dashes&&null!==t.dashes?e.dashes=t.dashes:!0===i&&null===t.dashes&&(e.dashes=Pp(r.dashes)),void 0!==t.scaling&&null!==t.scaling?(void 0!==t.scaling.min&&(e.scaling.min=t.scaling.min),void 0!==t.scaling.max&&(e.scaling.max=t.scaling.max),iy(e.scaling,t.scaling,"label",r.scaling)):!0===i&&null===t.scaling&&(e.scaling=Pp(r.scaling)),void 0!==t.arrows&&null!==t.arrows)if("string"==typeof t.arrows){const i=t.arrows.toLowerCase();e.arrows.to.enabled=-1!=Ap(i).call(i,"to"),e.arrows.middle.enabled=-1!=Ap(i).call(i,"middle"),e.arrows.from.enabled=-1!=Ap(i).call(i,"from")}else{if("object"!=typeof t.arrows)throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+Bp(t.arrows));iy(e.arrows,t.arrows,"to",r.arrows),iy(e.arrows,t.arrows,"middle",r.arrows),iy(e.arrows,t.arrows,"from",r.arrows)}else!0===i&&null===t.arrows&&(e.arrows=Pp(r.arrows));if(void 0!==t.color&&null!==t.color){const s=Eg(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,o=e.color;if(n)Pg(o,r.color,!1,i);else for(const e in o)Object.prototype.hasOwnProperty.call(o,e)&&delete o[e];if(Eg(o))o.color=o,o.highlight=o,o.hover=o,o.inherit=!1,void 0===s.opacity&&(o.opacity=1);else{let e=!1;void 0!==s.color&&(o.color=s.color,e=!0),void 0!==s.highlight&&(o.highlight=s.highlight,e=!0),void 0!==s.hover&&(o.hover=s.hover,e=!0),void 0!==s.inherit&&(o.inherit=s.inherit),void 0!==s.opacity&&(o.opacity=Math.min(1,Math.max(0,s.opacity))),!0===e?o.inherit=!1:void 0===o.inherit&&(o.inherit="from")}}else!0===i&&null===t.color&&(e.color=ty(r.color));!0===i&&null===t.font&&(e.font=ty(r.font)),Object.prototype.hasOwnProperty.call(t,"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=t.selfReferenceSize)}getFormattingValues(){const e=!0===this.options.arrows.to||!0===this.options.arrows.to.enabled,t=!0===this.options.arrows.from||!0===this.options.arrows.from.enabled,i=!0===this.options.arrows.middle||!0===this.options.arrows.middle.enabled,r=this.options.color.inherit,n={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:i,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:t,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:r?void 0:this.options.color.color,inheritsColor:r,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){const e=this.options.selectionWidth;"function"==typeof e?n.width=e(n.width):"number"==typeof e&&(n.width+=e),n.width=Math.max(n.width,.3/this.body.view.scale),n.color=this.options.color.highlight,n.shadow=this.options.shadow.enabled}else if(this.hover){const e=this.options.hoverWidth;"function"==typeof e?n.width=e(n.width):"number"==typeof e&&(n.width+=e),n.width=Math.max(n.width,.3/this.body.view.scale),n.color=this.options.color.hover,n.shadow=this.options.shadow.enabled}}else"function"==typeof this.chooser&&(this.chooser(n,this.options.id,this.selected,this.hover),void 0!==n.color&&(n.inheritsColor=!1),!1===n.shadow&&(n.shadowColor===this.options.shadow.color&&n.shadowSize===this.options.shadow.size&&n.shadowX===this.options.shadow.x&&n.shadowY===this.options.shadow.y||(n.shadow=!0)));else n.shadow=this.options.shadow.enabled,n.width=Math.max(n.width,.3/this.body.view.scale);return n}updateLabelModule(e){const t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),void 0!==this.labelModule.baseSize&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){const e=this.options.smooth;let t=!1,i=!0;return void 0!==this.edgeType&&((this.edgeType instanceof lk&&!0===e.enabled&&"dynamic"===e.type||this.edgeType instanceof dk&&!0===e.enabled&&"cubicBezier"===e.type||this.edgeType instanceof ck&&!0===e.enabled&&"dynamic"!==e.type&&"cubicBezier"!==e.type||this.edgeType instanceof hk&&!1===e.type.enabled)&&(i=!1),!0===i&&(t=this.cleanup())),!0===i?!0===e.enabled?"dynamic"===e.type?(t=!0,this.edgeType=new lk(this.options,this.body,this.labelModule)):"cubicBezier"===e.type?this.edgeType=new dk(this.options,this.body,this.labelModule):this.edgeType=new ck(this.options,this.body,this.labelModule):this.edgeType=new hk(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){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()}disconnect(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,i){if(void 0!==this.options.value){const r=this.options.scaling.customScalingFunction(e,t,i,this.options.value),n=this.options.scaling.max-this.options.scaling.min;if(!0===this.options.scaling.label.enabled){const e=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+r*e}this.options.width=this.options.scaling.min+r*n}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){"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}draw(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,i),this.drawLabel(e,i)}drawArrows(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode(),r={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(r.from=this.edgeType.getArrowData(e,"from",i,this.selected,this.hover,t),!1===t.arrowStrikethrough&&(this.edgeType.fromPoint=r.from.core),t.fromArrowSrc&&(r.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(r.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(r.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(r.to=this.edgeType.getArrowData(e,"to",i,this.selected,this.hover,t),!1===t.arrowStrikethrough&&(this.edgeType.toPoint=r.to.core),t.toArrowSrc&&(r.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(r.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(r.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(r.middle=this.edgeType.getArrowData(e,"middle",i,this.selected,this.hover,t),t.middleArrowSrc&&(r.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(r.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(r.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.to)}drawLabel(e,t){if(void 0!==this.options.label){const i=this.from,r=this.to;let n;if(this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover),i.id!=r.id){this.labelModule.pointToSelf=!1,n=this.edgeType.getPoint(.5,t),e.save();const i=this._getRotation(e);0!=i.angle&&(e.translate(i.x,i.y),e.rotate(i.angle)),this.labelModule.draw(e,n.x,n.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;const t=sC(e,this.options.selfReference.angle,this.options.selfReference.size,i);n=this._pointOnCircle(t.x,t.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,n.x,n.y,this.selected,this.hover)}}}getItemsOnPoint(e){const t=[];if(this.labelModule.visible()){const i=this._getRotation();rC(this.labelModule.getSize(),e,i)&&t.push({edgeId:this.id,labelId:0})}const i={left:e.x,top:e.y};return this.isOverlappingWith(i)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){const t=10,i=this.from.x,r=this.from.y,n=this.to.x,s=this.to.y,o=e.left,a=e.top;return this.edgeType.getDistanceToEdge(i,r,n,s,o,a)0&&s<0)&&(o+=Math.PI),r.angle=o,r}_pointOnCircle(e,t,i,r){return{x:e+i*Math.cos(r),y:t-i*Math.sin(r)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return void 0!==this.body.nodes[this.fromId]&&void 0!==this.body.nodes[this.toId]}}class fk{constructor(e,t,i){var r;this.body=e,this.images=t,this.groups=i,this.body.functions.createEdge=zr(r=this.create).call(r,this),this.edgesListeners={add:(e,t)=>{this.add(t.items)},update:(e,t)=>{this.update(t.items)},remove:(e,t)=>{this.remove(t.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,t,i,r){if(t===e)return.5;{const i=1/(t-e);return Math.max(0,(r-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},Pg(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t,i=this;this.body.emitter.on("_forceDisableDynamicCurves",(function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"dynamic"===e&&(e="continuous");let r=!1;for(const n in i.body.edges)if(Object.prototype.hasOwnProperty.call(i.body.edges,n)){const t=i.body.edges[n],s=i.body.data.edges.get(n);if(null!=s){const i=s.smooth;void 0!==i&&!0===i.enabled&&"dynamic"===i.type&&(void 0===e?t.setOptions({smooth:!1}):t.setOptions({smooth:{type:e}}),r=!0)}}!0===t&&!0===r&&i.body.emitter.emit("_dataChanged")})),this.body.emitter.on("_dataUpdated",()=>{this.reconnectEdges()}),this.body.emitter.on("refreshEdges",zr(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",zr(t=this.refresh).call(t,this)),this.body.emitter.on("destroy",()=>{zg(this.edgesListeners,(e,t)=>{this.body.data.edges&&this.body.data.edges.off(t,e)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(void 0!==e){pk.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(void 0!==e.smooth)for(const e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&(t=this.body.edges[e].updateEdgeType()||t);if(void 0!==e.font)for(const e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&this.body.edges[e].updateLabelModule();void 0===e.hidden&&void 0===e.physics&&!0!==t||this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.body.data.edges;if(Mj("id",e))this.body.data.edges=e;else if(Wu(e))this.body.data.edges=new Rj,this.body.data.edges.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.edges=new Rj}if(i&&zg(this.edgesListeners,(e,t)=>{i.off(t,e)}),this.body.edges={},this.body.data.edges){zg(this.edgesListeners,(e,t)=>{this.body.data.edges.on(t,e)});const e=this.body.data.edges.getIds();this.add(e,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),!1===t&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.body.edges,r=this.body.data.edges;for(let n=0;n1&&void 0!==arguments[1])||arguments[1];if(0===e.length)return;const i=this.body.edges;zg(e,e=>{const t=i[e];void 0!==t&&t.remove()}),t&&this.body.emitter.emit("_dataChanged")}refresh(){zg(this.body.edges,(e,t)=>{const i=this.body.data.edges.get(t);void 0!==i&&e.setOptions(i)})}create(e){return new pk(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e;const t=this.body.nodes,i=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const t=i[e];t.from=null,t.to=null,t.connect()}}getConnectedNodes(e){const t=[];if(void 0!==this.body.edges[e]){const i=this.body.edges[e];void 0!==i.fromId&&t.push(i.fromId),void 0!==i.toId&&t.push(i.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){const e=[];zg(this.body.edges,(t,i)=>{const r=this.body.nodes[t.toId],n=this.body.nodes[t.fromId];void 0!==r&&!0===r.isCluster||void 0!==n&&!0===n.isCluster||void 0!==r&&void 0!==n||e.push(i)}),this.remove(e,!1)}_addMissingEdges(){const e=this.body.data.edges;if(null==e)return;const t=this.body.edges,i=[];yd(e).call(e,(e,r)=>{void 0===t[r]&&i.push(r)}),this.add(i,!0)}}class mk{constructor(e,t,i){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(i),this._rng=bg("BARNES HUT SOLVER")}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(0!==this.options.gravitationalConstant&&this.physicsBody.physicsNodeIndices.length>0){let e;const t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,r=i.length,n=this._formBarnesHutTree(t,i);this.barnesHutTree=n;for(let s=0;s0&&this._getForceContributions(n.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){const i=e.centerOfMass.x-t.x,r=e.centerOfMass.y-t.y,n=Math.sqrt(i*i+r*r);n*e.calcSize>this.thetaInversed?this._calculateForces(n,i,r,t,e):4===e.childrenCount?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(n,i,r,t,e)}}_calculateForces(e,t,i,r,n){0===e&&(t=e=.1),this.overlapAvoidanceFactor<1&&r.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*r.shape.radius,e-r.shape.radius));const s=this.options.gravitationalConstant*n.mass*r.options.mass/Math.pow(e,3),o=t*s,a=i*s;this.physicsBody.forces[r.id].x+=o,this.physicsBody.forces[r.id].y+=a}_formBarnesHutTree(e,t){let i;const r=t.length;let n=e[t[0]].x,s=e[t[0]].y,o=e[t[0]].x,a=e[t[0]].y;for(let f=1;f0&&(ro&&(o=r),la&&(a=l))}const l=Math.abs(o-n)-Math.abs(a-s);l>0?(s-=.5*l,a+=.5*l):(n+=.5*l,o-=.5*l);const c=Math.max(1e-5,Math.abs(o-n)),u=.5*c,d=.5*(n+o),h=.5*(s+a),p={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:d-u,maxX:d+u,minY:h-u,maxY:h+u},size:c,calcSize:1/c,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(p.root);for(let f=0;f0&&this._placeInTree(p.root,i);return p}_updateBranchMass(e,t){const i=e.centerOfMass,r=e.mass+t.options.mass,n=1/r;i.x=i.x*e.mass+t.x*t.options.mass,i.x*=n,i.y=i.y*e.mass+t.y*t.options.mass,i.y*=n,e.mass=r;const s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?r.maxY>t.y?"NW":"SW":r.maxY>t.y?"NE":"SE",this._placeInRegion(e,t,n)}_placeInRegion(e,t,i){const r=e.children[i];switch(r.childrenCount){case 0:r.children.data=t,r.childrenCount=1,this._updateBranchMass(r,t);break;case 1:r.children.data.x===t.x&&r.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(r),this._placeInTree(r,t));break;case 4:this._placeInTree(r,t)}}_splitBranch(e){let t=null;1===e.childrenCount&&(t=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!=t&&this._placeInTree(e,t)}_insertRegion(e,t){let i,r,n,s;const o=.5*e.size;switch(t){case"NW":i=e.range.minX,r=e.range.minX+o,n=e.range.minY,s=e.range.minY+o;break;case"NE":i=e.range.minX+o,r=e.range.maxX,n=e.range.minY,s=e.range.minY+o;break;case"SW":i=e.range.minX,r=e.range.minX+o,n=e.range.minY+o,s=e.range.maxY;break;case"SE":i=e.range.minX+o,r=e.range.maxX,n=e.range.minY+o,s=e.range.maxY}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:r,minY:n,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){void 0!==this.barnesHutTree&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,i){void 0===i&&(i="#FF0000"),4===e.childrenCount&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}class gk{constructor(e,t,i){this._rng=bg("REPULSION SOLVER"),this.body=e,this.physicsBody=t,this.setOptions(i)}setOptions(e){this.options=e}solve(){let e,t,i,r,n,s,o,a;const l=this.body.nodes,c=this.physicsBody.physicsNodeIndices,u=this.physicsBody.forces,d=this.options.nodeDistance,h=-2/3/d;for(let p=0;p0){const e=n.edges.length+1,s=this.options.centralGravity*e*n.options.mass;r[n.id].x=t*s,r[n.id].y=i*s}}}class jk{constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},vr(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("initPhysics",()=>{this.initPhysics()}),this.body.emitter.on("_layoutFailed",()=>{this.layoutFailed=!0}),this.body.emitter.on("resetPhysics",()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on("disablePhysics",()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on("restorePhysics",()=>{this.setOptions(this.options),!0===this.ready&&this.startSimulation()}),this.body.emitter.on("startSimulation",()=>{!0===this.ready&&this.startSimulation()}),this.body.emitter.on("stopSimulation",()=>{this.stopSimulation()}),this.body.emitter.on("destroy",()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on("_dataChanged",()=>{this.updatePhysicsData()})}setOptions(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,Rg(["stabilization"],this.options,e),iy(this.options,e,"stabilization"),void 0===e.enabled&&(this.options.enabled=!0),!1===this.options.enabled&&(this.physicsEnabled=!1,this.stopSimulation());const t=this.options.wind;t&&(("number"!=typeof t.x||cw(t.x))&&(t.x=0),("number"!=typeof t.y||cw(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;"forceAtlas2Based"===this.options.solver?(e=this.options.forceAtlas2Based,this.nodesSolver=new xk(this.body,this.physicsBody,e),this.edgesSolver=new bk(this.body,this.physicsBody,e),this.gravitySolver=new _k(this.body,this.physicsBody,e)):"repulsion"===this.options.solver?(e=this.options.repulsion,this.nodesSolver=new gk(this.body,this.physicsBody,e),this.edgesSolver=new bk(this.body,this.physicsBody,e),this.gravitySolver=new wk(this.body,this.physicsBody,e)):"hierarchicalRepulsion"===this.options.solver?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new yk(this.body,this.physicsBody,e),this.edgesSolver=new vk(this.body,this.physicsBody,e),this.gravitySolver=new wk(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new mk(this.body,this.physicsBody,e),this.edgesSolver=new bk(this.body,this.physicsBody,e),this.gravitySolver=new wk(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){!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"))}startSimulation(){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=zr(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))):this.body.emitter.emit("_redraw")}stopSimulation(){let 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"))}simulationStep(){const e=nd();this.physicsTick(),(nd()-e<.4*this.simulationInterval||!0===this.runDoubleSpeed)&&!1===this.stabilized&&(this.physicsTick(),this.runDoubleSpeed=!0),!0===this.stabilized&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||!0===this.startedStabilization)&&sf(()=>{this.body.emitter.emit("stabilized",{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){!0===this._evaluateStepQuality()?this.timestep=1.2*this.timestep:this.timestep/1.2.3))return!1;return!0}moveNodes(){const e=this.physicsBody.physicsNodeIndices;let t=0,i=0;for(let r=0;rr&&(e=e>0?r:-r),e}_performStep(e){const t=this.body.nodes[e],i=this.physicsBody.forces[e];this.options.wind&&(i.x+=this.options.wind.x,i.y+=this.options.wind.y);const r=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:r.x,vy:r.y},!1===t.options.fixed.x?(r.x=this.calculateComponentVelocity(r.x,i.x,t.options.mass),t.x+=r.x*this.timestep):(i.x=0,r.x=0),!1===t.options.fixed.y?(r.y=this.calculateComponentVelocity(r.y,i.y,t.options.mass),t.y+=r.y*this.timestep):(i.y=0,r.y=0),Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))}_freezeNodes(){const e=this.body.nodes;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){const i=e[t].options.fixed;this.freezeCache[t]={x:i.x,y:i.y},i.x=!0,i.y=!0}}_restoreFrozenNodes(){const e=this.body.nodes;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&void 0!==this.freezeCache[t]&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.stabilization.iterations;"number"!=typeof e&&(e=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",e)),0!==this.physicsBody.physicsNodeIndices.length?(this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,!0===this.options.stabilization.onlyDynamicEdges&&this._freezeNodes(),this.stabilizationIterations=0,sf(()=>this._stabilizationBatch(),0)):this.ready=!0}_startStabilizing(){return!0!==this.startedStabilization&&(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}_stabilizationBatch(){const e=()=>!1===this.stabilized&&this.stabilizationIterations{this.body.emitter.emit("stabilizationProgress",{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let i=0;for(;e()&&i1&&void 0!==arguments[1]?arguments[1]:[],r=1e9,n=-1e9,s=1e9,o=-1e9;if(i.length>0)for(let a=0;at.shape.boundingBox.left&&(s=t.shape.boundingBox.left),ot.shape.boundingBox.top&&(r=t.shape.boundingBox.top),n1&&void 0!==arguments[1]?arguments[1]:[],r=1e9,n=-1e9,s=1e9,o=-1e9;if(i.length>0)for(let a=0;at.x&&(s=t.x),ot.y&&(r=t.y),n{delete this.containedEdges[e.id]}),zg(t.containedNodes,(e,t)=>{this.containedNodes[t]=e}),t.containedNodes={},zg(t.containedEdges,(e,t)=>{this.containedEdges[t]=e}),t.containedEdges={},zg(t.edges,e=>{zg(this.edges,t=>{var i,r;const n=Ap(i=t.clusteringEdgeReplacingIds).call(i,e.id);-1!==n&&(zg(e.clusteringEdgeReplacingIds,e=>{t.clusteringEdgeReplacingIds.push(e),this.body.edges[e].edgeReplacedById=t.id}),eh(r=t.clusteringEdgeReplacingIds).call(r,n,1))})}),t.edges=[]}}class Sk{constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},vr(this.options,this.defaultOptions),this.body.emitter.on("_resetData",()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){void 0===e?e=this._getHubSize():"object"==typeof e&&(t=this._checkOptions(e),e=this._getHubSize());const i=[];for(let r=0;r=e&&i.push(t.id)}for(let r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===e.joinCondition)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);const i={},r={};zg(this.body.nodes,(t,n)=>{t.options&&!0===e.joinCondition(t.options)&&(i[n]=t,zg(t.edges,e=>{void 0===this.clusteredEdges[e.id]&&(r[e.id]=e)}))}),this._cluster(i,r,e,t)}clusterByEdgeCount(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=this._checkOptions(t);const r=[],n={};let s,o,a;for(let l=0;l0&&ed(c).length>0&&!0===a){const e=function(){for(let e=0;e1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var i;let r=!(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!");const n=this.body.nodes[e];void 0===(t=this._checkOptions(t,n)).clusterNodeProperties.x&&(t.clusterNodeProperties.x=n.x),void 0===t.clusterNodeProperties.y&&(t.clusterNodeProperties.y=n.y),void 0===t.clusterNodeProperties.fixed&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=n.options.fixed.x,t.clusterNodeProperties.fixed.y=n.options.fixed.y);const s={},o={},a=n.id,l=Ck.cloneOptions(n);s[a]=n;for(let u=0;u-1&&(o[i.id]=i)}}this._cluster(s,o,t,r)}_createClusterEdges(e,t,i,r){let n,s,o,a,l,c;const u=ed(e),d=[];for(let f=0;f0&&void 0!==arguments[0]?arguments[0]:{};return void 0===e.clusterEdgeProperties&&(e.clusterEdgeProperties={}),void 0===e.clusterNodeProperties&&(e.clusterNodeProperties={}),e}_cluster(e,t,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const n=[];for(const c in e)Object.prototype.hasOwnProperty.call(e,c)&&void 0!==this.clusteredNodes[c]&&n.push(c);for(let c=0;cn?i.x:n,s=i.yo?i.y:o;return{x:.5*(r+n),y:.5*(s+o)}}openCluster(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No clusterNodeId supplied to openCluster.");const r=this.body.nodes[e];if(void 0===r)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(!0!==r.isCluster||void 0===r.containedNodes||void 0===r.containedEdges)throw new Error("The node:"+e+" is not a valid cluster.");const n=this.findNode(e),s=Ap(n).call(n,e)-1;if(s>=0){const t=n[s];return this.body.nodes[t]._openChildCluster(e),delete this.body.nodes[e],void(!0===i&&this.body.emitter.emit("_dataChanged"))}const o=r.containedNodes,a=r.containedEdges;if(void 0!==t&&void 0!==t.releaseFunction&&"function"==typeof t.releaseFunction){const e={},i={x:r.x,y:r.y};for(const t in o)if(Object.prototype.hasOwnProperty.call(o,t)){const i=this.body.nodes[t];e[t]={x:i.x,y:i.y}}const n=t.releaseFunction(i,e);for(const t in o)if(Object.prototype.hasOwnProperty.call(o,t)){const e=this.body.nodes[t];void 0!==n[t]&&(e.x=void 0===n[t].x?r.x:n[t].x,e.y=void 0===n[t].y?r.y:n[t].y)}}else zg(o,(function(e){!1===e.options.fixed.x&&(e.x=r.x),!1===e.options.fixed.y&&(e.y=r.y)}));for(const c in o)if(Object.prototype.hasOwnProperty.call(o,c)){const e=this.body.nodes[c];e.vx=r.vx,e.vy=r.vy,e.setOptions({physics:!0}),delete this.clusteredNodes[c]}const l=[];for(let c=0;c0&&n<100;){const e=t.pop();if(void 0===e)continue;const s=this.body.edges[e];if(void 0===s)continue;n++;const o=s.clusteringEdgeReplacingIds;if(void 0===o)r.push(e);else for(let r=0;rr&&(r=n.edges.length),e+=n.edges.length,t+=Math.pow(n.edges.length,2),i+=1}e/=i,t/=i;const n=t-Math.pow(e,2),s=Math.sqrt(n);let o=Math.floor(e+2*s);return o>r&&(o=r),o}_createClusteredEdge(e,t,i,r,n){const s=Ck.cloneOptions(i,"edge");Pg(s,r),s.from=e,s.to=t,s.id="clusterEdge:"+kj(),void 0!==n&&Pg(s,n);const o=this.body.functions.createEdge(s);return o.clusteringEdgeReplacingIds=[i.id],o.connect(),this.body.edges[o.id]=o,o}_clusterEdges(e,t,i,r){if(t instanceof pk){const e=t,i={};i[e.id]=e,t=i}if(e instanceof PC){const t=e,i={};i[t.id]=t,e=i}if(null==i)throw new Error("_clusterEdges: parameter clusterNode required");void 0===r&&(r=i.clusterEdgeProperties),this._createClusterEdges(e,t,i,r);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&void 0!==this.body.edges[n]){const e=this.body.edges[n];this._backupEdgeOptions(e),e.setOptions({physics:!1})}for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.clusteredNodes[n]={clusterId:i.id,node:this.body.nodes[n]},this.body.nodes[n].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(void 0===e)return;const t=this.clusteredNodes[e];if(void 0===t)return;const i=t.clusterId;return void 0!==i?this.body.nodes[i]:void 0}_filter(e,t){const i=[];return zg(e,e=>{t(e)&&i.push(e)}),i}_updateState(){let e;const t=[],i={},r=e=>{zg(this.body.nodes,t=>{!0===t.isCluster&&e(t)})};for(e in this.clusteredNodes)Object.prototype.hasOwnProperty.call(this.clusteredNodes,e)&&void 0===this.body.nodes[e]&&t.push(e);r((function(e){for(let i=0;i{const t=this.body.edges[e];void 0!==t&&t.endPointsValid()||(i[e]=e)}),r((function(e){zg(e.containedEdges,(e,t)=>{e.endPointsValid()||i[t]||(i[t]=t)})})),zg(this.body.edges,(e,t)=>{let r=!0;const n=e.clusteringEdgeReplacingIds;if(void 0!==n){let e=0;zg(n,t=>{const i=this.body.edges[t];void 0!==i&&i.endPointsValid()&&(e+=1)}),r=e>0}e.endPointsValid()&&r||(i[t]=t)}),r(e=>{zg(i,t=>{delete e.containedEdges[t],zg(e.edges,(r,n)=>{r.id!==t?r.clusteringEdgeReplacingIds=this._filter(r.clusteringEdgeReplacingIds,(function(e){return!i[e]})):e.edges[n]=null}),e.edges=this._filter(e.edges,(function(e){return null!==e}))})}),zg(i,e=>{delete this.clusteredEdges[e]}),zg(i,e=>{delete this.body.edges[e]}),zg(ed(this.body.edges),e=>{const t=this.body.edges[e],i=this._isClusteredNode(t.fromId)||this._isClusteredNode(t.toId);if(i!==this._isClusteredEdge(t.id))if(i){const e=this._getClusterNodeForNode(t.fromId);void 0!==e&&this._clusterEdges(this.body.nodes[t.fromId],t,e);const i=this._getClusterNodeForNode(t.toId);void 0!==i&&this._clusterEdges(this.body.nodes[t.toId],t,i)}else delete this._clusterEdges[e],this._restoreEdge(t)});let n=!1,s=!0;for(;s;){const e=[];r((function(t){const i=ed(t.containedNodes).length,r=!0===t.options.allowSingleNodeCluster;(r&&i<1||!r&&i<2)&&e.push(t.id)}));for(let t=0;t0,n=n||s}n&&this._updateState()}_isClusteredNode(e){return void 0!==this.clusteredNodes[e]}_isClusteredEdge(e){return void 0!==this.clusteredEdges[e]}}class Tk{constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 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},vr(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on("dragStart",()=>{this.dragging=!0}),this.body.emitter.on("dragEnd",()=>{this.dragging=!1}),this.body.emitter.on("zoom",()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=sf(()=>{var e;this.zooming=!1,zr(e=this._requestRedraw).call(e,this)()},250)}),this.body.emitter.on("_resizeNodes",()=>{this._resizeNodes()}),this.body.emitter.on("_redraw",()=>{!1===this.renderingActive&&this._redraw()}),this.body.emitter.on("_blockRedraw",()=>{this.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",zr(e=this._requestRedraw).call(e,this)),this.body.emitter.on("_startRendering",()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on("_stopRendering",()=>{this.renderRequests-=1,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on("destroy",()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){void 0!==e&&Ig(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}_startRendering(){var e;!0===this.renderingActive&&void 0===this.requestAnimationFrameRequestId&&(this.requestAnimationFrameRequestId=window.requestAnimationFrame(zr(e=this._renderStep).call(e,this),this.simulationInterval))}_renderStep(){!0===this.renderingActive&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit("setSize"),this._redraw()}_requestRedraw(){!0!==this.redrawRequested&&!1===this.renderingActive&&!0===this.allowRedraw&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!0===this.allowRedraw){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;const t={drawExternalLabels:null};0!==this.canvas.frame.canvas.width&&0!==this.canvas.frame.canvas.height||this.canvas.setSize(),this.canvas.setTransform();const i=this.canvas.getContext(),r=this.canvas.frame.canvas.clientWidth,n=this.canvas.frame.canvas.clientHeight;if(i.clearRect(0,0,r,n),0===this.canvas.frame.clientWidth)return;if(i.save(),i.translate(this.body.view.translation.x,this.body.view.translation.y),i.scale(this.body.view.scale,this.body.view.scale),i.beginPath(),this.body.emitter.emit("beforeDrawing",i),i.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(i),!1===this.dragging||!0===this.dragging&&!1===this.options.hideNodesOnDrag){const{drawExternalLabels:r}=this._drawNodes(i,e);t.drawExternalLabels=r}!1===e&&(!1===this.dragging||!0===this.dragging&&!1===this.options.hideEdgesOnDrag)&&(!1===this.zooming||!0===this.zooming&&!1===this.options.hideEdgesOnZoom)&&this._drawArrows(i),null!=t.drawExternalLabels&&t.drawExternalLabels(),!1===e&&this._drawSelectionBox(i),i.beginPath(),this.body.emitter.emit("afterDrawing",i),i.closePath(),i.restore(),!0===e&&i.clearRect(0,0,r,n)}}_resizeNodes(){this.canvas.setTransform();const 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);const t=this.body.nodes;let i;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i=t[r],i.resize(e),i.updateBoundingBox(e,i.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.body.nodes,r=this.body.nodeIndices;let n;const s=[],o=[],a=this.canvas.DOMtoCanvas({x:-20,y:-20}),l=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+20,y:this.canvas.frame.canvas.clientHeight+20}),c={top:a.y,left:a.x,bottom:l.y,right:l.x},u=[];for(let f=0;f{for(const e of u)e()}}}_drawEdges(e){const t=this.body.edges,i=this.body.edgeIndices;for(let r=0;r{0!==e.width&&(this.body.view.translation.x=.5*e.width),0!==e.height&&(this.body.view.translation.y=.5*e.height)}),this.body.emitter.on("setSize",zr(e=this.setSize).call(e,this)),this.body.emitter.on("destroy",()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(void 0!==e&&Ig(["width","height","autoResize"],this.options,e),this._cleanUp(),!0===this.options.autoResize){var t;if(window.ResizeObserver){const e=new ResizeObserver(()=>{!0===this.setSize()&&this.body.emitter.emit("_requestRedraw")}),{frame:t}=this;e.observe(t),this._cleanupCallbacks.push(()=>{e.unobserve(t)})}else{const e=Ek(()=>{!0===this.setSize()&&this.body.emitter.emit("_requestRedraw")},1e3);this._cleanupCallbacks.push(()=>{clearInterval(e)})}const e=zr(t=this._onResize).call(t,this);window.addEventListener("resize",e),this._cleanupCallbacks.push(()=>{window.removeEventListener("resize",e)})}}_cleanUp(){var e,t,i;yd(e=Td(t=eh(i=this._cleanupCallbacks).call(i,0)).call(t)).call(e,e=>{try{e()}catch(e){console.error(e)}})}_onResize(){this.setSize(),this.body.emitter.emit("_redraw")}_getCameraState(){let 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}))}_setCameraState(){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){const e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight;let i=this.cameraState.scale;1!=e&&1!=t?i=.5*this.cameraState.scale*(e+t):1!=e?i=this.cameraState.scale*e:1!=t&&(i=this.cameraState.scale*t),this.body.view.scale=i;const r=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),n={x:r.x-this.cameraState.position.x,y:r.y-this.cameraState.position.y};this.body.view.translation.x+=n.x*this.body.view.scale,this.body.view.translation.y+=n.y*this.body.view.scale}}_prepareValue(e){if("number"==typeof e)return e+"px";if("string"==typeof e){if(-1!==Ap(e).call(e,"%")||-1!==Ap(e).call(e,"px"))return e;if(-1===Ap(e).call(e,"%"))return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}_create(){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{const 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()}_bindHammer(){void 0!==this.hammer&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new fy(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:fy.DIRECTION_ALL}),Ok(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on("tap",e=>{this.body.eventListeners.onTap(e)}),this.hammer.on("doubletap",e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on("press",e=>{this.body.eventListeners.onHold(e)}),this.hammer.on("panstart",e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on("panmove",e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on("panend",e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on("pinch",e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener("wheel",e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("mousemove",e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener("contextmenu",e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new fy(this.frame),Dk(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.width,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let i=!1;const r=this.frame.canvas.width,n=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,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=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{const e=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),t=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);this.frame.canvas.width===e&&this.frame.canvas.height===t||this._getCameraState(s),this.frame.canvas.width!==e&&(this.frame.canvas.width=e,i=!0),this.frame.canvas.height!==t&&(this.frame.canvas.height=t,i=!0)}return!0===i&&(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(r/this.pixelRatio),oldHeight:Math.round(n/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}getContext(){return this.frame.canvas.getContext("2d")}_determinePixelRatio(){const e=this.getContext();if(void 0===e)throw new Error("Could not get canvax context");let t=1;return"undefined"!=typeof window&&(t=window.devicePixelRatio||1),t/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){const 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)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}class Nk{constructor(e,t){var i,r;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",zr(i=this.fit).call(i,this)),this.body.emitter.on("animationFinished",()=>{this.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",zr(r=this.releaseNode).call(r,this))}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e=function(e,t){const i=vr({nodes:t,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},null!=e?e:{});if(!Wu(i.nodes))throw new TypeError("Nodes has to be an array of ids.");if(0===i.nodes.length&&(i.nodes=t),!("number"==typeof i.minZoomLevel&&i.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!("number"==typeof i.maxZoomLevel&&i.minZoomLevel<=i.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return i}(e,this.body.nodeIndices);const i=this.canvas.frame.canvas.clientWidth,r=this.canvas.frame.canvas.clientHeight;let n,s;if(0===i||0===r)s=1,n=Ck.getRange(this.body.nodes,e.nodes);else if(!0===t){let t=0;for(const e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&!0===this.body.nodes[e].predefinedPosition&&(t+=1);if(t>.5*this.body.nodeIndices.length)return void this.fit(e,!1);n=Ck.getRange(this.body.nodes,e.nodes),s=12.662/(this.body.nodeIndices.length+7.4147)+.0964822,s*=Math.min(i/600,r/600)}else{this.body.emitter.emit("_resizeNodes"),n=Ck.getRange(this.body.nodes,e.nodes);const t=i/(1.1*Math.abs(n.maxX-n.minX)),o=r/(1.1*Math.abs(n.maxY-n.minY));s=t<=o?t:o}s>e.maxZoomLevel?s=e.maxZoomLevel:s1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==this.body.nodes[e]){const i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}moveTo(e){if(void 0!==e){if(null!=e.offset){if(null!=e.offset.x){if(e.offset.x=+e.offset.x,!hw(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,!hw(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,!hw(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,!hw(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={}}animateView(e){if(void 0===e)return;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;const t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i=t.x-e.position.x,r=t.y-e.position.y;var n,s;this.targetTranslation={x:this.sourceTranslation.x+i*this.targetScale+e.offset.x,y:this.sourceTranslation.y+r*this.targetScale+e.offset.y},0===e.animation.duration?null!=this.lockedOnNodeId?(this.viewFunction=zr(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)):(this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw")):(this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=zr(s=this._transitionRedraw).call(s,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))}_lockedRedraw(){const e=this.body.nodes[this.lockedOnNodeId].x,t=this.body.nodes[this.lockedOnNodeId].y,i=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),r=i.x-e,n=i.y-t,s=this.body.view.translation,o={x:s.x+r*this.body.view.scale+this.lockedOnNodeOffset.x,y:s.y+n*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}releaseNode(){void 0!==this.lockedOnNodeId&&void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.easingTime+=this.animationSpeed,this.easingTime=!0===e?1:this.easingTime;const t=ry[this.animationEasingFunction](this.easingTime);var i;(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1)&&(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,null!=this.lockedOnNodeId&&(this.viewFunction=zr(i=this._lockedRedraw).call(i,this),this.body.emitter.on("initRedraw",this.viewFunction)),this.body.emitter.emit("animationFinished"))}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}function Ik(e){var t,i=e&&e.preventDefault||!1,r=e&&e.container||window,n={},s={keydown:{},keyup:{}},o={};for(t=97;t<=122;t++)o[String.fromCharCode(t)]={code:t-97+65,shift:!1};for(t=65;t<=90;t++)o[String.fromCharCode(t)]={code:t,shift:!0};for(t=0;t<=9;t++)o[""+t]={code:48+t,shift:!1};for(t=1;t<=12;t++)o["F"+t]={code:111+t,shift:!1};for(t=0;t<=9;t++)o["num"+t]={code:96+t,shift:!1};o["num*"]={code:106,shift:!1},o["num+"]={code:107,shift:!1},o["num-"]={code:109,shift:!1},o["num/"]={code:111,shift:!1},o["num."]={code:110,shift:!1},o.left={code:37,shift:!1},o.up={code:38,shift:!1},o.right={code:39,shift:!1},o.down={code:40,shift:!1},o.space={code:32,shift:!1},o.enter={code:13,shift:!1},o.shift={code:16,shift:void 0},o.esc={code:27,shift:!1},o.backspace={code:8,shift:!1},o.tab={code:9,shift:!1},o.ctrl={code:17,shift:!1},o.alt={code:18,shift:!1},o.delete={code:46,shift:!1},o.pageup={code:33,shift:!1},o.pagedown={code:34,shift:!1},o["="]={code:187,shift:!1},o["-"]={code:189,shift:!1},o["]"]={code:221,shift:!1},o["["]={code:219,shift:!1};var a=function(e){c(e,"keydown")},l=function(e){c(e,"keyup")},c=function(e,t){if(void 0!==s[t][e.keyCode]){for(var r=s[t][e.keyCode],n=0;n{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on("deactivate",()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on("destroy",()=>{void 0!==this.keycharm&&this.keycharm.destroy()}),this.options={}}setOptions(e){void 0!==e&&(this.options=e,this.create())}create(){!0===this.options.navigationButtons?!1===this.iconsCreated&&this.loadNavigationElements():!0===this.iconsCreated&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(0!=this.navigationHammers.length){for(let e=0;e{this._stopMovement()}),this.navigationHammers.push(n),this.iconsCreated=!0}bindToRedraw(e){var t;void 0===this.boundFunctions[e]&&(this.boundFunctions[e]=zr(t=this[e]).call(t,this),this.body.emitter.on("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_startRendering"))}unbindFromRedraw(e){void 0!==this.boundFunctions[e]&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[e])}_fit(){(new Date).valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=(new Date).valueOf())}_stopMovement(){for(const 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={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){const e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,r=t/e,n=(1-r)*this.canvas.canvasViewCenter.x+i.x*r,s=(1-r)*this.canvas.canvasViewCenter.y+i.y*r;this.body.view.scale=t,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}_zoomOut(){const e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,r=t/e,n=(1-r)*this.canvas.canvasViewCenter.x+i.x*r,s=(1-r)*this.canvas.canvasViewCenter.y+i.y*r;this.body.view.scale=t,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){var e,t,i,r,n,s,o,a,l,c,u,d,h,p,f,m,g,y,b,v,w,x,_,j;void 0!==this.keycharm&&this.keycharm.destroy(),!0===this.options.keyboard.enabled&&(!0===this.options.keyboard.bindToWindow?this.keycharm=Ik({container:window,preventDefault:!0}):this.keycharm=Ik({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),!0===this.activated&&(zr(e=this.keycharm).call(e,"up",()=>{this.bindToRedraw("_moveUp")},"keydown"),zr(t=this.keycharm).call(t,"down",()=>{this.bindToRedraw("_moveDown")},"keydown"),zr(i=this.keycharm).call(i,"left",()=>{this.bindToRedraw("_moveLeft")},"keydown"),zr(r=this.keycharm).call(r,"right",()=>{this.bindToRedraw("_moveRight")},"keydown"),zr(n=this.keycharm).call(n,"=",()=>{this.bindToRedraw("_zoomIn")},"keydown"),zr(s=this.keycharm).call(s,"num+",()=>{this.bindToRedraw("_zoomIn")},"keydown"),zr(o=this.keycharm).call(o,"num-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),zr(a=this.keycharm).call(a,"-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),zr(l=this.keycharm).call(l,"[",()=>{this.bindToRedraw("_zoomOut")},"keydown"),zr(c=this.keycharm).call(c,"]",()=>{this.bindToRedraw("_zoomIn")},"keydown"),zr(u=this.keycharm).call(u,"pageup",()=>{this.bindToRedraw("_zoomIn")},"keydown"),zr(d=this.keycharm).call(d,"pagedown",()=>{this.bindToRedraw("_zoomOut")},"keydown"),zr(h=this.keycharm).call(h,"up",()=>{this.unbindFromRedraw("_moveUp")},"keyup"),zr(p=this.keycharm).call(p,"down",()=>{this.unbindFromRedraw("_moveDown")},"keyup"),zr(f=this.keycharm).call(f,"left",()=>{this.unbindFromRedraw("_moveLeft")},"keyup"),zr(m=this.keycharm).call(m,"right",()=>{this.unbindFromRedraw("_moveRight")},"keyup"),zr(g=this.keycharm).call(g,"=",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),zr(y=this.keycharm).call(y,"num+",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),zr(b=this.keycharm).call(b,"num-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),zr(v=this.keycharm).call(v,"-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),zr(w=this.keycharm).call(w,"[",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),zr(x=this.keycharm).call(x,"]",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),zr(_=this.keycharm).call(_,"pageup",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),zr(j=this.keycharm).call(j,"pagedown",()=>{this.unbindFromRedraw("_zoomOut")},"keyup")))}}class Fk{constructor(e,t,i){var r,n,s,o,a,l,c,u,d,h,p,f,m;this.body=e,this.canvas=t,this.selectionHandler=i,this.navigationHandler=new Pk(e,t),this.body.eventListeners.onTap=zr(r=this.onTap).call(r,this),this.body.eventListeners.onTouch=zr(n=this.onTouch).call(n,this),this.body.eventListeners.onDoubleTap=zr(s=this.onDoubleTap).call(s,this),this.body.eventListeners.onHold=zr(o=this.onHold).call(o,this),this.body.eventListeners.onDragStart=zr(a=this.onDragStart).call(a,this),this.body.eventListeners.onDrag=zr(l=this.onDrag).call(l,this),this.body.eventListeners.onDragEnd=zr(c=this.onDragEnd).call(c,this),this.body.eventListeners.onMouseWheel=zr(u=this.onMouseWheel).call(u,this),this.body.eventListeners.onPinch=zr(d=this.onPinch).call(d,this),this.body.eventListeners.onMouseMove=zr(h=this.onMouseMove).call(h,this),this.body.eventListeners.onRelease=zr(p=this.onRelease).call(p,this),this.body.eventListeners.onContext=zr(f=this.onContext).call(f,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=zr(m=this.getPointer).call(m,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},vr(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("destroy",()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){void 0!==e&&(Rg(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),iy(this.options,e,"keyboard"),e.tooltip&&(vr(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=Gg(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-Lg(this.canvas.frame.canvas),y:e.y-Bg(this.canvas.frame.canvas)}}onTouch(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())}onTap(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}onDoubleTap(e){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}onHold(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}onRelease(e){if((new Date).valueOf()-this.touchTime>10){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=(new Date).valueOf()}}onContext(e){const t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}checkSelectionChanges(e){!0===(arguments.length>1&&void 0!==arguments[1]&&arguments[1])?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){const i=function(e,t){const i=[];for(let r=0;r{const t=e.node;!1===e.xFixed&&(t.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(e.x)+r)),!1===e.yFixed&&(t.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(e.y)+n))}),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);const i=t.x-this.drag.pointer.x,r=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+i,y:this.drag.translation.y+r},this.body.emitter.emit("_requestRedraw")}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;const i=this.body.selectionBox.position,r={minX:Math.min(i.start.x,i.end.x),minY:Math.min(i.start.y,i.end.y),maxX:Math.max(i.start.x,i.end.x),maxY:Math.max(i.start.y,i.end.y)},n=Bh(t=this.body.nodeIndices).call(t,e=>{const t=this.body.nodes[e];return t.x>=r.minX&&t.x<=r.maxX&&t.y>=r.minY&&t.y<=r.maxY});yd(n).call(n,e=>this.selectionHandler.selectObject(this.body.nodes[e]));const s=this.getPointer(e.center);this.selectionHandler.commitAndEmit(s,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{const t=this.drag.selection;t&&t.length?(yd(t).call(t,(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"))}}onPinch(e){const t=this.getPointer(e.center);this.drag.pinched=!0,void 0===this.pinch.scale&&(this.pinch.scale=1);const i=this.pinch.scale*e.scale;this.zoom(i,t)}zoom(e,t){if(!0===this.options.zoomView){const i=this.body.view.scale;let r;e<1e-5&&(e=1e-5),e>10&&(e=10),void 0!==this.drag&&!0===this.drag.dragging&&(r=this.canvas.DOMtoCanvas(this.drag.pointer));const n=this.body.view.translation,s=e/i,o=(1-s)*t.x+n.x*s,a=(1-s)*t.y+n.y*s;if(this.body.view.scale=e,this.body.view.translation={x:o,y:a},null!=r){const e=this.canvas.canvasToDOM(r);this.drag.pointer.x=e.x,this.drag.pointer.y=e.y}this.body.emitter.emit("_requestRedraw"),ithis._checkShowPopup(t),this.options.tooltipDelay))),!0===this.options.hover&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){const t=this.canvas._XconvertDOMtoCanvas(e.x),i=this.canvas._YconvertDOMtoCanvas(e.y),r={left:t,top:i,right:t,bottom:i},n=void 0===this.popupObj?void 0:this.popupObj.id;let s=!1,o="node";if(void 0===this.popupObj){const e=this.body.nodeIndices,t=this.body.nodes;let i;const n=[];for(let o=0;o0&&(this.popupObj=t[n[n.length-1]],s=!0)}if(void 0===this.popupObj&&!1===s){const e=this.body.edgeIndices,t=this.body.edges;let i;const n=[];for(let s=0;s0&&(this.popupObj=t[n[n.length-1]],o="edge")}void 0!==this.popupObj?this.popupObj.id!==n&&(void 0===this.popup&&(this.popup=new my(this.canvas.frame)),this.popup.popupTargetType=o,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"))}_checkHidePopup(e){const t=this.selectionHandler._pointerToPositionObject(e);let i=!1;if("node"===this.popup.popupTargetType){if(void 0!==this.body.nodes[this.popup.popupTargetId]&&(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),!0===i)){const t=this.selectionHandler.getNodeAt(e);i=void 0!==t&&t.id===this.popup.popupTargetId}}else void 0===this.selectionHandler.getNodeAt(e)&&void 0!==this.body.edges[this.popup.popupTargetId]&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));!1===i&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}var Mk=y,Lk=kv,Bk=Cb.getWeakData,zk=ov,Uk=ri,qk=G,Vk=te,Wk=rv,Hk=Ze,Gk=Mo.set,$k=Mo.getterFor,Xk=Ho.find,Kk=Ho.findIndex,Yk=Mk([].splice),Jk=0,Qk=function(e){return e.frozen||(e.frozen=new Zk)},Zk=function(){this.entries=[]},eS=function(e,t){return Xk(e.entries,(function(e){return e[0]===t}))};Zk.prototype={get:function(e){var t=eS(this,e);if(t)return t[1]},has:function(e){return!!eS(this,e)},set:function(e,t){var i=eS(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=Kk(this.entries,(function(t){return t[0]===e}));return~t&&Yk(this.entries,t,1),!!~t}};var tS,iS={getConstructor:function(e,t,i,r){var n=e((function(e,n){zk(e,s),Gk(e,{type:t,id:Jk++,frozen:void 0}),qk(n)||Wk(n,e[r],{that:e,AS_ENTRIES:i})})),s=n.prototype,o=$k(t),a=function(e,t,i){var r=o(e),n=Bk(Uk(t),!0);return!0===n?Qk(r).set(t,i):n[r.id]=i,e};return Lk(s,{delete:function(e){var t=o(this);if(!Vk(e))return!1;var i=Bk(e);return!0===i?Qk(t).delete(e):i&&Hk(i,t.id)&&delete i[t.id]},has:function(e){var t=o(this);if(!Vk(e))return!1;var i=Bk(e);return!0===i?Qk(t).has(e):i&&Hk(i,t.id)}}),Lk(s,i?{get:function(e){var t=o(this);if(Vk(e)){var i=Bk(e);return!0===i?Qk(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return a(this,e,t)}}:{add:function(e){return a(this,e,!0)}}),n}},rS=lb,nS=s,sS=y,oS=kv,aS=Cb,lS=jv,cS=iS,uS=te,dS=Mo.enforce,hS=o,pS=jo,fS=Object,mS=Array.isArray,gS=fS.isExtensible,yS=fS.isFrozen,bS=fS.isSealed,vS=fS.freeze,wS=fS.seal,xS={},_S={},jS=!nS.ActiveXObject&&"ActiveXObject"in nS,CS=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},kS=lS("WeakMap",CS,cS),SS=kS.prototype,TS=sS(SS.set);if(pS)if(jS){tS=cS.getConstructor(CS,"WeakMap",!0),aS.enable();var ES=sS(SS.delete),OS=sS(SS.has),DS=sS(SS.get);oS(SS,{delete:function(e){if(uS(e)&&!gS(e)){var t=dS(this);return t.frozen||(t.frozen=new tS),ES(this,e)||t.frozen.delete(e)}return ES(this,e)},has:function(e){if(uS(e)&&!gS(e)){var t=dS(this);return t.frozen||(t.frozen=new tS),OS(this,e)||t.frozen.has(e)}return OS(this,e)},get:function(e){if(uS(e)&&!gS(e)){var t=dS(this);return t.frozen||(t.frozen=new tS),OS(this,e)?DS(this,e):t.frozen.get(e)}return DS(this,e)},set:function(e,t){if(uS(e)&&!gS(e)){var i=dS(this);i.frozen||(i.frozen=new tS),OS(this,e)?TS(this,e,t):i.frozen.set(e,t)}else TS(this,e,t);return this}})}else rS&&hS((function(){var e=vS([]);return TS(new kS,e,1),!yS(e)}))&&oS(SS,{set:function(e,t){var i;return mS(e)&&(yS(e)?i=xS:bS(e)&&(i=_S)),TS(this,e,t),i===xS&&vS(e),i===_S&&wS(e),this}});var AS,NS,IS,RS,PS,FS=r(ie.WeakMap);function MS(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)}function LS(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i}function BS(e,t){const i=new o_;for(const r of t)e.has(r)||i.add(r);return i}"function"==typeof SuppressedError&&SuppressedError;class zS{constructor(){AS.set(this,new o_),NS.set(this,new o_)}get size(){return MS(this,NS,"f").size}add(){for(var e=arguments.length,t=new Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:()=>{};IS.set(this,new zS),RS.set(this,new zS),PS.set(this,void 0),LS(this,PS,e,"f")}get sizeNodes(){return MS(this,IS,"f").size}get sizeEdges(){return MS(this,RS,"f").size}getNodes(){return MS(this,IS,"f").getSelection()}getEdges(){return MS(this,RS,"f").getSelection()}addNodes(){MS(this,IS,"f").add(...arguments)}addEdges(){MS(this,RS,"f").add(...arguments)}deleteNodes(e){MS(this,IS,"f").delete(e)}deleteEdges(e){MS(this,RS,"f").delete(e)}clear(){MS(this,IS,"f").clear(),MS(this,RS,"f").clear()}commit(){const e={nodes:MS(this,IS,"f").commit(),edges:MS(this,RS,"f").commit()};for(var t=arguments.length,i=new Array(t),r=0;r{this.updateSelection()})}setOptions(e){void 0!==e&&Ig(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,e)}selectOnPoint(e){let t=!1;if(!0===this.options.selectable){const i=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),void 0!==i&&(t=this.selectObject(i)),this.body.emitter.emit("_requestRedraw")}return t}selectAdditionalOnPoint(e){let t=!1;if(!0===this.options.selectable){const i=this.getNodeAt(e)||this.getEdgeAt(e);void 0!==i&&(t=!0,!0===i.isSelected()?this.deselectObject(i):this.selectObject(i),this.body.emitter.emit("_requestRedraw"))}return t}_initBaseEvent(e,t){const i={};return i.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},i.event=e,i}generateClickEvent(e,t,i,r){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=this._initBaseEvent(t,i);if(!0===n)s.nodes=[],s.edges=[];else{const e=this.getSelection();s.nodes=e.nodes,s.edges=e.edges}void 0!==r&&(s.previousSelection=r),"click"==e&&(s.items=this.getClickedItems(i)),void 0!==t.controlEdge&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}selectObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.selectConnectedEdges;return void 0!==e&&(e instanceof PC?(!0===t&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0)}deselectObject(e){!0===e.isSelected()&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){const t=[],i=this.body.nodes;for(let r=0;r1&&void 0!==arguments[1])||arguments[1];const i=this._pointerToPositionObject(e),r=this._getAllNodesOverlappingWith(i);return r.length>0?!0===t?this.body.nodes[r[r.length-1]]:r[r.length-1]:void 0}_getEdgesOverlappingWith(e,t){const i=this.body.edges;for(let r=0;r1&&void 0!==arguments[1])||arguments[1];const i=this.canvas.DOMtoCanvas(e);let r=10,n=null;const s=this.body.edges;for(let o=0;o0&&(this.generateClickEvent("deselectEdge",t,e,n),i=!0),r.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,n),i=!0),r.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),i=!0),r.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),i=!0),!0===i&&this.generateClickEvent("select",t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return Ju(e=this._selectionAccumulator.getNodes()).call(e,e=>e.id)}getSelectedEdgeIds(){var e;return Ju(e=this._selectionAccumulator.getEdges()).call(e,e=>e.id)}setSelection(e){let t=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((t.unselectAll||void 0===t.unselectAll)&&this.unselectAll(),e.nodes)for(const i of e.nodes){const e=this.body.nodes[i];if(!e)throw new RangeError('Node with id "'+i+'" not found');this.selectObject(e,t.highlightEdges)}if(e.edges)for(const i of e.edges){const e=this.body.edges[i];if(!e)throw new RangeError('Edge with id "'+i+'" not found');this.selectObject(e)}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}selectNodes(e){let t=!(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:t})}selectEdges(e){if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({edges:e})}updateSelection(){for(const e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(const e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){const t=this.canvas.DOMtoCanvas(e),i=[],r=this.body.nodeIndices,n=this.body.nodes;for(let a=r.length-1;a>=0;a--){const e=n[r[a]].getItemsOnPoint(t);i.push.apply(i,e)}const s=this.body.edgeIndices,o=this.body.edges;for(let a=s.length-1;a>=0;a--){const e=o[s[a]].getItemsOnPoint(t);i.push.apply(i,e)}return i}}class VS{abstract(){throw new Error("Can't instantiate abstract class!")}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;this.fake_use(e,t,i),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}}class WS extends VS{constructor(e){super(),this.layout=e}curveType(){return"horizontal"}getPosition(e){return e.x}setPosition(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==i&&this.layout.hierarchical.addToOrdering(e,i),e.x=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){H_(e).call(e,(function(e,t){return e.x-t.x}))}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}}class HS extends VS{constructor(e){super(),this.layout=e}curveType(){return"vertical"}getPosition(e){return e.y}setPosition(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==i&&this.layout.hierarchical.addToOrdering(e,i),e.y=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){H_(e).call(e,(function(e,t){return e.y-t.y}))}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}}var GS=Ho.every;Oi({target:"Array",proto:!0,forced:!od("every")},{every:function(e){return GS(this,e,arguments.length>1?arguments[1]:void 0)}});var $S=Rr("Array").every,XS=le,KS=$S,YS=Array.prototype,JS=function(e){var t=e.every;return e===YS||XS(YS,e)&&t===YS.every?KS:t},QS=r(JS);function ZS(e,t){const i=new o_;return yd(e).call(e,e=>{var t;yd(t=e.edges).call(t,e=>{e.connected&&i.add(e)})}),yd(i).call(i,e=>{const i=e.from.id,r=e.to.id;null==t[i]&&(t[i]=0),(null==t[r]||t[i]>=t[r])&&(t[r]=t[i]+1)}),t}function eT(e,t,i,r){var n;const s=Pp(null),o=qx(n=[...cj(r).call(r)]).call(n,(e,t)=>e+1+t.edges.length,0),a=i+"Id",l="to"===i?1:-1;for(const[d,h]of r){if(!r.has(d)||!e(h))continue;s[d]=0;const n=[h];let p,f=0;for(;p=n.pop();){var c,u;if(!r.has(d))continue;const e=s[p.id]+l;if(yd(c=Bh(u=p.edges).call(u,e=>e.connected&&e.to!==e.from&&e[i]!==p&&r.has(e.toId)&&r.has(e.fromId))).call(c,r=>{const o=r[a],l=s[o];(null==l||t(e,l))&&(s[o]=e,n.push(r[i]))}),f>o)return ZS(r,s);++f}}return s}class tT{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){void 0===this.childrenReference[e]&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),void 0===this.parentReference[t]&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(const e in this.parentReference)if(this.parentReference[e].length>1)return void(this.isTree=!1);this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){void 0!==t&&void 0===this.trees[e.id]&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){void 0===this.levels[e]&&(this.levels[e]=0)}getMaxLevel(e){const t={},i=e=>{if(void 0!==t[e])return t[e];let r=this.levels[e];if(this.childrenReference[e]){const t=this.childrenReference[e];if(t.length>0)for(let e=0;ee-t);for(const n of r)t.set(n,i++);for(const n in this.levels)Object.prototype.hasOwnProperty.call(this.levels,n)&&(this.levels[n]=t.get(this.levels[n]))}getTreeSize(e,t){let i=1e9,r=-1e9,n=1e9,s=-1e9;for(const o in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,o)&&this.trees[o]===t){const t=e[o];i=Math.min(t.x,i),r=Math.max(t.x,r),n=Math.min(t.y,n),s=Math.max(t.y,s)}return{min_x:i,max_x:r,min_y:n,max_y:s}}hasSameParent(e,t){const i=this.parentReference[e.id],r=this.parentReference[t.id];if(void 0===i||void 0===r)return!1;for(let n=0;n{this.setupHierarchicalLayout()}),this.body.emitter.on("_dataLoaded",()=>{this.layoutNetwork()}),this.body.emitter.on("_resetHierarchicalLayout",()=>{this.setupHierarchicalLayout()}),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",()=>{if(!0!==this.options.hierarchical.enabled)return;const e=this.direction.curveType();this.body.emitter.emit("_forceDisableDynamicCurves",e,!1)})}setOptions(e,t){if(void 0!==e){const i=this.options.hierarchical,r=i.enabled;if(Ig(["randomSeed","improvedLayout","clusterThreshold"],this.options,e),iy(this.options,e,"hierarchical"),void 0!==e.randomSeed&&this._resetRNG(e.randomSeed),!0===i.enabled)return!0===r&&this.body.emitter.emit("refresh",!0),"RL"===i.direction||"DU"===i.direction?i.levelSeparation>0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(!0===r)return this.body.emitter.emit("refresh"),Pg(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=bg(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(!0===this.options.hierarchical.enabled){const t=this.optionsBackup.physics;void 0===e.physics||!0===e.physics?(e.physics={enabled:void 0===t.enabled||t.enabled,solver:"hierarchicalRepulsion"},t.enabled=void 0===t.enabled||t.enabled,t.solver=t.solver||"barnesHut"):"object"==typeof e.physics?(t.enabled=void 0===e.physics.enabled||e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):!1!==e.physics&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});let i=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:i};else{const t=e.edges.smooth;void 0!==t.type&&"dynamic"!==t.type&&(i=t.type),this.optionsBackup.edges={smooth:{enabled:void 0===t.enabled||t.enabled,type:void 0===t.type?"dynamic":t.type,roundness:void 0===t.roundness?.5:t.roundness,forceDirection:void 0!==t.forceDirection&&t.forceDirection}},e.edges.smooth={enabled:void 0===t.enabled||t.enabled,type:i,roundness:void 0===t.roundness?.5:t.roundness,forceDirection:void 0!==t.forceDirection&&t.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}positionInitially(e){if(!0!==this.options.hierarchical.enabled){this._resetRNG(this.initialRandomSeed);const t=e.length+50;for(let i=0;ir){const s=e.length;for(;e.length>r&&i<=t;){i+=1;const t=e.length;if(i%3==0?this.body.modules.clustering.clusterBridges(n):this.body.modules.clustering.clusterOutliers(n),t==e.length&&i%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*s)})}i>t&&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();const s=70;for(let o=0;o0){let e,t,i=!1,r=!1;for(t in this.lastNodeOnLevel={},this.hierarchical=new tT,this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],void 0!==e.options.level?(i=!0,this.hierarchical.levels[t]=e.options.level):r=!0);if(!0===r&&!0===i)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===r){const e=this.options.hierarchical.sortMethod;"hubsize"===e?this._determineLevelsByHubsize():"directed"===e?this._determineLevelsDirected():"custom"===e&&this._determineLevelsCustomCallback()}for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.hierarchical.ensureLevel(t);const e=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(e),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1;const i={},r=(e,t)=>{const i=this.hierarchical.trees;for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&i[r]===e&&this.direction.shift(r,t)},n=()=>{const e=[];for(let t=0;t{if(!t[e.id]&&(t[e.id]=!0,this.hierarchical.childrenReference[e.id])){const i=this.hierarchical.childrenReference[e.id];if(i.length>0)for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:1e9,r=1e9,n=1e9,s=1e9,o=-1e9;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const l=e.body.nodes[a],c=e.hierarchical.levels[l.id],u=e.direction.getPosition(l),[d,h]=e._getSpaceAroundNode(l,t);r=Math.min(d,r),n=Math.min(h,n),c<=i&&(s=Math.min(u,s),o=Math.max(u,o))}return[s,o,r,n]},a=(e,t)=>{const i=this.hierarchical.getMaxLevel(e.id),r=this.hierarchical.getMaxLevel(t.id);return Math.min(i,r)},l=(e,t,i)=>{const r=this.hierarchical;for(let n=0;n1)for(let t=0;t2&&void 0!==arguments[2]&&arguments[2];const l=e.direction.getPosition(i),c=e.direction.getPosition(r),u=Math.abs(c-l),d=e.options.hierarchical.nodeSpacing;if(u>d){const l={},c={};s(i,l),s(r,c);const u=a(i,r),h=o(l,u),p=o(c,u),f=h[1],m=p[0],g=p[2];if(Math.abs(f-m)>d){let i=f-m+d;i<-g+d&&(i=-g+d),i<0&&(e._shiftBlock(r.id,i),t=!0,!0===n&&e._centerParent(r))}}},u=(e,r)=>{const n=r.id,a=r.edges,l=this.hierarchical.levels[r.id],c=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,u={},d=[];for(let t=0;t{let i=0;for(let r=0;r{let i=0;for(let r=0;r{let i=this.direction.getPosition(r);const n={};for(let r=0;r{const n=this.direction.getPosition(r);if(void 0===i[r.id]){const e={};s(r,e),i[r.id]=e}const a=o(i[r.id]),l=a[2],c=a[3],u=e-n;let d=0;u>0?d=Math.min(u,c-this.options.hierarchical.nodeSpacing):u<0&&(d=-Math.min(-u,l-this.options.hierarchical.nodeSpacing)),0!=d&&(this._shiftBlock(r.id,d),t=!0)})(m),m=f(e,a),(e=>{const i=this.direction.getPosition(r),[n,s]=this._getSpaceAroundNode(r),o=e-i;let a=i;o>0?a=Math.min(i+(s-this.options.hierarchical.nodeSpacing),e):o<0&&(a=Math.max(i-(n-this.options.hierarchical.nodeSpacing),e)),a!==i&&(this.direction.setPosition(r,a),t=!0)})(m)},d=e=>{let i=this.hierarchical.getLevels();i=Td(i).call(i);for(let r=0;r{let i=this.hierarchical.getLevels();i=Td(i).call(i);for(let r=0;r{for(const e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this._centerParent(this.body.nodes[e])},f=()=>{let e=this.hierarchical.getLevels();e=Td(e).call(e);for(let t=0;t{const e=n();let t=0;for(let i=0;i0&&Math.abs(o)0&&(o=this.direction.getPosition(r[e-1])+s),this.direction.setPosition(t,o,i),this._validatePositionAndContinue(t,i,o),n++}}}}_placeBranchNodes(e,t){var i;const r=this.hierarchical.childrenReference[e];if(void 0===r)return;const n=[];for(let o=0;ot&&void 0===this.positionedNodes[i.id]))return;{const t=this.options.hierarchical.nodeSpacing;let s;s=0===o?this.direction.getPosition(this.body.nodes[e]):this.direction.getPosition(n[o-1])+t,this.direction.setPosition(i,s,r),this._validatePositionAndContinue(i,r,s)}}const s=this._getCenterPosition(n);this.direction.setPosition(this.body.nodes[e],s,t)}_validatePositionAndContinue(e,t,i){if(this.hierarchical.isTree){if(void 0!==this.lastNodeOnLevel[t]){const r=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-r{var i;-1!==Ap(i=this.body.edgeIndices).call(i,e.id)&&t.push(e)}),t}_getHubSizes(){const e={};zg(this.body.nodeIndices,t=>{const i=this.body.nodes[t],r=this._getActiveEdges(i).length;e[r]=!0});const t=[];return zg(e,e=>{t.push(Number(e))}),H_(t).call(t,(function(e,t){return t-e})),t}_determineLevelsByHubsize(){const e=(e,t)=>{this.hierarchical.levelDownstream(e,t)},t=this._getHubSizes();for(let i=0;i{const i=this.body.nodes[t];r===this._getActiveEdges(i).length&&this._crawlNetwork(e,t)})}}_determineLevelsCustomCallback(){this._crawlNetwork((e,t,i)=>{let r=this.hierarchical.levels[e.id];void 0===r&&(r=this.hierarchical.levels[e.id]=1e5);const n=(Ck.cloneOptions(e,"node"),Ck.cloneOptions(t,"node"),void Ck.cloneOptions(i,"edge"));this.hierarchical.levels[t.id]=r+n}),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;const t=qx(e=this.body.nodeIndices).call(e,(e,t)=>(e.set(t,this.body.nodes[t]),e),new aw);"roots"===this.options.hierarchical.shakeTowards?this.hierarchical.levels=function(e){return eT(t=>{var i,r;return QS(i=Bh(r=t.edges).call(r,t=>e.has(t.toId))).call(i,e=>e.from===t)},(e,t)=>t{var i,r;return QS(i=Bh(r=t.edges).call(r,t=>e.has(t.toId))).call(i,e=>e.to===t)},(e,t)=>t>e,"from",e)}(t),this.hierarchical.setMinLevelToZero()}_generateMap(){this._crawlNetwork((e,t)=>{this.hierarchical.levels[t.id]>this.hierarchical.levels[e.id]&&this.hierarchical.addRelation(e.id,t.id)}),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0;const i={},r=(t,n)=>{if(void 0===i[t.id]){let s;this.hierarchical.setTreeIndex(t,n),i[t.id]=!0;const o=this._getActiveEdges(t);for(let i=0;i{if(i[e])return;i[e]=!0,this.direction.shift(e,t);const n=this.hierarchical.childrenReference[e];if(void 0!==n)for(let t=0;t{const i=this.hierarchical.parentReference[t];if(void 0!==i)for(let n=0;n{const i=this.hierarchical.parentReference[t];if(void 0!==i)for(let r=0;r{this._clean()}),this.body.emitter.on("_dataChanged",zr(n=this._restore).call(n,this)),this.body.emitter.on("_resetData",zr(s=this._restore).call(s,this))}_restore(){!1!==this.inMode&&(!0===this.options.initiallyActive?this.enableEditMode():this.disableEditMode())}setOptions(e,t,i){void 0!==t&&(void 0!==t.locale?this.options.locale=t.locale:this.options.locale=i.locale,void 0!==t.locales?this.options.locales=t.locales:this.options.locales=i.locales),void 0!==e&&("boolean"==typeof e?this.options.enabled=e:(this.options.enabled=!0,Pg(this.options,e)),!0===this.options.initiallyActive&&(this.editMode=!0),this._setup())}toggleEditMode(){!0===this.editMode?this.disableEditMode():this.enableEditMode()}enableEditMode(){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())}disableEditMode(){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())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},!0===this.guiEnabled){var e,t;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";const i=this.selectionHandler.getSelectedNodeCount(),r=this.selectionHandler.getSelectedEdgeCount(),n=i+r,s=this.options.locales[this.options.locale];let o=!1;!1!==this.options.addNode&&(this._createAddNodeButton(s),o=!0),!1!==this.options.addEdge&&(!0===o?this._createSeperator(1):o=!0,this._createAddEdgeButton(s)),1===i&&"function"==typeof this.options.editNode?(!0===o?this._createSeperator(2):o=!0,this._createEditNodeButton(s)):1===r&&0===i&&!1!==this.options.editEdge&&(!0===o?this._createSeperator(3):o=!0,this._createEditEdgeButton(s)),0!==n&&(i>0&&!1!==this.options.deleteNode||0===i&&!1!==this.options.deleteEdge)&&(!0===o&&this._createSeperator(4),this._createDeleteButton(s)),this._bindElementEvents(this.closeDiv,zr(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",zr(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}addNodeMode(){var e;if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addNode",!0===this.guiEnabled){var t;const e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,zr(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",zr(e=this._performAddNode).call(e,this))}editNode(){!0!==this.editMode&&this.enableEditMode(),this._clean();const e=this.selectionHandler.getSelectedNodes()[0];if(void 0!==e){if(this.inMode="editNode","function"!=typeof this.options.editNode)throw new Error("No function has been configured to handle the editing of nodes.");if(!0!==e.isCluster){const t=Pg({},e.options,!1);if(t.x=e.x,t.y=e.y,2!==this.options.editNode.length)throw new Error("The function for edit does not support two arguments (data, callback)");this.options.editNode(t,e=>{null!=e&&"editNode"===this.inMode&&this.body.data.nodes.getDataSet().update(e),this.showManipulatorToolbar()})}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError)}else this.showManipulatorToolbar()}addEdgeMode(){var e,t,i,r,n;if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addEdge",!0===this.guiEnabled){var s;const e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,zr(s=this.toggleEditMode).call(s,this))}this._temporaryBindUI("onTouch",zr(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",zr(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",zr(i=this._dragControlNode).call(i,this)),this._temporaryBindUI("onRelease",zr(r=this._finishConnect).call(r,this)),this._temporaryBindUI("onDragStart",zr(n=this._dragStartEdge).call(n,this)),this._temporaryBindUI("onHold",()=>{})}editEdgeMode(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="editEdge","object"!=typeof 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;const t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,zr(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],void 0!==this.edgeBeingEditedId){var t,i,r,n;const e=this.body.edges[this.edgeBeingEditedId],s=this._getNewTargetNode(e.from.x,e.from.y),o=this._getNewTargetNode(e.to.x,e.to.y);this.temporaryIds.nodes.push(s.id),this.temporaryIds.nodes.push(o.id),this.body.nodes[s.id]=s,this.body.nodeIndices.push(s.id),this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id),this._temporaryBindUI("onTouch",zr(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",()=>{}),this._temporaryBindUI("onHold",()=>{}),this._temporaryBindUI("onDragStart",zr(i=this._controlNodeDragStart).call(i,this)),this._temporaryBindUI("onDrag",zr(r=this._controlNodeDrag).call(r,this)),this._temporaryBindUI("onDragEnd",zr(n=this._controlNodeDragEnd).call(n,this)),this._temporaryBindUI("onMouseMove",()=>{}),this._temporaryBindEvent("beforeDrawing",t=>{const i=e.edgeType.findBorderPositions(t);!1===s.selected&&(s.x=i.from.x,s.y=i.from.y),!1===o.selected&&(o.x=i.to.x,o.y=i.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}else{const e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id)}}deleteSelected(){!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="delete";const e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds();let i;if(e.length>0){for(let t=0;t0&&"function"==typeof this.options.deleteEdge&&(i=this.options.deleteEdge);if("function"==typeof i){const r={nodes:e,edges:t};if(2!==i.length)throw new Error("The function for delete does not support two arguments (data, callback)");i(r,e=>{null!=e&&"delete"===this.inMode?(this.body.data.edges.getDataSet().remove(e.edges),this.body.data.nodes.getDataSet().remove(e.nodes),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()):(this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}_setup(){!0===this.options.enabled?(this.guiEnabled=!0,this._createWrappers(),!1===this.editMode?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){var e,t;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===(t=this.options.locales[this.options.locale])||void 0===t?void 0:t.close)&&void 0!==e?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}_getNewTargetNode(e,t){const i=Pg({},this.options.controlNodeStyle);i.id="targetNode"+kj(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;const r=this.body.functions.createNode(i);return r.shape.boundingBox={left:e,right:e,top:t,bottom:t},r}_createEditButton(){var e;this._clean(),this.manipulationDOM={},Tg(this.editModeDiv);const t=this.options.locales[this.options.locale],i=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(i),this._bindElementEvents(i,zr(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,!0===this.guiEnabled&&(Tg(this.editModeDiv),Tg(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}_cleanupDOMEventListeners(){for(const t of eh(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),Tg(this.manipulationDiv),Tg(this.editModeDiv),Tg(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}_createSeperator(){let 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])}_createAddNodeButton(e){var t;const i=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,zr(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;const i=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,zr(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;const i=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,zr(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;const i=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,zr(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let i;i=this.options.rtl?"vis-delete-rtl":"vis-delete";const r=this._createButton("delete",i,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(r),this._bindElementEvents(r,zr(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;const i=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,zr(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,i){let r=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 "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=r,this.manipulationDOM[e+"Label"].innerText=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(void 0===this.body.eventListeners[e])throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+Bp(ed(this.body.eventListeners)));this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t}_unbindTemporaryUIs(){for(const e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e{i.destroy()});const r=e=>{let{keyCode:i,key:r}=e;"Enter"!==r&&" "!==r&&13!==i&&32!==i||t()};e.addEventListener("keyup",r,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener("keyup",r,!1)})}_cleanupTemporaryNodesAndEdges(){for(let n=0;n=0;o--)if(n[o]!==this.selectedControlNode.id){s=this.body.nodes[n[o]];break}if(void 0!==s&&void 0!==this.selectedControlNode)if(!0===s.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const e=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===e.id?this._performEditEdge(s.id,r.to.id):this._performEditEdge(r.from.id,s.id)}else r.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}_handleConnect(e){if((new Date).valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=vr({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;const t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(void 0!==i)if(!0===i.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const e=this._getNewTargetNode(i.x,i.y);this.body.nodes[e.id]=e,this.body.nodeIndices.push(e.id);const t=this.body.functions.createEdge({id:"connectionEdge"+kj(),from:i.id,to:e.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[t.id]=t,this.body.edgeIndices.push(t.id),this.temporaryIds.nodes.push(e.id),this.temporaryIds.edges.push(t.id)}this.touchTime=(new Date).valueOf()}}_dragControlNode(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let r;void 0!==this.temporaryIds.edges[0]&&(r=this.body.edges[this.temporaryIds.edges[0]].fromId);const n=this.selectionHandler._getAllNodesOverlappingWith(i);let s;for(let a=n.length-1;a>=0;a--){var o;if(-1===Ap(o=this.temporaryIds.nodes).call(o,n[a])){s=this.body.nodes[n[a]];break}}if(e.controlEdge={from:r,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),void 0!==this.temporaryIds.nodes[0]){const e=this.body.nodes[this.temporaryIds.nodes[0]];e.x=this.canvas._XconvertDOMtoCanvas(t.x),e.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}_finishConnect(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let r;void 0!==this.temporaryIds.edges[0]&&(r=this.body.edges[this.temporaryIds.edges[0]].fromId);const n=this.selectionHandler._getAllNodesOverlappingWith(i);let s;for(let a=n.length-1;a>=0;a--){var o;if(-1===Ap(o=this.temporaryIds.nodes).call(o,n[a])){s=this.body.nodes[n[a]];break}}this._cleanupTemporaryNodesAndEdges(),void 0!==s&&(!0===s.isCluster?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):void 0!==this.body.nodes[r]&&void 0!==this.body.nodes[s.id]&&this._performAddEdge(r,s.id)),e.controlEdge={from:r,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}_dragStartEdge(e){const t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}_performAddNode(e){const t={id:kj(),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,e=>{null!=e&&"addNode"===this.inMode&&this.body.data.nodes.getDataSet().add(e),this.showManipulatorToolbar()})}else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){const i={from:e,to:t};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(i,e=>{null!=e&&"addEdge"===this.inMode&&(this.body.data.edges.getDataSet().add(e),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().add(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){const i={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label};let r=this.options.editEdge;if("object"==typeof r&&(r=r.editWithoutDrag),"function"==typeof r){if(2!==r.length)throw new Error("The function for edit does not support two arguments (data, callback)");r(i,e=>{null==e||"editEdge"!==this.inMode?(this.body.edges[i.id].updateEdgeType(),this.body.emitter.emit("_redraw"),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(e),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().update(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}const nT="string",sT="boolean",oT="number",aT="array",lT="object",cT=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],uT={borderWidth:{number:oT},borderWidthSelected:{number:oT,undefined:"undefined"},brokenImage:{string:nT,undefined:"undefined"},chosen:{label:{boolean:sT,function:"function"},node:{boolean:sT,function:"function"},__type__:{object:lT,boolean:sT}},color:{border:{string:nT},background:{string:nT},highlight:{border:{string:nT},background:{string:nT},__type__:{object:lT,string:nT}},hover:{border:{string:nT},background:{string:nT},__type__:{object:lT,string:nT}},__type__:{object:lT,string:nT}},opacity:{number:oT,undefined:"undefined"},fixed:{x:{boolean:sT},y:{boolean:sT},__type__:{object:lT,boolean:sT}},font:{align:{string:nT},color:{string:nT},size:{number:oT},face:{string:nT},background:{string:nT},strokeWidth:{number:oT},strokeColor:{string:nT},vadjust:{number:oT},multi:{boolean:sT,string:nT},bold:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},boldital:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},ital:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},mono:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},__type__:{object:lT,string:nT}},group:{string:nT,number:oT,undefined:"undefined"},heightConstraint:{minimum:{number:oT},valign:{string:nT},__type__:{object:lT,boolean:sT,number:oT}},hidden:{boolean:sT},icon:{face:{string:nT},code:{string:nT},size:{number:oT},color:{string:nT},weight:{string:nT,number:oT},__type__:{object:lT}},id:{string:nT,number:oT},image:{selected:{string:nT,undefined:"undefined"},unselected:{string:nT,undefined:"undefined"},__type__:{object:lT,string:nT}},imagePadding:{top:{number:oT},right:{number:oT},bottom:{number:oT},left:{number:oT},__type__:{object:lT,number:oT}},label:{string:nT,undefined:"undefined"},labelHighlightBold:{boolean:sT},level:{number:oT,undefined:"undefined"},margin:{top:{number:oT},right:{number:oT},bottom:{number:oT},left:{number:oT},__type__:{object:lT,number:oT}},mass:{number:oT},physics:{boolean:sT},scaling:{min:{number:oT},max:{number:oT},label:{enabled:{boolean:sT},min:{number:oT},max:{number:oT},maxVisible:{number:oT},drawThreshold:{number:oT},__type__:{object:lT,boolean:sT}},customScalingFunction:{function:"function"},__type__:{object:lT}},shadow:{enabled:{boolean:sT},color:{string:nT},size:{number:oT},x:{number:oT},y:{number:oT},__type__:{object:lT,boolean:sT}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:sT,array:aT},borderRadius:{number:oT},interpolation:{boolean:sT},useImageSize:{boolean:sT},useBorderWithImage:{boolean:sT},coordinateOrigin:{string:["center","top-left"]},__type__:{object:lT}},size:{number:oT},title:{string:nT,dom:"dom",undefined:"undefined"},value:{number:oT,undefined:"undefined"},widthConstraint:{minimum:{number:oT},maximum:{number:oT},__type__:{object:lT,boolean:sT,number:oT}},x:{number:oT},y:{number:oT},__type__:{object:lT}},dT={configure:{enabled:{boolean:sT},filter:{boolean:sT,string:nT,array:aT,function:"function"},container:{dom:"dom"},showButton:{boolean:sT},__type__:{object:lT,boolean:sT,string:nT,array:aT,function:"function"}},edges:{arrows:{to:{enabled:{boolean:sT},scaleFactor:{number:oT},type:{string:cT},imageHeight:{number:oT},imageWidth:{number:oT},src:{string:nT},__type__:{object:lT,boolean:sT}},middle:{enabled:{boolean:sT},scaleFactor:{number:oT},type:{string:cT},imageWidth:{number:oT},imageHeight:{number:oT},src:{string:nT},__type__:{object:lT,boolean:sT}},from:{enabled:{boolean:sT},scaleFactor:{number:oT},type:{string:cT},imageWidth:{number:oT},imageHeight:{number:oT},src:{string:nT},__type__:{object:lT,boolean:sT}},__type__:{string:["from","to","middle"],object:lT}},endPointOffset:{from:{number:oT},to:{number:oT},__type__:{object:lT,number:oT}},arrowStrikethrough:{boolean:sT},background:{enabled:{boolean:sT},color:{string:nT},size:{number:oT},dashes:{boolean:sT,array:aT},__type__:{object:lT,boolean:sT}},chosen:{label:{boolean:sT,function:"function"},edge:{boolean:sT,function:"function"},__type__:{object:lT,boolean:sT}},color:{color:{string:nT},highlight:{string:nT},hover:{string:nT},inherit:{string:["from","to","both"],boolean:sT},opacity:{number:oT},__type__:{object:lT,string:nT}},dashes:{boolean:sT,array:aT},font:{color:{string:nT},size:{number:oT},face:{string:nT},background:{string:nT},strokeWidth:{number:oT},strokeColor:{string:nT},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:oT},multi:{boolean:sT,string:nT},bold:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},boldital:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},ital:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},mono:{color:{string:nT},size:{number:oT},face:{string:nT},mod:{string:nT},vadjust:{number:oT},__type__:{object:lT,string:nT}},__type__:{object:lT,string:nT}},hidden:{boolean:sT},hoverWidth:{function:"function",number:oT},label:{string:nT,undefined:"undefined"},labelHighlightBold:{boolean:sT},length:{number:oT,undefined:"undefined"},physics:{boolean:sT},scaling:{min:{number:oT},max:{number:oT},label:{enabled:{boolean:sT},min:{number:oT},max:{number:oT},maxVisible:{number:oT},drawThreshold:{number:oT},__type__:{object:lT,boolean:sT}},customScalingFunction:{function:"function"},__type__:{object:lT}},selectionWidth:{function:"function",number:oT},selfReferenceSize:{number:oT},selfReference:{size:{number:oT},angle:{number:oT},renderBehindTheNode:{boolean:sT},__type__:{object:lT}},shadow:{enabled:{boolean:sT},color:{string:nT},size:{number:oT},x:{number:oT},y:{number:oT},__type__:{object:lT,boolean:sT}},smooth:{enabled:{boolean:sT},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:oT},forceDirection:{string:["horizontal","vertical","none"],boolean:sT},__type__:{object:lT,boolean:sT}},title:{string:nT,undefined:"undefined"},width:{number:oT},widthConstraint:{maximum:{number:oT},__type__:{object:lT,boolean:sT,number:oT}},value:{number:oT,undefined:"undefined"},__type__:{object:lT}},groups:{useDefaultGroups:{boolean:sT},__any__:uT,__type__:{object:lT}},interaction:{dragNodes:{boolean:sT},dragView:{boolean:sT},hideEdgesOnDrag:{boolean:sT},hideEdgesOnZoom:{boolean:sT},hideNodesOnDrag:{boolean:sT},hover:{boolean:sT},keyboard:{enabled:{boolean:sT},speed:{x:{number:oT},y:{number:oT},zoom:{number:oT},__type__:{object:lT}},bindToWindow:{boolean:sT},autoFocus:{boolean:sT},__type__:{object:lT,boolean:sT}},multiselect:{boolean:sT},navigationButtons:{boolean:sT},selectable:{boolean:sT},selectConnectedEdges:{boolean:sT},hoverConnectedEdges:{boolean:sT},tooltipDelay:{number:oT},zoomView:{boolean:sT},zoomSpeed:{number:oT},__type__:{object:lT}},layout:{randomSeed:{undefined:"undefined",number:oT,string:nT},improvedLayout:{boolean:sT},clusterThreshold:{number:oT},hierarchical:{enabled:{boolean:sT},levelSeparation:{number:oT},nodeSpacing:{number:oT},treeSpacing:{number:oT},blockShifting:{boolean:sT},edgeMinimization:{boolean:sT},parentCentralization:{boolean:sT},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:lT,boolean:sT}},__type__:{object:lT}},manipulation:{enabled:{boolean:sT},initiallyActive:{boolean:sT},addNode:{boolean:sT,function:"function"},addEdge:{boolean:sT,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:lT,boolean:sT,function:"function"}},deleteNode:{boolean:sT,function:"function"},deleteEdge:{boolean:sT,function:"function"},controlNodeStyle:uT,__type__:{object:lT,boolean:sT}},nodes:uT,physics:{enabled:{boolean:sT},barnesHut:{theta:{number:oT},gravitationalConstant:{number:oT},centralGravity:{number:oT},springLength:{number:oT},springConstant:{number:oT},damping:{number:oT},avoidOverlap:{number:oT},__type__:{object:lT}},forceAtlas2Based:{theta:{number:oT},gravitationalConstant:{number:oT},centralGravity:{number:oT},springLength:{number:oT},springConstant:{number:oT},damping:{number:oT},avoidOverlap:{number:oT},__type__:{object:lT}},repulsion:{centralGravity:{number:oT},springLength:{number:oT},springConstant:{number:oT},nodeDistance:{number:oT},damping:{number:oT},__type__:{object:lT}},hierarchicalRepulsion:{centralGravity:{number:oT},springLength:{number:oT},springConstant:{number:oT},nodeDistance:{number:oT},damping:{number:oT},avoidOverlap:{number:oT},__type__:{object:lT}},maxVelocity:{number:oT},minVelocity:{number:oT},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:sT},iterations:{number:oT},updateInterval:{number:oT},onlyDynamicEdges:{boolean:sT},fit:{boolean:sT},__type__:{object:lT,boolean:sT}},timestep:{number:oT},adaptiveTimestep:{boolean:sT},wind:{x:{number:oT},y:{number:oT},__type__:{object:lT}},__type__:{object:lT,boolean:sT}},autoResize:{boolean:sT},clickToUse:{boolean:sT},locale:{string:nT},locales:{__any__:{any:"any"},__type__:{object:lT}},height:{string:nT},width:{string:nT},__type__:{object:lT}},hT={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]}}},pT=(e,t,i)=>{var r;return!(!_h(e).call(e,"physics")||!_h(r=hT.physics.solver).call(r,t)||i.physics.solver===t||"wind"===t)};var fT=Object.freeze({__proto__:null,allOptions:dT,configuratorHideOption:pT,configureOptions:hT});class mT{constructor(){}getDistances(e,t,i){const r={},n=e.edges;for(let o=0;o2&&void 0!==arguments[2]&&arguments[2];const r=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(r),this._createK_matrix(r),this._createE_matrix();let n=0;const s=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3));let o=1e9,a=0,l=0,c=0,u=0,d=0;for(;o>.01&&n1&&d<5;)d+=1,this._moveNode(a,l,c),[u,l,c]=this._getEnergy(a)}_getHighestEnergyNode(e){const t=this.body.nodeIndices,i=this.body.nodes;let r=0,n=t[0],s=0,o=0;for(let a=0;athis.body.emitter.emit("_requestRedraw")),this.groups=new lw,this.canvas=new Ak(this.body),this.selectionHandler=new qS(this.body,this.canvas),this.interactionHandler=new Fk(this.body,this.canvas,this.selectionHandler),this.view=new Nk(this.body,this.canvas),this.renderer=new Tk(this.body,this.canvas),this.physics=new jk(this.body),this.layoutEngine=new iT(this.body),this.clustering=new Sk(this.body),this.manipulation=new rT(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new FC(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new fk(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new gT(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(i),this.setData(t)}function bT(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t].redundant=e[t].used,e[t].used=[])}function vT(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].redundant){for(let i=0;i0?(r=t[e].redundant[0],t[e].redundant.shift()):(r=document.createElementNS("http://www.w3.org/2000/svg",e),i.appendChild(r)):(r=document.createElementNS("http://www.w3.org/2000/svg",e),t[e]={used:[],redundant:[]},i.appendChild(r)),t[e].used.push(r),r}Xr(yT.prototype),yT.prototype.setOptions=function(e){if(null===e&&(e=void 0),void 0!==e){if(!0===yy.validate(e,dT)&&console.error("%cErrors have been found in the supplied options object.",gy),Ig(["locale","locales","clickToUse"],this.options,e),void 0!==e.locale&&(e.locale=function(e,t){try{const[r,n]=t.split(/[-_ /]/,2),s=null!=r?r.toLowerCase():null,o=null!=n?n.toUpperCase():null;if(s&&o){const t=s+"-"+o;if(Object.prototype.hasOwnProperty.call(e,t))return t;var i;console.warn(Nh(i="Unknown variant ".concat(o," of language ")).call(i,s,"."))}if(s){const t=s;if(Object.prototype.hasOwnProperty.call(e,t))return t;console.warn("Unknown language ".concat(s))}return console.warn("Unknown locale ".concat(t,", falling back to English.")),"en"}catch(e){return console.error(e),console.warn("Unexpected error while normalizing locale ".concat(t,", 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 py(this,this.body.container,hT,this.canvas.pixelRatio,pT)),this.configurator.setOptions(e.configure)),this.configurator&&!0===this.configurator.options.enabled){const e={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};Pg(e.nodes,this.nodesHandler.options),Pg(e.edges,this.edgesHandler.options),Pg(e.layout,this.layoutEngine.options),Pg(e.interaction,this.selectionHandler.options),Pg(e.interaction,this.renderer.options),Pg(e.interaction,this.interactionHandler.options),Pg(e.manipulation,this.manipulation.options),Pg(e.physics,this.physics.options),Pg(e.global,this.canvas.options),Pg(e.global,this.options),this.configurator.setModuleOptions(e)}void 0!==e.clickToUse?!0===e.clickToUse?void 0===this.activator&&(this.activator=new dy(this.canvas.frame),this.activator.on("change",()=>{this.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")}},yT.prototype._updateVisibleIndices=function(){const e=this.body.nodes,t=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(this.clustering._isClusteredNode(i)||!1!==e[i].options.hidden||this.body.nodeIndices.push(e[i].id));for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i],n=e[r.fromId],s=e[r.toId],o=void 0!==n&&void 0!==s;!this.clustering._isClusteredEdge(i)&&!1===r.options.hidden&&o&&!1===n.options.hidden&&!1===s.options.hidden&&this.body.edgeIndices.push(r.id)}},yT.prototype.bindEventListeners=function(){this.body.emitter.on("_dataChanged",()=>{this.edgesHandler._updateState(),this.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit("startSimulation"),this.body.emitter.emit("_requestRedraw")})},yT.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);");const t=$y(e.dot);this.setData(t)}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);");const t=Ky(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")},yT.prototype.destroy=function(){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;for(const e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&delete this.body.nodes[e];for(const e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&delete this.body.edges[e];Tg(this.body.container)},yT.prototype._updateValueRange=function(e){let t,i,r,n=0;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const s=e[t].getValue();void 0!==s&&(i=void 0===i?s:Math.min(s,i),r=void 0===r?s:Math.max(s,r),n+=s)}if(void 0!==i&&void 0!==r)for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t].setValueRange(i,r,n)},yT.prototype.isActive=function(){return!this.activator||this.activator.active},yT.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},yT.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},yT.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},yT.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},yT.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},yT.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},yT.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},yT.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},yT.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},yT.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},yT.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},yT.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},yT.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},yT.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},yT.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},yT.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},yT.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},yT.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},yT.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},yT.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},yT.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},yT.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},yT.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},yT.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},yT.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},yT.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},yT.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},yT.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},yT.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},yT.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},yT.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)},yT.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},yT.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},yT.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},yT.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},yT.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},yT.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},yT.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},yT.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},yT.prototype.getNodeAt=function(){const e=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},yT.prototype.getEdgeAt=function(){const e=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},yT.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},yT.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},yT.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},yT.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},yT.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},yT.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},yT.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},yT.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},yT.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},yT.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},yT.prototype.getOptionsFromConfigurator=function(){let e={};return this.configurator&&(e=this.configurator.getOptions.apply(this.configurator)),e};var xT=Object.freeze({__proto__:null,cleanupElements:vT,drawBar:function(e,t,i,r,n,s,o,a){if(0!=r){r<0&&(t-=r*=-1);const l=wT("rect",s,o);l.setAttributeNS(null,"x",e-.5*i),l.setAttributeNS(null,"y",t),l.setAttributeNS(null,"width",i),l.setAttributeNS(null,"height",r),l.setAttributeNS(null,"class",n),a&&l.setAttributeNS(null,"style",a)}},drawPoint:function(e,t,i,r,n,s){let o;if("circle"==i.style?(o=wT("circle",r,n),o.setAttributeNS(null,"cx",e),o.setAttributeNS(null,"cy",t),o.setAttributeNS(null,"r",.5*i.size)):(o=wT("rect",r,n),o.setAttributeNS(null,"x",e-.5*i.size),o.setAttributeNS(null,"y",t-.5*i.size),o.setAttributeNS(null,"width",i.size),o.setAttributeNS(null,"height",i.size)),void 0!==i.styles&&o.setAttributeNS(null,"style",i.styles),o.setAttributeNS(null,"class",i.className+" vis-point"),s){const i=wT("text",r,n);s.xOffset&&(e+=s.xOffset),s.yOffset&&(t+=s.yOffset),s.content&&(i.textContent=s.content),s.className&&i.setAttributeNS(null,"class",s.className+" vis-label"),i.setAttributeNS(null,"x",e),i.setAttributeNS(null,"y",t)}return o},getDOMElement:function(e,t,i,r){let n;return Object.prototype.hasOwnProperty.call(t,e)?t[e].redundant.length>0?(n=t[e].redundant[0],t[e].redundant.shift()):(n=document.createElement(e),void 0!==r?i.insertBefore(n,r):i.appendChild(n)):(n=document.createElement(e),t[e]={used:[],redundant:[]},void 0!==r?i.insertBefore(n,r):i.appendChild(n)),t[e].used.push(n),n},getSVGElement:wT,prepareElements:bT,resetElements:function(e){bT(e),vT(e),bT(e)}});const _T={Images:Zy,dotparser:Xy,gephiParser:Yy,allOptions:fT,convertDot:$y,convertGephi:Ky};var jT=Object.freeze({__proto__:null,DOMutil:xT,DataSet:Rj,DataView:Pj,Hammer:fy,Network:yT,Queue:Aj,data:Lj,keycharm:Rk,network:_T,util:by});t.DOMutil=xT,t.DataSet=Rj,t.DataView=Pj,t.Hammer=fy,t.Network=yT,t.Queue=Aj,t.data=Lj,t.default=jT,t.keycharm=Rk,t.network=_T,t.util=by,Object.defineProperty(t,"__esModule",{value:!0})}))}).call(this,i("a282"))},ffe5:function(e,t,i){"use strict";var r=i("b7d7"),n=i("7794"),s=i("8a19"),o=i("62e3"),a=i("f65b"),l=i("8fce"),c=i("3f2a"),u=i("289f"),d=i("5270"),h=TypeError,p=d((function(){[].keys().reduce((function(){}),void 0)})),f=!p&&c("reduce",h);r({target:"Iterator",proto:!0,real:!0,forced:p||f},{reduce:function(e){o(this);try{s(e)}catch(d){l(this,"throw",d)}var t=arguments.length<2,i=t?void 0:arguments[1];if(f)return u(f,this,t?[e]:[e,i]);var r=a(this),c=0;if(n(r,(function(r){t?(t=!1,i=r):i=e(i,r,c),c++}),{IS_RECORD:!0}),t)throw new h("Reduce of empty iterator with no initial value");return i}})}}]);
//# sourceMappingURL=chunk-1ae86eb6.1a6de5854cd1d99ba42c.js.map