Files
drawNET/static/js/lib/x6.js
T
2026-04-21 13:28:36 +09:00

12 lines
483 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).X6={})}(this,(function(t){"use strict";function e(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function n(t,e,n,r){var i,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,n,o):i(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o}"function"==typeof SuppressedError&&SuppressedError,"object"==typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),"undefined"!=typeof window&&[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach((t=>{Object.prototype.hasOwnProperty.call(t,"append")||Object.defineProperty(t,"append",{configurable:!0,enumerable:!0,writable:!0,value(...t){const e=document.createDocumentFragment();t.forEach((t=>{const n=t instanceof Node;e.appendChild(n?t:document.createTextNode(String(t)))})),this.appendChild(e)}})}));class r{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}!function(t){t.dispose=function(){return(t,e,n)=>{const r=n.value,i=t.__proto__;n.value=function(...t){this.disposed||(r.call(this,...t),i.dispose.call(this))}}}}(r||(r={}));class i{constructor(){this.isDisposed=!1,this.items=new Set}get disposed(){return this.isDisposed}dispose(){this.isDisposed||(this.isDisposed=!0,this.items.forEach((t=>{t.dispose()})),this.items.clear())}contains(t){return this.items.has(t)}add(t){this.items.add(t)}remove(t){this.items.delete(t)}clear(){this.items.clear()}}!function(t){t.from=function(e){const n=new t;return e.forEach((t=>{n.add(t)})),n}}(i||(i={}));var s="object"==typeof global&&global&&global.Object===Object&&global,o="object"==typeof self&&self&&self.Object===Object&&self,a=s||o||Function("return this")(),l=a.Symbol,c=Object.prototype,h=c.hasOwnProperty,u=c.toString,g=l?l.toStringTag:void 0;var d=Object.prototype.toString;var f=l?l.toStringTag:void 0;function p(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?function(t){var e=h.call(t,g),n=t[g];try{t[g]=void 0;var r=!0}catch(t){}var i=u.call(t);return r&&(e?t[g]=n:delete t[g]),i}(t):function(t){return d.call(t)}(t)}function m(t){return null!=t&&"object"==typeof t}function y(t){return"symbol"==typeof t||m(t)&&"[object Symbol]"==p(t)}function v(t){return"number"==typeof t?t:y(t)?NaN:+t}function b(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var x=Array.isArray,w=l?l.prototype:void 0,A=w?w.toString:void 0;function C(t){if("string"==typeof t)return t;if(x(t))return b(t,C)+"";if(y(t))return A?A.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function P(t,e){return function(n,r){var i;if(void 0===n&&void 0===r)return e;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=C(n),r=C(r)):(n=v(n),r=v(r)),i=t(n,r)}return i}}var M=P((function(t,e){return t+e}),0),E=/\s/;function S(t){for(var e=t.length;e--&&E.test(t.charAt(e)););return e}var O=/^\s+/;function T(t){return t?t.slice(0,S(t)+1).replace(O,""):t}function k(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var N=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,_=/^0o[0-7]+$/i,L=parseInt;function B(t){if("number"==typeof t)return t;if(y(t))return NaN;if(k(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=k(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=T(t);var n=j.test(t);return n||_.test(t)?L(t.slice(2),n?2:8):N.test(t)?NaN:+t}var I=1/0;function D(t){return t?(t=B(t))===I||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function R(t){var e=D(t),n=e%1;return e==e?n?e-n:e:0}function V(t){return t}function z(t){if(!k(t))return!1;var e=p(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var $,F=a["__core-js_shared__"],G=($=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"";var U=Function.prototype.toString;function q(t){if(null!=t){try{return U.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var W=/^\[object .+?Constructor\]$/,H=Function.prototype,J=Object.prototype,X=H.toString,Y=J.hasOwnProperty,Z=RegExp("^"+X.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function K(t){return!(!k(t)||function(t){return!!G&&G in t}(t))&&(z(t)?Z:W).test(q(t))}function Q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return K(n)?n:void 0}var tt=Q(a,"WeakMap"),et=tt&&new tt,nt=et?function(t,e){return et.set(t,e),t}:V,rt=Object.create,it=function(){function t(){}return function(e){if(!k(e))return{};if(rt)return rt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function st(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=it(t.prototype),r=t.apply(n,e);return k(r)?r:n}}function ot(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var at=Math.max;function lt(t,e,n,r){for(var i=-1,s=t.length,o=n.length,a=-1,l=e.length,c=at(s-o,0),h=Array(l+c),u=!r;++a<l;)h[a]=e[a];for(;++i<o;)(u||i<s)&&(h[n[i]]=t[i]);for(;c--;)h[a++]=t[i++];return h}var ct=Math.max;function ht(t,e,n,r){for(var i=-1,s=t.length,o=-1,a=n.length,l=-1,c=e.length,h=ct(s-a,0),u=Array(h+c),g=!r;++i<h;)u[i]=t[i];for(var d=i;++l<c;)u[d+l]=e[l];for(;++o<a;)(g||i<s)&&(u[d+n[o]]=t[i++]);return u}function ut(){}function gt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function dt(){}gt.prototype=it(ut.prototype),gt.prototype.constructor=gt;var ft=et?function(t){return et.get(t)}:dt,pt={},mt=Object.prototype.hasOwnProperty;function yt(t){for(var e=t.name+"",n=pt[e],r=mt.call(pt,e)?n.length:0;r--;){var i=n[r],s=i.func;if(null==s||s==t)return i.name}return e}function vt(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function bt(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function xt(t){if(t instanceof gt)return t.clone();var e=new vt(t.__wrapped__,t.__chain__);return e.__actions__=bt(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}vt.prototype=it(ut.prototype),vt.prototype.constructor=vt;var wt=Object.prototype.hasOwnProperty;function At(t){if(m(t)&&!x(t)&&!(t instanceof gt)){if(t instanceof vt)return t;if(wt.call(t,"__wrapped__"))return xt(t)}return new vt(t)}function Ct(t){var e=yt(t),n=At[e];if("function"!=typeof n||!(e in gt.prototype))return!1;if(t===n)return!0;var r=ft(n);return!!r&&t===r[0]}At.prototype=ut.prototype,At.prototype.constructor=At;var Pt=Date.now;function Mt(t){var e=0,n=0;return function(){var r=Pt(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Et=Mt(nt),St=/\{\n\/\* \[wrapped with (.+)\] \*/,Ot=/,? & /;var Tt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function kt(t){return function(){return t}}var Nt=function(){try{var t=Q(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),jt=Nt?function(t,e){return Nt(t,"toString",{configurable:!0,enumerable:!1,value:kt(e),writable:!0})}:V,_t=Mt(jt);function Lt(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Bt(t,e,n,r){for(var i=t.length,s=n+(r?1:-1);r?s--:++s<i;)if(e(t[s],s,t))return s;return-1}function It(t){return t!=t}function Dt(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Bt(t,It,n)}function Rt(t,e){return!!(null==t?0:t.length)&&Dt(t,e,0)>-1}var Vt=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function zt(t,e,n){var r=e+"";return _t(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Tt,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Lt(Vt,(function(n){var r="_."+n[0];e&n[1]&&!Rt(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(St);return e?e[1].split(Ot):[]}(r),n)))}function $t(t,e,n,r,i,s,o,a,l,c){var h=8&e;e|=h?32:64,4&(e&=~(h?64:32))||(e&=-4);var u=[t,e,i,h?s:void 0,h?o:void 0,h?void 0:s,h?void 0:o,a,l,c],g=n.apply(void 0,u);return Ct(t)&&Et(g,u),g.placeholder=r,zt(g,t,e)}function Ft(t){return t.placeholder}var Gt=/^(?:0|[1-9]\d*)$/;function Ut(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Gt.test(t))&&t>-1&&t%1==0&&t<e}var qt=Math.min;var Wt="__lodash_placeholder__";function Ht(t,e){for(var n=-1,r=t.length,i=0,s=[];++n<r;){var o=t[n];o!==e&&o!==Wt||(t[n]=Wt,s[i++]=n)}return s}function Jt(t,e,n,r,i,s,o,l,c,h){var u=128&e,g=1&e,d=2&e,f=24&e,p=512&e,m=d?void 0:st(t);return function y(){for(var v=arguments.length,b=Array(v),x=v;x--;)b[x]=arguments[x];if(f)var w=Ft(y),A=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,w);if(r&&(b=lt(b,r,i,f)),s&&(b=ht(b,s,o,f)),v-=A,f&&v<h){var C=Ht(b,w);return $t(t,e,Jt,y.placeholder,n,b,C,l,c,h-v)}var P=g?n:this,M=d?P[t]:t;return v=b.length,l?b=function(t,e){for(var n=t.length,r=qt(e.length,n),i=bt(t);r--;){var s=e[r];t[r]=Ut(s,n)?i[s]:void 0}return t}(b,l):p&&v>1&&b.reverse(),u&&c<v&&(b.length=c),this&&this!==a&&this instanceof y&&(M=m||st(M)),M.apply(P,b)}}var Xt="__lodash_placeholder__",Yt=128,Zt=Math.min;var Kt=Math.max;function Qt(t,e,n,r,i,s,o,l){var c=2&e;if(!c&&"function"!=typeof t)throw new TypeError("Expected a function");var h=r?r.length:0;if(h||(e&=-97,r=i=void 0),o=void 0===o?o:Kt(R(o),0),l=void 0===l?l:R(l),h-=i?i.length:0,64&e){var u=r,g=i;r=i=void 0}var d=c?void 0:ft(t),f=[t,e,n,r,i,u,g,s,o,l];if(d&&function(t,e){var n=t[1],r=e[1],i=n|r,s=i<131,o=r==Yt&&8==n||r==Yt&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!s&&!o)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var a=e[3];if(a){var l=t[3];t[3]=l?lt(l,a,e[4]):a,t[4]=l?Ht(t[3],Xt):e[4]}(a=e[5])&&(l=t[5],t[5]=l?ht(l,a,e[6]):a,t[6]=l?Ht(t[5],Xt):e[6]),(a=e[7])&&(t[7]=a),r&Yt&&(t[8]=null==t[8]?e[8]:Zt(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(f,d),t=f[0],e=f[1],n=f[2],r=f[3],i=f[4],!(l=f[9]=void 0===f[9]?c?0:t.length:Kt(f[9]-h,0))&&24&e&&(e&=-25),e&&1!=e)p=8==e||16==e?function(t,e,n){var r=st(t);return function i(){for(var s=arguments.length,o=Array(s),l=s,c=Ft(i);l--;)o[l]=arguments[l];var h=s<3&&o[0]!==c&&o[s-1]!==c?[]:Ht(o,c);return(s-=h.length)<n?$t(t,e,Jt,i.placeholder,void 0,o,h,void 0,void 0,n-s):ot(this&&this!==a&&this instanceof i?r:t,this,o)}}(t,e,l):32!=e&&33!=e||i.length?Jt.apply(void 0,f):function(t,e,n,r){var i=1&e,s=st(t);return function e(){for(var o=-1,l=arguments.length,c=-1,h=r.length,u=Array(h+l),g=this&&this!==a&&this instanceof e?s:t;++c<h;)u[c]=r[c];for(;l--;)u[c++]=arguments[++o];return ot(g,i?n:this,u)}}(t,e,n,r);else var p=function(t,e,n){var r=1&e,i=st(t);return function e(){return(this&&this!==a&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return zt((d?nt:Et)(p,f),t,e)}function te(t,e,n){return e=n?void 0:e,Qt(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function ee(t,e,n){"__proto__"==e&&Nt?Nt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ne(t,e){return t===e||t!=t&&e!=e}var re=Object.prototype.hasOwnProperty;function ie(t,e,n){var r=t[e];re.call(t,e)&&ne(r,n)&&(void 0!==n||e in t)||ee(t,e,n)}function se(t,e,n,r){var i=!n;n||(n={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),i?ee(n,a,l):ie(n,a,l)}return n}var oe=Math.max;function ae(t,e,n){return e=oe(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=oe(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(o),ot(t,this,a)}}function le(t,e){return _t(ae(t,e,V),t+"")}function ce(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function he(t){return null!=t&&ce(t.length)&&!z(t)}function ue(t,e,n){if(!k(n))return!1;var r=typeof e;return!!("number"==r?he(n)&&Ut(e,n.length):"string"==r&&e in n)&&ne(n[e],t)}function ge(t){return le((function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,o&&ue(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var a=n[r];a&&t(e,a,r,s)}return e}))}var de=Object.prototype;function fe(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||de)}function pe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function me(t){return m(t)&&"[object Arguments]"==p(t)}var ye=Object.prototype,ve=ye.hasOwnProperty,be=ye.propertyIsEnumerable,xe=me(function(){return arguments}())?me:function(t){return m(t)&&ve.call(t,"callee")&&!be.call(t,"callee")};function we(){return!1}var Ae="object"==typeof t&&t&&!t.nodeType&&t,Ce=Ae&&"object"==typeof module&&module&&!module.nodeType&&module,Pe=Ce&&Ce.exports===Ae?a.Buffer:void 0,Me=(Pe?Pe.isBuffer:void 0)||we,Ee={};function Se(t){return function(e){return t(e)}}Ee["[object Float32Array]"]=Ee["[object Float64Array]"]=Ee["[object Int8Array]"]=Ee["[object Int16Array]"]=Ee["[object Int32Array]"]=Ee["[object Uint8Array]"]=Ee["[object Uint8ClampedArray]"]=Ee["[object Uint16Array]"]=Ee["[object Uint32Array]"]=!0,Ee["[object Arguments]"]=Ee["[object Array]"]=Ee["[object ArrayBuffer]"]=Ee["[object Boolean]"]=Ee["[object DataView]"]=Ee["[object Date]"]=Ee["[object Error]"]=Ee["[object Function]"]=Ee["[object Map]"]=Ee["[object Number]"]=Ee["[object Object]"]=Ee["[object RegExp]"]=Ee["[object Set]"]=Ee["[object String]"]=Ee["[object WeakMap]"]=!1;var Oe="object"==typeof t&&t&&!t.nodeType&&t,Te=Oe&&"object"==typeof module&&module&&!module.nodeType&&module,ke=Te&&Te.exports===Oe&&s.process,Ne=function(){try{var t=Te&&Te.require&&Te.require("util").types;return t||ke&&ke.binding&&ke.binding("util")}catch(t){}}(),je=Ne&&Ne.isTypedArray,_e=je?Se(je):function(t){return m(t)&&ce(t.length)&&!!Ee[p(t)]},Le=Object.prototype.hasOwnProperty;function Be(t,e){var n=x(t),r=!n&&xe(t),i=!n&&!r&&Me(t),s=!n&&!r&&!i&&_e(t),o=n||r||i||s,a=o?pe(t.length,String):[],l=a.length;for(var c in t)!e&&!Le.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ut(c,l))||a.push(c);return a}function Ie(t,e){return function(n){return t(e(n))}}var De=Ie(Object.keys,Object),Re=Object.prototype.hasOwnProperty;function Ve(t){if(!fe(t))return De(t);var e=[];for(var n in Object(t))Re.call(t,n)&&"constructor"!=n&&e.push(n);return e}function ze(t){return he(t)?Be(t):Ve(t)}var $e=Object.prototype.hasOwnProperty,Fe=ge((function(t,e){if(fe(e)||he(e))se(e,ze(e),t);else for(var n in e)$e.call(e,n)&&ie(t,n,e[n])}));var Ge=Object.prototype.hasOwnProperty;function Ue(t){if(!k(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=fe(t),n=[];for(var r in t)("constructor"!=r||!e&&Ge.call(t,r))&&n.push(r);return n}function qe(t){return he(t)?Be(t,!0):Ue(t)}var We=ge((function(t,e){se(e,qe(e),t)})),He=ge((function(t,e,n,r){se(e,qe(e),t,r)})),Je=ge((function(t,e,n,r){se(e,ze(e),t,r)})),Xe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ye=/^\w*$/;function Ze(t,e){if(x(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!y(t))||(Ye.test(t)||!Xe.test(t)||null!=e&&t in Object(e))}var Ke=Q(Object,"create");var Qe=Object.prototype.hasOwnProperty;var tn=Object.prototype.hasOwnProperty;function en(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function nn(t,e){for(var n=t.length;n--;)if(ne(t[n][0],e))return n;return-1}en.prototype.clear=function(){this.__data__=Ke?Ke(null):{},this.size=0},en.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},en.prototype.get=function(t){var e=this.__data__;if(Ke){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Qe.call(e,t)?e[t]:void 0},en.prototype.has=function(t){var e=this.__data__;return Ke?void 0!==e[t]:tn.call(e,t)},en.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ke&&void 0===e?"__lodash_hash_undefined__":e,this};var rn=Array.prototype.splice;function sn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}sn.prototype.clear=function(){this.__data__=[],this.size=0},sn.prototype.delete=function(t){var e=this.__data__,n=nn(e,t);return!(n<0)&&(n==e.length-1?e.pop():rn.call(e,n,1),--this.size,!0)},sn.prototype.get=function(t){var e=this.__data__,n=nn(e,t);return n<0?void 0:e[n][1]},sn.prototype.has=function(t){return nn(this.__data__,t)>-1},sn.prototype.set=function(t,e){var n=this.__data__,r=nn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var on=Q(a,"Map");function an(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ln(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ln.prototype.clear=function(){this.size=0,this.__data__={hash:new en,map:new(on||sn),string:new en}},ln.prototype.delete=function(t){var e=an(this,t).delete(t);return this.size-=e?1:0,e},ln.prototype.get=function(t){return an(this,t).get(t)},ln.prototype.has=function(t){return an(this,t).has(t)},ln.prototype.set=function(t,e){var n=an(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function cn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=t.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(cn.Cache||ln),n}cn.Cache=ln;var hn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,un=/\\(\\)?/g,gn=function(t){var e=cn(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(hn,(function(t,n,r,i){e.push(r?i.replace(un,"$1"):n||t)})),e}));function dn(t){return null==t?"":C(t)}function fn(t,e){return x(t)?t:Ze(t,e)?[t]:gn(dn(t))}function pn(t){if("string"==typeof t||y(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function mn(t,e){for(var n=0,r=(e=fn(e,t)).length;null!=t&&n<r;)t=t[pn(e[n++])];return n&&n==r?t:void 0}function yn(t,e,n){var r=null==t?void 0:mn(t,e);return void 0===r?n:r}function vn(t,e){for(var n=-1,r=e.length,i=Array(r),s=null==t;++n<r;)i[n]=s?void 0:yn(t,e[n]);return i}function bn(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var xn=l?l.isConcatSpreadable:void 0;function wn(t){return x(t)||xe(t)||!!(xn&&t&&t[xn])}function An(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=wn),i||(i=[]);++s<o;){var a=t[s];e>0&&n(a)?e>1?An(a,e-1,n,r,i):bn(i,a):r||(i[i.length]=a)}return i}function Cn(t){return(null==t?0:t.length)?An(t,1):[]}function Pn(t){return _t(ae(t,void 0,Cn),t+"")}var Mn=Pn(vn),En=Ie(Object.getPrototypeOf,Object),Sn=Function.prototype,On=Object.prototype,Tn=Sn.toString,kn=On.hasOwnProperty,Nn=Tn.call(Object);function jn(t){if(!m(t)||"[object Object]"!=p(t))return!1;var e=En(t);if(null===e)return!0;var n=kn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Tn.call(n)==Nn}function _n(t){if(!m(t))return!1;var e=p(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!jn(t)}var Ln=le((function(t,e){try{return ot(t,void 0,e)}catch(t){return _n(t)?t:new Error(t)}}));function Bn(t,e){var n;if("function"!=typeof e)throw new TypeError("Expected a function");return t=R(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var In=le((function(t,e,n){var r=1;if(n.length){var i=Ht(n,Ft(In));r|=32}return Qt(t,r,e,n,i)}));In.placeholder={};var Dn=Pn((function(t,e){return Lt(e,(function(e){e=pn(e),ee(t,e,In(t[e],t))})),t})),Rn=le((function(t,e,n){var r=3;if(n.length){var i=Ht(n,Ft(Rn));r|=32}return Qt(e,r,t,n,i)}));function Vn(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function zn(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:Vn(t,e,n)}Rn.placeholder={};var $n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function Fn(t){return $n.test(t)}var Gn="\\ud800-\\udfff",Un="["+Gn+"]",qn="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Wn="\\ud83c[\\udffb-\\udfff]",Hn="[^"+Gn+"]",Jn="(?:\\ud83c[\\udde6-\\uddff]){2}",Xn="[\\ud800-\\udbff][\\udc00-\\udfff]",Yn="(?:"+qn+"|"+Wn+")"+"?",Zn="[\\ufe0e\\ufe0f]?",Kn=Zn+Yn+("(?:\\u200d(?:"+[Hn,Jn,Xn].join("|")+")"+Zn+Yn+")*"),Qn="(?:"+[Hn+qn+"?",qn,Jn,Xn,Un].join("|")+")",tr=RegExp(Wn+"(?="+Wn+")|"+Qn+Kn,"g");function er(t){return Fn(t)?function(t){return t.match(tr)||[]}(t):function(t){return t.split("")}(t)}function nr(t){return function(e){var n=Fn(e=dn(e))?er(e):void 0,r=n?n[0]:e.charAt(0),i=n?zn(n,1).join(""):e.slice(1);return r[t]()+i}}var rr=nr("toUpperCase");function ir(t){return rr(dn(t).toLowerCase())}function sr(t,e,n,r){var i=-1,s=null==t?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function or(t){return function(e){return null==t?void 0:t[e]}}var ar=or({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),lr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,cr=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function hr(t){return(t=dn(t))&&t.replace(lr,ar).replace(cr,"")}var ur=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var gr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var dr="\\ud800-\\udfff",fr="\\u2700-\\u27bf",pr="a-z\\xdf-\\xf6\\xf8-\\xff",mr="A-Z\\xc0-\\xd6\\xd8-\\xde",yr="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",vr="["+yr+"]",br="\\d+",xr="["+fr+"]",wr="["+pr+"]",Ar="[^"+dr+yr+br+fr+pr+mr+"]",Cr="(?:\\ud83c[\\udde6-\\uddff]){2}",Pr="[\\ud800-\\udbff][\\udc00-\\udfff]",Mr="["+mr+"]",Er="(?:"+wr+"|"+Ar+")",Sr="(?:"+Mr+"|"+Ar+")",Or="(?:['](?:d|ll|m|re|s|t|ve))?",Tr="(?:['](?:D|LL|M|RE|S|T|VE))?",kr="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Nr="[\\ufe0e\\ufe0f]?",jr=Nr+kr+("(?:\\u200d(?:"+["[^"+dr+"]",Cr,Pr].join("|")+")"+Nr+kr+")*"),_r="(?:"+[xr,Cr,Pr].join("|")+")"+jr,Lr=RegExp([Mr+"?"+wr+"+"+Or+"(?="+[vr,Mr,"$"].join("|")+")",Sr+"+"+Tr+"(?="+[vr,Mr+Er,"$"].join("|")+")",Mr+"?"+Er+"+"+Or,Mr+"+"+Tr,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",br,_r].join("|"),"g");function Br(t,e,n){return t=dn(t),void 0===(e=n?void 0:e)?function(t){return gr.test(t)}(t)?function(t){return t.match(Lr)||[]}(t):function(t){return t.match(ur)||[]}(t):t.match(e)||[]}var Ir=RegExp("[']","g");function Dr(t){return function(e){return sr(Br(hr(e).replace(Ir,"")),t,"")}}var Rr=Dr((function(t,e,n){return e=e.toLowerCase(),t+(n?ir(e):e)}));var Vr=a.isFinite,zr=Math.min;function $r(t){var e=Math[t];return function(t,n){if(t=B(t),(n=null==n?0:zr(R(n),292))&&Vr(t)){var r=(dn(t)+"e").split("e");return+((r=(dn(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Fr=$r("ceil");function Gr(t){var e=At(t);return e.__chain__=!0,e}var Ur=Math.ceil,qr=Math.max;function Wr(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function Hr(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=B(n))==n?n:0),void 0!==e&&(e=(e=B(e))==e?e:0),Wr(B(t),e,n)}function Jr(t){var e=this.__data__=new sn(t);this.size=e.size}function Xr(t,e){return t&&se(e,ze(e),t)}Jr.prototype.clear=function(){this.__data__=new sn,this.size=0},Jr.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Jr.prototype.get=function(t){return this.__data__.get(t)},Jr.prototype.has=function(t){return this.__data__.has(t)},Jr.prototype.set=function(t,e){var n=this.__data__;if(n instanceof sn){var r=n.__data__;if(!on||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ln(r)}return n.set(t,e),this.size=n.size,this};var Yr="object"==typeof t&&t&&!t.nodeType&&t,Zr=Yr&&"object"==typeof module&&module&&!module.nodeType&&module,Kr=Zr&&Zr.exports===Yr?a.Buffer:void 0,Qr=Kr?Kr.allocUnsafe:void 0;function ti(t,e){if(e)return t.slice();var n=t.length,r=Qr?Qr(n):new t.constructor(n);return t.copy(r),r}function ei(t,e){for(var n=-1,r=null==t?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}function ni(){return[]}var ri=Object.prototype.propertyIsEnumerable,ii=Object.getOwnPropertySymbols,si=ii?function(t){return null==t?[]:(t=Object(t),ei(ii(t),(function(e){return ri.call(t,e)})))}:ni;var oi=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)bn(e,si(t)),t=En(t);return e}:ni;function ai(t,e,n){var r=e(t);return x(t)?r:bn(r,n(t))}function li(t){return ai(t,ze,si)}function ci(t){return ai(t,qe,oi)}var hi=Q(a,"DataView"),ui=Q(a,"Promise"),gi=Q(a,"Set"),di="[object Map]",fi="[object Promise]",pi="[object Set]",mi="[object WeakMap]",yi="[object DataView]",vi=q(hi),bi=q(on),xi=q(ui),wi=q(gi),Ai=q(tt),Ci=p;(hi&&Ci(new hi(new ArrayBuffer(1)))!=yi||on&&Ci(new on)!=di||ui&&Ci(ui.resolve())!=fi||gi&&Ci(new gi)!=pi||tt&&Ci(new tt)!=mi)&&(Ci=function(t){var e=p(t),n="[object Object]"==e?t.constructor:void 0,r=n?q(n):"";if(r)switch(r){case vi:return yi;case bi:return di;case xi:return fi;case wi:return pi;case Ai:return mi}return e});var Pi=Ci,Mi=Object.prototype.hasOwnProperty;var Ei=a.Uint8Array;function Si(t){var e=new t.constructor(t.byteLength);return new Ei(e).set(new Ei(t)),e}var Oi=/\w*$/;var Ti=l?l.prototype:void 0,ki=Ti?Ti.valueOf:void 0;function Ni(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function ji(t,e,n){var r,i=t.constructor;switch(e){case"[object ArrayBuffer]":return Si(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Ni(t,n);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,Oi.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return r=t,ki?Object(ki.call(r)):{}}}function _i(t){return"function"!=typeof t.constructor||fe(t)?{}:it(En(t))}var Li=Ne&&Ne.isMap,Bi=Li?Se(Li):function(t){return m(t)&&"[object Map]"==Pi(t)};var Ii=Ne&&Ne.isSet,Di=Ii?Se(Ii):function(t){return m(t)&&"[object Set]"==Pi(t)},Ri="[object Arguments]",Vi="[object Function]",zi="[object Object]",$i={};function Fi(t,e,n,r,i,s){var o,a=1&e,l=2&e,c=4&e;if(n&&(o=i?n(t,r,i,s):n(t)),void 0!==o)return o;if(!k(t))return t;var h=x(t);if(h){if(o=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Mi.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!a)return bt(t,o)}else{var u=Pi(t),g=u==Vi||"[object GeneratorFunction]"==u;if(Me(t))return ti(t,a);if(u==zi||u==Ri||g&&!i){if(o=l||g?{}:_i(t),!a)return l?function(t,e){return se(t,oi(t),e)}(t,function(t,e){return t&&se(e,qe(e),t)}(o,t)):function(t,e){return se(t,si(t),e)}(t,Xr(o,t))}else{if(!$i[u])return i?t:{};o=ji(t,u,a)}}s||(s=new Jr);var d=s.get(t);if(d)return d;s.set(t,o),Di(t)?t.forEach((function(r){o.add(Fi(r,e,n,r,t,s))})):Bi(t)&&t.forEach((function(r,i){o.set(i,Fi(r,e,n,i,t,s))}));var f=h?void 0:(c?l?ci:li:l?qe:ze)(t);return Lt(f||t,(function(r,i){f&&(r=t[i=r]),ie(o,i,Fi(r,e,n,i,t,s))})),o}$i[Ri]=$i["[object Array]"]=$i["[object ArrayBuffer]"]=$i["[object DataView]"]=$i["[object Boolean]"]=$i["[object Date]"]=$i["[object Float32Array]"]=$i["[object Float64Array]"]=$i["[object Int8Array]"]=$i["[object Int16Array]"]=$i["[object Int32Array]"]=$i["[object Map]"]=$i["[object Number]"]=$i[zi]=$i["[object RegExp]"]=$i["[object Set]"]=$i["[object String]"]=$i["[object Symbol]"]=$i["[object Uint8Array]"]=$i["[object Uint8ClampedArray]"]=$i["[object Uint16Array]"]=$i["[object Uint32Array]"]=!0,$i["[object Error]"]=$i[Vi]=$i["[object WeakMap]"]=!1;function Gi(t){return Fi(t,4)}function Ui(t){return Fi(t,5)}function qi(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ln;++e<n;)this.add(t[e])}function Wi(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function Hi(t,e){return t.has(e)}qi.prototype.add=qi.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},qi.prototype.has=function(t){return this.__data__.has(t)};function Ji(t,e,n,r,i,s){var o=1&n,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(t),h=s.get(e);if(c&&h)return c==e&&h==t;var u=-1,g=!0,d=2&n?new qi:void 0;for(s.set(t,e),s.set(e,t);++u<a;){var f=t[u],p=e[u];if(r)var m=o?r(p,f,u,e,t,s):r(f,p,u,t,e,s);if(void 0!==m){if(m)continue;g=!1;break}if(d){if(!Wi(e,(function(t,e){if(!Hi(d,e)&&(f===t||i(f,t,n,r,s)))return d.push(e)}))){g=!1;break}}else if(f!==p&&!i(f,p,n,r,s)){g=!1;break}}return s.delete(t),s.delete(e),g}function Xi(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function Yi(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var Zi=l?l.prototype:void 0,Ki=Zi?Zi.valueOf:void 0;var Qi=Object.prototype.hasOwnProperty;var ts="[object Arguments]",es="[object Array]",ns="[object Object]",rs=Object.prototype.hasOwnProperty;function is(t,e,n,r,i,s){var o=x(t),a=x(e),l=o?es:Pi(t),c=a?es:Pi(e),h=(l=l==ts?ns:l)==ns,u=(c=c==ts?ns:c)==ns,g=l==c;if(g&&Me(t)){if(!Me(e))return!1;o=!0,h=!1}if(g&&!h)return s||(s=new Jr),o||_e(t)?Ji(t,e,n,r,i,s):function(t,e,n,r,i,s,o){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new Ei(t),new Ei(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ne(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=Xi;case"[object Set]":var l=1&r;if(a||(a=Yi),t.size!=e.size&&!l)return!1;var c=o.get(t);if(c)return c==e;r|=2,o.set(t,e);var h=Ji(a(t),a(e),r,i,s,o);return o.delete(t),h;case"[object Symbol]":if(Ki)return Ki.call(t)==Ki.call(e)}return!1}(t,e,l,n,r,i,s);if(!(1&n)){var d=h&&rs.call(t,"__wrapped__"),f=u&&rs.call(e,"__wrapped__");if(d||f){var p=d?t.value():t,m=f?e.value():e;return s||(s=new Jr),i(p,m,n,r,s)}}return!!g&&(s||(s=new Jr),function(t,e,n,r,i,s){var o=1&n,a=li(t),l=a.length;if(l!=li(e).length&&!o)return!1;for(var c=l;c--;){var h=a[c];if(!(o?h in e:Qi.call(e,h)))return!1}var u=s.get(t),g=s.get(e);if(u&&g)return u==e&&g==t;var d=!0;s.set(t,e),s.set(e,t);for(var f=o;++c<l;){var p=t[h=a[c]],m=e[h];if(r)var y=o?r(m,p,h,e,t,s):r(p,m,h,t,e,s);if(!(void 0===y?p===m||i(p,m,n,r,s):y)){d=!1;break}f||(f="constructor"==h)}if(d&&!f){var v=t.constructor,b=e.constructor;v==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b||(d=!1)}return s.delete(t),s.delete(e),d}(t,e,n,r,i,s))}function ss(t,e,n,r,i){return t===e||(null==t||null==e||!m(t)&&!m(e)?t!=t&&e!=e:is(t,e,n,r,ss,i))}function os(t,e,n,r){var i=n.length,s=i,o=!r;if(null==t)return!s;for(t=Object(t);i--;){var a=n[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){var l=(a=n[i])[0],c=t[l],h=a[1];if(o&&a[2]){if(void 0===c&&!(l in t))return!1}else{var u=new Jr;if(r)var g=r(c,h,l,t,e,u);if(!(void 0===g?ss(h,c,3,r,u):g))return!1}}return!0}function as(t){return t==t&&!k(t)}function ls(t){for(var e=ze(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,as(i)]}return e}function cs(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function hs(t){var e=ls(t);return 1==e.length&&e[0][2]?cs(e[0][0],e[0][1]):function(n){return n===t||os(n,t,e)}}function us(t,e){return null!=t&&e in Object(t)}function gs(t,e,n){for(var r=-1,i=(e=fn(e,t)).length,s=!1;++r<i;){var o=pn(e[r]);if(!(s=null!=t&&n(t,o)))break;t=t[o]}return s||++r!=i?s:!!(i=null==t?0:t.length)&&ce(i)&&Ut(o,i)&&(x(t)||xe(t))}function ds(t,e){return null!=t&&gs(t,e,us)}function fs(t,e){return Ze(t)&&as(e)?cs(pn(t),e):function(n){var r=yn(n,t);return void 0===r&&r===e?ds(n,t):ss(e,r,3)}}function ps(t){return function(e){return null==e?void 0:e[t]}}function ms(t){return Ze(t)?ps(pn(t)):function(t){return function(e){return mn(e,t)}}(t)}function ys(t){return"function"==typeof t?t:null==t?V:"object"==typeof t?x(t)?fs(t[0],t[1]):hs(t):ms(t)}function vs(t,e,n){var r=n.length;if(null==t)return!r;for(t=Object(t);r--;){var i=n[r],s=e[i],o=t[i];if(void 0===o&&!(i in t)||!s(o))return!1}return!0}function bs(t,e,n,r){for(var i=-1,s=null==t?0:t.length;++i<s;){var o=t[i];e(r,o,n(o),t)}return r}function xs(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[t?a:++i];if(!1===n(s[l],l,s))break}return e}}var ws=xs();function As(t,e){return t&&ws(t,e,ze)}function Cs(t,e){return function(n,r){if(null==n)return n;if(!he(n))return t(n,r);for(var i=n.length,s=e?i:-1,o=Object(n);(e?s--:++s<i)&&!1!==r(o[s],s,o););return n}}var Ps=Cs(As);function Ms(t,e,n,r){return Ps(t,(function(t,i,s){e(r,t,n(t),s)})),r}function Es(t,e){return function(n,r){var i=x(n)?bs:Ms,s=e?e():{};return i(n,t,ys(r),s)}}var Ss=Object.prototype.hasOwnProperty,Os=Es((function(t,e,n){Ss.call(t,n)?++t[n]:ee(t,n,1)}));function Ts(t,e,n){var r=Qt(t,8,void 0,void 0,void 0,void 0,void 0,e=n?void 0:e);return r.placeholder=Ts.placeholder,r}Ts.placeholder={};function ks(t,e,n){var r=Qt(t,16,void 0,void 0,void 0,void 0,void 0,e=n?void 0:e);return r.placeholder=ks.placeholder,r}ks.placeholder={};var Ns=function(){return a.Date.now()},js=Math.max,_s=Math.min;function Ls(t,e,n){var r,i,s,o,a,l,c=0,h=!1,u=!1,g=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){var n=r,s=i;return r=i=void 0,c=e,o=t.apply(s,n)}function f(t){var n=t-l;return void 0===l||n>=e||n<0||u&&t-c>=s}function p(){var t=Ns();if(f(t))return m(t);a=setTimeout(p,function(t){var n=e-(t-l);return u?_s(n,s-(t-c)):n}(t))}function m(t){return a=void 0,g&&r?d(t):(r=i=void 0,o)}function y(){var t=Ns(),n=f(t);if(r=arguments,i=this,l=t,n){if(void 0===a)return function(t){return c=t,a=setTimeout(p,e),h?d(t):o}(l);if(u)return clearTimeout(a),a=setTimeout(p,e),d(l)}return void 0===a&&(a=setTimeout(p,e)),o}return e=B(e)||0,k(n)&&(h=!!n.leading,s=(u="maxWait"in n)?js(B(n.maxWait)||0,e):s,g="trailing"in n?!!n.trailing:g),y.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=i=a=void 0},y.flush=function(){return void 0===a?o:m(Ns())},y}var Bs=Object.prototype,Is=Bs.hasOwnProperty,Ds=le((function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&ue(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],o=qe(s),a=-1,l=o.length;++a<l;){var c=o[a],h=t[c];(void 0===h||ne(h,Bs[c])&&!Is.call(t,c))&&(t[c]=s[c])}return t}));function Rs(t,e,n){(void 0!==n&&!ne(t[e],n)||void 0===n&&!(e in t))&&ee(t,e,n)}function Vs(t){return m(t)&&he(t)}function zs(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function $s(t){return se(t,qe(t))}function Fs(t,e,n,r,i){t!==e&&ws(e,(function(s,o){if(i||(i=new Jr),k(s))!function(t,e,n,r,i,s,o){var a=zs(t,n),l=zs(e,n),c=o.get(l);if(c)Rs(t,n,c);else{var h=s?s(a,l,n+"",t,e,o):void 0,u=void 0===h;if(u){var g=x(l),d=!g&&Me(l),f=!g&&!d&&_e(l);h=l,g||d||f?x(a)?h=a:Vs(a)?h=bt(a):d?(u=!1,h=ti(l,!0)):f?(u=!1,h=Ni(l,!0)):h=[]:jn(l)||xe(l)?(h=a,xe(a)?h=$s(a):k(a)&&!z(a)||(h=_i(l))):u=!1}u&&(o.set(l,h),i(h,l,r,s,o),o.delete(l)),Rs(t,n,h)}}(t,e,o,n,Fs,r,i);else{var a=r?r(zs(t,o),s,o+"",t,e,i):void 0;void 0===a&&(a=s),Rs(t,o,a)}}),qe)}function Gs(t,e,n,r,i,s){return k(t)&&k(e)&&(s.set(e,t),Fs(t,e,void 0,Gs,s),s.delete(e)),t}var Us=ge((function(t,e,n,r){Fs(t,e,n,r)})),qs=le((function(t){return t.push(void 0,Gs),ot(Us,void 0,t)}));function Ws(t,e,n){if("function"!=typeof t)throw new TypeError("Expected a function");return setTimeout((function(){t.apply(void 0,n)}),e)}var Hs=le((function(t,e){return Ws(t,1,e)})),Js=le((function(t,e,n){return Ws(t,B(e)||0,n)}));function Xs(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Ys(t,e,n,r){var i=-1,s=Rt,o=!0,a=t.length,l=[],c=e.length;if(!a)return l;n&&(e=b(e,Se(n))),r?(s=Xs,o=!1):e.length>=200&&(s=Hi,o=!1,e=new qi(e));t:for(;++i<a;){var h=t[i],u=null==n?h:n(h);if(h=r||0!==h?h:0,o&&u==u){for(var g=c;g--;)if(e[g]===u)continue t;l.push(h)}else s(e,u,r)||l.push(h)}return l}var Zs=le((function(t,e){return Vs(t)?Ys(t,An(e,1,Vs,!0)):[]}));function Ks(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var Qs=le((function(t,e){var n=Ks(e);return Vs(n)&&(n=void 0),Vs(t)?Ys(t,An(e,1,Vs,!0),ys(n)):[]})),to=le((function(t,e){var n=Ks(e);return Vs(n)&&(n=void 0),Vs(t)?Ys(t,An(e,1,Vs,!0),void 0,n):[]})),eo=P((function(t,e){return t/e}),1);function no(t,e,n,r){for(var i=t.length,s=r?i:-1;(r?s--:++s<i)&&e(t[s],s,t););return n?Vn(t,r?0:s,r?s+1:i):Vn(t,r?s+1:0,r?i:s)}function ro(t){return"function"==typeof t?t:V}function io(t,e){return(x(t)?Lt:Ps)(t,ro(e))}function so(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}var oo=xs(!0);function ao(t,e){return t&&oo(t,e,ze)}var lo=Cs(ao,!0);function co(t,e){return(x(t)?so:lo)(t,ro(e))}function ho(t){return function(e){var n=Pi(e);return"[object Map]"==n?Xi(e):"[object Set]"==n?function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}(e):function(t,e){return b(e,(function(e){return[e,t[e]]}))}(e,t(e))}}var uo=ho(ze),go=ho(qe),fo=or({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),po=/[&<>"']/g,mo=RegExp(po.source);function yo(t){return(t=dn(t))&&mo.test(t)?t.replace(po,fo):t}var vo=/[\\^$.*+?()[\]{}|]/g,bo=RegExp(vo.source);function xo(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function wo(t,e){var n=!0;return Ps(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function Ao(t){return t?Wr(R(t),0,4294967295):0}function Co(t,e){var n=[];return Ps(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function Po(t){return function(e,n,r){var i=Object(e);if(!he(e)){var s=ys(n);e=ze(e),n=function(t){return s(i[t],t,i)}}var o=t(e,n,r);return o>-1?i[s?e[o]:o]:void 0}}var Mo=Math.max;function Eo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:R(n);return i<0&&(i=Mo(r+i,0)),Bt(t,ys(e),i)}var So=Po(Eo);function Oo(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}var To=Math.max,ko=Math.min;function No(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=R(n),i=n<0?To(r+i,0):ko(i,r-1)),Bt(t,ys(e),i,!0)}var jo=Po(No);function _o(t){return t&&t.length?t[0]:void 0}function Lo(t,e){var n=-1,r=he(t)?Array(t.length):[];return Ps(t,(function(t,i,s){r[++n]=e(t,i,s)})),r}function Bo(t,e){return(x(t)?b:Lo)(t,ys(e))}var Io=1/0;var Do=1/0;var Ro=$r("floor");function Vo(t){return Pn((function(e){var n=e.length,r=n,i=vt.prototype.thru;for(t&&e.reverse();r--;){var s=e[r];if("function"!=typeof s)throw new TypeError("Expected a function");if(i&&!o&&"wrapper"==yt(s))var o=new vt([],!0)}for(r=o?r:n;++r<n;){var a=yt(s=e[r]),l="wrapper"==a?ft(s):void 0;o=l&&Ct(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?o[yt(l[0])].apply(o,l[3]):1==s.length&&Ct(s)?o[a]():o.thru(s)}return function(){var t=arguments,r=t[0];if(o&&1==t.length&&x(r))return o.plant(r).value();for(var i=0,s=n?e[i].apply(this,t):r;++i<n;)s=e[i].call(this,s);return s}}))}var zo=Vo(),$o=Vo(!0);function Fo(t,e){return ei(e,(function(e){return z(t[e])}))}var Go=Object.prototype.hasOwnProperty,Uo=Es((function(t,e,n){Go.call(t,n)?t[n].push(e):ee(t,n,[e])}));function qo(t,e){return t>e}function Wo(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=B(e),n=B(n)),t(e,n)}}var Ho=Wo(qo),Jo=Wo((function(t,e){return t>=e})),Xo=Object.prototype.hasOwnProperty;function Yo(t,e){return null!=t&&Xo.call(t,e)}function Zo(t,e){return null!=t&&gs(t,e,Yo)}var Ko=Math.max,Qo=Math.min;function ta(t){return"string"==typeof t||!x(t)&&m(t)&&"[object String]"==p(t)}function ea(t,e){return b(e,(function(e){return t[e]}))}function na(t){return null==t?[]:ea(t,ze(t))}var ra=Math.max;var ia=Math.max;var sa=Math.min;function oa(t,e,n){for(var r=n?Xs:Rt,i=t[0].length,s=t.length,o=s,a=Array(s),l=1/0,c=[];o--;){var h=t[o];o&&e&&(h=b(h,Se(e))),l=sa(h.length,l),a[o]=!n&&(e||i>=120&&h.length>=120)?new qi(o&&h):void 0}h=t[0];var u=-1,g=a[0];t:for(;++u<i&&c.length<l;){var d=h[u],f=e?e(d):d;if(d=n||0!==d?d:0,!(g?Hi(g,f):r(c,f,n))){for(o=s;--o;){var p=a[o];if(!(p?Hi(p,f):r(t[o],f,n)))continue t}g&&g.push(f),c.push(d)}}return c}function aa(t){return Vs(t)?t:[]}var la=le((function(t){var e=b(t,aa);return e.length&&e[0]===t[0]?oa(e):[]})),ca=le((function(t){var e=Ks(t),n=b(t,aa);return e===Ks(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?oa(n,ys(e)):[]})),ha=le((function(t){var e=Ks(t),n=b(t,aa);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?oa(n,void 0,e):[]}));function ua(t,e){return function(n,r){return function(t,e,n,r){return As(t,(function(t,i,s){e(r,n(t),i,s)})),r}(n,t,e(r),{})}}var ga=Object.prototype.toString,da=ua((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=ga.call(e)),t[e]=n}),kt(V)),fa=Object.prototype,pa=fa.hasOwnProperty,ma=fa.toString,ya=ua((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=ma.call(e)),pa.call(t,e)?t[e].push(n):t[e]=[n]}),ys);function va(t,e){return e.length<2?t:mn(t,Vn(e,0,-1))}function ba(t,e,n){var r=null==(t=va(t,e=fn(e,t)))?t:t[pn(Ks(e))];return null==r?void 0:ot(r,t,n)}var xa=le(ba),wa=le((function(t,e,n){var r=-1,i="function"==typeof e,s=he(t)?Array(t.length):[];return Ps(t,(function(t){s[++r]=i?ot(e,t,n):ba(t,e,n)})),s}));var Aa=Ne&&Ne.isArrayBuffer,Ca=Aa?Se(Aa):function(t){return m(t)&&"[object ArrayBuffer]"==p(t)};var Pa=Ne&&Ne.isDate,Ma=Pa?Se(Pa):function(t){return m(t)&&"[object Date]"==p(t)};var Ea=Object.prototype.hasOwnProperty;function Sa(t){if(null==t)return!0;if(he(t)&&(x(t)||"string"==typeof t||"function"==typeof t.splice||Me(t)||_e(t)||xe(t)))return!t.length;var e=Pi(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(fe(t))return!Ve(t).length;for(var n in t)if(Ea.call(t,n))return!1;return!0}function Oa(t,e){return ss(t,e)}var Ta=a.isFinite;function ka(t){return"number"==typeof t&&t==R(t)}function Na(t){return"number"==typeof t||m(t)&&"[object Number]"==p(t)}var ja=F?z:we;var _a=Ne&&Ne.isRegExp,La=_a?Se(_a):function(t){return m(t)&&"[object RegExp]"==p(t)},Ba=9007199254740991;var Ia=Array.prototype.join;var Da=Dr((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ra=Es((function(t,e,n){ee(t,n,e)}));var Va=Math.max,za=Math.min;var $a=Dr((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Fa=nr("toLowerCase");function Ga(t,e){return t<e}var Ua=Wo(Ga),qa=Wo((function(t,e){return t<=e}));function Wa(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],o=e(s);if(null!=o&&(void 0===a?o==o&&!y(o):n(o,a)))var a=o,l=s}return l}function Ha(t){return t&&t.length?Wa(t,V,qo):void 0}function Ja(t,e){for(var n,r=-1,i=t.length;++r<i;){var s=e(t[r]);void 0!==s&&(n=void 0===n?s:n+s)}return n}function Xa(t,e){var n=null==t?0:t.length;return n?Ja(t,e)/n:NaN}var Ya=ge((function(t,e,n){Fs(t,e,n)})),Za=le((function(t,e){return function(n){return ba(n,t,e)}})),Ka=le((function(t,e){return function(n){return ba(t,n,e)}}));function Qa(t,e,n){var r=ze(e),i=Fo(e,r),s=!(k(n)&&"chain"in n&&!n.chain),o=z(t);return Lt(i,(function(n){var r=e[n];t[n]=r,o&&(t.prototype[n]=function(){var e=this.__chain__;if(s||e){var n=t(this.__wrapped__);return(n.__actions__=bt(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,bn([this.value()],arguments))})})),t}var tl=P((function(t,e){return t*e}),1);function el(t){if("function"!=typeof t)throw new TypeError("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var nl=l?l.iterator:void 0;function rl(t){if(!t)return[];if(he(t))return ta(t)?er(t):bt(t);if(nl&&t[nl])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[nl]());var e=Pi(t);return("[object Map]"==e?Xi:"[object Set]"==e?Yi:na)(t)}function il(t,e){var n=t.length;if(n)return Ut(e+=e<0?n:0,n)?t[e]:void 0}function sl(t,e){return null==(t=va(t,e=fn(e,t)))||delete t[pn(Ks(e))]}function ol(t){return jn(t)?void 0:t}var al=Pn((function(t,e){var n={};if(null==t)return n;var r=!1;e=b(e,(function(e){return e=fn(e,t),r||(r=e.length>1),e})),se(t,ci(t),n),r&&(n=Fi(n,7,ol));for(var i=e.length;i--;)sl(n,e[i]);return n}));function ll(t,e,n,r){if(!k(t))return t;for(var i=-1,s=(e=fn(e,t)).length,o=s-1,a=t;null!=a&&++i<s;){var l=pn(e[i]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(i!=o){var h=a[l];void 0===(c=r?r(h,l,a):void 0)&&(c=k(h)?h:Ut(e[i+1])?[]:{})}ie(a,l,c),a=a[l]}return t}function cl(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=mn(t,o);n(a,o)&&ll(s,fn(o,t),a)}return s}function hl(t,e){if(null==t)return{};var n=b(ci(t),(function(t){return[t]}));return e=ys(e),cl(t,n,(function(t,n){return e(t,n[0])}))}function ul(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,s=y(t),o=void 0!==e,a=null===e,l=e==e,c=y(e);if(!a&&!c&&!s&&t>e||s&&o&&l&&!a&&!c||r&&o&&l||!n&&l||!i)return 1;if(!r&&!s&&!c&&t<e||c&&n&&i&&!r&&!s||a&&n&&i||!o&&i||!l)return-1}return 0}function gl(t,e,n){e=e.length?b(e,(function(t){return x(t)?function(e){return mn(e,1===t.length?t[0]:t)}:t})):[V];var r=-1;e=b(e,Se(ys));var i=Lo(t,(function(t,n,i){var s=b(e,(function(e){return e(t)}));return{criteria:s,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,s=e.criteria,o=i.length,a=n.length;++r<o;){var l=ul(i[r],s[r]);if(l)return r>=a?l:l*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function dl(t){return Pn((function(e){return e=b(e,Se(ys)),le((function(n){var r=this;return t(e,(function(t){return ot(t,r,n)}))}))}))}var fl=dl(b),pl=le,ml=Math.min,yl=pl((function(t,e){var n=(e=1==e.length&&x(e[0])?b(e[0],Se(ys)):b(An(e,1),Se(ys))).length;return le((function(r){for(var i=-1,s=ml(r.length,n);++i<s;)r[i]=e[i].call(this,r[i]);return ot(t,this,r)}))})),vl=dl(xo),bl=dl(Wi),xl=Math.floor;function wl(t,e){var n="";if(!t||e<1||e>9007199254740991)return n;do{e%2&&(n+=t),(e=xl(e/2))&&(t+=t)}while(e);return n}var Al=ps("length"),Cl="\\ud800-\\udfff",Pl="["+Cl+"]",Ml="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",El="\\ud83c[\\udffb-\\udfff]",Sl="[^"+Cl+"]",Ol="(?:\\ud83c[\\udde6-\\uddff]){2}",Tl="[\\ud800-\\udbff][\\udc00-\\udfff]",kl="(?:"+Ml+"|"+El+")"+"?",Nl="[\\ufe0e\\ufe0f]?",jl=Nl+kl+("(?:\\u200d(?:"+[Sl,Ol,Tl].join("|")+")"+Nl+kl+")*"),_l="(?:"+[Sl+Ml+"?",Ml,Ol,Tl,Pl].join("|")+")",Ll=RegExp(El+"(?="+El+")|"+_l+jl,"g");function Bl(t){return Fn(t)?function(t){for(var e=Ll.lastIndex=0;Ll.test(t);)++e;return e}(t):Al(t)}var Il=Math.ceil;function Dl(t,e){var n=(e=void 0===e?" ":C(e)).length;if(n<2)return n?wl(e,t):e;var r=wl(e,Il(t/Bl(e)));return Fn(e)?zn(er(r),0,t).join(""):r.slice(0,t)}var Rl=Math.ceil,Vl=Math.floor;var zl=/^\s+/,$l=a.parseInt;var Fl=le((function(t,e){return Qt(t,32,void 0,e,Ht(e,Ft(Fl)))}));Fl.placeholder={};var Gl=le((function(t,e){return Qt(t,64,void 0,e,Ht(e,Ft(Gl)))}));Gl.placeholder={};var Ul=Es((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var ql=Pn((function(t,e){return null==t?{}:function(t,e){return cl(t,e,(function(e,n){return ds(t,n)}))}(t,e)}));function Wl(t,e,n,r){for(var i=n-1,s=t.length;++i<s;)if(r(t[i],e))return i;return-1}var Hl=Array.prototype.splice;function Jl(t,e,n,r){var i=r?Wl:Dt,s=-1,o=e.length,a=t;for(t===e&&(e=bt(e)),n&&(a=b(t,Se(n)));++s<o;)for(var l=0,c=e[s],h=n?n(c):c;(l=i(a,h,l,r))>-1;)a!==t&&Hl.call(a,l,1),Hl.call(t,l,1);return t}function Xl(t,e){return t&&t.length&&e&&e.length?Jl(t,e):t}var Yl=le(Xl);var Zl=Array.prototype.splice;function Kl(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==s){var s=i;Ut(i)?Zl.call(t,i,1):sl(t,i)}}return t}var Ql=Pn((function(t,e){var n=null==t?0:t.length,r=vn(t,e);return Kl(t,b(e,(function(t){return Ut(t,n)?+t:t})).sort(ul)),r})),tc=Math.floor,ec=Math.random;function nc(t,e){return t+tc(ec()*(e-t+1))}var rc=parseFloat,ic=Math.min,sc=Math.random;var oc=Math.ceil,ac=Math.max;function lc(t){return function(e,n,r){return r&&"number"!=typeof r&&ue(e,n,r)&&(n=r=void 0),e=D(e),void 0===n?(n=e,e=0):n=D(n),function(t,e,n,r){for(var i=-1,s=ac(oc((e-t)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=t,t+=n;return o}(e,n,r=void 0===r?e<n?1:-1:D(r),t)}}var cc=lc(),hc=lc(!0),uc=Pn((function(t,e){return Qt(t,256,void 0,void 0,void 0,e)}));function gc(t,e,n,r,i){return i(t,(function(t,i,s){n=r?(r=!1,t):e(n,t,i,s)})),n}function dc(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}var fc=Array.prototype.reverse;function pc(t){return null==t?t:fc.call(t)}var mc=$r("round");function yc(t){var e=t.length;return e?t[nc(0,e-1)]:void 0}function vc(t){return yc(na(t))}function bc(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n<e;){var s=nc(n,i),o=t[s];t[s]=t[n],t[n]=o}return t.length=e,t}function xc(t,e){return bc(bt(t),Wr(e,0,t.length))}function wc(t,e){var n=na(t);return bc(n,Wr(e,0,n.length))}function Ac(t){return bc(bt(t))}function Cc(t){return bc(na(t))}var Pc=Dr((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));function Mc(t,e){var n;return Ps(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}var Ec=le((function(t,e){if(null==t)return[];var n=e.length;return n>1&&ue(t,e[0],e[1])?e=[]:n>2&&ue(e[0],e[1],e[2])&&(e=[e[0]]),gl(t,An(e,1),[])})),Sc=Math.floor,Oc=Math.min;function Tc(t,e,n,r){var i=0,s=null==t?0:t.length;if(0===s)return 0;for(var o=(e=n(e))!=e,a=null===e,l=y(e),c=void 0===e;i<s;){var h=Sc((i+s)/2),u=n(t[h]),g=void 0!==u,d=null===u,f=u==u,p=y(u);if(o)var m=r||f;else m=c?f&&(r||g):a?f&&g&&(r||!d):l?f&&g&&!d&&(r||!p):!d&&!p&&(r?u<=e:u<e);m?i=h+1:s=h}return Oc(s,4294967294)}function kc(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var s=r+i>>>1,o=t[s];null!==o&&!y(o)&&(n?o<=e:o<e)?r=s+1:i=s}return i}return Tc(t,e,V,n)}function Nc(t,e){return kc(t,e)}function jc(t,e,n){return Tc(t,e,ys(n))}function _c(t,e){for(var n=-1,r=t.length,i=0,s=[];++n<r;){var o=t[n],a=e?e(o):o;if(!n||!ne(a,l)){var l=a;s[i++]=0===o?0:o}}return s}var Lc=Math.max;var Bc=Dr((function(t,e,n){return t+(n?" ":"")+rr(e)}));var Ic=P((function(t,e){return t-e}),0);var Dc=Object.prototype,Rc=Dc.hasOwnProperty;function Vc(t,e,n,r){return void 0===t||ne(t,Dc[n])&&!Rc.call(r,n)?e:t}var zc={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function $c(t){return"\\"+zc[t]}var Fc=/<%=([\s\S]+?)%>/g,Gc={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:Fc,variable:"",imports:{_:{escape:yo}}},Uc=/\b__p \+= '';/g,qc=/\b(__p \+=) '' \+/g,Wc=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Hc=/[()=,{}\[\]\/\s]/,Jc=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Xc=/($^)/,Yc=/['\n\r\u2028\u2029\\]/g,Zc=Object.prototype.hasOwnProperty;function Kc(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return k(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ls(t,e,{leading:r,maxWait:e,trailing:i})}function Qc(t,e){return e(t)}var th=4294967295,eh=Math.min;function nh(t,e){var n=t;return n instanceof gt&&(n=n.value()),sr(e,(function(t,e){return e.func.apply(e.thisArg,bn([t],e.args))}),n)}function rh(){return nh(this.__wrapped__,this.__actions__)}var ih=9007199254740991;function sh(t,e){for(var n=t.length;n--&&Dt(e,t[n],0)>-1;);return n}function oh(t,e){for(var n=-1,r=t.length;++n<r&&Dt(e,t[n],0)>-1;);return n}var ah=/^\s+/;var lh=/\w*$/;var ch=or({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hh=/&(?:amp|lt|gt|quot|#39);/g,uh=RegExp(hh.source);var gh=gi&&1/Yi(new gi([,-0]))[1]==1/0?function(t){return new gi(t)}:dt;function dh(t,e,n){var r=-1,i=Rt,s=t.length,o=!0,a=[],l=a;if(n)o=!1,i=Xs;else if(s>=200){var c=e?null:gh(t);if(c)return Yi(c);o=!1,i=Hi,l=new qi}else l=e?[]:a;t:for(;++r<s;){var h=t[r],u=e?e(h):h;if(h=n||0!==h?h:0,o&&u==u){for(var g=l.length;g--;)if(l[g]===u)continue t;e&&l.push(u),a.push(h)}else i(l,u,n)||(l!==a&&l.push(u),a.push(h))}return a}var fh=le((function(t){return dh(An(t,1,Vs,!0))})),ph=le((function(t){var e=Ks(t);return Vs(e)&&(e=void 0),dh(An(t,1,Vs,!0),ys(e))})),mh=le((function(t){var e=Ks(t);return e="function"==typeof e?e:void 0,dh(An(t,1,Vs,!0),void 0,e)}));function yh(t){return t&&t.length?dh(t):[]}var vh=0;function bh(t){var e=++vh;return dn(t)+e}var xh=Math.max;function wh(t){if(!t||!t.length)return[];var e=0;return t=ei(t,(function(t){if(Vs(t))return e=xh(t.length,e),!0})),pe(e,(function(e){return b(t,ps(e))}))}function Ah(t,e){if(!t||!t.length)return[];var n=wh(t);return null==e?n:b(n,(function(t){return ot(e,void 0,t)}))}function Ch(t,e,n,r){return ll(t,e,n(mn(t,e)),r)}var Ph=Dr((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}));var Mh=le((function(t,e){return Vs(t)?Ys(t,e):[]}));var Eh=Pn((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return vn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof gt&&Ut(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:Qc,args:[i],thisArg:void 0}),new vt(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)}));function Sh(t,e,n){var r=t.length;if(r<2)return r?dh(t[0]):[];for(var i=-1,s=Array(r);++i<r;)for(var o=t[i],a=-1;++a<r;)a!=i&&(s[i]=Ys(s[i]||o,t[a],e,n));return dh(An(s,1),e,n)}var Oh=le((function(t){return Sh(ei(t,Vs))})),Th=le((function(t){var e=Ks(t);return Vs(e)&&(e=void 0),Sh(ei(t,Vs),ys(e))})),kh=le((function(t){var e=Ks(t);return e="function"==typeof e?e:void 0,Sh(ei(t,Vs),void 0,e)})),Nh=le(wh);function jh(t,e,n){for(var r=-1,i=t.length,s=e.length,o={};++r<i;){var a=r<s?e[r]:void 0;n(o,t[r],a)}return o}var _h=le((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Ah(t,n)})),Lh={chunk:function(t,e,n){e=(n?ue(t,e,n):void 0===e)?1:qr(R(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var i=0,s=0,o=Array(Ur(r/e));i<r;)o[s++]=Vn(t,i,i+=e);return o},compact:function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i},concat:function(){var t=arguments.length;if(!t)return[];for(var e=Array(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return bn(x(n)?bt(n):[n],An(e,1))},difference:Zs,differenceBy:Qs,differenceWith:to,drop:function(t,e,n){var r=null==t?0:t.length;return r?Vn(t,(e=n||void 0===e?1:R(e))<0?0:e,r):[]},dropRight:function(t,e,n){var r=null==t?0:t.length;return r?Vn(t,0,(e=r-(e=n||void 0===e?1:R(e)))<0?0:e):[]},dropRightWhile:function(t,e){return t&&t.length?no(t,ys(e),!0,!0):[]},dropWhile:function(t,e){return t&&t.length?no(t,ys(e),!0):[]},fill:function(t,e,n,r){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&ue(t,e,n)&&(n=0,r=i),function(t,e,n,r){var i=t.length;for((n=R(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:R(r))<0&&(r+=i),r=n>r?0:Ao(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},findIndex:Eo,findLastIndex:No,first:_o,flatten:Cn,flattenDeep:function(t){return(null==t?0:t.length)?An(t,Do):[]},flattenDepth:function(t,e){return(null==t?0:t.length)?An(t,e=void 0===e?1:R(e)):[]},fromPairs:function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},head:_o,indexOf:function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:R(n);return i<0&&(i=ia(r+i,0)),Dt(t,e,i)},initial:function(t){return(null==t?0:t.length)?Vn(t,0,-1):[]},intersection:la,intersectionBy:ca,intersectionWith:ha,join:function(t,e){return null==t?"":Ia.call(t,e)},last:Ks,lastIndexOf:function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=R(n))<0?Va(r+i,0):za(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):Bt(t,It,i,!0)},nth:function(t,e){return t&&t.length?il(t,R(e)):void 0},pull:Yl,pullAll:Xl,pullAllBy:function(t,e,n){return t&&t.length&&e&&e.length?Jl(t,e,ys(n)):t},pullAllWith:function(t,e,n){return t&&t.length&&e&&e.length?Jl(t,e,void 0,n):t},pullAt:Ql,remove:function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],s=t.length;for(e=ys(e);++r<s;){var o=t[r];e(o,r,t)&&(n.push(o),i.push(r))}return Kl(t,i),n},reverse:pc,slice:function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&ue(t,e,n)?(e=0,n=r):(e=null==e?0:R(e),n=void 0===n?r:R(n)),Vn(t,e,n)):[]},sortedIndex:Nc,sortedIndexBy:jc,sortedIndexOf:function(t,e){var n=null==t?0:t.length;if(n){var r=kc(t,e);if(r<n&&ne(t[r],e))return r}return-1},sortedLastIndex:function(t,e){return kc(t,e,!0)},sortedLastIndexBy:function(t,e,n){return Tc(t,e,ys(n),!0)},sortedLastIndexOf:function(t,e){if(null==t?0:t.length){var n=kc(t,e,!0)-1;if(ne(t[n],e))return n}return-1},sortedUniq:function(t){return t&&t.length?_c(t):[]},sortedUniqBy:function(t,e){return t&&t.length?_c(t,ys(e)):[]},tail:function(t){var e=null==t?0:t.length;return e?Vn(t,1,e):[]},take:function(t,e,n){return t&&t.length?Vn(t,0,(e=n||void 0===e?1:R(e))<0?0:e):[]},takeRight:function(t,e,n){var r=null==t?0:t.length;return r?Vn(t,(e=r-(e=n||void 0===e?1:R(e)))<0?0:e,r):[]},takeRightWhile:function(t,e){return t&&t.length?no(t,ys(e),!1,!0):[]},takeWhile:function(t,e){return t&&t.length?no(t,ys(e)):[]},union:fh,unionBy:ph,unionWith:mh,uniq:yh,uniqBy:function(t,e){return t&&t.length?dh(t,ys(e)):[]},uniqWith:function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?dh(t,void 0,e):[]},unzip:wh,unzipWith:Ah,without:Mh,xor:Oh,xorBy:Th,xorWith:kh,zip:Nh,zipObject:function(t,e){return jh(t||[],e||[],ie)},zipObjectDeep:function(t,e){return jh(t||[],e||[],ll)},zipWith:_h},Bh={countBy:Os,each:io,eachRight:co,every:function(t,e,n){var r=x(t)?xo:wo;return n&&ue(t,e,n)&&(e=void 0),r(t,ys(e))},filter:function(t,e){return(x(t)?ei:Co)(t,ys(e))},find:So,findLast:jo,flatMap:function(t,e){return An(Bo(t,e),1)},flatMapDeep:function(t,e){return An(Bo(t,e),Io)},flatMapDepth:function(t,e,n){return n=void 0===n?1:R(n),An(Bo(t,e),n)},forEach:io,forEachRight:co,groupBy:Uo,includes:function(t,e,n,r){t=he(t)?t:na(t),n=n&&!r?R(n):0;var i=t.length;return n<0&&(n=ra(i+n,0)),ta(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Dt(t,e,n)>-1},invokeMap:wa,keyBy:Ra,map:Bo,orderBy:function(t,e,n,r){return null==t?[]:(x(e)||(e=null==e?[]:[e]),x(n=r?void 0:n)||(n=null==n?[]:[n]),gl(t,e,n))},partition:Ul,reduce:function(t,e,n){var r=x(t)?sr:gc,i=arguments.length<3;return r(t,ys(e),n,i,Ps)},reduceRight:function(t,e,n){var r=x(t)?dc:gc,i=arguments.length<3;return r(t,ys(e),n,i,lo)},reject:function(t,e){return(x(t)?ei:Co)(t,el(ys(e)))},sample:function(t){return(x(t)?yc:vc)(t)},sampleSize:function(t,e,n){return e=(n?ue(t,e,n):void 0===e)?1:R(e),(x(t)?xc:wc)(t,e)},shuffle:function(t){return(x(t)?Ac:Cc)(t)},size:function(t){if(null==t)return 0;if(he(t))return ta(t)?Bl(t):t.length;var e=Pi(t);return"[object Map]"==e||"[object Set]"==e?t.size:Ve(t).length},some:function(t,e,n){var r=x(t)?Wi:Mc;return n&&ue(t,e,n)&&(e=void 0),r(t,ys(e))},sortBy:Ec},Ih=Ns,Dh={after:function(t,e){if("function"!=typeof e)throw new TypeError("Expected a function");return t=R(t),function(){if(--t<1)return e.apply(this,arguments)}},ary:te,before:Bn,bind:In,bindKey:Rn,curry:Ts,curryRight:ks,debounce:Ls,defer:Hs,delay:Js,flip:function(t){return Qt(t,512)},memoize:cn,negate:el,once:function(t){return Bn(2,t)},overArgs:yl,partial:Fl,partialRight:Gl,rearg:uc,rest:function(t,e){if("function"!=typeof t)throw new TypeError("Expected a function");return le(t,e=void 0===e?e:R(e))},spread:function(t,e){if("function"!=typeof t)throw new TypeError("Expected a function");return e=null==e?0:Lc(R(e),0),le((function(n){var r=n[e],i=zn(n,0,e);return r&&bn(i,r),ot(t,this,i)}))},throttle:Kc,unary:function(t){return te(t,1)},wrap:function(t,e){return Fl(ro(e),t)}},Rh={castArray:function(){if(!arguments.length)return[];var t=arguments[0];return x(t)?t:[t]},clone:Gi,cloneDeep:Ui,cloneDeepWith:function(t,e){return Fi(t,5,e="function"==typeof e?e:void 0)},cloneWith:function(t,e){return Fi(t,4,e="function"==typeof e?e:void 0)},conformsTo:function(t,e){return null==e||vs(t,e,ze(e))},eq:ne,gt:Ho,gte:Jo,isArguments:xe,isArray:x,isArrayBuffer:Ca,isArrayLike:he,isArrayLikeObject:Vs,isBoolean:function(t){return!0===t||!1===t||m(t)&&"[object Boolean]"==p(t)},isBuffer:Me,isDate:Ma,isElement:function(t){return m(t)&&1===t.nodeType&&!jn(t)},isEmpty:Sa,isEqual:Oa,isEqualWith:function(t,e,n){var r=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===r?ss(t,e,void 0,n):!!r},isError:_n,isFinite:function(t){return"number"==typeof t&&Ta(t)},isFunction:z,isInteger:ka,isLength:ce,isMap:Bi,isMatch:function(t,e){return t===e||os(t,e,ls(e))},isMatchWith:function(t,e,n){return n="function"==typeof n?n:void 0,os(t,e,ls(e),n)},isNaN:function(t){return Na(t)&&t!=+t},isNative:function(t){if(ja(t))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return K(t)},isNil:function(t){return null==t},isNull:function(t){return null===t},isNumber:Na,isObject:k,isObjectLike:m,isPlainObject:jn,isRegExp:La,isSafeInteger:function(t){return ka(t)&&t>=-9007199254740991&&t<=Ba},isSet:Di,isString:ta,isSymbol:y,isTypedArray:_e,isUndefined:function(t){return void 0===t},isWeakMap:function(t){return m(t)&&"[object WeakMap]"==Pi(t)},isWeakSet:function(t){return m(t)&&"[object WeakSet]"==p(t)},lt:Ua,lte:qa,toArray:rl,toFinite:D,toInteger:R,toLength:Ao,toNumber:B,toPlainObject:$s,toSafeInteger:function(t){return t?Wr(R(t),-9007199254740991,ih):0===t?t:0},toString:dn},Vh={add:M,ceil:Fr,divide:eo,floor:Ro,max:Ha,maxBy:function(t,e){return t&&t.length?Wa(t,ys(e),qo):void 0},mean:function(t){return Xa(t,V)},meanBy:function(t,e){return Xa(t,ys(e))},min:function(t){return t&&t.length?Wa(t,V,Ga):void 0},minBy:function(t,e){return t&&t.length?Wa(t,ys(e),Ga):void 0},multiply:tl,round:mc,subtract:Ic,sum:function(t){return t&&t.length?Ja(t,V):0},sumBy:function(t,e){return t&&t.length?Ja(t,ys(e)):0}},zh=Hr,$h=function(t,e,n){return e=D(e),void 0===n?(n=e,e=0):n=D(n),function(t,e,n){return t>=Qo(e,n)&&t<Ko(e,n)}(t=B(t),e,n)},Fh=function(t,e,n){if(n&&"boolean"!=typeof n&&ue(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=D(t),void 0===e?(e=t,t=0):e=D(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=sc();return ic(t+i*(e-t+rc("1e-"+((i+"").length-1))),e)}return nc(t,e)},Gh={assign:Fe,assignIn:We,assignInWith:He,assignWith:Je,at:Mn,create:function(t,e){var n=it(t);return null==e?n:Xr(n,e)},defaults:Ds,defaultsDeep:qs,entries:uo,entriesIn:go,extend:We,extendWith:He,findKey:function(t,e){return Oo(t,ys(e),As)},findLastKey:function(t,e){return Oo(t,ys(e),ao)},forIn:function(t,e){return null==t?t:ws(t,ro(e),qe)},forInRight:function(t,e){return null==t?t:oo(t,ro(e),qe)},forOwn:function(t,e){return t&&As(t,ro(e))},forOwnRight:function(t,e){return t&&ao(t,ro(e))},functions:function(t){return null==t?[]:Fo(t,ze(t))},functionsIn:function(t){return null==t?[]:Fo(t,qe(t))},get:yn,has:Zo,hasIn:ds,invert:da,invertBy:ya,invoke:xa,keys:ze,keysIn:qe,mapKeys:function(t,e){var n={};return e=ys(e),As(t,(function(t,r,i){ee(n,e(t,r,i),t)})),n},mapValues:function(t,e){var n={};return e=ys(e),As(t,(function(t,r,i){ee(n,r,e(t,r,i))})),n},merge:Ya,mergeWith:Us,omit:al,omitBy:function(t,e){return hl(t,el(ys(e)))},pick:ql,pickBy:hl,result:function(t,e,n){var r=-1,i=(e=fn(e,t)).length;for(i||(i=1,t=void 0);++r<i;){var s=null==t?void 0:t[pn(e[r])];void 0===s&&(r=i,s=n),t=z(s)?s.call(t):s}return t},set:function(t,e,n){return null==t?t:ll(t,e,n)},setWith:function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:ll(t,e,n,r)},toPairs:uo,toPairsIn:go,transform:function(t,e,n){var r=x(t),i=r||Me(t)||_e(t);if(e=ys(e),null==n){var s=t&&t.constructor;n=i?r?new s:[]:k(t)&&z(s)?it(En(t)):{}}return(i?Lt:As)(t,(function(t,r,i){return e(n,t,r,i)})),n},unset:function(t,e){return null==t||sl(t,e)},update:function(t,e,n){return null==t?t:Ch(t,e,ro(n))},updateWith:function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Ch(t,e,ro(n),r)},values:na,valuesIn:function(t){return null==t?[]:ea(t,qe(t))}},Uh={at:Eh,chain:Gr,commit:function(){return new vt(this.value(),this.__chain__)},lodash:At,next:function(){void 0===this.__values__&&(this.__values__=rl(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},plant:function(t){for(var e,n=this;n instanceof ut;){var r=xt(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},reverse:function(){var t=this.__wrapped__;if(t instanceof gt){var e=t;return this.__actions__.length&&(e=new gt(this)),(e=e.reverse()).__actions__.push({func:Qc,args:[pc],thisArg:void 0}),new vt(e,this.__chain__)}return this.thru(pc)},tap:function(t,e){return e(t),t},thru:Qc,toIterator:function(){return this},toJSON:rh,value:rh,valueOf:rh,wrapperChain:function(){return Gr(this)}},qh={camelCase:Rr,capitalize:ir,deburr:hr,endsWith:function(t,e,n){t=dn(t),e=C(e);var r=t.length,i=n=void 0===n?r:Wr(R(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},escape:yo,escapeRegExp:function(t){return(t=dn(t))&&bo.test(t)?t.replace(vo,"\\$&"):t},kebabCase:Da,lowerCase:$a,lowerFirst:Fa,pad:function(t,e,n){t=dn(t);var r=(e=R(e))?Bl(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Dl(Vl(i),n)+t+Dl(Rl(i),n)},padEnd:function(t,e,n){t=dn(t);var r=(e=R(e))?Bl(t):0;return e&&r<e?t+Dl(e-r,n):t},padStart:function(t,e,n){t=dn(t);var r=(e=R(e))?Bl(t):0;return e&&r<e?Dl(e-r,n)+t:t},parseInt:function(t,e,n){return n||null==e?e=0:e&&(e=+e),$l(dn(t).replace(zl,""),e||0)},repeat:function(t,e,n){return e=(n?ue(t,e,n):void 0===e)?1:R(e),wl(dn(t),e)},replace:function(){var t=arguments,e=dn(t[0]);return t.length<3?e:e.replace(t[1],t[2])},snakeCase:Pc,split:function(t,e,n){return n&&"number"!=typeof n&&ue(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=dn(t))&&("string"==typeof e||null!=e&&!La(e))&&!(e=C(e))&&Fn(t)?zn(er(t),0,n):t.split(e,n):[]},startCase:Bc,startsWith:function(t,e,n){return t=dn(t),n=null==n?0:Wr(R(n),0,t.length),e=C(e),t.slice(n,n+e.length)==e},template:function(t,e,n){var r=Gc.imports._.templateSettings||Gc;n&&ue(t,e,n)&&(e=void 0),t=dn(t),e=He({},e,r,Vc);var i,s,o=He({},e.imports,r.imports,Vc),a=ze(o),l=ea(o,a),c=0,h=e.interpolate||Xc,u="__p += '",g=RegExp((e.escape||Xc).source+"|"+h.source+"|"+(h===Fc?Jc:Xc).source+"|"+(e.evaluate||Xc).source+"|$","g"),d=Zc.call(e,"sourceURL")?"//# sourceURL="+(e.sourceURL+"").replace(/\s/g," ")+"\n":"";t.replace(g,(function(e,n,r,o,a,l){return r||(r=o),u+=t.slice(c,l).replace(Yc,$c),n&&(i=!0,u+="' +\n__e("+n+") +\n'"),a&&(s=!0,u+="';\n"+a+";\n__p += '"),r&&(u+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=l+e.length,e})),u+="';\n";var f=Zc.call(e,"variable")&&e.variable;if(f){if(Hc.test(f))throw new Error("Invalid `variable` option passed into `_.template`")}else u="with (obj) {\n"+u+"\n}\n";u=(s?u.replace(Uc,""):u).replace(qc,"$1").replace(Wc,"$1;"),u="function("+(f||"obj")+") {\n"+(f?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+u+"return __p\n}";var p=Ln((function(){return Function(a,d+"return "+u).apply(void 0,l)}));if(p.source=u,_n(p))throw p;return p},templateSettings:Gc,toLower:function(t){return dn(t).toLowerCase()},toUpper:function(t){return dn(t).toUpperCase()},trim:function(t,e,n){if((t=dn(t))&&(n||void 0===e))return T(t);if(!t||!(e=C(e)))return t;var r=er(t),i=er(e);return zn(r,oh(r,i),sh(r,i)+1).join("")},trimEnd:function(t,e,n){if((t=dn(t))&&(n||void 0===e))return t.slice(0,S(t)+1);if(!t||!(e=C(e)))return t;var r=er(t);return zn(r,0,sh(r,er(e))+1).join("")},trimStart:function(t,e,n){if((t=dn(t))&&(n||void 0===e))return t.replace(ah,"");if(!t||!(e=C(e)))return t;var r=er(t);return zn(r,oh(r,er(e))).join("")},truncate:function(t,e){var n=30,r="...";if(k(e)){var i="separator"in e?e.separator:i;n="length"in e?R(e.length):n,r="omission"in e?C(e.omission):r}var s=(t=dn(t)).length;if(Fn(t)){var o=er(t);s=o.length}if(n>=s)return t;var a=n-Bl(r);if(a<1)return r;var l=o?zn(o,0,a).join(""):t.slice(0,a);if(void 0===i)return l+r;if(o&&(a+=l.length-a),La(i)){if(t.slice(a).search(i)){var c,h=l;for(i.global||(i=RegExp(i.source,dn(lh.exec(i))+"g")),i.lastIndex=0;c=i.exec(h);)var u=c.index;l=l.slice(0,void 0===u?a:u)}}else if(t.indexOf(C(i),a)!=a){var g=l.lastIndexOf(i);g>-1&&(l=l.slice(0,g))}return l+r},unescape:function(t){return(t=dn(t))&&uh.test(t)?t.replace(hh,ch):t},upperCase:Ph,upperFirst:rr,words:Br},Wh={attempt:Ln,bindAll:Dn,cond:function(t){var e=null==t?0:t.length,n=ys;return t=e?b(t,(function(t){if("function"!=typeof t[1])throw new TypeError("Expected a function");return[n(t[0]),t[1]]})):[],le((function(n){for(var r=-1;++r<e;){var i=t[r];if(ot(i[0],this,n))return ot(i[1],this,n)}}))},conforms:function(t){return function(t){var e=ze(t);return function(n){return vs(n,t,e)}}(Fi(t,1))},constant:kt,defaultTo:function(t,e){return null==t||t!=t?e:t},flow:zo,flowRight:$o,identity:V,iteratee:function(t){return ys("function"==typeof t?t:Fi(t,1))},matches:function(t){return hs(Fi(t,1))},matchesProperty:function(t,e){return fs(t,Fi(e,1))},method:Za,methodOf:Ka,mixin:Qa,noop:dt,nthArg:function(t){return t=R(t),le((function(e){return il(e,t)}))},over:fl,overEvery:vl,overSome:bl,property:ms,propertyOf:function(t){return function(e){return null==t?void 0:mn(t,e)}},range:cc,rangeRight:hc,stubArray:ni,stubFalse:we,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(t,e){if((t=R(t))<1||t>9007199254740991)return[];var n=th,r=eh(t,th);e=ro(e),t-=th;for(var i=pe(r,e);++n<t;)e(n);return i},toPath:function(t){return x(t)?b(t,pn):y(t)?[t]:bt(gn(dn(t)))},uniqueId:bh};var Hh=Math.max,Jh=Math.min;var Xh=Math.min;
/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
var Yh,Zh=4294967295,Kh=Array.prototype,Qh=Object.prototype.hasOwnProperty,tu=l?l.iterator:void 0,eu=Math.max,nu=Math.min,ru=function(t){return function(e,n,r){if(null==r){var i=k(n),s=i&&ze(n),o=s&&s.length&&Fo(n,s);(o?o.length:i)||(r=n,n=e,e=this)}return t(e,n,r)}}(Qa);function iu(t,e,n){if(n)switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2]);case 4:return t.call(e,n[0],n[1],n[2],n[3]);case 5:return t.call(e,n[0],n[1],n[2],n[3],n[4]);case 6:return t.call(e,n[0],n[1],n[2],n[3],n[4],n[5]);default:return t.apply(e,n)}return t.call(e)}function su(t,e,...n){return iu(t,e,n)}function ou(t){return"object"==typeof t&&t.then&&"function"==typeof t.then}function au(t){return null!=t&&(t instanceof Promise||ou(t))}function lu(...t){const e=[];t.forEach((t=>{Array.isArray(t)?e.push(...t):e.push(t)}));if(e.some((t=>au(t)))){const t=e.map((t=>au(t)?t:Promise.resolve(!1!==t)));return Promise.all(t).then((t=>t.reduce(((t,e)=>!1!==e&&t),!0)))}return e.every((t=>!1!==t))}At.after=Dh.after,At.ary=Dh.ary,At.assign=Gh.assign,At.assignIn=Gh.assignIn,At.assignInWith=Gh.assignInWith,At.assignWith=Gh.assignWith,At.at=Gh.at,At.before=Dh.before,At.bind=Dh.bind,At.bindAll=Wh.bindAll,At.bindKey=Dh.bindKey,At.castArray=Rh.castArray,At.chain=Uh.chain,At.chunk=Lh.chunk,At.compact=Lh.compact,At.concat=Lh.concat,At.cond=Wh.cond,At.conforms=Wh.conforms,At.constant=Wh.constant,At.countBy=Bh.countBy,At.create=Gh.create,At.curry=Dh.curry,At.curryRight=Dh.curryRight,At.debounce=Dh.debounce,At.defaults=Gh.defaults,At.defaultsDeep=Gh.defaultsDeep,At.defer=Dh.defer,At.delay=Dh.delay,At.difference=Lh.difference,At.differenceBy=Lh.differenceBy,At.differenceWith=Lh.differenceWith,At.drop=Lh.drop,At.dropRight=Lh.dropRight,At.dropRightWhile=Lh.dropRightWhile,At.dropWhile=Lh.dropWhile,At.fill=Lh.fill,At.filter=Bh.filter,At.flatMap=Bh.flatMap,At.flatMapDeep=Bh.flatMapDeep,At.flatMapDepth=Bh.flatMapDepth,At.flatten=Lh.flatten,At.flattenDeep=Lh.flattenDeep,At.flattenDepth=Lh.flattenDepth,At.flip=Dh.flip,At.flow=Wh.flow,At.flowRight=Wh.flowRight,At.fromPairs=Lh.fromPairs,At.functions=Gh.functions,At.functionsIn=Gh.functionsIn,At.groupBy=Bh.groupBy,At.initial=Lh.initial,At.intersection=Lh.intersection,At.intersectionBy=Lh.intersectionBy,At.intersectionWith=Lh.intersectionWith,At.invert=Gh.invert,At.invertBy=Gh.invertBy,At.invokeMap=Bh.invokeMap,At.iteratee=Wh.iteratee,At.keyBy=Bh.keyBy,At.keys=ze,At.keysIn=Gh.keysIn,At.map=Bh.map,At.mapKeys=Gh.mapKeys,At.mapValues=Gh.mapValues,At.matches=Wh.matches,At.matchesProperty=Wh.matchesProperty,At.memoize=Dh.memoize,At.merge=Gh.merge,At.mergeWith=Gh.mergeWith,At.method=Wh.method,At.methodOf=Wh.methodOf,At.mixin=ru,At.negate=el,At.nthArg=Wh.nthArg,At.omit=Gh.omit,At.omitBy=Gh.omitBy,At.once=Dh.once,At.orderBy=Bh.orderBy,At.over=Wh.over,At.overArgs=Dh.overArgs,At.overEvery=Wh.overEvery,At.overSome=Wh.overSome,At.partial=Dh.partial,At.partialRight=Dh.partialRight,At.partition=Bh.partition,At.pick=Gh.pick,At.pickBy=Gh.pickBy,At.property=Wh.property,At.propertyOf=Wh.propertyOf,At.pull=Lh.pull,At.pullAll=Lh.pullAll,At.pullAllBy=Lh.pullAllBy,At.pullAllWith=Lh.pullAllWith,At.pullAt=Lh.pullAt,At.range=Wh.range,At.rangeRight=Wh.rangeRight,At.rearg=Dh.rearg,At.reject=Bh.reject,At.remove=Lh.remove,At.rest=Dh.rest,At.reverse=Lh.reverse,At.sampleSize=Bh.sampleSize,At.set=Gh.set,At.setWith=Gh.setWith,At.shuffle=Bh.shuffle,At.slice=Lh.slice,At.sortBy=Bh.sortBy,At.sortedUniq=Lh.sortedUniq,At.sortedUniqBy=Lh.sortedUniqBy,At.split=qh.split,At.spread=Dh.spread,At.tail=Lh.tail,At.take=Lh.take,At.takeRight=Lh.takeRight,At.takeRightWhile=Lh.takeRightWhile,At.takeWhile=Lh.takeWhile,At.tap=Uh.tap,At.throttle=Dh.throttle,At.thru=Qc,At.toArray=Rh.toArray,At.toPairs=Gh.toPairs,At.toPairsIn=Gh.toPairsIn,At.toPath=Wh.toPath,At.toPlainObject=Rh.toPlainObject,At.transform=Gh.transform,At.unary=Dh.unary,At.union=Lh.union,At.unionBy=Lh.unionBy,At.unionWith=Lh.unionWith,At.uniq=Lh.uniq,At.uniqBy=Lh.uniqBy,At.uniqWith=Lh.uniqWith,At.unset=Gh.unset,At.unzip=Lh.unzip,At.unzipWith=Lh.unzipWith,At.update=Gh.update,At.updateWith=Gh.updateWith,At.values=Gh.values,At.valuesIn=Gh.valuesIn,At.without=Lh.without,At.words=qh.words,At.wrap=Dh.wrap,At.xor=Lh.xor,At.xorBy=Lh.xorBy,At.xorWith=Lh.xorWith,At.zip=Lh.zip,At.zipObject=Lh.zipObject,At.zipObjectDeep=Lh.zipObjectDeep,At.zipWith=Lh.zipWith,At.entries=Gh.toPairs,At.entriesIn=Gh.toPairsIn,At.extend=Gh.assignIn,At.extendWith=Gh.assignInWith,ru(At,At),At.add=Vh.add,At.attempt=Wh.attempt,At.camelCase=qh.camelCase,At.capitalize=qh.capitalize,At.ceil=Vh.ceil,At.clamp=zh,At.clone=Rh.clone,At.cloneDeep=Rh.cloneDeep,At.cloneDeepWith=Rh.cloneDeepWith,At.cloneWith=Rh.cloneWith,At.conformsTo=Rh.conformsTo,At.deburr=qh.deburr,At.defaultTo=Wh.defaultTo,At.divide=Vh.divide,At.endsWith=qh.endsWith,At.eq=Rh.eq,At.escape=qh.escape,At.escapeRegExp=qh.escapeRegExp,At.every=Bh.every,At.find=Bh.find,At.findIndex=Lh.findIndex,At.findKey=Gh.findKey,At.findLast=Bh.findLast,At.findLastIndex=Lh.findLastIndex,At.findLastKey=Gh.findLastKey,At.floor=Vh.floor,At.forEach=Bh.forEach,At.forEachRight=Bh.forEachRight,At.forIn=Gh.forIn,At.forInRight=Gh.forInRight,At.forOwn=Gh.forOwn,At.forOwnRight=Gh.forOwnRight,At.get=Gh.get,At.gt=Rh.gt,At.gte=Rh.gte,At.has=Gh.has,At.hasIn=Gh.hasIn,At.head=Lh.head,At.identity=V,At.includes=Bh.includes,At.indexOf=Lh.indexOf,At.inRange=$h,At.invoke=Gh.invoke,At.isArguments=Rh.isArguments,At.isArray=x,At.isArrayBuffer=Rh.isArrayBuffer,At.isArrayLike=Rh.isArrayLike,At.isArrayLikeObject=Rh.isArrayLikeObject,At.isBoolean=Rh.isBoolean,At.isBuffer=Rh.isBuffer,At.isDate=Rh.isDate,At.isElement=Rh.isElement,At.isEmpty=Rh.isEmpty,At.isEqual=Rh.isEqual,At.isEqualWith=Rh.isEqualWith,At.isError=Rh.isError,At.isFinite=Rh.isFinite,At.isFunction=Rh.isFunction,At.isInteger=Rh.isInteger,At.isLength=Rh.isLength,At.isMap=Rh.isMap,At.isMatch=Rh.isMatch,At.isMatchWith=Rh.isMatchWith,At.isNaN=Rh.isNaN,At.isNative=Rh.isNative,At.isNil=Rh.isNil,At.isNull=Rh.isNull,At.isNumber=Rh.isNumber,At.isObject=k,At.isObjectLike=Rh.isObjectLike,At.isPlainObject=Rh.isPlainObject,At.isRegExp=Rh.isRegExp,At.isSafeInteger=Rh.isSafeInteger,At.isSet=Rh.isSet,At.isString=Rh.isString,At.isSymbol=Rh.isSymbol,At.isTypedArray=Rh.isTypedArray,At.isUndefined=Rh.isUndefined,At.isWeakMap=Rh.isWeakMap,At.isWeakSet=Rh.isWeakSet,At.join=Lh.join,At.kebabCase=qh.kebabCase,At.last=Ks,At.lastIndexOf=Lh.lastIndexOf,At.lowerCase=qh.lowerCase,At.lowerFirst=qh.lowerFirst,At.lt=Rh.lt,At.lte=Rh.lte,At.max=Vh.max,At.maxBy=Vh.maxBy,At.mean=Vh.mean,At.meanBy=Vh.meanBy,At.min=Vh.min,At.minBy=Vh.minBy,At.stubArray=Wh.stubArray,At.stubFalse=Wh.stubFalse,At.stubObject=Wh.stubObject,At.stubString=Wh.stubString,At.stubTrue=Wh.stubTrue,At.multiply=Vh.multiply,At.nth=Lh.nth,At.noop=Wh.noop,At.now=Ih,At.pad=qh.pad,At.padEnd=qh.padEnd,At.padStart=qh.padStart,At.parseInt=qh.parseInt,At.random=Fh,At.reduce=Bh.reduce,At.reduceRight=Bh.reduceRight,At.repeat=qh.repeat,At.replace=qh.replace,At.result=Gh.result,At.round=Vh.round,At.sample=Bh.sample,At.size=Bh.size,At.snakeCase=qh.snakeCase,At.some=Bh.some,At.sortedIndex=Lh.sortedIndex,At.sortedIndexBy=Lh.sortedIndexBy,At.sortedIndexOf=Lh.sortedIndexOf,At.sortedLastIndex=Lh.sortedLastIndex,At.sortedLastIndexBy=Lh.sortedLastIndexBy,At.sortedLastIndexOf=Lh.sortedLastIndexOf,At.startCase=qh.startCase,At.startsWith=qh.startsWith,At.subtract=Vh.subtract,At.sum=Vh.sum,At.sumBy=Vh.sumBy,At.template=qh.template,At.times=Wh.times,At.toFinite=Rh.toFinite,At.toInteger=R,At.toLength=Rh.toLength,At.toLower=qh.toLower,At.toNumber=Rh.toNumber,At.toSafeInteger=Rh.toSafeInteger,At.toString=Rh.toString,At.toUpper=qh.toUpper,At.trim=qh.trim,At.trimEnd=qh.trimEnd,At.trimStart=qh.trimStart,At.truncate=qh.truncate,At.unescape=qh.unescape,At.uniqueId=Wh.uniqueId,At.upperCase=qh.upperCase,At.upperFirst=qh.upperFirst,At.each=Bh.forEach,At.eachRight=Bh.forEachRight,At.first=Lh.head,ru(At,(Yh={},As(At,(function(t,e){Qh.call(At.prototype,e)||(Yh[e]=t)})),Yh),{chain:!1}),At.VERSION="4.17.21",(At.templateSettings=qh.templateSettings).imports._=At,Lt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){At[t].placeholder=At})),Lt(["drop","take"],(function(t,e){gt.prototype[t]=function(n){n=void 0===n?1:eu(R(n),0);var r=this.__filtered__&&!e?new gt(this):this.clone();return r.__filtered__?r.__takeCount__=nu(n,r.__takeCount__):r.__views__.push({size:nu(n,Zh),type:t+(r.__dir__<0?"Right":"")}),r},gt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Lt(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;gt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ys(t),type:n}),e.__filtered__=e.__filtered__||r,e}})),Lt(["head","last"],(function(t,e){var n="take"+(e?"Right":"");gt.prototype[t]=function(){return this[n](1).value()[0]}})),Lt(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");gt.prototype[t]=function(){return this.__filtered__?new gt(this):this[n](1)}})),gt.prototype.compact=function(){return this.filter(V)},gt.prototype.find=function(t){return this.filter(t).head()},gt.prototype.findLast=function(t){return this.reverse().find(t)},gt.prototype.invokeMap=le((function(t,e){return"function"==typeof t?new gt(this):this.map((function(n){return ba(n,t,e)}))})),gt.prototype.reject=function(t){return this.filter(el(ys(t)))},gt.prototype.slice=function(t,e){t=R(t);var n=this;return n.__filtered__&&(t>0||e<0)?new gt(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=R(e))<0?n.dropRight(-e):n.take(e-t)),n)},gt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},gt.prototype.toArray=function(){return this.take(Zh)},As(gt.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=At[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);i&&(At.prototype[e]=function(){var e=this.__wrapped__,o=r?[1]:arguments,a=e instanceof gt,l=o[0],c=a||x(e),h=function(t){var e=i.apply(At,bn([t],o));return r&&u?e[0]:e};c&&n&&"function"==typeof l&&1!=l.length&&(a=c=!1);var u=this.__chain__,g=!!this.__actions__.length,d=s&&!u,f=a&&!g;if(!s&&c){e=f?e:new gt(this);var p=t.apply(e,o);return p.__actions__.push({func:Qc,args:[h],thisArg:void 0}),new vt(p,u)}return d&&f?t.apply(this,o):(p=this.thru(h),d?r?p.value()[0]:p.value():p)})})),Lt(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Kh[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);At.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(x(i)?i:[],t)}return this[n]((function(n){return e.apply(x(n)?n:[],t)}))}})),As(gt.prototype,(function(t,e){var n=At[e];if(n){var r=n.name+"";Qh.call(pt,r)||(pt[r]=[]),pt[r].push({name:e,func:n})}})),pt[Jt(void 0,2).name]=[{name:"wrapper",func:void 0}],gt.prototype.clone=function(){var t=new gt(this.__wrapped__);return t.__actions__=bt(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=bt(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=bt(this.__views__),t},gt.prototype.reverse=function(){if(this.__filtered__){var t=new gt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},gt.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=x(t),r=e<0,i=n?t.length:0,s=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var s=n[r],o=s.size;switch(s.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=Jh(e,t+o);break;case"takeRight":t=Hh(t,e-o)}}return{start:t,end:e}}(0,i,this.__views__),o=s.start,a=s.end,l=a-o,c=r?a:o-1,h=this.__iteratees__,u=h.length,g=0,d=Xh(l,this.__takeCount__);if(!n||!r&&i==l&&d==l)return nh(t,this.__actions__);var f=[];t:for(;l--&&g<d;){for(var p=-1,m=t[c+=e];++p<u;){var y=h[p],v=y.iteratee,b=y.type,w=v(m);if(2==b)m=w;else if(!w){if(1==b)continue t;break t}}f[g++]=m}return f},At.prototype.at=Uh.at,At.prototype.chain=Uh.wrapperChain,At.prototype.commit=Uh.commit,At.prototype.next=Uh.next,At.prototype.plant=Uh.plant,At.prototype.reverse=Uh.reverse,At.prototype.toJSON=At.prototype.valueOf=At.prototype.value=Uh.value,At.prototype.first=At.prototype.head,tu&&(At.prototype[tu]=Uh.toIterator);var cu=Object.freeze({__proto__:null,apply:iu,call:su,debounce:Ls,isAsync:au,isAsyncLike:ou,throttle:Kc,toAsyncBoolean:lu,toDeferredBoolean:function(...t){const e=lu(t);return"boolean"==typeof e?Promise.resolve(e):e}});function hu(t,e){const n=[];for(let r=0;r<t.length;r+=2){const i=iu(t[r],t[r+1],Array.isArray(e)?e:[e]);n.push(i)}return lu(n)}class uu{constructor(){this.listeners={}}on(t,e,n){if(null==e)return this;this.listeners[t]||(this.listeners[t]=[]);return this.listeners[t].push(e,n),this}once(t,e,n){const r=(...i)=>(this.off(t,r),hu([e,n],i));return this.on(t,r,this)}off(t,e,n){if(!(t||e||n))return this.listeners={},this;const r=this.listeners;return(t?[t]:Object.keys(r)).forEach((t=>{const i=r[t];if(i)if(e||n)for(let t=i.length-2;t>=0;t-=2)e&&i[t]!==e||n&&i[t+1]!==n||i.splice(t,2);else delete r[t]})),this}trigger(t,...e){let n=!0;if("*"!==t){const r=this.listeners[t];null!=r&&(n=hu([...r],e))}const r=this.listeners["*"];return null!=r?lu([n,hu([...r],[t,...e])]):n}emit(t,...e){return this.trigger(t,...e)}}function gu(t,...e){e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{"constructor"!==n&&Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))}))}))}const du=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])};function fu(t,e){function n(){this.constructor=t}du(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}const pu=/^\s*class\s+/.test(`${class{}}`)||/^\s*class\s*\{/.test(`${class{}}`);function mu(t,e){let n;return pu?n=class extends e{}:(n=function(){return e.apply(this,arguments)},fu(n,e)),Object.defineProperty(n,"name",{value:t}),n}function yu(t,e){return null!=t?t:e}function vu(t){return"__proto__"===t}function bu(t,e,n="/"){let r;const i=Array.isArray(e)?e:e.split(n);if(i.length)for(r=t;i.length;){const t=i.shift();if(Object(r)!==r||!t||!(t in r))return;r=r[t]}return r}function xu(t,e,n,r="/"){const i=Array.isArray(e)?e:e.split(r),s=i.pop();if(s&&!vu(s)){let e=t;i.forEach((t=>{vu(t)||(null==e[t]&&(e[t]={}),e=e[t])})),e[s]=n}return t}function wu(t,e,n="/"){const r=Array.isArray(e)?e.slice():e.split(n),i=r.pop();if(i)if(r.length>0){const e=bu(t,r);e&&delete e[i]}else delete t[i];return t}var Au=Object.freeze({__proto__:null,applyMixins:gu,clone:Gi,cloneDeep:Ui,createClass:mu,defaults:Ds,defaultsDeep:qs,ensure:yu,flatten:function t(e,n="/",r){const i={};Object.keys(e).forEach((s=>{const o=e[s];let a="object"==typeof o||Array.isArray(o);if(a&&r&&r(o)&&(a=!1),a){const e=t(o,n,r);Object.keys(e).forEach((t=>{i[s+n+t]=e[t]}))}else i[s]=o}));for(const t in e)Object.prototype.hasOwnProperty.call(e,t);return i},getBoolean:function(t,e,n){const r=null!=t?t[e]:null;return null==r?n:!!r},getByPath:bu,getNumber:function(t,e,n){let r=null!=t?t[e]:null;return null==r?n:(r=+r,Number.isNaN(r)||!Number.isFinite(r)?n:r)},getValue:function(t,e,n){const r=null!=t?t[e]:null;return void 0!==n?yu(r,n):r},has:Zo,inherit:fu,isEmpty:Sa,isEqual:Oa,isMaliciousProp:vu,isObject:k,isPlainObject:jn,merge:Ya,pick:ql,setByPath:xu,unsetByPath:wu}),Cu=window&&window.__decorate||function(t,e,n,r){var i,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,n,o):i(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Pu extends uu{dispose(){this.off()}}Cu([r.dispose()],Pu.prototype,"dispose",null),function(t){t.dispose=r.dispose}(Pu||(Pu={})),gu(Pu,r);var Mu=Object.freeze({__proto__:null,difference:Zs,groupBy:Uo,max:Ha,sortBy:Ec,sortedIndex:Nc,sortedIndexBy:jc,union:fh,uniq:yh});const Eu=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Su=Eu((t=>t.replace(/\B([A-Z])/g,"-$1").toLowerCase())),Ou=Eu((t=>Bc(Rr(t)).replace(/ /g,""))),Tu=Eu((t=>Ph(t).replace(/ /g,"_"))),ku=Eu((t=>$a(t).replace(/ /g,"."))),Nu=Eu((t=>$a(t).replace(/ /g,"/"))),ju=Eu((t=>rr($a(t)))),_u=Eu((t=>Bc(Rr(t))));function Lu(t){let e=2166136261,n=!1,r=t;for(let t=0,i=r.length;t<i;t+=1){let i=r.charCodeAt(t);i>127&&!n&&(r=unescape(encodeURIComponent(r)),i=r.charCodeAt(t),n=!0),e^=i,e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}return e>>>0}function Bu(){let t="";const e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let n=0,r=36;n<r;n+=1){const r=e[n],i=16*Math.random()|0;t+=("x"===r?i:"y"===r?3&i|8:r).toString(16)}return t}function Iu(t,e,n){const r=Math.min(2,Math.floor(.34*t.length));let i,s=Math.floor(.4*t.length)+1,o=!1;const a=t.toLowerCase();for(const l of e){const e=n(l);if(void 0!==e&&Math.abs(e.length-a.length)<=r){const n=e.toLowerCase();if(n===a){if(e===t)continue;return l}if(o)continue;if(e.length<3)continue;const r=Du(a,n,s-1);if(void 0===r)continue;r<3?(o=!0,i=l):(s=r,i=l)}}return i}function Du(t,e,n){let r=new Array(e.length+1),i=new Array(e.length+1);const s=n+1;for(let t=0;t<=e.length;t+=1)r[t]=t;for(let o=1;o<=t.length;o+=1){const a=t.charCodeAt(o-1),l=o>n?o-n:1,c=e.length>n+o?n+o:e.length;i[0]=o;let h=o;for(let t=1;t<l;t+=1)i[t]=s;for(let t=l;t<=c;t+=1){const n=a===e.charCodeAt(t-1)?r[t-1]:Math.min(r[t]+1,i[t-1]+1,r[t-1]+2);i[t]=n,h=Math.min(h,n)}for(let t=c+1;t<=e.length;t+=1)i[t]=s;if(h>n)return;const u=r;r=i,i=u}const o=r[e.length];return o>n?void 0:o}var Ru=Object.freeze({__proto__:null,camelCase:Rr,constantCase:Tu,dotCase:ku,getSpellingSuggestion:Iu,hashcode:Lu,kebabCase:Su,lowerFirst:Fa,pascalCase:Ou,pathCase:Nu,sentenceCase:ju,titleCase:_u,uniqueId:bh,upperFirst:rr,uuid:Bu});function Vu(t){return"string"==typeof t&&"%"===t.slice(-1)}function zu(t,e){if(null==t)return 0;let n;if("string"==typeof t){if(n=parseFloat(t),Vu(t)&&(n/=100,Number.isFinite(n)))return n*e}else n=t;return Number.isFinite(n)?n>0&&n<1?n*e:n:0}function $u(t){if("object"==typeof t){let e=0,n=0,r=0,i=0;return null!=t.vertical&&Number.isFinite(t.vertical)&&(n=i=t.vertical),null!=t.horizontal&&Number.isFinite(t.horizontal)&&(r=e=t.horizontal),null!=t.left&&Number.isFinite(t.left)&&(e=t.left),null!=t.top&&Number.isFinite(t.top)&&(n=t.top),null!=t.right&&Number.isFinite(t.right)&&(r=t.right),null!=t.bottom&&Number.isFinite(t.bottom)&&(i=t.bottom),{top:n,right:r,bottom:i,left:e}}let e=0;return null!=t&&Number.isFinite(t)&&(e=t),{top:e,right:e,bottom:e,left:e}}var Fu=Object.freeze({__proto__:null,clamp:Hr,isNumber:Na,isPercentage:Vu,mod:function(t,e){return(t%e+e)%e},normalizePercentage:zu,normalizeSides:$u,parseCssNumeric:function(t,e){const n=parseFloat(t);if(Number.isNaN(n))return null;let r;if(null==e)r="[A-Za-z]*";else if(Array.isArray(e)){if(0===e.length)return null;r=e.join("|")}else"string"==typeof e&&(r=e);const i=function(e){const n=new RegExp(`(?:\\d+(?:\\.\\d+)*)(${e})$`).exec(t);return n?n[1]:null}(r);return null===i?null:{unit:i,value:n}},random:function(t,e){if(null==e)e=null==t?1:t,t=0;else if(e<t){const n=t;t=e,e=n}return Math.floor(Math.random()*(e-t+1)+t)}});let Gu=!1,Uu=!1,qu=!1,Wu=!1,Hu=!1,Ju=!1,Xu=!1,Yu=!1,Zu=!1,Ku=!1,Qu=!1,tg=!1,eg=!1,ng=!1,rg=!1,ig=!1;if("object"==typeof navigator){const t=navigator.userAgent;Gu=t.indexOf("Macintosh")>=0,Uu=!!t.match(/(iPad|iPhone|iPod)/g),qu=t.indexOf("Windows")>=0,Wu=t.indexOf("MSIE")>=0,Hu=!!t.match(/Trident\/7\./),Ju=!!t.match(/Edge\//),Xu=t.indexOf("Mozilla/")>=0&&t.indexOf("MSIE")<0&&t.indexOf("Edge/")<0,Zu=t.indexOf("Chrome/")>=0&&t.indexOf("Edge/")<0,Ku=t.indexOf("Opera/")>=0||t.indexOf("OPR/")>=0,Qu=t.indexOf("Firefox/")>=0,tg=t.indexOf("AppleWebKit/")>=0&&t.indexOf("Chrome/")<0&&t.indexOf("Edge/")<0,"object"==typeof document&&(ig=!document.createElementNS||"[object SVGForeignObjectElement]"!=`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`||t.indexOf("Opera/")>=0)}if("object"==typeof window&&(Yu=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,ng=null!=window.PointerEvent&&!Gu),"object"==typeof document){eg="ontouchstart"in document.documentElement;try{const t=Object.defineProperty({},"passive",{get(){rg=!0}}),e=document.createElement("div");e.addEventListener&&e.addEventListener("click",(()=>{}),t)}catch(t){}}var sg;t.Platform=void 0,(sg=t.Platform||(t.Platform={})).IS_MAC=Gu,sg.IS_IOS=Uu,sg.IS_WINDOWS=qu,sg.IS_IE=Wu,sg.IS_IE11=Hu,sg.IS_EDGE=Ju,sg.IS_NETSCAPE=Xu,sg.IS_CHROME_APP=Yu,sg.IS_CHROME=Zu,sg.IS_OPERA=Ku,sg.IS_FIREFOX=Qu,sg.IS_SAFARI=tg,sg.SUPPORT_TOUCH=eg,sg.SUPPORT_POINTER=ng,sg.SUPPORT_PASSIVE=rg,sg.NO_FOREIGNOBJECT=ig,sg.SUPPORT_FOREIGNOBJECT=!sg.NO_FOREIGNOBJECT,function(t){function e(){const t=window.module;return null!=t&&null!=t.hot&&null!=t.hot.status?t.hot.status():"unkonwn"}t.getHMRStatus=e,t.isApplyingHMR=function(){return"apply"===e()};const n={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};t.isEventSupported=function(t){const e=document.createElement(n[t]||"div"),r=`on${t}`;let i=r in e;return i||(e.setAttribute(r,"return;"),i="function"==typeof e[r]),i}}(t.Platform||(t.Platform={}));const og=/[\t\r\n\f]/g,ag=/\S+/g,lg=t=>` ${t} `;function cg(t){return t&&t.getAttribute&&t.getAttribute("class")||""}function hg(t,e){if(null==t||null==e)return!1;const n=lg(cg(t)),r=lg(e);return 1===t.nodeType&&n.replace(og," ").includes(r)}function ug(t,e){if(null!=t&&null!=e){if("function"==typeof e)return ug(t,e(cg(t)));if("string"==typeof e&&1===t.nodeType){const n=e.match(ag)||[],r=lg(cg(t)).replace(og," ");let i=n.reduce(((t,e)=>t.indexOf(lg(e))<0?`${t}${e} `:t),r);i=i.trim(),r!==i&&t.setAttribute("class",i)}}}function gg(t,e){if(null!=t){if("function"==typeof e)return gg(t,e(cg(t)));if((!e||"string"==typeof e)&&1===t.nodeType){const n=(e||"").match(ag)||[],r=lg(cg(t)).replace(og," ");let i=n.reduce(((t,e)=>{const n=lg(e);return t.indexOf(n)>-1?t.replace(n," "):t}),r);i=e?i.trim():"",r!==i&&t.setAttribute("class",i)}}}function dg(t,e,n){if(null!=t&&null!=e)if(null==n||"string"!=typeof e){if("function"==typeof e)return dg(t,e(cg(t),n),n);if("string"==typeof e){(e.match(ag)||[]).forEach((e=>{hg(t,e)?gg(t,e):ug(t,e)}))}}else n?ug(t,e):gg(t,e)}let fg=0;function pg(){return fg+=1,`v${fg}`}function mg(t){return null!=t.id&&""!==t.id||(t.id=pg()),t.id}function yg(t){return null!=t&&("function"==typeof t.getScreenCTM&&t instanceof SVGElement)}const vg={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},bg="1.1";function xg(t,e=document){return e.createElement(t)}function wg(t,e=vg.xhtml,n=document){return n.createElementNS(e,t)}function Ag(t,e=document){return wg(t,vg.svg,e)}function Cg(t){if(t){const e=`<svg xmlns="${vg.svg}" xmlns:xlink="${vg.xlink}" version="${bg}">${t}</svg>`,{documentElement:n}=Pg(e,{async:!1});return n}const e=document.createElementNS(vg.svg,"svg");return e.setAttributeNS(vg.xmlns,"xmlns:xlink",vg.xlink),e.setAttribute("version",bg),e}function Pg(t,e={}){let n;try{const r=new DOMParser;if(null!=e.async){r.async=e.async}n=r.parseFromString(t,e.mimeType||"text/xml")}catch(t){n=void 0}if(!n||n.getElementsByTagName("parsererror").length)throw new Error(`Invalid XML: ${t}`);return n}function Mg(t,e=!0){const n=t.nodeName;return e?n.toLowerCase():n.toUpperCase()}function Eg(t){let e=0,n=t.previousSibling;for(;n;)1===n.nodeType&&(e+=1),n=n.previousSibling;return e}function Sg(t,e){return t.querySelectorAll(e)}function Og(t,e){return t.querySelector(e)}function Tg(t,e,n){const r=t.ownerSVGElement;let i=t.parentNode;for(;i&&i!==n&&i!==r;){if(hg(i,e))return i;i=i.parentNode}return null}function kg(t,e){const n=e&&e.parentNode;return t===n||!!(n&&1===n.nodeType&&16&t.compareDocumentPosition(n))}function Ng(t){if(t){(Array.isArray(t)?t:[t]).forEach((t=>{t.parentNode&&t.parentNode.removeChild(t)}))}}function jg(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function _g(t,e){(Array.isArray(e)?e:[e]).forEach((e=>{null!=e&&t.appendChild(e)}))}function Lg(t,e){const n=t.firstChild;return n?Bg(n,e):_g(t,e)}function Bg(t,e){const n=t.parentNode;if(n){(Array.isArray(e)?e:[e]).forEach((e=>{null!=e&&n.insertBefore(e,t)}))}}function Ig(t,e){null!=e&&e.appendChild(t)}function Dg(t){return!!t&&1===t.nodeType}function Rg(t){try{return t instanceof HTMLElement}catch(e){return"object"==typeof t&&1===t.nodeType&&"object"==typeof t.style&&"object"==typeof t.ownerDocument}}const Vg=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function zg(t,e){return t.getAttribute(e)}function $g(t,e){const n=qg(e);n.ns?t.hasAttributeNS(n.ns,n.local)&&t.removeAttributeNS(n.ns,n.local):t.hasAttribute(e)&&t.removeAttribute(e)}function Fg(t,e,n){if(null==n)return $g(t,e);const r=qg(e);r.ns&&"string"==typeof n?t.setAttributeNS(r.ns,e,n):"id"===e?t.id=`${n}`:t.setAttribute(e,`${n}`)}function Gg(t,e){Object.keys(e).forEach((n=>{Fg(t,n,e[n])}))}function Ug(t,e,n){if(null==e){const e=t.attributes,n={};for(let t=0;t<e.length;t+=1)n[e[t].name]=e[t].value;return n}if("string"==typeof e&&void 0===n)return t.getAttribute(e);"object"==typeof e?Gg(t,e):Fg(t,e,n)}function qg(t){if(-1!==t.indexOf(":")){const e=t.split(":");return{ns:vg[e[0]],local:e[1]}}return{ns:null,local:t}}function Wg(t){const e={};return Object.keys(t).forEach((n=>{const r=Vg.includes(n)?n:Su(n);e[r]=t[n]})),e}function Hg(t){const e={};return t.split(";").forEach((t=>{const n=t.trim();if(n){const t=n.split("=");t.length&&(e[t[0].trim()]=t[1]?t[1].trim():"")}})),e}function Jg(t,e){return Object.keys(e).forEach((n=>{if("class"===n)t[n]=t[n]?`${t[n]} ${e[n]}`:e[n];else if("style"===n){const r="object"==typeof t[n],i="object"==typeof e[n];let s,o;r&&i?(s=t[n],o=e[n]):r?(s=t[n],o=Hg(e[n])):i?(s=Hg(t[n]),o=e[n]):(s=Hg(t[n]),o=Hg(e[n])),t[n]=Jg(s,o)}else t[n]=e[n]})),t}function Xg(t,e,n={}){const r=n.offset||0,i=[],s=[];let o,a,l=null;for(let c=0;c<t.length;c+=1){o=s[c]=t[c];for(let i=0,a=e.length;i<a;i+=1){const a=e[i],l=a.start+r,h=a.end+r;c>=l&&c<h&&("string"==typeof o?o=s[c]={t:t[c],attrs:a.attrs}:o.attrs=Jg(Jg({},o.attrs),a.attrs),n.includeAnnotationIndices&&(null==o.annotations&&(o.annotations=[]),o.annotations.push(i)))}a=s[c-1],a?k(o)&&k(a)?JSON.stringify(o.attrs)===JSON.stringify(a.attrs)?l.t+=o.t:(i.push(l),l=o):k(o)||k(a)?(i.push(l),l=o):l=(l||"")+o:l=o}return null!=l&&i.push(l),i}function Yg(t){return t.replace(/ /g," ")}var Zg=Object.freeze({__proto__:null,annotate:Xg,findAnnotationsAtIndex:function(t,e){return t?t.filter((t=>t.start<e&&e<=t.end)):[]},findAnnotationsBetweenIndexes:function(t,e,n){return t?t.filter((t=>e>=t.start&&e<t.end||n>t.start&&n<=t.end||t.start>=e&&t.end<n)):[]},sanitize:Yg,shiftAnnotations:function(t,e,n){return t&&t.forEach((t=>{t.start<e&&t.end>=e?t.end+=n:t.start>=e&&(t.start+=n,t.end+=n)})),t}});let Kg;t.DataUri=void 0,function(t){function e(t){const e="data:";return t.substr(0,5)===e}function n(t){let e=t.replace(/\s/g,"");e=decodeURIComponent(e);const n=e.indexOf(","),r=e.slice(0,n),i=r.split(":")[1].split(";")[0],s=e.slice(n+1);let o;o=r.indexOf("base64")>=0?atob(s):unescape(encodeURIComponent(s));const a=new Uint8Array(o.length);for(let t=0;t<o.length;t+=1)a[t]=o.charCodeAt(t);return new Blob([a],{type:i})}function r(t,e){const n=window.navigator.msSaveBlob;if(n)n(t,e);else{const n=window.URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}}function i(t){const e=parseFloat(t);return Number.isNaN(e)?null:e}t.isDataUrl=e,t.imageToDataUri=function(t,n){if(!t||e(t))return void setTimeout((()=>n(null,t)));const r=()=>{n(new Error(`Failed to load image: ${t}`))},i=window.FileReader?t=>{if(200===t.status){const e=new FileReader;e.onload=t=>{const e=t.target.result;n(null,e)},e.onerror=r,e.readAsDataURL(t.response)}else r()}:e=>{if(200===e.status){let r=t.split(".").pop()||"png";"svg"===r&&(r="svg+xml");const i=`data:image/${r};base64,`,s=new Uint8Array(e.response),o=i+btoa((t=>{const e=[];for(let n=0;n<t.length;n+=32768)e.push(String.fromCharCode.apply(null,t.subarray(n,n+32768)));return e.join("")})(s));n(null,o)}else r()},s=new XMLHttpRequest;s.responseType=window.FileReader?"blob":"arraybuffer",s.open("GET",t,!0),s.addEventListener("error",r),s.addEventListener("load",(()=>i(s))),s.send()},t.dataUriToBlob=n,t.downloadBlob=r,t.downloadDataUri=function(t,e){r(n(t),e)},t.svgToDataUrl=function(t,e={}){let n=null;const r=e=>(null==n&&(n=function(t){const e=t.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return e&&e[2]?e[2].replace(/\s+/," ").split(" "):null}(t)),null!=n?i(n[e]):null),s=e=>{const n=t.match(e);return n&&n[2]?i(n[2]):null};let o=e.width;if(null==o&&(o=s(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==o&&(o=r(2)),null==o)throw new Error("Can not parse width from svg string");let a=e.height;if(null==a&&(a=s(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==a&&(a=r(3)),null==a)throw new Error("Can not parse height from svg string");return`data:image/svg+xml,${encodeURIComponent(t).replace(/'/g,"%27").replace(/"/g,"%22")}`}}(t.DataUri||(t.DataUri={}));const Qg={px:t=>t,mm:t=>Kg*t,cm:t=>Kg*t*10,in:t=>Kg*t*25.4,pt:t=>Kg*(25.4*t/72),pc:t=>Kg*(25.4*t/6)};t.Unit=void 0,function(t){function e(t,e,n){const r=document.createElement("div"),i=r.style;i.display="inline-block",i.position="absolute",i.left="-15000px",i.top="-15000px",i.width=t+(n||"px"),i.height=e+(n||"px"),document.body.appendChild(r);const s=r.getBoundingClientRect(),o={width:s.width||0,height:s.height||0};return document.body.removeChild(r),o}t.measure=e,t.toPx=function(t,n){null==Kg&&(Kg=e("1","1","mm").width);const r=n?Qg[n]:null;return r?r(t):t}}(t.Unit||(t.Unit={}));const td=/-(.)/g;const ed={},nd=["webkit","ms","moz","o"],rd="undefined"!=typeof document?document.createElement("div").style:{};function id(t){const e=t.replace(td,((t,e)=>e.toUpperCase()));if(null==ed[e]){const t=e.charAt(0).toUpperCase()+e.slice(1);ed[e]=e in rd?e:function(t){for(let e=0;e<nd.length;e+=1){const n=nd[e]+t;if(n in rd)return n}return null}(t)}return ed[e]}function sd(t,e){const n=t.ownerDocument&&t.ownerDocument.defaultView&&t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):window.getComputedStyle(t,null);return n&&e?n.getPropertyValue(e)||n[e]:n}const od=function(){if("undefined"==typeof document)return function(){};const t=document;return t.selection?function(){t.selection.empty()}:window.getSelection?function(){const t=window.getSelection();t&&(t.empty?t.empty():t.removeAllRanges&&t.removeAllRanges())}:function(){}}(),ad={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function ld(t){return/^--/.test(t)}function cd(t,e,n){const r=window.getComputedStyle(t,null);return n?r.getPropertyValue(e)||void 0:r[e]||t.style[e]}function hd(t,e){return parseInt(cd(t,e),10)||0}function ud(t,e,n){if("string"!=typeof e)for(const n in e)ud(t,n,e[n]);else{const r=ld(e);if(r||(e=id(e)),void 0===n)return cd(t,e,r);r||(n=function(t,e){return ad[t]||"number"!=typeof e?e:`${e}px`}(e,n));const i=t.style;r?i.setProperty(e,n):i[e]=n}}const gd=new WeakMap;function dd(t,e){const n=Rr(e),r=gd.get(t);if(r)return r[n]}function fd(t,e,n){const r=Rr(e),i=gd.get(t);i?i[r]=n:gd.set(t,{[r]:n})}function pd(t,e,n){if(!e){const e={};return Object.keys(gd).forEach((n=>{e[n]=dd(t,n)})),e}if("string"==typeof e)return void 0===n?dd(t,e):void fd(t,e,n);for(const n in e)pd(t,n,e[n])}const md={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};class yd{get[Symbol.toStringTag](){return yd.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(t){this.node.id=t}constructor(t,e,n){if(!t)throw new TypeError("Invalid element to create vector");let r;if(yd.isVector(t))r=t.node;else if("string"==typeof t)if("svg"===t.toLowerCase())r=Cg();else if("<"===t[0]){const e=Cg(t);r=document.importNode(e.firstChild,!0)}else r=document.createElementNS(vg.svg,t);else r=t;this.node=r,e&&this.setAttributes(e),n&&this.append(n)}transform(t,e){return null==t?Qd(this.node):(Qd(this.node,t,e),this)}translate(t,e=0,n={}){return null==t?tf(this.node):(tf(this.node,t,e,n),this)}rotate(t,e,n,r={}){return null==t?ef(this.node):(ef(this.node,t,e,n,r),this)}scale(t,e){return null==t?nf(this.node):(nf(this.node,t,e),this)}getTransformToElement(t){const e=yd.toNode(t);return rf(this.node,e)}removeAttribute(t){return $g(this.node,t),this}getAttribute(t){return zg(this.node,t)}setAttribute(t,e){return Fg(this.node,t,e),this}setAttributes(t){return Gg(this.node,t),this}attr(t,e){return null==t?Ug(this.node):"string"==typeof t&&void 0===e?Ug(this.node,t):("object"==typeof t?Ug(this.node,t):Ug(this.node,t,e),this)}svg(){return this.node instanceof SVGSVGElement?this:yd.create(this.node.ownerSVGElement)}defs(){const t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?yd.create(e):yd.create("defs").appendTo(t)}text(t,e={}){return wd(this.node,t,e),this}tagName(){return Mg(this.node)}clone(){return yd.create(this.node.cloneNode(!0))}remove(){return Ng(this.node),this}empty(){return jg(this.node),this}append(t){return _g(this.node,yd.toNodes(t)),this}appendTo(t){return Ig(this.node,yd.isVector(t)?t.node:t),this}prepend(t){return Lg(this.node,yd.toNodes(t)),this}before(t){return Bg(this.node,yd.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(yd.toNode(t),this.node),yd.create(t)}first(){return this.node.firstChild?yd.create(this.node.firstChild):null}last(){return this.node.lastChild?yd.create(this.node.lastChild):null}get(t){const e=this.node.childNodes[t];return e?yd.create(e):null}indexOf(t){return Array.prototype.slice.call(this.node.childNodes).indexOf(yd.toNode(t))}find(t){const e=[],n=Sg(this.node,t);if(n)for(let t=0,r=n.length;t<r;t+=1)e.push(yd.create(n[t]));return e}findOne(t){const e=Og(this.node,t);return e?yd.create(e):null}findParentByClass(t,e){const n=Tg(this.node,t,e);return n?yd.create(n):null}matches(t){const e=this.node;this.node.matches;const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return n&&n.call(e,t)}contains(t){return kg(this.node,yd.isVector(t)?t.node:t)}wrap(t){const e=yd.create(t),n=this.node.parentNode;return null!=n&&n.insertBefore(e.node,this.node),e.append(this)}parent(t){let e=this;if(null==e.node.parentNode)return null;if(e=yd.create(e.node.parentNode),null==t)return e;do{if("string"==typeof t?e.matches(t):e instanceof t)return e}while(e=yd.create(e.node.parentNode));return e}children(){const t=this.node.childNodes,e=[];for(let n=0;n<t.length;n+=1){1===t[n].nodeType&&e.push(yd.create(t[n]))}return e}eachChild(t,e){const n=this.children();for(let r=0,i=n.length;r<i;r+=1)t.call(n[r],n[r],r,n),e&&n[r].eachChild(t,e);return this}index(){return Eg(this.node)}hasClass(t){return hg(this.node,t)}addClass(t){return ug(this.node,t),this}removeClass(t){return gg(this.node,t),this}toggleClass(t,e){return dg(this.node,t,e),this}toLocalPoint(t,e){return of(this.node,t,e)}sample(t=1){return this.node instanceof SVGPathElement?Sd(this.node,t):[]}toPath(){return yd.create(Dd(this.node))}toPathData(){return Rd(this.node)}}function vd(t,e,n){const r=n.eol,i=n.baseSize,s=n.lineHeight;let o,a=0;const l={},c=e.length-1;for(let s=0;s<=c;s+=1){let l=e[s],h=null;if("object"==typeof l){const t=l.attrs,e=yd.create("tspan",t);o=e.node;let u=l.t;r&&s===c&&(u+=r),o.textContent=u;const g=t.class;g&&e.addClass(g),n.includeAnnotationIndices&&e.attr("annotations",l.annotations.join(",")),h=parseFloat(t["font-size"]),void 0===h&&(h=i),h&&h>a&&(a=h)}else r&&s===c&&(l+=r),o=document.createTextNode(l||" "),i&&i>a&&(a=i);t.appendChild(o)}return a&&(l.maxFontSize=a),s?l.lineHeight=s:a&&(l.lineHeight=1.2*a),l}!function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&r.node instanceof SVGElement&&"function"==typeof r.sample&&"function"==typeof r.toPath}function n(e,n,r){return new t(e,n,r)}function r(t){return e(t)?t.node:t}t.toStringTag=`X6.${t.name}`,t.isVector=e,t.create=n,t.createVectors=function(t){if("<"===t[0]){const e=Cg(t),r=[];for(let t=0,i=e.childNodes.length;t<i;t+=1){const i=e.childNodes[t];r.push(n(document.importNode(i,!0)))}return r}return[n(t)]},t.toNode=r,t.toNodes=function(t){return Array.isArray(t)?t.map((t=>r(t))):[r(t)]}}(yd||(yd={}));const bd=/em$/;function xd(t,e){const n=parseFloat(t);return bd.test(t)?n*e:n}function wd(t,e,n={}){e=Yg(e);const r=n.eol;let i=n.textPath;const s=n.textVerticalAnchor,o="middle"===s||"bottom"===s||"top"===s;let a=n.x;void 0===a&&(a=t.getAttribute("x")||0);const l=n.includeAnnotationIndices;let c=n.annotations;c&&!Array.isArray(c)&&(c=[c]);const h=n.lineHeight,u="auto"===h,g=u?"1.5em":h||"1em";let d=!0;const f=t.childNodes;if(1===f.length){const t=f[0];t&&"TITLE"===t.tagName.toUpperCase()&&(d=!1)}d&&jg(t),Ug(t,{"xml:space":"preserve",display:e||n.displayEmpty?null:"none"});const p=Ug(t,"font-size");let m,y,v=parseFloat(p);v||(v=16,!o&&!c||p||Ug(t,"font-size",`${v}`)),i?("string"==typeof i&&(i={d:i}),m=function(t,e){const n=yd.create(e),r=yd.create("textPath"),i=t.d;if(i&&void 0===t["xlink:href"]){const t=yd.create("path").attr("d",i).appendTo(n.defs());r.attr("xlink:href",`#${t.id}`)}return"object"==typeof t&&r.attr(t),r.node}(i,t)):m=document.createDocumentFragment();let b,x=0;const w=e.split("\n"),A=[],C=w.length-1;for(let t=0;t<=C;t+=1){y=g;let e="v-line";const n=Ag("tspan");let s,o=w[t];if(o)if(c){s=vd(n,Xg(o,c,{offset:-x,includeAnnotationIndices:l}),{eol:t!==C&&r,baseSize:v,lineHeight:u?null:g,includeAnnotationIndices:l});const e=s.lineHeight;e&&u&&0!==t&&(y=e),0===t&&(b=.8*s.maxFontSize)}else r&&t!==C&&(o+=r),n.textContent=o;else{n.textContent="-",e+=" v-empty-line";const t=n.style;t.fillOpacity=0,t.strokeOpacity=0,c&&(s={})}s&&A.push(s),t>0&&n.setAttribute("dy",y),(t>0||i)&&n.setAttribute("x",a),n.className.baseVal=e,m.appendChild(n),x+=o.length+1}if(o)if(c)y=function(t,e,n,r){if(!Array.isArray(e))return 0;const i=e.length;if(!i)return 0;let s=e[0];const o=xd(s.maxFontSize,n)||n;let a=0;const l=xd(r,n);for(let t=1;t<i;t+=1)s=e[t],a+=xd(s.lineHeight,n)||l;const c=xd(s.maxFontSize,n)||n;let h;switch(t){case"middle":h=o/2-.15*c-a/2;break;case"bottom":h=-.25*c-a;break;default:h=.8*o}return h}(s,A,v,g);else if("top"===s)y="0.8em";else{let t;switch(C>0?(t=parseFloat(g)||1,t*=C,bd.test(g)||(t/=v)):t=0,s){case"middle":y=.3-t/2+"em";break;case"bottom":y=-t-.3+"em"}}else 0===s?y="0em":s?y=s:(y=0,null==t.getAttribute("y")&&t.setAttribute("y",`${b||"0.8em"}`));m.firstChild.setAttribute("dy",y),t.appendChild(m)}function Ad(t,e={}){const n=document.createElement("canvas").getContext("2d");if(!t)return{width:0};const r=[],i=e["font-size"]?`${parseFloat(e["font-size"])}px`:"14px";return r.push(e["font-style"]||"normal"),r.push(e["font-variant"]||"normal"),r.push(e["font-weight"]||400),r.push(i),r.push(e["font-family"]||"sans-serif"),n.font=r.join(" "),n.measureText(t)}function Cd(t,e,n,r={}){if(e>=n)return[t,""];const i=t.length,s={};let o=Math.round(e/n*i-1);for(o<0&&(o=0);o>=0&&o<i;){const n=t.slice(0,o),i=s[n]||Ad(n,r).width,a=t.slice(0,o+1),l=s[a]||Ad(a,r).width;if(s[n]=i,s[a]=l,i>e)o-=1;else{if(!(l<=e))break;o+=1}}return[t.slice(0,o),t.slice(o)]}function Pd(t,e,n={},r={}){const i=e.width,s=e.height,o=r.eol||"\n",a=n.fontSize||14,l=n.lineHeight?parseFloat(n.lineHeight):Math.ceil(1.4*a),c=Math.floor(s/l);if(t.indexOf(o)>-1){const i=Bu(),s=[];return t.split(o).map((t=>{const o=Pd(t,Object.assign(Object.assign({},e),{height:Number.MAX_SAFE_INTEGER}),n,Object.assign(Object.assign({},r),{eol:i}));o&&s.push(...o.split(i))})),s.slice(0,c).join(o)}const{width:h}=Ad(t,n);if(h<i)return t;const u=[];let g=t,d=h,f=r.ellipsis,p=0;f&&("string"!=typeof f&&(f="…"),p=Ad(f,n).width);for(let t=0;t<c;t+=1){if(!(d>i)){u.push(g);break}if(t===c-1){const[t]=Cd(g,i-p,d,n);u.push(f?`${t}${f}`:t)}else{const[t,e]=Cd(g,i,d,n);u.push(t),g=e,d=Ad(g,n).width}}return u.join(o)}const Md=.551784;function Ed(t,e,n=NaN){const r=t.getAttribute(e);if(null==r)return n;const i=parseFloat(r);return Number.isNaN(i)?n:i}function Sd(t,e=1){const n=t.getTotalLength(),r=[];let i,s=0;for(;s<n;)i=t.getPointAtLength(s),r.push({distance:s,x:i.x,y:i.y}),s+=e;return r}function Od(t){return["M",Ed(t,"x1"),Ed(t,"y1"),"L",Ed(t,"x2"),Ed(t,"y2")].join(" ")}function Td(t){const e=jd(t);return 0===e.length?null:`${Nd(e)} Z`}function kd(t){const e=jd(t);return 0===e.length?null:Nd(e)}function Nd(t){return`M ${t.map((t=>`${t.x} ${t.y}`)).join(" L")}`}function jd(t){const e=[],n=t.points;if(n)for(let t=0,r=n.numberOfItems;t<r;t+=1)e.push(n.getItem(t));return e}function _d(t){const e=Ed(t,"cx",0),n=Ed(t,"cy",0),r=Ed(t,"r"),i=r*Md;return["M",e,n-r,"C",e+i,n-r,e+r,n-i,e+r,n,"C",e+r,n+i,e+i,n+r,e,n+r,"C",e-i,n+r,e-r,n+i,e-r,n,"C",e-r,n-i,e-i,n-r,e,n-r,"Z"].join(" ")}function Ld(t){const e=Ed(t,"cx",0),n=Ed(t,"cy",0),r=Ed(t,"rx"),i=Ed(t,"ry")||r,s=r*Md,o=i*Md;return["M",e,n-i,"C",e+s,n-i,e+r,n-o,e+r,n,"C",e+r,n+o,e+s,n+i,e,n+i,"C",e-s,n+i,e-r,n+o,e-r,n,"C",e-r,n-o,e-s,n-i,e,n-i,"Z"].join(" ")}function Bd(t){return Id({x:Ed(t,"x",0),y:Ed(t,"y",0),width:Ed(t,"width",0),height:Ed(t,"height",0),rx:Ed(t,"rx",0),ry:Ed(t,"ry",0)})}function Id(t){let e;const n=t.x,r=t.y,i=t.width,s=t.height,o=Math.min(t.rx||t["top-rx"]||0,i/2),a=Math.min(t.rx||t["bottom-rx"]||0,i/2),l=Math.min(t.ry||t["top-ry"]||0,s/2),c=Math.min(t.ry||t["bottom-ry"]||0,s/2);return e=o||a||l||c?["M",n,r+l,"v",s-l-c,"a",a,c,0,0,0,a,c,"h",i-2*a,"a",a,c,0,0,0,a,-c,"v",-(s-c-l),"a",o,l,0,0,0,-o,-l,"h",-(i-2*o),"a",o,l,0,0,0,-o,l,"Z"]:["M",n,r,"H",n+i,"V",r+s,"H",n,"V",r,"Z"],e.join(" ")}function Dd(t){const e=Ag("path");Ug(e,Ug(t));const n=Rd(t);return n&&e.setAttribute("d",n),e}function Rd(t){const e=t.tagName.toLowerCase();switch(e){case"path":return t.getAttribute("d");case"line":return Od(t);case"polygon":return Td(t);case"polyline":return kd(t);case"ellipse":return Ld(t);case"circle":return _d(t);case"rect":return Bd(t)}throw new Error(`"${e}" cannot be converted to svg path element.`)}const Vd=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,zd=/[ ,]+/,$d=/^(\w+)\((.*)\)/;function Fd(t,e){const n=Ag("svg").createSVGPoint();return n.x=t,n.y=e,n}function Gd(t){const e=Ag("svg").createSVGMatrix();if(null!=t){const n=t,r=e;for(const t in n)r[t]=n[t]}return e}function Ud(t){const e=Ag("svg");return null!=t?(t instanceof DOMMatrix||(t=Gd(t)),e.createSVGTransformFromMatrix(t)):e.createSVGTransform()}function qd(t){let e=Gd();const n=null!=t&&t.match(Vd);if(!n)return e;for(let t=0,r=n.length;t<r;t+=1){const r=n[t].match($d);if(r){let t,n,i,s,o,a=Gd();const l=r[2].split(zd);switch(r[1].toLowerCase()){case"scale":t=parseFloat(l[0]),n=void 0===l[1]?t:parseFloat(l[1]),a=a.scaleNonUniform(t,n);break;case"translate":i=parseFloat(l[0]),s=parseFloat(l[1]),a=a.translate(i,s);break;case"rotate":o=parseFloat(l[0]),i=parseFloat(l[1])||0,s=parseFloat(l[2])||0,a=0!==i||0!==s?a.translate(i,s).rotate(o).translate(-i,-s):a.rotate(o);break;case"skewx":o=parseFloat(l[0]),a=a.skewX(o);break;case"skewy":o=parseFloat(l[0]),a=a.skewY(o);break;case"matrix":a.a=parseFloat(l[0]),a.b=parseFloat(l[1]),a.c=parseFloat(l[2]),a.d=parseFloat(l[3]),a.e=parseFloat(l[4]),a.f=parseFloat(l[5]);break;default:continue}e=e.multiply(a)}}return e}function Wd(t){const e=t||{};return`matrix(${null!=e.a?e.a:1},${null!=e.b?e.b:0},${null!=e.c?e.c:0},${null!=e.d?e.d:1},${null!=e.e?e.e:0},${null!=e.f?e.f:0})`}function Hd(t){let e,n,r;if(t){const i=zd;if(t.trim().indexOf("matrix")>=0){const i=Xd(qd(t));e=[i.translateX,i.translateY],n=[i.rotation],r=[i.scaleX,i.scaleY];const s=[];0===e[0]&&0===e[1]||s.push(`translate(${e.join(",")})`),1===r[0]&&1===r[1]||s.push(`scale(${r.join(",")})`),0!==n[0]&&s.push(`rotate(${n[0]})`),t=s.join(" ")}else{const s=t.match(/translate\((.*?)\)/);s&&(e=s[1].split(i));const o=t.match(/rotate\((.*?)\)/);o&&(n=o[1].split(i));const a=t.match(/scale\((.*?)\)/);a&&(r=a[1].split(i))}}const i=r&&r[0]?parseFloat(r[0]):1;return{raw:t||"",translation:{tx:e&&e[0]?parseInt(e[0],10):0,ty:e&&e[1]?parseInt(e[1],10):0},rotation:{angle:n&&n[0]?parseInt(n[0],10):0,cx:n&&n[1]?parseInt(n[1],10):void 0,cy:n&&n[2]?parseInt(n[2],10):void 0},scale:{sx:i,sy:r&&r[1]?parseFloat(r[1]):i}}}function Jd(t,e){return{x:e.x*t.a+e.y*t.c+0,y:e.x*t.b+e.y*t.d+0}}function Xd(t){const e=Jd(t,{x:0,y:1}),n=Jd(t,{x:1,y:0}),r=180/Math.PI*Math.atan2(e.y,e.x)-90;return{skewX:r,skewY:180/Math.PI*Math.atan2(n.y,n.x),translateX:t.e,translateY:t.f,scaleX:Math.sqrt(t.a*t.a+t.b*t.b),scaleY:Math.sqrt(t.c*t.c+t.d*t.d),rotation:r}}function Yd(t){let e,n,r,i;return t?(e=null==t.a?1:t.a,i=null==t.d?1:t.d,n=t.b,r=t.c):e=i=1,{sx:n?Math.sqrt(e*e+n*n):e,sy:r?Math.sqrt(r*r+i*i):i}}function Zd(t){let e={x:0,y:1};t&&(e=Jd(t,e));const n=180*Math.atan2(e.y,e.x)/Math.PI%360-90;return{angle:n%360+(n<0?360:0)}}function Kd(t){return{tx:t&&t.e||0,ty:t&&t.f||0}}function Qd(t,e,n={}){if(null==e)return qd(Ug(t,"transform"));if(n.absolute)return void t.setAttribute("transform",Wd(e));const r=t.transform,i=Ud(e);r.baseVal.appendItem(i)}function tf(t,e,n=0,r={}){let i=Ug(t,"transform");const s=Hd(i);if(null==e)return s.translation;i=s.raw,i=i.replace(/translate\([^)]*\)/g,"").trim();const o=`translate(${r.absolute?e:s.translation.tx+e},${r.absolute?n:s.translation.ty+n})`;t.setAttribute("transform",`${o} ${i}`.trim())}function ef(t,e,n,r,i={}){let s=Ug(t,"transform");const o=Hd(s);if(null==e)return o.rotation;s=o.raw,s=s.replace(/rotate\([^)]*\)/g,"").trim(),e%=360;const a=`rotate(${i.absolute?e:o.rotation.angle+e}${null!=n&&null!=r?`,${n},${r}`:""})`;t.setAttribute("transform",`${s} ${a}`.trim())}function nf(t,e,n){let r=Ug(t,"transform");const i=Hd(r);if(null==e)return i.scale;n=null==n?e:n,r=i.raw,r=r.replace(/scale\([^)]*\)/g,"").trim();const s=`scale(${e},${n})`;t.setAttribute("transform",`${r} ${s}`.trim())}function rf(t,e){if(yg(e)&&yg(t)){const n=e.getScreenCTM(),r=t.getScreenCTM();if(n&&r)return n.inverse().multiply(r)}return Gd()}function sf(t,e){let n=Gd();if(yg(e)&&yg(t)){let r=t;const i=[];for(;r&&r!==e;){const t=qd(r.getAttribute("transform")||null);i.push(t),r=r.parentNode}i.reverse().forEach((t=>{n=n.multiply(t)}))}return n}function of(t,e,n){const r=t instanceof SVGSVGElement?t:t.ownerSVGElement,i=r.createSVGPoint();i.x=e,i.y=n;try{const e=r.getScreenCTM(),n=i.matrixTransform(e.inverse()),s=rf(t,r).inverse();return n.matrixTransform(s)}catch(t){return i}}var af,lf,cf;!function(t){const e={};t.get=function(t){return e[t]||{}},t.register=function(t,n){e[t]=n},t.unregister=function(t){delete e[t]}}(af||(af={})),function(t){const e=new WeakMap;t.ensure=function(t){return e.has(t)||e.set(t,{events:Object.create(null)}),e.get(t)},t.get=function(t){return e.get(t)},t.remove=function(t){return e.delete(t)}}(lf||(lf={})),function(t){t.returnTrue=()=>!0,t.returnFalse=()=>!1,t.stopPropagationCallback=function(t){t.stopPropagation()},t.addEventListener=function(t,e,n){null!=t.addEventListener&&t.addEventListener(e,n)},t.removeEventListener=function(t,e,n){null!=t.removeEventListener&&t.removeEventListener(e,n)}}(cf||(cf={})),function(t){const e=/[^\x20\t\r\n\f]+/g,n=/^([^.]*)(?:\.(.+)|)/;t.splitType=function(t){return(t||"").match(e)||[""]},t.normalizeType=function(t){const e=n.exec(t)||[];return{originType:e[1]?e[1].trim():e[1],namespaces:e[2]?e[2].split(".").map((t=>t.trim())).sort():[]}},t.isValidTarget=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType},t.isValidSelector=function(t,e){if(e){const n=t;return null!=n.querySelector&&null!=n.querySelector(e)}return!0}}(cf||(cf={})),function(t){let e=0;const n=new WeakMap;t.ensureHandlerId=function(t){return n.has(t)||(n.set(t,e),e+=1),n.get(t)},t.getHandlerId=function(t){return n.get(t)},t.removeHandlerId=function(t){return n.delete(t)},t.setHandlerId=function(t,e){return n.set(t,e)}}(cf||(cf={})),function(t){t.getHandlerQueue=function(t,e){const n=[],r=lf.get(t),i=r&&r.events&&r.events[e.type],s=i&&i.handlers||[],o=i?i.delegateCount:0;if(o>0&&!("click"===e.type&&"number"==typeof e.button&&e.button>=1))for(let r=e.target;r!==t;r=r.parentNode||t)if(1===r.nodeType&&("click"!==e.type||!0!==r.disabled)){const e=[],i={};for(let n=0;n<o;n+=1){const o=s[n],a=o.selector;if(null!=a&&null==i[a]){const e=[];t.querySelectorAll(a).forEach((t=>{e.push(t)})),i[a]=e.includes(r)}i[a]&&e.push(o)}e.length&&n.push({elem:r,handlers:e})}return o<s.length&&n.push({elem:t,handlers:s.slice(o)}),n}}(cf||(cf={})),function(t){t.isWindow=function(t){return null!=t&&t===t.window}}(cf||(cf={})),function(t){t.contains=function(t,e){const n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}}(cf||(cf={}));class hf{constructor(t,e){this.isDefaultPrevented=cf.returnFalse,this.isPropagationStopped=cf.returnFalse,this.isImmediatePropagationStopped=cf.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{const t=this.originalEvent;this.isDefaultPrevented=cf.returnTrue,t&&!this.isSimulated&&t.preventDefault()},this.stopPropagation=()=>{const t=this.originalEvent;this.isPropagationStopped=cf.returnTrue,t&&!this.isSimulated&&t.stopPropagation()},this.stopImmediatePropagation=()=>{const t=this.originalEvent;this.isImmediatePropagationStopped=cf.returnTrue,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()},"string"==typeof t?this.type=t:t.type&&(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?cf.returnTrue:cf.returnFalse,this.target=t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget,this.timeStamp=t.timeStamp),e&&Object.assign(this,e),this.timeStamp||(this.timeStamp=Date.now())}}!function(t){t.create=function(e){return e instanceof t?e:new t(e)}}(hf||(hf={})),function(t){t.addProperty=function(e,n){Object.defineProperty(t.prototype,e,{enumerable:!0,configurable:!0,get:"function"==typeof n?function(){if(this.originalEvent)return n(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})}}(hf||(hf={})),function(t){const e={bubbles:!0,cancelable:!0,eventPhase:!0,detail:!0,view:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pageX:!0,pageY:!0,screenX:!0,screenY:!0,toElement:!0,pointerId:!0,pointerType:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,touches:!0,changedTouches:!0,targetTouches:!0,which:!0,altKey:!0,ctrlKey:!0,metaKey:!0,shiftKey:!0};Object.keys(e).forEach((n=>t.addProperty(n,e[n])))}(hf||(hf={})),af.register("load",{noBubble:!0}),af.register("beforeunload",{postDispatch(t,e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}),af.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(t,e){let n;const r=e.relatedTarget,i=e.handleObj;return r&&(r===t||cf.contains(t,r))||(e.type=i.originType,n=i.handler.call(t,e),e.type="mouseover"),n}}),af.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(t,e){let n;const r=e.relatedTarget,i=e.handleObj;return r&&(r===t||cf.contains(t,r))||(e.type=i.originType,n=i.handler.call(t,e),e.type="mouseout"),n}});var uf,gf,df,ff=window&&window.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};!function(t){let e;function n(t,e,...n){const r=hf.create(e);r.delegateTarget=t;const i=af.get(r.type);if(i.preDispatch&&!1===i.preDispatch(t,r))return;const s=cf.getHandlerQueue(t,r);for(let t=0,e=s.length;t<e&&!r.isPropagationStopped();t+=1){const e=s[t];r.currentTarget=e.elem;for(let t=0,i=e.handlers.length;t<i&&!r.isImmediatePropagationStopped();t+=1){const i=e.handlers[t];if(null==r.rnamespace||i.namespace&&r.rnamespace.test(i.namespace)){r.handleObj=i,r.data=i.data;const t=af.get(i.originType).handle,s=t?t(e.elem,r,...n):i.handler.call(e.elem,r,...n);void 0!==s&&(r.result=s,!1===s&&(r.preventDefault(),r.stopPropagation()))}}}return i.postDispatch&&i.postDispatch(t,r),r.result}t.on=function(t,r,i,s,o){if(!cf.isValidTarget(t))return;let a;if("function"!=typeof i){const{handler:t,selector:e}=i,n=ff(i,["handler","selector"]);i=t,o=e,a=n}const l=lf.ensure(t);let c=l.handler;null==c&&(c=l.handler=function(r,...i){return e!==r.type?n(t,r,...i):void 0});const h=cf.ensureHandlerId(i);cf.splitType(r).forEach((e=>{const{originType:n,namespaces:r}=cf.normalizeType(e);if(!n)return;let u=n,g=af.get(u);u=(o?g.delegateType:g.bindType)||u,g=af.get(u);const d=Object.assign({type:u,originType:n,data:s,selector:o,guid:h,handler:i,namespace:r.join(".")},a),f=l.events;let p=f[u];p||(p=f[u]={handlers:[],delegateCount:0},g.setup&&!1!==g.setup(t,s,r,c)||cf.addEventListener(t,u,c)),g.add&&(cf.removeHandlerId(d.handler),g.add(t,d),cf.setHandlerId(d.handler,h)),o?(p.handlers.splice(p.delegateCount,0,d),p.delegateCount+=1):p.handlers.push(d)}))},t.off=function t(e,n,r,i,s){const o=lf.get(e);if(!o)return;const a=o.events;a&&(cf.splitType(n).forEach((n=>{const{originType:l,namespaces:c}=cf.normalizeType(n);if(!l)return void Object.keys(a).forEach((s=>{t(e,s+n,r,i,!0)}));let h=l;const u=af.get(h);h=(i?u.delegateType:u.bindType)||h;const g=a[h];if(!g)return;const d=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,f=g.handlers.length;for(let t=g.handlers.length-1;t>=0;t-=1){const n=g.handlers[t];!s&&l!==n.originType||r&&cf.getHandlerId(r)!==n.guid||!(null==d||n.namespace&&d.test(n.namespace))||!(null==i||i===n.selector||"**"===i&&n.selector)||(g.handlers.splice(t,1),n.selector&&(g.delegateCount-=1),u.remove&&u.remove(e,n))}f&&0===g.handlers.length&&(u.teardown&&!1!==u.teardown(e,c,o.handler)||cf.removeEventListener(e,h,o.handler),delete a[h])})),0===Object.keys(a).length&&lf.remove(e))},t.dispatch=n,t.trigger=function(t,n,r,i){let s=t,o="string"==typeof t?t:t.type,a="string"==typeof t||null==s.namespace?[]:s.namespace.split(".");const l=r;if(3===l.nodeType||8===l.nodeType)return;o.indexOf(".")>-1&&(a=o.split("."),o=a.shift(),a.sort());const c=o.indexOf(":")<0&&`on${o}`;s=t instanceof hf?t:new hf(o,"object"==typeof t?t:null),s.namespace=a.join("."),s.rnamespace=s.namespace?new RegExp(`(^|\\.)${a.join("\\.(?:.*\\.|)")}(\\.|$)`):null,s.result=void 0,s.target||(s.target=l);const h=[s];Array.isArray(n)?h.push(...n):h.push(n);const u=af.get(o);if(!i&&u.trigger&&!1===u.trigger(l,s,n))return;let g;const d=[l];if(!i&&!u.noBubble&&!cf.isWindow(l)){g=u.delegateType||o;let t=l,e=l.parentNode;for(;null!=e;)d.push(e),t=e,e=e.parentNode;if(t===(l.ownerDocument||document)){const e=t.defaultView||t.parentWindow||window;d.push(e)}}let f=l;for(let t=0,e=d.length;t<e&&!s.isPropagationStopped();t+=1){const e=d[t];f=e,s.type=t>1?g:u.bindType||o;const n=lf.get(e);n&&n.events[s.type]&&n.handler&&n.handler.call(e,...h);const r=c&&e[c]||null;r&&cf.isValidTarget(e)&&(s.result=r.call(e,...h),!1===s.result&&s.preventDefault())}if(s.type=o,!i&&!s.isDefaultPrevented()){const t=u.preventDefault;if((null==t||!1===t(d.pop(),s,n))&&cf.isValidTarget(l)&&c&&"function"==typeof l[o]&&!cf.isWindow(l)){const t=l[c];t&&(l[c]=null),e=o,s.isPropagationStopped()&&f.addEventListener(o,cf.stopPropagationCallback),l[o](),s.isPropagationStopped()&&f.removeEventListener(o,cf.stopPropagationCallback),e=void 0,t&&(l[c]=t)}}return s.result}}(uf||(uf={})),function(t){t.on=function(t,e,n,r,i){return df.on(t,e,n,r,i),t},t.once=function(t,e,n,r,i){return df.on(t,e,n,r,i,!0),t},t.off=function(t,e,n,r){return df.off(t,e,n,r),t},t.trigger=function(t,e,n,r){return uf.trigger(e,n,t,r),t}}(gf||(gf={})),function(t){t.on=function e(n,r,i,s,o,a){if("object"==typeof r)return"string"!=typeof i&&(s=s||i,i=void 0),void Object.keys(r).forEach((t=>e(n,t,i,s,r[t],a)));if(null==s&&null==o?(o=i,s=i=void 0):null==o&&("string"==typeof i?(o=s,s=void 0):(o=s,s=i,i=void 0)),!1===o)o=cf.returnFalse;else if(!o)return;if(a){const e=o;o=function(r,...i){return t.off(n,r),e.call(this,r,...i)},cf.setHandlerId(o,cf.ensureHandlerId(e))}uf.on(n,r,o,s,i)},t.off=function t(e,n,r,i){const s=n;if(s&&null!=s.preventDefault&&null!=s.handleObj){const e=s.handleObj;t(s.delegateTarget,e.namespace?`${e.originType}.${e.namespace}`:e.originType,e.selector,e.handler)}else if("object"!=typeof n)!1!==r&&"function"!=typeof r||(i=r,r=void 0),!1===i&&(i=cf.returnFalse),uf.off(e,n,i,r);else{const i=n;Object.keys(i).forEach((n=>t(e,n,r,i[n])))}}}(df||(df={}));class pf{constructor(e,n,r){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=t.Platform.isEventSupported("wheel")?"wheel":"mousewheel",this.target=e,this.onWheelCallback=n,this.onWheelGuard=r,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(t){if(null!=this.onWheelGuard&&!this.onWheelGuard(t))return;let e;this.deltaX+=t.deltaX,this.deltaY+=t.deltaY,t.preventDefault(),0===this.deltaX&&0===this.deltaY||(t.stopPropagation(),e=!0),!0===e&&0===this.animationFrameId&&(this.animationFrameId=requestAnimationFrame((()=>{this.didWheel(t)})))}didWheel(t){this.animationFrameId=0,this.onWheelCallback(t,this.deltaX,this.deltaY),this.deltaX=0,this.deltaY=0}}function mf(t){const e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}var yf=Object.freeze({__proto__:null,CASE_SENSITIVE_ATTR:Vg,get Event(){return gf},get EventHook(){return af},get EventObject(){return hf},KAPPA:Md,MouseWheelHandle:pf,addClass:ug,after:function(t,e){const n=t.parentNode;if(n){(Array.isArray(e)?e:[e]).forEach((e=>{null!=e&&n.insertBefore(e,t.nextSibling)}))}},append:_g,appendTo:Ig,attr:Ug,before:Bg,breakText:Pd,children:function(t,e){const n=[];let r=t.firstChild;for(;r;r=r.nextSibling)1===r.nodeType&&(e&&!hg(r,e)||n.push(r));return n},circleToPathData:_d,clearSelection:od,computeStyle:cd,computeStyleInt:hd,contains:kg,createElement:xg,createElementNS:wg,createSVGMatrix:Gd,createSVGPoint:Fd,createSVGTransform:Ud,createSlicePathData:function(t,e,n,r){const i=2*Math.PI-1e-6,s=t,o=e;let a=n,l=r;if(l<a){const t=a;a=l,l=t}const c=l-a,h=c<Math.PI?"0":"1",u=Math.cos(a),g=Math.sin(a),d=Math.cos(l),f=Math.sin(l);return c>=i?s?`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}M0,${s}A${s},${s} 0 1,0 0,${-s}A${s},${s} 0 1,0 0,${s}Z`:`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}Z`:s?`M${o*u},${o*g}A${o},${o} 0 ${h},1 ${o*d},${o*f}L${s*d},${s*f}A${s},${s} 0 ${h},0 ${s*u},${s*g}Z`:`M${o*u},${o*g}A${o},${o} 0 ${h},1 ${o*d},${o*f}L0,0Z`},createSvgDocument:Cg,createSvgElement:Ag,css:ud,data:pd,decomposeMatrix:Xd,ellipseToPathData:Ld,empty:jg,ensureId:mg,find:Sg,findOne:Og,findParentByClass:Tg,getAttribute:zg,getClass:cg,getComputedStyle:sd,getData:dd,getPointsFromSvgElement:jd,getTransformToElement:rf,getTransformToParentElement:sf,getVendorPrefixedName:id,hasClass:hg,hasScrollbars:function(t){const e=sd(t);return null!=e&&("scroll"===e.overflow||"auto"===e.overflow)},height:function(t){return t.getBoundingClientRect().height},index:Eg,isCSSVariable:ld,isElement:Dg,isHTMLElement:Rg,isSVGGraphicsElement:yg,kebablizeAttrs:Wg,lineToPathData:Od,matrixToRotation:Zd,matrixToScale:Yd,matrixToTransformString:Wd,matrixToTranslation:Kd,measureText:Ad,mergeAttrs:Jg,ns:vg,offset:mf,parseTransformString:Hd,parseXML:Pg,polygonToPathData:Td,polylineToPathData:kd,position:function(t){const e="fixed"===cd(t,"position");let n;if(e){const e=t.getBoundingClientRect();n={left:e.left,top:e.top}}else n=mf(t);if(!e){const e=t.ownerDocument;let r=t.offsetParent||e.documentElement;for(;(r===e.body||r===e.documentElement)&&"static"===cd(r,"position");)r=r.parentNode;if(r!==t&&Dg(r)){const t=mf(r);n.top-=t.top+hd(r,"borderTopWidth"),n.left-=t.left+hd(r,"borderLeftWidth")}}return{top:n.top-hd(t,"marginTop"),left:n.left-hd(t,"marginLeft")}},prepend:Lg,prop:function t(e,n,r){if(n){if("string"==typeof n)return n=md[n]||n,arguments.length<3?e[n]:void(e[n]=r);for(const r in n)t(e,r,n[r])}},qualifyAttr:qg,rectToPathData:Id,rectangleToPathData:Bd,remove:Ng,removeAttribute:$g,removeClass:gg,rotate:ef,sample:Sd,scale:nf,setAttribute:Fg,setAttributes:Gg,setData:fd,setPrefixedStyle:function(t,e,n){const r=id(e);null!=r&&(t[r]=n),t[e]=n},splitTextByLength:Cd,styleToObject:Hg,svgVersion:bg,tagName:Mg,text:wd,toLocalPoint:of,toPath:Dd,toPathData:Rd,toggleClass:dg,transform:Qd,transformStringToMatrix:qd,translate:tf,uniqueId:pg,width:function(t){return t.getBoundingClientRect().width}});function vf(t,e=60){let n=null;return(...r)=>{n&&clearTimeout(n),n=window.setTimeout((()=>{t.apply(this,r)}),e)}}const bf="undefined"!=typeof ResizeObserver?function(t){let e=null,n=[];const r=vf((()=>{n.forEach((e=>{e(t)}))})),i=()=>{e&&(e.disconnect(),n=[],e=null)};return{element:t,bind:i=>{e||(e=(()=>{const e=new ResizeObserver(r);return e.observe(t),r(),e})()),-1===n.indexOf(i)&&n.push(i)},destroy:i,unbind:t=>{const r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&e&&i()}}}:function(t){let e=null,n=[];const r=vf((()=>{n.forEach((e=>e(t)))})),i=()=>{e&&e.parentNode&&(e.contentDocument&&e.contentDocument.defaultView.removeEventListener("resize",r),e.parentNode.removeChild(e),e=null,n=[])};return{element:t,bind:i=>{e||(e=(()=>{"static"===getComputedStyle(t).position&&(t.style.position="relative");const e=document.createElement("object");return e.onload=()=>{e.contentDocument.defaultView.addEventListener("resize",r),r()},e.style.display="block",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.overflow="hidden",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.opacity="0",e.setAttribute("tabindex","-1"),e.type="text/html",t.appendChild(e),e.data="about:blank",e})()),-1===n.indexOf(i)&&n.push(i)},destroy:i,unbind:t=>{const r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&e&&i()}}};t.SizeSensor=void 0,function(t){const e=new WeakMap;function n(t){let n=e.get(t);return n||(n=bf(t),e.set(t,n),n)}t.bind=(t,e)=>{const r=n(t);return r.bind(e),()=>r.unbind(e)},t.clear=t=>{!function(t){t.destroy(),e.delete(t.element)}(n(t))}}(t.SizeSensor||(t.SizeSensor={}));class xf{constructor(t={}){this.comparator=t.comparator||xf.defaultComparator,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return 0===this.data.length}insert(t,e,n){const r={priority:t,value:e},i=this.data.length;return n&&(r.id=n,this.index[n]=i),this.data.push(r),this.bubbleUp(i),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(t,e){const n=this.index[t];if(void 0===n)throw new Error(`Node with id '${t}' was not found in the heap.`);const r=this.data,i=r[n].priority,s=this.comparator(e,i);s<0?(r[n].priority=e,this.bubbleUp(n)):s>0&&(r[n].priority=e,this.bubbleDown(n))}remove(){const t=this.data,e=t[0],n=t.pop();return e.id&&delete this.index[e.id],t.length>0&&(t[0]=n,n.id&&(this.index[n.id]=0),this.bubbleDown(0)),e?e.value:null}heapify(){for(let t=0;t<this.data.length;t+=1)this.bubbleUp(t)}bubbleUp(t){const e=this.data;let n,r,i=t;for(;i>0&&(r=i-1>>>1,this.comparator(e[i].priority,e[r].priority)<0);){n=e[r],e[r]=e[i];let t=e[i].id;null!=t&&(this.index[t]=r),e[i]=n,t=e[i].id,null!=t&&(this.index[t]=i),i=r}}bubbleDown(t){const e=this.data,n=e.length-1;let r=t;for(;;){const t=1+(r<<1),i=t+1;let s=r;if(t<=n&&this.comparator(e[t].priority,e[s].priority)<0&&(s=t),i<=n&&this.comparator(e[i].priority,e[s].priority)<0&&(s=i),s===r)break;{const t=e[s];e[s]=e[r];let n=e[r].id;null!=n&&(this.index[n]=s),e[r]=t,n=e[r].id,null!=n&&(this.index[n]=r),r=s}}}}var wf,Af;!function(t){t.defaultComparator=(t,e)=>t-e}(xf||(xf={})),t.Dijkstra=void 0,(t.Dijkstra||(t.Dijkstra={})).run=function(t,e,n=(t,e)=>1){const r={},i={},s={},o=new xf;for(r[e]=0,Object.keys(t).forEach((t=>{t!==e&&(r[t]=1/0),o.insert(r[t],t,t)}));!o.isEmpty();){const e=o.remove();s[e]=!0;const a=t[e]||[];for(let t=0;t<a.length;t+=1){const l=a[t];if(!s[l]){const t=r[e]+n(e,l);t<r[l]&&(r[l]=t,i[l]=e,o.updatePriority(l,t))}}}return i};class Cf{constructor(t,e,n,r){return null==t?this.set(255,255,255,1):"number"==typeof t?this.set(t,e,n,r):"string"==typeof t?Cf.fromString(t)||this:Array.isArray(t)?this.set(t):void this.set(t.r,t.g,t.b,null==t.a?1:t.a)}blend(t,e,n){this.set(t.r+(e.r-t.r)*n,t.g+(e.g-t.g)*n,t.b+(e.b-t.b)*n,t.a+(e.a-t.a)*n)}lighten(t){const e=Cf.lighten(this.toArray(),t);this.r=e[0],this.g=e[1],this.b=e[2],this.a=e[3]}darken(t){this.lighten(-t)}set(t,e,n,r){const i=Array.isArray(t)?t[0]:t,s=Array.isArray(t)?t[1]:e,o=Array.isArray(t)?t[2]:n,a=Array.isArray(t)?t[3]:r;return this.r=Math.round(Hr(i,0,255)),this.g=Math.round(Hr(s,0,255)),this.b=Math.round(Hr(o,0,255)),this.a=null==a?1:Hr(a,0,1),this}toHex(){return`#${["r","g","b"].map((t=>{const e=this[t].toString(16);return e.length<2?`0${e}`:e})).join("")}`}toRGBA(){return this.toArray()}toHSLA(){return Cf.rgba2hsla(this.r,this.g,this.b,this.a)}toCSS(t){const e=`${this.r},${this.g},${this.b},`;return t?`rgb(${e})`:`rgba(${e},${this.a})`}toGrey(){return Cf.makeGrey(Math.round((this.r+this.g+this.b)/3),this.a)}toArray(){return[this.r,this.g,this.b,this.a]}toString(){return this.toCSS()}}!function(t){function e(e){return new t([...a(e),1])}function n(e){const n=e.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);if(n){const e=n[1].split(/\s*,\s*/).map((t=>parseInt(t,10)));return new t(e)}return null}function r(t,e,n){n<0&&++n,n>1&&--n;const r=6*n;return r<1?t+(e-t)*r:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function i(e){const n=e.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(n){const e=n[2].split(/\s*,\s*/),r=(parseFloat(e[0])%360+360)%360/360,i=parseFloat(e[1])/100,o=parseFloat(e[2])/100,a=null==e[3]?1:parseInt(e[3],10);return new t(s(r,i,o,a))}return null}function s(t,e,n,i){const s=Array.isArray(t)?t[0]:t,o=Array.isArray(t)?t[1]:e,a=Array.isArray(t)?t[2]:n,l=Array.isArray(t)?t[3]:i,c=a<=.5?a*(o+1):a+o-a*o,h=2*a-c;return[256*r(h,c,s+1/3),256*r(h,c,s),256*r(h,c,s-1/3),null==l?1:l]}function o(e){return new t(Math.round(256*Math.random()),Math.round(256*Math.random()),Math.round(256*Math.random()),e?void 0:parseFloat(Math.random().toFixed(2)))}function a(t){const e=0===t.indexOf("#")?t:`#${t}`;let n=Number(`0x${e.substr(1)}`);if(4!==e.length&&7!==e.length||Number.isNaN(n))throw new Error("Invalid hex color.");const r=4===e.length?4:8,i=(1<<r)-1,s=["b","g","r"].map((()=>{const t=n&i;return n>>=r,4===r?17*t:t}));return[s[2],s[1],s[0]]}function l(t,e,n){const r=t=>t.length<2?`0${t}`:t;return`${r(t.toString(16))}${r(e.toString(16))}${r(n.toString(16))}`}function c(t,e){if("string"==typeof t){const n="#"===t[0],r=parseInt(n?t.substr(1):t,16),i=Hr((r>>16)+e,0,255),s=Hr((r>>8&255)+e,0,255);return`${n?"#":""}${(Hr((255&r)+e,0,255)|s<<8|i<<16).toString(16)}`}const n=a(c(l(t[0],t[1],t[2]),e));return[n[0],n[1],n[2],t[3]]}t.fromArray=function(e){return new t(e)},t.fromHex=e,t.fromRGBA=n,t.fromHSLA=i,t.fromString=function(r){if(r.startsWith("#"))return e(r);if(r.startsWith("rgb"))return n(r);const s=t.named[r];return s?e(s):i(r)},t.makeGrey=function(e,n){return t.fromArray([e,e,e,n])},t.rgba2hsla=function(t,e,n,r){const i=Array.isArray(t)?t[0]:t,s=Array.isArray(t)?t[1]:e,o=Array.isArray(t)?t[2]:n,a=Array.isArray(t)?t[3]:r,l=Math.max(i,s,o),c=Math.min(i,s,o),h=(l+c)/2;let u=0,g=0;if(c!==l){const t=l-c;switch(g=h>.5?t/(2-l-c):t/(l+c),l){case i:u=(s-o)/t+(s<o?6:0);break;case s:u=(o-i)/t+2;break;case o:u=(i-s)/t+4}u/=6}return[u,g,h,null==a?1:a]},t.hsla2rgba=s,t.random=o,t.randomHex=function(){let t="#";for(let e=0;e<6;e+=1)t+="0123456789ABCDEF"[Math.floor(16*Math.random())];return t},t.randomRGBA=function(t){return o(t).toString()},t.invert=function(t,e){if("string"==typeof t){const n="#"===t[0],[r,i,s]=a(t);return e?.299*r+.587*i+.114*s>186?"#000000":"#ffffff":`${n?"#":""}${l(255-r,255-i,255-s)}`}const n=t[0],r=t[1],i=t[2],s=t[3];return e?.299*n+.587*r+.114*i>186?[0,0,0,s]:[255,255,255,s]:[255-n,255-r,255-i,s]},t.lighten=function(t,e){return c(t,e)},t.darken=function(t,e){return c(t,-e)}}(Cf||(Cf={})),function(t){t.named={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",burntsienna:"#ea7e5d",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(Cf||(Cf={}));class Pf{constructor(){this.clear()}clear(){this.map=new WeakMap,this.arr=[]}has(t){return this.map.has(t)}get(t){return this.map.get(t)}set(t,e){this.map.set(t,e),this.arr.push(t)}delete(t){const e=this.arr.indexOf(t);e>=0&&this.arr.splice(e,1);const n=this.map.get(t);return this.map.delete(t),n}each(t){this.arr.forEach((e=>{const n=this.map.get(e);t(n,e)}))}dispose(){this.clear()}}t.ModifierKey=void 0,function(t){function e(t){const e=[],n=[];return Array.isArray(t)?e.push(...t):t.split("|").forEach((t=>{-1===t.indexOf("&")?e.push(t):n.push(...t.split("&"))})),{or:e,and:n}}t.parse=e,t.equals=function(t,n){if(null!=t&&null!=n){const r=e(t),i=e(n),s=r.or.sort(),o=i.or.sort(),a=r.and.sort(),l=i.and.sort(),c=(t,e)=>t.length===e.length&&(0===t.length||t.every(((t,n)=>t===e[n])));return c(s,o)&&c(a,l)}return null==t&&null==n},t.isMatch=function(t,n,r){if(null==n||Array.isArray(n)&&0===n.length)return!r||!0!==t.altKey&&!0!==t.ctrlKey&&!0!==t.metaKey&&!0!==t.shiftKey;const{or:i,and:s}=e(n),o=e=>{const n=`${e.toLowerCase()}Key`;return!0===t[n]};return i.some((t=>o(t)))&&s.every((t=>o(t)))}}(t.ModifierKey||(t.ModifierKey={})),t.Timing=void 0,(wf=t.Timing||(t.Timing={})).linear=t=>t,wf.quad=t=>t*t,wf.cubic=t=>t*t*t,wf.inout=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)},wf.exponential=t=>Math.pow(2,10*(t-1)),wf.bounce=t=>{for(let e=0,n=1;;e+=n,n/=2)if(t>=(7-4*e)/11){const r=(11-6*e-11*t)/4;return-r*r+n*n}},function(t){t.decorators={reverse:t=>e=>1-t(1-e),reflect:t=>e=>.5*(e<.5?t(2*e):2-t(2-2*e)),clamp:(t,e=0,n=1)=>r=>{const i=t(r);return i<e?e:i>n?n:i},back:(t=1.70158)=>e=>e*e*((t+1)*e-t),elastic:(t=1.5)=>e=>Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*t/3*e)}}(t.Timing||(t.Timing={})),function(t){function e(t){const e=t/1;if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const t=e-1.5/2.75;return 7.5625*t*t+.75}if(e<2.5/2.75){const t=e-2.25/2.75;return 7.5625*t*t+.9375}{const t=e-2.625/2.75;return 7.5625*t*t+.984375}}function n(t){return 1-e(1-t)}t.easeInSine=function(t){return-1*Math.cos(t*(Math.PI/2))+1},t.easeOutSine=function(t){return Math.sin(t*(Math.PI/2))},t.easeInOutSine=function(t){return-.5*(Math.cos(Math.PI*t)-1)},t.easeInQuad=function(t){return t*t},t.easeOutQuad=function(t){return t*(2-t)},t.easeInOutQuad=function(t){return t<.5?2*t*t:(4-2*t)*t-1},t.easeInCubic=function(t){return t*t*t},t.easeOutCubic=function(t){const e=t-1;return e*e*e+1},t.easeInOutCubic=function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},t.easeInQuart=function(t){return t*t*t*t},t.easeOutQuart=function(t){const e=t-1;return 1-e*e*e*e},t.easeInOutQuart=function(t){const e=t-1;return t<.5?8*t*t*t*t:1-8*e*e*e*e},t.easeInQuint=function(t){return t*t*t*t*t},t.easeOutQuint=function(t){const e=t-1;return 1+e*e*e*e*e},t.easeInOutQuint=function(t){const e=t-1;return t<.5?16*t*t*t*t*t:1+16*e*e*e*e*e},t.easeInExpo=function(t){return 0===t?0:Math.pow(2,10*(t-1))},t.easeOutExpo=function(t){return 1===t?1:1-Math.pow(2,-10*t)},t.easeInOutExpo=function(t){if(0===t||1===t)return t;const e=2*t,n=e-1;return e<1?.5*Math.pow(2,10*n):.5*(2-Math.pow(2,-10*n))},t.easeInCirc=function(t){const e=t/1;return-1*(Math.sqrt(1-e*t)-1)},t.easeOutCirc=function(t){const e=t-1;return Math.sqrt(1-e*e)},t.easeInOutCirc=function(t){const e=2*t,n=e-2;return e<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-n*n)+1)},t.easeInBack=function(t,e=1.70158){return t*t*((e+1)*t-e)},t.easeOutBack=function(t,e=1.70158){const n=t/1-1;return n*n*((e+1)*n+e)+1},t.easeInOutBack=function(t,e=1.70158){const n=2*t,r=n-2,i=1.525*e;return n<1?.5*n*n*((i+1)*n-i):.5*(r*r*((i+1)*r+i)+2)},t.easeInElastic=function(t,e=.7){if(0===t||1===t)return t;const n=t/1-1,r=1-e,i=r/(2*Math.PI)*Math.asin(1);return-Math.pow(2,10*n)*Math.sin((n-i)*(2*Math.PI)/r)},t.easeOutElastic=function(t,e=.7){const n=1-e,r=2*t;if(0===t||1===t)return t;const i=n/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*r)*Math.sin((r-i)*(2*Math.PI)/n)+1},t.easeInOutElastic=function(t,e=.65){const n=1-e;if(0===t||1===t)return t;const r=2*t,i=r-1,s=n/(2*Math.PI)*Math.asin(1);return r<1?Math.pow(2,10*i)*Math.sin((i-s)*(2*Math.PI)/n)*-.5:Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)*.5+1},t.easeOutBounce=e,t.easeInBounce=n,t.easeInOutBounce=function(t){return t<.5?.5*n(2*t):.5*e(2*t-1)+.5}}(t.Timing||(t.Timing={})),t.Interp=void 0,(Af=t.Interp||(t.Interp={})).number=(t,e)=>{const n=e-t;return e=>t+n*e},Af.object=(t,e)=>{const n=Object.keys(t);return r=>{const i={};for(let s=n.length-1;-1!==s;s-=1){const o=n[s];i[o]=t[o]+(e[o]-t[o])*r}return i}},Af.unit=(t,e)=>{const n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,r=n.exec(t),i=n.exec(e),s=i?i[1]:"",o=r?+r[1]:0,a=i?+i[1]:0,l=s.indexOf("."),c=l>0?s[1].length-l-1:0,h=a-o,u=r?r[2]:"";return t=>(o+h*t).toFixed(c)+u},Af.color=(t,e)=>{const n=parseInt(t.slice(1),16),r=parseInt(e.slice(1),16),i=255&n,s=(255&r)-i,o=65280&n,a=(65280&r)-o,l=16711680&n,c=(16711680&r)-l;return t=>`#${(1<<24|i+s*t&255|o+a*t&65280|l+c*t&16711680).toString(16).slice(1)}`};const Mf=[];function Ef(e,n){const r=Mf.find((t=>t.name===e));if(!(r&&(r.loadTimes+=1,r.loadTimes>1)||t.Platform.isApplyingHMR())){const t=document.createElement("style");t.setAttribute("type","text/css"),t.textContent=n;const r=document.querySelector("head");r&&r.insertBefore(t,r.firstChild),Mf.push({name:e,loadTimes:1,styleElement:t})}}function Sf(t){const e=Mf.findIndex((e=>e.name===t));if(e>-1){const t=Mf[e];if(t.loadTimes-=1,t.loadTimes>0)return;let n=t.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,Mf.splice(e,1)}}var Of,Tf,kf=Object.freeze({__proto__:null,clean:Sf,ensure:Ef});t.Angle=void 0,(Of=t.Angle||(t.Angle={})).toDeg=function(t){return 180*t/Math.PI%360},Of.toRad=function(t,e=!1){return(e?t:t%360)*Math.PI/180},Of.normalize=function(t){return t%360+(t<0?360:0)},t.GeometryUtil=void 0,(Tf=t.GeometryUtil||(t.GeometryUtil={})).round=function(t,e=0){return Number.isInteger(t)?t:+t.toFixed(e)},Tf.random=function(t,e){let n,r;if(null==e?(r=null==t?1:t,n=0):(r=e,n=null==t?0:t),r<n){const t=n;n=r,r=t}return Math.floor(Math.random()*(r-n+1)+n)},Tf.clamp=function(t,e,n){return Number.isNaN(t)?NaN:Number.isNaN(e)||Number.isNaN(n)?0:e<n?t<e?e:t>n?n:t:t<n?n:t>e?e:t},Tf.snapToGrid=function(t,e){return e*Math.round(t/e)},Tf.containsPoint=function(t,e){return null!=e&&null!=t&&e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height},Tf.squaredLength=function(t,e){const n=t.x-e.x,r=t.y-e.y;return n*n+r*r};class Nf{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class jf extends Nf{constructor(t,e){super(),this.x=null==t?0:t,this.y=null==e?0:e}round(e=0){return this.x=t.GeometryUtil.round(this.x,e),this.y=t.GeometryUtil.round(this.y,e),this}add(t,e){const n=jf.create(t,e);return this.x+=n.x,this.y+=n.y,this}update(t,e){const n=jf.create(t,e);return this.x=n.x,this.y=n.y,this}translate(t,e){const n=jf.create(t,e);return this.x+=n.x,this.y+=n.y,this}rotate(t,e){const n=jf.rotate(this,t,e);return this.x=n.x,this.y=n.y,this}scale(t,e,n=new jf){const r=jf.create(n);return this.x=r.x+t*(this.x-r.x),this.y=r.y+e*(this.y-r.y),this}closest(t){if(1===t.length)return jf.create(t[0]);let e=null,n=1/0;return t.forEach((t=>{const r=this.squaredDistance(t);r<n&&(e=t,n=r)})),e?jf.create(e):null}distance(t){return Math.sqrt(this.squaredDistance(t))}squaredDistance(t){const e=jf.create(t),n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistance(t){const e=jf.create(t);return Math.abs(e.x-this.x)+Math.abs(e.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(t=new jf){const e=jf.create(t),n=-(e.y-this.y),r=e.x-this.x;let i=Math.atan2(n,r);return i<0&&(i=2*Math.PI+i),180*i/Math.PI}angleBetween(t,e){if(this.equals(t)||this.equals(e))return NaN;let n=this.theta(e)-this.theta(t);return n<0&&(n+=360),n}vectorAngle(t){return new jf(0,0).angleBetween(this,t)}toPolar(t){return this.update(jf.toPolar(this,t)),this}changeInAngle(t,e,n=new jf){return this.clone().translate(-t,-e).theta(n)-this.theta(n)}adhereToRect(e){return t.GeometryUtil.containsPoint(e,this)||(this.x=Math.min(Math.max(this.x,e.x),e.x+e.width),this.y=Math.min(Math.max(this.y,e.y),e.y+e.height)),this}bearing(e){const n=jf.create(e),r=t.Angle.toRad(this.y),i=t.Angle.toRad(n.y),s=this.x,o=n.x,a=t.Angle.toRad(o-s),l=Math.sin(a)*Math.cos(i),c=Math.cos(r)*Math.sin(i)-Math.sin(r)*Math.cos(i)*Math.cos(a);let h=t.Angle.toDeg(Math.atan2(l,c))-22.5;return h<0&&(h+=360),h=parseInt(h/45,10),["NE","E","SE","S","SW","W","NW","N"][h]}cross(t,e){if(null!=t&&null!=e){const n=jf.create(t),r=jf.create(e);return(r.x-this.x)*(n.y-this.y)-(r.y-this.y)*(n.x-this.x)}return NaN}dot(t){const e=jf.create(t);return this.x*e.x+this.y*e.y}diff(t,e){if("number"==typeof t)return new jf(this.x-t,this.y-e);const n=jf.create(t);return new jf(this.x-n.x,this.y-n.y)}lerp(t,e){const n=jf.create(t);return new jf((1-e)*this.x+e*n.x,(1-e)*this.y+e*n.y)}normalize(t=1){const e=t/this.magnitude();return this.scale(e,e)}move(e,n){const r=jf.create(e),i=t.Angle.toRad(r.theta(this));return this.translate(Math.cos(i)*n,-Math.sin(i)*n)}reflection(t){return jf.create(t).move(this,this.distance(t))}snapToGrid(e,n){return this.x=t.GeometryUtil.snapToGrid(this.x,e),this.y=t.GeometryUtil.snapToGrid(this.y,null==n?e:n),this}equals(t){const e=jf.create(t);return null!=e&&e.x===this.x&&e.y===this.y}clone(){return jf.clone(this)}toJSON(){return jf.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}!function(t){t.isPoint=function(e){return null!=e&&e instanceof t}}(jf||(jf={})),function(t){t.isPointLike=function(t){return null!=t&&"object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y},t.isPointData=function(t){return null!=t&&Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}}(jf||(jf={})),function(e){function n(t){return e.isPoint(t)?new e(t.x,t.y):Array.isArray(t)?new e(t[0],t[1]):new e(t.x,t.y)}function r(t,e){return t===e||null!=t&&null!=e&&(t.x===e.x&&t.y===e.y)}function i(t,r,i,s=new e){const o=n(t),a=n(s),l=o.x-a.x,c=o.y-a.y,h=c*r+l*i;return new e(l*r-c*i+a.x,h+a.y)}e.create=function(t,r){return null==t||"number"==typeof t?new e(t,r):n(t)},e.clone=n,e.toJSON=function(t){return e.isPoint(t)?{x:t.x,y:t.y}:Array.isArray(t)?{x:t[0],y:t[1]}:{x:t.x,y:t.y}},e.fromPolar=function(r,i,s=new e){let o=Math.abs(r*Math.cos(i)),a=Math.abs(r*Math.sin(i));const l=n(s),c=t.Angle.normalize(t.Angle.toDeg(i));return c<90?a=-a:c<180?(o=-o,a=-a):c<270&&(o=-o),new e(l.x+o,l.y+a)},e.toPolar=function(r,i=new e){const s=n(r),o=n(i),a=s.x-o.x,l=s.y-o.y;return new e(Math.sqrt(a*a+l*l),t.Angle.toRad(o.theta(s)))},e.equals=r,e.equalPoints=function(t,e){if(null==t&&null!=e||null!=t&&null==e||null!=t&&null!=e&&t.length!==e.length)return!1;if(null!=t&&null!=e)for(let n=0,i=t.length;n<i;n+=1)if(!r(t[n],e[n]))return!1;return!0},e.random=function(n,r,i,s){return new e(t.GeometryUtil.random(n,r),t.GeometryUtil.random(i,s))},e.rotate=function(e,n,r){const s=t.Angle.toRad(t.Angle.normalize(-n)),o=Math.sin(s);return i(e,Math.cos(s),o,r)},e.rotateEx=i}(jf||(jf={}));class _f extends Nf{get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get origin(){return new jf(this.x,this.y)}get topLeft(){return new jf(this.x,this.y)}get topCenter(){return new jf(this.x+this.width/2,this.y)}get topRight(){return new jf(this.x+this.width,this.y)}get center(){return new jf(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new jf(this.x,this.y+this.height)}get bottomCenter(){return new jf(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new jf(this.x+this.width,this.y+this.height)}get corner(){return new jf(this.x+this.width,this.y+this.height)}get rightMiddle(){return new jf(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new jf(this.x,this.y+this.height/2)}get topLine(){return new Lf(this.topLeft,this.topRight)}get rightLine(){return new Lf(this.topRight,this.bottomRight)}get bottomLine(){return new Lf(this.bottomLeft,this.bottomRight)}get leftLine(){return new Lf(this.topLeft,this.bottomLeft)}constructor(t,e,n,r){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.width=null==n?0:n,this.height=null==r?0:r}getOrigin(){return this.origin}getTopLeft(){return this.topLeft}getTopCenter(){return this.topCenter}getTopRight(){return this.topRight}getCenter(){return this.center}getCenterX(){return this.x+this.width/2}getCenterY(){return this.y+this.height/2}getBottomLeft(){return this.bottomLeft}getBottomCenter(){return this.bottomCenter}getBottomRight(){return this.bottomRight}getCorner(){return this.corner}getRightMiddle(){return this.rightMiddle}getLeftMiddle(){return this.leftMiddle}getTopLine(){return this.topLine}getRightLine(){return this.rightLine}getBottomLine(){return this.bottomLine}getLeftLine(){return this.leftLine}bbox(e){if(!e)return this.clone();const n=t.Angle.toRad(e),r=Math.abs(Math.sin(n)),i=Math.abs(Math.cos(n)),s=this.width*i+this.height*r,o=this.width*r+this.height*i;return new _f(this.x+(this.width-s)/2,this.y+(this.height-o)/2,s,o)}round(e=0){return this.x=t.GeometryUtil.round(this.x,e),this.y=t.GeometryUtil.round(this.y,e),this.width=t.GeometryUtil.round(this.width,e),this.height=t.GeometryUtil.round(this.height,e),this}add(t,e,n,r){const i=_f.create(t,e,n,r),s=Math.min(this.x,i.x),o=Math.min(this.y,i.y),a=Math.max(this.x+this.width,i.x+i.width),l=Math.max(this.y+this.height,i.y+i.height);return this.x=s,this.y=o,this.width=a-s,this.height=l-o,this}update(t,e,n,r){const i=_f.create(t,e,n,r);return this.x=i.x,this.y=i.y,this.width=i.width,this.height=i.height,this}inflate(t,e){const n=t,r=null!=e?e:t;return this.x-=n,this.y-=r,this.width+=2*n,this.height+=2*r,this}snapToGrid(t,e){const n=this.origin.snapToGrid(t,e),r=this.corner.snapToGrid(t,e);return this.x=n.x,this.y=n.y,this.width=r.x-n.x,this.height=r.y-n.y,this}translate(t,e){const n=jf.create(t,e);return this.x+=n.x,this.y+=n.y,this}scale(t,e,n=new jf){const r=this.origin.scale(t,e,n);return this.x=r.x,this.y=r.y,this.width*=t,this.height*=e,this}rotate(e,n=this.getCenter()){if(0!==e){const r=t.Angle.toRad(e),i=Math.cos(r),s=Math.sin(r);let o=this.getOrigin(),a=this.getTopRight(),l=this.getBottomRight(),c=this.getBottomLeft();o=jf.rotateEx(o,i,s,n),a=jf.rotateEx(a,i,s,n),l=jf.rotateEx(l,i,s,n),c=jf.rotateEx(c,i,s,n);const h=new _f(o.x,o.y,0,0);h.add(a.x,a.y,0,0),h.add(l.x,l.y,0,0),h.add(c.x,c.y,0,0),this.update(h)}return this}rotate90(){const t=(this.width-this.height)/2;this.x+=t,this.y-=t;const e=this.width;return this.width=this.height,this.height=e,this}moveAndExpand(t){const e=_f.clone(t);return this.x+=e.x||0,this.y+=e.y||0,this.width+=e.width||0,this.height+=e.height||0,this}getMaxScaleToFit(t,e=this.center){const n=_f.clone(t),r=e.x,i=e.y;let s=1/0,o=1/0,a=1/0,l=1/0,c=1/0,h=1/0,u=1/0,g=1/0;const d=n.topLeft;d.x<r&&(s=(this.x-r)/(d.x-r)),d.y<i&&(c=(this.y-i)/(d.y-i));const f=n.bottomRight;f.x>r&&(o=(this.x+this.width-r)/(f.x-r)),f.y>i&&(h=(this.y+this.height-i)/(f.y-i));const p=n.topRight;p.x>r&&(a=(this.x+this.width-r)/(p.x-r)),p.y<i&&(u=(this.y-i)/(p.y-i));const m=n.bottomLeft;return m.x<r&&(l=(this.x-r)/(m.x-r)),m.y>i&&(g=(this.y+this.height-i)/(m.y-i)),{sx:Math.min(s,o,a,l),sy:Math.min(c,h,u,g)}}getMaxUniformScaleToFit(t,e=this.center){const n=this.getMaxScaleToFit(t,e);return Math.min(n.sx,n.sy)}containsPoint(e,n){return t.GeometryUtil.containsPoint(this,jf.create(e,n))}containsRect(t,e,n,r){const i=_f.create(t,e,n,r),s=this.x,o=this.y,a=this.width,l=this.height,c=i.x,h=i.y,u=i.width,g=i.height;return 0!==a&&0!==l&&0!==u&&0!==g&&(c>=s&&h>=o&&c+u<=s+a&&h+g<=o+l)}intersectsWithLine(t){const e=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],r=[];return e.forEach((e=>{const i=t.intersectsWithLine(e);null!==i&&r.indexOf(i.toString())<0&&(n.push(i),r.push(i.toString()))})),n.length>0?n:null}intersectsWithLineFromCenterToPoint(t,e){const n=jf.clone(t),r=this.center;let i=null;null!=e&&0!==e&&n.rotate(e,r);const s=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],o=new Lf(r,n);for(let t=s.length-1;t>=0;t-=1){const e=s[t].intersectsWithLine(o);if(null!==e){i=e;break}}return i&&null!=e&&0!==e&&i.rotate(-e,r),i}intersectsWithRect(t,e,n,r){const i=_f.create(t,e,n,r);if(!this.isIntersectWithRect(i))return null;const s=this.origin,o=this.corner,a=i.origin,l=i.corner,c=Math.max(s.x,a.x),h=Math.max(s.y,a.y);return new _f(c,h,Math.min(o.x,l.x)-c,Math.min(o.y,l.y)-h)}isIntersectWithRect(t,e,n,r){const i=_f.create(t,e,n,r),s=this.origin,o=this.corner,a=i.origin,l=i.corner;return!(l.x<=s.x||l.y<=s.y||a.x>=o.x||a.y>=o.y)}normalize(){let t=this.x,e=this.y,n=this.width,r=this.height;return this.width<0&&(t=this.x+this.width,n=-this.width),this.height<0&&(e=this.y+this.height,r=-this.height),this.x=t,this.y=e,this.width=n,this.height=r,this}union(t){const e=_f.clone(t),n=this.origin,r=this.corner,i=e.origin,s=e.corner,o=Math.min(n.x,i.x),a=Math.min(n.y,i.y),l=Math.max(r.x,s.x),c=Math.max(r.y,s.y);return new _f(o,a,l-o,c-a)}getNearestSideToPoint(t){const e=jf.clone(t),n=e.x-this.x,r=this.x+this.width-e.x,i=e.y-this.y;let s=n,o="left";return r<s&&(s=r,o="right"),i<s&&(s=i,o="top"),this.y+this.height-e.y<s&&(o="bottom"),o}getNearestPointToPoint(t){const e=jf.clone(t);if(this.containsPoint(e)){const t=this.getNearestSideToPoint(e);if("left"===t)return new jf(this.x,e.y);if("top"===t)return new jf(e.x,this.y);if("right"===t)return new jf(this.x+this.width,e.y);if("bottom"===t)return new jf(e.x,this.y+this.height)}return e.adhereToRect(this)}equals(t){return null!=t&&t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height}clone(){return new _f(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}}!function(t){t.isRectangle=function(e){return null!=e&&e instanceof t}}(_f||(_f={})),function(t){t.isRectangleLike=function(t){return null!=t&&"object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.width&&"number"==typeof t.height}}(_f||(_f={})),function(t){function e(e){return t.isRectangle(e)?e.clone():Array.isArray(e)?new t(e[0],e[1],e[2],e[3]):new t(e.x,e.y,e.width,e.height)}t.create=function(n,r,i,s){return null==n||"number"==typeof n?new t(n,r,i,s):e(n)},t.clone=e,t.fromEllipse=function(e){return new t(e.x-e.a,e.y-e.b,2*e.a,2*e.b)},t.fromSize=function(e){return new t(0,0,e.width,e.height)},t.fromPositionAndSize=function(e,n){return new t(e.x,e.y,n.width,n.height)}}(_f||(_f={}));class Lf extends Nf{get center(){return new jf((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(t,e,n,r){super(),"number"==typeof t&&"number"==typeof e?(this.start=new jf(t,e),this.end=new jf(n,r)):(this.start=jf.create(t),this.end=jf.create(e))}getCenter(){return this.center}round(t=0){return this.start.round(t),this.end.round(t),this}translate(t,e){return"number"==typeof t?(this.start.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.end.translate(t)),this}rotate(t,e){return this.start.rotate(t,e),this.end.rotate(t,e),this}scale(t,e,n){return this.start.scale(t,e,n),this.end.scale(t,e,n),this}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const t=this.start.x-this.end.x,e=this.start.y-this.end.y;return t*t+e*e}setLength(t){const e=this.length();if(!e)return this;const n=t/e;return this.scale(n,n,this.start)}parallel(t){const e=this.clone();if(!e.isDifferentiable())return e;const{start:n,end:r}=e,i=n.clone().rotate(270,r),s=r.clone().rotate(90,n);return n.move(s,t),r.move(i,t),e}vector(){return new jf(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const t=new jf(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,t)}bbox(){const t=Math.min(this.start.x,this.end.x),e=Math.min(this.start.y,this.end.y),n=Math.max(this.start.x,this.end.x),r=Math.max(this.start.y,this.end.y);return new _f(t,e,n-t,r-e)}bearing(){return this.start.bearing(this.end)}closestPoint(t){return this.pointAt(this.closestPointNormalizedLength(t))}closestPointLength(t){return this.closestPointNormalizedLength(t)*this.length()}closestPointTangent(t){return this.tangentAt(this.closestPointNormalizedLength(t))}closestPointNormalizedLength(t){const e=this.vector().dot(new Lf(this.start,t).vector()),n=Math.min(1,Math.max(0,e/this.squaredLength()));return Number.isNaN(n)?0:n}pointAt(t){const e=this.start,n=this.end;return t<=0?e.clone():t>=1?n.clone():e.lerp(n,t)}pointAtLength(t){const e=this.start,n=this.end;let r=!0;t<0&&(r=!1,t=-t);const i=this.length();if(t>=i)return r?n.clone():e.clone();const s=(r?t:i-t)/i;return this.pointAt(s)}divideAt(t){const e=this.pointAt(t);return[new Lf(this.start,e),new Lf(e,this.end)]}divideAtLength(t){const e=this.pointAtLength(t);return[new Lf(this.start,e),new Lf(e,this.end)]}containsPoint(t){const e=this.start,n=this.end;if(0!==e.cross(t,n))return!1;const r=this.length();return!(new Lf(e,t).length()>r)&&!(new Lf(t,n).length()>r)}intersect(t,e){const n=t.intersectsWithLine(this,e);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(t){const e=new jf(this.end.x-this.start.x,this.end.y-this.start.y),n=new jf(t.end.x-t.start.x,t.end.y-t.start.y),r=e.x*n.y-e.y*n.x,i=new jf(t.start.x-this.start.x,t.start.y-this.start.y),s=i.x*n.y-i.y*n.x,o=i.x*e.y-i.y*e.x;if(0===r||s*r<0||o*r<0)return null;if(r>0){if(s>r||o>r)return null}else if(s<r||o<r)return null;return new jf(this.start.x+s*e.x/r,this.start.y+s*e.y/r)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(t){const e=jf.clone(t),n=this.start,r=this.end;return((r.x-n.x)*(e.y-n.y)-(r.y-n.y)*(e.x-n.x))/this.length()}pointSquaredDistance(t,e){const n=jf.create(t,e);return this.closestPoint(n).squaredDistance(n)}pointDistance(t,e){const n=jf.create(t,e);return this.closestPoint(n).distance(n)}tangentAt(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,r=this.pointAt(t),i=new Lf(e,n);return i.translate(r.x-e.x,r.y-e.y),i}tangentAtLength(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,r=this.pointAtLength(t),i=new Lf(e,n);return i.translate(r.x-e.x,r.y-e.y),i}relativeCcw(t,e){const n=jf.create(t,e);let r=n.x-this.start.x,i=n.y-this.start.y;const s=this.end.x-this.start.x,o=this.end.y-this.start.y;let a=r*o-i*s;return 0===a&&(a=r*s+i*o,a>0&&(r-=s,i-=o,a=r*s+i*o,a<0&&(a=0))),a<0?-1:a>0?1:0}equals(t){return null!=t&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.end.x===t.end.x&&this.end.y===t.end.y}clone(){return new Lf(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}!function(t){t.isLine=function(e){return null!=e&&e instanceof t}}(Lf||(Lf={}));let Bf=class t extends Nf{get center(){return new jf(this.x,this.y)}constructor(t,e,n,r){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.a=null==n?0:n,this.b=null==r?0:r}bbox(){return _f.fromEllipse(this)}getCenter(){return this.center}inflate(t,e){const n=t,r=null!=e?e:t;return this.a+=2*n,this.b+=2*r,this}normalizedDistance(t,e){const n=jf.create(t,e),r=n.x-this.x,i=n.y-this.y,s=this.a,o=this.b;return r*r/(s*s)+i*i/(o*o)}containsPoint(t,e){return this.normalizedDistance(t,e)<=1}intersectsWithLine(t){const e=[],n=this.a,r=this.b,i=t.start,s=t.end,o=t.vector(),a=i.diff(new jf(this.x,this.y)),l=new jf(o.x/(n*n),o.y/(r*r)),c=new jf(a.x/(n*n),a.y/(r*r)),h=o.dot(l),u=o.dot(c),g=u*u-h*(a.dot(c)-1);if(g<0)return null;if(g>0){const t=Math.sqrt(g),n=(-u-t)/h,r=(-u+t)/h;if((n<0||n>1)&&(r<0||r>1))return null;n>=0&&n<=1&&e.push(i.lerp(s,n)),r>=0&&r<=1&&e.push(i.lerp(s,r))}else{const t=-u/h;if(!(t>=0&&t<=1))return null;e.push(i.lerp(s,t))}return e}intersectsWithLineFromCenterToPoint(t,e=0){const n=jf.clone(t);e&&n.rotate(e,this.getCenter());const r=n.x-this.x,i=n.y-this.y;let s;if(0===r)return s=this.bbox().getNearestPointToPoint(n),e?s.rotate(-e,this.getCenter()):s;const o=i/r,a=o*o,l=this.a*this.a,c=this.b*this.b;let h=Math.sqrt(1/(1/l+a/c));h=r<0?-h:h;const u=o*h;return s=new jf(this.x+h,this.y+u),e?s.rotate(-e,this.getCenter()):s}tangentTheta(t){const e=jf.clone(t),n=e.x,r=e.y,i=this.a,s=this.b,o=this.bbox().center,a=o.x,l=o.y,c=n>o.x+i/2,h=n<o.x-i/2;let u,g;return c||h?(g=n>o.x?r-30:r+30,u=i*i/(n-a)-i*i*(r-l)*(g-l)/(s*s*(n-a))+a):(u=r>o.y?n+30:n-30,g=s*s/(r-l)-s*s*(n-a)*(u-a)/(i*i*(r-l))+l),new jf(u,g).theta(e)}scale(t,e){return this.a*=t,this.b*=e,this}rotate(e,n){const r=_f.fromEllipse(this);r.rotate(e,n);const i=t.fromRect(r);return this.a=i.a,this.b=i.b,this.x=i.x,this.y=i.y,this}translate(t,e){const n=jf.create(t,e);return this.x+=n.x,this.y+=n.y,this}equals(t){return null!=t&&t.x===this.x&&t.y===this.y&&t.a===this.a&&t.b===this.b}clone(){return new t(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}};!function(t){t.isEllipse=function(e){return null!=e&&e instanceof t}}(Bf||(Bf={})),function(t){function e(e){return t.isEllipse(e)?e.clone():Array.isArray(e)?new t(e[0],e[1],e[2],e[3]):new t(e.x,e.y,e.a,e.b)}t.create=function(n,r,i,s){return null==n||"number"==typeof n?new t(n,r,i,s):e(n)},t.parse=e,t.fromRect=function(e){const n=e.center;return new t(n.x,n.y,e.width/2,e.height/2)}}(Bf||(Bf={}));const If=new RegExp("^[\\s\\dLMCZz,.]*$");function Df(t){return"string"==typeof t&&If.test(t)}function Rf(t,e){return(t%e+e)%e}function Vf(t,e={}){const n=[];return t&&t.length&&t.forEach((t=>{Array.isArray(t)?n.push({x:t[0],y:t[1]}):n.push({x:t.x,y:t.y})})),function(t,e,n,r,i){const s=[],o=t[t.length-1],a=null!=e&&e>0,l=e||0;if(r&&a){const e=(t=t.slice())[0],n=new jf(o.x+(e.x-o.x)/2,o.y+(e.y-o.y)/2);t.splice(0,0,n)}let c=t[0],h=1;for(n?s.push("M",c.x,c.y):s.push("L",c.x,c.y);h<(r?t.length:t.length-1);){let e=t[Rf(h,t.length)],n=c.x-e.x,r=c.y-e.y;if(a&&(0!==n||0!==r)&&(null==i||i.indexOf(h-1)<0)){let i=Math.sqrt(n*n+r*r);const o=n*Math.min(l,i/2)/i,a=r*Math.min(l,i/2)/i,c=e.x+o,u=e.y+a;s.push("L",c,u);let g=t[Rf(h+1,t.length)];for(;h<t.length-2&&0===Math.round(g.x-e.x)&&0===Math.round(g.y-e.y);)g=t[Rf(h+2,t.length)],h+=1;n=g.x-e.x,r=g.y-e.y,i=Math.max(1,Math.sqrt(n*n+r*r));const d=n*Math.min(l,i/2)/i,f=r*Math.min(l,i/2)/i,p=e.x+d,m=e.y+f;s.push("Q",e.x,e.y,p,m),e=new jf(p,m)}else s.push("L",e.x,e.y);c=e,h+=1}return r?s.push("Z"):s.push("L",o.x,o.y),s.map((t=>"string"==typeof t?t:+t.toFixed(3))).join(" ")}(n,e.round,null==e.initialMove||e.initialMove,e.close,e.exclude)}function zf(t,e,n,r,i=0,s=0,o=0,a,l){if(0===n||0===r)return[];a-=t,l-=e,n=Math.abs(n),r=Math.abs(r);const c=-a/2,h=-l/2,u=Math.cos(i*Math.PI/180),g=Math.sin(i*Math.PI/180),d=u*c+g*h,f=-1*g*c+u*h,p=d*d,m=f*f,y=n*n,v=r*r,b=p/y+m/v;let x;if(b>1)n=Math.sqrt(b)*n,r=Math.sqrt(b)*r,x=0;else{let t=1;s===o&&(t=-1),x=t*Math.sqrt((y*v-y*m-v*p)/(y*m+v*p))}const w=x*n*f/r,A=-1*x*r*d/n,C=u*w-g*A+a/2,P=g*w+u*A+l/2;let M=Math.atan2((f-A)/r,(d-w)/n)-Math.atan2(0,1),E=M>=0?M:2*Math.PI+M;M=Math.atan2((-f-A)/r,(-d-w)/n)-Math.atan2((f-A)/r,(d-w)/n);let S=M>=0?M:2*Math.PI+M;0===o&&S>0?S-=2*Math.PI:0!==o&&S<0&&(S+=2*Math.PI);const O=2*S/Math.PI,T=Math.ceil(O<0?-1*O:O),k=S/T,N=8/3*Math.sin(k/4)*Math.sin(k/4)/Math.sin(k/2),j=u*n,_=u*r,L=g*n,B=g*r;let I=Math.cos(E),D=Math.sin(E),R=-N*(j*D+B*I),V=-N*(L*D-_*I),z=0,$=0;const F=[];for(let n=0;n<T;n+=1){E+=k,I=Math.cos(E),D=Math.sin(E),z=j*I-B*D+C,$=L*I+_*D+P;const r=-N*(j*D+B*I),i=-N*(L*D-_*I),s=6*n;F[s]=Number(R+t),F[s+1]=Number(V+e),F[s+2]=Number(z-r+t),F[s+3]=Number($-i+e),F[s+4]=Number(z+t),F[s+5]=Number($+e),R=z+r,V=$+i}return F.map((t=>+t.toFixed(2)))}function $f(t,e,n,r,i=0,s=0,o=0,a,l){const c=[],h=zf(t,e,n,r,i,s,o,a,l);if(null!=h)for(let t=0,e=h.length;t<e;t+=6)c.push("C",h[t],h[t+1],h[t+2],h[t+3],h[t+4],h[t+5]);return c.join(" ")}let Ff=class t extends Nf{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(e){if(super(),null!=e){if("string"==typeof e)return t.parse(e);this.points=e.map((t=>jf.create(t)))}else this.points=[]}scale(t,e,n=new jf){return this.points.forEach((r=>r.scale(t,e,n))),this}rotate(t,e){return this.points.forEach((n=>n.rotate(t,e))),this}translate(t,e){const n=jf.create(t,e);return this.points.forEach((t=>t.translate(n.x,n.y))),this}round(t=0){return this.points.forEach((e=>e.round(t))),this}bbox(){if(0===this.points.length)return new _f;let t=1/0,e=-1/0,n=1/0,r=-1/0;const i=this.points;for(let s=0,o=i.length;s<o;s+=1){const o=i[s],a=o.x,l=o.y;a<t&&(t=a),a>e&&(e=a),l<n&&(n=l),l>r&&(r=l)}return new _f(t,n,e-t,r-n)}closestPoint(t){const e=this.closestPointLength(t);return this.pointAtLength(e)}closestPointLength(t){const e=this.points,n=e.length;if(0===n||1===n)return 0;let r=0,i=0,s=1/0;for(let o=0,a=n-1;o<a;o+=1){const n=new Lf(e[o],e[o+1]),a=n.length(),l=n.closestPointNormalizedLength(t),c=n.pointAt(l).squaredDistance(t);c<s&&(s=c,i=r+l*a),r+=a}return i}closestPointNormalizedLength(t){const e=this.length();if(0===e)return 0;return this.closestPointLength(t)/e}closestPointTangent(t){const e=this.closestPointLength(t);return this.tangentAtLength(e)}containsPoint(t){if(0===this.points.length)return!1;const e=jf.clone(t),n=e.x,r=e.y,i=this.points,s=i.length;let o=s-1,a=0;for(let l=0;l<s;l+=1){const s=i[o],c=i[l];if(e.equals(s))return!0;const h=new Lf(s,c);if(h.containsPoint(t))return!0;if(r<=s.y&&r>c.y||r>s.y&&r<=c.y){const e=s.x-n>c.x-n?s.x-n:c.x-n;if(e>=0){const i=new jf(n+e,r),s=new Lf(t,i);h.intersectsWithLine(s)&&(a+=1)}}o=l}return a%2==1}intersectsWithLine(t){const e=[];for(let n=0,r=this.points.length-1;n<r;n+=1){const r=this.points[n],i=this.points[n+1],s=t.intersectsWithLine(new Lf(r,i));s&&e.push(s)}return e.length>0?e:null}isDifferentiable(){for(let t=0,e=this.points.length-1;t<e;t+=1){const e=this.points[t],n=this.points[t+1];if(new Lf(e,n).isDifferentiable())return!0}return!1}length(){let t=0;for(let e=0,n=this.points.length-1;e<n;e+=1){const n=this.points[e],r=this.points[e+1];t+=n.distance(r)}return t}pointAt(t){const e=this.points,n=e.length;if(0===n)return null;if(1===n)return e[0].clone();if(t<=0)return e[0].clone();if(t>=1)return e[n-1].clone();const r=this.length()*t;return this.pointAtLength(r)}pointAtLength(t){const e=this.points,n=e.length;if(0===n)return null;if(1===n)return e[0].clone();let r=!0;t<0&&(r=!1,t=-t);let i=0;for(let s=0,o=n-1;s<o;s+=1){const n=r?s:o-1-s,a=e[n],l=e[n+1],c=new Lf(a,l),h=a.distance(l);if(t<=i+h)return c.pointAtLength((r?1:-1)*(t-i));i+=h}return(r?e[n-1]:e[0]).clone()}tangentAt(t){const e=this.points.length;if(0===e||1===e)return null;t<0&&(t=0),t>1&&(t=1);const n=this.length()*t;return this.tangentAtLength(n)}tangentAtLength(t){const e=this.points,n=e.length;if(0===n||1===n)return null;let r,i=!0;t<0&&(i=!1,t=-t);let s=0;for(let o=0,a=n-1;o<a;o+=1){const n=i?o:a-1-o,l=e[n],c=e[n+1],h=new Lf(l,c),u=l.distance(c);if(h.isDifferentiable()){if(t<=s+u)return h.tangentAtLength((i?1:-1)*(t-s));r=h}s+=u}if(r){const t=i?1:0;return r.tangentAt(t)}return null}simplify(t={}){const e=this.points;if(e.length<3)return this;const n=t.threshold||0;let r=0;for(;e[r+2];){const t=r+1,i=r+2,s=e[r],o=e[t],a=e[i];new Lf(s,a).closestPoint(o).distance(o)<=n?e.splice(t,1):r+=1}return this}toHull(){const e=this.points,n=e.length;if(0===n)return new t;let r=e[0];for(let t=1;t<n;t+=1)(e[t].y<r.y||e[t].y===r.y&&e[t].x>r.x)&&(r=e[t]);const i=[];for(let t=0;t<n;t+=1){let n=r.theta(e[t]);0===n&&(n=360),i.push([e[t],t,n])}if(i.sort(((t,e)=>{let n=t[2]-e[2];return 0===n&&(n=e[1]-t[1]),n})),i.length>2){const t=i[i.length-1];i.unshift(t)}const s={},o=[],a=t=>`${t[0].toString()}@${t[1]}`;for(;0!==i.length;){const t=i.pop(),e=t[0];if(s[a(t)])continue;let n=!1;for(;!n;)if(o.length<2)o.push(t),n=!0;else{const r=o.pop(),l=r[0],c=o.pop(),h=c[0],u=h.cross(l,e);if(u<0)o.push(c),o.push(r),o.push(t),n=!0;else if(0===u){const t=1e-10,n=l.angleBetween(h,e);Math.abs(n-180)<t||l.equals(e)||h.equals(l)?(s[a(r)]=l,o.push(c)):Math.abs((n+1)%360-1)<t&&(o.push(c),i.push(r))}else s[a(r)]=l,o.push(c)}}let l;o.length>2&&o.pop();let c=-1;for(let t=0,e=o.length;t<e;t+=1){const e=o[t][1];(void 0===l||e<l)&&(l=e,c=t)}let h=[];if(c>0){const t=o.slice(c),e=o.slice(0,c);h=t.concat(e)}else h=o;const u=[];for(let t=0,e=h.length;t<e;t+=1)u.push(h[t][0]);return new t(u)}equals(t){return null!=t&&(t.points.length===this.points.length&&t.points.every(((t,e)=>t.equals(this.points[e]))))}clone(){return new t(this.points.map((t=>t.clone())))}toJSON(){return this.points.map((t=>t.toJSON()))}serialize(){return this.points.map((t=>`${t.serialize()}`)).join(" ")}};!function(t){t.isPolyline=function(e){return null!=e&&e instanceof t}}(Ff||(Ff={})),function(t){t.parse=function(e){const n=e.trim();if(""===n)return new t;const r=[],i=n.split(/\s*,\s*|\s+/);for(let t=0,e=i.length;t<e;t+=2)r.push({x:+i[t],y:+i[t+1]});return new t(r)}}(Ff||(Ff={}));class Gf extends Nf{constructor(t,e,n,r){super(),this.PRECISION=3,this.start=jf.create(t),this.controlPoint1=jf.create(e),this.controlPoint2=jf.create(n),this.end=jf.create(r)}bbox(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,r=this.end,i=t.x,s=t.y,o=e.x,a=e.y,l=n.x,c=n.y,h=r.x,u=r.y,g=[],d=[[],[]];let f,p,m,y,v,b,x,w,A,C,P;for(let t=0;t<2;t+=1)if(0===t?(p=6*i-12*o+6*l,f=-3*i+9*o-9*l+3*h,m=3*o-3*i):(p=6*s-12*a+6*c,f=-3*s+9*a-9*c+3*u,m=3*a-3*s),Math.abs(f)<1e-12){if(Math.abs(p)<1e-12)continue;y=-m/p,y>0&&y<1&&g.push(y)}else x=p*p-4*m*f,w=Math.sqrt(x),x<0||(v=(-p+w)/(2*f),v>0&&v<1&&g.push(v),b=(-p-w)/(2*f),b>0&&b<1&&g.push(b));let M=g.length;const E=M;for(;M;)M-=1,y=g[M],P=1-y,A=P*P*P*i+3*P*P*y*o+3*P*y*y*l+y*y*y*h,d[0][M]=A,C=P*P*P*s+3*P*P*y*a+3*P*y*y*c+y*y*y*u,d[1][M]=C;g[E]=0,g[E+1]=1,d[0][E]=i,d[1][E]=s,d[0][E+1]=h,d[1][E+1]=u,g.length=E+2,d[0].length=E+2,d[1].length=E+2;const S=Math.min.apply(null,d[0]),O=Math.min.apply(null,d[1]),T=Math.max.apply(null,d[0]),k=Math.max.apply(null,d[1]);return new _f(S,O,T-S,k-O)}closestPoint(t,e={}){return this.pointAtT(this.closestPointT(t,e))}closestPointLength(t,e={}){const n=this.getOptions(e);return this.lengthAtT(this.closestPointT(t,n),n)}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),r=this.closestPointLength(t,n);if(!r)return 0;const i=this.length(n);return 0===i?0:r/i}closestPointT(t,e={}){const n=this.getPrecision(e),r=this.getDivisions(e),i=Math.pow(10,-n);let s=null,o=0,a=0,l=0,c=0,h=0,u=null;const g=r.length;let d=g>0?1/g:0;for(r.forEach(((e,n)=>{const r=e.start.distance(t),i=e.end.distance(t),g=r+i;(null==u||g<u)&&(s=e,o=n*d,a=(n+1)*d,l=r,c=i,u=g,h=e.endpointDistance())}));;){const e=l?Math.abs(l-c)/l:0,n=null!=c?Math.abs(l-c)/c:0;if(e<i||n<i||(!l||l<h*i||(!c||c<h*i)))return l<=c?o:a;const r=s.divide(.5);d/=2;const u=r[0].start.distance(t),g=r[0].end.distance(t),f=u+g,p=r[1].start.distance(t),m=r[1].end.distance(t);f<=p+m?(s=r[0],a-=d,l=u,c=g):(s=r[1],o+=d,l=p,c=m)}}closestPointTangent(t,e={}){return this.tangentAtT(this.closestPointT(t,e))}containsPoint(t,e={}){return this.toPolyline(e).containsPoint(t)}divideAt(t,e={}){if(t<=0)return this.divideAtT(0);if(t>=1)return this.divideAtT(1);const n=this.tAt(t,e);return this.divideAtT(n)}divideAtLength(t,e={}){const n=this.tAtLength(t,e);return this.divideAtT(n)}divide(t){return this.divideAtT(t)}divideAtT(t){const e=this.start,n=this.controlPoint1,r=this.controlPoint2,i=this.end;if(t<=0)return[new Gf(e,e,e,e),new Gf(e,n,r,i)];if(t>=1)return[new Gf(e,n,r,i),new Gf(i,i,i,i)];const s=this.getSkeletonPoints(t),o=s.startControlPoint1,a=s.startControlPoint2,l=s.divider,c=s.dividerControlPoint1,h=s.dividerControlPoint2;return[new Gf(e,o,a,l),new Gf(l,c,h,i)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(t){const e=this.start,n=this.controlPoint1,r=this.controlPoint2,i=this.end;if(t<=0)return{startControlPoint1:e.clone(),startControlPoint2:e.clone(),divider:e.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:r.clone()};if(t>=1)return{startControlPoint1:n.clone(),startControlPoint2:r.clone(),divider:i.clone(),dividerControlPoint1:i.clone(),dividerControlPoint2:i.clone()};const s=new Lf(e,n).pointAt(t),o=new Lf(n,r).pointAt(t),a=new Lf(r,i).pointAt(t),l=new Lf(s,o).pointAt(t),c=new Lf(o,a).pointAt(t);return{startControlPoint1:s,startControlPoint2:l,divider:new Lf(l,c).pointAt(t),dividerControlPoint1:c,dividerControlPoint2:a}}getSubdivisions(t={}){const e=this.getPrecision(t);let n=[new Gf(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===e)return n;let r=this.endpointDistance();const i=Math.pow(10,-e);let s=0;for(;;){s+=1;const t=[];n.forEach((e=>{const n=e.divide(.5);t.push(n[0],n[1])}));const e=t.reduce(((t,e)=>t+e.endpointDistance()),0);if(s>1&&(0!==e?(e-r)/e:0)<i)return t;n=t,r=e}}length(t={}){return this.getDivisions(t).reduce(((t,e)=>t+e.endpointDistance()),0)}lengthAtT(t,e={}){if(t<=0)return 0;const n=void 0===e.precision?this.PRECISION:e.precision;return this.divide(t)[0].length({precision:n})}pointAt(t,e={}){if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.tAt(t,e);return this.pointAtT(n)}pointAtLength(t,e={}){const n=this.tAtLength(t,e);return this.pointAtT(n)}pointAtT(t){return t<=0?this.start.clone():t>=1?this.end.clone():this.getSkeletonPoints(t).divider}isDifferentiable(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,r=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(r))}tangentAt(t,e={}){if(!this.isDifferentiable())return null;t<0?t=0:t>1&&(t=1);const n=this.tAt(t,e);return this.tangentAtT(n)}tangentAtLength(t,e={}){if(!this.isDifferentiable())return null;const n=this.tAtLength(t,e);return this.tangentAtT(n)}tangentAtT(t){if(!this.isDifferentiable())return null;t<0&&(t=0),t>1&&(t=1);const e=this.getSkeletonPoints(t),n=e.startControlPoint2,r=e.dividerControlPoint1,i=e.divider,s=new Lf(n,r);return s.translate(i.x-n.x,i.y-n.y),s}getPrecision(t={}){return null==t.precision?this.PRECISION:t.precision}getDivisions(t={}){if(null!=t.subdivisions)return t.subdivisions;const e=this.getPrecision(t);return this.getSubdivisions({precision:e})}getOptions(t={}){return{precision:this.getPrecision(t),subdivisions:this.getDivisions(t)}}tAt(t,e={}){if(t<=0)return 0;if(t>=1)return 1;const n=this.getOptions(e),r=this.length(n)*t;return this.tAtLength(r,n)}tAtLength(t,e={}){let n=!0;t<0&&(n=!1,t=-t);const r=this.getPrecision(e),i=this.getDivisions(e),s={precision:r,subdivisions:i};let o,a,l=null,c=0,h=0,u=0;const g=i.length;let d=g>0?1/g:0;for(let e=0;e<g;e+=1){const r=n?e:g-1-e,s=i[e],f=s.endpointDistance();if(t<=u+f){l=s,o=r*d,a=(r+1)*d,c=n?t-u:f+u-t,h=n?f+u-t:t-u;break}u+=f}if(null==l)return n?1:0;const f=this.length(s),p=Math.pow(10,-r);for(;;){let t,e,n;if(t=0!==f?c/f:0,t<p)return o;if(t=0!==f?h/f:0,t<p)return a;const r=l.divide(.5);d/=2;const i=r[0].endpointDistance(),s=r[1].endpointDistance();c<=i?(l=r[0],a-=d,e=c,n=i-e):(l=r[1],o+=d,e=c-i,n=s-e),c=e,h=n}}toPoints(t={}){const e=this.getDivisions(t),n=[e[0].start.clone()];return e.forEach((t=>n.push(t.end.clone()))),n}toPolyline(t={}){return new Ff(this.toPoints(t))}scale(t,e,n){return this.start.scale(t,e,n),this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.start.rotate(t,e),this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return"number"==typeof t?(this.start.translate(t,e),this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return null!=t&&this.start.equals(t.start)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)&&this.end.equals(t.end)}clone(){return new Gf(this.start,this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.controlPoint1.serialize(),this.controlPoint2.serialize(),this.end.serialize()].join(" ")}}!function(t){t.isCurve=function(e){return null!=e&&e instanceof t}}(Gf||(Gf={})),function(t){function e(t){const e=t.length,n=[],r=[];let i=2;n[0]=t[0]/i;for(let s=1;s<e;s+=1)r[s]=1/i,i=(s<e-1?4:3.5)-r[s],n[s]=(t[s]-n[s-1])/i;for(let t=1;t<e;t+=1)n[e-t-1]-=r[e-t]*n[e-t];return n}t.throughPoints=function(n){if(null==n||Array.isArray(n)&&n.length<2)throw new Error("At least 2 points are required");const r=function(t){const n=t.map((t=>jf.clone(t))),r=[],i=[],s=n.length-1;if(1===s)return r[0]=new jf((2*n[0].x+n[1].x)/3,(2*n[0].y+n[1].y)/3),i[0]=new jf(2*r[0].x-n[0].x,2*r[0].y-n[0].y),[r,i];const o=[];for(let t=1;t<s-1;t+=1)o[t]=4*n[t].x+2*n[t+1].x;o[0]=n[0].x+2*n[1].x,o[s-1]=(8*n[s-1].x+n[s].x)/2;const a=e(o);for(let t=1;t<s-1;t+=1)o[t]=4*n[t].y+2*n[t+1].y;o[0]=n[0].y+2*n[1].y,o[s-1]=(8*n[s-1].y+n[s].y)/2;const l=e(o);for(let t=0;t<s;t+=1)r.push(new jf(a[t],l[t])),t<s-1?i.push(new jf(2*n[t+1].x-a[t+1],2*n[t+1].y-l[t+1])):i.push(new jf((n[s].x+a[s-1])/2,(n[s].y+l[s-1])/2));return[r,i]}(n),i=[];for(let e=0,s=r[0].length;e<s;e+=1){const s=new jf(r[0][e].x,r[0][e].y),o=new jf(r[1][e].x,r[1][e].y);i.push(new t(n[e],s,o,n[e+1]))}return i}}(Gf||(Gf={}));class Uf extends Nf{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(null==this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)");return this.previousSegment.end}closestPointT(t,e){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(t);throw new Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.")}lengthAtT(t,e){if(t<=0)return 0;const n=this.length();return t>=1?n:n*t}divideAtT(t){if(this.divideAt)return this.divideAt(t);throw new Error("Neither `divideAtT` nor `divideAt` method is implemented.")}pointAtT(t){if(this.pointAt)return this.pointAt(t);throw new Error("Neither `pointAtT` nor `pointAt` method is implemented.")}tangentAtT(t){if(this.tangentAt)return this.tangentAt(t);throw new Error("Neither `tangentAtT` nor `tangentAt` method is implemented.")}}class qf extends Uf{constructor(t,e){super(),Lf.isLine(t)?this.endPoint=t.end.clone().round(2):this.endPoint=jf.create(t,e).round(2)}get type(){return"L"}get line(){return new Lf(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){const e=this.line.divideAt(t);return[new qf(e[0]),new qf(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[new qf(e[0]),new qf(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return null!=this.previousSegment&&!this.start.equals(this.end)}clone(){return new qf(this.end)}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return"number"==typeof t?this.end.translate(t,e):this.end.translate(t),this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){const t=this.end;return`${this.type} ${t.x} ${t.y}`}}!function(t){t.create=function(...e){const n=e.length,r=e[0];if(Lf.isLine(r))return new t(r);if(jf.isPointLike(r))return 1===n?new t(r):e.map((e=>new t(e)));if(2===n)return new t(+e[0],+e[1]);const i=[];for(let r=0;r<n;r+=2){const n=+e[r],s=+e[r+1];i.push(new t(n,s))}return i}}(qf||(qf={}));class Wf extends Uf{get end(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)");return this.subpathStartSegment.end}get type(){return"Z"}get line(){return new Lf(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){const e=this.line.divideAt(t);return[e[1].isDifferentiable()?new qf(e[0]):this.clone(),new qf(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[e[1].isDifferentiable()?new qf(e[0]):this.clone(),new qf(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return!(!this.previousSegment||!this.subpathStartSegment)&&!this.start.equals(this.end)}scale(){return this}rotate(){return this}translate(){return this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}clone(){return new Wf}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}!function(t){t.create=function(){return new t}}(Wf||(Wf={}));class Hf extends Uf{constructor(t,e){super(),this.isVisible=!1,this.isSubpathStart=!0,Lf.isLine(t)||Gf.isCurve(t)?this.endPoint=t.end.clone().round(2):this.endPoint=jf.create(t,e).round(2)}get start(){throw new Error("Illegal access. Moveto segments should not need a start property.")}get type(){return"M"}bbox(){return null}closestPoint(){return this.end.clone()}closestPointLength(){return 0}closestPointNormalizedLength(){return 0}closestPointT(){return 1}closestPointTangent(){return null}length(){return 0}lengthAtT(){return 0}divideAt(){return[this.clone(),this.clone()]}divideAtLength(){return[this.clone(),this.clone()]}getSubdivisions(){return[]}pointAt(){return this.end.clone()}pointAtLength(){return this.end.clone()}pointAtT(){return this.end.clone()}tangentAt(){return null}tangentAtLength(){return null}tangentAtT(){return null}isDifferentiable(){return!1}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return"number"==typeof t?this.end.translate(t,e):this.end.translate(t),this}clone(){return new Hf(this.end)}equals(t){return this.type===t.type&&this.end.equals(t.end)}toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){const t=this.end;return`${this.type} ${t.x} ${t.y}`}}!function(t){t.create=function(...e){const n=e.length,r=e[0];if(Lf.isLine(r))return new t(r);if(Gf.isCurve(r))return new t(r);if(jf.isPointLike(r)){if(1===n)return new t(r);const i=[];for(let r=0;r<n;r+=1)0===r?i.push(new t(e[r])):i.push(new qf(e[r]));return i}if(2===n)return new t(+e[0],+e[1]);const i=[];for(let r=0;r<n;r+=2){const n=+e[r],s=+e[r+1];0===r?i.push(new t(n,s)):i.push(new qf(n,s))}return i}}(Hf||(Hf={}));class Jf extends Uf{constructor(t,e,n,r,i,s){super(),Gf.isCurve(t)?(this.controlPoint1=t.controlPoint1.clone().round(2),this.controlPoint2=t.controlPoint2.clone().round(2),this.endPoint=t.end.clone().round(2)):"number"==typeof t?(this.controlPoint1=new jf(t,e).round(2),this.controlPoint2=new jf(n,r).round(2),this.endPoint=new jf(i,s).round(2)):(this.controlPoint1=jf.create(t).round(2),this.controlPoint2=jf.create(e).round(2),this.endPoint=jf.create(n).round(2))}get type(){return"C"}get curve(){return new Gf(this.start,this.controlPoint1,this.controlPoint2,this.end)}bbox(){return this.curve.bbox()}closestPoint(t){return this.curve.closestPoint(t)}closestPointLength(t){return this.curve.closestPointLength(t)}closestPointNormalizedLength(t){return this.curve.closestPointNormalizedLength(t)}closestPointTangent(t){return this.curve.closestPointTangent(t)}length(){return this.curve.length()}divideAt(t,e={}){const n=this.curve.divideAt(t,e);return[new Jf(n[0]),new Jf(n[1])]}divideAtLength(t,e={}){const n=this.curve.divideAtLength(t,e);return[new Jf(n[0]),new Jf(n[1])]}divideAtT(t){const e=this.curve.divideAtT(t);return[new Jf(e[0]),new Jf(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.curve.pointAt(t)}pointAtLength(t){return this.curve.pointAtLength(t)}tangentAt(t){return this.curve.tangentAt(t)}tangentAtLength(t){return this.curve.tangentAtLength(t)}isDifferentiable(){if(!this.previousSegment)return!1;const t=this.start,e=this.controlPoint1,n=this.controlPoint2,r=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(r))}scale(t,e,n){return this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return"number"==typeof t?(this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return this.start.equals(t.start)&&this.end.equals(t.end)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)}clone(){return new Jf(this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){const t=this.controlPoint1,e=this.controlPoint2,n=this.end;return[this.type,t.x,t.y,e.x,e.y,n.x,n.y].join(" ")}}function Xf(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function Yf(t,e,n,r,i,s){const o=1/3,a=2/3;return[o*t+a*n,o*e+a*r,o*i+a*n,o*s+a*r,i,s]}function Zf(t,e,n,r,i,s,o,a,l,c){const h=120*Math.PI/180,u=Math.PI/180*(+i||0);let g,d,f,p,m,y=[];if(c)d=c[0],f=c[1],p=c[2],m=c[3];else{g=Xf(t,e,-u),t=g.x,e=g.y,g=Xf(a,l,-u);const i=(t-(a=g.x))/2,c=(e-(l=g.y))/2;let h=i*i/(n*n)+c*c/(r*r);h>1&&(h=Math.sqrt(h),n*=h,r*=h);const y=n*n,v=r*r,b=(s===o?-1:1)*Math.sqrt(Math.abs((y*v-y*c*c-v*i*i)/(y*c*c+v*i*i)));p=b*n*c/r+(t+a)/2,m=b*-r*i/n+(e+l)/2,d=Math.asin((e-m)/r),f=Math.asin((l-m)/r),d=t<p?Math.PI-d:d,f=a<p?Math.PI-f:f,d<0&&(d=2*Math.PI+d),f<0&&(f=2*Math.PI+f),o&&d>f&&(d-=2*Math.PI),!o&&f>d&&(f-=2*Math.PI)}let v=f-d;if(Math.abs(v)>h){const t=f,e=a,s=l;f=d+h*(o&&f>d?1:-1),y=Zf(a=p+n*Math.cos(f),l=m+r*Math.sin(f),n,r,i,0,o,e,s,[f,t,p,m])}v=f-d;const b=Math.cos(d),x=Math.sin(d),w=Math.cos(f),A=Math.sin(f),C=Math.tan(v/4),P=4/3*(n*C),M=4/3*(r*C),E=[t,e],S=[t+P*x,e-M*b],O=[a+P*A,l-M*w],T=[a,l];if(S[0]=2*E[0]-S[0],S[1]=2*E[1]-S[1],c)return[S,O,T].concat(y);{y=[S,O,T].concat(y).join().split(",");const t=[],e=y.length;for(let n=0;n<e;n+=1)t[n]=n%2?Xf(+y[n-1],+y[n],u).y:Xf(+y[n],+y[n+1],u).x;return t}}function Kf(t){const e=function(t){if(!t)return null;const e="\t\n\v\f\r    \u2028\u2029",n=new RegExp(`([a-z])[${e},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${e}]*,?[${e}]*)+)`,"ig"),r=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${e}]*,?[${e}]*`,"ig"),i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},s=[];return t.replace(n,((t,e,n)=>{const o=[];let a=e.toLowerCase();n.replace(r,((t,e)=>(e&&o.push(+e),t))),"m"===a&&o.length>2&&(s.push([e,...o.splice(0,2)]),a="l",e="m"===e?"l":"L");const l=i[a];for(;o.length>=l&&(s.push([e,...o.splice(0,l)]),l););return t})),s}(t);if(!e||!e.length)return[["M",0,0]];let n=0,r=0,i=0,s=0;const o=[];for(let t=0,a=e.length;t<a;t+=1){const a=[];o.push(a);const l=e[t],c=l[0];if(c!==c.toUpperCase())switch(a[0]=c.toUpperCase(),a[0]){case"A":a[1]=l[1],a[2]=l[2],a[3]=l[3],a[4]=l[4],a[5]=l[5],a[6]=+l[6]+n,a[7]=+l[7]+r;break;case"V":a[1]=+l[1]+r;break;case"H":a[1]=+l[1]+n;break;case"M":i=+l[1]+n,s=+l[2]+r;for(let t=1,e=l.length;t<e;t+=1)a[t]=+l[t]+(t%2?n:r);break;default:for(let t=1,e=l.length;t<e;t+=1)a[t]=+l[t]+(t%2?n:r)}else for(let t=0,e=l.length;t<e;t+=1)a[t]=l[t];switch(a[0]){case"Z":n=+i,r=+s;break;case"H":n=a[1];break;case"V":r=a[1];break;case"M":i=a[a.length-2],s=a[a.length-1],n=a[a.length-2],r=a[a.length-1];break;default:n=a[a.length-2],r=a[a.length-1]}}return o}function Qf(t){const e=Kf(t),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function r(t,e,n){let r,i;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(t[0]in{T:1,Q:1}||(e.qx=null,e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":return 0===parseFloat(t[1])||0===parseFloat(t[2])?["L",t[6],t[7]]:["C"].concat(Zf.apply(0,[e.x,e.y].concat(t.slice(1))));case"S":return"C"===n||"S"===n?(r=2*e.x-e.bx,i=2*e.y-e.by):(r=e.x,i=e.y),["C",r,i].concat(t.slice(1));case"T":return"Q"===n||"T"===n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),["C"].concat(Yf(e.x,e.y,e.qx,e.qy,t[1],t[2]));case"Q":return e.qx=t[1],e.qy=t[2],["C"].concat(Yf(e.x,e.y,t[1],t[2],t[3],t[4]));case"H":return["L"].concat(t[1],e.y);case"V":return["L"].concat(e.x,t[1])}return t}function i(t,n){if(t[n].length>7){t[n].shift();const r=t[n];for(;r.length;)s[n]="A",n+=1,t.splice(n,0,["C"].concat(r.splice(0,6)));t.splice(n,1),a=e.length}}const s=[];let o="",a=e.length;for(let t=0;t<a;t+=1){let a="";e[t]&&(a=e[t][0]),"C"!==a&&(s[t]=a,t>0&&(o=s[t-1])),e[t]=r(e[t],n,o),"A"!==s[t]&&"C"===a&&(s[t]="C"),i(e,t);const l=e[t],c=l.length;n.x=l[c-2],n.y=l[c-1],n.bx=parseFloat(l[c-4])||n.x,n.by=parseFloat(l[c-3])||n.y}return e[0][0]&&"M"===e[0][0]||e.unshift(["M",0,0]),e}function tp(e){return Qf(e).map((e=>e.map((e=>"string"==typeof e?e:t.GeometryUtil.round(e,2))))).join(",").split(",").join(" ")}!function(t){t.create=function(...e){const n=e.length,r=e[0];if(Gf.isCurve(r))return new t(r);if(jf.isPointLike(r)){if(3===n)return new t(e[0],e[1],e[2]);const r=[];for(let i=0;i<n;i+=3)r.push(new t(e[i],e[i+1],e[i+2]));return r}if(6===n)return new t(e[0],e[1],e[2],e[3],e[4],e[5]);const i=[];for(let r=0;r<n;r+=6)i.push(new t(e[r],e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]));return i}}(Jf||(Jf={}));let ep=class e extends Nf{constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t))if(Lf.isLine(t[0])||Gf.isCurve(t[0])){let n=null;t.forEach(((t,r)=>{0===r&&this.appendSegment(e.createSegment("M",t.start)),null==n||n.end.equals(t.start)||this.appendSegment(e.createSegment("M",t.start)),Lf.isLine(t)?this.appendSegment(e.createSegment("L",t.end)):Gf.isCurve(t)&&this.appendSegment(e.createSegment("C",t.controlPoint1,t.controlPoint2,t.end)),n=t}))}else{t.forEach((t=>{t.isSegment&&this.appendSegment(t)}))}else null!=t&&(Lf.isLine(t)?(this.appendSegment(e.createSegment("M",t.start)),this.appendSegment(e.createSegment("L",t.end))):Gf.isCurve(t)?(this.appendSegment(e.createSegment("M",t.start)),this.appendSegment(e.createSegment("C",t.controlPoint1,t.controlPoint2,t.end))):Ff.isPolyline(t)?t.points&&t.points.length&&t.points.forEach(((t,n)=>{const r=0===n?e.createSegment("M",t):e.createSegment("L",t);this.appendSegment(r)})):t.isSegment&&this.appendSegment(t))}get start(){const t=this.segments,e=t.length;if(0===e)return null;for(let n=0;n<e;n+=1){const e=t[n];if(e.isVisible)return e.start}return t[e-1].end}get end(){const t=this.segments,e=t.length;if(0===e)return null;for(let n=e-1;n>=0;n-=1){const e=t[n];if(e.isVisible)return e.end}return t[e-1].end}moveTo(...t){return this.appendSegment(Hf.create.call(null,...t))}lineTo(...t){return this.appendSegment(qf.create.call(null,...t))}curveTo(...t){return this.appendSegment(Jf.create.call(null,...t))}arcTo(t,e,n,r,i,s,o){const a=this.end||new jf,l="number"==typeof s?zf(a.x,a.y,t,e,n,r,i,s,o):zf(a.x,a.y,t,e,n,r,i,s.x,s.y);if(null!=l)for(let t=0,e=l.length;t<e;t+=6)this.curveTo(l[t],l[t+1],l[t+2],l[t+3],l[t+4],l[t+5]);return this}quadTo(t,n,r,i){const s=this.end||new jf,o=["M",s.x,s.y];if("number"==typeof t)o.push("Q",t,n,r,i);else{const e=n;o.push("Q",t.x,t.y,e.x,e.y)}const a=e.parse(o.join(" "));return this.appendSegment(a.segments.slice(1)),this}close(){return this.appendSegment(Wf.create())}drawPoints(t,n={}){const r=Vf(t,n),i=e.parse(r);i&&i.segments&&this.appendSegment(i.segments)}bbox(){const t=this.segments,e=t.length;if(0===e)return null;let n;for(let r=0;r<e;r+=1){const e=t[r];if(e.isVisible){const t=e.bbox();null!=t&&(n=n?n.union(t):t)}}if(null!=n)return n;const r=t[e-1];return new _f(r.end.x,r.end.y,0,0)}appendSegment(t){const e=this.segments.length;let n,r=0!==e?this.segments[e-1]:null;if(Array.isArray(t))for(let e=0,i=t.length;e<i;e+=1){const i=t[e];n=this.prepareSegment(i,r,null),this.segments.push(n),r=n}else null!=t&&t.isSegment&&(n=this.prepareSegment(t,r,null),this.segments.push(n));return this}insertSegment(t,e){const n=this.segments.length;if(t<0&&(t=n+t+1),t>n||t<0)throw new Error("Index out of range.");let r,i=null,s=null;if(0!==n&&(t>=1?(i=this.segments[t-1],s=i.nextSegment):(i=null,s=this.segments[0])),Array.isArray(e))for(let n=0,o=e.length;n<o;n+=1){const o=e[n];r=this.prepareSegment(o,i,s),this.segments.splice(t+n,0,r),i=r}else r=this.prepareSegment(e,i,s),this.segments.splice(t,0,r);return this}removeSegment(t){const e=this.fixIndex(t),n=this.segments.splice(e,1)[0],r=n.previousSegment,i=n.nextSegment;return r&&(r.nextSegment=i),i&&(i.previousSegment=r),n.isSubpathStart&&i&&this.updateSubpathStartSegment(i),n}replaceSegment(t,e){const n=this.fixIndex(t);let r;const i=this.segments[n];let s=i.previousSegment;const o=i.nextSegment;let a=i.isSubpathStart;if(Array.isArray(e)){this.segments.splice(t,1);for(let n=0,i=e.length;n<i;n+=1){const i=e[n];r=this.prepareSegment(i,s,o),this.segments.splice(t+n,0,r),s=r,a&&r.isSubpathStart&&(a=!1)}}else r=this.prepareSegment(e,s,o),this.segments.splice(n,1,r),a&&r.isSubpathStart&&(a=!1);a&&o&&this.updateSubpathStartSegment(o)}getSegment(t){const e=this.fixIndex(t);return this.segments[e]}fixIndex(t){const e=this.segments.length;if(0===e)throw new Error("Path has no segments.");let n=t;for(;n<0;)n=e+n;if(n>=e||n<0)throw new Error("Index out of range.");return n}segmentAt(t,e={}){const n=this.segmentIndexAt(t,e);return n?this.getSegment(n):null}segmentAtLength(t,e={}){const n=this.segmentIndexAtLength(t,e);return n?this.getSegment(n):null}segmentIndexAt(e,n={}){if(0===this.segments.length)return null;const r=t.GeometryUtil.clamp(e,0,1),i=this.getOptions(n),s=this.length(i)*r;return this.segmentIndexAtLength(s,i)}segmentIndexAtLength(t,e={}){const n=this.segments.length;if(0===n)return null;let r=!0;t<0&&(r=!1,t=-t);const i=this.getPrecision(e),s=this.getSubdivisions(e);let o=0,a=null;for(let e=0;e<n;e+=1){const l=r?e:n-1-e,c=this.segments[l],h=s[l],u=c.length({precision:i,subdivisions:h});if(c.isVisible){if(t<=o+u)return l;a=l}o+=u}return a}getSegmentSubdivisions(t={}){const e=this.getPrecision(t),n=[];for(let t=0,r=this.segments.length;t<r;t+=1){const r=this.segments[t].getSubdivisions({precision:e});n.push(r)}return n}updateSubpathStartSegment(t){let e=t.previousSegment,n=t;for(;n&&!n.isSubpathStart;)n.subpathStartSegment=null!=e?e.subpathStartSegment:null,e=n,n=n.nextSegment}prepareSegment(t,e,n){t.previousSegment=e,t.nextSegment=n,null!=e&&(e.nextSegment=t),null!=n&&(n.previousSegment=t);let r=t;return t.isSubpathStart&&(t.subpathStartSegment=t,r=n),null!=r&&this.updateSubpathStartSegment(r),t}closestPoint(t,e={}){const n=this.closestPointT(t,e);return n?this.pointAtT(n):null}closestPointLength(t,e={}){const n=this.getOptions(e),r=this.closestPointT(t,n);return r?this.lengthAtT(r,n):0}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),r=this.closestPointLength(t,n);if(0===r)return 0;const i=this.length(n);return 0===i?0:r/i}closestPointT(e,n={}){if(0===this.segments.length)return null;const r=this.getPrecision(n),i=this.getSubdivisions(n);let s,o=1/0;for(let n=0,a=this.segments.length;n<a;n+=1){const a=this.segments[n],l=i[n];if(a.isVisible){const i=a.closestPointT(e,{precision:r,subdivisions:l}),c=a.pointAtT(i),h=t.GeometryUtil.squaredLength(c,e);h<o&&(s={segmentIndex:n,value:i},o=h)}}return s||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(e,n={}){if(0===this.segments.length)return null;const r=this.getPrecision(n),i=this.getSubdivisions(n);let s,o=1/0;for(let n=0,a=this.segments.length;n<a;n+=1){const a=this.segments[n],l=i[n];if(a.isDifferentiable()){const n=a.closestPointT(e,{precision:r,subdivisions:l}),i=a.pointAtT(n),c=t.GeometryUtil.squaredLength(i,e);c<o&&(s=a.tangentAtT(n),o=c)}}return s||null}containsPoint(t,e={}){const n=this.toPolylines(e);if(!n)return!1;let r=0;for(let e=0,i=n.length;e<i;e+=1){n[e].containsPoint(t)&&(r+=1)}return r%2==1}pointAt(t,e={}){if(0===this.segments.length)return null;if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.getOptions(e),r=this.length(n)*t;return this.pointAtLength(r,n)}pointAtLength(t,e={}){if(0===this.segments.length)return null;if(0===t)return this.start.clone();let n=!0;t<0&&(n=!1,t=-t);const r=this.getPrecision(e),i=this.getSubdivisions(e);let s,o=0;for(let e=0,a=this.segments.length;e<a;e+=1){const l=n?e:a-1-e,c=this.segments[l],h=i[l],u=c.length({precision:r,subdivisions:h});if(c.isVisible){if(t<=o+u)return c.pointAtLength((n?1:-1)*(t-o),{precision:r,subdivisions:h});s=c}o+=u}if(s)return n?s.end:s.start;return this.segments[this.segments.length-1].end.clone()}pointAtT(e){const n=this.segments,r=n.length;if(0===r)return null;const i=e.segmentIndex;if(i<0)return n[0].pointAtT(0);if(i>=r)return n[r-1].pointAtT(1);const s=t.GeometryUtil.clamp(e.value,0,1);return n[i].pointAtT(s)}divideAt(e,n={}){if(0===this.segments.length)return null;const r=t.GeometryUtil.clamp(e,0,1),i=this.getOptions(n),s=this.length(i)*r;return this.divideAtLength(s,i)}divideAtLength(t,n={}){if(0===this.segments.length)return null;let r=!0;t<0&&(r=!1,t=-t);const i=this.getPrecision(n),s=this.getSubdivisions(n);let o,a,l,c,h,u=0;for(let e=0,n=this.segments.length;e<n;e+=1){const h=r?e:n-1-e,g=this.getSegment(h),d={precision:i,subdivisions:s[h]},f=g.length(d);if(g.isDifferentiable()&&(l=g,c=h,t<=u+f)){a=h,o=g.divideAtLength((r?1:-1)*(t-u),d);break}u+=f}if(!l)return null;o||(a=c,h=r?1:0,o=l.divideAtT(h));const g=this.clone(),d=a;g.replaceSegment(d,o);const f=d;let p=d+1,m=d+2;o[0].isDifferentiable()||(g.removeSegment(f),p-=1,m-=1);const y=g.getSegment(p).start;g.insertSegment(p,e.createSegment("M",y)),m+=1,o[1].isDifferentiable()||(g.removeSegment(m-1),m-=1);const v=m-f-1;for(let t=m,n=g.segments.length;t<n;t+=1){const n=this.getSegment(t-v),r=g.getSegment(t);if("Z"===r.type&&!n.subpathStartSegment.end.equals(r.subpathStartSegment.end)){const r=e.createSegment("L",n.end);g.replaceSegment(t,r)}}return[new e(g.segments.slice(0,p)),new e(g.segments.slice(p))]}intersectsWithLine(t,e={}){const n=this.toPolylines(e);if(null==n)return null;let r=null;for(let e=0,i=n.length;e<i;e+=1){const i=n[e],s=t.intersect(i);s&&(null==r&&(r=[]),Array.isArray(s)?r.push(...s):r.push(s))}return r}isDifferentiable(){for(let t=0,e=this.segments.length;t<e;t+=1){if(this.segments[t].isDifferentiable())return!0}return!1}isValid(){const t=this.segments;return 0===t.length||"M"===t[0].type}length(t={}){if(0===this.segments.length)return 0;const e=this.getSubdivisions(t);let n=0;for(let t=0,r=this.segments.length;t<r;t+=1){const r=this.segments[t],i=e[t];n+=r.length({subdivisions:i})}return n}lengthAtT(e,n={}){const r=this.segments.length;if(0===r)return 0;let i=e.segmentIndex;if(i<0)return 0;let s=t.GeometryUtil.clamp(e.value,0,1);i>=r&&(i=r-1,s=1);const o=this.getPrecision(n),a=this.getSubdivisions(n);let l=0;for(let t=0;t<i;t+=1){const e=this.segments[t],n=a[t];l+=e.length({precision:o,subdivisions:n})}const c=this.segments[i],h=a[i];return l+=c.lengthAtT(s,{precision:o,subdivisions:h}),l}tangentAt(e,n={}){if(0===this.segments.length)return null;const r=t.GeometryUtil.clamp(e,0,1),i=this.getOptions(n),s=this.length(i)*r;return this.tangentAtLength(s,i)}tangentAtLength(t,e={}){if(0===this.segments.length)return null;let n=!0;t<0&&(n=!1,t=-t);const r=this.getPrecision(e),i=this.getSubdivisions(e);let s,o=0;for(let e=0,a=this.segments.length;e<a;e+=1){const l=n?e:a-1-e,c=this.segments[l],h=i[l],u=c.length({precision:r,subdivisions:h});if(c.isDifferentiable()){if(t<=o+u)return c.tangentAtLength((n?1:-1)*(t-o),{precision:r,subdivisions:h});s=c}o+=u}if(s){const t=n?1:0;return s.tangentAtT(t)}return null}tangentAtT(e){const n=this.segments.length;if(0===n)return null;const r=e.segmentIndex;if(r<0)return this.segments[0].tangentAtT(0);if(r>=n)return this.segments[n-1].tangentAtT(1);const i=t.GeometryUtil.clamp(e.value,0,1);return this.segments[r].tangentAtT(i)}getPrecision(t={}){return null==t.precision?this.PRECISION:t.precision}getSubdivisions(t={}){if(null==t.segmentSubdivisions){const e=this.getPrecision(t);return this.getSegmentSubdivisions({precision:e})}return t.segmentSubdivisions}getOptions(t={}){return{precision:this.getPrecision(t),segmentSubdivisions:this.getSubdivisions(t)}}toPoints(t={}){const e=this.segments,n=e.length;if(0===n)return null;const r=this.getSubdivisions(t),i=[];let s=[];for(let t=0;t<n;t+=1){const n=e[t];if(n.isVisible){const e=r[t];e.length>0?e.forEach((t=>s.push(t.start))):s.push(n.start)}else s.length>0&&(s.push(e[t-1].end),i.push(s),s=[])}return s.length>0&&(s.push(this.end),i.push(s)),i}toPolylines(t={}){const e=this.toPoints(t);return e?e.map((t=>new Ff(t))):null}scale(t,e,n){return this.segments.forEach((r=>r.scale(t,e,n))),this}rotate(t,e){return this.segments.forEach((n=>n.rotate(t,e))),this}translate(t,e){return"number"==typeof t?this.segments.forEach((n=>n.translate(t,e))):this.segments.forEach((e=>e.translate(t))),this}clone(){const t=new e;return this.segments.forEach((e=>t.appendSegment(e.clone()))),t}equals(t){if(null==t)return!1;const e=this.segments,n=t.segments,r=e.length;if(n.length!==r)return!1;for(let t=0;t<r;t+=1){const r=e[t],i=n[t];if(r.type!==i.type||!r.equals(i))return!1}return!0}toJSON(){return this.segments.map((t=>t.toJSON()))}serialize(){if(!this.isValid())throw new Error("Invalid path segments.");return this.segments.map((t=>t.serialize())).join(" ")}toString(){return this.serialize()}};!function(t){t.isPath=function(e){return null!=e&&e instanceof t}}(ep||(ep={})),function(t){function e(t,...e){if("M"===t)return Hf.create.call(null,...e);if("L"===t)return qf.create.call(null,...e);if("C"===t)return Jf.create.call(null,...e);if("z"===t||"Z"===t)return Wf.create();throw new Error(`Invalid path segment type "${t}"`)}t.parse=function(n){if(!n)return new t;const r=new t,i=t.normalize(n).match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g);if(null!=i)for(let t=0,n=i.length;t<n;t+=1){const n=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,s=i[t].match(n);if(null!=s){const t=s[0],n=s.slice(1).map((t=>+t)),i=e.call(null,t,...n);r.appendSegment(i)}}return r},t.createSegment=e}(ep||(ep={})),function(t){t.normalize=tp,t.isValid=Df,t.drawArc=$f,t.drawPoints=Vf,t.arcToCurves=zf}(ep||(ep={}));class np{constructor(t){this.options=Object.assign({},t),this.data=this.options.data||{},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this)}get names(){return Object.keys(this.data)}register(e,n,r=!1){if("object"==typeof e)return void Object.entries(e).forEach((([t,e])=>{this.register(t,e,n)}));!this.exist(e)||r||t.Platform.isApplyingHMR()||this.onDuplicated(e);const i=this.options.process,s=i?su(i,this,e,n):n;return this.data[e]=s,s}unregister(t){const e=t?this.data[t]:null;return delete this.data[t],e}get(t){return t?this.data[t]:null}exist(t){return!!t&&null!=this.data[t]}onDuplicated(t){try{throw this.options.onConflict&&su(this.options.onConflict,this,t),new Error(`${rr(this.options.type)} with name '${t}' already registered.`)}catch(t){throw t}}onNotFound(t,e){throw new Error(this.getSpellingSuggestion(t,e))}getSpellingSuggestion(t,e){const n=this.getSpellingSuggestionForName(t),r=e?`${e} ${Fa(this.options.type)}`:this.options.type;return`${rr(r)} with name '${t}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(t){return Iu(t,Object.keys(this.data),(t=>t))}}!function(t){t.create=function(e){return new t(e)}}(np||(np={}));const rp={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.thickness*e.sx,r=e.thickness*e.sy;Ug(t,{width:n,height:r,rx:n,ry:r,fill:e.color})}},ip={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.sx<=1?e.thickness*e.sx:e.thickness;Ug(t,{width:n,height:n,rx:n,ry:n,fill:e.color})}},sp={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const r=e.width,i=e.height,s=e.thickness;n=r-s>=0&&i-s>=0?["M",r,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",Ug(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}},op=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const r=e.width,i=e.height,s=e.thickness;n=r-s>=0&&i-s>=0?["M",r,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",Ug(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}},{color:"rgba(224,224,224,0.2)",thickness:3,factor:4,markup:"path",update(t,e){let n;const r=e.factor||1,i=e.width*r,s=e.height*r,o=e.thickness;n=i-o>=0&&s-o>=0?["M",i,0,"H0 M0 0 V0",s].join(" "):"M 0 0 0 0",e.width=i,e.height=s,Ug(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}}];var ap=Object.freeze({__proto__:null,dot:rp,doubleMesh:op,fixedDot:ip,mesh:sp});class lp{constructor(){this.patterns={},this.root=yd.create(Cg(),{width:"100%",height:"100%"},[Ag("defs")]).node}add(t,e){const n=this.root.childNodes[0];n&&n.appendChild(e),this.patterns[t]=e,yd.create("rect",{width:"100%",height:"100%",fill:`url(#${t})`}).appendTo(this.root)}get(t){return this.patterns[t]}has(t){return null!=this.patterns[t]}}!function(t){t.presets=ap,t.registry=np.create({type:"grid"}),t.registry.register(t.presets,!0)}(lp||(lp={}));const cp=function(t){const e=document.createElement("canvas"),n=t.width,r=t.height;e.width=2*n,e.height=r;const i=e.getContext("2d");return i.drawImage(t,0,0,n,r),i.translate(2*n,0),i.scale(-1,1),i.drawImage(t,0,0,n,r),e},hp=function(t){const e=document.createElement("canvas"),n=t.width,r=t.height;e.width=n,e.height=2*r;const i=e.getContext("2d");return i.drawImage(t,0,0,n,r),i.translate(0,2*r),i.scale(1,-1),i.drawImage(t,0,0,n,r),e},up=function(t){const e=document.createElement("canvas"),n=t.width,r=t.height;e.width=2*n,e.height=2*r;const i=e.getContext("2d");return i.drawImage(t,0,0,n,r),i.setTransform(-1,0,0,-1,e.width,e.height),i.drawImage(t,0,0,n,r),i.setTransform(-1,0,0,1,e.width,0),i.drawImage(t,0,0,n,r),i.setTransform(1,0,0,-1,0,e.height),i.drawImage(t,0,0,n,r),e};var gp,dp=Object.freeze({__proto__:null,flipX:cp,flipXY:up,flipY:hp,watermark:function(e,n){const r=e.width,i=e.height,s=document.createElement("canvas");s.width=3*r,s.height=3*i;const o=s.getContext("2d"),a=null!=n.angle?-n.angle:-20,l=t.Angle.toRad(a),c=s.width/4,h=s.height/4;for(let t=0;t<4;t+=1)for(let n=0;n<4;n+=1)(t+n)%2>0&&(o.setTransform(1,0,0,1,(2*t-1)*c,(2*n-1)*h),o.rotate(l),o.drawImage(e,-r/2,-i/2,r,i));return s}});function fp(t,e){return null!=t?t:e}function pp(t,e){return null!=t&&Number.isFinite(t)?t:e}!function(t){t.presets=Object.assign({},dp),t.presets["flip-x"]=cp,t.presets["flip-y"]=hp,t.presets["flip-xy"]=up,t.registry=np.create({type:"background pattern"}),t.registry.register(t.presets,!0)}(gp||(gp={}));var mp,yp=Object.freeze({__proto__:null,blur:function(t={}){const e=pp(t.x,2);return`\n <filter>\n <feGaussianBlur stdDeviation="${null!=t.y&&Number.isFinite(t.y)?[e,t.y]:e}"/>\n </filter>\n `.trim()},brightness:function(t={}){const e=pp(t.amount,1);return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${e}"/>\n <feFuncG type="linear" slope="${e}"/>\n <feFuncB type="linear" slope="${e}"/>\n </feComponentTransfer>\n </filter>\n `.trim()},contrast:function(t={}){const e=pp(t.amount,1),n=.5-e/2;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${e}" intercept="${n}"/>\n <feFuncG type="linear" slope="${e}" intercept="${n}"/>\n <feFuncB type="linear" slope="${e}" intercept="${n}"/>\n </feComponentTransfer>\n </filter>\n `.trim()},dropShadow:function(t={}){const e=pp(t.dx,0),n=pp(t.dy,0),r=fp(t.color,"black"),i=pp(t.blur,4),s=pp(t.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>\n <feDropShadow stdDeviation="${i}" dx="${e}" dy="${n}" flood-color="${r}" flood-opacity="${s}" />\n </filter>`.trim():`<filter>\n <feGaussianBlur in="SourceAlpha" stdDeviation="${i}" />\n <feOffset dx="${e}" dy="${n}" result="offsetblur" />\n <feFlood flood-color="${r}" />\n <feComposite in2="offsetblur" operator="in" />\n <feComponentTransfer>\n <feFuncA type="linear" slope="${s}" />\n </feComponentTransfer>\n <feMerge>\n <feMergeNode/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>`.trim()},grayScale:function(t={}){const e=pp(t.amount,1),n=.7152-.7152*(1-e);return`\n <filter>\n <feColorMatrix type="matrix" values="${.2126+.7874*(1-e)} ${n} ${.0722-.0722*(1-e)} 0 0 ${.2126-.2126*(1-e)} ${.7152+.2848*(1-e)} ${.0722-.0722*(1-e)} 0 0 ${.2126-.2126*(1-e)} ${n} ${.0722+.9278*(1-e)} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()},highlight:function(t={}){const e=fp(t.color,"red"),n=pp(t.blur,0),r=pp(t.width,1);return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${pp(t.opacity,1)}" result="colored"/>\n <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${r}"/>\n <feComposite result="composed" in="colored" in2="morphed" operator="in"/>\n <feGaussianBlur result="blured" in="composed" stdDeviation="${n}"/>\n <feBlend in="SourceGraphic" in2="blured" mode="normal"/>\n </filter>\n `.trim()},hueRotate:function(t={}){return`\n <filter>\n <feColorMatrix type="hueRotate" values="${pp(t.angle,0)}"/>\n </filter>\n `.trim()},invert:function(t={}){const e=pp(t.amount,1),n=1-e;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="table" tableValues="${e} ${n}"/>\n <feFuncG type="table" tableValues="${e} ${n}"/>\n <feFuncB type="table" tableValues="${e} ${n}"/>\n </feComponentTransfer>\n </filter>\n `.trim()},outline:function(t={}){const e=fp(t.color,"blue"),n=pp(t.width,1),r=pp(t.margin,2);return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${pp(t.opacity,1)}" result="colored"/>\n <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${r+n}" />\n <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${r}" />\n <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>\n <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>\n <feMerge>\n <feMergeNode in="outline"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n `.trim()},saturate:function(t={}){return`\n <filter>\n <feColorMatrix type="saturate" values="${1-pp(t.amount,1)}"/>\n </filter>\n `.trim()},sepia:function(t={}){const e=pp(t.amount,1);return`\n <filter>\n <feColorMatrix type="matrix" values="${.393+.607*(1-e)} ${.769-.769*(1-e)} ${.189-.189*(1-e)} 0 0 ${.349-.349*(1-e)} ${.686+.314*(1-e)} ${.168-.168*(1-e)} 0 0 ${.272-.272*(1-e)} ${.534-.534*(1-e)} ${.131+.869*(1-e)} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}});!function(t){t.presets=yp,t.registry=np.create({type:"filter"}),t.registry.register(t.presets,!0)}(mp||(mp={}));const vp={xlinkHref:"xlink:href",xlinkShow:"xlink:show",xlinkRole:"xlink:role",xlinkType:"xlink:type",xlinkArcrole:"xlink:arcrole",xlinkTitle:"xlink:title",xlinkActuate:"xlink:actuate",xmlSpace:"xml:space",xmlBase:"xml:base",xmlLang:"xml:lang",preserveAspectRatio:"preserveAspectRatio",requiredExtension:"requiredExtension",requiredFeatures:"requiredFeatures",systemLanguage:"systemLanguage",externalResourcesRequired:"externalResourceRequired"},bp={position:Fp("x","width","origin")},xp={position:Fp("y","height","origin")},wp={position:Fp("x","width","corner")},Ap={position:Fp("y","height","corner")},Cp={set:Gp("width","width")},Pp={set:Gp("height","height")},Mp={set:Gp("rx","width")},Ep={set:Gp("ry","height")},Sp={set:(()=>{const t=Gp("r","width"),e=Gp("r","height");return function(n,r){const i=r.refBBox;return su(i.height>i.width?t:e,this,n,r)}})()},Op={set(t,{refBBox:e}){let n=parseFloat(t);const r=Vu(t);r&&(n/=100);const i=Math.sqrt(e.height*e.height+e.width*e.width);let s;return Number.isFinite(n)&&(s=r||n>=0&&n<=1?n*i:Math.max(n+i,0)),{r:s}}},Tp={set:Gp("cx","width")},kp={set:Gp("cy","height")},Np={set:qp({resetOffset:!0})},jp={set:qp({resetOffset:!1})},_p={set:Wp({resetOffset:!0})},Lp={set:Wp({resetOffset:!1})},Bp=Sp,Ip=Np,Dp=_p,Rp=bp,Vp=xp,zp=Cp,$p=Pp;function Fp(t,e,n){return(r,{refBBox:i})=>{if(null==r)return null;let s=parseFloat(r);const o=Vu(r);let a;if(o&&(s/=100),Number.isFinite(s)){const r=i[n];a=o||s>0&&s<1?r[t]+i[e]*s:r[t]+s}const l=new jf;return l[t]=a||0,l}}function Gp(t,e){return function(n,{refBBox:r}){let i=parseFloat(n);const s=Vu(n);s&&(i/=100);const o={};if(Number.isFinite(i)){const n=s||i>=0&&i<=1?i*r[e]:Math.max(i+r[e],0);o[t]=n}return o}}function Up(t,e){const n="x6-shape",r=e&&e.resetOffset;return function(e,{elem:i,refBBox:s}){let o=pd(i,n);if(!o||o.value!==e){const r=t(e);o={value:e,shape:r,shapeBBox:r.bbox()},pd(i,n,o)}const a=o.shape.clone(),l=o.shapeBBox.clone(),c=l.getOrigin(),h=s.getOrigin();l.x=h.x,l.y=h.y;const u=s.getMaxScaleToFit(l,h),g=0===l.width||0===s.width?1:u.sx,d=0===l.height||0===s.height?1:u.sy;return a.scale(g,d,c),r&&a.translate(-c.x,-c.y),a}}function qp(t){const e=Up((function(t){return ep.parse(t)}),t);return(t,n)=>({d:e(t,n).serialize()})}function Wp(t){const e=Up((t=>new Ff(t)),t);return(t,n)=>({points:e(t,n).serialize()})}const Hp={qualify:jn,set:(t,{view:e})=>`url(#${e.graph.defineGradient(t)})`},Jp={qualify:jn,set(t,{view:e}){const n=e.cell,r=Object.assign({},t);if(n.isEdge()&&"linearGradient"===r.type){const t=e,i=t.sourcePoint,s=t.targetPoint;r.id=`gradient-${r.type}-${n.id}`,r.attrs=Object.assign(Object.assign({},r.attrs),{x1:i.x,y1:i.y,x2:s.x,y2:s.y,gradientUnits:"userSpaceOnUse"}),e.graph.defs.remove(r.id)}return`url(#${e.graph.defineGradient(r)})`}},Xp={qualify:(t,{attrs:e})=>null==e.textWrap||!jn(e.textWrap),set(t,{view:e,elem:n,attrs:r}){const i="x6-text",s=pd(n,i),o=t=>{try{return JSON.parse(t)}catch(e){return t}},a={x:r.x,eol:r.eol,annotations:o(r.annotations),textPath:o(r["text-path"]||r.textPath),textVerticalAnchor:r["text-vertical-anchor"]||r.textVerticalAnchor,displayEmpty:"true"===(r["display-empty"]||r.displayEmpty),lineHeight:r["line-height"]||r.lineHeight},l=r["font-size"]||r.fontSize,c=JSON.stringify([t,a]);if(l&&n.setAttribute("font-size",l),null==s||s!==c){const r=a.textPath;if(null!=r&&"object"==typeof r){const t=r.selector;if("string"==typeof t){const n=e.find(t)[0];n instanceof SVGPathElement&&(mg(n),a.textPath=Object.assign({"xlink:href":`#${n.id}`},r))}}wd(n,`${t}`,a),pd(n,i,c)}}},Yp={qualify:jn,set(t,{view:e,elem:n,attrs:r,refBBox:i}){const s=t,o=s.width||0;Vu(o)?i.width*=parseFloat(o)/100:o<=0?i.width+=o:i.width=o;const a=s.height||0;let l;Vu(a)?i.height*=parseFloat(a)/100:a<=0?i.height+=a:i.height=a;let c=s.text;null==c&&(c=r.text||(null==n?void 0:n.textContent)),l=null!=c?Pd(`${c}`,i,{"font-weight":r["font-weight"]||r.fontWeight,"font-size":r["font-size"]||r.fontSize,"font-family":r["font-family"]||r.fontFamily,lineHeight:r.lineHeight},{ellipsis:s.ellipsis}):"",su(Xp.set,this,l,{view:e,elem:n,attrs:r,refBBox:i,cell:e.cell})}},Zp=(t,{attrs:e})=>void 0!==e.text,Kp={qualify:Zp},Qp={qualify:Zp},tm={qualify:Zp},em={qualify:Zp},nm={qualify:Zp},rm={qualify:Zp},im={qualify:(t,{elem:e})=>e instanceof SVGElement,set(t,{elem:e}){const n="x6-title",r=`${t}`,i=pd(e,n);if(null==i||i!==r){pd(e,n,r);const t=e.firstChild;if(t&&"TITLE"===t.tagName.toUpperCase()){t.textContent=r}else{const n=document.createElementNS(e.namespaceURI,"title");n.textContent=r,e.insertBefore(n,t)}}}},sm={offset:lm("x","width","right")},om={offset:lm("y","height","bottom")},am={offset:(t,{refBBox:e})=>t?{x:-e.x,y:-e.y}:{x:0,y:0}};function lm(t,e,n){return(r,{refBBox:i})=>{const s=new jf;let o;return o="middle"===r?i[e]/2:r===n?i[e]:"number"==typeof r&&Number.isFinite(r)?r>-1&&r<1?-i[e]*r:-r:Vu(r)?i[e]*parseFloat(r)/100:0,s[t]=-(i[t]+o),s}}const cm={qualify:jn,set(t,{elem:e}){ud(e,t)}},hm={set(t,{elem:e}){e.innerHTML=`${t}`}},um={qualify:jn,set:(t,{view:e})=>`url(#${e.graph.defineFilter(t)})`},gm={set:t=>null!=t&&"object"==typeof t&&t.id?t.id:t};function dm(t,e,n){let r,i;"object"==typeof e?(r=e.x,i=e.y):(r=e,i=n);const s=ep.parse(t),o=s.bbox();if(o){let t=-o.height/2-o.y,e=-o.width/2-o.x;"number"==typeof r&&(e-=r),"number"==typeof i&&(t-=i),s.translate(e,t)}return s.serialize()}function fm(t,e,n,r=3/4,i={}){const s=t.size||10,o=t.width||s,a=t.height||s,l=new ep,c={};if(e)l.moveTo(o,0).lineTo(0,a/2).lineTo(o,a),c.fill="none";else{if(l.moveTo(0,a/2),l.lineTo(o,0),!n){const t=Hr(r,0,1);l.lineTo(o*t,a/2)}l.lineTo(o,a),l.close()}return Object.assign(Object.assign(Object.assign({},c),i),{tagName:"path",d:dm(l.serialize(),{x:null!=t.offset?t.offset:-o/2})})}const pm=t=>{var{r:n}=t,r=e(t,["r"]);const i=n||5;return Object.assign(Object.assign({cx:i},r),{tagName:"circle",r:i})};var mm,ym=Object.freeze({__proto__:null,async:t=>{var{width:n,height:r,offset:i,open:s,flip:o}=t,a=e(t,["width","height","offset","open","flip"]);let l=r||6;const c=n||10,h=!0===s,u=!0===o,g=Object.assign(Object.assign({},a),{tagName:"path"});u&&(l=-l);const d=new ep;return d.moveTo(0,l).lineTo(c,0),h?g.fill="none":(d.lineTo(c,l),d.close()),g.d=dm(d.serialize(),{x:i||-c/2,y:l/2}),g},block:t=>{var{size:n,width:r,height:i,offset:s,open:o}=t;return fm({size:n,width:r,height:i,offset:s},!0===o,!0,void 0,e(t,["size","width","height","offset","open"]))},circle:pm,circlePlus:t=>{var{r:n}=t,r=e(t,["r"]);const i=n||5,s=new ep;return s.moveTo(i,0).lineTo(i,2*i),s.moveTo(0,i).lineTo(2*i,i),{children:[Object.assign(Object.assign({},pm({r:i})),{fill:"none"}),Object.assign(Object.assign({},r),{tagName:"path",d:dm(s.serialize(),-i)})]}},classic:t=>{var{size:n,width:r,height:i,offset:s,factor:o}=t;return fm({size:n,width:r,height:i,offset:s},!1,!1,o,e(t,["size","width","height","offset","factor"]))},cross:t=>{var{size:n,width:r,height:i,offset:s}=t,o=e(t,["size","width","height","offset"]);const a=n||10,l=r||a,c=i||a,h=new ep;return h.moveTo(0,0).lineTo(l,c).moveTo(0,c).lineTo(l,0),Object.assign(Object.assign({},o),{tagName:"path",fill:"none",d:dm(h.serialize(),s||-l/2)})},diamond:t=>{var{size:n,width:r,height:i,offset:s}=t,o=e(t,["size","width","height","offset"]);const a=n||10,l=r||a,c=i||a,h=new ep;return h.moveTo(0,c/2).lineTo(l/2,0).lineTo(l,c/2).lineTo(l/2,c).close(),Object.assign(Object.assign({},o),{tagName:"path",d:dm(h.serialize(),null==s?-l/2:s)})},ellipse:t=>{var{rx:n,ry:r}=t,i=e(t,["rx","ry"]);const s=n||5,o=r||5;return Object.assign(Object.assign({cx:s},i),{tagName:"ellipse",rx:s,ry:o})},path:t=>{var{d:n,offsetX:r,offsetY:i}=t,s=e(t,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},s),{tagName:"path",d:dm(n,r,i)})}});function vm(t){return"string"==typeof t||jn(t)}!function(t){t.presets=ym,t.registry=np.create({type:"marker"}),t.registry.register(t.presets,!0)}(mm||(mm={})),function(t){t.normalize=dm}(mm||(mm={}));const bm={qualify:vm,set:(t,{view:e,attrs:n})=>Am("marker-start",t,e,n)},xm={qualify:vm,set:(t,{view:e,attrs:n})=>Am("marker-end",t,e,n,{transform:"rotate(180)"})},wm={qualify:vm,set:(t,{view:e,attrs:n})=>Am("marker-mid",t,e,n)};function Am(t,n,r,i,s={}){const o="string"==typeof n?{name:n}:n,{name:a,args:l}=o,c=e(o,["name","args"]);let h=c;if(a&&"string"==typeof a){const t=mm.registry.get(a);if(!t)return mm.registry.onNotFound(a);h=t(Object.assign(Object.assign({},c),l))}const u=Object.assign(Object.assign(Object.assign({},function(t,e){const n={},r=t.stroke;"string"==typeof r&&(n.stroke=r,n.fill=r);let i=t.strokeOpacity;null==i&&(i=t["stroke-opacity"]);null==i&&(i=t.opacity);null!=i&&(n["stroke-opacity"]=i,n["fill-opacity"]=i);if("marker-mid"!==e){const r=parseFloat(t.strokeWidth||t["stroke-width"]);if(Number.isFinite(r)&&r>1){const t=Math.ceil(r/2);n.refX="marker-start"===e?t:-t}}return n}(i,t)),s),h);return{[t]:`url(#${r.graph.defineMarker(u)})`}}const Cm=(t,{view:e})=>e.cell.isEdge(),Pm={qualify:Cm,set(t,e){var n,r,i,s;const o=e.view,a=t.reverse||!1,l=t.stubs||0;let c;if(Number.isFinite(l)&&0!==l)if(a){let t,e;const a=o.getConnectionLength()||0;l<0?(t=(a+l)/2,e=-l):(t=l,e=a-2*l);const h=o.getConnection();c=null===(s=null===(i=null===(r=null===(n=null==h?void 0:h.divideAtLength(t))||void 0===n?void 0:n[1])||void 0===r?void 0:r.divideAtLength(e))||void 0===i?void 0:i[0])||void 0===s?void 0:s.serialize()}else{let t;if(l<0){t=((o.getConnectionLength()||0)+l)/2}else t=l;const e=o.getConnection();if(e){const n=e.divideAtLength(t),r=e.divideAtLength(-t);n&&r&&(c=`${n[0].serialize()} ${r[1].serialize()}`)}}return{d:c||o.getConnectionPathData()}}},Mm={qualify:Cm,set:Nm("getTangentAtLength",{rotate:!0})},Em={qualify:Cm,set:Nm("getTangentAtLength",{rotate:!1})},Sm={qualify:Cm,set:Nm("getTangentAtRatio",{rotate:!0})},Om={qualify:Cm,set:Nm("getTangentAtRatio",{rotate:!1})},Tm=Mm,km=Sm;function Nm(t,e){const n={x:1,y:0};return(r,i)=>{let s,o;const a=i.view,l=a[t](Number(r));return l?(o=e.rotate?l.vector().vectorAngle(n):0,s=l.start):(s=a.path.start,o=0),0===o?{transform:`translate(${s.x},${s.y}')`}:{transform:`translate(${s.x},${s.y}') rotate(${o})`}}}var jm,_m=Object.freeze({__proto__:null,annotations:em,atConnectionLength:Tm,atConnectionLengthIgnoreGradient:Em,atConnectionLengthKeepGradient:Mm,atConnectionRatio:km,atConnectionRatioIgnoreGradient:Om,atConnectionRatioKeepGradient:Sm,connection:Pm,displayEmpty:rm,eol:nm,fill:Hp,filter:um,html:hm,lineHeight:Kp,port:gm,ref:{},refCx:Tp,refCy:kp,refD:Ip,refDKeepOffset:jp,refDResetOffset:Np,refDx:wp,refDy:Ap,refHeight:Pp,refHeight2:$p,refPoints:Dp,refPointsKeepOffset:Lp,refPointsResetOffset:_p,refR:Bp,refRCircumscribed:Op,refRInscribed:Sp,refRx:Mp,refRy:Ep,refWidth:Cp,refWidth2:zp,refX:bp,refX2:Rp,refY:xp,refY2:Vp,resetOffset:am,sourceMarker:bm,stroke:Jp,style:cm,targetMarker:xm,text:Xp,textPath:tm,textVerticalAnchor:Qp,textWrap:Yp,title:im,vertexMarker:wm,xAlign:sm,yAlign:om});!function(t){t.isValidDefinition=function(t,e,n){if(null!=t){if("string"==typeof t)return!0;if("function"!=typeof t.qualify||su(t.qualify,this,e,n))return!0}return!1}}(jm||(jm={})),function(t){t.presets=Object.assign(Object.assign({},vp),_m),t.registry=np.create({type:"attribute definition"}),t.registry.register(t.presets,!0)}(jm||(jm={}));const Lm={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix:t=>`${Lm.prefixCls}-${t}`},Bm=Lm.prefix("highlighted"),Im={highlight(t,e,n){ug(e,n&&n.className||Bm)},unhighlight(t,e,n){gg(e,n&&n.className||Bm)}},Dm=Lm.prefix("highlight-opacity"),Rm={highlight(t,e){ug(e,Dm)},unhighlight(t,e){gg(e,Dm)}};t.Util=void 0,function(t){function e(t,e){const n=Fd(t.x,t.y).matrixTransform(e);return new jf(n.x,n.y)}function n(t,e){const n=Ag("svg").createSVGPoint();n.x=t.x,n.y=t.y;const r=n.matrixTransform(e);n.x=t.x+t.width,n.y=t.y;const i=n.matrixTransform(e);n.x=t.x+t.width,n.y=t.y+t.height;const s=n.matrixTransform(e);n.x=t.x,n.y=t.y+t.height;const o=n.matrixTransform(e),a=Math.min(r.x,i.x,s.x,o.x),l=Math.max(r.x,i.x,s.x,o.x),c=Math.min(r.y,i.y,s.y,o.y),h=Math.max(r.y,i.y,s.y,o.y);return new _f(a,c,l-a,h-c)}function r(t,e={}){let s;if(!t.ownerSVGElement||!yg(t)){if(Rg(t)){const{left:e,top:n,width:r,height:s}=i(t);return new _f(e,n,r,s)}return new _f(0,0,0,0)}let o=e.target;if(!e.recursive){try{s=t.getBBox()}catch(e){s={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}if(!o)return _f.create(s);return n(s,rf(t,o))}{const e=t.childNodes,n=e.length;if(0===n)return r(t,{target:o});o||(o=t);for(let t=0;t<n;t+=1){const n=e[t];let i;i=0===n.childNodes.length?r(n,{target:o}):r(n,{target:o,recursive:!0}),s=s?s.union(i):i}return s}}function i(t){let e=0,n=0,r=0,i=0;if(t){let s=t;for(;s;)e+=s.offsetLeft,n+=s.offsetTop,s=s.offsetParent,s&&(e+=parseInt(sd(s,"borderLeft"),10),n+=parseInt(sd(s,"borderTop"),10));r=t.offsetWidth,i=t.offsetHeight}return{left:e,top:n,width:r,height:i}}function s(t){const e=e=>{const n=t.getAttribute(e),r=n?parseFloat(n):0;return Number.isNaN(r)?0:r};switch(t instanceof SVGElement&&t.nodeName.toLowerCase()){case"rect":return new _f(e("x"),e("y"),e("width"),e("height"));case"circle":return new Bf(e("cx"),e("cy"),e("r"),e("r"));case"ellipse":return new Bf(e("cx"),e("cy"),e("rx"),e("ry"));case"polyline":{const e=jd(t);return new Ff(e)}case"polygon":{const e=jd(t);return e.length>1&&e.push(e[0]),new Ff(e)}case"path":{let e=t.getAttribute("d");return ep.isValid(e)||(e=ep.normalize(e)),ep.parse(e)}case"line":return new Lf(e("x1"),e("y1"),e("x2"),e("y2"))}return r(t)}function o(t){if(null==t)return null;let e=t;do{let t=e.tagName;if("string"!=typeof t)return null;if(t=t.toUpperCase(),hg(e,"x6-port"))e=e.nextElementSibling;else if("G"===t)e=e.firstElementChild;else{if("TITLE"!==t)break;e=e.nextElementSibling}}while(e);return e}t.normalizeMarker=dm,t.transformPoint=e,t.transformLine=function(t,n){return new Lf(e(t.start,n),e(t.end,n))},t.transformPolyline=function(t,n){let r=t instanceof Ff?t.points:t;return Array.isArray(r)||(r=[]),new Ff(r.map((t=>e(t,n))))},t.transformRectangle=n,t.bbox=function(t,e,r){let i;const s=t.ownerSVGElement;if(!s)return new _f(0,0,0,0);try{i=t.getBBox()}catch(e){i={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}return e?_f.create(i):n(i,rf(t,r||s))},t.getBBox=r,t.getBoundingOffsetRect=i,t.toGeometryShape=s,t.translateAndAutoOrient=function(t,e,n,i){const s=jf.create(e),o=jf.create(n);if(!i){i=t instanceof SVGSVGElement?t:t.ownerSVGElement}const a=nf(t);t.setAttribute("transform","");const l=r(t,{target:i}).scale(a.sx,a.sy),c=Ud();c.setTranslate(-l.x-l.width/2,-l.y-l.height/2);const h=Ud(),u=s.angleBetween(o,s.clone().translate(1,0));u&&h.setRotate(u,0,0);const g=Ud(),d=s.clone().move(o,l.width/2);g.setTranslate(2*s.x-d.x,2*s.y-d.y);const f=rf(t,i),p=Ud();p.setMatrix(g.matrix.multiply(h.matrix.multiply(c.matrix.multiply(f.scale(a.sx,a.sy))))),t.setAttribute("transform",Wd(p.matrix))},t.findShapeNode=o,t.getBBoxV2=function(t){const e=o(t);if(!yg(e)){if(Rg(t)){const{left:e,top:n,width:r,height:s}=i(t);return new _f(e,n,r,s)}return new _f(0,0,0,0)}return s(e).bbox()||_f.create()}}(t.Util||(t.Util={}));const Vm={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},zm={highlight(e,n,r){const i=$m.getHighlighterId(n,r);if($m.hasCache(i))return;r=qs({},r,Vm);const s=yd.create(n);let o,a;try{o=s.toPathData()}catch(e){a=t.Util.bbox(s.node,!0),o=Id(Object.assign(Object.assign({},r),a))}const l=Ag("path");if(Ug(l,Object.assign({d:o,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},r.attrs?Wg(r.attrs):null)),e.isEdgeElement(n))Ug(l,"d",e.getConnectionPathData());else{let n=s.getTransformToElement(e.container);const i=r.padding;if(i){null==a&&(a=t.Util.bbox(s.node,!0));const e=a.x+a.width/2,r=a.y+a.height/2;a=t.Util.transformRectangle(a,n);const o=Math.max(a.width,1),l=Math.max(a.height,1),c=(o+i)/o,h=(l+i)/l,u=Gd({a:c,b:0,c:0,d:h,e:e-c*e,f:r-h*r});n=n.multiply(u)}Qd(l,n)}ug(l,Lm.prefix("highlight-stroke"));const c=e.cell,h=()=>$m.removeHighlighter(i);c.on("removed",h),c.model&&c.model.on("reseted",h),e.container.appendChild(l),$m.setCache(i,l)},unhighlight(t,e,n){$m.removeHighlighter($m.getHighlighterId(e,n))}};var $m;!function(t){t.getHighlighterId=function(t,e){return mg(t),t.id+JSON.stringify(e)};const e={};t.setCache=function(t,n){e[t]=n},t.hasCache=function(t){return null!=e[t]},t.removeHighlighter=function(t){const n=e[t];n&&(Ng(n),delete e[t])}}($m||($m={}));var Fm,Gm=Object.freeze({__proto__:null,className:Im,opacity:Rm,stroke:zm});function Um(t,e={}){return new jf(zu(e.x,t.width),zu(e.y,t.height))}function qm(t,e,n){return Object.assign({angle:e,position:t.toJSON()},n)}!function(t){t.check=function(t,e){if("function"!=typeof e.highlight)throw new Error(`Highlighter '${t}' is missing required \`highlight()\` method`);if("function"!=typeof e.unhighlight)throw new Error(`Highlighter '${t}' is missing required \`unhighlight()\` method`)}}(Fm||(Fm={})),function(t){t.presets=Gm,t.registry=np.create({type:"highlighter"}),t.registry.register(t.presets,!0)}(Fm||(Fm={}));function Wm(t,e,n,r){const i=e.getCenter(),s=e.getTopCenter(),o=e.width/e.height,a=Bf.fromRect(e),l=t.length;return t.map(((t,e)=>{const c=n+r(e,l),h=s.clone().rotate(-c,i).scale(o,1,i),u=t.compensateRotate?-a.tangentTheta(h):0;return(t.dx||t.dy)&&h.translate(t.dx||0,t.dy||0),t.dr&&h.move(i,t.dr),qm(h.round(),u,t)}))}function Hm(t,n,r,i){const s=new Lf(n,r),o=t.length;return t.map(((t,n)=>{var{strict:r}=t,a=e(t,["strict"]);const l=r||i.strict?(n+1)/(o+1):(n+.5)/o,c=s.pointAt(l);return(a.dx||a.dy)&&c.translate(a.dx||0,a.dy||0),qm(c.round(),0,a)}))}var Jm,Xm=Object.freeze({__proto__:null,absolute:(t,e)=>t.map((({x:t,y:n,angle:r})=>qm(Um(e,{x:t,y:n}),r||0))),bottom:(t,e,n)=>Hm(t,e.getBottomLeft(),e.getBottomRight(),n),ellipse:(t,e,n)=>{const r=n.start||0,i=n.step||20;return Wm(t,e,r,((t,e)=>(t+.5-e/2)*i))},ellipseSpread:(t,e,n)=>{const r=n.start||0,i=n.step||360/t.length;return Wm(t,e,r,(t=>t*i))},left:(t,e,n)=>Hm(t,e.getTopLeft(),e.getBottomLeft(),n),line:(t,e,n)=>Hm(t,Um(e,n.start||e.getOrigin()),Um(e,n.end||e.getCorner()),n),right:(t,e,n)=>Hm(t,e.getTopRight(),e.getBottomRight(),n),top:(t,e,n)=>Hm(t,e.getTopLeft(),e.getTopRight(),n)});!function(t){t.presets=Xm,t.registry=np.create({type:"port layout"}),t.registry.register(t.presets,!0)}(Jm||(Jm={}));const Ym={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function Zm(t,e){const{x:n,y:r,angle:i,attrs:s}=e||{};return qs({},{angle:i,attrs:s,position:{x:n,y:r}},t,Ym)}function Km(t,e,n,r){const i=null!=r.offset?r.offset:15,s=e.getCenter().theta(t),o=ty(e);let a,l,c,h,u=0;return s<o[1]||s>o[2]?(a=".3em",l=i,c=0,h="start"):s<o[0]?(a="0",l=0,c=-i,n?(u=-90,h="start"):h="middle"):s<o[3]?(a=".3em",l=-i,c=0,h="end"):(a=".6em",l=0,c=i,n?(u=90,h="start"):h="middle"),Zm({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},r)}function Qm(t,e,n,r){const i=null!=r.offset?r.offset:15,s=e.getCenter().theta(t),o=ty(e);let a,l,c,h,u=0;return s<o[1]||s>o[2]?(a=".3em",l=-i,c=0,h="end"):s<o[0]?(a=".6em",l=0,c=i,n?(u=90,h="start"):h="middle"):s<o[3]?(a=".3em",l=i,c=0,h="start"):(a="0em",l=0,c=-i,n?(u=-90,h="start"):h="middle"),Zm({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},r)}function ty(t){const e=t.getCenter(),n=e.theta(t.getTopLeft()),r=e.theta(t.getBottomLeft()),i=e.theta(t.getBottomRight());return[n,e.theta(t.getTopRight()),i,r]}function ey(t,e,n){const r=null!=n.offset?n.offset:20,i=new jf(0,0),s=-t.theta(i);let o,a=".3em",l=s;return(s+90)%180==0?(o=e?"end":"middle",e||-270!==s||(a="0em")):s>-270&&s<-90?(o="start",l=s-180):o="end",Zm({position:t.clone().move(i,r).diff(t).round().round().toJSON(),angle:e?l:0,attrs:{".":{y:a,"text-anchor":o}}},n)}var ny,ry,iy=Object.freeze({__proto__:null,bottom:(t,e,n)=>Zm({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},n),inside:(t,e,n)=>Qm(t,e,!1,n),insideOriented:(t,e,n)=>Qm(t,e,!0,n),left:(t,e,n)=>Zm({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},n),manual:(t,e,n)=>Zm({position:e.getTopLeft()},n),outside:(t,e,n)=>Km(t,e,!1,n),outsideOriented:(t,e,n)=>Km(t,e,!0,n),radial:(t,e,n)=>ey(t.diff(e.getCenter()),!1,n),radialOriented:(t,e,n)=>ey(t.diff(e.getCenter()),!0,n),right:(t,e,n)=>Zm({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},n),top:(t,e,n)=>Zm({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},n)});!function(t){t.presets=iy,t.registry=np.create({type:"port label layout"}),t.registry.register(t.presets,!0)}(ny||(ny={}));class sy extends Pu{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=ry.uniqueId(),sy.views[this.cid]=this}confirmUpdate(t,e){return 0}empty(t=this.container){return jg(t),this}unmount(t=this.container){return Ng(t),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),delete sy.views[this.cid],this.disposeContainer&&this.unmount(t)):this.unmount(t),this}onRemove(){}setClass(t,e=this.container){e.classList.value=Array.isArray(t)?t.join(" "):t}addClass(t,e=this.container){return ug(e,Array.isArray(t)?t.join(" "):t),this}removeClass(t,e=this.container){return gg(e,Array.isArray(t)?t.join(" "):t),this}setStyle(t,e=this.container){return ud(e,t),this}setAttrs(t,e=this.container){return null!=t&&null!=e&&Ug(e,t),this}findAttr(t,e=this.container){let n=e;for(;n&&1===n.nodeType;){const e=n.getAttribute(t);if(null!=e)return e;if(n===this.container)return null;n=n.parentNode}return null}find(t,e=this.container,n=this.selectors){return sy.find(t,e,n).elems}findOne(t,e=this.container,n=this.selectors){const r=this.find(t,e,n);return r.length>0?r[0]:null}findByAttr(t,e=this.container){let n=e;for(;n&&n.getAttribute;){const e=n.getAttribute(t);if((null!=e||n===this.container)&&"false"!==e)return n;n=n.parentNode}return null}getSelector(t,e){let n;if(t===this.container)return"string"==typeof e&&(n=`> ${e}`),n;if(t){const r=Eg(t)+1;n=`${t.tagName.toLowerCase()}:nth-child(${r})`,e&&(n+=` > ${e}`),n=this.getSelector(t.parentNode,n)}return n}prefixClassName(t){return Lm.prefix(t)}delegateEvents(t,e){if(null==t)return this;e||this.undelegateEvents();const n=/^(\S+)\s*(.*)$/;return Object.keys(t).forEach((e=>{const r=e.match(n);if(null==r)return;const i=this.getEventHandler(t[e]);"function"==typeof i&&this.delegateEvent(r[1],r[2],i)})),this}undelegateEvents(){return gf.off(this.container,this.getEventNamespace()),this}delegateDocumentEvents(t,e){return this.addEventListeners(document,t,e),this}undelegateDocumentEvents(){return this.removeEventListeners(document),this}delegateEvent(t,e,n){return gf.on(this.container,t+this.getEventNamespace(),e,n),this}undelegateEvent(t,e,n){const r=t+this.getEventNamespace();return null==e?gf.off(this.container,r):"string"==typeof e?gf.off(this.container,r,e,n):gf.off(this.container,r,e),this}addEventListeners(t,e,n){if(null==e)return this;const r=this.getEventNamespace();return Object.keys(e).forEach((i=>{const s=this.getEventHandler(e[i]);"function"==typeof s&&gf.on(t,i+r,n,s)})),this}removeEventListeners(t){return null!=t&&gf.off(t,this.getEventNamespace()),this}getEventNamespace(){return`.${Lm.prefixCls}-event-${this.cid}`}getEventHandler(t){let e;if("string"==typeof t){const n=this[t];"function"==typeof n&&(e=(...t)=>n.call(this,...t))}else e=(...e)=>t.call(this,...e);return e}getEventTarget(t,e={}){const{target:n,type:r,clientX:i=0,clientY:s=0}=t;return e.fromPoint||"touchmove"===r||"touchend"===r?document.elementFromPoint(i,s):n}stopPropagation(t){return this.setEventData(t,{propagationStopped:!0}),this}isPropagationStopped(t){return!0===this.getEventData(t).propagationStopped}getEventData(t){return this.eventData(t)}setEventData(t,e){return this.eventData(t,e)}eventData(t,e){if(null==t)throw new TypeError("Event object required");let n=t.data;const r=`__${this.cid}__`;return null==e?null==n?{}:n[r]||{}:(null==n&&(n=t.data={}),null==n[r]?n[r]=Object.assign({},e):n[r]=Object.assign(Object.assign({},n[r]),e),n[r])}normalizeEvent(t){return sy.normalizeEvent(t)}dispose(){this.remove()}}n([sy.dispose()],sy.prototype,"dispose",null),function(t){t.createElement=function(t,e){return e?Ag(t||"g"):wg(t||"div")},t.find=function(t,e,n){if(!t||"."===t)return{elems:[e]};if(n){const e=n[t];if(e)return{elems:Array.isArray(e)?e:[e]}}if(Lm.useCSSSelector){const n=t.includes(">")?`:scope ${t}`:t;return{isCSSSelector:!0,elems:Array.prototype.slice.call(e.querySelectorAll(n))}}return{elems:[]}},t.normalizeEvent=function(t){let e=t;const n=t.originalEvent,r=n&&n.changedTouches&&n.changedTouches[0];if(r){for(const e in t)void 0===r[e]&&(r[e]=t[e]);e=r}return e}}(sy||(sy={})),function(t){t.views={},t.getView=function(e){return t.views[e]||null}}(sy||(sy={})),function(t){let e=0;t.uniqueId=function(){const t=`v${e}`;return e+=1,t}}(ry||(ry={}));class oy{constructor(t){this.view=t,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Pf,this.pathCache={}}get(t){return this.elemCache.has(t)||this.elemCache.set(t,{}),this.elemCache.get(t)}getData(t){const e=this.get(t);return e.data||(e.data={}),e.data}getMatrix(t){const e=this.get(t);if(null==e.matrix){const n=this.view.container;e.matrix=sf(t,n)}return Gd(e.matrix)}getShape(e){const n=this.get(e);return null==n.shape&&(n.shape=t.Util.toGeometryShape(e)),n.shape.clone()}getBoundingRect(e){const n=this.get(e);return null==n.boundingRect&&(n.boundingRect=t.Util.getBBoxV2(e)),n.boundingRect.clone()}}t.Markup=void 0,function(t){function e(t){return null!=t&&"string"==typeof t}function n(t,e={ns:vg.svg}){const n=document.createDocumentFragment(),r={},i={},s=[{markup:Array.isArray(t)?t:[t],parent:n,ns:e.ns}];for(;s.length>0;){const t=s.pop();let e=t.ns||vg.svg;const n=t.markup,o=t.parent;n.forEach((t=>{const n=t.tagName;if(!n)throw new TypeError("Invalid tagName");t.ns&&(e=t.ns);const a=e?wg(n,e):xg(n),l=t.attrs;l&&Ug(a,Wg(l));const c=t.style;c&&ud(a,c);const h=t.className;null!=h&&a.setAttribute("class",Array.isArray(h)?h.join(" "):h),t.textContent&&(a.textContent=t.textContent);const u=t.selector;if(null!=u){if(i[u])throw new TypeError("Selector must be unique");i[u]=a}if(t.groupSelector){let e=t.groupSelector;Array.isArray(e)||(e=[e]),e.forEach((t=>{r[t]||(r[t]=[]),r[t].push(a)}))}o.appendChild(a);const g=t.children;Array.isArray(g)&&s.push({ns:e,markup:g,parent:a})}))}return Object.keys(r).forEach((t=>{if(i[t])throw new Error("Ambiguous group selector");i[t]=r[t]})),{fragment:n,selectors:i,groups:r}}function r(t){return t instanceof SVGElement?Ag("g"):xg("div")}t.isJSONMarkup=function(t){return null!=t&&!e(t)},t.isStringMarkup=e,t.clone=function(t){return null==t||e(t)?t:Ui(t)},t.sanitize=function(t){return`${t}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")},t.parseJSONMarkup=n,t.renderMarkup=function(t){if(e(t)){const e=yd.createVectors(t),n=e.length;if(1===n)return{elem:e[0].node};if(n>1){const t=r(e[0].node);return e.forEach((e=>{t.appendChild(e.node)})),{elem:t}}return{}}const i=n(t),s=i.fragment;let o=null;return s.childNodes.length>1?(o=r(s.firstChild),o.appendChild(s)):o=s.firstChild,{elem:o,selectors:i.selectors}},t.parseLabelStringMarkup=function(t){const e=yd.createVectors(t),n=document.createDocumentFragment();for(let t=0,r=e.length;t<r;t+=1){const r=e[t].node;n.appendChild(r)}return{fragment:n,selectors:{}}}}(t.Markup||(t.Markup={})),(t.Markup||(t.Markup={})).getSelector=function t(e,n,r){if(null!=e){let i;const s=e.tagName.toLowerCase();if(e===n)return i="string"==typeof r?`> ${s} > ${r}`:`> ${s}`,i;const o=e.parentNode;return i=o&&o.childNodes.length>1?`${s}:nth-child(${Eg(e)+1})`:s,r&&(i+=` > ${r}`),t(e.parentNode,n,i)}return r},function(t){t.getPortContainerMarkup=function(){return"g"},t.getPortMarkup=function(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}},t.getPortLabelMarkup=function(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}}(t.Markup||(t.Markup={})),function(t){t.getEdgeMarkup=function(){return[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}]}}(t.Markup||(t.Markup={})),function(t){t.getForeignObjectMarkup=function(t=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:vg.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:vg.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:t?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}}(t.Markup||(t.Markup={}));class ay{constructor(t){this.view=t}get cell(){return this.view.cell}getDefinition(t){return this.cell.getAttrDefinition(t)}processAttrs(t,e){let n,r,i,s;const o=[];return Object.keys(e).forEach((r=>{const i=e[r],s=this.getDefinition(r),a=su(jm.isValidDefinition,this.view,s,i,{elem:t,attrs:e,cell:this.cell,view:this.view});if(s&&a)"string"==typeof s?(null==n&&(n={}),n[s]=i):null!==i&&o.push({name:r,definition:s});else{null==n&&(n={});const t=Vg.includes(r)?r:Su(r);n[t]=i}})),o.forEach((({name:t,definition:n})=>{const o=e[t];"function"==typeof n.set&&(null==r&&(r={}),r[t]=o);"function"==typeof n.offset&&(null==i&&(i={}),i[t]=o);"function"==typeof n.position&&(null==s&&(s={}),s[t]=o)})),{raw:e,normal:n,set:r,offset:i,position:s}}mergeProcessedAttrs(t,e){t.set=Object.assign(Object.assign({},t.set),e.set),t.position=Object.assign(Object.assign({},t.position),e.position),t.offset=Object.assign(Object.assign({},t.offset),e.offset);const n=t.normal&&t.normal.transform;null!=n&&e.normal&&(e.normal.transform=n),t.normal=e.normal}findAttrs(t,e,n,r){const i=[],s=new Pf;return Object.keys(t).forEach((o=>{const a=t[o];if(!jn(a))return;const{isCSSSelector:l,elems:c}=sy.find(o,e,r);n[o]=c;for(let t=0,e=c.length;t<e;t+=1){const n=c[t],h=r&&r[o]===n,u=s.get(n);if(u){u.array||(i.push(n),u.array=!0,u.attrs=[u.attrs],u.priority=[u.priority]);const t=u.attrs,r=u.priority;if(h)t.unshift(a),r.unshift(-1);else{const n=Nc(r,l?-1:e);t.splice(n,0,a),r.splice(n,0,e)}}else s.set(n,{elem:n,attrs:a,priority:h?-1:e,array:!1})}})),i.forEach((t=>{const e=s.get(t),n=e.attrs;e.attrs=n.reduceRight(((t,e)=>Ya(t,e)),{})})),s}updateRelativeAttrs(e,n,r){const i=n.raw||{};let s=n.normal||{};const o=n.set,a=n.position,l=n.offset,c=()=>({elem:e,cell:this.cell,view:this.view,attrs:i,refBBox:r.clone()});if(null!=o&&Object.keys(o).forEach((t=>{const e=o[t],n=this.getDefinition(t);if(null!=n){const r=su(n.set,this.view,e,c());"object"==typeof r?s=Object.assign(Object.assign({},s),r):null!=r&&(s[t]=r)}})),e instanceof HTMLElement)return void this.view.setAttrs(s,e);const h=s.transform,u=qd(h?`${h}`:null),g=new jf(u.e,u.f);h&&(delete s.transform,u.e=0,u.f=0);let d=!1;null!=a&&Object.keys(a).forEach((t=>{const e=a[t],n=this.getDefinition(t);if(null!=n){const t=su(n.position,this.view,e,c());null!=t&&(d=!0,g.translate(jf.create(t)))}})),this.view.setAttrs(s,e);let f=!1;if(null!=l){const n=this.view.getBoundingRectOfElement(e);if(n.width>0&&n.height>0){const r=t.Util.transformRectangle(n,u);Object.keys(l).forEach((t=>{const n=l[t],s=this.getDefinition(t);if(null!=s){const t=su(s.offset,this.view,n,{elem:e,cell:this.cell,view:this.view,attrs:i,refBBox:r});null!=t&&(f=!0,g.translate(jf.create(t)))}}))}}(null!=h||d||f)&&(g.round(1),u.e=Number.isFinite(g.x)?g.x:0,u.f=Number.isFinite(g.y)?g.y:0,e.setAttribute("transform",Wd(u)))}update(e,n,r){const i={},s=this.findAttrs(r.attrs||n,e,i,r.selectors),o=r.attrs?this.findAttrs(n,e,i,r.selectors):s,a=[];s.each((t=>{const n=t.elem,s=t.attrs,l=this.processAttrs(n,s);if(null==l.set&&null==l.position&&null==l.offset)this.view.setAttrs(l.normal,n);else{const t=o.get(n),c=t?t.attrs:null,h=c&&null==s.ref?c.ref:s.ref;let u;if(h){if(u=(i[h]||this.view.find(h,e,r.selectors))[0],!u)throw new Error(`"${h}" reference does not exist.`)}else u=null;const g={node:n,refNode:u,attributes:c,processedAttributes:l},d=a.findIndex((t=>t.refNode===n));d>-1?a.splice(d,0,g):a.push(g)}}));const l=new Pf;let c;a.forEach((n=>{const i=n.node,s=n.refNode;let o;const a=null!=s&&null!=r.rotatableNode&&kg(r.rotatableNode,s);if(s&&(o=l.get(s)),!o){const n=a?r.rotatableNode:e;o=s?t.Util.getBBox(s,{target:n}):r.rootBBox,s&&l.set(s,o)}let h;r.attrs&&n.attributes?(h=this.processAttrs(i,n.attributes),this.mergeProcessedAttrs(h,n.processedAttributes)):h=n.processedAttributes;let u=o;a&&null!=r.rotatableNode&&!r.rotatableNode.contains(i)&&(c||(c=qd(Ug(r.rotatableNode,"transform"))),u=t.Util.transformRectangle(o,c)),this.updateRelativeAttrs(i,h,u)}))}}class ly{get cell(){return this.view.cell}constructor(t,e,n=[]){this.view=t;const r={},i={};let s=0;Object.keys(e).forEach((t=>{let n=e[t];Array.isArray(n)||(n=[n]),n.forEach((e=>{let n=r[e];n||(s+=1,n=r[e]=1<<s),i[t]|=n}))}));let o=n;if(Array.isArray(o)||(o=[o]),o.forEach((t=>{r[t]||(s+=1,r[t]=1<<s)})),s>25)throw new Error("Maximum number of flags exceeded.");this.flags=r,this.attrs=i,this.bootstrap=n}getFlag(t){const e=this.flags;return null==e?0:Array.isArray(t)?t.reduce(((t,n)=>t|e[n]),0):0|e[t]}hasAction(t,e){return t&this.getFlag(e)}removeAction(t,e){return t^t&this.getFlag(e)}getBootstrapFlag(){return this.getFlag(this.bootstrap)}getChangedFlag(){let t=0;return this.attrs?(Object.keys(this.attrs).forEach((e=>{this.cell.hasChanged(e)&&(t|=this.attrs[e])})),t):t}}class cy extends sy{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){const n=(t,e)=>null!=e?yh([...Array.isArray(t)?t:[t],...Array.isArray(e)?e:[e]]):Array.isArray(t)?[...t]:[t],r=Ui(this.getDefaults()),{bootstrap:i,actions:s,events:o,documentEvents:a}=t,l=e(t,["bootstrap","actions","events","documentEvents"]);return i&&(r.bootstrap=n(r.bootstrap,i)),s&&Object.entries(s).forEach((([t,e])=>{const i=r.actions[t];e&&i?r.actions[t]=n(i,e):e&&(r.actions[t]=n(e))})),o&&(r.events=Object.assign(Object.assign({},r.events),o)),t.documentEvents&&(r.documentEvents=Object.assign(Object.assign({},r.documentEvents),a)),Ya(r,l)}get[Symbol.toStringTag](){return cy.toStringTag}constructor(t,e={}){super(),this.cell=t,this.options=this.ensureOptions(e),this.graph=this.options.graph,this.attr=new ay(this),this.flag=new ly(this,this.options.actions,this.options.bootstrap),this.cache=new oy(this),this.setContainer(this.ensureContainer()),this.setup(),this.init()}init(){}onRemove(){this.removeTools()}get priority(){return this.options.priority}get rootSelector(){return this.options.rootSelector}getConstructor(){return this.constructor}ensureOptions(t){return this.getConstructor().getOptions(t)}getContainerTagName(){return this.options.isSvgElement?"g":"div"}getContainerStyle(){}getContainerAttrs(){return{"data-cell-id":this.cell.id,"data-shape":this.cell.shape}}getContainerClassName(){return this.prefixClassName("cell")}ensureContainer(){return sy.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(t){if(this.container!==t){this.undelegateEvents(),this.container=t,null!=this.options.events&&this.delegateEvents(this.options.events);const e=this.getContainerAttrs();null!=e&&this.setAttrs(e,t);const n=this.getContainerStyle();null!=n&&this.setStyle(n,t);const r=this.getContainerClassName();null!=r&&this.addClass(r,t)}return this}isNodeView(){return!1}isEdgeView(){return!1}render(){return this}confirmUpdate(t,e={}){return 0}getBootstrapFlag(){return this.flag.getBootstrapFlag()}getFlag(t){return this.flag.getFlag(t)}hasAction(t,e){return this.flag.hasAction(t,e)}removeAction(t,e){return this.flag.removeAction(t,e)}handleAction(t,e,n,r){if(this.hasAction(t,e)){n();const i=[e];return r&&("string"==typeof r?i.push(r):i.push(...r)),this.removeAction(t,i)}return t}setup(){this.cell.on("changed",this.onCellChanged,this)}onCellChanged({options:t}){this.onAttrsChange(t)}onAttrsChange(t){let e=this.flag.getChangedFlag();!t.updated&&e&&(t.dirty&&this.hasAction(e,"update")&&(e|=this.getFlag("render")),t.toolId&&(t.async=!1),null!=this.graph&&this.graph.renderer.requestViewUpdate(this,e,t))}parseJSONMarkup(e,n){const r=t.Markup.parseJSONMarkup(e),i=r.selectors,s=this.rootSelector;if(n&&s){if(i[s])throw new Error("Invalid root selector");i[s]=n}return r}can(t){let e=this.graph.options.interacting;if("function"==typeof e&&(e=su(e,this.graph,this)),"object"==typeof e){let n=e[t];return"function"==typeof n&&(n=su(n,this.graph,this)),!1!==n}return"boolean"==typeof e&&e}cleanCache(){return this.cache.clean(),this}getCache(t){return this.cache.get(t)}getDataOfElement(t){return this.cache.getData(t)}getMatrixOfElement(t){return this.cache.getMatrix(t)}getShapeOfElement(t){return this.cache.getShape(t)}getBoundingRectOfElement(t){return this.cache.getBoundingRect(t)}getBBoxOfElement(e){const n=this.getBoundingRectOfElement(e),r=this.getMatrixOfElement(e),i=this.getRootRotatedMatrix(),s=this.getRootTranslatedMatrix();return t.Util.transformRectangle(n,s.multiply(i).multiply(r))}getUnrotatedBBoxOfElement(e){const n=this.getBoundingRectOfElement(e),r=this.getMatrixOfElement(e),i=this.getRootTranslatedMatrix();return t.Util.transformRectangle(n,i.multiply(r))}getBBox(t={}){let e;if(t.useCellGeometry){const t=this.cell,n=t.isNode()?t.getAngle():0;e=t.getBBox().bbox(n)}else e=this.getBBoxOfElement(this.container);return this.graph.coord.localToGraphRect(e)}getRootTranslatedMatrix(){const t=this.cell,e=t.isNode()?t.getPosition():{x:0,y:0};return Gd().translate(e.x,e.y)}getRootRotatedMatrix(){let t=Gd();const e=this.cell,n=e.isNode()?e.getAngle():0;if(n){const r=e.getBBox(),i=r.width/2,s=r.height/2;t=t.translate(i,s).rotate(n).translate(-i,-s)}return t}findMagnet(t=this.container){return this.findByAttr("magnet",t)}updateAttrs(t,e,n={}){null==n.rootBBox&&(n.rootBBox=new _f),null==n.selectors&&(n.selectors=this.selectors),this.attr.update(t,e,n)}isEdgeElement(t){return this.cell.isEdge()&&(null==t||t===this.container)}prepareHighlight(t,e={}){const n=t||this.container;return e.partial=n===this.container,n}highlight(t,e={}){const n=this.prepareHighlight(t,e);return this.notify("cell:highlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isEdgeView()?this.notify("edge:highlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}):this.isNodeView()&&this.notify("node:highlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}),this}unhighlight(t,e={}){const n=this.prepareHighlight(t,e);return this.notify("cell:unhighlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isNodeView()?this.notify("node:unhighlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}):this.isEdgeView()&&this.notify("edge:unhighlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}),this}notifyUnhighlight(t,e){}getEdgeTerminal(t,e,n,r,i){const s=this.cell,o=this.findAttr("port",t),a=t.getAttribute("data-selector"),l={cell:s.id};return null!=a&&(l.magnet=a),null!=o?(l.port=o,s.isNode()&&(s.hasPort(o)||null!=a||(l.selector=this.getSelector(t)))):null==a&&this.container!==t&&(l.selector=this.getSelector(t)),l}getMagnetFromEdgeTerminal(t){const e=this.cell,n=this.container,r=t.port;let i,s=t.magnet;return null!=r&&e.isNode()&&e.hasPort(r)?i=this.findPortElem(r,s)||n:(s||(s=t.selector),s||null==r||(s=`[port="${r}"]`),i=this.findOne(s,n,this.selectors)),i}hasTools(t){const e=this.tools;return null!=e&&(null==t||e.name===t)}addTools(t){if(this.removeTools(),t){if(!this.can("toolsAddable"))return this;const e=hy.isToolsView(t)?t:new hy(t);this.tools=e,e.config({view:this}),e.mount()}return this}updateTools(t={}){return this.tools&&this.tools.update(t),this}removeTools(){return this.tools&&(this.tools.remove(),this.tools=null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}notify(t,e){return this.trigger(t,e),this.graph.trigger(t,e),this}getEventArgs(t,e,n){const r=this,i=r.cell;return null==e||null==n?{e:t,view:r,cell:i}:{e:t,x:e,y:n,view:r,cell:i}}onClick(t,e,n){this.notify("cell:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){this.notify("cell:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){this.notify("cell:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch("mouse")),this.notify("cell:mousedown",this.getEventArgs(t,e,n))}onMouseUp(t,e,n){this.notify("cell:mouseup",this.getEventArgs(t,e,n)),this.cachedModelForMouseEvent&&(this.cachedModelForMouseEvent.stopBatch("mouse",{cell:this.cell}),this.cachedModelForMouseEvent=null)}onMouseMove(t,e,n){this.notify("cell:mousemove",this.getEventArgs(t,e,n))}onMouseOver(t){this.notify("cell:mouseover",this.getEventArgs(t))}onMouseOut(t){this.notify("cell:mouseout",this.getEventArgs(t))}onMouseEnter(t){this.notify("cell:mouseenter",this.getEventArgs(t))}onMouseLeave(t){this.notify("cell:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,r){this.notify("cell:mousewheel",Object.assign({delta:r},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,r){this.notify("cell:customevent",Object.assign({name:e},this.getEventArgs(t,n,r))),this.notify(e,Object.assign({},this.getEventArgs(t,n,r)))}onMagnetMouseDown(t,e,n,r){}onMagnetDblClick(t,e,n,r){}onMagnetContextMenu(t,e,n,r){}onLabelMouseDown(t,e,n){}checkMouseleave(t){const e=this.getEventTarget(t,{fromPoint:!0}),n=this.graph.findViewByElem(e);n!==this&&(this.onMouseLeave(t),n&&n.onMouseEnter(t))}dispose(){this.cell.off("changed",this.onCellChanged,this)}}cy.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},n([cy.dispose()],cy.prototype,"dispose",null),function(t){t.Flag=ly,t.Attr=ay}(cy||(cy={})),function(t){t.toStringTag=`X6.${t.name}`,t.isCellView=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&"function"==typeof r.isNodeView&&"function"==typeof r.isEdgeView&&"function"==typeof r.confirmUpdate}}(cy||(cy={})),function(t){t.priority=function(t){return function(e){e.config({priority:t})}},t.bootstrap=function(t){return function(e){e.config({bootstrap:t})}}}(cy||(cy={})),function(t){t.registry=np.create({type:"view"})}(cy||(cy={}));class hy extends sy{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return hy.toStringTag}constructor(t={}){super(),this.svgContainer=this.createContainer(!0,t),this.htmlContainer=this.createContainer(!1,t),this.config(t)}createContainer(t,e){const n=t?sy.createElement("g",!0):sy.createElement("div",!1);return ug(n,this.prefixClassName("cell-tools")),e.className&&ug(n,e.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!cy.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(ug(this.svgContainer,this.prefixClassName("edge-tools")),ug(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(ug(this.svgContainer,this.prefixClassName("node-tools")),ug(this.htmlContainer,this.prefixClassName("node-tools"))),this.svgContainer.setAttribute("data-cell-id",this.cell.id),this.htmlContainer.setAttribute("data-cell-id",this.cell.id),this.name&&(this.svgContainer.setAttribute("data-tools-name",this.name),this.htmlContainer.setAttribute("data-tools-name",this.name));const e=this.options.items;if(!Array.isArray(e))return this;this.tools=[];const n=[];e.forEach((t=>{if(hy.ToolItem.isToolItem(t))"vertices"===t.name?n.unshift(t):n.push(t);else{"vertices"===("object"==typeof t?t.name:t)?n.unshift(t):n.push(t)}}));for(let t=0;t<n.length;t+=1){const e=n[t];let r;if(hy.ToolItem.isToolItem(e))r=e;else{const t="object"==typeof e?e.name:e,n="object"==typeof e&&e.args||{};if(t)if(this.cell.isNode()){const e=ky.registry.get(t);if(!e)return ky.registry.onNotFound(t);r=new e(n)}else if(this.cell.isEdge()){const e=Ny.registry.get(t);if(!e)return Ny.registry.onNotFound(t);r=new e(n)}}if(r){r.config(this.cellView,this),r.render();(!1!==r.options.isSVGElement?this.svgContainer:this.htmlContainer).appendChild(r.container),this.tools.push(r)}}return this}update(t={}){const e=this.tools;return e&&e.forEach((e=>{t.toolId!==e.cid&&e.isVisible()&&e.update()})),this}focus(t){const e=this.tools;return e&&e.forEach((e=>{t===e?e.show():e.hide()})),this}blur(t){const e=this.tools;return e&&e.forEach((e=>{e===t||e.isVisible()||(e.show(),e.update())})),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){const t=this.tools;return t&&(t.forEach((t=>t.remove())),this.tools=null),Ng(this.svgContainer),Ng(this.htmlContainer),super.remove()}mount(){const t=this.tools,e=this.cellView;if(e&&t){const n=t.some((t=>!1!==t.options.isSVGElement)),r=t.some((t=>!1===t.options.isSVGElement));if(n){(this.options.local?e.container:e.graph.view.decorator).appendChild(this.svgContainer)}r&&this.graph.container.appendChild(this.htmlContainer)}return this}}!function(t){t.toStringTag=`X6.${t.name}`,t.isToolsView=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&null!=r.graph&&null!=r.cell&&"function"==typeof r.config&&"function"==typeof r.update&&"function"==typeof r.focus&&"function"==typeof r.blur&&"function"==typeof r.show&&"function"==typeof r.hide}}(hy||(hy={})),function(e){class n extends sy{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){return Ya(Ui(this.getDefaults()),t)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return n.toStringTag}constructor(t={}){super(),this.visible=!0,this.options=this.getOptions(t),this.container=sy.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),ug(this.container,this.prefixClassName("cell-tool")),"string"==typeof this.options.className&&ug(this.container,this.options.className),this.init()}init(){}getOptions(t){return this.constructor.getOptions(t)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(t,e){return this.cellView=t,this.parent=e,this.stamp(this.container),this.cell.isEdge()?ug(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&ug(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();const e=this.options.markup;if(e){const n=t.Markup.parseJSONMarkup(e);this.container.appendChild(n.fragment),this.childNodes=n.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(t){t&&t.setAttribute("data-cell-id",this.cellView.cell.id)}show(){return this.container.style.display="",this.visible=!0,this}hide(){return this.container.style.display="none",this.visible=!1,this}isVisible(){return this.visible}focus(){const t=this.options.focusOpacity;return null!=t&&Number.isFinite(t)&&(this.container.style.opacity=`${t}`),this.parent.focus(this),this}blur(){return this.container.style.opacity="",this.parent.blur(this),this}guard(t){return null==this.graph||null==this.cellView||this.graph.view.guard(t,this.cellView)}}n.defaults={isSVGElement:!0,tagName:"g"},e.ToolItem=n,function(t){let e=0;t.define=function(t){const n=mu((r=t.name)?Ou(r):(e+=1,`CustomTool${e}`),this);var r;return n.config(t),n}}(n=e.ToolItem||(e.ToolItem={})),function(t){t.toStringTag=`X6.${t.name}`,t.isToolItem=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&null!=r.graph&&null!=r.cell&&"function"==typeof r.config&&"function"==typeof r.update&&"function"==typeof r.focus&&"function"==typeof r.blur&&"function"==typeof r.show&&"function"==typeof r.hide&&"function"==typeof r.isVisible}}(n=e.ToolItem||(e.ToolItem={}))}(hy||(hy={}));function uy(t,e){return 0===e?"0%":`${Math.round(t/e*100)}%`}function gy(t){return(e,n,r,i)=>n.isEdgeElement(r)?function(t,e,n,r,i){const s=n.getConnection();if(!s)return e;const o=s.closestPointLength(i);if(t){const t=s.length();e.anchor={name:"ratio",args:{ratio:o/t}}}else e.anchor={name:"length",args:{length:o}};return e}(t,e,n,0,i):function(t,e,n,r,i){const s=n.cell,o=s.getAngle(),a=n.getUnrotatedBBoxOfElement(r),l=s.getBBox().getCenter(),c=jf.create(i).rotate(o,l);let h=c.x-a.x,u=c.y-a.y;t&&(h=uy(h,a.width),u=uy(u,a.height));return e.anchor={name:"topLeft",args:{dx:h,dy:u,rotate:!0}},e}(t,e,n,r,i)}const dy=gy(!0),fy=gy(!1);var py,my=Object.freeze({__proto__:null,noop:t=>t,pinAbsolute:fy,pinRelative:dy});function yy(t,e,n,r){return su(py.presets.pinRelative,this.graph,{},e,n,t,this.cell,r,{}).anchor}function vy(t,e){return e?t.cell.getBBox():t.cell.isEdge()?t.getConnection().bbox():t.getUnrotatedBBoxOfElement(t.container)}!function(t){t.presets=my,t.registry=np.create({type:"connection strategy"}),t.registry.register(t.presets,!0)}(py||(py={}));class by extends hy.ToolItem{onRender(){ug(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){const t=this.cellView.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();Qd(this.container,t,{absolute:!0})}getNodeMatrix(){const t=this.cellView,e=this.options;let{x:n=0,y:r=0}=e;const{offset:i,useCellGeometry:s,rotate:o}=e;let a=vy(t,s);const l=t.cell.getAngle();o||(a=a.bbox(l));let c=0,h=0;"number"==typeof i?(c=i,h=i):"object"==typeof i&&(c=i.x,h=i.y),n=zu(n,a.width),r=zu(r,a.height);let u=Gd().translate(a.x+a.width/2,a.y+a.height/2);return o&&(u=u.rotate(l)),u=u.translate(n+c-a.width/2,r+h-a.height/2),u}getEdgeMatrix(){const t=this.cellView,e=this.options,{offset:n=0,distance:r=0,rotate:i}=e;let s,o,a;const l=zu(r,1);s=l>=0&&l<=1?t.getTangentAtRatio(l):t.getTangentAtLength(l),s?(o=s.start,a=s.vector().vectorAngle(new jf(1,0))||0):(o=t.getConnection().start,a=0);let c=Gd().translate(o.x,o.y).rotate(a);return c="object"==typeof n?c.translate(n.x||0,n.y||0):c.translate(0,n),i||(c=c.rotate(-a)),c}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.options.onClick;"function"==typeof e&&su(e,this.cellView,{e:t,view:this.cellView,cell:this.cellView.cell,btn:this})}}!function(t){t.config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}})}(by||(by={})),function(t){t.Remove=t.define({name:"button-remove",markup:[{tagName:"circle",selector:"button",attrs:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:t,btn:e}){e.parent.remove(),t.cell.remove({ui:!0,toolId:e.cid})}})}(by||(by={}));class xy extends hy.ToolItem{onRender(){if(ug(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const t=this.options.attrs,{class:n}=t,r=e(t,["class"]);Ug(this.container,Wg(r)),n&&ug(this.container,n)}this.update()}update(){const t=this.cellView,e=this.options,{useCellGeometry:n,rotate:r}=e,i=$u(e.padding);let s=vy(t,n).moveAndExpand({x:-i.left,y:-i.top,width:i.left+i.right,height:i.top+i.bottom});const o=t.cell;if(o.isNode()){const t=o.getAngle();if(t)if(r){const e=o.getBBox().getCenter();ef(this.container,t,e.x,e.y,{absolute:!0})}else s=s.bbox(t)}return Ug(this.container,s.toJSON()),this}}!function(t){t.config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}})}(xy||(xy={}));class wy extends hy.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){return this.vertices.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach((t=>{this.stopHandleListening(t),t.remove()}))}renderHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const n=t[e],r=this.options.createHandle,i=this.options.processHandle,s=r({index:e,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});i&&i(s),s.updatePosition(n.x,n.y),this.stamp(s.container),this.container.appendChild(s.container),this.handles.push(s),this.startHandleListening(s)}}updateHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const n=t[e],r=this.handles[e];r&&r.updatePosition(n.x,n.y)}}updatePath(){const t=this.childNodes.connection;t&&t.setAttribute("d",this.cellView.getConnectionPathData())}startHandleListening(t){const e=this.cellView;e.can("vertexMovable")&&(t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.on("remove",this.onHandleRemove,this)}stopHandleListening(t){const e=this.cellView;e.can("vertexMovable")&&(t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.off("remove",this.onHandleRemove,this)}getNeighborPoints(t){const e=this.cellView,n=this.vertices,r=t>0?n[t-1]:e.sourceAnchor,i=t<n.length-1?n[t+1]:e.targetAnchor;return{prev:jf.create(r),next:jf.create(i)}}getMouseEventArgs(t){const e=this.normalizeEvent(t),{x:n,y:r}=this.graph.snapToGrid(e.clientX,e.clientY);return{e:e,x:n,y:r}}onHandleChange({e:t}){this.focus();const e=this.cellView;if(e.cell.startBatch("move-vertex",{ui:!0,toolId:this.cid}),!this.options.stopPropagation){const{e:n,x:r,y:i}=this.getMouseEventArgs(t);this.eventData(n,{start:{x:r,y:i}}),e.notifyMouseDown(n,r,i)}}onHandleChanging({handle:t,e:e}){const n=this.cellView,r=t.options.index,{e:i,x:s,y:o}=this.getMouseEventArgs(e),a={x:s,y:o};this.snapVertex(a,r),n.cell.setVertexAt(r,a,{ui:!0,toolId:this.cid}),t.updatePosition(a.x,a.y),this.options.stopPropagation||n.notifyMouseMove(i,s,o)}stopBatch(t){this.cell.stopBatch("move-vertex",{ui:!0,toolId:this.cid}),t&&this.cell.stopBatch("add-vertex",{ui:!0,toolId:this.cid})}onHandleChanged({e:t}){const e=this.options,n=this.cellView;if(e.addable&&this.updatePath(),!e.removeRedundancies)return void this.stopBatch(this.eventData(t).vertexAdded);n.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(t).vertexAdded);const{e:r,x:i,y:s}=this.getMouseEventArgs(t);if(!this.options.stopPropagation){n.notifyMouseUp(r,i,s);const{start:t}=this.eventData(r);if(t){const{x:e,y:o}=t;e===i&&o===s&&n.onClick(r,i,s)}}n.checkMouseleave(r),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}snapVertex(t,e){const n=this.options.snapRadius||0;if(n>0){const r=this.getNeighborPoints(e),i=r.prev,s=r.next;Math.abs(t.x-i.x)<n?t.x=i.x:Math.abs(t.x-s.x)<n&&(t.x=s.x),Math.abs(t.y-i.y)<n?t.y=r.prev.y:Math.abs(t.y-s.y)<n&&(t.y=s.y)}}onHandleRemove({handle:t,e:e}){if(this.options.removable){const n=t.options.index,r=this.cellView;r.cell.removeVertexAt(n,{ui:!0}),this.options.addable&&this.updatePath(),r.checkMouseleave(this.normalizeEvent(e))}}allowAddVertex(e){const n=this.guard(e),r=this.options.addable&&this.cellView.can("vertexAddable"),i=!this.options.modifiers||t.ModifierKey.isMatch(e,this.options.modifiers);return!n&&r&&i}onPathMouseDown(t){const e=this.cellView;if(!this.allowAddVertex(t))return;t.stopPropagation(),t.preventDefault();const n=this.normalizeEvent(t),r=this.graph.snapToGrid(n.clientX,n.clientY).toJSON();e.cell.startBatch("add-vertex",{ui:!0,toolId:this.cid});const i=e.getVertexIndex(r.x,r.y);this.snapVertex(r,i),e.cell.insertVertex(r,i,{ui:!0,toolId:this.cid}),this.render();const s=this.handles[i];this.eventData(n,{vertexAdded:!0}),s.onMouseDown(n)}onRemove(){this.resetHandles()}}!function(t){t.Handle=class extends sy{get graph(){return this.options.graph}constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDoubleClick"})}render(){this.container=sy.createElement("circle",!0);const e=this.options.attrs;if("function"==typeof e){const n=t.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-vertex"))}updatePosition(t,e){this.setAttrs({cx:t,cy:e})}onMouseDown(t){this.options.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data),this.emit("change",{e:t,handle:this}))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(t){this.emit("remove",{e:t,handle:this})}}}(wy||(wy={})),function(t){const e=Lm.prefix("edge-tool-vertex-path");t.config({name:"vertices",snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:"#333",stroke:"#fff",cursor:"move","stroke-width":2},createHandle:e=>new t.Handle(e),markup:[{tagName:"path",selector:"connection",className:e,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${e}`]:"onPathMouseDown",[`touchstart .${e}`]:"onPathMouseDown"}})}(wy||(wy={}));class Ay extends hy.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){ug(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();const t=this.cellView,e=[...this.vertices];e.unshift(t.sourcePoint),e.push(t.targetPoint);for(let t=0,n=e.length;t<n-1;t+=1){const n=e[t],r=e[t+1],i=this.renderHandle(n,r,t);this.stamp(i.container),this.handles.push(i)}return this}renderHandle(t,e,n){const r=this.options.createHandle({index:n,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(r),this.updateHandle(r,t,e),this.container.appendChild(r.container),this.startHandleListening(r),r}startHandleListening(t){t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)}stopHandleListening(t){t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach((t=>{this.stopHandleListening(t),t.remove()}))}shiftHandleIndexes(t){const e=this.handles;for(let n=0,r=e.length;n<r;n+=1)e[n].options.index+=t}resetAnchor(t,e){const n=this.cellView.cell,r={ui:!0,toolId:this.cid};e?n.prop([t,"anchor"],e,r):n.removeProp([t,"anchor"],r)}snapHandle(t,e,n){const r=t.options.axis,i=t.options.index,s=this.cellView.cell.getVertices(),o=s[i-2]||n.sourceAnchor,a=s[i+1]||n.targetAnchor,l=this.options.snapRadius;return Math.abs(e[r]-o[r])<l?e[r]=o[r]:Math.abs(e[r]-a[r])<l&&(e[r]=a[r]),e}onHandleChanging({handle:t,e:e}){const n=this.graph,r=this.options,i=this.cellView,s=r.anchor,o=t.options.axis,a=t.options.index-1,l=this.getEventData(e),c=this.normalizeEvent(e),h=n.snapToGrid(c.clientX,c.clientY),u=this.snapHandle(t,h.clone(),l),g=Ui(this.vertices);let d=g[a],f=g[a+1];const p=i.sourceView,m=i.sourceBBox;let y=!1,v=!1;if(d?0===a?m.containsPoint(d)?(g.shift(),this.shiftHandleIndexes(-1),y=!0):(d[o]=u[o],v=!0):d[o]=u[o]:(d=i.sourceAnchor.toJSON(),d[o]=u[o],m.containsPoint(d)?y=!0:(g.unshift(d),this.shiftHandleIndexes(1),v=!0)),"function"==typeof s&&p){if(y){const t=l.sourceAnchor.clone();t[o]=u[o];const e=su(s,i,t,p,i.sourceMagnet||p.container,"source",i,this);this.resetAnchor("source",e)}v&&this.resetAnchor("source",l.sourceAnchorDef)}const b=i.targetView,x=i.targetBBox;let w=!1,A=!1;if(f?a===g.length-2?x.containsPoint(f)?(g.pop(),w=!0):(f[o]=u[o],A=!0):f[o]=u[o]:(f=i.targetAnchor.toJSON(),f[o]=u[o],x.containsPoint(f)?w=!0:(g.push(f),A=!0)),"function"==typeof s&&b){if(w){const t=l.targetAnchor.clone();t[o]=u[o];const e=su(s,i,t,b,i.targetMagnet||b.container,"target",i,this);this.resetAnchor("target",e)}A&&this.resetAnchor("target",l.targetAnchorDef)}jf.equalPoints(g,this.vertices)||this.cellView.cell.setVertices(g,{ui:!0,toolId:this.cid}),this.updateHandle(t,d,f,0),r.stopPropagation||i.notifyMouseMove(c,h.x,h.y)}onHandleChange({handle:t,e:e}){const n=this.options,r=this.handles,i=this.cellView,s=t.options.index;if(Array.isArray(r)){for(let t=0,e=r.length;t<e;t+=1)t!==s&&r[t].hide();if(this.focus(),this.setEventData(e,{sourceAnchor:i.sourceAnchor.clone(),targetAnchor:i.targetAnchor.clone(),sourceAnchorDef:Ui(this.cell.prop(["source","anchor"])),targetAnchorDef:Ui(this.cell.prop(["target","anchor"]))}),this.cell.startBatch("move-segment",{ui:!0,toolId:this.cid}),!n.stopPropagation){const t=this.normalizeEvent(e),n=this.graph.snapToGrid(t.clientX,t.clientY);i.notifyMouseDown(t,n.x,n.y)}}}onHandleChanged({e:t}){const e=this.options,n=this.cellView;e.removeRedundancies&&n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});const r=this.normalizeEvent(t),i=this.graph.snapToGrid(r.clientX,r.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),e.stopPropagation||n.notifyMouseUp(r,i.x,i.y),n.checkMouseleave(r),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}updateHandle(t,e,n,r=0){const i=this.options.precision||0,s=Math.abs(e.x-n.x)<i,o=Math.abs(e.y-n.y)<i;if(s||o){const i=new Lf(e,n);if(i.length()<this.options.threshold)t.hide();else{const e=i.getCenter(),n=s?"x":"y";e[n]+=r||0;const o=i.vector().vectorAngle(new jf(1,0));t.updatePosition(e.x,e.y,o,this.cellView),t.show(),t.options.axis=n}}else t.hide()}onRemove(){this.resetHandles()}}!function(t){t.Handle=class extends sy{constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=sy.createElement("rect",!0);const e=this.options.attrs;if("function"==typeof e){const n=t.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(t,e,n,r){const i=r.getClosestPoint(new jf(t,e))||new jf(t,e);let s=Gd().translate(i.x,i.y);if(i.equals({x:t,y:e}))s=s.rotate(n);else{let n=new Lf(t,e,i.x,i.y).vector().vectorAngle(new jf(1,0));0!==n&&(n+=90),s=s.rotate(n)}this.setAttrs({transform:Wd(s),cursor:n%180==0?"row-resize":"col-resize"})}onMouseDown(t){this.options.guard(t)||(this.trigger("change",{e:t,handle:this}),t.stopPropagation(),t.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}}}(Ay||(Ay={})),function(t){t.config({name:"segments",precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#333",stroke:"#fff","stroke-width":2},createHandle:e=>new t.Handle(e),anchor:yy})}(Ay||(Ay={}));class Cy extends hy.ToolItem{get type(){return this.options.type}onRender(){ug(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){const t=this.type;return this.cellView.getTerminalView(t)?(this.updateAnchor(),this.updateArea(),this.container.style.display=""):this.container.style.display="none",this}updateAnchor(){const t=this.childNodes;if(!t)return;const e=t.anchor;if(!e)return;const n=this.type,r=this.cellView,i=this.options,s=r.getTerminalAnchor(n),o=r.cell.prop([n,"anchor"]);e.setAttribute("transform",`translate(${s.x}, ${s.y})`);const a=o?i.customAnchorAttrs:i.defaultAnchorAttrs;a&&Object.keys(a).forEach((t=>{e.setAttribute(t,a[t])}))}updateArea(){const t=this.childNodes;if(!t)return;const e=t.area;if(!e)return;const n=this.type,r=this.cellView,i=r.getTerminalView(n);if(i){const t=i.cell,s=r.getTerminalMagnet(n);let o,a,l,c=this.options.areaPadding||0;Number.isFinite(c)||(c=0),i.isEdgeElement(s)?(o=i.getBBox(),a=0,l=o.getCenter()):(o=i.getUnrotatedBBoxOfElement(s),a=t.getAngle(),l=o.getCenter(),a&&l.rotate(-a,t.getBBox().getCenter())),o.inflate(c),Ug(e,{x:-o.width/2,y:-o.height/2,width:o.width,height:o.height,transform:`translate(${l.x}, ${l.y}) rotate(${a})`})}}toggleArea(t){if(this.childNodes){const e=this.childNodes.area;e&&(e.style.display=t?"":"none")}}onMouseDown(t){this.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.options.documentEvents&&this.delegateDocumentEvents(this.options.documentEvents),this.focus(),this.toggleArea(this.options.restrictArea),this.cell.startBatch("move-anchor",{ui:!0,toolId:this.cid}))}resetAnchor(t){const e=this.type,n=this.cell;t?n.prop([e,"anchor"],t,{rewrite:!0,ui:!0,toolId:this.cid}):n.removeProp([e,"anchor"],{ui:!0,toolId:this.cid})}onMouseMove(t){const e=this.type,n=this.cellView,r=n.getTerminalView(e);if(null==r)return;const i=this.normalizeEvent(t),s=r.cell,o=n.getTerminalMagnet(e);let a=this.graph.coord.clientToLocalPoint(i.clientX,i.clientY);const l=this.options.snap;if("function"==typeof l){const t=su(l,n,a,r,o,e,n,this);a=jf.create(t)}if(this.options.restrictArea)if(r.isEdgeElement(o)){const t=r.getClosestPoint(a);t&&(a=t)}else{const t=r.getUnrotatedBBoxOfElement(o),e=s.getAngle(),n=s.getBBox().getCenter(),i=a.clone().rotate(e,n);t.containsPoint(i)||(a=t.getNearestPointToPoint(i).rotate(-e,n))}let c;const h=this.options.anchor;"function"==typeof h&&(c=su(h,n,a,r,o,e,n,this)),this.resetAnchor(c),this.update()}onMouseUp(t){this.graph.view.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);const e=this.cellView;this.options.removeRedundancies&&e.removeRedundantLinearVertices({ui:!0,toolId:this.cid}),this.cell.stopBatch("move-anchor",{ui:!0,toolId:this.cid})}onDblClick(){const t=this.options.resetAnchor;t&&this.resetAnchor(!0===t?void 0:t),this.update()}}!function(t){t.config({tagName:"g",markup:[{tagName:"circle",selector:"anchor",attrs:{cursor:"pointer"}},{tagName:"rect",selector:"area",attrs:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDblClick"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},customAnchorAttrs:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:yy,snap(t,e,n,r,i,s){const o=s.options.snapRadius||0,a="source"===r,l=a?0:-1,c=this.cell.getVertexAt(l)||this.getTerminalAnchor(a?"target":"source");return c&&(Math.abs(c.x-t.x)<o&&(t.x=c.x),Math.abs(c.y-t.y)<o&&(t.y=c.y)),t}})}(Cy||(Cy={}));const Py=Cy.define({name:"source-anchor",type:"source"}),My=Cy.define({name:"target-anchor",type:"target"});class Ey extends hy.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){const t=this.options.attrs,{class:n}=t,r=e(t,["class"]);this.setAttrs(r,this.container),n&&ug(this.container,n)}}onRender(){ug(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){const t=this.ratio,e=this.cellView,n=e.getTangentAtRatio(t),r=n?n.start:e.getPointAtRatio(t),i=n&&n.vector().vectorAngle(new jf(1,0))||0;if(!r)return this;const s=Gd().translate(r.x,r.y).rotate(i);return Qd(this.container,s,{absolute:!0}),this}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.cellView;if(e.can("arrowheadMovable")){e.cell.startBatch("move-arrowhead",{ui:!0,toolId:this.cid});const n=this.graph.snapToGrid(t.clientX,t.clientY),r=e.prepareArrowheadDragging(this.type,{x:n.x,y:n.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(t,r),this.delegateDocumentEvents(this.options.documentEvents,t.data),e.graph.view.undelegateEvents(),this.container.style.pointerEvents="none"}this.focus()}onMouseMove(t){const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY);this.cellView.onMouseMove(e,n.x,n.y),this.update()}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.cellView,r=this.graph.snapToGrid(e.clientX,e.clientY);n.onMouseUp(e,r.x,r.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents="",n.cell.stopBatch("move-arrowhead",{ui:!0,toolId:this.cid})}}!function(t){t.config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}})}(Ey||(Ey={}));const Sy=Ey.define({name:"source-arrowhead",type:"source",ratio:0,attrs:{d:"M 10 -8 -10 0 10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}}),Oy=Ey.define({name:"target-arrowhead",type:"target",ratio:1,attrs:{d:"M -10 -8 10 0 -10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});class Ty extends hy.ToolItem{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){const t=this.cellView;t&&t.on("cell:dblclick",this.dblClick)}createElement(){const t=[this.prefixClassName((this.cell.isEdge()?"edge":"node")+"-tool-editor"),this.prefixClassName("cell-tool-editor")];this.editor=hy.createElement("div",!1),this.addClass(t,this.editor),this.editor.contentEditable="true",this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&(this.container.removeChild(this.editor),this.editor=null)}updateEditor(){const{cell:t,editor:e}=this;if(!e)return;const{style:n}=e;t.isNode()?this.updateNodeEditorTransform():t.isEdge()&&this.updateEdgeEditorTransform();const{attrs:r}=this.options;n.fontSize=`${r.fontSize}px`,n.fontFamily=r.fontFamily,n.color=r.color,n.backgroundColor=r.backgroundColor;const i=this.getCellText()||"";return e.innerText=i,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:t,cell:e,editor:n}=this;if(!n)return;let r=jf.create(),i=20,s="",{x:o,y:a}=this.options;const{width:l,height:c}=this.options;if(void 0!==o&&void 0!==a){const t=e.getBBox();o=zu(o,t.width),a=zu(a,t.height),r=t.topLeft.translate(o,a),i=t.width-2*o}else{const t=e.getBBox();r=t.center,i=t.width-4,s="translate(-50%, -50%)"}const h=t.scale(),{style:u}=n;r=t.localToGraph(r),u.left=`${r.x}px`,u.top=`${r.y}px`,u.transform=`scale(${h.sx}, ${h.sy}) ${s}`,u.minWidth=`${i}px`,"number"==typeof l&&(u.width=`${l}px`),"number"==typeof c&&(u.height=`${c}px`)}updateEdgeEditorTransform(){if(!this.event)return;const{graph:e,editor:n}=this;if(!n)return;let r=jf.create(),i=20;const{style:s}=n,o=this.event.target,a=o.parentElement;if(a&&hg(a,this.prefixClassName("edge-label"))){const e=a.getAttribute("data-index")||"0";this.labelIndex=parseInt(e,10);const n=a.getAttribute("transform"),{translation:s}=Hd(n);r=new jf(s.tx,s.ty),i=t.Util.getBBox(o).width}else{if(!this.options.labelAddable)return this;r=e.clientToLocal(jf.create(this.event.clientX,this.event.clientY));const t=this.cellView.path.closestPointLength(r);this.distance=t,this.labelIndex=-1}r=e.localToGraph(r);const l=e.scale();s.left=`${r.x}px`,s.top=`${r.y}px`,s.minWidth=`${i}px`,s.transform=`scale(${l.sx}, ${l.sy}) translate(-50%, -50%)`}onDocumentMouseUp(t){if(this.editor&&t.target!==this.editor){const t=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(""!==t?t:null),this.removeElement()}}onCellDblClick({e:t}){this.editor||(t.stopPropagation(),this.removeElement(),this.event=t,this.createElement(),this.updateEditor(),this.autoFocus(),this.delegateDocumentEvents(this.options.documentEvents))}onMouseDown(t){t.stopPropagation()}autoFocus(){setTimeout((()=>{this.editor&&(this.editor.focus(),this.selectText())}))}selectText(){if(window.getSelection&&this.editor){const t=document.createRange(),e=window.getSelection();t.selectNodeContents(this.editor),e.removeAllRanges(),e.addRange(t)}}getCellText(){const{getText:t}=this.options;if("function"==typeof t)return su(t,this.cellView,{cell:this.cell,index:this.labelIndex});if("string"==typeof t){if(this.cell.isNode())return this.cell.attr(t);if(this.cell.isEdge()&&-1!==this.labelIndex)return this.cell.prop(`labels/${this.labelIndex}/attrs/${t}`)}}setCellText(t){const e=this.options.setText;if("function"!=typeof e){if("string"==typeof e){if(this.cell.isNode())return void(null!==t&&this.cell.attr(e,t));if(this.cell.isEdge()){const n=this.cell;if(-1===this.labelIndex){if(t){const r={position:{distance:this.distance},attrs:{}};xu(r,`attrs/${e}`,t),n.appendLabel(r)}}else null!==t?n.prop(`labels/${this.labelIndex}/attrs/${e}`,t):"number"==typeof this.labelIndex&&n.removeLabelAt(this.labelIndex)}}}else su(e,this.cellView,{cell:this.cell,value:t,index:this.labelIndex,distance:this.distance})}onRemove(){const t=this.cellView;t&&t.off("cell:dblclick",this.dblClick),this.removeElement()}}var ky,Ny;!function(t){t.config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}})}(Ty||(Ty={})),function(t){t.NodeEditor=t.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),t.EdgeEditor=t.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"})}(Ty||(Ty={})),function(t){t.presets={boundary:xy,button:by,"button-remove":by.Remove,"node-editor":Ty.NodeEditor},t.registry=np.create({type:"node tool",process(t,n){if("function"==typeof n)return n;let r=hy.ToolItem;const{inherit:i}=n,s=e(n,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):r=t}return null==s.name&&(s.name=t),r.define.call(r,s)}}),t.registry.register(t.presets,!0)}(ky||(ky={})),function(t){t.presets={boundary:xy,vertices:wy,segments:Ay,button:by,"button-remove":by.Remove,"source-anchor":Py,"target-anchor":My,"source-arrowhead":Sy,"target-arrowhead":Oy,"edge-editor":Ty.EdgeEditor},t.registry=np.create({type:"edge tool",process(t,n){if("function"==typeof n)return n;let r=hy.ToolItem;const{inherit:i}=n,s=e(n,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):r=t}return null==s.name&&(s.name=t),r.define.call(r,s)}}),t.registry.register(t.presets,!0)}(Ny||(Ny={}));const jy=$y("center"),_y=$y("topCenter"),Ly=$y("bottomCenter"),By=$y("leftMiddle"),Iy=$y("rightMiddle"),Dy=$y("topLeft"),Ry=$y("topRight"),Vy=$y("bottomLeft"),zy=$y("bottomRight");function $y(t){return function(e,n,r,i={}){let s;s=e.cell.visible?i.rotate?e.getUnrotatedBBoxOfElement(n):e.getBBoxOfElement(n):e.cell.getBBox();const o=s[t];o.x+=zu(i.dx,s.width),o.y+=zu(i.dy,s.height);const a=e.cell;return i.rotate?o.rotate(-a.getAngle(),a.getBBox().getCenter()):o}}function Fy(t){return function(e,n,r,i){if(r instanceof Element){const s=this.graph.findViewByElem(r);let o;if(s)if(s.isEdgeElement(r)){o=Gy(s,null!=i.fixedAt?i.fixedAt:"50%")}else o=s.getBBoxOfElement(r).getCenter();else o=new jf;return t.call(this,e,n,o,i)}return t.apply(this,arguments)}}function Gy(t,e){const n=Vu(e),r="string"==typeof e?parseFloat(e):e;return n?t.getPointAtRatio(r/100):t.getPointAtLength(r)}const Uy=Fy((function(e,n,r,i){const s=t.Angle.normalize(e.cell.getAngle()),o=e.cell.visible?e.getBBoxOfElement(n):e.cell.getBBox(),a=o.getCenter(),l=o.getTopLeft(),c=o.getBottomRight();let h=i.padding;if(Number.isFinite(h)||(h=0),l.y+h<=r.y&&r.y<=c.y-h){const e=r.y-a.y;a.x+=0===s||180===s?0:1*e/Math.tan(t.Angle.toRad(s)),a.y+=e}else if(l.x+h<=r.x&&r.x<=c.x-h){const e=r.x-a.x;a.y+=90===s||270===s?0:e*Math.tan(t.Angle.toRad(s)),a.x+=e}return a})),qy=Fy((function(t,e,n,r){let i,s,o=0;const a=t.cell;r.rotate?(i=t.getUnrotatedBBoxOfElement(e),s=a.getBBox().getCenter(),o=a.getAngle()):i=a.visible?t.getBBoxOfElement(e):t.cell.getBBox();const l=r.padding;null!=l&&Number.isFinite(l)&&i.inflate(l),r.rotate&&n.rotate(o,s);const c=i.getNearestSideToPoint(n);let h;switch(c){case"left":h=i.getLeftMiddle();break;case"right":h=i.getRightMiddle();break;case"top":h=i.getTopCenter();break;case"bottom":h=i.getBottomCenter()}const u=r.direction;return"H"===u?"top"!==c&&"bottom"!==c||(h=n.x<=i.x+i.width?i.getLeftMiddle():i.getRightMiddle()):"V"===u&&(h=n.y<=i.y+i.height?i.getTopCenter():i.getBottomCenter()),r.rotate?h.rotate(-o,s):h}));var Wy,Hy=Object.freeze({__proto__:null,bottom:Ly,bottomLeft:Vy,bottomRight:zy,center:jy,left:By,midSide:qy,nodeCenter:function(t,e,n,r,i){const s=t.cell.getConnectionPoint(this.cell,i);return(r.dx||r.dy)&&s.translate(r.dx||0,r.dy||0),s},orth:Uy,right:Iy,top:_y,topLeft:Dy,topRight:Ry});!function(t){t.presets=Hy,t.registry=np.create({type:"node endpoint"}),t.registry.register(t.presets,!0)}(Wy||(Wy={}));const Jy=function(t,e,n,r){const i=t.getClosestPoint(n);return null!=i?i:new jf},Xy=Fy(Jy),Yy=Fy((function(t,e,n,r){const i=1e6,s=t.getConnection(),o=t.getConnectionSubdivisions(),a=new Lf(n.clone().translate(0,i),n.clone().translate(0,-i)),l=new Lf(n.clone().translate(i,0),n.clone().translate(-i,0)),c=a.intersect(s,{segmentSubdivisions:o}),h=l.intersect(s,{segmentSubdivisions:o}),u=[];return c&&u.push(...c),h&&u.push(...h),u.length>0?n.closest(u):null!=r.fallbackAt?Gy(t,r.fallbackAt):su(Jy,this,t,e,n,r)}));var Zy,Ky=Object.freeze({__proto__:null,closest:Xy,length:function(t,e,n,r){const i=null!=r.length?r.length:20;return t.getPointAtLength(i)},orth:Yy,ratio:function(t,e,n,r){let i=null!=r.ratio?r.ratio:.5;return i>1&&(i/=100),t.getPointAtRatio(i)}});function Qy(t,e,n){let r;if("object"==typeof n){if(Number.isFinite(n.y)){const r=new Lf(e,t),{start:i,end:s}=r.parallel(n.y);e=i,t=s}r=n.x}else r=n;if(null==r||!Number.isFinite(r))return t;const i=t.distance(e);return 0===r&&i>0?t:t.move(e,-Math.min(r,i-1))}function tv(t){const e=t.getAttribute("stroke-width");return null===e?0:parseFloat(e)||0}!function(t){t.presets=Ky,t.registry=np.create({type:"edge endpoint"}),t.registry.register(t.presets,!0)}(Zy||(Zy={}));const ev=function(t,e,n,r){const i=e.getBBoxOfElement(n);r.stroked&&i.inflate(tv(n)/2);const s=t.intersect(i);return Qy(s&&s.length?t.start.closest(s):t.end,t.start,r.offset)};var nv,rv=Object.freeze({__proto__:null,anchor:function(t,e,n,r){const{alignOffset:i,align:s}=r;return s&&function(t,e,n=0){const{start:r,end:i}=t;let s,o,a,l;switch(e){case"left":l="x",s=i,o=r,a=-1;break;case"right":l="x",s=r,o=i,a=1;break;case"top":l="y",s=i,o=r,a=-1;break;case"bottom":l="y",s=r,o=i,a=1;break;default:return}r[l]<i[l]?s[l]=o[l]:o[l]=s[l],Number.isFinite(n)&&(s[l]+=a*n,o[l]+=a*n)}(t,s,i),Qy(t.end,t.start,r.offset)},bbox:ev,boundary:function(e,n,r,i){let s,o;const a=e.end,l=i.selector;if(s="string"==typeof l?n.findOne(l):Array.isArray(l)?bu(r,l):function(t){if(null==t)return null;let e=t;do{let t=e.tagName;if("string"!=typeof t)return null;if(t=t.toUpperCase(),"G"===t)e=e.firstElementChild;else{if("TITLE"!==t)break;e=e.nextElementSibling}}while(e);return e}(r),!yg(s)){if(s===r||!yg(r))return a;s=r}const c=n.getShapeOfElement(s),h=n.getMatrixOfElement(s),u=n.getRootTranslatedMatrix(),g=n.getRootRotatedMatrix(),d=u.multiply(g).multiply(h),f=d.inverse(),p=t.Util.transformLine(e,f),m=p.start.clone(),y=n.getDataOfElement(s);if(!1===i.insideout){null==y.shapeBBox&&(y.shapeBBox=c.bbox());const t=y.shapeBBox;if(null!=t&&t.containsPoint(m))return a}let v;if(!0===i.extrapolate&&p.setLength(1e6),ep.isPath(c)){const t=i.precision||2;null==y.segmentSubdivisions&&(y.segmentSubdivisions=c.getSegmentSubdivisions({precision:t})),v={precision:t,segmentSubdivisions:y.segmentSubdivisions},o=p.intersect(c,v)}else o=p.intersect(c);o?Array.isArray(o)&&(o=m.closest(o)):!0===i.sticky&&(o=_f.isRectangle(c)?c.getNearestPointToPoint(m):Bf.isEllipse(c)?c.intersectsWithLineFromCenterToPoint(m):c.closestPoint(m,v));const b=o?t.Util.transformPoint(o,d):a;let x=i.offset||0;return!1!==i.stroked&&("object"==typeof x?(x=Object.assign({},x),null==x.x&&(x.x=0),x.x+=tv(s)/2):x+=tv(s)/2),Qy(b,e.start,x)},rect:function(t,e,n,r,i){const s=e.cell,o=s.isNode()?s.getAngle():0;if(0===o)return su(ev,this,t,e,n,r,i);const a=e.getUnrotatedBBoxOfElement(n);r.stroked&&a.inflate(tv(n)/2);const l=a.getCenter(),c=t.clone().rotate(o,l),h=c.setLength(1e6).intersect(a);return Qy(h&&h.length?c.start.closest(h).rotate(-o,l):t.end,t.start,r.offset)}});!function(t){t.presets=rv,t.registry=np.create({type:"connection point"}),t.registry.register(t.presets,!0)}(nv||(nv={}));function iv(t){return new _f(t.x,t.y,0,0)}function sv(t={}){const e=$u(t.padding||20);return{x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}function ov(t,e={}){return t.sourceBBox.clone().moveAndExpand(sv(e))}function av(t,e={}){return t.targetBBox.clone().moveAndExpand(sv(e))}const lv=function(t,e,n){let r=ov(n,e),i=av(n,e);const s=function(t,e={}){return t.sourceAnchor?t.sourceAnchor:ov(t,e).getCenter()}(n,e),o=function(t,e={}){return t.targetAnchor?t.targetAnchor:av(t,e).getCenter()}(n,e);r=r.union(iv(s)),i=i.union(iv(o));const a=t.map((t=>jf.create(t)));a.unshift(s),a.push(o);let l=null;const c=[];for(let t=0,n=a.length-1;t<n;t+=1){let s=null;const o=a[t],h=a[t+1],u=null!=cv.getBearing(o,h);if(0===t)t+1===n?r.intersectsWithRect(i.clone().inflate(1))?s=cv.insideNode(o,h,r,i):u||(s=cv.nodeToNode(o,h,r,i)):r.containsPoint(h)?s=cv.insideNode(o,h,r,iv(h).moveAndExpand(sv(e))):u||(s=cv.nodeToVertex(o,h,r));else if(t+1===n){const t=u&&cv.getBearing(h,o)===l;i.containsPoint(o)||t?s=cv.insideNode(o,h,iv(o).moveAndExpand(sv(e)),i,l):u||(s=cv.vertexToNode(o,h,i,l))}else u||(s=cv.vertexToVertex(o,h,l));s?(c.push(...s.points),l=s.direction):l=cv.getBearing(o,h),t+1<n&&c.push(h)}return c};var cv;!function(e){const n={N:"S",S:"N",E:"W",W:"E"},r={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function i(t,e,n){let r=new jf(t.x,e.y);return n.containsPoint(r)&&(r=new jf(e.x,t.y)),r}function s(t,e){return t["W"===e||"E"===e?"width":"height"]}function o(t,e){return t.x===e.x?t.y>e.y?"N":"S":t.y===e.y?t.x>e.x?"W":"E":null}function a(t,e,r){const i=new jf(t.x,e.y),s=new jf(e.x,t.y),a=o(t,i),l=o(t,s),c=r?n[r]:null,h=a===r||a!==c&&(l===c||l!==r)?i:s;return{points:[h],direction:o(h,e)}}function l(t,e,n){const r=i(t,e,n);return{points:[r],direction:o(r,e)}}e.getBBoxSize=s,e.getBearing=o,e.vertexToVertex=a,e.nodeToVertex=l,e.vertexToNode=function(t,e,n,r){const a=[new jf(t.x,e.y),new jf(e.x,t.y)],l=a.filter((t=>!n.containsPoint(t))),c=l.filter((e=>o(e,t)!==r));let h;if(c.length>0)return h=c.filter((e=>o(t,e)===r)).pop(),h=h||c[0],{points:[h],direction:o(h,e)};{h=Zs(a,l)[0];const c=jf.create(e).move(h,-s(n,r)/2);return{points:[i(c,t,n),c],direction:o(c,e)}}},e.nodeToNode=function(t,e,n,r){let i=l(e,t,r);const c=i.points[0];if(n.containsPoint(c)){i=l(t,e,n);const h=i.points[0];if(r.containsPoint(h)){const u=jf.create(t).move(h,-s(n,o(t,h))/2),g=jf.create(e).move(c,-s(r,o(e,c))/2),d=new Lf(u,g).getCenter(),f=l(t,d,n),p=a(d,e,f.direction);i.points=[f.points[0],p.points[0]],i.direction=p.direction}}return i},e.insideNode=function(e,n,s,a,l){const c=s.union(a).inflate(1),h=c.getCenter(),u=h.distance(n)>h.distance(e),g=u?n:e,d=u?e:n;let f,p,m,y;return l?(f=jf.fromPolar(c.width+c.height,r[l],g),f=c.getNearestPointToPoint(f).move(f,-1)):f=c.getNearestPointToPoint(g).move(g,1),p=i(f,d,c),f.round().equals(p.round())?(p=jf.fromPolar(c.width+c.height,t.Angle.toRad(f.theta(g))+Math.PI/2,d),p=c.getNearestPointToPoint(p).move(d,1).round(),m=i(f,p,c),y=u?[p,m,f]:[f,m,p]):y=u?[p,f]:[f,p],{points:y,direction:o(u?f:p,n)}}}(cv||(cv={}));const hv={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost(){return uv(this.step,this)},directions(){const t=uv(this.step,this),e=uv(this.cost,this);return[{cost:e,offsetX:t,offsetY:0},{cost:e,offsetX:-t,offsetY:0},{cost:e,offsetX:0,offsetY:t},{cost:e,offsetX:0,offsetY:-t}]},penalties(){const t=uv(this.step,this);return{0:0,45:t/2,90:t/2}},paddingBox(){const t=uv(this.step,this);return{x:-t,y:-t,width:2*t,height:2*t}},fallbackRouter:lv,draggingRouter:null,snapToGrid:!0};function uv(t,e){return"function"==typeof t?t.call(e):t}class gv{constructor(){this.items=[],this.hash={},this.values={}}add(t,e){this.hash[t]?this.items.splice(this.items.indexOf(t),1):this.hash[t]=1,this.values[t]=e;const n=jc(this.items,t,(t=>this.values[t]));this.items.splice(n,0,t)}pop(){const t=this.items.shift();return t&&(this.hash[t]=2),t}isOpen(t){return 1===this.hash[t]}isClose(t){return 2===this.hash[t]}isEmpty(){return 0===this.items.length}}class dv{constructor(t){this.options=t,this.mapGridSize=100,this.map={}}build(t,e){const n=this.options,r=n.excludeTerminals.reduce(((n,r)=>{const i=e[r];if(i){const e=t.getCell(i.cell);e&&n.push(e)}return n}),[]);let i=[];const s=t.getCell(e.getSourceCellId());s&&(i=fh(i,s.getAncestors().map((t=>t.id))));const o=t.getCell(e.getTargetCellId());o&&(i=fh(i,o.getAncestors().map((t=>t.id))));const a=this.mapGridSize;return t.getNodes().reduce(((t,e)=>{const s=r.some((t=>t.id===e.id)),o=!!e.shape&&n.excludeShapes.includes(e.shape),l=n.excludeNodes.some((t=>"string"==typeof t?e.id===t:t===e)),c=i.includes(e.id),h=o||s||l||c;if(e.isVisible()&&!h){const r=e.getBBox().moveAndExpand(n.paddingBox),i=r.getOrigin().snapToGrid(a),s=r.getCorner().snapToGrid(a);for(let e=i.x;e<=s.x;e+=a)for(let n=i.y;n<=s.y;n+=a){const i=new jf(e,n).toString();null==t[i]&&(t[i]=[]),t[i].push(r)}}return t}),this.map),this}isAccessible(t){const e=t.clone().snapToGrid(this.mapGridSize).toString(),n=this.map[e];return!n||n.every((e=>!e.containsPoint(t)))}}function fv(t,e){const n=t.sourceBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function pv(t,e){const n=t.targetBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function mv(t,e){if(t.sourceAnchor)return t.sourceAnchor;return fv(t,e).getCenter()}function yv(e,n,r,i,s){const o=360/r,a=e.theta(function(t,e,n,r){const i=r.step,s=e.x-t.x,o=e.y-t.y,a=s/n.x,l=o/n.y,c=a*i,h=l*i;return new jf(t.x+c,t.y+h)}(e,n,i,s)),l=t.Angle.normalize(a+o/2);return o*Math.floor(l/o)}function vv(t,e){const n=Math.abs(t-e);return n>180?360-n:n}function bv(t,e){if(!t)return e;const n=Math.abs(t),r=Math.round(n/e);if(!r)return n;return e+(n-r*e)/r}function xv(t,e){return t.round(e)}function wv(e,n,r){return xv(function(e,n){const r=n.source,i=t.GeometryUtil.snapToGrid(e.x-r.x,n.x)+r.x,s=t.GeometryUtil.snapToGrid(e.y-r.y,n.y)+r.y;return new jf(i,s)}(e.clone(),n),r)}function Av(t){return t.toString()}function Cv(t){return new jf(0===t.x?0:Math.abs(t.x)/t.x,0===t.y?0:Math.abs(t.y)/t.y)}function Pv(t,e){let n=1/0;for(let r=0,i=e.length;r<i;r+=1){const i=t.manhattanDistance(e[r]);i<n&&(n=i)}return n}function Mv(t,e,n,r,i){const s=i.precision,o=i.directionMap,a=t.diff(e.getCenter()),l=Object.keys(o).reduce(((i,l)=>{if(n.includes(l)){const n=o[l],c=new jf(t.x+n.x*(Math.abs(a.x)+e.width),t.y+n.y*(Math.abs(a.y)+e.height)),h=new Lf(t,c).intersect(e)||[];let u,g=null;for(let e=0;e<h.length;e+=1){const n=h[e],r=t.squaredDistance(n);(null==u||r>u)&&(u=r,g=n)}if(g){let t=wv(g,r,s);e.containsPoint(t)&&(t=wv(t.translate(n.x*r.x,n.y*r.y),r,s)),i.push(t)}}return i}),[]);return e.containsPoint(t)||l.push(wv(t,r,s)),l}function Ev(t,e,n,r,i){const s=[];let o,a=Cv(i.diff(n)),l=Av(n),c=t[l];for(;c;){o=e[l];const n=Cv(o.diff(c));n.equals(a)||(s.unshift(o),a=n),l=Av(c),c=t[l]}const h=e[l];return Cv(h.diff(r)).equals(a)||s.unshift(h),s}function Sv(t,e,n,r,i){const s=i.precision;let o,a;o=_f.isRectangle(e)?xv(mv(t,i).clone(),s):xv(e.clone(),s),a=_f.isRectangle(n)?xv(function(t,e){return t.targetAnchor?t.targetAnchor:pv(t,e).getCenter()}(t,i).clone(),s):xv(n.clone(),s);const l=function(t,e,n){return{source:e.clone(),x:bv(n.x-e.x,t),y:bv(n.y-e.y,t)}}(i.step,o,a),c=o,h=a;let u,g;if(u=_f.isRectangle(e)?Mv(c,e,i.startDirections,l,i):[c],g=_f.isRectangle(n)?Mv(a,n,i.endDirections,l,i):[h],u=u.filter((t=>r.isAccessible(t))),g=g.filter((t=>r.isAccessible(t))),u.length>0&&g.length>0){const t=new gv,e={},n={},o={};for(let n=0,r=u.length;n<r;n+=1){const r=u[n],i=Av(r);t.add(i,Pv(r,g)),e[i]=r,o[i]=0}const a=i.previousDirectionAngle,d=void 0===a;let f,p;const m=function(t,e){const n=e.step;return e.directions.forEach((e=>{e.gridOffsetX=e.offsetX/n*t.x,e.gridOffsetY=e.offsetY/n*t.y})),e.directions}(l,i),y=m.length,v=g.reduce(((t,e)=>{const n=Av(e);return t.push(n),t}),[]),b=jf.equalPoints(u,g);let x=i.maxLoopCount;for(;!t.isEmpty()&&x>0;){const u=t.pop(),w=e[u],A=n[u],C=o[u],P=w.equals(c),M=null==A;let E;E=M?d?P?null:yv(c,w,y,l,i):a:yv(A,w,y,l,i);if(!(M&&b)&&v.indexOf(u)>=0)return i.previousDirectionAngle=E,Ev(n,e,w,c,h);for(let a=0;a<y;a+=1){f=m[a];const c=f.angle;if(p=vv(E,c),(!d||!P)&&p>i.maxDirectionChange)continue;const u=wv(w.clone().translate(f.gridOffsetX||0,f.gridOffsetY||0),l,s),b=Av(u);if(t.isClose(b)||!r.isAccessible(u))continue;if(v.indexOf(b)>=0){if(!u.equals(h)){if(vv(c,yv(u,h,y,l,i))>i.maxDirectionChange)continue}}const x=C+f.cost+(P?0:i.penalties[p]);(!t.isOpen(b)||x<o[b])&&(e[b]=u,n[b]=w,o[b]=x,t.add(b,x+Pv(u,g)))}x-=1}}return i.fallbackRoute?su(i.fallbackRoute,this,c,h,i):null}const Ov=function(e,n,r){const i=function(e){const n=Object.keys(e).reduce(((t,n)=>(t[n]="fallbackRouter"===n||"draggingRouter"===n||"fallbackRoute"===n?e[n]:uv(e[n],e),t)),{});if(n.padding){const t=$u(n.padding);n.paddingBox={x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}return n.directions.forEach((e=>{const n=new jf(0,0),r=new jf(e.offsetX,e.offsetY);e.angle=t.Angle.normalize(n.theta(r))})),n}(n),s=fv(r,i),o=pv(r,i),a=mv(r,i),l=new dv(i).build(r.graph.model,r.cell),c=e.map((t=>jf.create(t))),h=[];let u,g,d=a;for(let t=0,n=c.length;t<=n;t+=1){let n=null;if(u=g||s,g=c[t],null==g){g=o;const t=r.cell;if((null==t.getSourceCellId()||null==t.getTargetCellId())&&"function"==typeof i.draggingRouter){const t=u===s?a:u,e=g.getOrigin();n=su(i.draggingRouter,r,t,e,i)}}if(null==n&&(n=Sv(r,u,g,l,i)),null===n)return console.warn("Unable to execute manhattan algorithm, use orth instead"),su(i.fallbackRouter,this,e,i,r);const f=n[0];f&&f.equals(d)&&n.shift(),d=n[n.length-1]||d,h.push(...n)}return i.snapToGrid?function(t,e=10){if(t.length<=1)return t;for(let n=0,r=t.length;n<r-1;n+=1){const r=t[n],i=t[n+1];if(r.x===i.x){const t=e*Math.round(r.x/e);r.x!==t&&(r.x=t,i.x=t)}else if(r.y===i.y){const t=e*Math.round(r.y/e);r.y!==t&&(r.y=t,i.y=t)}}return t}(h,r.graph.grid.getGridSize()):h},Tv=function(t,e,n){return su(Ov,this,t,Object.assign(Object.assign({},hv),e),n)},kv={maxDirectionChange:45,directions(){const t=uv(this.step,this),e=uv(this.cost,this),n=Math.ceil(Math.sqrt(t*t<<1));return[{cost:e,offsetX:t,offsetY:0},{cost:n,offsetX:t,offsetY:t},{cost:e,offsetX:0,offsetY:t},{cost:n,offsetX:-t,offsetY:t},{cost:e,offsetX:-t,offsetY:0},{cost:n,offsetX:-t,offsetY:-t},{cost:e,offsetX:0,offsetY:-t},{cost:n,offsetX:t,offsetY:-t}]},fallbackRoute(e,n,r){const i=e.theta(n),s=[];let o={x:n.x,y:e.y},a={x:e.x,y:n.y};if(i%180>90){const t=o;o=a,a=t}const l=i%90<45?o:a,c=new Lf(e,l),h=90*Math.ceil(i/90),u=jf.fromPolar(c.squaredLength(),t.Angle.toRad(h+135),l),g=new Lf(n,u),d=c.intersectsWithLine(g),f=d||n,p=d?f:e,m=360/r.directions.length,y=p.theta(n),v=t.Angle.normalize(y+m/2),b=m*Math.floor(v/m);return r.previousDirectionAngle=b,f&&s.push(f.round()),s.push(n),s}};function Nv(t,e){if(null!=e&&!1!==e){const n="boolean"==typeof e?0:e;if(n>0){const e=jf.create(t[1]).move(t[2],n),r=jf.create(t[1]).move(t[0],n);return[e.toJSON(),...t,r.toJSON()]}{const e=t[1];return[Object.assign({},e),...t,Object.assign({},e)]}}return t}var jv,_v=Object.freeze({__proto__:null,er:function(t,e,n){const r=e.offset||32,i=null==e.min?16:e.min;let s=0,o=e.direction;const a=n.sourceBBox,l=n.targetBBox,c=a.getCenter(),h=l.getCenter();if("number"==typeof r&&(s=r),null==o){let t=l.left-a.right,e=l.top-a.bottom;t>=0&&e>=0?o=t>=e?"L":"T":t<=0&&e>=0?(t=a.left-l.right,o=t>=0&&t>=e?"R":"T"):t>=0&&e<=0?(e=a.top-l.bottom,o=e>=0?t>=e?"L":"B":"L"):(t=a.left-l.right,e=a.top-l.bottom,o=t>=0&&e>=0?t>=e?"R":"B":t<=0&&e>=0?"B":t>=0&&e<=0||Math.abs(t)>Math.abs(e)?"R":"B")}let u,g,d;"H"===o?o=h.x-c.x>=0?"L":"R":"V"===o&&(o=h.y-c.y>=0?"T":"B"),"center"===r&&("L"===o?s=(l.left-a.right)/2:"R"===o?s=(a.left-l.right)/2:"T"===o?s=(l.top-a.bottom)/2:"B"===o&&(s=(a.top-l.bottom)/2));const f="L"===o||"R"===o;if(f){if(h.y===c.y)return[...t];d="L"===o?1:-1,u="x",g="width"}else{if(h.x===c.x)return[...t];d="T"===o?1:-1,u="y",g="height"}const p=c.clone(),m=h.clone();if(p[u]+=d*(a[g]/2+s),m[u]-=d*(l[g]/2+s),f){const t=p.x,e=m.x,n=a.width/2+i,r=l.width/2+i;h.x>c.x?e<=t&&(p.x=Math.max(e,c.x+n),m.x=Math.min(t,h.x-r)):e>=t&&(p.x=Math.min(e,c.x-n),m.x=Math.max(t,h.x+r))}else{const t=p.y,e=m.y,n=a.height/2+i,r=l.height/2+i;h.y>c.y?e<=t&&(p.y=Math.max(e,c.y+n),m.y=Math.min(t,h.y-r)):e>=t&&(p.y=Math.min(e,c.y-n),m.y=Math.max(t,h.y+r))}return[p.toJSON(),...t,m.toJSON()]},loop:function(e,n,r){const i=n.width||50,s=(n.height||80)/2,o=n.angle||"auto",a=r.sourceAnchor,l=r.targetAnchor,c=r.sourceBBox,h=r.targetBBox;if(a.equals(l)){const e=e=>{const n=t.Angle.toRad(e),r=Math.sin(n),o=Math.cos(n),l=new jf(a.x+o*i,a.y+r*i),c=new jf(l.x-o*s,l.y-r*s),h=c.clone().rotate(-90,l),u=c.clone().rotate(90,l);return[h.toJSON(),l.toJSON(),u.toJSON()]},r=t=>{const e=a.clone().move(t,-1),n=new Lf(e,t);return!c.containsPoint(t)&&!c.intersectsWithLine(n)},l=[0,90,180,270,45,135,225,315];if("number"==typeof o)return Nv(e(o),n.merge);const h=c.getCenter();if(h.equals(a))return Nv(e(0),n.merge);const u=h.angleBetween(a,h.clone().translate(1,0));let g=e(u);if(r(g[1]))return Nv(g,n.merge);for(let t=1,i=l.length;t<i;t+=1)if(g=e(u+l[t]),r(g[1]))return Nv(g,n.merge);return Nv(g,n.merge)}{const t=new Lf(a,l);let e=t.parallel(-i),o=e.getCenter(),u=e.start.clone().move(e.end,s),g=e.end.clone().move(e.start,s);const d=t.parallel(-1),f=new Lf(d.start,o),p=new Lf(d.end,o);if((c.containsPoint(o)||h.containsPoint(o)||c.intersectsWithLine(f)||c.intersectsWithLine(p)||h.intersectsWithLine(f)||h.intersectsWithLine(p))&&(e=t.parallel(i),o=e.getCenter(),u=e.start.clone().move(e.end,s),g=e.end.clone().move(e.start,s)),n.merge){const t=new Lf(a,l),e=new Lf(o,t.center).setLength(Number.MAX_SAFE_INTEGER),n=c.intersectsWithLine(e),i=h.intersectsWithLine(e),s=n?Array.isArray(n)?n:[n]:[];i&&(Array.isArray(i)?s.push(...i):s.push(i));const u=t.center.closest(s);u?(r.sourceAnchor=u.clone(),r.targetAnchor=u.clone()):(r.sourceAnchor=t.center.clone(),r.targetAnchor=t.center.clone())}return Nv([u.toJSON(),o.toJSON(),g.toJSON()],n.merge)}},manhattan:Tv,metro:function(t,e,n){return su(Tv,this,t,Object.assign(Object.assign({},kv),e),n)},normal:function(t){return[...t]},oneSide:function(t,e,n){const r=e.side||"bottom",i=$u(e.padding||40),s=n.sourceBBox,o=n.targetBBox,a=s.getCenter(),l=o.getCenter();let c,h,u;switch(r){case"top":u=-1,c="y",h="height";break;case"left":u=-1,c="x",h="width";break;case"right":u=1,c="x",h="width";break;default:u=1,c="y",h="height"}return a[c]+=u*(s[h]/2+i[r]),l[c]+=u*(o[h]/2+i[r]),u*(a[c]-l[c])>0?l[c]=a[c]:a[c]=l[c],[a.toJSON(),...t,l.toJSON()]},orth:lv});!function(t){t.presets=_v,t.registry=np.create({type:"router"}),t.registry.register(t.presets,!0)}(jv||(jv={}));const Lv=1/3,Bv=2/3;function Iv(t,e,n=[]){const r=[t,...n,e],i=[];return r.forEach(((t,e)=>{const n=r[e+1];null!=n&&i.push(new Lf(t,n))})),i}function Dv(t,e){return new Lf(t,e).squaredLength()}function Rv(t,e,n,r){const i=new ep;let s;return s=ep.createSegment("M",t[0].start),i.appendSegment(s),t.forEach(((o,a)=>{if(Vv.includes(o)){let t,r,a,l;if("arc"===n){t=-90,r=o.start.diff(o.end);(r.x<0||0===r.x&&r.y<0)&&(t+=180);const e=o.getCenter(),n=new Lf(e,o.end).rotate(t,e);let c;c=new Lf(o.start,e),a=c.pointAt(2/3).rotate(t,o.start),l=n.pointAt(1/3).rotate(-t,n.end),s=ep.createSegment("C",a,l,n.end),i.appendSegment(s),c=new Lf(e,o.end),a=n.pointAt(1/3).rotate(t,n.end),l=c.pointAt(1/3).rotate(-t,o.end),s=ep.createSegment("C",a,l,o.end),i.appendSegment(s)}else if("gap"===n)s=ep.createSegment("M",o.end),i.appendSegment(s);else if("cubic"===n){t=o.start.theta(o.end);const n=.6*e;let c=1.35*e;r=o.start.diff(o.end);(r.x<0||0===r.x&&r.y<0)&&(c*=-1),a=new jf(o.start.x+n,o.start.y+c).rotate(t,o.start),l=new jf(o.end.x-n,o.end.y+c).rotate(t,o.end),s=ep.createSegment("C",a,l,o.end),i.appendSegment(s)}}else{const e=t[a+1];0===r||!e||Vv.includes(e)?(s=ep.createSegment("L",o.end),i.appendSegment(s)):function(t,e,n,r,i){const s=n.distance(r)/2,o=n.distance(i)/2,a=-Math.min(t,s),l=-Math.min(t,o),c=n.clone().move(r,a).round(),h=n.clone().move(i,l).round(),u=new jf(Lv*c.x+Bv*n.x,Bv*n.y+Lv*c.y),g=new jf(Lv*h.x+Bv*n.x,Bv*n.y+Lv*h.y);let d;d=ep.createSegment("L",c),e.appendSegment(d),d=ep.createSegment("C",u,g,h),e.appendSegment(d)}(r,i,o.end,o.start,e.end)}})),i}let Vv,zv;var $v,Fv=Object.freeze({__proto__:null,jumpover:function(t,e,n,r={}){Vv=[],zv=[],function(t){let e=t.graph._jumpOverUpdateList;if(null==e&&(e=t.graph._jumpOverUpdateList=[],t.graph.on("cell:mouseup",(()=>{const e=t.graph._jumpOverUpdateList;setTimeout((()=>{for(let t=0;t<e.length;t+=1)e[t].update()}))})),t.graph.on("model:reseted",(()=>{e=t.graph._jumpOverUpdateList=[]}))),e.indexOf(t)<0){e.push(t);const n=()=>e.splice(e.indexOf(t),1);t.cell.once("change:connector",n),t.cell.once("removed",n)}}(this);const i=r.size||5,s=r.type||"arc",o=r.radius||0,a=r.ignoreConnectors||["smooth"],l=this.graph,c=l.model.getEdges();if(1===c.length)return Rv(Iv(t,e,n),i,s,o);const h=this.cell,u=c.indexOf(h),g=l.options.connecting.connector||{},d=c.filter(((t,e)=>{const n=t.getConnector()||g;return!a.includes(n.name)&&(!(e>u)||"jumpover"!==n.name)})),f=d.map((t=>l.findViewByCell(t))),p=Iv(t,e,n),m=f.map((t=>null==t?[]:t===this?p:Iv(t.sourcePoint,t.targetPoint,t.routePoints))),y=[];p.forEach((t=>{const e=d.reduce(((e,n,r)=>{if(n!==h){const n=function(t,e){const n=[];return e.forEach((e=>{const r=t.intersectsWithLine(e);if(r){const{x:t,y:i}=r,{start:s,end:o}=e,a=Math.round(s.x)===Math.round(t)&&Math.round(s.y)===Math.round(i),l=Math.round(o.x)===Math.round(t)&&Math.round(o.y)===Math.round(i);if(a||l)return;n.push(r)}})),n}(t,m[r]);e.push(...n)}return e}),[]).sort(((e,n)=>Dv(t.start,e)-Dv(t.start,n)));e.length>0?y.push(...function(t,e,n){return e.reduce(((r,i,s)=>{if(zv.includes(i))return r;const o=r.pop()||t,a=jf.create(i).move(o.start,-n);let l=jf.create(i).move(o.start,+n);const c=e[s+1];if(null!=c){const t=l.distance(c);t<=n&&(l=c.move(o.start,t),zv.push(c))}else if(a.distance(o.end)<2*n+1)return r.push(o),r;if(l.distance(o.start)<2*n+1)return r.push(o),r;const h=new Lf(a,l);return Vv.push(h),r.push(new Lf(o.start,a),h,new Lf(l,o.end)),r}),[])}(t,e,i)):y.push(t)}));const v=Rv(y,i,s,o);return Vv=[],zv=[],r.raw?v:v.serialize()},loop:function(t,e,n,r={}){const i=3===n.length?0:1,s=jf.create(n[0+i]),o=jf.create(n[2+i]),a=jf.create(n[1+i]);if(!jf.equals(t,e)){const n=new jf((t.x+e.x)/2,(t.y+e.y)/2),r=n.angleBetween(jf.create(t).rotate(90,n),a);r>1&&(s.rotate(180-r,n),o.rotate(180-r,n),a.rotate(180-r,n))}const l=`\n M ${t.x} ${t.y}\n Q ${s.x} ${s.y} ${a.x} ${a.y}\n Q ${o.x} ${o.y} ${e.x} ${e.y}\n `;return r.raw?ep.parse(l):l},normal:function(t,e,n,r={}){const i=[t,...n,e],s=new Ff(i),o=new ep(s);return r.raw?o:o.serialize()},rounded:function(t,e,n,r={}){const i=new ep;i.appendSegment(ep.createSegment("M",t));const s=1/3,o=2/3,a=r.radius||10;let l,c;for(let r=0,h=n.length;r<h;r+=1){const h=jf.create(n[r]),u=n[r-1]||t,g=n[r+1]||e;l=c||h.distance(u)/2,c=h.distance(g)/2;const d=-Math.min(a,l),f=-Math.min(a,c),p=h.clone().move(u,d).round(),m=h.clone().move(g,f).round(),y=new jf(s*p.x+o*h.x,o*h.y+s*p.y),v=new jf(s*m.x+o*h.x,o*h.y+s*m.y);i.appendSegment(ep.createSegment("L",p)),i.appendSegment(ep.createSegment("C",y,v,m))}return i.appendSegment(ep.createSegment("L",e)),r.raw?i:i.serialize()},smooth:function(t,e,n,r={}){let i,s=r.direction;if(n&&0!==n.length){const r=[t,...n,e],s=Gf.throughPoints(r);i=new ep(s)}else if(i=new ep,i.appendSegment(ep.createSegment("M",t)),s||(s=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?"H":"V"),"H"===s){const n=(t.x+e.x)/2;i.appendSegment(ep.createSegment("C",n,t.y,n,e.y,e.x,e.y))}else{const n=(t.y+e.y)/2;i.appendSegment(ep.createSegment("C",t.x,n,e.x,n,e.x,e.y))}return r.raw?i:i.serialize()}});!function(t){t.presets=Fv,t.registry=np.create({type:"connector"}),t.registry.register(t.presets,!0)}($v||($v={}));var Gv,Uv=Object.freeze({__proto__:null,get Attr(){return jm},get Background(){return gp},get ConnectionPoint(){return nv},get Connector(){return $v},get EdgeAnchor(){return Zy},get EdgeTool(){return Ny},get Filter(){return mp},get Grid(){return lp},get Highlighter(){return Fm},get Marker(){return mm},get NodeAnchor(){return Wy},get NodeTool(){return ky},get PortLabelLayout(){return ny},get PortLayout(){return Jm},get Registry(){return np},get Router(){return jv}});class qv extends Pu{constructor(t={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(Ui(t)),this.changed={}}mutate(t,e={}){const n=!0===e.unset,r=!0===e.silent,i=[],s=this.changing;this.changing=!0,s||(this.previous=Ui(this.data),this.changed={});const o=this.data,a=this.previous,l=this.changed;if(Object.keys(t).forEach((e=>{const r=e,s=t[r];Oa(o[r],s)||i.push(r),Oa(a[r],s)?delete l[r]:l[r]=s,n?delete o[r]:o[r]=s})),!r&&i.length>0&&(this.pending=!0,this.pendingOptions=e,i.forEach((t=>{this.emit("change:*",{key:t,options:e,store:this,current:o[t],previous:a[t]})}))),s)return this;if(!r)for(;this.pending;)this.pending=!1,this.emit("changed",{current:o,previous:a,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(t,e){if(null==t)return this.data;const n=this.data[t];return null==n?e:n}getPrevious(t){if(this.previous){const e=this.previous[t];return null==e?void 0:e}}set(t,e,n){return null!=t&&("object"==typeof t?this.mutate(t,e):this.mutate({[t]:e},n)),this}remove(t,e){const n=void 0,r={};let i;if("string"==typeof t)r[t]=n,i=e;else if(Array.isArray(t))t.forEach((t=>r[t]=n)),i=e;else{for(const t in this.data)r[t]=n;i=t}return this.mutate(r,Object.assign(Object.assign({},i),{unset:!0})),this}getByPath(t){return bu(this.data,t,"/")}setByPath(t,e,n={}){const r="/",i=Array.isArray(t)?[...t]:t.split(r),s=Array.isArray(t)?t.join(r):t,o=i[0],a=i.length;if(n.propertyPath=s,n.propertyValue=e,n.propertyPathArray=i,1===a)this.set(o,e,n);else{const s={};let l=s,c=o;for(let t=1;t<a;t+=1){const e=i[t],n=Number.isFinite(Number(e));l=l[c]=n?[]:{},c=e}xu(s,i,e,r);const h=Ui(this.data);n.rewrite&&wu(h,t,r);const u=Ya(h,s);this.set(o,u[o],n)}return this}removeByPath(t,e){const n=Array.isArray(t)?t:t.split("/"),r=n[0];if(1===n.length)this.remove(r,e);else{const t=n.slice(1),i=Ui(this.get(r));i&&wu(i,t),this.set(r,i,e)}return this}hasChanged(t){return null==t?Object.keys(this.changed).length>0:t in this.changed}getChanges(t){if(null==t)return this.hasChanged()?Ui(this.changed):null;const e=this.changing?this.previous:this.data,n={};let r;for(const i in t){const s=t[i];Oa(e[i],s)||(n[i]=s,r=!0)}return r?Ui(n):null}toJSON(){return Ui(this.data)}clone(){return new(0,this.constructor)(this.data)}dispose(){this.off(),this.data={},this.previous={},this.changed={},this.pending=!1,this.changing=!1,this.pendingOptions=null,this.trigger("disposed",{store:this})}}n([Pu.dispose()],qv.prototype,"dispose",null);class Wv{constructor(t){this.cell=t,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(t,e,n={},r="/"){const i=this.cell.getPropByPath(t),s=Ds(n,Wv.defaultOptions),o=this.getTiming(s.timing),a=this.getInterp(s.interp,i,e);let l=0;const c=Array.isArray(t)?t.join(r):t,h=Array.isArray(t)?t:t.split(r),u=()=>{const t=(new Date).getTime();0===l&&(l=t);let e=(t-l)/s.duration;e<1?this.ids[c]=requestAnimationFrame(u):e=1;const r=a(o(e));this.cell.setPropByPath(h,r),n.progress&&n.progress(Object.assign({progress:e,currentValue:r},this.getArgs(c))),1===e&&(this.cell.notify("transition:complete",this.getArgs(c)),n.complete&&n.complete(this.getArgs(c)),this.cell.notify("transition:finish",this.getArgs(c)),n.finish&&n.finish(this.getArgs(c)),this.clean(c))};return setTimeout((()=>{this.stop(t,void 0,r),this.cache[c]={startValue:i,targetValue:e,options:s},this.ids[c]=requestAnimationFrame(u),this.cell.notify("transition:start",this.getArgs(c)),n.start&&n.start(this.getArgs(c))}),n.delay),this.stop.bind(this,t,r,n)}stop(t,e={},n="/"){const r=Array.isArray(t)?t:t.split(n);return Object.keys(this.ids).filter((t=>Oa(r,t.split(n).slice(0,r.length)))).forEach((t=>{cancelAnimationFrame(this.ids[t]);const n=this.cache[t],r=this.getArgs(t),i=Object.assign(Object.assign({},n.options),e),s=i.jumpedToEnd;s&&null!=n.targetValue&&(this.cell.setPropByPath(t,n.targetValue),this.cell.notify("transition:end",Object.assign({},r)),this.cell.notify("transition:complete",Object.assign({},r)),i.complete&&i.complete(Object.assign({},r)));const o=Object.assign({jumpedToEnd:s},r);this.cell.notify("transition:stop",Object.assign({},o)),i.stop&&i.stop(Object.assign({},o)),this.cell.notify("transition:finish",Object.assign({},r)),i.finish&&i.finish(Object.assign({},r)),this.clean(t)})),this}clean(t){delete this.ids[t],delete this.cache[t]}getTiming(e){return"string"==typeof e?t.Timing[e]:e}getInterp(e,n,r){return e?e(n,r):"number"==typeof r?t.Interp.number(n,r):"string"==typeof r?"#"===r[0]?t.Interp.color(n,r):t.Interp.unit(n,r):t.Interp.object(n,r)}getArgs(t){const e=this.cache[t];return{path:t,startValue:e.startValue,targetValue:e.targetValue,cell:this.cell}}}!function(t){t.defaultOptions={delay:10,duration:100,timing:"linear"}}(Wv||(Wv={}));class Hv extends Pu{static config(t){const{markup:n,propHooks:r,attrHooks:i}=t,s=e(t,["markup","propHooks","attrHooks"]);null!=n&&(this.markup=n),r&&(this.propHooks=this.propHooks.slice(),Array.isArray(r)?this.propHooks.push(...r):"function"==typeof r?this.propHooks.push(r):Object.values(r).forEach((t=>{"function"==typeof t&&this.propHooks.push(t)}))),i&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),i)),this.defaults=Ya({},this.defaults,s)}static getMarkup(){return this.markup}static getDefaults(t){return t?this.defaults:Ui(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(t,e){return this.propHooks.reduce(((e,n)=>n?su(n,t,e):e),e)}get[Symbol.toStringTag](){return Hv.toStringTag}constructor(t={}){super();const e=this.constructor.getDefaults(!0),n=Ya({},this.preprocess(e),this.preprocess(t));this.id=n.id||Bu(),this.store=new qv(n),this.animation=new Wv(this),this.setup(),this.init(),this.postprocess(t)}init(){}get model(){return this._model}set model(t){this._model!==t&&(this._model=t)}preprocess(t,e){const n=t.id,r=this.constructor.applyPropHooks(this,t);return null==n&&!0!==e&&(r.id=Bu()),r}postprocess(t){}setup(){this.store.on("change:*",(t=>{const{key:e,current:n,previous:r,options:i}=t;this.notify("change:*",{key:e,options:i,current:n,previous:r,cell:this}),this.notify(`change:${e}`,{options:i,current:n,previous:r,cell:this});const s=e;"source"!==s&&"target"!==s||this.notify("change:terminal",{type:s,current:n,previous:r,options:i,cell:this})})),this.store.on("changed",(({options:t})=>this.notify("changed",{options:t,cell:this})))}notify(t,e){this.trigger(t,e);const n=this.model;return n&&(n.notify(`cell:${t}`,e),this.isNode()?n.notify(`node:${t}`,Object.assign(Object.assign({},e),{node:this})):this.isEdge()&&n.notify(`edge:${t}`,Object.assign(Object.assign({},e),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(t){return this.store===t.store}get view(){return this.store.get("view")}get shape(){return this.store.get("shape","")}getProp(t,e){return null==t?this.store.get():this.store.get(t,e)}setProp(t,e,n){if("string"==typeof t)this.store.set(t,e,n);else{const n=this.preprocess(t,!0);this.store.set(Ya({},this.getProp(),n),e),this.postprocess(t)}return this}removeProp(t,e){return"string"==typeof t||Array.isArray(t)?this.store.removeByPath(t,e):this.store.remove(e),this}hasChanged(t){return null==t?this.store.hasChanged():this.store.hasChanged(t)}getPropByPath(t){return this.store.getByPath(t)}setPropByPath(t,e,n={}){return this.model&&("children"===t?this._children=e?e.map((t=>this.model.getCell(t))).filter((t=>null!=t)):null:"parent"===t&&(this._parent=e?this.model.getCell(e):null)),this.store.setByPath(t,e,n),this}removePropByPath(t,e={}){const n=Array.isArray(t)?t:t.split("/");return"attrs"===n[0]&&(e.dirty=!0),this.store.removeByPath(n,e),this}prop(t,e,n){return null==t?this.getProp():"string"==typeof t||Array.isArray(t)?1===arguments.length?this.getPropByPath(t):null==e?this.removePropByPath(t,n||{}):this.setPropByPath(t,e,n||{}):this.setProp(t,e||{})}previous(t){return this.store.getPrevious(t)}get zIndex(){return this.getZIndex()}set zIndex(t){null==t?this.removeZIndex():this.setZIndex(t)}getZIndex(){return this.store.get("zIndex")}setZIndex(t,e={}){return this.store.set("zIndex",t,e),this}removeZIndex(t={}){return this.store.remove("zIndex",t),this}toFront(t={}){const e=this.model;if(e){let n,r=e.getMaxZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this],r=r-n.length+1;const i=e.total();let s=e.indexOf(this)!==i-n.length;s||(s=n.some(((t,e)=>t.getZIndex()!==r+e))),s&&this.batchUpdate("to-front",(()=>{r+=n.length,n.forEach(((e,n)=>{e.setZIndex(r+n,t)}))}))}return this}toBack(t={}){const e=this.model;if(e){let n,r=e.getMinZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this];let i=0!==e.indexOf(this);i||(i=n.some(((t,e)=>t.getZIndex()!==r+e))),i&&this.batchUpdate("to-back",(()=>{r-=n.length,n.forEach(((e,n)=>{e.setZIndex(r+n,t)}))}))}return this}get markup(){return this.getMarkup()}set markup(t){null==t?this.removeMarkup():this.setMarkup(t)}getMarkup(){let t=this.store.get("markup");if(null==t){t=this.constructor.getMarkup()}return t}setMarkup(t,e={}){return this.store.set("markup",t,e),this}removeMarkup(t={}){return this.store.remove("markup",t),this}get attrs(){return this.getAttrs()}set attrs(t){null==t?this.removeAttrs():this.setAttrs(t)}getAttrs(){const t=this.store.get("attrs");return t?Object.assign({},t):{}}setAttrs(t,e={}){if(null==t)this.removeAttrs(e);else{const n=t=>this.store.set("attrs",t,e);if(!0===e.overwrite)n(t);else{const r=this.getAttrs();!1===e.deep?n(Object.assign(Object.assign({},r),t)):n(Ya({},r,t))}}return this}replaceAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{deep:!1}))}removeAttrs(t={}){return this.store.remove("attrs",t),this}getAttrDefinition(t){if(!t)return null;const e=this.constructor.getAttrHooks()||{};let n=e[t]||jm.registry.get(t);if(!n){const r=Rr(t);n=e[r]||jm.registry.get(r)}return n||null}getAttrByPath(t){return null==t||""===t?this.getAttrs():this.getPropByPath(this.prefixAttrPath(t))}setAttrByPath(t,e,n={}){return this.setPropByPath(this.prefixAttrPath(t),e,n),this}removeAttrByPath(t,e={}){return this.removePropByPath(this.prefixAttrPath(t),e),this}prefixAttrPath(t){return Array.isArray(t)?["attrs"].concat(t):`attrs/${t}`}attr(t,e,n){return null==t?this.getAttrByPath():"string"==typeof t||Array.isArray(t)?1===arguments.length?this.getAttrByPath(t):null==e?this.removeAttrByPath(t,n||{}):this.setAttrByPath(t,e,n||{}):this.setAttrs(t,e||{})}get visible(){return this.isVisible()}set visible(t){this.setVisible(t)}setVisible(t,e={}){return this.store.set("visible",t,e),this}isVisible(){return!1!==this.store.get("visible")}show(t={}){return this.isVisible()||this.setVisible(!0,t),this}hide(t={}){return this.isVisible()&&this.setVisible(!1,t),this}toggleVisible(t,e={}){const n="boolean"==typeof t?e:t;return("boolean"==typeof t?t:!this.isVisible())?this.show(n):this.hide(n),this}get data(){return this.getData()}set data(t){this.setData(t)}getData(){return this.store.get("data")}setData(t,e={}){if(null==t)this.removeData(e);else{const n=t=>this.store.set("data",t,e);if(!0===e.overwrite)n(t);else{const r=this.getData();!1===e.deep?n("object"==typeof t?Object.assign(Object.assign({},r),t):t):n(Ya({},r,t))}}return this}replaceData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{deep:!1}))}removeData(t={}){return this.store.remove("data",t),this}get parent(){return this.getParent()}get children(){return this.getChildren()}getParentId(){return this.store.get("parent")}getParent(){const t=this.getParentId();if(t&&this.model){const e=this.model.getCell(t);return this._parent=e,e}return null}getChildren(){const t=this.store.get("children");if(t&&t.length&&this.model){const e=t.map((t=>{var e;return null===(e=this.model)||void 0===e?void 0:e.getCell(t)})).filter((t=>null!=t));return this._children=e,[...e]}return null}hasParent(){return null!=this.parent}isParentOf(t){return null!=t&&t.getParent()===this}isChildOf(t){return null!=t&&this.getParent()===t}eachChild(t,e){return this.children&&this.children.forEach(t,e),this}filterChild(t,e){return this.children?this.children.filter(t,e):[]}getChildCount(){return null==this.children?0:this.children.length}getChildIndex(t){return null==this.children?-1:this.children.indexOf(t)}getChildAt(t){return null!=this.children&&t>=0?this.children[t]:null}getAncestors(t={}){const e=[];let n=this.getParent();for(;n;)e.push(n),n=!1!==t.deep?n.getParent():null;return e}getDescendants(t={}){if(!1!==t.deep){if(t.breadthFirst){const t=[],e=this.getChildren()||[];for(;e.length>0;){const n=e.shift(),r=n.getChildren();t.push(n),r&&e.push(...r)}return t}{const e=this.getChildren()||[];return e.forEach((n=>{e.push(...n.getDescendants(t))})),e}}return this.getChildren()||[]}isDescendantOf(t,e={}){if(null==t)return!1;if(!1!==e.deep){let e=this.getParent();for(;e;){if(e===t)return!0;e=e.getParent()}return!1}return this.isChildOf(t)}isAncestorOf(t,e={}){return null!=t&&t.isDescendantOf(this,e)}contains(t){return this.isAncestorOf(t)}getCommonAncestor(...t){return Hv.getCommonAncestor(this,...t)}setParent(t,e={}){return this._parent=t,t?this.store.set("parent",t.id,e):this.store.remove("parent",e),this}setChildren(t,e={}){return this._children=t,null!=t?this.store.set("children",t.map((t=>t.id)),e):this.store.remove("children",e),this}unembed(t,e={}){const n=this.children;if(null!=n&&null!=t){const r=this.getChildIndex(t);-1!==r&&(n.splice(r,1),t.setParent(null,e),this.setChildren(n,e))}return this}embed(t,e={}){return t.addTo(this,e),this}addTo(t,e={}){return Hv.isCell(t)?t.addChild(this,e):t.addCell(this,e),this}insertTo(t,e,n={}){return t.insertChild(this,e,n),this}addChild(t,e={}){return this.insertChild(t,void 0,e)}insertChild(t,e,n={}){if(null!=t&&t!==this){const r=t.getParent(),i=this!==r;let s=e;if(null==s&&(s=this.getChildCount(),i||(s-=1)),r){const e=r.getChildren();if(e){const i=e.indexOf(t);i>=0&&(t.setParent(null,n),e.splice(i,1),r.setChildren(e,n))}}let o=this.children;if(null==o?(o=[],o.push(t)):o.splice(s,0,t),t.setParent(this,n),this.setChildren(o,n),i&&this.model){const t=this.model.getIncomingEdges(this),e=this.model.getOutgoingEdges(this);t&&t.forEach((t=>t.updateParent(n))),e&&e.forEach((t=>t.updateParent(n)))}this.model&&this.model.addCell(t,n)}return this}removeFromParent(t={}){const e=this.getParent();if(null!=e){const n=e.getChildIndex(this);e.removeChildAt(n,t)}return this}removeChild(t,e={}){const n=this.getChildIndex(t);return this.removeChildAt(n,e)}removeChildAt(t,e={}){const n=this.getChildAt(t);return null!=this.children&&null!=n&&(this.unembed(n,e),n.remove(e)),n}remove(t={}){return this.batchUpdate("remove",(()=>{const e=this.getParent();e&&e.removeChild(this,t),!1!==t.deep&&this.eachChild((e=>e.remove(t))),this.model&&this.model.removeCell(this,t)})),this}transition(t,e,n={},r="/"){return this.animation.start(t,e,n,r)}stopTransition(t,e,n="/"){return this.animation.stop(t,e,n),this}getTransitions(){return this.animation.get()}translate(t,e,n){return this}scale(t,e,n,r){return this}addTools(t,e,n){const r=Array.isArray(t)?t:[t],i="string"==typeof e?e:null,s="object"==typeof e?e:"object"==typeof n?n:{};if(s.reset)return this.setTools({name:i,items:r,local:s.local},s);let o=Ui(this.getTools());return null==o||null==i||o.name===i?(null==o&&(o={}),o.items||(o.items=[]),o.name=i,o.items=[...o.items,...r],this.setTools(Object.assign({},o),s)):void 0}setTools(t,e={}){return null==t?this.removeTools():this.store.set("tools",Hv.normalizeTools(t),e),this}getTools(){return this.store.get("tools")}removeTools(t={}){return this.store.remove("tools",t),this}hasTools(t){const e=this.getTools();return null!=e&&(null==t||e.name===t)}hasTool(t){const e=this.getTools();return null!=e&&e.items.some((e=>"string"==typeof e?e===t:e.name===t))}removeTool(t,e={}){const n=Ui(this.getTools());if(n){let r=!1;const i=n.items.slice(),s=t=>{i.splice(t,1),r=!0};if("number"==typeof t)s(t);else for(let e=i.length-1;e>=0;e-=1){const n=i[e];("string"==typeof n?n===t:n.name===t)&&s(e)}r&&(n.items=i,this.setTools(n,e))}return this}getBBox(t){return new _f}getConnectionPoint(t,e){return new jf}toJSON(t={}){const e=Object.assign({},this.store.get()),n=Object.prototype.toString,r=this.isNode()?"node":this.isEdge()?"edge":"cell";if(!e.shape){const t=this.constructor;throw new Error(`Unable to serialize ${r} missing "shape" prop, check the ${r} "${t.name||n.call(t)}"`)}const i=this.constructor,s=!0===t.diff,o=e.attrs||{},a=i.getDefaults(!0),l=s?this.preprocess(a,!0):a,c=l.attrs||{},h={};Object.entries(e).forEach((([t,i])=>{if(null!=i&&!Array.isArray(i)&&"object"==typeof i&&!jn(i))throw new Error(`Can only serialize ${r} with plain-object props, but got a "${n.call(i)}" type of key "${t}" on ${r} "${this.id}"`);if("attrs"!==t&&"shape"!==t&&s){Oa(i,l[t])&&delete e[t]}})),Object.keys(o).forEach((t=>{const e=o[t],n=c[t];Object.keys(e).forEach((r=>{const i=e[r],s=n?n[r]:null;null==i||"object"!=typeof i||Array.isArray(i)?null!=n&&Oa(s,i)||(null==h[t]&&(h[t]={}),h[t][r]=i):Object.keys(i).forEach((e=>{const o=i[e];if(null==n||null==s||!k(s)||!Oa(s[e],o)){null==h[t]&&(h[t]={}),null==h[t][r]&&(h[t][r]={});h[t][r][e]=o}}))}))}));const u=Object.assign(Object.assign({},e),{attrs:Sa(h)?void 0:h});null==u.attrs&&delete u.attrs;const g=u;return 0===g.angle&&delete g.angle,Ui(g)}clone(t={}){if(!t.deep){const e=Object.assign({},this.store.get());t.keepId||delete e.id,delete e.parent,delete e.children;return new(0,this.constructor)(e)}return Hv.deepClone(this)[this.id]}findView(t){return t.findViewByCell(this)}startBatch(t,e={},n=this.model){return this.notify("batch:start",{name:t,data:e,cell:this}),n&&n.startBatch(t,Object.assign(Object.assign({},e),{cell:this})),this}stopBatch(t,e={},n=this.model){return n&&n.stopBatch(t,Object.assign(Object.assign({},e),{cell:this})),this.notify("batch:stop",{name:t,data:e,cell:this}),this}batchUpdate(t,e,n){const r=this.model;this.startBatch(t,n,r);const i=e();return this.stopBatch(t,n,r),i}dispose(){this.removeFromParent(),this.store.dispose()}}Hv.defaults={},Hv.attrHooks={},Hv.propHooks=[],n([Pu.dispose()],Hv.prototype,"dispose",null),function(t){t.normalizeTools=function(t){return"string"==typeof t?{items:[t]}:Array.isArray(t)?{items:t}:t.items?t:{items:[t]}}}(Hv||(Hv={})),function(t){t.toStringTag=`X6.${t.name}`,t.isCell=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&"function"==typeof r.isNode&&"function"==typeof r.isEdge&&"function"==typeof r.prop&&"function"==typeof r.attr}}(Hv||(Hv={})),function(t){t.getCommonAncestor=function(...t){const e=t.filter((t=>null!=t)).map((t=>t.getAncestors())).sort(((t,e)=>t.length-e.length));return e.shift().find((t=>e.every((e=>e.includes(t)))))||null},t.getCellsBBox=function(t,e={}){let n=null;for(let r=0,i=t.length;r<i;r+=1){const i=t[r];let s=i.getBBox(e);if(s){if(i.isNode()){const t=i.getAngle();null!=t&&0!==t&&(s=s.bbox(t))}n=null==n?s:n.union(s)}}return n},t.deepClone=function(e){const n=[e,...e.getDescendants({deep:!0})];return t.cloneCells(n)},t.cloneCells=function(t){const e=yh(t),n=e.reduce(((t,e)=>(t[e.id]=e.clone(),t)),{});return e.forEach((t=>{const e=n[t.id];if(e.isEdge()){const t=e.getSourceCellId(),r=e.getTargetCellId();t&&n[t]&&e.setSource(Object.assign(Object.assign({},e.getSource()),{cell:n[t].id})),r&&n[r]&&e.setTarget(Object.assign(Object.assign({},e.getTarget()),{cell:n[r].id}))}const r=t.getParent();r&&n[r.id]&&e.setParent(n[r.id]);const i=t.getChildren();if(i&&i.length){const t=i.reduce(((t,e)=>(n[e.id]&&t.push(n[e.id]),t)),[]);t.length>0&&e.setChildren(t)}})),n}}(Hv||(Hv={})),function(t){t.config({propHooks(n){var{tools:r}=n,i=e(n,["tools"]);return r&&(i.tools=t.normalizeTools(r)),i}})}(Hv||(Hv={})),function(t){let e,n;t.exist=function(t,r){return r?null!=e&&e.exist(t):null!=n&&n.exist(t)},t.setEdgeRegistry=function(t){e=t},t.setNodeRegistry=function(t){n=t}}(Gv||(Gv={}));class Jv{constructor(t){this.ports=[],this.groups={},this.init(Ui(t))}getPorts(){return this.ports}getGroup(t){return null!=t?this.groups[t]:null}getPortsByGroup(t){return this.ports.filter((e=>e.group===t||null==e.group&&null==t))}getPortsLayoutByGroup(t,e){const n=this.getPortsByGroup(t),r=t?this.getGroup(t):null,i=r?r.position:null,s=i?i.name:null;let o;if(null!=s){const t=Jm.registry.get(s);if(null==t)return Jm.registry.onNotFound(s);o=t}else o=Jm.presets.left;const a=n.map((t=>t&&t.position&&t.position.args||{})),l=i&&i.args||{};return o(a,e,l).map(((t,r)=>{const i=n[r];return{portLayout:t,portId:i.id,portSize:i.size,portAttrs:i.attrs,labelSize:i.label.size,labelLayout:this.getPortLabelLayout(i,jf.create(t.position),e)}}))}init(t){const{groups:e,items:n}=t;null!=e&&Object.keys(e).forEach((t=>{this.groups[t]=this.parseGroup(e[t])})),Array.isArray(n)&&n.forEach((t=>{this.ports.push(this.parsePort(t))}))}parseGroup(t){return Object.assign(Object.assign({},t),{label:this.getLabel(t,!0),position:this.getPortPosition(t.position,!0)})}parsePort(t){const e=Object.assign({},t),n=this.getGroup(t.group)||{};return e.markup=e.markup||n.markup,e.attrs=Ya({},n.attrs,e.attrs),e.position=this.createPosition(n,e),e.label=Ya({},n.label,this.getLabel(e)),e.zIndex=this.getZIndex(n,e),e.size=Object.assign(Object.assign({},n.size),e.size),e}getZIndex(t,e){return"number"==typeof e.zIndex?e.zIndex:"number"==typeof t.zIndex||"auto"===t.zIndex?t.zIndex:"auto"}createPosition(t,e){return Ya({name:"left",args:{}},t.position,{args:e.args})}getPortPosition(t,e=!1){if(null==t){if(e)return{name:"left",args:{}}}else{if("string"==typeof t)return{name:t,args:{}};if(Array.isArray(t))return{name:"absolute",args:{x:t[0],y:t[1]}};if("object"==typeof t)return t}return{args:{}}}getPortLabelPosition(t,e=!1){if(null==t){if(e)return{name:"left",args:{}}}else{if("string"==typeof t)return{name:t,args:{}};if("object"==typeof t)return t}return{args:{}}}getLabel(t,e=!1){const n=t.label||{};return n.position=this.getPortLabelPosition(n.position,e),n}getPortLabelLayout(t,e,n){const r=t.label.position.name||"left",i=t.label.position.args||{},s=ny.registry.get(r)||ny.presets.left;return s?s(e,n,i):null}}let Xv=class n extends Hv{get[Symbol.toStringTag](){return n.toStringTag}constructor(t={}){super(t),this.initPorts()}preprocess(t,n){const{x:r,y:i,width:s,height:o}=t,a=e(t,["x","y","width","height"]);if(null!=r||null!=i){const t=a.position;a.position=Object.assign(Object.assign({},t),{x:null!=r?r:t?t.x:0,y:null!=i?i:t?t.y:0})}if(null!=s||null!=o){const t=a.size;a.size=Object.assign(Object.assign({},t),{width:null!=s?s:t?t.width:0,height:null!=o?o:t?t.height:0})}return super.preprocess(a,n)}isNode(){return!0}size(t,e,n){return void 0===t?this.getSize():"number"==typeof t?this.setSize(t,e,n):this.setSize(t,e)}getSize(){const t=this.store.get("size");return t?Object.assign({},t):{width:1,height:1}}setSize(t,e,n){return"object"==typeof t?this.resize(t.width,t.height,e):this.resize(t,e,n),this}resize(e,n,r={}){this.startBatch("resize",r);const i=r.direction;if(i){const s=this.getSize();switch(i){case"left":case"right":n=s.height;break;case"top":case"bottom":e=s.width}let o={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[i];const a=t.Angle.normalize(this.getAngle()||0);r.absolute&&(o+=Math.floor((a+45)/90),o%=4);const l=this.getBBox();let c;c=0===o?l.getBottomLeft():1===o?l.getCorner():2===o?l.getTopRight():l.getOrigin();const h=c.clone().rotate(-a,l.getCenter()),u=Math.sqrt(e*e+n*n)/2;let g=o*Math.PI/2;g+=Math.atan(o%2==0?n/e:e/n),g-=t.Angle.toRad(a);const d=jf.fromPolar(u,g,h).clone().translate(e/-2,n/-2);this.store.set("size",{width:e,height:n},r),this.setPosition(d.x,d.y,r)}else this.store.set("size",{width:e,height:n},r);return this.stopBatch("resize",r),this}scale(t,e,n,r={}){const i=this.getBBox().scale(t,e,null==n?void 0:n);return this.startBatch("scale",r),this.setPosition(i.x,i.y,r),this.resize(i.width,i.height,r),this.stopBatch("scale"),this}position(t,e,n){return"number"==typeof t?this.setPosition(t,e,n):this.getPosition(t)}getPosition(t={}){if(t.relative){const t=this.getParent();if(null!=t&&t.isNode()){const e=this.getPosition(),n=t.getPosition();return{x:e.x-n.x,y:e.y-n.y}}}const e=this.store.get("position");return e?Object.assign({},e):{x:0,y:0}}setPosition(t,e,n={}){let r,i,s;if("object"==typeof t?(r=t.x,i=t.y,s=e||{}):(r=t,i=e,s=n||{}),s.relative){const t=this.getParent();if(null!=t&&t.isNode()){const e=t.getPosition();r+=e.x,i+=e.y}}if(s.deep){const t=this.getPosition();this.translate(r-t.x,i-t.y,s)}else this.store.set("position",{x:r,y:i},s);return this}translate(e=0,n=0,r={}){if(0===e&&0===n)return this;r.translateBy=r.translateBy||this.id;const i=this.getPosition();if(null!=r.restrict&&r.translateBy===this.id){const t=this.getBBox({deep:!0}),s=r.restrict,o=i.x-t.x,a=i.y-t.y,l=Math.max(s.x+o,Math.min(s.x+s.width+o-t.width,i.x+e)),c=Math.max(s.y+a,Math.min(s.y+s.height+a-t.height,i.y+n));e=l-i.x,n=c-i.y}const s={x:i.x+e,y:i.y+n};return r.tx=e,r.ty=n,r.transition?("object"!=typeof r.transition&&(r.transition={}),this.transition("position",s,Object.assign(Object.assign({},r.transition),{interp:t.Interp.object})),this.eachChild((t=>{var i;(null===(i=r.exclude)||void 0===i?void 0:i.includes(t))||t.translate(e,n,r)}))):(this.startBatch("translate",r),this.store.set("position",s,r),this.eachChild((t=>{var i;(null===(i=r.exclude)||void 0===i?void 0:i.includes(t))||t.translate(e,n,r)})),this.stopBatch("translate",r)),this}angle(t,e){return null==t?this.getAngle():this.rotate(t,e)}getAngle(){return this.store.get("angle",0)}rotate(t,e={}){const n=this.getAngle();if(e.center){const r=this.getSize(),i=this.getPosition(),s=this.getBBox().getCenter();s.rotate(n-t,e.center);const o=s.x-r.width/2-i.x,a=s.y-r.height/2-i.y;this.startBatch("rotate",{angle:t,options:e}),this.setPosition(i.x+o,i.y+a,e),this.rotate(t,Object.assign(Object.assign({},e),{center:null})),this.stopBatch("rotate")}else this.store.set("angle",e.absolute?t:(n+t)%360,e);return this}getBBox(t={}){if(t.deep){const t=this.getDescendants({deep:!0,breadthFirst:!0});return t.push(this),Hv.getCellsBBox(t)}return _f.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(t,e){const n=this.getBBox(),r=n.getCenter(),i=t.getTerminal(e);if(null==i)return r;const s=i.port;if(!s||!this.hasPort(s))return r;const o=this.getPort(s);if(!o||!o.group)return r;const a=this.getPortsPosition(o.group)[s].position,l=jf.create(a).translate(n.getOrigin()),c=this.getAngle();return c&&l.rotate(-c,r),l}fit(t={}){const e=(this.getChildren()||[]).filter((t=>t.isNode()));if(0===e.length)return this;this.startBatch("fit-embeds",t),t.deep&&e.forEach((e=>e.fit(t)));let{x:n,y:r,width:i,height:s}=Hv.getCellsBBox(e);const o=$u(t.padding);return n-=o.left,r-=o.top,i+=o.left+o.right,s+=o.bottom+o.top,this.store.set({position:{x:n,y:r},size:{width:i,height:s}},t),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(t){this.setPortContainerMarkup(t)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||t.Markup.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(e,n={}){return this.store.set("portContainerMarkup",t.Markup.clone(e),n),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(t){this.setPortMarkup(t)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||t.Markup.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(e,n={}){return this.store.set("portMarkup",t.Markup.clone(e),n),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(t){this.setPortLabelMarkup(t)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||t.Markup.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(e,n={}){return this.store.set("portLabelMarkup",t.Markup.clone(e),n),this}get ports(){const t=this.store.get("ports",{items:[]});return null==t.items&&(t.items=[]),t}getPorts(){return Ui(this.ports.items)}getPortsByGroup(t){return this.getPorts().filter((e=>e.group===t))}getPort(t){return Ui(this.ports.items.find((e=>e.id&&e.id===t)))}getPortAt(t){return this.ports.items[t]||null}hasPorts(){return this.ports.items.length>0}hasPort(t){return-1!==this.getPortIndex(t)}getPortIndex(t){const e="string"==typeof t?t:t.id;return null!=e?this.ports.items.findIndex((t=>t.id===e)):-1}getPortsPosition(t){const e=this.getSize();return this.port.getPortsLayoutByGroup(t,new _f(0,0,e.width,e.height)).reduce(((t,e)=>{const n=e.portLayout;return t[e.portId]={position:Object.assign({},n.position),angle:n.angle||0},t}),{})}getPortProp(t,e){return this.getPropByPath(this.prefixPortPath(t,e))}setPortProp(t,e,n,r){if("string"==typeof e||Array.isArray(e)){const i=this.prefixPortPath(t,e),s=n;return this.setPropByPath(i,s,r)}const i=this.prefixPortPath(t),s=e;return this.setPropByPath(i,s,n)}removePortProp(t,e,n){return"string"==typeof e||Array.isArray(e)?this.removePropByPath(this.prefixPortPath(t,e),n):this.removePropByPath(this.prefixPortPath(t),e)}portProp(t,e,n,r){return null==e?this.getPortProp(t):"string"==typeof e||Array.isArray(e)?2===arguments.length?this.getPortProp(t,e):null==n?this.removePortProp(t,e,r):this.setPortProp(t,e,n,r):this.setPortProp(t,e,n)}prefixPortPath(t,e){const n=this.getPortIndex(t);if(-1===n)throw new Error(`Unable to find port with id: "${t}"`);return null==e||""===e?["ports","items",`${n}`]:Array.isArray(e)?["ports","items",`${n}`,...e]:`ports/items/${n}/${e}`}addPort(t,e){const n=[...this.ports.items];return n.push(t),this.setPropByPath("ports/items",n,e),this}addPorts(t,e){return this.setPropByPath("ports/items",[...this.ports.items,...t],e),this}insertPort(t,e,n){const r=[...this.ports.items];return r.splice(t,0,e),this.setPropByPath("ports/items",r,n),this}removePort(t,e={}){return this.removePortAt(this.getPortIndex(t),e)}removePortAt(t,e={}){if(t>=0){const n=[...this.ports.items];n.splice(t,1),e.rewrite=!0,this.setPropByPath("ports/items",n,e)}return this}removePorts(t,e){let n;if(Array.isArray(t)){if(n=e||{},t.length){n.rewrite=!0;const e=[...this.ports.items].filter((e=>!t.some((t=>{const n="string"==typeof t?t:t.id;return e.id===n}))));this.setPropByPath("ports/items",e,n)}}else n=t||{},n.rewrite=!0,this.setPropByPath("ports/items",[],n);return this}getParsedPorts(){return this.port.getPorts()}getParsedGroups(){return this.port.groups}getPortsLayoutByGroup(t,e){return this.port.getPortsLayoutByGroup(t,e)}initPorts(){this.updatePortData(),this.on("change:ports",(()=>{this.processRemovedPort(),this.updatePortData()}))}processRemovedPort(){const t=this.ports,e={};t.items.forEach((t=>{t.id&&(e[t.id]=!0)}));const n={};(this.store.getPrevious("ports")||{items:[]}).items.forEach((t=>{t.id&&!e[t.id]&&(n[t.id]=!0)}));const r=this.model;if(r&&!Sa(n)){r.getConnectedEdges(this,{incoming:!0}).forEach((t=>{const e=t.getTargetPortId();e&&n[e]&&t.remove()}));r.getConnectedEdges(this,{outgoing:!0}).forEach((t=>{const e=t.getSourcePortId();e&&n[e]&&t.remove()}))}}validatePorts(){const t={},e=[];return this.ports.items.forEach((n=>{"object"!=typeof n&&e.push(`Invalid port ${n}.`),null==n.id&&(n.id=this.generatePortId()),t[n.id]&&e.push("Duplicitied port id."),t[n.id]=!0})),e}generatePortId(){return Bu()}updatePortData(){const t=this.validatePorts();if(t.length>0)throw this.store.set("ports",this.store.getPrevious("ports")),new Error(t.join(" "));const e=this.port?this.port.getPorts():null;this.port=new Jv(this.ports);const n=this.port.getPorts(),r=e?n.filter((t=>e.find((e=>e.id===t.id))?null:t)):[...n],i=e?e.filter((t=>n.find((e=>e.id===t.id))?null:t)):[];r.length>0&&this.notify("ports:added",{added:r,cell:this,node:this}),i.length>0&&this.notify("ports:removed",{removed:i,cell:this,node:this})}};Xv.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},function(t){t.toStringTag=`X6.${t.name}`,t.isNode=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&"function"==typeof r.isNode&&"function"==typeof r.isEdge&&"function"==typeof r.prop&&"function"==typeof r.attr&&"function"==typeof r.size&&"function"==typeof r.position}}(Xv||(Xv={})),function(t){t.config({propHooks(t){var{ports:n}=t,r=e(t,["ports"]);return n&&(r.ports=Array.isArray(n)?{items:n}:n),r}})}(Xv||(Xv={})),function(t){t.registry=np.create({type:"node",process(n,r){if(Gv.exist(n,!0))throw new Error(`Node with name '${n}' was registered by anthor Edge`);if("function"==typeof r)return r.config({shape:n}),r;let i=t;const{inherit:s}=r,o=e(r,["inherit"]);if(s)if("string"==typeof s){const t=this.get(s);null==t?this.onNotFound(s,"inherited"):i=t}else i=s;null==o.constructorName&&(o.constructorName=n);const a=i.define.call(i,o);return a.config({shape:n}),a}}),Gv.setNodeRegistry(t.registry)}(Xv||(Xv={})),function(t){let n=0;t.define=function(r){const{constructorName:i,overwrite:s}=r,o=e(r,["constructorName","overwrite"]),a=mu((l=i||o.shape)?Ou(l):(n+=1,`CustomNode${n}`),this);var l;return a.config(o),o.shape&&t.registry.register(o.shape,a,s),a},t.create=function(e){const n=e.shape||"rect",r=t.registry.get(n);return r?new r(e):t.registry.onNotFound(n)}}(Xv||(Xv={}));let Yv=class n extends Hv{get[Symbol.toStringTag](){return n.toStringTag}constructor(t={}){super(t)}preprocess(t,n){const{source:r,sourceCell:i,sourcePort:s,sourcePoint:o,target:a,targetCell:l,targetPort:c,targetPoint:h}=t,u=e(t,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),g=t=>"string"==typeof t||"number"==typeof t;if(null!=r)if(Hv.isCell(r))u.source={cell:r.id};else if(g(r))u.source={cell:r};else if(jf.isPoint(r))u.source=r.toJSON();else if(Array.isArray(r))u.source={x:r[0],y:r[1]};else{const t=r.cell;Hv.isCell(t)?u.source=Object.assign(Object.assign({},r),{cell:t.id}):u.source=r}if(null!=i||null!=s){let t=u.source;if(null!=i){const e=g(i)?i:i.id;t?t.cell=e:t=u.source={cell:e}}null!=s&&t&&(t.port=s)}else null!=o&&(u.source=jf.create(o).toJSON());if(null!=a)if(Hv.isCell(a))u.target={cell:a.id};else if(g(a))u.target={cell:a};else if(jf.isPoint(a))u.target=a.toJSON();else if(Array.isArray(a))u.target={x:a[0],y:a[1]};else{const t=a.cell;Hv.isCell(t)?u.target=Object.assign(Object.assign({},a),{cell:t.id}):u.target=a}if(null!=l||null!=c){let t=u.target;if(null!=l){const e=g(l)?l:l.id;t?t.cell=e:t=u.target={cell:e}}null!=c&&t&&(t.port=c)}else null!=h&&(u.target=jf.create(h).toJSON());return super.preprocess(u,n)}setup(){super.setup(),this.on("change:labels",(t=>this.onLabelsChanged(t))),this.on("change:vertices",(t=>this.onVertexsChanged(t)))}isEdge(){return!0}disconnect(t={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},t),this}get source(){return this.getSource()}set source(t){this.setSource(t)}getSource(){return this.getTerminal("source")}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(t,e,n={}){return this.setTerminal("source",t,e,n)}get target(){return this.getTarget()}set target(t){this.setTarget(t)}getTarget(){return this.getTerminal("target")}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(t,e,n={}){return this.setTerminal("target",t,e,n)}getTerminal(t){return Object.assign({},this.store.get(t))}setTerminal(t,e,n,r={}){if(Hv.isCell(e))return this.store.set(t,Ya({},n,{cell:e.id}),r),this;const i=e;return jf.isPoint(e)||null!=i.x&&null!=i.y?(this.store.set(t,Ya({},n,{x:i.x,y:i.y}),r),this):(this.store.set(t,Ui(e),r),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(t){const e=this[t];if(jf.isPointLike(e))return jf.create(e);const n=this.getTerminalCell(t);return n?n.getConnectionPoint(this,t):new jf}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(t){if(this.model){const e="source"===t?this.getSourceCellId():this.getTargetCellId();if(e)return this.model.getCell(e)}return null}getSourceNode(){return this.getTerminalNode("source")}getTargetNode(){return this.getTerminalNode("target")}getTerminalNode(t){let e=this;const n={};for(;e&&e.isEdge();){if(n[e.id])return null;n[e.id]=!0,e=e.getTerminalCell(t)}return e&&e.isNode()?e:null}get router(){return this.getRouter()}set router(t){null==t?this.removeRouter():this.setRouter(t)}getRouter(){return this.store.get("router")}setRouter(t,e,n){return"object"==typeof t?this.store.set("router",t,e):this.store.set("router",{name:t,args:e},n),this}removeRouter(t={}){return this.store.remove("router",t),this}get connector(){return this.getConnector()}set connector(t){null==t?this.removeConnector():this.setConnector(t)}getConnector(){return this.store.get("connector")}setConnector(t,e,n){return"object"==typeof t?this.store.set("connector",t,e):this.store.set("connector",{name:t,args:e},n),this}removeConnector(t={}){return this.store.remove("connector",t)}getDefaultLabel(){const t=this.constructor;return Ui(this.store.get("defaultLabel")||t.defaultLabel||{})}get labels(){return this.getLabels()}set labels(t){this.setLabels(t)}getLabels(){return[...this.store.get("labels",[])].map((t=>this.parseLabel(t)))}setLabels(t,e={}){return this.store.set("labels",Array.isArray(t)?t:[t],e),this}insertLabel(t,e,n={}){const r=this.getLabels(),i=r.length;let s=null!=e&&Number.isFinite(e)?e:i;return s<0&&(s=i+s+1),r.splice(s,0,this.parseLabel(t)),this.setLabels(r,n)}appendLabel(t,e={}){return this.insertLabel(t,-1,e)}getLabelAt(t){const e=this.getLabels();return null!=t&&Number.isFinite(t)?this.parseLabel(e[t]):null}setLabelAt(t,e,n={}){if(null!=t&&Number.isFinite(t)){const r=this.getLabels();r[t]=this.parseLabel(e),this.setLabels(r,n)}return this}removeLabelAt(t,e={}){const n=this.getLabels(),r=null!=t&&Number.isFinite(t)?t:-1,i=n.splice(r,1);return this.setLabels(n,e),i.length?i[0]:null}parseLabel(t){if("string"==typeof t){return this.constructor.parseStringLabel(t)}return t}onLabelsChanged({previous:t,current:e}){const n=t&&e?e.filter((e=>t.find((t=>e===t||Oa(e,t)))?null:e)):e?[...e]:[],r=t&&e?t.filter((t=>e.find((e=>t===e||Oa(t,e)))?null:t)):t?[...t]:[];n.length>0&&this.notify("labels:added",{added:n,cell:this,edge:this}),r.length>0&&this.notify("labels:removed",{removed:r,cell:this,edge:this})}get vertices(){return this.getVertices()}set vertices(t){this.setVertices(t)}getVertices(){return[...this.store.get("vertices",[])]}setVertices(t,e={}){const n=Array.isArray(t)?t:[t];return this.store.set("vertices",n.map((t=>jf.toJSON(t))),e),this}insertVertex(t,e,n={}){const r=this.getVertices(),i=r.length;let s=null!=e&&Number.isFinite(e)?e:i;return s<0&&(s=i+s+1),r.splice(s,0,jf.toJSON(t)),this.setVertices(r,n)}appendVertex(t,e={}){return this.insertVertex(t,-1,e)}getVertexAt(t){if(null!=t&&Number.isFinite(t)){return this.getVertices()[t]}return null}setVertexAt(t,e,n={}){if(null!=t&&Number.isFinite(t)){const r=this.getVertices();r[t]=e,this.setVertices(r,n)}return this}removeVertexAt(t,e={}){const n=this.getVertices(),r=null!=t&&Number.isFinite(t)?t:-1;return n.splice(r,1),this.setVertices(n,e)}onVertexsChanged({previous:t,current:e}){const n=t&&e?e.filter((e=>t.find((t=>jf.equals(e,t)))?null:e)):e?[...e]:[],r=t&&e?t.filter((t=>e.find((e=>jf.equals(t,e)))?null:t)):t?[...t]:[];n.length>0&&this.notify("vertexs:added",{added:n,cell:this,edge:this}),r.length>0&&this.notify("vertexs:removed",{removed:r,cell:this,edge:this})}getDefaultMarkup(){return this.store.get("defaultMarkup")||t.Markup.getEdgeMarkup()}getMarkup(){return super.getMarkup()||this.getDefaultMarkup()}translate(t,e,n={}){return n.translateBy=n.translateBy||this.id,n.tx=t,n.ty=e,this.applyToPoints((n=>({x:(n.x||0)+t,y:(n.y||0)+e})),n)}scale(t,e,n,r={}){return this.applyToPoints((r=>jf.create(r).scale(t,e,n).toJSON()),r)}applyToPoints(t,e={}){const n={},r=this.getSource(),i=this.getTarget();jf.isPointLike(r)&&(n.source=t(r)),jf.isPointLike(i)&&(n.target=t(i));const s=this.getVertices();return s.length>0&&(n.vertices=s.map(t)),this.store.set(n,e),this}getBBox(){return this.getPolyline().bbox()}getConnectionPoint(){return this.getPolyline().pointAt(.5)}getPolyline(){const t=[this.getSourcePoint(),...this.getVertices().map((t=>jf.create(t))),this.getTargetPoint()];return new Ff(t)}updateParent(t){let e=null;const n=this.getSourceCell(),r=this.getTargetCell(),i=this.getParent();return n&&r&&(e=n===r||n.isDescendantOf(r)?r:r.isDescendantOf(n)?n:Hv.getCommonAncestor(n,r)),i&&e&&e.id!==i.id&&i.unembed(this,t),!e||i&&i.id===e.id||e.embed(this,t),e}hasLoop(t={}){const e=this.getSource(),n=this.getTarget(),r=e.cell,i=n.cell;if(!r||!i)return!1;let s=r===i;if(!s&&t.deep&&this._model){const e=this.getSourceCell(),n=this.getTargetCell();e&&n&&(s=e.isAncestorOf(n,t)||n.isAncestorOf(e,t))}return s}getFragmentAncestor(){const t=[this,this.getSourceNode(),this.getTargetNode()].filter((t=>null!=t));return this.getCommonAncestor(...t)}isFragmentDescendantOf(t){const e=this.getFragmentAncestor();return!!e&&(e.id===t.id||e.isDescendantOf(t))}};Yv.defaults={},function(t){t.equalTerminals=function(t,e){const n=t,r=e;return n.cell===r.cell&&(n.port===r.port||null==n.port&&null==r.port)}}(Yv||(Yv={})),function(t){t.defaultLabel={markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}],attrs:{text:{fill:"#000",fontSize:14,textAnchor:"middle",textVerticalAnchor:"middle",pointerEvents:"none"},rect:{ref:"label",fill:"#fff",rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}},t.parseStringLabel=function(t){return{attrs:{label:{text:t}}}}}(Yv||(Yv={})),function(t){t.toStringTag=`X6.${t.name}`,t.isEdge=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&"function"==typeof r.isNode&&"function"==typeof r.isEdge&&"function"==typeof r.prop&&"function"==typeof r.attr&&"function"==typeof r.disconnect&&"function"==typeof r.getSource&&"function"==typeof r.getTarget}}(Yv||(Yv={})),function(t){t.registry=np.create({type:"edge",process(n,r){if(Gv.exist(n,!1))throw new Error(`Edge with name '${n}' was registered by anthor Node`);if("function"==typeof r)return r.config({shape:n}),r;let i=t;const{inherit:s="edge"}=r,o=e(r,["inherit"]);if("string"==typeof s){const t=this.get(s||"edge");null==t&&s?this.onNotFound(s,"inherited"):i=t}else i=s;null==o.constructorName&&(o.constructorName=n);const a=i.define.call(i,o);return a.config({shape:n}),a}}),Gv.setEdgeRegistry(t.registry)}(Yv||(Yv={})),function(t){let n=0;t.define=function(r){const{constructorName:i,overwrite:s}=r,o=e(r,["constructorName","overwrite"]),a=mu((l=i||o.shape)?Ou(l):(n+=1,`CustomEdge${n}`),this);var l;return a.config(o),o.shape&&t.registry.register(o.shape,a,s),a},t.create=function(e){const n=e.shape||"edge",r=t.registry.get(n);return r?new r(e):t.registry.onNotFound(n)}}(Yv||(Yv={})),function(t){const n="basic.edge";t.config({shape:n,propHooks(n){const{label:r,vertices:i}=n,s=e(n,["label","vertices"]);if(r){null==s.labels&&(s.labels=[]);const e="string"==typeof r?t.parseStringLabel(r):r;s.labels.push(e)}return i&&Array.isArray(i)&&(s.vertices=i.map((t=>jf.create(t).toJSON()))),s}}),t.registry.register(n,t)}(Yv||(Yv={}));class Zv extends Pu{constructor(t,e={}){super(),this.length=0,this.comparator=e.comparator||"zIndex",this.clean(),t&&this.reset(t,{silent:!0})}toJSON(){return this.cells.map((t=>t.toJSON()))}add(t,e,n){let r,i;"number"==typeof e?(r=e,i=Object.assign({merge:!1},n)):(r=this.length,i=Object.assign({merge:!1},e)),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);const s=Array.isArray(t)?t:[t],o=this.comparator&&"number"!=typeof e&&!1!==i.sort,a=this.comparator||null;let l=!1;const c=[],h=[];return s.forEach((t=>{const e=this.get(t);e?i.merge&&!t.isSameStore(e)&&(e.setProp(t.getProp(),n),h.push(e),o&&!l&&(l=null==a||"function"==typeof a?e.hasChanged():"string"==typeof a?e.hasChanged(a):a.some((t=>e.hasChanged(t))))):(c.push(t),this.reference(t))})),c.length&&(o&&(l=!0),this.cells.splice(r,0,...c),this.length=this.cells.length),l&&this.sort({silent:!0}),i.silent||(c.forEach(((t,e)=>{const n={cell:t,index:r+e,options:i};this.trigger("added",n),i.dryrun||t.notify("added",Object.assign({},n))})),l&&this.trigger("sorted"),(c.length||h.length)&&this.trigger("updated",{added:c,merged:h,removed:[],options:i})),this}remove(t,e={}){const n=Array.isArray(t)?t:[t],r=this.removeCells(n,e);return!e.silent&&r.length>0&&this.trigger("updated",{options:e,removed:r,added:[],merged:[]}),Array.isArray(t)?r:r[0]}removeCells(t,e){const n=[];for(let r=0;r<t.length;r+=1){const i=this.get(t[r]);if(null==i)continue;const s=this.cells.indexOf(i);this.cells.splice(s,1),this.length-=1,delete this.map[i.id],n.push(i),this.unreference(i),e.dryrun||i.remove(),e.silent||(this.trigger("removed",{cell:i,index:s,options:e}),e.dryrun||i.notify("removed",{cell:i,index:s,options:e}))}return n}reset(t,e={}){const n=this.cells.slice();if(n.forEach((t=>this.unreference(t))),this.clean(),this.add(t,Object.assign({silent:!0},e)),!e.silent){const t=this.cells.slice();this.trigger("reseted",{options:e,previous:n,current:t});const r=[],i=[];t.forEach((t=>{n.some((e=>e.id===t.id))||r.push(t)})),n.forEach((e=>{t.some((t=>t.id===e.id))||i.push(e)})),this.trigger("updated",{options:e,added:r,removed:i,merged:[]})}return this}push(t,e){return this.add(t,this.length,e)}pop(t){const e=this.at(this.length-1);return this.remove(e,t)}unshift(t,e){return this.add(t,0,e)}shift(t){const e=this.at(0);return this.remove(e,t)}get(t){if(null==t)return null;const e="string"==typeof t||"number"==typeof t?t:t.id;return this.map[e]||null}has(t){return null!=this.get(t)}at(t){return t<0&&(t+=this.length),this.cells[t]||null}first(){return this.at(0)}last(){return this.at(-1)}indexOf(t){return this.cells.indexOf(t)}toArray(){return this.cells.slice()}sort(t={}){return null!=this.comparator&&(this.cells=Ec(this.cells,this.comparator),t.silent||this.trigger("sorted")),this}clone(){return new(0,this.constructor)(this.cells.slice(),{comparator:this.comparator})}reference(t){this.map[t.id]=t,t.on("*",this.notifyCellEvent,this)}unreference(t){t.off("*",this.notifyCellEvent,this),delete this.map[t.id]}notifyCellEvent(t,e){const n=e.cell;this.trigger(`cell:${t}`,e),n&&(n.isNode()?this.trigger(`node:${t}`,Object.assign(Object.assign({},e),{node:n})):n.isEdge()&&this.trigger(`edge:${t}`,Object.assign(Object.assign({},e),{edge:n})))}clean(){this.length=0,this.cells=[],this.map={}}dispose(){this.reset([])}}n([Zv.dispose()],Zv.prototype,"dispose",null);class Kv extends Pu{get[Symbol.toStringTag](){return Kv.toStringTag}constructor(t=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new Zv(t),this.setup()}notify(t,e){this.trigger(t,e);const n=this.graph;return n&&("sorted"===t||"reseted"===t||"updated"===t?n.trigger(`model:${t}`,e):n.trigger(t,e)),this}setup(){const t=this.collection;t.on("sorted",(()=>this.notify("sorted",null))),t.on("updated",(t=>this.notify("updated",t))),t.on("cell:change:zIndex",(()=>this.sortOnChangeZ())),t.on("added",(({cell:t})=>{this.onCellAdded(t)})),t.on("removed",(t=>{const e=t.cell;this.onCellRemoved(e,t.options),this.notify("cell:removed",t),e.isNode()?this.notify("node:removed",Object.assign(Object.assign({},t),{node:e})):e.isEdge()&&this.notify("edge:removed",Object.assign(Object.assign({},t),{edge:e}))})),t.on("reseted",(t=>{this.onReset(t.current),this.notify("reseted",t)})),t.on("edge:change:source",(({edge:t})=>this.onEdgeTerminalChanged(t,"source"))),t.on("edge:change:target",(({edge:t})=>{this.onEdgeTerminalChanged(t,"target")}))}sortOnChangeZ(){this.collection.sort()}onCellAdded(t){const e=t.id;t.isEdge()?(t.updateParent(),this.edges[e]=!0,this.onEdgeTerminalChanged(t,"source"),this.onEdgeTerminalChanged(t,"target")):this.nodes[e]=!0}onCellRemoved(t,e){const n=t.id;if(t.isEdge()){delete this.edges[n];const e=t.getSource(),r=t.getTarget();if(e&&e.cell){const t=this.outgoings[e.cell],r=t?t.indexOf(n):-1;r>=0&&(t.splice(r,1),0===t.length&&delete this.outgoings[e.cell])}if(r&&r.cell){const t=this.incomings[r.cell],e=t?t.indexOf(n):-1;e>=0&&(t.splice(e,1),0===t.length&&delete this.incomings[r.cell])}}else delete this.nodes[n];e.clear||(e.disconnectEdges?this.disconnectConnectedEdges(t,e):this.removeConnectedEdges(t,e)),t.model===this&&(t.model=null)}onReset(t){this.nodes={},this.edges={},this.outgoings={},this.incomings={},t.forEach((t=>this.onCellAdded(t)))}onEdgeTerminalChanged(t,e){const n="source"===e?this.outgoings:this.incomings,r=t.previous(e);if(r&&r.cell){const e=Hv.isCell(r.cell)?r.cell.id:r.cell,i=n[e],s=i?i.indexOf(t.id):-1;s>=0&&(i.splice(s,1),0===i.length&&delete n[e])}const i=t.getTerminal(e);if(i&&i.cell){const e=Hv.isCell(i.cell)?i.cell.id:i.cell,r=n[e]||[];-1===r.indexOf(t.id)&&r.push(t.id),n[e]=r}}prepareCell(t,e){return t.model||e&&e.dryrun||(t.model=this),null==t.zIndex&&t.setZIndex(this.getMaxZIndex()+1,{silent:!0}),t}resetCells(t,e={}){return t.map((t=>this.prepareCell(t,Object.assign(Object.assign({},e),{dryrun:!0})))),this.collection.reset(t,e),t.map((t=>this.prepareCell(t,{options:e}))),this}clear(t={}){const e=this.getCells();if(0===e.length)return this;const n=Object.assign(Object.assign({},t),{clear:!0});return this.batchUpdate("clear",(()=>{const t=e.sort(((t,e)=>(t.isEdge()?1:2)-(e.isEdge()?1:2)));for(;t.length>0;){const e=t.shift();e&&e.remove(n)}}),n),this}addNode(t,e={}){const n=Xv.isNode(t)?t:this.createNode(t);return this.addCell(n,e),n}updateNode(t,e={}){const n=this.createNode(t),r=n.getProp();return n.dispose(),this.updateCell(r,e)}createNode(t){return Xv.create(t)}addEdge(t,e={}){const n=Yv.isEdge(t)?t:this.createEdge(t);return this.addCell(n,e),n}createEdge(t){return Yv.create(t)}updateEdge(t,e={}){const n=this.createEdge(t),r=n.getProp();return n.dispose(),this.updateCell(r,e)}addCell(t,e={}){return Array.isArray(t)?this.addCells(t,e):(this.collection.has(t)||this.addings.has(t)||(this.addings.set(t,!0),this.collection.add(this.prepareCell(t,e),e),t.eachChild((t=>this.addCell(t,e))),this.addings.delete(t)),this)}addCells(t,e={}){const n=t.length;if(0===n)return this;const r=Object.assign(Object.assign({},e),{position:n-1,maxPosition:n-1});return this.startBatch("add",Object.assign(Object.assign({},r),{cells:t})),t.forEach((t=>{this.addCell(t,r),r.position-=1})),this.stopBatch("add",Object.assign(Object.assign({},r),{cells:t})),this}updateCell(t,e={}){const n=t.id&&this.getCell(t.id);return!!n&&this.batchUpdate("update",(()=>(Object.entries(t).forEach((([t,r])=>n.setProp(t,r,e))),!0)),t)}removeCell(t,e={}){const n="string"==typeof t?this.getCell(t):t;return n&&this.has(n)?this.collection.remove(n,e):null}updateCellId(t,e){if(t.id===e)return;this.startBatch("update",{id:e}),t.prop("id",e);const n=t.clone({keepId:!0});this.addCell(n);return this.getConnectedEdges(t).forEach((n=>{const r=n.getSourceCell(),i=n.getTargetCell();r===t&&n.setSource(Object.assign(Object.assign({},n.getSource()),{cell:e})),i===t&&n.setTarget(Object.assign(Object.assign({},n.getTarget()),{cell:e}))})),this.removeCell(t),this.stopBatch("update",{id:e}),n}removeCells(t,e={}){return t.length?this.batchUpdate("remove",(()=>t.map((t=>this.removeCell(t,e))))):[]}removeConnectedEdges(t,e={}){const n=this.getConnectedEdges(t);return n.forEach((t=>{t.remove(e)})),n}disconnectConnectedEdges(t,e={}){const n="string"==typeof t?t:t.id;this.getConnectedEdges(t).forEach((t=>{const r=t.getSourceCellId(),i=t.getTargetCellId();r===n&&t.setSource({x:0,y:0},e),i===n&&t.setTarget({x:0,y:0},e)}))}has(t){return this.collection.has(t)}total(){return this.collection.length}indexOf(t){return this.collection.indexOf(t)}getCell(t){return this.collection.get(t)}getCells(){return this.collection.toArray()}getFirstCell(){return this.collection.first()}getLastCell(){return this.collection.last()}getMinZIndex(){const t=this.collection.first();return t&&t.getZIndex()||0}getMaxZIndex(){const t=this.collection.last();return t&&t.getZIndex()||0}getCellsFromCache(t){return t?Object.keys(t).map((t=>this.getCell(t))).filter((t=>null!=t)):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(t){const e="string"==typeof t?t:t.id,n=this.outgoings[e];return n?n.map((t=>this.getCell(t))).filter((t=>t&&t.isEdge())):null}getIncomingEdges(t){const e="string"==typeof t?t:t.id,n=this.incomings[e];return n?n.map((t=>this.getCell(t))).filter((t=>t&&t.isEdge())):null}getConnectedEdges(t,e={}){const n=[],r="string"==typeof t?this.getCell(t):t;if(null==r)return n;const i={},s=e.indirect;let o=e.incoming,a=e.outgoing;null==o&&null==a&&(o=a=!0);const l=(t,e)=>{const r=e?this.getOutgoingEdges(t):this.getIncomingEdges(t);if(null!=r&&r.forEach((t=>{i[t.id]||(n.push(t),i[t.id]=!0,s&&(o&&l(t,!1),a&&l(t,!0)))})),s&&t.isEdge()){const r=e?t.getTargetCell():t.getSourceCell();r&&r.isEdge()&&(i[r.id]||(n.push(r),l(r,e)))}};if(a&&l(r,!0),o&&l(r,!1),e.deep){const t=r.getDescendants({deep:!0}),s={};t.forEach((t=>{t.isNode()&&(s[t.id]=!0)}));const l=(t,r)=>{const o=r?this.getOutgoingEdges(t.id):this.getIncomingEdges(t.id);null!=o&&o.forEach((t=>{if(!i[t.id]){const r=t.getSourceCell(),o=t.getTargetCell();if(!e.enclosed&&r&&s[r.id]&&o&&s[o.id])return;n.push(t),i[t.id]=!0}}))};t.forEach((t=>{t.isEdge()||(a&&l(t,!0),o&&l(t,!1))}))}return n}isBoundary(t,e){const n="string"==typeof t?this.getCell(t):t,r=e?this.getIncomingEdges(n):this.getOutgoingEdges(n);return null==r||0===r.length}getBoundaryNodes(t){const e=[];return Object.keys(this.nodes).forEach((n=>{if(this.isBoundary(n,t)){const t=this.getCell(n);t&&e.push(t)}})),e}getRoots(){return this.getBoundaryNodes(!0)}getLeafs(){return this.getBoundaryNodes(!1)}isRoot(t){return this.isBoundary(t,!0)}isLeaf(t){return this.isBoundary(t,!1)}getNeighbors(t,e={}){let n=e.incoming,r=e.outgoing;null==n&&null==r&&(n=r=!0);const i=this.getConnectedEdges(t,e).reduce(((i,s)=>{const o=s.hasLoop(e),a=s.getSourceCell(),l=s.getTargetCell();return n&&a&&a.isNode()&&!i[a.id]&&(!o&&(a===t||e.deep&&a.isDescendantOf(t))||(i[a.id]=a)),r&&l&&l.isNode()&&!i[l.id]&&(!o&&(l===t||e.deep&&l.isDescendantOf(t))||(i[l.id]=l)),i}),{});if(t.isEdge()){if(n){const e=t.getSourceCell();e&&e.isNode()&&!i[e.id]&&(i[e.id]=e)}if(r){const e=t.getTargetCell();e&&e.isNode()&&!i[e.id]&&(i[e.id]=e)}}return Object.keys(i).map((t=>i[t]))}isNeighbor(t,e,n={}){let r=n.incoming,i=n.outgoing;return null==r&&null==i&&(r=i=!0),this.getConnectedEdges(t,n).some((t=>{const n=t.getSourceCell(),s=t.getTargetCell();return!(!r||!n||n.id!==e.id)||!(!i||!s||s.id!==e.id)}))}getSuccessors(t,e={}){const n=[];return this.search(t,((r,i)=>{r!==t&&this.matchDistance(i,e.distance)&&n.push(r)}),Object.assign(Object.assign({},e),{outgoing:!0})),n}isSuccessor(t,e,n={}){let r=!1;return this.search(t,((i,s)=>{if(i===e&&i!==t&&this.matchDistance(s,n.distance))return r=!0,!1}),Object.assign(Object.assign({},n),{outgoing:!0})),r}getPredecessors(t,e={}){const n=[];return this.search(t,((r,i)=>{r!==t&&this.matchDistance(i,e.distance)&&n.push(r)}),Object.assign(Object.assign({},e),{incoming:!0})),n}isPredecessor(t,e,n={}){let r=!1;return this.search(t,((i,s)=>{if(i===e&&i!==t&&this.matchDistance(s,n.distance))return r=!0,!1}),Object.assign(Object.assign({},n),{incoming:!0})),r}matchDistance(t,e){return null==e||("function"==typeof e?e(t):!(!Array.isArray(e)||!e.includes(t))||t===e)}getCommonAncestor(...t){const e=[];return t.forEach((t=>{t&&(Array.isArray(t)?e.push(...t):e.push(t))})),Hv.getCommonAncestor(...e)}getSubGraph(t,e={}){const n=[],r={},i=[],s=[],o=t=>{r[t.id]||(n.push(t),r[t.id]=t,t.isEdge()&&s.push(t),t.isNode()&&i.push(t))};return t.forEach((t=>{if(o(t),e.deep){t.getDescendants({deep:!0}).forEach((t=>o(t)))}})),s.forEach((t=>{const e=t.getSourceCell(),s=t.getTargetCell();e&&!r[e.id]&&(n.push(e),r[e.id]=e,e.isNode()&&i.push(e)),s&&!r[s.id]&&(n.push(s),r[s.id]=s,s.isNode()&&i.push(s))})),i.forEach((t=>{this.getConnectedEdges(t,e).forEach((t=>{const e=t.getSourceCell(),i=t.getTargetCell();!r[t.id]&&e&&r[e.id]&&i&&r[i.id]&&(n.push(t),r[t.id]=t)}))})),n}cloneSubGraph(t,e={}){const n=this.getSubGraph(t,e);return this.cloneCells(n)}cloneCells(t){return Hv.cloneCells(t)}getNodesFromPoint(t,e){const n="number"==typeof t?{x:t,y:e||0}:t;return this.getNodes().filter((t=>t.getBBox().containsPoint(n)))}getNodesInArea(t,e,n,r,i){const s="number"==typeof t?new _f(t,e,n,r):_f.create(t),o="number"==typeof t?i:e,a=o&&o.strict;return this.getNodes().filter((t=>{const e=t.getBBox();return a?s.containsRect(e):s.isIntersectWithRect(e)}))}getEdgesInArea(t,e,n,r,i){const s="number"==typeof t?new _f(t,e,n,r):_f.create(t),o="number"==typeof t?i:e,a=o&&o.strict;return this.getEdges().filter((t=>{const e=t.getBBox();return 0===e.width?e.inflate(1,0):0===e.height&&e.inflate(0,1),a?s.containsRect(e):s.isIntersectWithRect(e)}))}getNodesUnderNode(t,e={}){const n=t.getBBox();return(null==e.by||"bbox"===e.by?this.getNodesInArea(n):this.getNodesFromPoint(n[e.by])).filter((e=>t.id!==e.id&&!e.isDescendantOf(t)))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(t,e={}){return Hv.getCellsBBox(t,e)}search(t,e,n={}){n.breadthFirst?this.breadthFirstSearch(t,e,n):this.depthFirstSearch(t,e,n)}breadthFirstSearch(t,e,n={}){const r=[],i={},s={};for(r.push(t),s[t.id]=0;r.length>0;){const t=r.shift();if(null==t||i[t.id])continue;if(i[t.id]=!0,!1===su(e,this,t,s[t.id]))continue;this.getNeighbors(t,n).forEach((e=>{s[e.id]=s[t.id]+1,r.push(e)}))}}depthFirstSearch(t,e,n={}){const r=[],i={},s={};for(r.push(t),s[t.id]=0;r.length>0;){const t=r.pop();if(null==t||i[t.id])continue;if(i[t.id]=!0,!1===su(e,this,t,s[t.id]))continue;const o=this.getNeighbors(t,n),a=r.length;o.forEach((e=>{s[e.id]=s[t.id]+1,r.splice(a,0,e)}))}}getShortestPath(e,n,r={}){const i={};this.getEdges().forEach((t=>{const e=t.getSourceCellId(),n=t.getTargetCellId();e&&n&&(i[e]||(i[e]=[]),i[n]||(i[n]=[]),i[e].push(n),r.directed||i[n].push(e))}));const s="string"==typeof e?e:e.id,o=t.Dijkstra.run(i,s,r.weight),a=[];let l="string"==typeof n?n:n.id;for(o[l]&&a.push(l);l=o[l];)a.unshift(l);return a}translate(t,e,n){return this.getCells().filter((t=>!t.hasParent())).forEach((r=>r.translate(t,e,n))),this}resize(t,e,n){return this.resizeCells(t,e,this.getCells(),n)}resizeCells(t,e,n,r={}){const i=this.getCellsBBox(n);if(i){const s=Math.max(t/i.width,0),o=Math.max(e/i.height,0),a=i.getOrigin();n.forEach((t=>t.scale(s,o,a,r)))}return this}toJSON(t={}){return Kv.toJSON(this.getCells(),t)}parseJSON(t){return Kv.fromJSON(t)}fromJSON(t,e={}){const n=this.parseJSON(t);return this.resetCells(n,e),this}startBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)+1,this.notify("batch:start",{name:t,data:e}),this}stopBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)-1,this.notify("batch:stop",{name:t,data:e}),this}batchUpdate(t,e,n={}){this.startBatch(t,n);const r=e();return this.stopBatch(t,n),r}hasActiveBatch(t=Object.keys(this.batches)){return(Array.isArray(t)?t:[t]).some((t=>this.batches[t]>0))}dispose(){this.collection.dispose()}}n([Kv.dispose()],Kv.prototype,"dispose",null),function(t){t.toStringTag=`X6.${t.name}`,t.isModel=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&"function"==typeof r.addNode&&"function"==typeof r.addEdge&&null!=r.collection}}(Kv||(Kv={})),function(t){t.toJSON=function(t,e={}){return{cells:t.map((t=>t.toJSON(e)))}},t.fromJSON=function(t){const e=[];return Array.isArray(t)?e.push(...t):(t.cells&&e.push(...t.cells),t.nodes&&t.nodes.forEach((t=>{null==t.shape&&(t.shape="rect"),e.push(t)})),t.edges&&t.edges.forEach((t=>{null==t.shape&&(t.shape="edge"),e.push(t)}))),e.map((t=>{const e=t.shape;if(e){if(Xv.registry.exist(e))return Xv.create(t);if(Yv.registry.exist(e))return Yv.create(t)}throw new Error("The `shape` should be specified when creating a node/edge instance")}))}}(Kv||(Kv={}));let Qv=class extends Xv{get label(){return this.getLabel()}set label(t){this.setLabel(t)}getLabel(){return this.getAttrByPath("text/text")}setLabel(t,e){return null==t?this.removeLabel():this.setAttrByPath("text/text",t,e),this}removeLabel(){return this.removeAttrByPath("text/text"),this}};function tb(t,e="body"){return[{tagName:t,selector:e},{tagName:"text",selector:"label"}]}function eb(t,e,n={}){const r={constructorName:t,markup:tb(t,n.selector),attrs:{[t]:Object.assign({},Qv.bodyAttr)}};return(n.parent||Qv).define(Ya(r,e,{shape:t}))}!function(t){t.bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},t.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},t.config({attrs:{text:Object.assign({},t.labelAttr)},propHooks(t){const{label:n}=t,r=e(t,["label"]);return n&&xu(r,"attrs/text/text",n),r},visible:!0})}(Qv||(Qv={}));const nb=eb("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}}),rb=Yv.define({shape:"edge",markup:[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}],attrs:{lines:{connection:!0,strokeLinejoin:"round"},wrap:{strokeWidth:10},line:{stroke:"#333",strokeWidth:2,targetMarker:"classic"}}}),ib=eb("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});class sb extends Qv{get points(){return this.getPoints()}set points(t){this.setPoints(t)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(t,e){return null==t?this.removePoints():this.setAttrByPath("body/refPoints",sb.pointsToString(t),e),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}!function(t){function n(t){return"string"==typeof t?t:t.map((t=>Array.isArray(t)?t.join(","):jf.isPointLike(t)?`${t.x}, ${t.y}`:"")).join(" ")}t.pointsToString=n,t.config({propHooks(t){const{points:r}=t,i=e(t,["points"]);if(r){const t=n(r);t&&xu(i,"attrs/body/refPoints",t)}return i}})}(sb||(sb={}));const ob=eb("polygon",{},{parent:sb}),ab=eb("polyline",{},{parent:sb}),lb=Qv.define({shape:"path",markup:[{tagName:"rect",selector:"bg"},{tagName:"path",selector:"body"},{tagName:"text",selector:"label"}],attrs:{bg:{refWidth:"100%",refHeight:"100%",fill:"none",stroke:"none",pointerEvents:"all"},body:{fill:"none",stroke:"#000",strokeWidth:2}},propHooks(t){const{path:n}=t,r=e(t,["path"]);return n&&xu(r,"attrs/body/refD",n),r}}),cb=Qv.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},t.Platform.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:vg.xhtml,selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]}:{tagName:"text",selector:"label",attrs:{textAnchor:"middle"}}],attrs:{body:Object.assign(Object.assign({},Qv.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(t){const{text:n}=t,r=e(t,["text"]);return n&&xu(r,"attrs/label/text",n),r},attrHooks:{text:{set(t,{cell:e,view:n,refBBox:r,elem:i,attrs:s}){if(!(i instanceof HTMLElement)){const o=s.style||{},a={text:t,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},o);return su(jm.presets.textWrap.set,this,a,{cell:e,view:n,elem:i,refBBox:r,attrs:l}),{fill:o.color||null}}i.textContent=t},position(t,{refBBox:e,elem:n}){if(n instanceof SVGElement)return e.getCenter()}}}}),hb=eb("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:function(t="xlink:href"){return n=>{const{imageUrl:r,imageWidth:i,imageHeight:s}=n,o=e(n,["imageUrl","imageWidth","imageHeight"]);if(null!=r||null!=i||null!=s){const e=()=>{if(o.attrs){const e=o.attrs.image;null!=r&&(e[t]=r),null!=i&&(e.width=i),null!=s&&(e.height=s),o.attrs.image=e}};o.attrs?(null==o.attrs.image&&(o.attrs.image={}),e()):(o.attrs={image:{}},e())}return o}}()},{selector:"image"}),ub=eb("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class gb extends cy{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return gb.toStringTag}getContainerClassName(){const t=[super.getContainerClassName(),this.prefixClassName("node")];return this.can("nodeMovable")||t.push(this.prefixClassName("node-immovable")),t.join(" ")}updateClassName(t){const e=t.target;if(e.hasAttribute("magnet")){const t=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?gg(e,t):ug(e,t)}else{const t=this.prefixClassName("node-immovable");this.can("nodeMovable")?this.removeClass(t):this.addClass(t)}}isNodeView(){return!0}confirmUpdate(t,e={}){let n=t;return this.hasAction(n,"ports")&&(this.removePorts(),this.cleanPortsCache()),this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","resize","translate","rotate","ports","tools"])):(n=this.handleAction(n,"resize",(()=>this.resize()),"update"),n=this.handleAction(n,"update",(()=>this.update()),Lm.useCSSSelector?"ports":null),n=this.handleAction(n,"translate",(()=>this.translate())),n=this.handleAction(n,"rotate",(()=>this.rotate())),n=this.handleAction(n,"ports",(()=>this.renderPorts())),n=this.handleAction(n,"tools",(()=>{this.getFlag("tools")===t?this.renderTools():this.updateTools(e)}))),n}update(t){this.cleanCache(),Lm.useCSSSelector&&this.removePorts();const e=this.cell,n=e.getSize(),r=e.getAttrs();this.updateAttrs(this.container,r,{attrs:t===r?null:t,rootBBox:new _f(0,0,n.width,n.height),selectors:this.selectors}),Lm.useCSSSelector&&this.renderPorts()}renderMarkup(){const t=this.cell.markup;if(t){if("string"==typeof t)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid node markup.")}renderJSONMarkup(t){const e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.appendChild(e.fragment)}render(){return this.empty(),this.renderMarkup(),this.resize(),this.updateTransform(),Lm.useCSSSelector||this.renderPorts(),this.renderTools(),this}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){const t=this.cell.getPosition();return`translate(${t.x},${t.y})`}getRotationString(){const t=this.cell.getAngle();if(t){const e=this.cell.getSize();return`rotate(${t},${e.width/2},${e.height/2})`}}updateTransform(){let t=this.getTranslationString();const e=this.getRotationString();e&&(t+=` ${e}`),this.container.setAttribute("transform",t)}findPortElem(t,e){const n=t?this.portsCache[t]:null;if(!n)return null;const r=n.portContentElement,i=n.portContentSelectors||{};return this.findOne(e,r,i)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach((t=>{Ng(t.portElement)}))}renderPorts(){const t=this.container,e=[];t.childNodes.forEach((t=>{e.push(t)}));const n=this.cell.getParsedPorts(),r=Uo(n,"zIndex"),i="auto";r[i]&&r[i].forEach((n=>{const r=this.getPortElement(n);t.append(r),e.push(r)})),Object.keys(r).forEach((t=>{if(t!==i){const n=parseInt(t,10);this.appendPorts(r[t],n,e)}})),this.updatePorts()}appendPorts(t,e,n){const r=t.map((t=>this.getPortElement(t)));n[e]||e<0?Bg(n[Math.max(e,0)],r):_g(this.container,r)}getPortElement(t){const e=this.portsCache[t.id];return e?e.portElement:this.createPortElement(t)}createPortElement(e){let n=t.Markup.renderMarkup(this.cell.getPortContainerMarkup());const r=n.elem;if(null==r)throw new Error("Invalid port container markup.");n=t.Markup.renderMarkup(this.getPortMarkup(e));const i=n.elem,s=n.selectors;if(null==i)throw new Error("Invalid port markup.");this.setAttrs({port:e.id,"port-group":e.group},i);let o="x6-port";e.group&&(o+=` x6-port-${e.group}`),ug(r,o),ug(r,"x6-port"),ug(i,"x6-port-body"),r.appendChild(i);let a,l,c=s;if(this.existPortLabel(e)){if(n=t.Markup.renderMarkup(this.getPortLabelMarkup(e.label)),a=n.elem,l=n.selectors,null==a)throw new Error("Invalid port label markup.");if(s&&l){for(const t in l)if(s[t]&&t!==this.rootSelector)throw new Error("Selectors within port must be unique.");c=Object.assign(Object.assign({},s),l)}ug(a,"x6-port-label"),r.appendChild(a)}return this.portsCache[e.id]={portElement:r,portSelectors:c,portLabelElement:a,portLabelSelectors:l,portContentElement:i,portContentSelectors:s},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:e,node:this.cell,container:r,selectors:c,labelContainer:a,labelSelectors:l,contentContainer:i,contentSelectors:s}),r}updatePorts(){const t=this.cell.getParsedGroups(),e=Object.keys(t);0===e.length?this.updatePortGroup():e.forEach((t=>this.updatePortGroup(t)))}updatePortGroup(t){const e=_f.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(t,e);for(let t=0,e=n.length;t<e;t+=1){const e=n[t],r=e.portId,i=this.portsCache[r]||{},s=e.portLayout;if(this.applyPortTransform(i.portElement,s),null!=e.portAttrs){const t={selectors:i.portSelectors||{}};e.portSize&&(t.rootBBox=_f.fromSize(e.portSize)),this.updateAttrs(i.portElement,e.portAttrs,t)}const o=e.labelLayout;if(o&&i.portLabelElement&&(this.applyPortTransform(i.portLabelElement,o,-(s.angle||0)),o.attrs)){const t={selectors:i.portLabelSelectors||{}};e.labelSize&&(t.rootBBox=_f.fromSize(e.labelSize)),this.updateAttrs(i.portLabelElement,o.attrs,t)}}}applyPortTransform(t,e,n=0){const r=e.angle,i=e.position;Qd(t,Gd().rotate(n).translate(i.x||0,i.y||0).rotate(r||0),{absolute:!0})}getPortMarkup(t){return t.markup||this.cell.portMarkup}getPortLabelMarkup(t){return t.markup||this.cell.portLabelMarkup}existPortLabel(t){return t.attrs&&t.attrs.text}getEventArgs(t,e,n){const r=this,i=r.cell;return null==e||null==n?{e:t,view:r,node:i,cell:i}:{e:t,x:e,y:n,view:r,node:i,cell:i}}getPortEventArgs(t,e,n){const r=this,i=r.cell,s=i;return n?{e:t,x:n.x,y:n.y,view:r,node:i,cell:s,port:e}:{e:t,view:r,node:i,cell:s,port:e}}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("node:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("node:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("node:mouseup",this.getEventArgs(t,e,n))}notifyPortEvent(t,e,n){const r=this.findAttr("port",e.target);if(r){const i=e.type;"node:port:mouseenter"===t?e.type="mouseenter":"node:port:mouseleave"===t&&(e.type="mouseleave"),this.notify(t,this.getPortEventArgs(e,r,n)),e.type=i}}onClick(t,e,n){super.onClick(t,e,n),this.notify("node:click",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:click",t,{x:e,y:n})}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("node:dblclick",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:dblclick",t,{x:e,y:n})}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("node:contextmenu",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:contextmenu",t,{x:e,y:n})}onMouseDown(t,e,n){this.isPropagationStopped(t)||(this.notifyMouseDown(t,e,n),this.notifyPortEvent("node:port:mousedown",t,{x:e,y:n}),this.startNodeDragging(t,e,n))}onMouseMove(t,e,n){const r=this.getEventData(t),i=r.action;if("magnet"===i)this.dragMagnet(t,e,n);else{if("move"===i){const i=r.targetView||this;i.dragNode(t,e,n),i.notify("node:moving",{e:t,x:e,y:n,view:i,cell:i.cell,node:i.cell})}this.notifyMouseMove(t,e,n),this.notifyPortEvent("node:port:mousemove",t,{x:e,y:n})}this.setEventData(t,r)}onMouseUp(t,e,n){const r=this.getEventData(t),i=r.action;if("magnet"===i)this.stopMagnetDragging(t,e,n);else if(this.notifyMouseUp(t,e,n),this.notifyPortEvent("node:port:mouseup",t,{x:e,y:n}),"move"===i){(r.targetView||this).stopNodeDragging(t,e,n)}const s=r.targetMagnet;s&&this.onMagnetClick(t,s,e,n),this.checkMouseleave(t)}onMouseOver(t){super.onMouseOver(t),this.notify("node:mouseover",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseenter",t),this.notifyPortEvent("node:port:mouseover",t)}onMouseOut(t){super.onMouseOut(t),this.notify("node:mouseout",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseleave",t),this.notifyPortEvent("node:port:mouseout",t)}onMouseEnter(t){this.updateClassName(t),super.onMouseEnter(t),this.notify("node:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("node:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,r){super.onMouseWheel(t,e,n,r),this.notify("node:mousewheel",Object.assign({delta:r},this.getEventArgs(t,e,n)))}onMagnetClick(t,e,n,r){const i=this.graph;i.view.getMouseMovedCount(t)>i.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet:e},this.getEventArgs(t,n,r)))}onMagnetDblClick(t,e,n,r){this.notify("node:magnet:dblclick",Object.assign({magnet:e},this.getEventArgs(t,n,r)))}onMagnetContextMenu(t,e,n,r){this.notify("node:magnet:contextmenu",Object.assign({magnet:e},this.getEventArgs(t,n,r)))}onMagnetMouseDown(t,e,n,r){this.startMagnetDragging(t,n,r)}onCustomEvent(t,e,n,r){this.notify("node:customevent",Object.assign({name:e},this.getEventArgs(t,n,r))),super.onCustomEvent(t,e,n,r)}prepareEmbedding(t){const e=this.graph,n=this.getEventData(t).cell||this.cell,r=e.findViewByCell(n),i=e.snapToGrid(t.clientX,t.clientY);this.notify("node:embed",{e:t,node:n,view:r,cell:n,x:i.x,y:i.y,currentParent:n.getParent()})}processEmbedding(t,e){const n=e.cell||this.cell,r=e.graph||this.graph,i=r.options.embedding,s=i.findParent;let o="function"==typeof s?su(s,r,{view:this,node:this.cell}).filter((t=>Hv.isCell(t)&&this.cell.id!==t.id&&!t.isDescendantOf(this.cell))):r.model.getNodesUnderNode(n,{by:s});if(i.frontOnly&&o.length>0){const t=Uo(o,"zIndex"),e=Ha(Object.keys(t).map((t=>parseInt(t,10))));e&&(o=t[e])}o=o.filter((t=>t.visible));let a=null;const l=e.candidateEmbedView,c=i.validate;for(let t=o.length-1;t>=0;t-=1){const e=o[t];if(l&&l.cell.id===e.id){a=l;break}{const t=e.findView(r);if(c&&su(c,r,{child:this.cell,parent:t.cell,childView:this,parentView:t})){a=t;break}}}this.clearEmbedding(e),a&&a.highlight(null,{type:"embedding"}),e.candidateEmbedView=a;const h=r.snapToGrid(t.clientX,t.clientY);this.notify("node:embedding",{e:t,cell:n,node:n,view:r.findViewByCell(n),x:h.x,y:h.y,currentParent:n.getParent(),candidateParent:a?a.cell:null})}clearEmbedding(t){const e=t.candidateEmbedView;e&&(e.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null)}finalizeEmbedding(t,e){this.graph.startBatch("embedding");const n=e.cell||this.cell,r=e.graph||this.graph,i=r.findViewByCell(n),s=n.getParent(),o=e.candidateEmbedView;if(o?(o.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null,null!=s&&s.id===o.cell.id||o.cell.insertChild(n,void 0,{ui:!0})):s&&s.unembed(n,{ui:!0}),r.model.getConnectedEdges(n,{deep:!0}).forEach((t=>{t.updateParent({ui:!0})})),i&&o){const e=r.snapToGrid(t.clientX,t.clientY);i.notify("node:embedded",{e:t,cell:n,x:e.x,y:e.y,node:n,view:r.findViewByCell(n),previousParent:s,currentParent:n.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let t=this.cell,e=this;for(;e&&!t.isEdge();){if(!t.hasParent()||e.can("stopDelegateOnDragging"))return e;t=t.getParent(),e=this.graph.findViewByCell(t)}return null}validateMagnet(t,e,n){if("passive"!==e.getAttribute("magnet")){const r=this.graph.options.connecting.validateMagnet;return!r||su(r,this.graph,{e:n,magnet:e,view:t,cell:t.cell})}return!1}startMagnetDragging(t,e,n){if(!this.can("magnetConnectable"))return;t.stopPropagation();const r=t.currentTarget,i=this.graph;this.setEventData(t,{targetMagnet:r}),this.validateMagnet(this,r,t)?(i.options.magnetThreshold<=0&&this.startConnectting(t,r,e,n),this.setEventData(t,{action:"magnet"}),this.stopPropagation(t)):this.onMouseDown(t,e,n),i.view.delegateDragEvents(t,this)}startConnectting(t,e,n,r){this.graph.model.startBatch("add-edge");const i=this.createEdgeFromMagnet(e,n,r);i.setEventData(t,i.prepareArrowheadDragging("target",{x:n,y:r,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(t,{edgeView:i}),i.notifyMouseDown(t,n,r)}getDefaultEdge(t,e){let n;const r=this.graph.options.connecting.createEdge;return r&&(n=su(r,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),n}createEdgeFromMagnet(t,e,n){const r=this.graph,i=r.model,s=this.getDefaultEdge(this,t);return s.setSource(Object.assign(Object.assign({},s.getSource()),this.getEdgeTerminal(t,e,n,s,"source"))),s.setTarget(Object.assign(Object.assign({},s.getTarget()),{x:e,y:n})),s.addTo(i,{async:!1,ui:!0}),s.findView(r)}dragMagnet(t,e,n){const r=this.getEventData(t),i=r.edgeView;if(i)i.onMouseMove(t,e,n),this.autoScrollGraph(t.clientX,t.clientY);else{const i=this.graph,s=i.options.magnetThreshold,o=this.getEventTarget(t),a=r.targetMagnet;if("onleave"===s){if(a===o||a.contains(o))return}else if(i.view.getMouseMovedCount(t)<=s)return;this.startConnectting(t,a,e,n)}}stopMagnetDragging(t,e,n){const r=this.eventData(t).edgeView;r&&(r.onMouseUp(t,e,n),this.graph.model.stopBatch("add-edge"))}notifyUnhandledMouseDown(t,e,n){this.notify("node:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(t,e,n,r,i){let s=[i];const o=this.graph.getPlugin("selection");if(o&&o.isSelectionMovable()){const t=o.getSelectedCells();t.includes(i)&&(s=t.filter((t=>t.isNode())))}s.forEach((i=>{this.notify(t,{e:e,x:n,y:r,cell:i,node:i,view:i.findView(this.graph)})}))}getRestrictArea(t){const e=this.graph.options.translating.restrict,n="function"==typeof e?su(e,this.graph,t):e;return"number"==typeof n?this.graph.transform.getGraphArea().inflate(n):!0===n?this.graph.transform.getGraphArea():n||null}startNodeDragging(t,e,n){const r=this.getDelegatedView();if(null==r||!r.can("nodeMovable"))return this.notifyUnhandledMouseDown(t,e,n);this.setEventData(t,{targetView:r,action:"move"});const i=jf.create(r.cell.getPosition());r.setEventData(t,{moving:!1,offset:i.diff(e,n),restrict:this.getRestrictArea(r)})}dragNode(e,n,r){const i=this.cell,s=this.graph,o=s.getGridSize(),a=this.getEventData(e),l=a.offset,c=a.restrict;a.moving||(a.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",e,n,r,this.cell)),this.autoScrollGraph(e.clientX,e.clientY);const h=t.GeometryUtil.snapToGrid(n+l.x,o),u=t.GeometryUtil.snapToGrid(r+l.y,o);i.setPosition(h,u,{restrict:c,deep:!0,ui:!0}),s.options.embedding.enabled&&(a.embedding||(this.prepareEmbedding(e),a.embedding=!0),this.processEmbedding(e,a))}autoOffsetNode(){const t=this.cell,e=this.graph,n=Object.assign({id:t.id},t.getPosition()),r=e.getNodes().map((t=>{const e=t.getPosition();return{id:t.id,x:e.x,y:e.y}})).filter((t=>t.id!==n.id)),i=[[1,1],[1,-1],[-1,1],[-1,-1]];let s=e.getGridSize();const o=t=>r.some((e=>e.x===t.x&&e.y===t.y));for(;o(n);){let r=!1;for(let e=0;e<i.length;e+=1){const a=i[e];if(!o({x:n.x+a[0]*s,y:n.y+a[1]*s})){t.translate(a[0]*s,a[1]*s),r=!0;break}}if(r)break;s+=e.getGridSize()}}stopNodeDragging(t,e,n){const r=this.getEventData(t),i=this.graph;if(r.embedding&&this.finalizeEmbedding(t,r),r.moving){i.options.translating.autoOffset&&this.autoOffsetNode(),this.removeClass("node-moving"),this.notifyNodeMove("node:moved",t,e,n,this.cell)}r.moving=!1,r.embedding=!1}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");n&&n.autoScroll(t,e)}}!function(t){t.toStringTag=`X6.${t.name}`,t.isNodeView=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&"function"==typeof r.isNodeView&&"function"==typeof r.isEdgeView&&"function"==typeof r.confirmUpdate&&"function"==typeof r.update&&"function"==typeof r.findPortElem&&"function"==typeof r.resize&&"function"==typeof r.rotate&&"function"==typeof r.translate}}(gb||(gb={})),gb.config({isSvgElement:!0,priority:0,bootstrap:["render"],actions:{view:["render"],markup:["render"],attrs:["update"],size:["resize","ports","tools"],angle:["rotate","tools"],position:["translate","tools"],ports:["ports"],tools:["tools"]}}),gb.registry.register("node",gb,!0);class db extends cy{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return db.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const t=this.sourceView;if(!t){const t=this.cell.getSource();return new _f(t.x,t.y)}const e=this.sourceMagnet;return t.isEdgeElement(e)?new _f(this.sourceAnchor.x,this.sourceAnchor.y):t.getBBoxOfElement(e||t.container)}get targetBBox(){const t=this.targetView;if(!t){const t=this.cell.getTarget();return new _f(t.x,t.y)}const e=this.targetMagnet;return t.isEdgeElement(e)?new _f(this.targetAnchor.x,this.targetAnchor.y):t.getBBoxOfElement(e||t.container)}isEdgeView(){return!0}confirmUpdate(t,e={}){let n=t;if(this.hasAction(n,"source")){if(!this.updateTerminalProperties("source"))return n;n=this.removeAction(n,"source")}if(this.hasAction(n,"target")){if(!this.updateTerminalProperties("target"))return n;n=this.removeAction(n,"target")}return this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","labels","tools"]),n):(n=this.handleAction(n,"update",(()=>this.update(e))),n=this.handleAction(n,"labels",(()=>this.onLabelsChange(e))),n=this.handleAction(n,"tools",(()=>this.renderTools())),n)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this}renderMarkup(){const t=this.cell.markup;if(t){if("string"==typeof t)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid edge markup.")}renderJSONMarkup(t){const e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.append(e.fragment)}customizeLabels(){if(this.labelContainer){const t=this.cell,e=t.labels;for(let n=0,r=e.length;n<r;n+=1){const r=e[n],i=this.labelCache[n],s=this.labelSelectors[n],o=this.graph.options.onEdgeLabelRendered;if(o){const e=o({edge:t,label:r,container:i,selectors:s});e&&(this.labelDestroyFn[n]=e)}}}}destroyCustomizeLabels(){const t=this.cell.labels;if(this.labelCache&&this.labelSelectors&&this.labelDestroyFn)for(let e=0,n=t.length;e<n;e+=1){const n=this.labelDestroyFn[e],r=this.labelCache[e],i=this.labelSelectors[e];n&&r&&i&&n({edge:this.cell,label:t[e],container:r,selectors:i})}this.labelDestroyFn={}}renderLabels(){const t=this.cell,e=t.getLabels(),n=e.length;let r=this.labelContainer;if(this.labelCache={},this.labelSelectors={},n<=0)return r&&r.parentNode&&r.parentNode.removeChild(r),this;r?this.empty(r):(r=Ag("g"),this.addClass(this.prefixClassName("edge-labels"),r),this.labelContainer=r);for(let n=0,i=e.length;n<i;n+=1){const i=e[n],s=this.normalizeLabelMarkup(this.parseLabelMarkup(i.markup));let o,a;if(s)o=s.node,a=s.selectors;else{const e=t.getDefaultLabel(),n=this.normalizeLabelMarkup(this.parseLabelMarkup(e.markup));o=n.node,a=n.selectors}o.setAttribute("data-index",`${n}`),r.appendChild(o);const l=this.rootSelector;if(a[l])throw new Error("Ambiguous label root selector.");a[l]=o,this.labelCache[n]=o,this.labelSelectors[n]=a}return null==r.parentNode&&this.container.appendChild(r),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(t={}){this.destroyCustomizeLabels(),this.shouldRerenderLabels(t)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(t={}){const e=this.cell.previous("labels");if(null==e)return!0;if("propertyPathArray"in t&&"propertyValue"in t){const n=t.propertyPathArray||[],r=n.length;if(r>1){if(e[n[1]]){if(2===r)return"object"==typeof t.propertyValue&&Zo(t.propertyValue,"markup");if("markup"!==n[2])return!1}}}return!0}parseLabelMarkup(t){return t?"string"==typeof t?this.parseLabelStringMarkup(t):this.parseJSONMarkup(t):null}parseLabelStringMarkup(t){const e=yd.createVectors(t),n=document.createDocumentFragment();for(let t=0,r=e.length;t<r;t+=1){const r=e[t].node;n.appendChild(r)}return{fragment:n,selectors:{}}}normalizeLabelMarkup(t){if(null==t)return;const e=t.fragment;if(!(e instanceof DocumentFragment&&e.hasChildNodes()))throw new Error("Invalid label markup.");let n;const r=e.childNodes;return n=r.length>1||"G"!==r[0].nodeName.toUpperCase()?yd.create("g").append(e):yd.create(r[0]),n.addClass(this.prefixClassName("edge-label")),{node:n.node,selectors:t.selectors}}updateLabels(){if(this.labelContainer){const t=this.cell,e=t.labels,n=this.can("edgeLabelMovable"),r=t.getDefaultLabel();for(let t=0,i=e.length;t<i;t+=1){const i=this.labelCache[t],s=this.labelSelectors[t];i.setAttribute("cursor",n?"move":"default");const o=e[t],a=Ya({},r.attrs,o.attrs);this.updateAttrs(i,a,{selectors:s,rootBBox:o.size?_f.fromSize(o.size):void 0})}}}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}update(t={}){this.cleanCache(),this.updateConnection(t);const n=e(this.cell.getAttrs(),["text"]);return null!=n&&this.updateAttrs(this.container,n,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(t),this}removeRedundantLinearVertices(t={}){const e=this.cell,n=e.getVertices(),r=[this.sourceAnchor,...n,this.targetAnchor],i=r.length,s=new Ff(r);s.simplify({threshold:.01});const o=s.points.map((t=>t.toJSON())),a=o.length;return i===a?0:(e.setVertices(o.slice(1,a-1),t),i-a)}getTerminalView(t){switch(t){case"source":return this.sourceView||null;case"target":return this.targetView||null;default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalAnchor(t){switch(t){case"source":return jf.create(this.sourceAnchor);case"target":return jf.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalConnectionPoint(t){switch(t){case"source":return jf.create(this.sourcePoint);case"target":return jf.create(this.targetPoint);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalMagnet(t,e={}){switch(t){case"source":{if(e.raw)return this.sourceMagnet;const t=this.sourceView;return t?this.sourceMagnet||t.container:null}case"target":{if(e.raw)return this.targetMagnet;const t=this.targetView;return t?this.targetMagnet||t.container:null}default:throw new Error(`Unknown terminal type '${t}'`)}}updateConnection(t={}){const e=this.cell;if(t.translateBy&&e.isFragmentDescendantOf(t.translateBy)){const e=t.tx||0,n=t.ty||0;this.routePoints=new Ff(this.routePoints).translate(e,n).points,this.translateConnectionPoints(e,n),this.path.translate(e,n)}else{const t=e.getVertices(),n=this.findAnchors(t);this.sourceAnchor=n.source,this.targetAnchor=n.target,this.routePoints=this.findRoutePoints(t);const r=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=r.source,this.targetPoint=r.target;const i=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,i.source||this.sourcePoint,i.target||this.targetPoint)}this.cleanCache()}findAnchors(t){const e=this.cell,n=e.source,r=e.target,i=t[0],s=t[t.length-1];return r.priority&&!n.priority?this.findAnchorsOrdered("target",s,"source",i):this.findAnchorsOrdered("source",i,"target",s)}findAnchorsOrdered(t,e,n,r){let i,s;const o=this.cell,a=o[t],l=o[n],c=this.getTerminalView(t),h=this.getTerminalView(n),u=this.getTerminalMagnet(t),g=this.getTerminalMagnet(n);if(c){let n;n=e?jf.create(e):h?g:jf.create(l),i=this.getAnchor(a.anchor,c,u,n,t)}else i=jf.create(a);if(h){const t=jf.create(r||i);s=this.getAnchor(l.anchor,h,g,t,n)}else s=jf.isPointLike(l)?jf.create(l):new jf;return{[t]:i,[n]:s}}getAnchor(t,e,n,r,i){const s=e.isEdgeElement(n),o=this.graph.options.connecting;let a,l="string"==typeof t?{name:t}:t;if(!l){const t=s?("source"===i?o.sourceEdgeAnchor:o.targetEdgeAnchor)||o.edgeAnchor:("source"===i?o.sourceAnchor:o.targetAnchor)||o.anchor;l="string"==typeof t?{name:t}:t}if(!l)throw new Error("Anchor should be specified.");const c=l.name;if(s){const t=Zy.registry.get(c);if("function"!=typeof t)return Zy.registry.onNotFound(c);a=su(t,this,e,n,r,l.args||{},i)}else{const t=Wy.registry.get(c);if("function"!=typeof t)return Wy.registry.onNotFound(c);a=su(t,this,e,n,r,l.args||{},i)}return a?a.round(this.POINT_ROUNDING):new jf}findRoutePoints(t=[]){const e=this.graph.options.connecting.router||jv.presets.normal,n=this.cell.getRouter()||e;let r;if("function"==typeof n)r=su(n,this,t,{},this);else{const e="string"==typeof n?n:n.name,i="string"==typeof n?{}:n.args||{},s=e?jv.registry.get(e):jv.presets.normal;if("function"!=typeof s)return jv.registry.onNotFound(e);r=su(s,this,t,i,this)}return null==r?t.map((t=>jf.create(t))):r.map((t=>jf.create(t)))}findConnectionPoints(t,e,n){const r=this.cell,i=this.graph.options.connecting,s=r.getSource(),o=r.getTarget(),a=this.sourceView,l=this.targetView,c=t[0],h=t[t.length-1];let u,g;if(a&&!a.isEdgeElement(this.sourceMagnet)){const t=this.sourceMagnet||a.container,r=new Lf(c||n,e),o=s.connectionPoint||i.sourceConnectionPoint||i.connectionPoint;u=this.getConnectionPoint(o,a,t,r,"source")}else u=e;if(l&&!l.isEdgeElement(this.targetMagnet)){const t=this.targetMagnet||l.container,r=o.connectionPoint||i.targetConnectionPoint||i.connectionPoint,s=new Lf(h||e,n);g=this.getConnectionPoint(r,l,t,s,"target")}else g=n;return{source:u,target:g}}getConnectionPoint(t,e,n,r,i){const s=r.end;if(null==t)return s;const o="string"==typeof t?t:t.name,a="string"==typeof t?{}:t.args,l=nv.registry.get(o);if("function"!=typeof l)return nv.registry.onNotFound(o);const c=su(l,this,r,e,n,a||{},i);return c?c.round(this.POINT_ROUNDING):s}findMarkerPoints(t,e,n){const r=t=>{const e=this.cell.getAttrs(),n=Object.keys(e);for(let r=0,i=n.length;r<i;r+=1){const i=e[n[r]];if(i[`${t}Marker`]||i[`${t}-marker`]){const t=i.strokeWidth||i["stroke-width"];if(t)return parseFloat(t);break}}return null},i=t[0],s=t[t.length-1];let o,a;const l=r("source");l&&(o=e.clone().move(i||n,-l));const c=r("target");return c&&(a=n.clone().move(s||e,-c)),this.sourceMarkerPoint=o||e.clone(),this.targetMarkerPoint=a||n.clone(),{source:o,target:a}}findPath(t,e,n){const r=this.cell.getConnector()||this.graph.options.connecting.connector;let i,s,o;if("string"==typeof r?i=r:(i=r.name,s=r.args),i){const t=$v.registry.get(i);if("function"!=typeof t)return $v.registry.onNotFound(i);o=t}else o=$v.presets.normal;const a=su(o,this,e,n,t,Object.assign(Object.assign({},s),{raw:!0}),this);return"string"==typeof a?ep.parse(a):a}translateConnectionPoints(t,e){this.sourcePoint.translate(t,e),this.targetPoint.translate(t,e),this.sourceAnchor.translate(t,e),this.targetAnchor.translate(t,e),this.sourceMarkerPoint.translate(t,e),this.targetMarkerPoint.translate(t,e)}updateLabelPositions(){if(null==this.labelContainer)return this;if(!this.path)return this;const t=this.cell,e=t.getLabels();if(0===e.length)return this;const n=t.getDefaultLabel(),r=this.normalizeLabelPosition(n.position);for(let t=0,n=e.length;t<n;t+=1){const n=e[t],i=this.labelCache[t];if(!i)continue;const s=this.normalizeLabelPosition(n.position),o=Ya({},r,s),a=this.getLabelTransformationMatrix(o);i.setAttribute("transform",Wd(a))}return this}updateTerminalProperties(t){const e=this.cell,n=this.graph,r=e[t],i=r&&r.cell,s=`${t}View`;if(!i)return this[s]=null,this.updateTerminalMagnet(t),!0;const o=n.getCellById(i);if(!o)throw new Error(`Edge's ${t} node with id "${i}" not exists`);const a=o.findView(n);return!!a&&(this[s]=a,this.updateTerminalMagnet(t),!0)}updateTerminalMagnet(t){const e=`${t}Magnet`,n=this.getTerminalView(t);if(n){let r=n.getMagnetFromEdgeTerminal(this.cell[t]);r===n.container&&(r=null),this[e]=r}else this[e]=null}getLabelPositionAngle(t){const e=this.cell.getLabelAt(t);return e&&e.position&&"object"==typeof e.position&&e.position.angle||0}getLabelPositionArgs(t){const e=this.cell.getLabelAt(t);if(e&&e.position&&"object"==typeof e.position)return e.position.options}getDefaultLabelPositionArgs(){const t=this.cell.getDefaultLabel();if(t&&t.position&&"object"==typeof t.position)return t.position.options}mergeLabelPositionArgs(t,e){return null===t?null:void 0===t?null===e?null:e:Ya({},e,t)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";const t=this.cache.pathCache;return Zo(t,"data")||(t.data=this.path.serialize()),t.data||""}getConnectionSubdivisions(){if(null==this.path)return null;const t=this.cache.pathCache;return Zo(t,"segmentSubdivisions")||(t.segmentSubdivisions=this.path.getSegmentSubdivisions()),t.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;const t=this.cache.pathCache;return Zo(t,"length")||(t.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),t.length}getPointAtLength(t){return null==this.path?null:this.path.pointAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(t){return null==this.path?null:(Vu(t)&&(t=parseFloat(t)/100),this.path.pointAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(t){return null==this.path?null:this.path.tangentAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(t){return null==this.path?null:this.path.tangentAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(t){return null==this.path?null:this.path.closestPoint(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(t){return null==this.path?null:this.path.closestPointLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(t){return null==this.path?null:this.path.closestPointNormalizedLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(t,e,n,r){const i={distance:0};let s,o=0;"number"==typeof n?(o=n,s=r):s=n,null!=s&&(i.options=s);const a=s&&s.absoluteOffset,l=!(s&&s.absoluteDistance),c=s&&s.absoluteDistance&&s.reverseDistance,h=this.path,u={segmentSubdivisions:this.getConnectionSubdivisions()},g=new jf(t,e),d=h.closestPointT(g,u),f=this.getConnectionLength()||0;let p,m,y=h.lengthAtT(d,u);if(l&&(y=f>0?y/f:0),c&&(y=-1*(f-y)||1),i.distance=y,a||(p=h.tangentAtT(d)),p)m=p.pointOffset(g);else{const t=h.pointAtT(d),e=g.diff(t);m={x:e.x,y:e.y}}return i.offset=m,i.angle=o,i}normalizeLabelPosition(t){return"number"==typeof t?{distance:t}:t}getLabelTransformationMatrix(e){const n=this.normalizeLabelPosition(e),r=n.options||{},i=n.angle||0,s=n.distance,o=s>0&&s<=1;let a=0;const l={x:0,y:0},c=n.offset;c&&("number"==typeof c?a=c:(null!=c.x&&(l.x=c.x),null!=c.y&&(l.y=c.y)));const h=0!==l.x||0!==l.y||0===a,u=r.keepGradient,g=r.ensureLegibility,d=this.path,f={segmentSubdivisions:this.getConnectionSubdivisions()},p=o?s*this.getConnectionLength():s,m=d.tangentAtLength(p,f);let y,v=i;if(m){if(h)y=m.start,y.translate(l);else{const t=m.clone();t.rotate(-90,m.start),t.setLength(a),y=t.end}u&&(v=m.angle()+i,g&&(v=t.Angle.normalize((v+90)%180-90)))}else y=d.start,h&&y.translate(l);return Gd().translate(y.x,y.y).rotate(v)}getVertexIndex(t,e){const n=this.cell.getVertices(),r=this.getClosestPointLength(new jf(t,e));let i=0;if(null!=r)for(const t=n.length;i<t;i+=1){const t=n[i],e=this.getClosestPointLength(t);if(null!=e&&r<e)break}return i}getEventArgs(t,e,n){const r=this,i=r.cell;return null==e||null==n?{e:t,view:r,edge:i,cell:i}:{e:t,x:e,y:n,view:r,edge:i,cell:i}}notifyUnhandledMouseDown(t,e,n){this.notify("edge:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("edge:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("edge:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("edge:mouseup",this.getEventArgs(t,e,n))}onClick(t,e,n){super.onClick(t,e,n),this.notify("edge:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("edge:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("edge:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startEdgeDragging(t,e,n)}onMouseMove(t,e,n){const r=this.getEventData(t);switch(r.action){case"drag-label":this.dragLabel(t,e,n);break;case"drag-arrowhead":this.dragArrowhead(t,e,n);break;case"drag-edge":this.dragEdge(t,e,n)}return this.notifyMouseMove(t,e,n),r}onMouseUp(t,e,n){const r=this.getEventData(t);switch(r.action){case"drag-label":this.stopLabelDragging(t,e,n);break;case"drag-arrowhead":this.stopArrowheadDragging(t,e,n);break;case"drag-edge":this.stopEdgeDragging(t,e,n)}return this.notifyMouseUp(t,e,n),this.checkMouseleave(t),r}onMouseOver(t){super.onMouseOver(t),this.notify("edge:mouseover",this.getEventArgs(t))}onMouseOut(t){super.onMouseOut(t),this.notify("edge:mouseout",this.getEventArgs(t))}onMouseEnter(t){super.onMouseEnter(t),this.notify("edge:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("edge:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,r){super.onMouseWheel(t,e,n,r),this.notify("edge:mousewheel",Object.assign({delta:r},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,r){if(Tg(t.target,"edge-tool",this.container)){if(t.stopPropagation(),this.can("useEdgeTools")){if("edge:remove"===e)return void this.cell.remove({ui:!0});this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,r)))}this.notifyMouseDown(t,n,r)}else this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,r))),super.onCustomEvent(t,e,n,r)}onLabelMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startLabelDragging(t,e,n);this.getEventData(t).stopPropagation&&t.stopPropagation()}startEdgeDragging(t,e,n){this.can("edgeMovable")?this.setEventData(t,{x:e,y:n,moving:!1,action:"drag-edge"}):this.notifyUnhandledMouseDown(t,e,n)}dragEdge(t,e,n){const r=this.getEventData(t);r.moving||(r.moving=!0,this.addClass("edge-moving"),this.notify("edge:move",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),this.cell.translate(e-r.x,n-r.y,{ui:!0}),this.setEventData(t,{x:e,y:n}),this.notify("edge:moving",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}stopEdgeDragging(t,e,n){const r=this.getEventData(t);r.moving&&(this.removeClass("edge-moving"),this.notify("edge:moved",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),r.moving=!1}prepareArrowheadDragging(t,e){const n=this.getTerminalMagnet(t),r={action:"drag-arrowhead",x:e.x,y:e.y,isNewEdge:!0===e.isNewEdge,terminalType:t,initialMagnet:n,initialTerminal:Gi(this.cell[t]),fallbackAction:e.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(t),options:e.options};return this.beforeArrowheadDragging(r),r}createValidateConnectionArgs(t){const e=[];let n;e[4]=t,e[5]=this;let r=0,i=0;"source"===t?(r=2,n="target"):(i=2,n="source");const s=this.cell[n],o=s.cell;if(o){let t;const n=e[r]=this.graph.findViewByCell(o);n&&(t=n.getMagnetFromEdgeTerminal(s),t===n.container&&(t=void 0)),e[r+1]=t}return(t,n)=>(e[i]=t,e[i+1]=t.container===n?void 0:n,e)}beforeArrowheadDragging(t){t.zIndex=this.cell.zIndex,this.cell.toFront();const e=this.container.style;t.pointerEvents=e.pointerEvents,e.pointerEvents="none",this.graph.options.connecting.highlight&&this.highlightAvailableMagnets(t)}afterArrowheadDragging(t){null!=t.zIndex&&(this.cell.setZIndex(t.zIndex,{ui:!0}),t.zIndex=null);this.container.style.pointerEvents=t.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(t)}validateConnection(t,e,n,r,i,s,o){const a=this.graph.options.connecting,l=a.allowLoop,c=a.allowNode,h=a.allowEdge,u=a.allowPort,g=a.allowMulti,d=a.validateConnection,f=s?s.cell:null,p="target"===i?n:t,m="target"===i?r:e;let y=!0;const v=a=>{const l="source"===i?o?o.port:null:f?f.getSourcePortId():null,c="target"===i?o?o.port:null:f?f.getTargetPortId():null;return su(a,this.graph,{edge:f,edgeView:s,sourceView:t,targetView:n,sourcePort:l,targetPort:c,sourceMagnet:e,targetMagnet:r,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:i})};if(null!=l&&("boolean"==typeof l?l||t!==n||(y=!1):y=v(l)),y&&null!=u&&("boolean"==typeof u?!u&&m&&(y=!1):y=v(u)),y&&null!=h&&("boolean"==typeof h?!h&&db.isEdgeView(p)&&(y=!1):y=v(h)),y&&null!=c&&null==m&&("boolean"==typeof c?!c&&gb.isNodeView(p)&&(y=!1):y=v(c)),y&&null!=g&&s){const t=s.cell,e="source"===i?o:t.getSource(),n="target"===i?o:t.getTarget(),r=o?this.graph.getCellById(o.cell):null;if(e&&n&&e.cell&&n.cell&&r)if("function"==typeof g)y=v(g);else{const t=this.graph.model.getConnectedEdges(r,{outgoing:"source"===i,incoming:"target"===i});if(t.length)if("withPort"===g){t.some((t=>{const r=t.getSource(),i=t.getTarget();return r&&i&&r.cell===e.cell&&i.cell===n.cell&&null!=r.port&&r.port===e.port&&null!=i.port&&i.port===n.port}))&&(y=!1)}else if(!g){t.some((t=>{const r=t.getSource(),i=t.getTarget();return r&&i&&r.cell===e.cell&&i.cell===n.cell}))&&(y=!1)}}}return y&&null!=d&&(y=v(d)),y}allowConnectToBlank(t){const e=this.graph,n=e.options.connecting.allowBlank;if("function"!=typeof n)return!!n;const r=e.findViewByCell(t),i=t.getSourceCell(),s=t.getTargetCell(),o=e.findViewByCell(i),a=e.findViewByCell(s);return su(n,e,{edge:t,edgeView:r,sourceCell:i,targetCell:s,sourceView:o,targetView:a,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:r.sourceMagnet,targetMagnet:r.targetMagnet})}validateEdge(t,e,n){const r=this.graph;if(!this.allowConnectToBlank(t)){const e=t.getSourceCellId(),n=t.getTargetCellId();if(!e||!n)return!1}const i=r.options.connecting.validateEdge;return!i||su(i,r,{edge:t,type:e,previous:n})}arrowheadDragging(t,e,n,r){r.x=e,r.y=n,r.currentTarget!==t&&(r.currentMagnet&&r.currentView&&r.currentView.unhighlight(r.currentMagnet,{type:"magnetAdsorbed"}),r.currentView=this.graph.findViewByElem(t),r.currentView?(r.currentMagnet=r.currentView.findMagnet(t),r.currentMagnet&&this.validateConnection(...r.getValidateConnectionArgs(r.currentView,r.currentMagnet),r.currentView.getEdgeTerminal(r.currentMagnet,e,n,this.cell,r.terminalType))?r.currentView.highlight(r.currentMagnet,{type:"magnetAdsorbed"}):r.currentMagnet=null):r.currentMagnet=null),r.currentTarget=t,this.cell.prop(r.terminalType,{x:e,y:n},Object.assign(Object.assign({},r.options),{ui:!0}))}arrowheadDragged(t,e,n){const r=t.currentView,i=t.currentMagnet;if(!i||!r)return;r.unhighlight(i,{type:"magnetAdsorbed"});const s=t.terminalType,o=r.getEdgeTerminal(i,e,n,this.cell,s);this.cell.setTerminal(s,o,{ui:!0})}snapArrowhead(t,e,n){const r=this.graph,{snap:i,allowEdge:s}=r.options.connecting,o="object"==typeof i&&i.radius||50,a="object"==typeof i&&i.anchor||"center",l=r.renderer.findViewsInArea({x:t-o,y:e-o,width:2*o,height:2*o},{nodeOnly:!0});if(s){const n=r.renderer.findEdgeViewsFromPoint({x:t,y:e},o).filter((t=>t!==this));l.push(...n)}const c=n.closestView||null,h=n.closestMagnet||null;let u;n.closestView=null,n.closestMagnet=null;let g=Number.MAX_SAFE_INTEGER;const d=new jf(t,e);let f;l.forEach((r=>{if("false"!==r.container.getAttribute("magnet")){if(r.isNodeView())u="center"===a?r.cell.getBBox().getCenter().distance(d):r.cell.getBBox().getNearestPointToPoint(d).distance(d);else if(r.isEdgeView()){const t=r.getClosestPoint(d);u=t?t.distance(d):Number.MAX_SAFE_INTEGER}u<o&&u<g&&(h===r.container||this.validateConnection(...n.getValidateConnectionArgs(r,null),r.getEdgeTerminal(r.container,t,e,this.cell,n.terminalType)))&&(g=u,n.closestView=r,n.closestMagnet=r.container)}r.container.querySelectorAll("[magnet]").forEach((i=>{if("false"!==i.getAttribute("magnet")){const s=r.getBBoxOfElement(i);u=d.distance(s.getCenter()),u<o&&u<g&&(h===i||this.validateConnection(...n.getValidateConnectionArgs(r,i),r.getEdgeTerminal(i,t,e,this.cell,n.terminalType)))&&(g=u,n.closestView=r,n.closestMagnet=i)}}))}));const p=n.terminalType,m=n.closestView,y=n.closestMagnet,v=h!==y;if(c&&v&&c.unhighlight(h,{type:"magnetAdsorbed"}),m){if(!v)return;m.highlight(y,{type:"magnetAdsorbed"}),f=m.getEdgeTerminal(y,t,e,this.cell,p)}else f={x:t,y:e};this.cell.setTerminal(p,f,{},Object.assign(Object.assign({},n.options),{ui:!0}))}snapArrowheadEnd(t){const e=t.closestView,n=t.closestMagnet;e&&n&&(e.unhighlight(n,{type:"magnetAdsorbed"}),t.currentMagnet=e.findMagnet(n)),t.closestView=null,t.closestMagnet=null}finishEmbedding(t){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(t.zIndex=null)}fallbackConnection(t){if("remove"===t.fallbackAction)this.cell.remove({ui:!0});else this.cell.prop(t.terminalType,t.initialTerminal,{ui:!0})}notifyConnectionEvent(t,e){const n=t.terminalType,r=t.initialTerminal,i=this.cell[n];if(i&&!Yv.equalTerminals(r,i)){const s=this.graph,o=r,a=o.cell?s.getCellById(o.cell):null,l=o.port,c=a?s.findViewByCell(a):null,h=a||t.isNewEdge?null:jf.create(r).toJSON(),u=i,g=u.cell?s.getCellById(u.cell):null,d=u.port,f=g?s.findViewByCell(g):null,p=g?null:jf.create(i).toJSON();this.notify("edge:connected",{e:e,previousCell:a,previousPort:l,previousView:c,previousPoint:h,currentCell:g,currentView:f,currentPort:d,currentPoint:p,previousMagnet:t.initialMagnet,currentMagnet:t.currentMagnet,edge:this.cell,view:this,type:n,isNew:t.isNewEdge})}}highlightAvailableMagnets(t){const e=this.graph,n=e.model.getCells();t.marked={};for(let r=0,i=n.length;r<i;r+=1){const i=e.findViewByCell(n[r]);if(!i||i.cell.id===this.cell.id)continue;const s=Array.prototype.slice.call(i.container.querySelectorAll("[magnet]"));"false"!==i.container.getAttribute("magnet")&&s.push(i.container);const o=s.filter((e=>this.validateConnection(...t.getValidateConnectionArgs(i,e),i.getEdgeTerminal(e,t.x,t.y,this.cell,t.terminalType))));if(o.length>0){for(let t=0,e=o.length;t<e;t+=1)i.highlight(o[t],{type:"magnetAvailable"});i.highlight(null,{type:"nodeAvailable"}),t.marked[i.cell.id]=o}}}unhighlightAvailableMagnets(t){const e=t.marked||{};Object.keys(e).forEach((t=>{const n=this.graph.findViewByCell(t);if(n){e[t].forEach((t=>{n.unhighlight(t,{type:"magnetAvailable"})})),n.unhighlight(null,{type:"nodeAvailable"})}})),t.marked=null}startArrowheadDragging(t,e,n){if(!this.can("arrowheadMovable"))return void this.notifyUnhandledMouseDown(t,e,n);const r=t.target.getAttribute("data-terminal"),i=this.prepareArrowheadDragging(r,{x:e,y:n});this.setEventData(t,i)}dragArrowhead(t,e,n){const r=this.getEventData(t);this.graph.options.connecting.snap?this.snapArrowhead(e,n,r):this.arrowheadDragging(this.getEventTarget(t),e,n,r)}stopArrowheadDragging(t,e,n){const r=this.graph,i=this.getEventData(t);r.options.connecting.snap?this.snapArrowheadEnd(i):this.arrowheadDragged(i,e,n);this.validateEdge(this.cell,i.terminalType,i.initialTerminal)?(this.finishEmbedding(i),this.notifyConnectionEvent(i,t)):this.fallbackConnection(i),this.afterArrowheadDragging(i)}startLabelDragging(t,e,n){if(this.can("edgeLabelMovable")){const e=t.currentTarget,n=parseInt(e.getAttribute("data-index"),10),r=this.getLabelPositionAngle(n),i=this.getLabelPositionArgs(n),s=this.getDefaultLabelPositionArgs(),o=this.mergeLabelPositionArgs(i,s);this.setEventData(t,{index:n,positionAngle:r,positionArgs:o,stopPropagation:!0,action:"drag-label"})}else this.setEventData(t,{stopPropagation:!0});this.graph.view.delegateDragEvents(t,this)}dragLabel(t,e,n){const r=this.getEventData(t),i=this.cell.getLabelAt(r.index),s=Ya({},i,{position:this.getLabelPosition(e,n,r.positionAngle,r.positionArgs)});this.cell.setLabelAt(r.index,s)}stopLabelDragging(t,e,n){}}!function(t){t.toStringTag=`X6.${t.name}`,t.isEdgeView=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],r=e;return(null==n||n===t.toStringTag)&&"function"==typeof r.isNodeView&&"function"==typeof r.isEdgeView&&"function"==typeof r.confirmUpdate&&"function"==typeof r.update&&"function"==typeof r.getConnection}}(db||(db={})),db.config({isSvgElement:!0,priority:1,bootstrap:["render","source","target"],actions:{view:["render"],markup:["render"],attrs:["update"],source:["source","update"],target:["target","update"],router:["update"],connector:["update"],labels:["labels"],defaultLabel:["labels"],tools:["tools"],vertices:["vertices","update"]}}),db.registry.register("edge",db,!0);class fb extends sy{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(e){super(),this.graph=e;const{selectors:n,fragment:r}=t.Markup.parseJSONMarkup(fb.markup);this.background=n.background,this.grid=n.grid,this.svg=n.svg,this.defs=n.defs,this.viewport=n.viewport,this.primer=n.primer,this.stage=n.stage,this.decorator=n.decorator,this.overlay=n.overlay,this.container=this.options.container,this.restore=fb.snapshoot(this.container),ug(this.container,this.prefixClassName("graph")),_g(this.container,r),this.delegateEvents()}delegateEvents(){const t=this.constructor;return super.delegateEvents(t.events),this}guard(t,e){return"mousedown"===t.type&&2===t.button||(!(!this.options.guard||!this.options.guard(t,e))||(t.data&&void 0!==t.data.guarded?t.data.guarded:!(e&&e.cell&&Hv.isCell(e.cell))&&(this.svg!==t.target&&this.container!==t.target&&!this.svg.contains(t.target))))}findView(t){return this.graph.findViewByElem(t)}onDblClick(t){this.options.preventDefaultDblClick&&t.preventDefault();const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const r=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onDblClick(e,r.x,r.y):this.graph.trigger("blank:dblclick",{e:e,x:r.x,y:r.y})}onClick(t){if(this.getMouseMovedCount(t)<=this.options.clickThreshold){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const r=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onClick(e,r.x,r.y):this.graph.trigger("blank:click",{e:e,x:r.x,y:r.y})}}isPreventDefaultContextMenu(t){let e=this.options.preventDefaultContextMenu;return"function"==typeof e&&(e=su(e,this.graph,{view:t})),e}onContextMenu(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.isPreventDefaultContextMenu(n)&&t.preventDefault(),this.guard(e,n))return;const r=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onContextMenu(e,r.x,r.y):this.graph.trigger("blank:contextmenu",{e:e,x:r.x,y:r.y})}delegateDragEvents(t,e){null==t.data&&(t.data={}),this.setEventData(t,{currentView:e||null,mouseMovedCount:0,startPosition:{x:t.clientX,y:t.clientY}});const n=this.constructor;this.delegateDocumentEvents(n.documentEvents,t.data),this.undelegateEvents()}getMouseMovedCount(t){return this.getEventData(t).mouseMovedCount||0}onMouseDown(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;this.options.preventDefaultMouseDown&&t.preventDefault();const r=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onMouseDown(e,r.x,r.y):(this.options.preventDefaultBlankAction&&["touchstart"].includes(e.type)&&t.preventDefault(),this.graph.trigger("blank:mousedown",{e:e,x:r.x,y:r.y})),this.delegateDragEvents(e,n)}onMouseMove(t){const e=this.getEventData(t),n=e.startPosition;if(n&&n.x===t.clientX&&n.y===t.clientY)return;null==e.mouseMovedCount&&(e.mouseMovedCount=0),e.mouseMovedCount+=1;if(e.mouseMovedCount<=this.options.moveThreshold)return;const r=this.normalizeEvent(t),i=this.graph.snapToGrid(r.clientX,r.clientY),s=e.currentView;s?s.onMouseMove(r,i.x,i.y):this.graph.trigger("blank:mousemove",{e:r,x:i.x,y:i.y}),this.setEventData(r,e)}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY),r=this.getEventData(t).currentView;if(r?r.onMouseUp(e,n.x,n.y):this.graph.trigger("blank:mouseup",{e:e,x:n.x,y:n.y}),!t.isPropagationStopped()){const e=new hf(t,{type:"click",data:t.data});this.onClick(e)}t.stopImmediatePropagation(),this.delegateEvents()}onMouseOver(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOver(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseover",{e:e})}}onMouseOut(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOut(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseout",{e:e})}}onMouseEnter(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const r=this.graph.findViewByElem(e.relatedTarget);if(n){if(r===n)return;n.onMouseEnter(e)}else{if(r)return;this.graph.trigger("graph:mouseenter",{e:e})}}onMouseLeave(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const r=this.graph.findViewByElem(e.relatedTarget);if(n){if(r===n)return;n.onMouseLeave(e)}else{if(r)return;this.graph.trigger("graph:mouseleave",{e:e})}}onMouseWheel(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const r=e.originalEvent,i=this.graph.snapToGrid(r.clientX,r.clientY),s=Math.max(-1,Math.min(1,r.wheelDelta||-r.detail));n?n.onMouseWheel(e,i.x,i.y,s):this.graph.trigger("blank:mousewheel",{e:e,delta:s,x:i.x,y:i.y})}onCustomEvent(t){const e=t.currentTarget,n=e.getAttribute("event")||e.getAttribute("data-event");if(n){const r=this.findView(e);if(r){const e=this.normalizeEvent(t);if(this.guard(e,r))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);r.onCustomEvent(e,n,i.x,i.y)}}}handleMagnetEvent(t,e){const n=t.currentTarget,r=n.getAttribute("magnet");if(r&&"false"!==r.toLowerCase()){const r=this.findView(n);if(r){const i=this.normalizeEvent(t);if(this.guard(i,r))return;const s=this.graph.snapToGrid(i.clientX,i.clientY);su(e,this.graph,r,i,n,s.x,s.y)}}}onMagnetMouseDown(t){this.handleMagnetEvent(t,((t,e,n,r,i)=>{t.onMagnetMouseDown(e,n,r,i)}))}onMagnetDblClick(t){this.handleMagnetEvent(t,((t,e,n,r,i)=>{t.onMagnetDblClick(e,n,r,i)}))}onMagnetContextMenu(t){const e=this.findView(t.target);this.isPreventDefaultContextMenu(e)&&t.preventDefault(),this.handleMagnetEvent(t,((t,e,n,r,i)=>{t.onMagnetContextMenu(e,n,r,i)}))}onLabelMouseDown(t){const e=t.currentTarget,n=this.findView(e);if(n){const e=this.normalizeEvent(t);if(this.guard(e,n))return;const r=this.graph.snapToGrid(e.clientX,e.clientY);n.onLabelMouseDown(e,r.x,r.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}n([sy.dispose()],fb.prototype,"dispose",null),function(t){const e=`${Lm.prefixCls}-graph`;t.markup=[{ns:vg.xhtml,tagName:"div",selector:"background",className:`${e}-background`},{ns:vg.xhtml,tagName:"div",selector:"grid",className:`${e}-grid`},{ns:vg.svg,tagName:"svg",selector:"svg",className:`${e}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":vg.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${e}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${e}-svg-primer`},{tagName:"g",selector:"stage",className:`${e}-svg-stage`},{tagName:"g",selector:"decorator",className:`${e}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${e}-svg-overlay`}]}]}],t.snapshoot=function(t){const e=t.cloneNode();return t.childNodes.forEach((t=>e.appendChild(t))),()=>{for(jg(t);t.attributes.length>0;)t.removeAttribute(t.attributes[0].name);for(let n=0,r=e.attributes.length;n<r;n+=1){const r=e.attributes[n];t.setAttribute(r.name,r.value)}e.childNodes.forEach((e=>t.appendChild(e)))}}}(fb||(fb={})),function(t){const e=Lm.prefixCls;t.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${e}-cell`]:"onMouseEnter",[`mouseleave .${e}-cell`]:"onMouseLeave",[`mouseenter .${e}-cell-tools`]:"onMouseEnter",[`mouseleave .${e}-cell-tools`]:"onMouseLeave",[`mousedown .${e}-cell [event]`]:"onCustomEvent",[`touchstart .${e}-cell [event]`]:"onCustomEvent",[`mousedown .${e}-cell [data-event]`]:"onCustomEvent",[`touchstart .${e}-cell [data-event]`]:"onCustomEvent",[`dblclick .${e}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${e}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${e}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${e}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${e}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${e}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${e}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${e}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${e}-cell image`]:"onImageDragStart",[`mousedown .${e}-edge .${e}-edge-label`]:"onLabelMouseDown",[`touchstart .${e}-edge .${e}-edge-label`]:"onLabelMouseDown"},t.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}}(fb||(fb={}));class pb extends r{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(t){super(),this.graph=t,this.init()}init(){}}class mb extends pb{init(){Lm.autoInsertCSS&&Ef("core",".x6-graph {\n position: relative;\n overflow: hidden;\n outline: none;\n touch-action: none;\n}\n.x6-graph-background,\n.x6-graph-grid,\n.x6-graph-svg {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.x6-graph-background-stage,\n.x6-graph-grid-stage,\n.x6-graph-svg-stage {\n user-select: none;\n}\n.x6-graph.x6-graph-pannable {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n.x6-graph.x6-graph-panning {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n}\n.x6-node {\n cursor: move;\n /* stylelint-disable-next-line */\n}\n.x6-node.x6-node-immovable {\n cursor: default;\n}\n.x6-node * {\n -webkit-user-drag: none;\n}\n.x6-node .scalable * {\n vector-effect: non-scaling-stroke;\n}\n.x6-node [magnet='true'] {\n cursor: crosshair;\n transition: opacity 0.3s;\n}\n.x6-node [magnet='true']:hover {\n opacity: 0.7;\n}\n.x6-node foreignObject {\n display: block;\n overflow: visible;\n background-color: transparent;\n}\n.x6-node foreignObject > body {\n position: static;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n overflow: visible;\n background-color: transparent;\n}\n.x6-edge .source-marker,\n.x6-edge .target-marker {\n vector-effect: non-scaling-stroke;\n}\n.x6-edge .connection {\n stroke-linejoin: round;\n fill: none;\n}\n.x6-edge .connection-wrap {\n cursor: move;\n opacity: 0;\n fill: none;\n stroke: #000;\n stroke-width: 15;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.x6-edge .connection-wrap:hover {\n opacity: 0.4;\n stroke-opacity: 0.4;\n}\n.x6-edge .vertices {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .vertices .vertex {\n fill: #1abc9c;\n}\n.x6-edge .vertices .vertex :hover {\n fill: #34495e;\n stroke: none;\n}\n.x6-edge .vertices .vertex-remove {\n cursor: pointer;\n fill: #fff;\n}\n.x6-edge .vertices .vertex-remove-area {\n cursor: pointer;\n opacity: 0.1;\n}\n.x6-edge .vertices .vertex-group:hover .vertex-remove-area {\n opacity: 1;\n}\n.x6-edge .arrowheads {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .arrowheads .arrowhead {\n fill: #1abc9c;\n}\n.x6-edge .arrowheads .arrowhead :hover {\n fill: #f39c12;\n stroke: none;\n}\n.x6-edge .tools {\n cursor: pointer;\n opacity: 0;\n}\n.x6-edge .tools .tool-options {\n display: none;\n}\n.x6-edge .tools .tool-remove circle {\n fill: #f00;\n}\n.x6-edge .tools .tool-remove path {\n fill: #fff;\n}\n.x6-edge:hover .vertices,\n.x6-edge:hover .arrowheads,\n.x6-edge:hover .tools {\n opacity: 1;\n}\n.x6-highlight-opacity {\n opacity: 0.3;\n}\n.x6-cell-tool-editor {\n position: relative;\n display: inline-block;\n min-height: 1em;\n margin: 0;\n padding: 0;\n line-height: 1;\n white-space: normal;\n text-align: center;\n vertical-align: top;\n overflow-wrap: normal;\n outline: none;\n transform-origin: 0 0;\n -webkit-user-drag: none;\n}\n.x6-edge-tool-editor {\n border: 1px solid #275fc5;\n border-radius: 2px;\n}\n")}dispose(){Sf("core")}}var yb,vb;n([mb.dispose()],mb.prototype,"dispose",null),t.Options=void 0,(yb=t.Options||(t.Options={})).get=function(t){const{grid:n,panning:r,mousewheel:i,embedding:s}=t,o=e(t,["grid","panning","mousewheel","embedding"]),a=t.container;if(null==a)throw new Error("Ensure the container of the graph is specified and valid");null==o.width&&(o.width=a.clientWidth),null==o.height&&(o.height=a.clientHeight);const l=Ya({},yb.defaults,o),c={size:10,visible:!1};return l.grid="number"==typeof n?{size:n,visible:!1}:"boolean"==typeof n?Object.assign(Object.assign({},c),{visible:n}):Object.assign(Object.assign({},c),n),["panning","mousewheel","embedding"].forEach((e=>{const n=t[e];"boolean"==typeof n?l[e].enabled=n:l[e]=Object.assign(Object.assign({},l[e]),n)})),l},function(t){t.defaults={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!1,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:Lm.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:Lm.prefix("available-magnet")}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",router:"normal",connector:"normal",validateConnection:({type:t,sourceView:e,targetView:n})=>null!=("target"===t?n:e),createEdge:()=>new rb},translating:{restrict:!1},embedding:{enabled:!1,findParent:"bbox",frontOnly:!0,validate:()=>!0},moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},async:!0,virtual:!1,guard:()=>!1}}(t.Options||(t.Options={}));class bb extends pb{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}setVisible(t){this.grid.visible!==t&&(this.grid.visible=t,this.update())}getGridSize(){return this.grid.size}setGridSize(t){this.grid.size=Math.max(t,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=""}draw(t){this.clear(),this.instance=null,Object.assign(this.grid,t),this.patterns=this.resolveGrid(t),this.update()}update(t={}){const n=this.grid.size;if(n<=1||!this.grid.visible)return this.clear();const r=this.graph.matrix(),i=this.getInstance(),s=Array.isArray(t)?t:[t];this.patterns.forEach(((t,o)=>{const a=`pattern_${o}`,l=r.a||1,c=r.d||1,{update:h,markup:u}=t,g=e(t,["update","markup"]),d=Object.assign(Object.assign(Object.assign({},g),s[o]),{sx:l,sy:c,ox:r.e||0,oy:r.f||0,width:n*l,height:n*c});i.has(a)||i.add(a,yd.create("pattern",{id:a,patternUnits:"userSpaceOnUse"},yd.createVectors(u)).node);const f=i.get(a);"function"==typeof h&&h(f.childNodes[0],d);let p=d.ox%d.width;p<0&&(p+=d.width);let m=d.oy%d.height;m<0&&(m+=d.height),Ug(f,{x:p,y:m,width:d.width,height:d.height})}));const o=(new XMLSerializer).serializeToString(i.root),a=`url(data:image/svg+xml;base64,${btoa(o)})`;this.elem.style.backgroundImage=a}getInstance(){return this.instance||(this.instance=new lp),this.instance}resolveGrid(t){if(!t)return[];const e=t.type;if(null==e)return[Object.assign(Object.assign({},lp.presets.dot),t.args)];const n=lp.registry.get(e);if(n){let e=t.args||[];return Array.isArray(e)||(e=[e]),Array.isArray(n)?n.map(((t,n)=>Object.assign(Object.assign({},t),e[n]))):[Object.assign(Object.assign({},n),e[0])]}return lp.registry.onNotFound(e)}dispose(){this.stopListening(),this.clear()}}n([pb.dispose()],bb.prototype,"dispose",null);class xb extends pb{get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get stage(){return this.graph.view.stage}init(){this.resize()}getMatrix(){const t=this.viewport.getAttribute("transform");return t!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=t),Gd(this.viewportMatrix)}setMatrix(t){const e=Gd(t);e.a=Number.isFinite(e.a)?e.a:1,e.b=Number.isFinite(e.b)?e.b:0,e.c=Number.isFinite(e.c)?e.c:0,e.d=Number.isFinite(e.d)?e.d:1,e.e=Number.isFinite(e.e)?e.e:0,e.f=Number.isFinite(e.f)?e.f:0;const n=Wd(e);this.viewport.setAttribute("transform",n),this.viewportMatrix=e,this.viewportTransformString=n}resize(t,e){let n=void 0===t?this.options.width:t,r=void 0===e?this.options.height:e;this.options.width=n,this.options.height=r,"number"==typeof n&&(n=Math.round(n)),"number"==typeof r&&(r=Math.round(r)),this.container.style.width=null==n?"":`${n}px`,this.container.style.height=null==r?"":`${r}px`;const i=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},i)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return Na(t)||(t=this.container.clientWidth),Na(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return Yd(this.getMatrix())}scale(t,e=t,n=0,r=0){if(t=this.clampScale(t),e=this.clampScale(e),n||r){const i=this.getTranslation(),s=i.tx-n*(t-1),o=i.ty-r*(e-1);s===i.tx&&o===i.ty||this.translate(s,o)}const i=this.getMatrix(),s=Number.isFinite(t)?t:1,o=Number.isFinite(e)?e:1;return i.a=s,i.d=o,this.setMatrix(i),this.graph.trigger("scale",{sx:s,sy:o,ox:n,oy:r}),this}clampScale(t){const e=this.graph.options.scaling;return Hr(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,r=t;const i=this.getScale(),s=this.getComputedSize();let o=s.width/2,a=s.height/2;if(e.absolute||(n+=i.sx,r+=i.sy),e.scaleGrid&&(n=Math.round(n/e.scaleGrid)*e.scaleGrid,r=Math.round(r/e.scaleGrid)*e.scaleGrid),e.maxScale&&(n=Math.min(e.maxScale,n),r=Math.min(e.maxScale,r)),e.minScale&&(n=Math.max(e.minScale,n),r=Math.max(e.minScale,r)),e.center&&(o=e.center.x,a=e.center.y),n=this.clampScale(n),r=this.clampScale(r),n=Number.isFinite(n)?n:i.sx,r=Number.isFinite(r)?r:i.sy,o||a){const t=this.getTranslation(),e=0===i.sx?1:i.sx,s=0===i.sy?1:i.sy,l=o-(o-t.tx)*(n/e),c=a-(a-t.ty)*(r/s);l===t.tx&&c===t.ty||this.translate(l,c)}return this.scale(n,r),this}getRotation(){return Zd(this.getMatrix())}rotate(e,n,r){if(null==n||null==r){const e=t.Util.getBBox(this.stage);n=e.width/2,r=e.height/2}const i=this.getMatrix().translate(n,r).rotate(e).translate(-n,-r);return this.setMatrix(i),this}getTranslation(){return Kd(this.getMatrix())}translate(t,e){const n=this.getMatrix();n.e=Number.isFinite(t)?t:0,n.f=Number.isFinite(e)?e:0,this.setMatrix(n);const r=this.getTranslation();return this.options.x=r.tx,this.options.y=r.ty,this.graph.trigger("translate",Object.assign({},r)),this}setOrigin(t,e){return this.translate(t||0,e||0)}fitToContent(t,e,n,r){if("object"==typeof t){const i=t;t=i.gridWidth||1,e=i.gridHeight||1,n=i.padding||0,r=i}else t=t||1,e=e||1,n=n||0,null==r&&(r={});const i=$u(n),s=r.border||0,o=r.contentArea?_f.create(r.contentArea):this.getContentArea(r);s>0&&o.inflate(s);const a=this.getScale(),l=this.getTranslation(),c=a.sx,h=a.sy;o.x*=c,o.y*=h,o.width*=c,o.height*=h;let u=Math.max(Math.ceil((o.width+o.x)/t),1)*t,g=Math.max(Math.ceil((o.height+o.y)/e),1)*e,d=0,f=0;("negative"===r.allowNewOrigin&&o.x<0||"positive"===r.allowNewOrigin&&o.x>=0||"any"===r.allowNewOrigin)&&(d=Math.ceil(-o.x/t)*t,d+=i.left,u+=d),("negative"===r.allowNewOrigin&&o.y<0||"positive"===r.allowNewOrigin&&o.y>=0||"any"===r.allowNewOrigin)&&(f=Math.ceil(-o.y/e)*e,f+=i.top,g+=f),u+=i.right,g+=i.bottom,u=Math.max(u,r.minWidth||0),g=Math.max(g,r.minHeight||0),u=Math.min(u,r.maxWidth||Number.MAX_SAFE_INTEGER),g=Math.min(g,r.maxHeight||Number.MAX_SAFE_INTEGER);const p=this.getComputedSize(),m=u!==p.width||g!==p.height;return(d!==l.tx||f!==l.ty)&&this.translate(d,f),m&&this.resize(u,g),new _f(-d/c,-f/h,u/c,g/h)}scaleContentToFit(t={}){this.scaleContentToFitImpl(t)}scaleContentToFitImpl(t={},e=!0){let n,r;if(t.contentArea){const e=t.contentArea;n=this.graph.localToGraph(e),r=jf.create(e)}else n=this.getContentBBox(t),r=this.graph.graphToLocal(n);if(!n.width||!n.height)return;const i=$u(t.padding),s=t.minScale||0,o=t.maxScale||Number.MAX_SAFE_INTEGER,a=t.minScaleX||s,l=t.maxScaleX||o,c=t.minScaleY||s,h=t.maxScaleY||o;let u;if(t.viewportArea)u=t.viewportArea;else{const t=this.getComputedSize(),e=this.getTranslation();u={x:e.tx,y:e.ty,width:t.width,height:t.height}}u=_f.create(u).moveAndExpand({x:i.left,y:i.top,width:-i.left-i.right,height:-i.top-i.bottom});const g=this.getScale();let d=u.width/n.width*g.sx,f=u.height/n.height*g.sy;!1!==t.preserveAspectRatio&&(d=f=Math.min(d,f));const p=t.scaleGrid;if(p&&(d=p*Math.floor(d/p),f=p*Math.floor(f/p)),d=Hr(d,a,l),f=Hr(f,c,h),this.scale(d,f),e){const t=this.options,e=u.x-r.x*d-t.x,n=u.y-r.y*f-t.y;this.translate(e,n)}}getContentArea(e={}){return!1!==e.useCellGeometry?this.model.getAllCellsBBox()||new _f:t.Util.getBBox(this.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){const t=_f.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){const n=_f.create(t),r=this.graph;e.contentArea=n,null==e.viewportArea&&(e.viewportArea={x:r.options.x,y:r.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(e,!1);const i=n.getCenter();return this.centerPoint(i.x,i.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){const n=this.getComputedSize(),r=this.getScale(),i=this.getTranslation(),s=n.width/2,o=n.height/2;e="number"==typeof e?e:o,t=s-(t="number"==typeof t?t:s)*r.sx,e=o-e*r.sy,i.tx===t&&i.ty===e||this.translate(t,e)}centerContent(t){const e=this.graph.getContentArea(t).getCenter();this.centerPoint(e.x,e.y)}centerCell(t){return this.positionCell(t,"center")}positionPoint(t,e,n){const r=this.getComputedSize();(e=zu(e,Math.max(0,r.width)))<0&&(e=r.width+e),(n=zu(n,Math.max(0,r.height)))<0&&(n=r.height+n);const i=this.getTranslation(),s=this.getScale(),o=e-t.x*s.sx,a=n-t.y*s.sy;i.tx===o&&i.ty===a||this.translate(o,a)}positionRect(t,e){const n=_f.create(t);switch(e){case"center":return this.positionPoint(n.getCenter(),"50%","50%");case"top":return this.positionPoint(n.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(n.getTopRight(),"100%",0);case"right":return this.positionPoint(n.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(n.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(n.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(n.getBottomLeft(),0,"100%");case"left":return this.positionPoint(n.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(n.getTopLeft(),0,0);default:return this}}positionCell(t,e){const n=t.getBBox();return this.positionRect(n,e)}positionContent(t,e){const n=this.graph.getContentArea(e);return this.positionRect(n,t)}}class wb extends pb{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}updateBackgroundImage(t={}){let e=t.size||"auto auto",n=t.position||"center";const r=this.graph.transform.getScale(),i=this.graph.translate();if("object"==typeof n){n=`${i.tx+r.sx*(n.x||0)}px ${i.ty+r.sy*(n.y||0)}px`}"object"==typeof e&&(e=_f.fromSize(e).scale(r.sx,r.sy),e=`${e.width}px ${e.height}px`),this.elem.style.backgroundSize=e,this.elem.style.backgroundPosition=n}drawBackgroundImage(t,e={}){if(!(t instanceof HTMLImageElement))return void(this.elem.style.backgroundImage="");const n=this.optionsCache;if(n&&n.image!==e.image)return;let r;const i=e.opacity,s=e.size;let o=e.repeat||"no-repeat";const a=gp.registry.get(o);if("function"==typeof a){const n=e.quality||1;t.width*=n,t.height*=n;const i=a(t,e);if(!(i instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");r=i.toDataURL("image/png"),o=e.repeat&&o!==e.repeat?e.repeat:"repeat","object"==typeof s?(s.width*=i.width/t.width,s.height*=i.height/t.height):void 0===s&&(e.size={width:i.width/n,height:i.height/n})}else r=t.src,void 0===s&&(e.size={width:t.width,height:t.height});null!=n&&"object"==typeof e.size&&e.image===n.image&&e.repeat===n.repeat&&e.quality===n.quality&&(n.size=Gi(e.size));const l=this.elem.style;l.backgroundImage=`url(${r})`,l.backgroundRepeat=o,l.opacity=null==i||i>=1?"":`${i}`,this.updateBackgroundImage(e)}updateBackgroundColor(t){this.elem.style.backgroundColor=t||""}updateBackgroundOptions(t){this.graph.options.background=t}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(t){const e=t||{};if(this.updateBackgroundOptions(t),this.updateBackgroundColor(e.color),e.image){this.optionsCache=Gi(e);const n=document.createElement("img");n.onload=()=>this.drawBackgroundImage(n,t),n.setAttribute("crossorigin","anonymous"),n.src=e.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}}n([pb.dispose()],wb.prototype,"dispose",null);class Ab extends pb{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&!0===this.widgetOptions.enabled}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on("blank:mousedown",this.onMouseDown,this),this.graph.on("node:unhandled:mousedown",this.onMouseDown,this),this.graph.on("edge:unhandled:mousedown",this.onMouseDown,this),gf.on(this.graph.container,"mousedown",this.onRightMouseDown),gf.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new pf(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()}stopListening(){this.graph.off("blank:mousedown",this.onMouseDown,this),this.graph.off("node:unhandled:mousedown",this.onMouseDown,this),this.graph.off("edge:unhandled:mousedown",this.onMouseDown,this),gf.off(this.graph.container,"mousedown",this.onRightMouseDown),gf.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(e,n){return e.spaceKey=this.isSpaceKeyPressed,this.pannable&&t.ModifierKey.isMatch(e,this.widgetOptions.modifiers,n)}startPanning(t){const e=this.view.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.panning=!0,this.updateClassName(t),gf.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),gf.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(t){const e=this.view.normalizeEvent(t),n=e.clientX-this.clientX,r=e.clientY-this.clientY;this.clientX=e.clientX,this.clientY=e.clientY,this.graph.translateBy(n,r)}stopPanning(t){this.panning=!1,this.updateClassName(t),gf.off(document.body,".panning"),gf.off(window,".panning")}updateClassName(t){const e=this.widgetOptions.eventTypes;if(1===(null==e?void 0:e.length)&&e.includes("mouseWheel"))return;const n=this.view.container,r=this.view.prefixClassName("graph-panning"),i=this.view.prefixClassName("graph-pannable"),s=this.graph.getPlugin("selection"),o=s&&s.allowRubberband(t,!0),a=(null==e?void 0:e.includes("leftMouseDown"))&&!o;this.allowPanning(null!=t?t:{},!0)||this.allowPanning(null!=t?t:{})&&a?this.panning?(ug(n,r),gg(n,i)):(gg(n,r),ug(n,i)):this.panning||(gg(n,r),gg(n,i))}onMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.getPlugin("selection"),n=e&&e.allowRubberband(t,!0);(this.allowPanning(t,!0)||this.allowPanning(t)&&!n)&&this.startPanning(t)}onRightMouseDown(t){const e=this.widgetOptions.eventTypes;(null==e?void 0:e.includes("rightMouseDown"))&&2===t.button&&this.allowPanning(t,!0)&&this.startPanning(t)}onMouseWheel(t,e,n){this.graph.translateBy(-e,-n)}onKeyDown(t){32===t.which&&(this.isSpaceKeyPressed=!0),this.updateClassName(t)}onKeyUp(t){32===t.which&&(this.isSpaceKeyPressed=!1),this.updateClassName(t)}allowBlankMouseDown(t){const e=this.widgetOptions.eventTypes;return(null==e?void 0:e.includes("leftMouseDown"))&&0===t.button||(null==e?void 0:e.includes("mouseWheelDown"))&&1===t.button}allowMouseWheel(t){var e;return this.pannable&&!t.ctrlKey&&(null===(e=this.widgetOptions.eventTypes)||void 0===e?void 0:e.includes("mouseWheel"))}autoPanning(t,e){const n=10,r=this.graph.getGraphArea();let i=0,s=0;t<=r.left+n&&(i=-10),e<=r.top+n&&(s=-10),t>=r.right-n&&(i=n),e>=r.bottom-n&&(s=n),0===i&&0===s||this.graph.translateBy(-i,-s)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}n([pb.dispose()],Ab.prototype,"dispose",null);class Cb extends pb{constructor(){super(...arguments),this.cumulatedFactor=1}get widgetOptions(){return this.options.mousewheel}init(){this.container=this.graph.container,this.target=this.widgetOptions.global?document:this.container,this.mousewheelHandle=new pf(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return!0!==this.widgetOptions.enabled}enable(t){(this.disabled||t)&&(this.widgetOptions.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.widgetOptions.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(e){const n=this.widgetOptions.guard;return(null==n||n(e))&&t.ModifierKey.isMatch(e,this.widgetOptions.modifiers)}onMouseWheel(e){const n=this.widgetOptions.guard;if((null==n||n(e))&&t.ModifierKey.isMatch(e,this.widgetOptions.modifiers)){const t=this.widgetOptions.factor||1.2;null==this.currentScale&&(this.startPos={x:e.clientX,y:e.clientY},this.currentScale=this.graph.transform.getScale().sx);e.deltaY<0?(this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*t*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/t)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const n=this.currentScale;let r=this.graph.transform.clampScale(n*this.cumulatedFactor);if(r=Hr(r,this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER),r!==n)if(this.widgetOptions.zoomAtMousePosition){const t=!!this.graph.getPlugin("scroller")?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(r,{absolute:!0,center:t.clone()})}else this.graph.zoom(r,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}n([r.dispose()],Cb.prototype,"dispose",null);class Pb extends pb{init(){this.resetRenderArea=Kc(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this)}enableVirtualRender(){this.options.virtual=!0,this.resetRenderArea()}disableVirtualRender(){this.options.virtual=!1,this.graph.renderer.setRenderArea(void 0)}resetRenderArea(){if(this.options.virtual){const t=this.graph.getGraphArea();this.graph.renderer.setRenderArea(t)}}dispose(){this.stopListening()}}n([pb.dispose()],Pb.prototype,"dispose",null);class Mb{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(t){if(t.priority&vb.PRIOR)t.cb();else{const e=this.findInsertionIndex(t);e>=0&&this.queue.splice(e,0,t)}}queueFlush(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(){this.isFlushPending=!1,this.isFlushing=!0;const t=this.getCurrentTime();let e;for(;(e=this.queue.shift())&&(e.cb(),!(this.getCurrentTime()-t>=this.frameInterval)););this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){let t;for(this.isFlushPending=!1,this.isFlushing=!0;t=this.queue.shift();)try{t.cb()}catch(t){console.log(t)}this.isFlushing=!1}findInsertionIndex(t){let e=0,n=this.queue.length,r=n-1;const i=t.priority;for(;e<=r;){const t=(r-e>>1)+e;i<=this.queue[t].priority?e=t+1:(n=t,r=t-1)}return n}scheduleJob(){"requestIdleCallback"in window?(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.requestIdleCallback(this.flushJobs.bind(this),{timeout:100})):(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.setTimeout(this.flushJobs.bind(this)))}cancelScheduleJob(){"cancelIdleCallback"in window?(this.scheduleId&&window.cancelIdleCallback(this.scheduleId),this.scheduleId=0):(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduleId=0)}getCurrentTime(){return"object"==typeof performance&&"function"==typeof performance.now?performance.now():Date.now()-this.initialTime}}!function(t){t[t.Update=2]="Update",t[t.RenderEdge=4]="RenderEdge",t[t.RenderNode=8]="RenderNode",t[t.PRIOR=1048576]="PRIOR"}(vb||(vb={}));class Eb extends r{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(t){super(),this.views={},this.willRemoveViews={},this.queue=new Mb,this.graph=t,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on("reseted",this.onModelReseted,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("reseted",this.onModelReseted,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}onModelReseted({options:t}){this.queue.clearJobs(),this.removeZPivots(),this.resetViews();const e=this.model.getCells();this.renderViews(e,Object.assign(Object.assign({},t),{queue:e.map((t=>t.id))}))}onCellAdded({cell:t,options:e}){this.renderViews([t],e)}onCellRemoved({cell:t}){this.removeViews([t])}onCellZIndexChanged({cell:t,options:e}){const n=this.views[t.id];n&&this.requestViewUpdate(n.view,Eb.FLAG_INSERT,e,vb.Update,!0)}onCellVisibleChanged({cell:t,current:e}){this.toggleVisible(t,!!e)}requestViewUpdate(t,e,n={},r=vb.Update,i=!0){const s=t.cell.id,o=this.views[s];if(!o)return;o.flag=e,o.options=n;(t.hasAction(e,["translate","resize","rotate"])||!1===n.async)&&(r=vb.PRIOR,i=!1),this.queue.queueJob({id:s,priority:r,cb:()=>{this.renderViewInArea(t,e,n);const r=n.queue;if(r){const e=r.indexOf(t.cell.id);e>=0&&r.splice(e,1),0===r.length&&this.graph.trigger("render:done")}}});this.getEffectedEdges(t).forEach((t=>{this.requestViewUpdate(t.view,t.flag,n,r,!1)})),i&&this.flush()}setRenderArea(t){this.renderArea=t,this.flushWaitingViews()}isViewMounted(t){if(null==t)return!1;const e=this.views[t.cell.id];return!!e&&e.state===Eb.ViewState.MOUNTED}renderViews(t,e={}){t.sort(((t,e)=>t.isNode()&&e.isEdge()?-1:0)),t.forEach((t=>{const n=t.id;let r=0,i=this.views[n];if(i)r=Eb.FLAG_INSERT;else{const s=this.createCellView(t);s&&(s.graph=this.graph,r=Eb.FLAG_INSERT|s.getBootstrapFlag(),i={view:s,flag:r,options:e,state:Eb.ViewState.CREATED},this.views[n]=i)}i&&this.requestViewUpdate(i.view,r,e,this.getRenderPriority(i.view),!1)})),this.flush()}renderViewInArea(t,e,n={}){const r=t.cell,i=r.id,s=this.views[i];if(!s)return;let o=0;this.isUpdatable(t)||s.state===Eb.ViewState.MOUNTED?(o=this.updateView(t,e,n),s.flag=o):s.state=Eb.ViewState.WAITING,o&&(!r.isEdge()||o&t.getFlag(["source","target"])||this.queue.queueJob({id:i,priority:vb.RenderEdge,cb:()=>{this.updateView(t,e,n)}}))}removeViews(t){t.forEach((t=>{const e=t.id,n=this.views[e];n&&(this.willRemoveViews[e]=n,delete this.views[e],this.queue.queueJob({id:e,priority:this.getRenderPriority(n.view),cb:()=>{this.removeView(n.view)}}))})),this.flush()}flush(){this.graph.options.async?this.queue.queueFlush():this.queue.queueFlushSync()}flushWaitingViews(){Object.values(this.views).forEach((t=>{if(t&&t.state===Eb.ViewState.WAITING){const{view:e,flag:n,options:r}=t;this.requestViewUpdate(e,n,r,this.getRenderPriority(e),!1)}})),this.flush()}updateView(t,e,n={}){if(null==t)return 0;if(cy.isCellView(t)){if(e&Eb.FLAG_REMOVE)return this.removeView(t.cell),0;e&Eb.FLAG_INSERT&&(this.insertView(t),e^=Eb.FLAG_INSERT)}return e?t.confirmUpdate(e,n):0}insertView(t){const e=this.views[t.cell.id];if(e){const n=t.cell.getZIndex(),r=this.addZPivot(n);this.container.insertBefore(t.container,r),t.cell.isVisible()||this.toggleVisible(t.cell,!1),e.state=Eb.ViewState.MOUNTED,this.graph.trigger("view:mounted",{view:t})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach((t=>{t&&this.removeView(t.view)})),this.views={},this.willRemoveViews={}}removeView(t){const e=t.cell,n=this.willRemoveViews[e.id];n&&t&&(n.view.remove(),delete this.willRemoveViews[e.id],this.graph.trigger("view:unmounted",{view:t}))}toggleVisible(t,e){const n=this.model.getConnectedEdges(t);for(let t=0,r=n.length;t<r;t+=1){const r=n[t];if(e){const t=r.getSourceCell(),e=r.getTargetCell();if(t&&!t.isVisible()||e&&!e.isVisible())continue;this.toggleVisible(r,!0)}else this.toggleVisible(r,!1)}const r=this.views[t.id];r&&ud(r.view.container,{display:e?"unset":"none"})}addZPivot(t=0){null==this.zPivots&&(this.zPivots={});const e=this.zPivots;let n=e[t];if(n)return n;n=e[t]=document.createComment(`z-index:${t+1}`);let r=-1/0;for(const n in e){const e=+n;e<t&&e>r&&(r=e)}const i=this.container;if(r!==-1/0){const t=e[r];i.insertBefore(n,t.nextSibling)}else i.insertBefore(n,i.firstChild);return n}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach((t=>{t&&t.parentNode&&t.parentNode.removeChild(t)})),this.zPivots={}}createCellView(t){const e={graph:this.graph},n=this.graph.options.createCellView;if(n){const r=su(n,this.graph,t);if(r)return new r(t,e);if(null===r)return null}const r=t.view;if(null!=r&&"string"==typeof r){const n=cy.registry.get(r);return n?new n(t,e):cy.registry.onNotFound(r)}return t.isNode()?new gb(t,e):t.isEdge()?new db(t,e):null}getEffectedEdges(t){const e=[],n=t.cell,r=this.model.getConnectedEdges(n);for(let t=0,i=r.length;t<i;t+=1){const i=r[t],s=this.views[i.id];if(!s)continue;const o=s.view;if(!this.isViewMounted(o))continue;const a=["update"];i.getTargetCell()===n&&a.push("target"),i.getSourceCell()===n&&a.push("source"),e.push({id:i.id,view:o,flag:o.getFlag(a)})}return e}isUpdatable(t){if(t.isNodeView())return!this.renderArea||this.renderArea.isIntersectWithRect(t.cell.getBBox());if(t.isEdgeView()){const e=t.cell,n=e.getSourceCell(),r=e.getTargetCell();if(this.renderArea&&n&&r)return this.renderArea.isIntersectWithRect(n.getBBox())||this.renderArea.isIntersectWithRect(r.getBBox())}return!0}getRenderPriority(t){return t.cell.isNode()?vb.RenderNode:vb.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach((t=>{this.views[t].view.dispose()})),this.views={}}}n([r.dispose()],Eb.prototype,"dispose",null),function(t){t.FLAG_INSERT=1<<30,t.FLAG_REMOVE=1<<29,t.FLAG_RENDER=67108863}(Eb||(Eb={})),function(t){var e;(e=t.ViewState||(t.ViewState={}))[e.CREATED=0]="CREATED",e[e.MOUNTED=1]="MOUNTED",e[e.WAITING=2]="WAITING"}(Eb||(Eb={}));class Sb extends pb{constructor(){super(...arguments),this.schedule=new Eb(this.graph)}requestViewUpdate(t,e,n={}){this.schedule.requestViewUpdate(t,e,n)}isViewMounted(t){return this.schedule.isViewMounted(t)}setRenderArea(t){this.schedule.setRenderArea(t)}findViewByElem(t){if(null==t)return null;const e=this.options.container,n="string"==typeof t?e.querySelector(t):t instanceof Element?t:t[0];if(n){const t=this.graph.view.findAttr("data-cell-id",n);if(t){const e=this.schedule.views;if(e[t])return e[t].view}}return null}findViewByCell(t){if(null==t)return null;const e=Hv.isCell(t)?t.id:t,n=this.schedule.views;return n[e]?n[e].view:null}findViewsFromPoint(e){const n={x:e.x,y:e.y};return this.model.getCells().map((t=>this.findViewByCell(t))).filter((e=>null!=e&&t.Util.getBBox(e.container,{target:this.view.stage}).containsPoint(n)))}findEdgeViewsFromPoint(t,e=5){return this.model.getEdges().map((t=>this.findViewByCell(t))).filter((n=>{if(null!=n){const r=n.getClosestPoint(t);if(r)return r.distance(t)<=e}return!1}))}findViewsInArea(e,n={}){const r=_f.create(e);return this.model.getCells().map((t=>this.findViewByCell(t))).filter((e=>{if(e){if(n.nodeOnly&&!e.isNodeView())return!1;const i=t.Util.getBBox(e.container,{target:this.view.stage});return 0===i.width?i.inflate(1,0):0===i.height&&i.inflate(0,1),n.strict?r.containsRect(i):r.isIntersectWithRect(i)}return!1}))}dispose(){this.schedule.dispose()}}n([pb.dispose()],Sb.prototype,"dispose",null);class Ob extends pb{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(t){return null!=this.svg.getElementById(t)}filter(e){let n=e.id;const r=e.name;if(n||(n=`filter-${r}-${this.cid}-${Lu(JSON.stringify(e))}`),!this.isDefined(n)){const i=mp.registry.get(r);if(null==i)return mp.registry.onNotFound(r);const s=i(e.args||{}),o=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},e.attrs),{id:n});yd.create(t.Markup.sanitize(s),o).appendTo(this.defs)}return n}gradient(t){let e=t.id;const n=t.type;if(e||(e=`gradient-${n}-${this.cid}-${Lu(JSON.stringify(t))}`),!this.isDefined(e)){const r=t.stops.map((t=>{const e=null!=t.opacity&&Number.isFinite(t.opacity)?t.opacity:1;return`<stop offset="${t.offset}" stop-color="${t.color}" stop-opacity="${e}"/>`})),i=`<${n}>${r.join("")}</${n}>`,s=Object.assign({id:e},t.attrs);yd.create(i,s).appendTo(this.defs)}return e}marker(t){const{id:n,refX:r,refY:i,markerUnits:s,markerOrient:o,tagName:a,children:l}=t,c=e(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let h=n;if(h||(h=`marker-${this.cid}-${Lu(JSON.stringify(t))}`),!this.isDefined(h)){"path"!==a&&delete c.d;const t=yd.create("marker",{refX:r,refY:i,id:h,overflow:"visible",orient:null!=o?o:"auto",markerUnits:s||"userSpaceOnUse"},l?l.map((t=>{var{tagName:n}=t,r=e(t,["tagName"]);return yd.create(`${n}`||"path",Wg(Object.assign(Object.assign({},c),r)))})):[yd.create(a||"path",Wg(c))]);this.defs.appendChild(t.node)}return h}remove(t){const e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}}class Tb extends pb{getClientMatrix(){return Gd(this.view.stage.getScreenCTM())}getClientOffset(){const t=this.view.svg.getBoundingClientRect();return new jf(t.left,t.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(t,e){return("number"==typeof t?this.clientToLocalPoint(t,e):this.clientToLocalPoint(t.x,t.y)).snapToGrid(this.graph.getGridSize())}localToGraphPoint(e,n){const r=jf.create(e,n);return t.Util.transformPoint(r,this.graph.matrix())}localToClientPoint(e,n){const r=jf.create(e,n);return t.Util.transformPoint(r,this.getClientMatrix())}localToPagePoint(t,e){return("number"==typeof t?this.localToGraphPoint(t,e):this.localToGraphPoint(t)).translate(this.getPageOffset())}localToGraphRect(e,n,r,i){const s=_f.create(e,n,r,i);return t.Util.transformRectangle(s,this.graph.matrix())}localToClientRect(e,n,r,i){const s=_f.create(e,n,r,i);return t.Util.transformRectangle(s,this.getClientMatrix())}localToPageRect(t,e,n,r){return("number"==typeof t?this.localToGraphRect(t,e,n,r):this.localToGraphRect(t)).translate(this.getPageOffset())}graphToLocalPoint(e,n){const r=jf.create(e,n);return t.Util.transformPoint(r,this.graph.matrix().inverse())}clientToLocalPoint(e,n){const r=jf.create(e,n);return t.Util.transformPoint(r,this.getClientMatrix().inverse())}clientToGraphPoint(e,n){const r=jf.create(e,n);return t.Util.transformPoint(r,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){const n=jf.create(t,e).diff(this.getPageOffset());return this.graphToLocalPoint(n)}graphToLocalRect(e,n,r,i){const s=_f.create(e,n,r,i);return t.Util.transformRectangle(s,this.graph.matrix().inverse())}clientToLocalRect(e,n,r,i){const s=_f.create(e,n,r,i);return t.Util.transformRectangle(s,this.getClientMatrix().inverse())}clientToGraphRect(e,n,r,i){const s=_f.create(e,n,r,i);return t.Util.transformRectangle(s,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,r){const i=_f.create(t,e,n,r),s=this.getPageOffset();return i.x-=s.x,i.y-=s.y,this.graphToLocalRect(i)}}class kb extends pb{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:t,magnet:e,options:n={}}){const r=this.resolveHighlighter(n);if(!r)return;const i=this.getHighlighterId(e,r);if(!this.highlights[i]){const n=r.highlighter;n.highlight(t,e,Object.assign({},r.args)),this.highlights[i]={cellView:t,magnet:e,highlighter:n,args:r.args}}}onCellUnhighlight({magnet:t,options:e={}}){const n=this.resolveHighlighter(e);if(!n)return;const r=this.getHighlighterId(t,n);this.unhighlight(r)}resolveHighlighter(t){const e=this.options;let n=t.highlighter;if(null==n){const r=t.type;n=r&&e.highlighting[r]||e.highlighting.default}if(null==n)return null;const r="string"==typeof n?{name:n}:n,i=r.name,s=Fm.registry.get(i);return null==s?Fm.registry.onNotFound(i):(Fm.check(i,s),{name:i,highlighter:s,args:r.args||{}})}getHighlighterId(t,e){return mg(t),e.name+t.id+JSON.stringify(e.args)}unhighlight(t){const e=this.highlights[t];e&&(e.highlighter.unhighlight(e.cellView,e.magnet,e.args),delete this.highlights[t])}dispose(){Object.keys(this.highlights).forEach((t=>this.unhighlight(t))),this.stopListening()}}n([kb.dispose()],kb.prototype,"dispose",null);class Nb extends pb{getScroller(){const t=this.graph.getPlugin("scroller");return t&&t.options.enabled?t:null}getContainer(){const t=this.getScroller();return t?t.container.parentElement:this.graph.container.parentElement}getSensorTarget(){const t=this.options.autoResize;if(t)return"boolean"==typeof t?this.getContainer():t}init(){if(this.options.autoResize){const e=this.getSensorTarget();e&&t.SizeSensor.bind(e,(()=>{const t=e.offsetWidth,n=e.offsetHeight;this.resize(t,n)}))}}resize(t,e){const n=this.getScroller();n?n.resize(t,e):this.graph.transform.resize(t,e)}dispose(){t.SizeSensor.clear(this.graph.container)}}n([pb.dispose()],Nb.prototype,"dispose",null);class jb extends Pu{get container(){return this.options.container}get[Symbol.toStringTag](){return jb.toStringTag}constructor(e){super(),this.installedPlugins=new Set,this.options=t.Options.get(e),this.css=new mb(this),this.view=new fb(this),this.defs=new Ob(this),this.coord=new Tb(this),this.transform=new xb(this),this.highlight=new kb(this),this.grid=new bb(this),this.background=new wb(this),this.options.model?this.model=this.options.model:(this.model=new Kv,this.model.graph=this),this.renderer=new Sb(this),this.panning=new Ab(this),this.mousewheel=new Cb(this),this.virtualRender=new Pb(this),this.size=new Nb(this)}isNode(t){return t.isNode()}isEdge(t){return t.isEdge()}resetCells(t,e={}){return this.model.resetCells(t,e),this}clearCells(t={}){return this.model.clear(t),this}toJSON(t={}){return this.model.toJSON(t)}parseJSON(t){return this.model.parseJSON(t)}fromJSON(t,e={}){return this.model.fromJSON(t,e),this}getCellById(t){return this.model.getCell(t)}addNode(t,e={}){return this.model.addNode(t,e)}addNodes(t,e={}){return this.addCell(t.map((t=>Xv.isNode(t)?t:this.createNode(t))),e)}createNode(t){return this.model.createNode(t)}removeNode(t,e={}){return this.model.removeCell(t,e)}addEdge(t,e={}){return this.model.addEdge(t,e)}addEdges(t,e={}){return this.addCell(t.map((t=>Yv.isEdge(t)?t:this.createEdge(t))),e)}removeEdge(t,e={}){return this.model.removeCell(t,e)}createEdge(t){return this.model.createEdge(t)}addCell(t,e={}){return this.model.addCell(t,e),this}removeCell(t,e={}){return this.model.removeCell(t,e)}removeCells(t,e={}){return this.model.removeCells(t,e)}removeConnectedEdges(t,e={}){return this.model.removeConnectedEdges(t,e)}disconnectConnectedEdges(t,e={}){return this.model.disconnectConnectedEdges(t,e),this}hasCell(t){return this.model.has(t)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(t){return this.model.getOutgoingEdges(t)}getIncomingEdges(t){return this.model.getIncomingEdges(t)}getConnectedEdges(t,e={}){return this.model.getConnectedEdges(t,e)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(t){return this.model.isRoot(t)}isLeafNode(t){return this.model.isLeaf(t)}getNeighbors(t,e={}){return this.model.getNeighbors(t,e)}isNeighbor(t,e,n={}){return this.model.isNeighbor(t,e,n)}getSuccessors(t,e={}){return this.model.getSuccessors(t,e)}isSuccessor(t,e,n={}){return this.model.isSuccessor(t,e,n)}getPredecessors(t,e={}){return this.model.getPredecessors(t,e)}isPredecessor(t,e,n={}){return this.model.isPredecessor(t,e,n)}getCommonAncestor(...t){return this.model.getCommonAncestor(...t)}getSubGraph(t,e={}){return this.model.getSubGraph(t,e)}cloneSubGraph(t,e={}){return this.model.cloneSubGraph(t,e)}cloneCells(t){return this.model.cloneCells(t)}getNodesFromPoint(t,e){return this.model.getNodesFromPoint(t,e)}getNodesInArea(t,e,n,r,i){return this.model.getNodesInArea(t,e,n,r,i)}getNodesUnderNode(t,e={}){return this.model.getNodesUnderNode(t,e)}searchCell(t,e,n={}){return this.model.search(t,e,n),this}getShortestPath(t,e,n={}){return this.model.getShortestPath(t,e,n)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(t,e={}){return this.model.getCellsBBox(t,e)}startBatch(t,e={}){this.model.startBatch(t,e)}stopBatch(t,e={}){this.model.stopBatch(t,e)}batchUpdate(t,e,n){const r="string"==typeof t?t:"update",i="string"==typeof t?e:t,s="function"==typeof e?n:e;this.startBatch(r,s);const o=i();return this.stopBatch(r,s),o}updateCellId(t,e){return this.model.updateCellId(t,e)}findView(t){return Hv.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return _f.isRectangleLike(t)?this.findViewsInArea(t):jf.isPointLike(t)?this.findViewsFromPoint(t):[]}findViewByCell(t){return this.renderer.findViewByCell(t)}findViewByElem(t){return this.renderer.findViewByElem(t)}findViewsFromPoint(t,e){const n="number"==typeof t?{x:t,y:e}:t;return this.renderer.findViewsFromPoint(n)}findViewsInArea(t,e,n,r,i){const s="number"==typeof t?{x:t,y:e,width:n,height:r}:t,o="number"==typeof t?i:e;return this.renderer.findViewsInArea(s,o)}matrix(t){return void 0===t?this.transform.getMatrix():(this.transform.setMatrix(t),this)}resize(t,e){const n=this.getPlugin("scroller");return n?n.resize(t,e):this.transform.resize(t,e),this}scale(t,e=t,n=0,r=0){return void 0===t?this.transform.getScale():(this.transform.scale(t,e,n,r),this)}zoom(t,e){const n=this.getPlugin("scroller");if(n){if(void 0===t)return n.zoom();n.zoom(t,e)}else{if(void 0===t)return this.transform.getZoom();this.transform.zoom(t,e)}return this}zoomTo(t,e={}){const n=this.getPlugin("scroller");return n?n.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})):this.transform.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})),this}zoomToRect(t,e={}){const n=this.getPlugin("scroller");return n?n.zoomToRect(t,e):this.transform.zoomToRect(t,e),this}zoomToFit(t={}){const e=this.getPlugin("scroller");return e?e.zoomToFit(t):this.transform.zoomToFit(t),this}rotate(t,e,n){return void 0===t?this.transform.getRotation():(this.transform.rotate(t,e,n),this)}translate(t,e){return void 0===t?this.transform.getTranslation():(this.transform.translate(t,e),this)}translateBy(t,e){const n=this.translate(),r=n.tx+t,i=n.ty+e;return this.translate(r,i)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(t={}){return this.transform.getContentArea(t)}getContentBBox(t={}){return this.transform.getContentBBox(t)}fitToContent(t,e,n,r){return this.transform.fitToContent(t,e,n,r)}scaleContentToFit(t={}){return this.transform.scaleContentToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const r=this.getPlugin("scroller");return r?r.centerPoint(t,e,n):this.transform.centerPoint(t,e),this}centerContent(t){const e=this.getPlugin("scroller");return e?e.centerContent(t):this.transform.centerContent(t),this}centerCell(t,e){const n=this.getPlugin("scroller");return n?n.centerCell(t,e):this.transform.centerCell(t),this}positionPoint(t,e,n,r={}){const i=this.getPlugin("scroller");return i?i.positionPoint(t,e,n,r):this.transform.positionPoint(t,e,n),this}positionRect(t,e,n){const r=this.getPlugin("scroller");return r?r.positionRect(t,e,n):this.transform.positionRect(t,e),this}positionCell(t,e,n){const r=this.getPlugin("scroller");return r?r.positionCell(t,e,n):this.transform.positionCell(t,e),this}positionContent(t,e){const n=this.getPlugin("scroller");return n?n.positionContent(t,e):this.transform.positionContent(t,e),this}snapToGrid(t,e){return this.coord.snapToGrid(t,e)}pageToLocal(t,e,n,r){return _f.isRectangleLike(t)?this.coord.pageToLocalRect(t):"number"==typeof t&&"number"==typeof e&&"number"==typeof n&&"number"==typeof r?this.coord.pageToLocalRect(t,e,n,r):this.coord.pageToLocalPoint(t,e)}localToPage(t,e,n,r){return _f.isRectangleLike(t)?this.coord.localToPageRect(t):"number"==typeof t&&"number"==typeof e&&"number"==typeof n&&"number"==typeof r?this.coord.localToPageRect(t,e,n,r):this.coord.localToPagePoint(t,e)}clientToLocal(t,e,n,r){return _f.isRectangleLike(t)?this.coord.clientToLocalRect(t):"number"==typeof t&&"number"==typeof e&&"number"==typeof n&&"number"==typeof r?this.coord.clientToLocalRect(t,e,n,r):this.coord.clientToLocalPoint(t,e)}localToClient(t,e,n,r){return _f.isRectangleLike(t)?this.coord.localToClientRect(t):"number"==typeof t&&"number"==typeof e&&"number"==typeof n&&"number"==typeof r?this.coord.localToClientRect(t,e,n,r):this.coord.localToClientPoint(t,e)}localToGraph(t,e,n,r){return _f.isRectangleLike(t)?this.coord.localToGraphRect(t):"number"==typeof t&&"number"==typeof e&&"number"==typeof n&&"number"==typeof r?this.coord.localToGraphRect(t,e,n,r):this.coord.localToGraphPoint(t,e)}graphToLocal(t,e,n,r){return _f.isRectangleLike(t)?this.coord.graphToLocalRect(t):"number"==typeof t&&"number"==typeof e&&"number"==typeof n&&"number"==typeof r?this.coord.graphToLocalRect(t,e,n,r):this.coord.graphToLocalPoint(t,e)}clientToGraph(t,e,n,r){return _f.isRectangleLike(t)?this.coord.clientToGraphRect(t):"number"==typeof t&&"number"==typeof e&&"number"==typeof n&&"number"==typeof r?this.coord.clientToGraphRect(t,e,n,r):this.coord.clientToGraphPoint(t,e)}defineFilter(t){return this.defs.filter(t)}defineGradient(t){return this.defs.gradient(t)}defineMarker(t){return this.defs.marker(t)}getGridSize(){return this.grid.getGridSize()}setGridSize(t){return this.grid.setGridSize(t),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(t){return this.grid.draw(t),this}updateBackground(){return this.background.update(),this}drawBackground(t,e){const n=this.getPlugin("scroller");return null==n||null!=this.options.background&&e?this.background.draw(t):n.drawBackground(t,e),this}clearBackground(t){const e=this.getPlugin("scroller");return null==e||null!=this.options.background&&t?this.background.clear():e.clearBackground(t),this}enableVirtualRender(){return this.virtualRender.enableVirtualRender(),this}disableVirtualRender(){return this.virtualRender.disableVirtualRender(),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(t){return null==t?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():t?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){const t=this.getPlugin("scroller");return t?t.isPannable():this.panning.pannable}enablePanning(){const t=this.getPlugin("scroller");return t?t.enablePanning():this.panning.enablePanning(),this}disablePanning(){const t=this.getPlugin("scroller");return t?t.disablePanning():this.panning.disablePanning(),this}togglePanning(t){return null==t?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}use(t,...e){return this.installedPlugins.has(t)||(this.installedPlugins.add(t),t.init(this,...e)),this}getPlugin(t){return Array.from(this.installedPlugins).find((e=>e.name===t))}getPlugins(t){return Array.from(this.installedPlugins).filter((e=>t.includes(e.name)))}enablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null==n||n.forEach((t=>{var e;null===(e=null==t?void 0:t.enable)||void 0===e||e.call(t)})),this}disablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null==n||n.forEach((t=>{var e;null===(e=null==t?void 0:t.disable)||void 0===e||e.call(t)})),this}isPluginEnabled(t){var e;const n=this.getPlugin(t);return null===(e=null==n?void 0:n.isEnabled)||void 0===e?void 0:e.call(n)}disposePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null==n||n.forEach((t=>{t.dispose(),this.installedPlugins.delete(t)})),this}dispose(t=!0){t&&this.model.dispose(),this.css.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.highlight.dispose(),this.background.dispose(),this.mousewheel.dispose(),this.panning.dispose(),this.view.dispose(),this.renderer.dispose(),this.installedPlugins.forEach((t=>{t.dispose()}))}}n([Pu.dispose()],jb.prototype,"dispose",null),function(t){t.View=fb,t.Renderer=Sb,t.MouseWheel=Cb,t.DefsManager=Ob,t.GridManager=bb,t.CoordManager=Tb,t.TransformManager=xb,t.HighlightManager=kb,t.BackgroundManager=wb,t.PanningManager=Ab}(jb||(jb={})),function(t){t.toStringTag=`X6.${t.name}`,t.isGraph=function(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag];return null==n||n===t.toStringTag}}(jb||(jb={})),function(t){t.render=function(e,n){const r=e instanceof HTMLElement?new t({container:e}):new t(e);return null!=n&&r.fromJSON(n),r}}(jb||(jb={})),function(t){t.registerNode=Xv.registry.register,t.registerEdge=Yv.registry.register,t.registerView=cy.registry.register,t.registerAttr=jm.registry.register,t.registerGrid=lp.registry.register,t.registerFilter=mp.registry.register,t.registerNodeTool=ky.registry.register,t.registerEdgeTool=Ny.registry.register,t.registerBackground=gp.registry.register,t.registerHighlighter=Fm.registry.register,t.registerPortLayout=Jm.registry.register,t.registerPortLabelLayout=ny.registry.register,t.registerMarker=mm.registry.register,t.registerRouter=jv.registry.register,t.registerConnector=$v.registry.register,t.registerAnchor=Wy.registry.register,t.registerEdgeAnchor=Zy.registry.register,t.registerConnectionPoint=nv.registry.register}(jb||(jb={})),function(t){t.unregisterNode=Xv.registry.unregister,t.unregisterEdge=Yv.registry.unregister,t.unregisterView=cy.registry.unregister,t.unregisterAttr=jm.registry.unregister,t.unregisterGrid=lp.registry.unregister,t.unregisterFilter=mp.registry.unregister,t.unregisterNodeTool=ky.registry.unregister,t.unregisterEdgeTool=Ny.registry.unregister,t.unregisterBackground=gp.registry.unregister,t.unregisterHighlighter=Fm.registry.unregister,t.unregisterPortLayout=Jm.registry.unregister,t.unregisterPortLabelLayout=ny.registry.unregister,t.unregisterMarker=mm.registry.unregister,t.unregisterRouter=jv.registry.unregister,t.unregisterConnector=$v.registry.unregister,t.unregisterAnchor=Wy.registry.unregister,t.unregisterEdgeAnchor=Zy.registry.unregister,t.unregisterConnectionPoint=nv.registry.unregister}(jb||(jb={}));class _b extends Xv{}!function(t){class e extends gb{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:e}){const n=t.shapeMaps[this.cell.shape];if(n){const{effect:t}=n;t&&!t.includes(e)||this.renderHTMLComponent()}}confirmUpdate(t){const n=super.confirmUpdate(t);return this.handleAction(n,e.action,(()=>this.renderHTMLComponent()))}renderHTMLComponent(){const e=this.selectors&&this.selectors.foContent;if(e){jg(e);const n=t.shapeMaps[this.cell.shape];if(!n)return;let{html:r}=n;"function"==typeof r&&(r=r(this.cell)),r&&("string"==typeof r?e.innerHTML=r:_g(e,r))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}n([e.dispose()],e.prototype,"dispose",null),t.View=e,function(t){t.action="html",t.config({bootstrap:[t.action],actions:{html:t.action}}),gb.registry.register("html-view",t,!0)}(e=t.View||(t.View={}))}(_b||(_b={})),function(e){e.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},t.Markup.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),Xv.registry.register("html",e,!0)}(_b||(_b={})),function(t){t.shapeMaps={},t.register=function(n){const{shape:r,html:i,effect:s,inherit:o}=n,a=e(n,["shape","html","effect","inherit"]);if(!r)throw new Error("should specify shape in config");t.shapeMaps[r]={html:i,effect:s},jb.registerNode(r,Object.assign({inherit:o||"html"},a),!0)}}(_b||(_b={}));var Lb=Object.freeze({__proto__:null,Circle:ub,Edge:rb,Ellipse:ib,get HTML(){return _b},Image:hb,Path:lb,Polygon:ob,Polyline:ab,Rect:nb,TextBlock:cb});t.ArrayExt=Mu,t.BackgroundManager=wb,t.Basecoat=Pu,t.Cell=Hv,t.CellView=cy,t.Collection=Zv,t.Color=Cf,t.Config=Lm,t.CssLoader=kf,t.Curve=Gf,t.Dictionary=Pf,t.Disablable=class extends Pu{get disabled(){return!0===this._disabled}enable(){delete this._disabled}disable(){this._disabled=!0}},t.Disposable=r,t.DisposableDelegate=class{constructor(t){this.callback=t}get disposed(){return!this.callback}dispose(){if(!this.callback)return;const t=this.callback;this.callback=null,t()}},t.DisposableSet=i,t.Dom=yf,t.Edge=Yv,t.EdgeView=db,t.Ellipse=Bf,t.Events=uu,t.FunctionExt=cu,t.Graph=jb,t.GraphView=fb,t.Line=Lf,t.Model=Kv,t.Node=Xv,t.NodeView=gb,t.NumberExt=Fu,t.ObjectExt=Au,t.Path=ep,t.Point=jf,t.Polyline=Ff,t.PriorityQueue=xf,t.Rectangle=_f,t.Registry=Uv,t.Segment=Uf,t.Shape=Lb,t.StringExt=Ru,t.Text=Zg,t.ToolsView=hy,t.TransformManager=xb,t.Vector=yd,t.View=sy,t.normalizePathData=tp}));