chunk-199a5778.3507ff09.js 447 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-199a5778"],{5728:function(t,e,n){"use strict";n.d(e,"j",(function(){return Rm})),n.d(e,"i",(function(){return nf})),n.d(e,"o",(function(){return sf})),n.d(e,"k",(function(){return cy})),n.d(e,"h",(function(){return Wy})),n.d(e,"l",(function(){return r})),n.d(e,"f",(function(){return i})),n.d(e,"c",(function(){return $l})),n.d(e,"e",(function(){return c})),n.d(e,"b",(function(){return h})),n.d(e,"m",(function(){return zh})),n.d(e,"g",(function(){return Ih})),n.d(e,"n",(function(){return O}));var i={};n.r(i),n.d(i,"debounce",(function(){return tt})),n.d(i,"throttle",(function(){return it})),n.d(i,"apply",(function(){return rt})),n.d(i,"call",(function(){return st})),n.d(i,"isAsyncLike",(function(){return ot})),n.d(i,"isAsync",(function(){return at})),n.d(i,"toAsyncBoolean",(function(){return lt})),n.d(i,"toDeferredBoolean",(function(){return ct}));var r={};n.r(r),n.d(r,"has",(function(){return Qt})),n.d(r,"pick",(function(){return Ee})),n.d(r,"merge",(function(){return Me["a"]})),n.d(r,"isEqual",(function(){return Se["a"]})),n.d(r,"isEmpty",(function(){return Fe})),n.d(r,"isObject",(function(){return S["a"]})),n.d(r,"isPlainObject",(function(){return $e["a"]})),n.d(r,"clone",(function(){return Ue})),n.d(r,"cloneDeep",(function(){return We["a"]})),n.d(r,"defaults",(function(){return tn})),n.d(r,"defaultsDeep",(function(){return hn})),n.d(r,"applyMixins",(function(){return un})),n.d(r,"inherit",(function(){return gn})),n.d(r,"createClass",(function(){return mn})),n.d(r,"ensure",(function(){return yn})),n.d(r,"getValue",(function(){return bn})),n.d(r,"getNumber",(function(){return vn})),n.d(r,"getBoolean",(function(){return xn})),n.d(r,"isMaliciousProp",(function(){return wn})),n.d(r,"getByPath",(function(){return Pn})),n.d(r,"setByPath",(function(){return Cn})),n.d(r,"unsetByPath",(function(){return An})),n.d(r,"flatten",(function(){return On}));var s={};n.r(s),n.d(s,"uniq",(function(){return Qn})),n.d(s,"union",(function(){return ni})),n.d(s,"sortedIndex",(function(){return pi})),n.d(s,"sortedIndexBy",(function(){return Wi})),n.d(s,"sortBy",(function(){return dr})),n.d(s,"groupBy",(function(){return Cr})),n.d(s,"difference",(function(){return Sr})),n.d(s,"max",(function(){return Br}));var o={};n.r(o),n.d(o,"uniqueId",(function(){return Rr})),n.d(o,"lowerFirst",(function(){return na})),n.d(o,"upperFirst",(function(){return Ho})),n.d(o,"camelCase",(function(){return Yo})),n.d(o,"kebabCase",(function(){return ra})),n.d(o,"pascalCase",(function(){return sa})),n.d(o,"constantCase",(function(){return oa})),n.d(o,"dotCase",(function(){return aa})),n.d(o,"pathCase",(function(){return la})),n.d(o,"sentenceCase",(function(){return ca})),n.d(o,"titleCase",(function(){return ha})),n.d(o,"hashcode",(function(){return ua})),n.d(o,"uuid",(function(){return da})),n.d(o,"getSpellingSuggestion",(function(){return ga}));var a={};n.r(a),n.d(a,"isNumber",(function(){return ya})),n.d(a,"clamp",(function(){return wa})),n.d(a,"mod",(function(){return Pa})),n.d(a,"random",(function(){return Ca})),n.d(a,"isPercentage",(function(){return Aa})),n.d(a,"normalizePercentage",(function(){return Oa})),n.d(a,"parseCssNumeric",(function(){return Ea})),n.d(a,"normalizeSides",(function(){return Ma}));var l={};n.r(l),n.d(l,"annotate",(function(){return Il})),n.d(l,"findAnnotationsAtIndex",(function(){return Rl})),n.d(l,"findAnnotationsBetweenIndexes",(function(){return Vl})),n.d(l,"shiftAnnotations",(function(){return zl})),n.d(l,"sanitize",(function(){return Fl}));var c={};n.r(c),n.d(c,"CASE_SENSITIVE_ATTR",(function(){return El})),n.d(c,"getAttribute",(function(){return Ml})),n.d(c,"removeAttribute",(function(){return Sl})),n.d(c,"setAttribute",(function(){return Tl})),n.d(c,"setAttributes",(function(){return Nl})),n.d(c,"attr",(function(){return kl})),n.d(c,"qualifyAttr",(function(){return jl})),n.d(c,"kebablizeAttrs",(function(){return Ll})),n.d(c,"styleToObject",(function(){return Bl})),n.d(c,"mergeAttrs",(function(){return Dl})),n.d(c,"uniqueId",(function(){return tl})),n.d(c,"ensureId",(function(){return el})),n.d(c,"isSVGGraphicsElement",(function(){return nl})),n.d(c,"ns",(function(){return il})),n.d(c,"svgVersion",(function(){return rl})),n.d(c,"createElement",(function(){return sl})),n.d(c,"createElementNS",(function(){return ol})),n.d(c,"createSvgElement",(function(){return al})),n.d(c,"createSvgDocument",(function(){return ll})),n.d(c,"parseXML",(function(){return cl})),n.d(c,"tagName",(function(){return hl})),n.d(c,"index",(function(){return ul})),n.d(c,"find",(function(){return dl})),n.d(c,"findOne",(function(){return gl})),n.d(c,"findParentByClass",(function(){return fl})),n.d(c,"contains",(function(){return pl})),n.d(c,"remove",(function(){return ml})),n.d(c,"empty",(function(){return yl})),n.d(c,"append",(function(){return bl})),n.d(c,"prepend",(function(){return vl})),n.d(c,"before",(function(){return xl})),n.d(c,"after",(function(){return wl})),n.d(c,"appendTo",(function(){return Pl})),n.d(c,"isElement",(function(){return Cl})),n.d(c,"isHTMLElement",(function(){return Al})),n.d(c,"children",(function(){return Ol})),n.d(c,"getClass",(function(){return Xa})),n.d(c,"hasClass",(function(){return _a})),n.d(c,"addClass",(function(){return Ya})),n.d(c,"removeClass",(function(){return Za})),n.d(c,"toggleClass",(function(){return Ka})),n.d(c,"setPrefixedStyle",(function(){return Kl})),n.d(c,"getComputedStyle",(function(){return Ql})),n.d(c,"hasScrollbars",(function(){return tc})),n.d(c,"getVendorPrefixedName",(function(){return Zl})),n.d(c,"clearSelection",(function(){return ec})),n.d(c,"isCSSVariable",(function(){return ic})),n.d(c,"computeStyle",(function(){return rc})),n.d(c,"computeStyleInt",(function(){return sc})),n.d(c,"css",(function(){return ac})),n.d(c,"getData",(function(){return cc})),n.d(c,"setData",(function(){return hc})),n.d(c,"data",(function(){return uc})),n.d(c,"prop",(function(){return gc})),n.d(c,"text",(function(){return xc})),n.d(c,"measureText",(function(){return wc})),n.d(c,"splitTextByLength",(function(){return Pc})),n.d(c,"breakText",(function(){return Cc})),n.d(c,"KAPPA",(function(){return Ac})),n.d(c,"sample",(function(){return Ec})),n.d(c,"lineToPathData",(function(){return Mc})),n.d(c,"polygonToPathData",(function(){return Sc})),n.d(c,"polylineToPathData",(function(){return Tc})),n.d(c,"getPointsFromSvgElement",(function(){return kc})),n.d(c,"circleToPathData",(function(){return jc})),n.d(c,"ellipseToPathData",(function(){return Lc})),n.d(c,"rectangleToPathData",(function(){return Bc})),n.d(c,"rectToPathData",(function(){return Dc})),n.d(c,"toPath",(function(){return Ic})),n.d(c,"toPathData",(function(){return Rc})),n.d(c,"createSlicePathData",(function(){return Vc})),n.d(c,"createSVGPoint",(function(){return Gc})),n.d(c,"createSVGMatrix",(function(){return qc})),n.d(c,"createSVGTransform",(function(){return Hc})),n.d(c,"transformStringToMatrix",(function(){return Uc})),n.d(c,"matrixToTransformString",(function(){return Wc})),n.d(c,"parseTransformString",(function(){return Jc})),n.d(c,"decomposeMatrix",(function(){return _c})),n.d(c,"matrixToScale",(function(){return Yc})),n.d(c,"matrixToRotation",(function(){return Zc})),n.d(c,"matrixToTranslation",(function(){return Kc})),n.d(c,"transform",(function(){return Qc})),n.d(c,"translate",(function(){return th})),n.d(c,"rotate",(function(){return eh})),n.d(c,"scale",(function(){return nh})),n.d(c,"getTransformToElement",(function(){return ih})),n.d(c,"getTransformToParentElement",(function(){return rh})),n.d(c,"toLocalPoint",(function(){return sh})),n.d(c,"EventHook",(function(){return oh})),n.d(c,"Event",(function(){return dh})),n.d(c,"EventObject",(function(){return hh})),n.d(c,"MouseWheelHandle",(function(){return ph})),n.d(c,"offset",(function(){return mh})),n.d(c,"width",(function(){return yh})),n.d(c,"height",(function(){return bh})),n.d(c,"position",(function(){return vh}));var h={};n.r(h),n.d(h,"ensure",(function(){return Lh})),n.d(h,"clean",(function(){return Bh}));var u={};n.r(u),n.d(u,"dot",(function(){return uu})),n.d(u,"fixedDot",(function(){return du})),n.d(u,"mesh",(function(){return gu})),n.d(u,"doubleMesh",(function(){return fu}));var d={};n.r(d),n.d(d,"flipX",(function(){return mu})),n.d(d,"flipY",(function(){return yu})),n.d(d,"flipXY",(function(){return bu})),n.d(d,"watermark",(function(){return vu}));var g={};n.r(g),n.d(g,"outline",(function(){return Au})),n.d(g,"highlight",(function(){return Ou})),n.d(g,"blur",(function(){return Eu})),n.d(g,"dropShadow",(function(){return Mu})),n.d(g,"grayScale",(function(){return Su})),n.d(g,"sepia",(function(){return Tu})),n.d(g,"saturate",(function(){return Nu})),n.d(g,"hueRotate",(function(){return ku})),n.d(g,"invert",(function(){return ju})),n.d(g,"brightness",(function(){return Lu})),n.d(g,"contrast",(function(){return Bu}));var f={};n.r(f),n.d(f,"block",(function(){return Ld})),n.d(f,"classic",(function(){return Bd})),n.d(f,"diamond",(function(){return Rd})),n.d(f,"path",(function(){return zd})),n.d(f,"cross",(function(){return $d})),n.d(f,"async",(function(){return qd})),n.d(f,"circle",(function(){return Ud})),n.d(f,"circlePlus",(function(){return Wd})),n.d(f,"ellipse",(function(){return Xd}));var p={};n.r(p),n.d(p,"ref",(function(){return Iu})),n.d(p,"refX",(function(){return Ru})),n.d(p,"refY",(function(){return Vu})),n.d(p,"refDx",(function(){return zu})),n.d(p,"refDy",(function(){return Fu})),n.d(p,"refWidth",(function(){return $u})),n.d(p,"refHeight",(function(){return Gu})),n.d(p,"refRx",(function(){return qu})),n.d(p,"refRy",(function(){return Hu})),n.d(p,"refRInscribed",(function(){return Uu})),n.d(p,"refRCircumscribed",(function(){return Wu})),n.d(p,"refCx",(function(){return Ju})),n.d(p,"refCy",(function(){return Xu})),n.d(p,"refDResetOffset",(function(){return _u})),n.d(p,"refDKeepOffset",(function(){return Yu})),n.d(p,"refPointsResetOffset",(function(){return Zu})),n.d(p,"refPointsKeepOffset",(function(){return Ku})),n.d(p,"refR",(function(){return Qu})),n.d(p,"refD",(function(){return td})),n.d(p,"refPoints",(function(){return ed})),n.d(p,"refX2",(function(){return nd})),n.d(p,"refY2",(function(){return id})),n.d(p,"refWidth2",(function(){return rd})),n.d(p,"refHeight2",(function(){return sd})),n.d(p,"fill",(function(){return ud})),n.d(p,"stroke",(function(){return dd})),n.d(p,"text",(function(){return gd})),n.d(p,"textWrap",(function(){return fd})),n.d(p,"lineHeight",(function(){return md})),n.d(p,"textVerticalAnchor",(function(){return yd})),n.d(p,"textPath",(function(){return bd})),n.d(p,"annotations",(function(){return vd})),n.d(p,"eol",(function(){return xd})),n.d(p,"displayEmpty",(function(){return wd})),n.d(p,"title",(function(){return Pd})),n.d(p,"xAlign",(function(){return Cd})),n.d(p,"yAlign",(function(){return Ad})),n.d(p,"resetOffset",(function(){return Od})),n.d(p,"style",(function(){return Md})),n.d(p,"html",(function(){return Sd})),n.d(p,"filter",(function(){return Td})),n.d(p,"port",(function(){return Nd})),n.d(p,"sourceMarker",(function(){return Kd})),n.d(p,"targetMarker",(function(){return Qd})),n.d(p,"vertexMarker",(function(){return tg})),n.d(p,"connection",(function(){return rg})),n.d(p,"atConnectionLengthKeepGradient",(function(){return sg})),n.d(p,"atConnectionLengthIgnoreGradient",(function(){return og})),n.d(p,"atConnectionRatioKeepGradient",(function(){return ag})),n.d(p,"atConnectionRatioIgnoreGradient",(function(){return lg})),n.d(p,"atConnectionLength",(function(){return cg})),n.d(p,"atConnectionRatio",(function(){return hg}));var m={};n.r(m),n.d(m,"className",(function(){return pg})),n.d(m,"opacity",(function(){return yg})),n.d(m,"stroke",(function(){return xg}));var y={};n.r(y),n.d(y,"absolute",(function(){return Og})),n.d(y,"ellipse",(function(){return Eg})),n.d(y,"ellipseSpread",(function(){return Mg})),n.d(y,"line",(function(){return Ng})),n.d(y,"left",(function(){return kg})),n.d(y,"right",(function(){return jg})),n.d(y,"top",(function(){return Lg})),n.d(y,"bottom",(function(){return Bg}));var b={};n.r(b),n.d(b,"manual",(function(){return zg})),n.d(b,"left",(function(){return Fg})),n.d(b,"right",(function(){return $g})),n.d(b,"top",(function(){return Gg})),n.d(b,"bottom",(function(){return qg})),n.d(b,"outside",(function(){return Hg})),n.d(b,"outsideOriented",(function(){return Ug})),n.d(b,"inside",(function(){return Wg})),n.d(b,"insideOriented",(function(){return Jg})),n.d(b,"radial",(function(){return Zg})),n.d(b,"radialOriented",(function(){return Kg}));var v={};n.r(v),n.d(v,"noop",(function(){return gf})),n.d(v,"pinRelative",(function(){return bf})),n.d(v,"pinAbsolute",(function(){return vf}));var x={};n.r(x),n.d(x,"center",(function(){return zf})),n.d(x,"top",(function(){return Ff})),n.d(x,"bottom",(function(){return $f})),n.d(x,"left",(function(){return Gf})),n.d(x,"right",(function(){return qf})),n.d(x,"topLeft",(function(){return Hf})),n.d(x,"topRight",(function(){return Uf})),n.d(x,"bottomLeft",(function(){return Wf})),n.d(x,"bottomRight",(function(){return Jf})),n.d(x,"orth",(function(){return Kf})),n.d(x,"nodeCenter",(function(){return Qf})),n.d(x,"midSide",(function(){return ep}));var w={};n.r(w),n.d(w,"ratio",(function(){return ip})),n.d(w,"length",(function(){return rp})),n.d(w,"orth",(function(){return lp})),n.d(w,"closest",(function(){return op}));var P={};n.r(P),n.d(P,"bbox",(function(){return gp})),n.d(P,"rect",(function(){return fp})),n.d(P,"boundary",(function(){return pp})),n.d(P,"anchor",(function(){return yp}));var C={};n.r(C),n.d(C,"normal",(function(){return vp})),n.d(C,"oneSide",(function(){return xp})),n.d(C,"orth",(function(){return Mp})),n.d(C,"metro",(function(){return sm})),n.d(C,"manhattan",(function(){return im})),n.d(C,"er",(function(){return om})),n.d(C,"loop",(function(){return lm}));var A={};n.r(A),n.d(A,"normal",(function(){return hm})),n.d(A,"loop",(function(){return um})),n.d(A,"rounded",(function(){return dm})),n.d(A,"smooth",(function(){return gm})),n.d(A,"jumpover",(function(){return Em}));var O={};n.r(O),n.d(O,"Rect",(function(){return Ym})),n.d(O,"Edge",(function(){return Zm})),n.d(O,"Ellipse",(function(){return Km})),n.d(O,"Polygon",(function(){return ey})),n.d(O,"Polyline",(function(){return ny})),n.d(O,"Path",(function(){return ry})),n.d(O,"TextBlock",(function(){return oy})),n.d(O,"Image",(function(){return ay})),n.d(O,"Circle",(function(){return ly})),n.d(O,"HTML",(function(){return _y}));n("6362");class E{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}(function(t){function e(){return(t,e,n)=>{const i=n.value,r=t.__proto__;n.value=function(...t){this.disposed||(i.call(this,...t),r.dispose.call(this))}}}t.dispose=e})(E||(E={}));class M{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){function e(e){const n=new t;return e.forEach(t=>{n.add(t)}),n}t.from=e})(M||(M={}));var S=n("2332"),T=n("26ee"),N=function(){return T["a"].Date.now()},k=N,j=/\s/;function L(t){var e=t.length;while(e--&&j.test(t.charAt(e)));return e}var B=L,D=/^\s+/;function I(t){return t?t.slice(0,B(t)+1).replace(D,""):t}var R=I,V=n("f0ce"),z=n("1147"),F="[object Symbol]";function $(t){return"symbol"==typeof t||Object(z["a"])(t)&&Object(V["a"])(t)==F}var G=$,q=NaN,H=/^[-+]0x[0-9a-f]+$/i,U=/^0b[01]+$/i,W=/^0o[0-7]+$/i,J=parseInt;function X(t){if("number"==typeof t)return t;if(G(t))return q;if(Object(S["a"])(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Object(S["a"])(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=R(t);var n=U.test(t);return n||W.test(t)?J(t.slice(2),n?2:8):H.test(t)?q:+t}var _=X,Y="Expected a function",Z=Math.max,K=Math.min;function Q(t,e,n){var i,r,s,o,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError(Y);function g(e){var n=i,s=r;return i=r=void 0,c=e,o=t.apply(s,n),o}function f(t){return c=t,a=setTimeout(y,e),h?g(t):o}function p(t){var n=t-l,i=t-c,r=e-n;return u?K(r,s-i):r}function m(t){var n=t-l,i=t-c;return void 0===l||n>=e||n<0||u&&i>=s}function y(){var t=k();if(m(t))return b(t);a=setTimeout(y,p(t))}function b(t){return a=void 0,d&&i?g(t):(i=r=void 0,o)}function v(){void 0!==a&&clearTimeout(a),c=0,i=l=r=a=void 0}function x(){return void 0===a?o:b(k())}function w(){var t=k(),n=m(t);if(i=arguments,r=this,l=t,n){if(void 0===a)return f(l);if(u)return clearTimeout(a),a=setTimeout(y,e),g(l)}return void 0===a&&(a=setTimeout(y,e)),o}return e=_(e)||0,Object(S["a"])(n)&&(h=!!n.leading,u="maxWait"in n,s=u?Z(_(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d),w.cancel=v,w.flush=x,w}var tt=Q,et="Expected a function";function nt(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new TypeError(et);return Object(S["a"])(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),tt(t,e,{leading:i,maxWait:e,trailing:r})}var it=nt;function rt(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 st(t,e,...n){return rt(t,e,n)}function ot(t){return"object"===typeof t&&t.then&&"function"===typeof t.then}function at(t){return null!=t&&(t instanceof Promise||ot(t))}function lt(...t){const e=[];t.forEach(t=>{Array.isArray(t)?e.push(...t):e.push(t)});const n=e.some(t=>at(t));if(n){const t=e.map(t=>at(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)}function ct(...t){const e=lt(t);return"boolean"===typeof e?Promise.resolve(e):e}function ht(t,e){const n=[];for(let r=0;r<t.length;r+=2){const s=t[r],o=t[r+1],a=Array.isArray(e)?e:[e],l=i.apply(s,o,a);n.push(l)}return i.toAsyncBoolean(n)}class ut{constructor(){this.listeners={}}on(t,e,n){if(null==e)return this;this.listeners[t]||(this.listeners[t]=[]);const i=this.listeners[t];return i.push(e,n),this}once(t,e,n){const i=(...r)=>(this.off(t,i),ht([e,n],r));return this.on(t,i,this)}off(t,e,n){if(!(t||e||n))return this.listeners={},this;const i=this.listeners,r=t?[t]:Object.keys(i);return r.forEach(t=>{const r=i[t];if(r)if(e||n)for(let i=r.length-2;i>=0;i-=2)e&&r[i]!==e||n&&r[i+1]!==n||r.splice(i,2);else delete i[t]}),this}trigger(t,...e){let n=!0;if("*"!==t){const i=this.listeners[t];null!=i&&(n=ht([...i],e))}const r=this.listeners["*"];return null!=r?i.toAsyncBoolean([n,ht([...r],[t,...e])]):n}emit(t,...e){return this.trigger(t,...e)}}var dt=Object.prototype,gt=dt.hasOwnProperty;function ft(t,e){return null!=t&&gt.call(t,e)}var pt=ft,mt=n("ff51"),yt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bt=/^\w*$/;function vt(t,e){if(Object(mt["a"])(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!G(t))||(bt.test(t)||!yt.test(t)||null!=e&&t in Object(e))}var xt=vt,wt=n("0e59"),Pt="Expected a function";function Ct(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Pt);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],s=n.cache;if(s.has(r))return s.get(r);var o=t.apply(this,i);return n.cache=s.set(r,o)||s,o};return n.cache=new(Ct.Cache||wt["a"]),n}Ct.Cache=wt["a"];var At=Ct,Ot=500;function Et(t){var e=At(t,(function(t){return n.size===Ot&&n.clear(),t})),n=e.cache;return e}var Mt=Et,St=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tt=/\\(\\)?/g,Nt=Mt((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(St,(function(t,n,i,r){e.push(i?r.replace(Tt,"$1"):n||t)})),e})),kt=Nt,jt=n("ca54");function Lt(t,e){var n=-1,i=null==t?0:t.length,r=Array(i);while(++n<i)r[n]=e(t[n],n,t);return r}var Bt=Lt,Dt=1/0,It=jt["a"]?jt["a"].prototype:void 0,Rt=It?It.toString:void 0;function Vt(t){if("string"==typeof t)return t;if(Object(mt["a"])(t))return Bt(t,Vt)+"";if(G(t))return Rt?Rt.call(t):"";var e=t+"";return"0"==e&&1/t==-Dt?"-0":e}var zt=Vt;function Ft(t){return null==t?"":zt(t)}var $t=Ft;function Gt(t,e){return Object(mt["a"])(t)?t:xt(t,e)?[t]:kt($t(t))}var qt=Gt,Ht=n("f5fe"),Ut=n("7129"),Wt=n("26ce"),Jt=1/0;function Xt(t){if("string"==typeof t||G(t))return t;var e=t+"";return"0"==e&&1/t==-Jt?"-0":e}var _t=Xt;function Yt(t,e,n){e=qt(e,t);var i=-1,r=e.length,s=!1;while(++i<r){var o=_t(e[i]);if(!(s=null!=t&&n(t,o)))break;t=t[o]}return s||++i!=r?s:(r=null==t?0:t.length,!!r&&Object(Wt["a"])(r)&&Object(Ut["a"])(o,r)&&(Object(mt["a"])(t)||Object(Ht["a"])(t)))}var Zt=Yt;function Kt(t,e){return null!=t&&Zt(t,e,pt)}var Qt=Kt;function te(t,e){e=qt(e,t);var n=0,i=e.length;while(null!=t&&n<i)t=t[_t(e[n++])];return n&&n==i?t:void 0}var ee=te,ne=n("db72");function ie(t,e,n,i){if(!Object(S["a"])(t))return t;e=qt(e,t);var r=-1,s=e.length,o=s-1,a=t;while(null!=a&&++r<s){var l=_t(e[r]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(r!=o){var h=a[l];c=i?i(h,l,a):void 0,void 0===c&&(c=Object(S["a"])(h)?h:Object(Ut["a"])(e[r+1])?[]:{})}Object(ne["a"])(a,l,c),a=a[l]}return t}var re=ie;function se(t,e,n){var i=-1,r=e.length,s={};while(++i<r){var o=e[i],a=ee(t,o);n(a,o)&&re(s,qt(o,t),a)}return s}var oe=se;function ae(t,e){return null!=t&&e in Object(t)}var le=ae;function ce(t,e){return null!=t&&Zt(t,e,le)}var he=ce;function ue(t,e){return oe(t,e,(function(e,n){return he(t,n)}))}var de=ue,ge=n("b4f1"),fe=jt["a"]?jt["a"].isConcatSpreadable:void 0;function pe(t){return Object(mt["a"])(t)||Object(Ht["a"])(t)||!!(fe&&t&&t[fe])}var me=pe;function ye(t,e,n,i,r){var s=-1,o=t.length;n||(n=me),r||(r=[]);while(++s<o){var a=t[s];e>0&&n(a)?e>1?ye(a,e-1,n,i,r):Object(ge["a"])(r,a):i||(r[r.length]=a)}return r}var be=ye;function ve(t){var e=null==t?0:t.length;return e?be(t,1):[]}var xe=ve,we=n("500e"),Pe=n("c619");function Ce(t){return Object(Pe["a"])(Object(we["a"])(t,void 0,xe),t+"")}var Ae=Ce,Oe=Ae((function(t,e){return null==t?{}:de(t,e)})),Ee=Oe,Me=n("a1a3"),Se=n("32e8"),Te=n("8cc4"),Ne=n("60ce"),ke=n("e56b"),je=n("58e0"),Le=n("a724"),Be=n("a187"),De="[object Map]",Ie="[object Set]",Re=Object.prototype,Ve=Re.hasOwnProperty;function ze(t){if(null==t)return!0;if(Object(ke["a"])(t)&&(Object(mt["a"])(t)||"string"==typeof t||"function"==typeof t.splice||Object(je["a"])(t)||Object(Be["a"])(t)||Object(Ht["a"])(t)))return!t.length;var e=Object(Ne["a"])(t);if(e==De||e==Ie)return!t.size;if(Object(Le["a"])(t))return!Object(Te["a"])(t).length;for(var n in t)if(Ve.call(t,n))return!1;return!0}var Fe=ze,$e=n("e8b2"),Ge=n("09f4"),qe=4;function He(t){return Object(Ge["a"])(t,qe)}var Ue=He,We=n("5c8a"),Je=n("2d5d"),Xe=n("6071"),_e=n("5c59"),Ye=n("e3fa"),Ze=Object.prototype,Ke=Ze.hasOwnProperty,Qe=Object(Je["a"])((function(t,e){t=Object(t);var n=-1,i=e.length,r=i>2?e[2]:void 0;r&&Object(_e["a"])(e[0],e[1],r)&&(i=1);while(++n<i){var s=e[n],o=Object(Ye["a"])(s),a=-1,l=o.length;while(++a<l){var c=o[a],h=t[c];(void 0===h||Object(Xe["a"])(h,Ze[c])&&!Ke.call(t,c))&&(t[c]=s[c])}}return t})),tn=Qe,en=n("b911"),nn=n("14ba");function rn(t,e,n,i,r,s){return Object(S["a"])(t)&&Object(S["a"])(e)&&(s.set(e,t),Object(nn["a"])(t,e,void 0,rn,s),s["delete"](e)),t}var sn=rn,on=n("92dd"),an=Object(on["a"])((function(t,e,n,i){Object(nn["a"])(t,e,n,i)})),ln=an,cn=Object(Je["a"])((function(t){return t.push(void 0,sn),Object(en["a"])(ln,void 0,t)})),hn=cn;function un(t,...e){e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{"constructor"!==n&&Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}const dn=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 gn(t,e){function n(){this.constructor=t}dn(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}class fn{}const pn=/^\s*class\s+/.test(""+fn)||/^\s*class\s*\{/.test(""+class{});function mn(t,e){let n;return pn?n=class extends e{}:(n=function(){return e.apply(this,arguments)},gn(n,e)),Object.defineProperty(n,"name",{value:t}),n}function yn(t,e){return null!=t?t:e}function bn(t,e,n){const i=null!=t?t[e]:null;return void 0!==n?yn(i,n):i}function vn(t,e,n){let i=null!=t?t[e]:null;return null==i?n:(i=+i,Number.isNaN(i)||!Number.isFinite(i)?n:i)}function xn(t,e,n){const i=null!=t?t[e]:null;return null==i?n:!!i}function wn(t){return"__proto__"===t}function Pn(t,e,n="/"){let i;const r=Array.isArray(e)?e:e.split(n);if(r.length){i=t;while(r.length){const t=r.shift();if(Object(i)!==i||!t||!(t in i))return;i=i[t]}}return i}function Cn(t,e,n,i="/"){const r=Array.isArray(e)?e:e.split(i),s=r.pop();if(s&&!wn(s)){let e=t;r.forEach(t=>{wn(t)||(null==e[t]&&(e[t]={}),e=e[t])}),e[s]=n}return t}function An(t,e,n="/"){const i=Array.isArray(e)?e.slice():e.split(n),r=i.pop();if(r)if(i.length>0){const e=Pn(t,i);e&&delete e[r]}else delete t[r];return t}function On(t,e="/",n){const i={};Object.keys(t).forEach(r=>{const s=t[r];let o="object"===typeof s||Array.isArray(s);if(o&&n&&n(s)&&(o=!1),o){const t=On(s,e,n);Object.keys(t).forEach(n=>{i[r+e+n]=t[n]})}else i[r]=s});for(const r in t)Object.prototype.hasOwnProperty.call(t,r);return i}var En=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Mn extends ut{dispose(){this.off()}}En([E.dispose()],Mn.prototype,"dispose",null),function(t){t.dispose=E.dispose}(Mn||(Mn={})),r.applyMixins(Mn,E);var Sn=n("9ac7");function Tn(t,e,n,i){var r=t.length,s=n+(i?1:-1);while(i?s--:++s<r)if(e(t[s],s,t))return s;return-1}var Nn=Tn;function kn(t){return t!==t}var jn=kn;function Ln(t,e,n){var i=n-1,r=t.length;while(++i<r)if(t[i]===e)return i;return-1}var Bn=Ln;function Dn(t,e,n){return e===e?Bn(t,e,n):Nn(t,jn,n)}var In=Dn;function Rn(t,e){var n=null==t?0:t.length;return!!n&&In(t,e,0)>-1}var Vn=Rn;function zn(t,e,n){var i=-1,r=null==t?0:t.length;while(++i<r)if(n(e,t[i]))return!0;return!1}var Fn=zn,$n=n("6568"),Gn=n("a55c");function qn(){}var Hn=qn,Un=n("1989"),Wn=1/0,Jn=Gn["a"]&&1/Object(Un["a"])(new Gn["a"]([,-0]))[1]==Wn?function(t){return new Gn["a"](t)}:Hn,Xn=Jn,_n=200;function Yn(t,e,n){var i=-1,r=Vn,s=t.length,o=!0,a=[],l=a;if(n)o=!1,r=Fn;else if(s>=_n){var c=e?null:Xn(t);if(c)return Object(Un["a"])(c);o=!1,r=$n["a"],l=new Sn["a"]}else l=e?[]:a;t:while(++i<s){var h=t[i],u=e?e(h):h;if(h=n||0!==h?h:0,o&&u===u){var d=l.length;while(d--)if(l[d]===u)continue t;e&&l.push(u),a.push(h)}else r(l,u,n)||(l!==a&&l.push(u),a.push(h))}return a}var Zn=Yn;function Kn(t){return t&&t.length?Zn(t):[]}var Qn=Kn,ti=n("010c"),ei=Object(Je["a"])((function(t){return Zn(be(t,1,ti["a"],!0))})),ni=ei,ii=4294967295,ri=ii-1,si=Math.floor,oi=Math.min;function ai(t,e,n,i){var r=0,s=null==t?0:t.length;if(0===s)return 0;e=n(e);var o=e!==e,a=null===e,l=G(e),c=void 0===e;while(r<s){var h=si((r+s)/2),u=n(t[h]),d=void 0!==u,g=null===u,f=u===u,p=G(u);if(o)var m=i||f;else m=c?f&&(i||d):a?f&&d&&(i||!g):l?f&&d&&!g&&(i||!p):!g&&!p&&(i?u<=e:u<e);m?r=h+1:s=h}return oi(s,ri)}var li=ai,ci=n("f976"),hi=4294967295,ui=hi>>>1;function di(t,e,n){var i=0,r=null==t?i:t.length;if("number"==typeof e&&e===e&&r<=ui){while(i<r){var s=i+r>>>1,o=t[s];null!==o&&!G(o)&&(n?o<=e:o<e)?i=s+1:r=s}return r}return li(t,e,ci["a"],n)}var gi=di;function fi(t,e){return gi(t,e)}var pi=fi,mi=n("a12c"),yi=n("12a1"),bi=1,vi=2;function xi(t,e,n,i){var r=n.length,s=r,o=!i;if(null==t)return!s;t=Object(t);while(r--){var a=n[r];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}while(++r<s){a=n[r];var l=a[0],c=t[l],h=a[1];if(o&&a[2]){if(void 0===c&&!(l in t))return!1}else{var u=new mi["a"];if(i)var d=i(c,h,l,t,e,u);if(!(void 0===d?Object(yi["a"])(h,c,bi|vi,i,u):d))return!1}}return!0}var wi=xi;function Pi(t){return t===t&&!Object(S["a"])(t)}var Ci=Pi,Ai=n("9a4b");function Oi(t){var e=Object(Ai["a"])(t),n=e.length;while(n--){var i=e[n],r=t[i];e[n]=[i,r,Ci(r)]}return e}var Ei=Oi;function Mi(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}var Si=Mi;function Ti(t){var e=Ei(t);return 1==e.length&&e[0][2]?Si(e[0][0],e[0][1]):function(n){return n===t||wi(n,t,e)}}var Ni=Ti;function ki(t,e,n){var i=null==t?void 0:ee(t,e);return void 0===i?n:i}var ji=ki,Li=1,Bi=2;function Di(t,e){return xt(t)&&Ci(e)?Si(_t(t),e):function(n){var i=ji(n,t);return void 0===i&&i===e?he(n,t):Object(yi["a"])(e,i,Li|Bi)}}var Ii=Di;function Ri(t){return function(e){return null==e?void 0:e[t]}}var Vi=Ri;function zi(t){return function(e){return ee(e,t)}}var Fi=zi;function $i(t){return xt(t)?Vi(_t(t)):Fi(t)}var Gi=$i;function qi(t){return"function"==typeof t?t:null==t?ci["a"]:"object"==typeof t?Object(mt["a"])(t)?Ii(t[0],t[1]):Ni(t):Gi(t)}var Hi=qi;function Ui(t,e,n){return li(t,e,Hi(n,2))}var Wi=Ui,Ji=n("6999");function Xi(t,e){return t&&Object(Ji["a"])(t,e,Ai["a"])}var _i=Xi;function Yi(t,e){return function(n,i){if(null==n)return n;if(!Object(ke["a"])(n))return t(n,i);var r=n.length,s=e?r:-1,o=Object(n);while(e?s--:++s<r)if(!1===i(o[s],s,o))break;return n}}var Zi=Yi,Ki=Zi(_i),Qi=Ki;function tr(t,e){var n=-1,i=Object(ke["a"])(t)?Array(t.length):[];return Qi(t,(function(t,r,s){i[++n]=e(t,r,s)})),i}var er=tr;function nr(t,e){var n=t.length;t.sort(e);while(n--)t[n]=t[n].value;return t}var ir=nr,rr=n("a2fb");function sr(t,e){if(t!==e){var n=void 0!==t,i=null===t,r=t===t,s=G(t),o=void 0!==e,a=null===e,l=e===e,c=G(e);if(!a&&!c&&!s&&t>e||s&&o&&l&&!a&&!c||i&&o&&l||!n&&l||!r)return 1;if(!i&&!s&&!c&&t<e||c&&n&&r&&!i&&!s||a&&n&&r||!o&&r||!l)return-1}return 0}var or=sr;function ar(t,e,n){var i=-1,r=t.criteria,s=e.criteria,o=r.length,a=n.length;while(++i<o){var l=or(r[i],s[i]);if(l){if(i>=a)return l;var c=n[i];return l*("desc"==c?-1:1)}}return t.index-e.index}var lr=ar;function cr(t,e,n){e=e.length?Bt(e,(function(t){return Object(mt["a"])(t)?function(e){return ee(e,1===t.length?t[0]:t)}:t})):[ci["a"]];var i=-1;e=Bt(e,Object(rr["a"])(Hi));var r=er(t,(function(t,n,r){var s=Bt(e,(function(e){return e(t)}));return{criteria:s,index:++i,value:t}}));return ir(r,(function(t,e){return lr(t,e,n)}))}var hr=cr,ur=Object(Je["a"])((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Object(_e["a"])(t,e[0],e[1])?e=[]:n>2&&Object(_e["a"])(e[0],e[1],e[2])&&(e=[e[0]]),hr(t,be(e,1),[])})),dr=ur,gr=n("b84d");function fr(t,e,n,i){var r=-1,s=null==t?0:t.length;while(++r<s){var o=t[r];e(i,o,n(o),t)}return i}var pr=fr;function mr(t,e,n,i){return Qi(t,(function(t,r,s){e(i,t,n(t),s)})),i}var yr=mr;function br(t,e){return function(n,i){var r=Object(mt["a"])(n)?pr:yr,s=e?e():{};return r(n,t,Hi(i,2),s)}}var vr=br,xr=Object.prototype,wr=xr.hasOwnProperty,Pr=vr((function(t,e,n){wr.call(t,n)?t[n].push(e):Object(gr["a"])(t,n,[e])})),Cr=Pr,Ar=200;function Or(t,e,n,i){var r=-1,s=Vn,o=!0,a=t.length,l=[],c=e.length;if(!a)return l;n&&(e=Bt(e,Object(rr["a"])(n))),i?(s=Fn,o=!1):e.length>=Ar&&(s=$n["a"],o=!1,e=new Sn["a"](e));t:while(++r<a){var h=t[r],u=null==n?h:n(h);if(h=i||0!==h?h:0,o&&u===u){var d=c;while(d--)if(e[d]===u)continue t;l.push(h)}else s(e,u,i)||l.push(h)}return l}var Er=Or,Mr=Object(Je["a"])((function(t,e){return Object(ti["a"])(t)?Er(t,be(e,1,ti["a"],!0)):[]})),Sr=Mr;function Tr(t,e,n){var i=-1,r=t.length;while(++i<r){var s=t[i],o=e(s);if(null!=o&&(void 0===a?o===o&&!G(o):n(o,a)))var a=o,l=s}return l}var Nr=Tr;function kr(t,e){return t>e}var jr=kr;function Lr(t){return t&&t.length?Nr(t,ci["a"],jr):void 0}var Br=Lr,Dr=0;function Ir(t){var e=++Dr;return $t(t)+e}var Rr=Ir;function Vr(t,e,n,i){var r=-1,s=null==t?0:t.length;i&&s&&(n=t[++r]);while(++r<s)n=e(n,t[r],r,t);return n}var zr=Vr;function Fr(t){return function(e){return null==t?void 0:t[e]}}var $r=Fr,Gr={"À":"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"},qr=$r(Gr),Hr=qr,Ur=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wr="\\u0300-\\u036f",Jr="\\ufe20-\\ufe2f",Xr="\\u20d0-\\u20ff",_r=Wr+Jr+Xr,Yr="["+_r+"]",Zr=RegExp(Yr,"g");function Kr(t){return t=$t(t),t&&t.replace(Ur,Hr).replace(Zr,"")}var Qr=Kr,ts=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function es(t){return t.match(ts)||[]}var ns=es,is=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function rs(t){return is.test(t)}var ss=rs,os="\\ud800-\\udfff",as="\\u0300-\\u036f",ls="\\ufe20-\\ufe2f",cs="\\u20d0-\\u20ff",hs=as+ls+cs,us="\\u2700-\\u27bf",ds="a-z\\xdf-\\xf6\\xf8-\\xff",gs="\\xac\\xb1\\xd7\\xf7",fs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ps="\\u2000-\\u206f",ms=" \\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",ys="A-Z\\xc0-\\xd6\\xd8-\\xde",bs="\\ufe0e\\ufe0f",vs=gs+fs+ps+ms,xs="['’]",ws="["+vs+"]",Ps="["+hs+"]",Cs="\\d+",As="["+us+"]",Os="["+ds+"]",Es="[^"+os+vs+Cs+us+ds+ys+"]",Ms="\\ud83c[\\udffb-\\udfff]",Ss="(?:"+Ps+"|"+Ms+")",Ts="[^"+os+"]",Ns="(?:\\ud83c[\\udde6-\\uddff]){2}",ks="[\\ud800-\\udbff][\\udc00-\\udfff]",js="["+ys+"]",Ls="\\u200d",Bs="(?:"+Os+"|"+Es+")",Ds="(?:"+js+"|"+Es+")",Is="(?:"+xs+"(?:d|ll|m|re|s|t|ve))?",Rs="(?:"+xs+"(?:D|LL|M|RE|S|T|VE))?",Vs=Ss+"?",zs="["+bs+"]?",Fs="(?:"+Ls+"(?:"+[Ts,Ns,ks].join("|")+")"+zs+Vs+")*",$s="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Gs="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qs=zs+Vs+Fs,Hs="(?:"+[As,Ns,ks].join("|")+")"+qs,Us=RegExp([js+"?"+Os+"+"+Is+"(?="+[ws,js,"$"].join("|")+")",Ds+"+"+Rs+"(?="+[ws,js+Bs,"$"].join("|")+")",js+"?"+Bs+"+"+Is,js+"+"+Rs,Gs,$s,Cs,Hs].join("|"),"g");function Ws(t){return t.match(Us)||[]}var Js=Ws;function Xs(t,e,n){return t=$t(t),e=n?void 0:e,void 0===e?ss(t)?Js(t):ns(t):t.match(e)||[]}var _s=Xs,Ys="['’]",Zs=RegExp(Ys,"g");function Ks(t){return function(e){return zr(_s(Qr(e).replace(Zs,"")),t,"")}}var Qs=Ks;function to(t,e,n){var i=-1,r=t.length;e<0&&(e=-e>r?0:r+e),n=n>r?r:n,n<0&&(n+=r),r=e>n?0:n-e>>>0,e>>>=0;var s=Array(r);while(++i<r)s[i]=t[i+e];return s}var eo=to;function no(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:eo(t,e,n)}var io=no,ro="\\ud800-\\udfff",so="\\u0300-\\u036f",oo="\\ufe20-\\ufe2f",ao="\\u20d0-\\u20ff",lo=so+oo+ao,co="\\ufe0e\\ufe0f",ho="\\u200d",uo=RegExp("["+ho+ro+lo+co+"]");function go(t){return uo.test(t)}var fo=go;function po(t){return t.split("")}var mo=po,yo="\\ud800-\\udfff",bo="\\u0300-\\u036f",vo="\\ufe20-\\ufe2f",xo="\\u20d0-\\u20ff",wo=bo+vo+xo,Po="\\ufe0e\\ufe0f",Co="["+yo+"]",Ao="["+wo+"]",Oo="\\ud83c[\\udffb-\\udfff]",Eo="(?:"+Ao+"|"+Oo+")",Mo="[^"+yo+"]",So="(?:\\ud83c[\\udde6-\\uddff]){2}",To="[\\ud800-\\udbff][\\udc00-\\udfff]",No="\\u200d",ko=Eo+"?",jo="["+Po+"]?",Lo="(?:"+No+"(?:"+[Mo,So,To].join("|")+")"+jo+ko+")*",Bo=jo+ko+Lo,Do="(?:"+[Mo+Ao+"?",Ao,So,To,Co].join("|")+")",Io=RegExp(Oo+"(?="+Oo+")|"+Do+Bo,"g");function Ro(t){return t.match(Io)||[]}var Vo=Ro;function zo(t){return fo(t)?Vo(t):mo(t)}var Fo=zo;function $o(t){return function(e){e=$t(e);var n=fo(e)?Fo(e):void 0,i=n?n[0]:e.charAt(0),r=n?io(n,1).join(""):e.slice(1);return i[t]()+r}}var Go=$o,qo=Go("toUpperCase"),Ho=qo,Uo=Qs((function(t,e,n){return t+(n?" ":"")+Ho(e)})),Wo=Uo;function Jo(t){return Ho($t(t).toLowerCase())}var Xo=Jo,_o=Qs((function(t,e,n){return e=e.toLowerCase(),t+(n?Xo(e):e)})),Yo=_o,Zo=Qs((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ko=Zo,Qo=Qs((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),ta=Qo,ea=Go("toLowerCase"),na=ea;const ia=t=>{const e=Object.create(null);return n=>{const i=e[n];return i||(e[n]=t(n))}},ra=ia(t=>t.replace(/\B([A-Z])/g,"-$1").toLowerCase()),sa=ia(t=>Wo(Yo(t)).replace(/ /g,"")),oa=ia(t=>Ko(t).replace(/ /g,"_")),aa=ia(t=>ta(t).replace(/ /g,".")),la=ia(t=>ta(t).replace(/ /g,"/")),ca=ia(t=>Ho(ta(t))),ha=ia(t=>Wo(Yo(t)));function ua(t){let e=2166136261,n=!1,i=t;for(let r=0,s=i.length;r<s;r+=1){let t=i.charCodeAt(r);t>127&&!n&&(i=unescape(encodeURIComponent(i)),t=i.charCodeAt(r),n=!0),e^=t,e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}return e>>>0}function da(){let t="";const e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let n=0,i=e.length;n<i;n+=1){const i=e[n],r=16*Math.random()|0,s="x"===i?r:"y"===i?3&r|8:i;t+=s.toString(16)}return t}function ga(t,e,n){const i=Math.min(2,Math.floor(.34*t.length));let r,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)<=i){const n=e.toLowerCase();if(n===a){if(e===t)continue;return l}if(o)continue;if(e.length<3)continue;const i=fa(a,n,s-1);if(void 0===i)continue;i<3?(o=!0,r=l):(s=i,r=l)}}return r}function fa(t,e,n){let i=new Array(e.length+1),r=new Array(e.length+1);const s=n+1;for(let a=0;a<=e.length;a+=1)i[a]=a;for(let a=1;a<=t.length;a+=1){const o=t.charCodeAt(a-1),l=a>n?a-n:1,c=e.length>n+a?n+a:e.length;r[0]=a;let h=a;for(let t=1;t<l;t+=1)r[t]=s;for(let t=l;t<=c;t+=1){const n=o===e.charCodeAt(t-1)?i[t-1]:Math.min(i[t]+1,r[t-1]+1,i[t-1]+2);r[t]=n,h=Math.min(h,n)}for(let t=c+1;t<=e.length;t+=1)r[t]=s;if(h>n)return;const u=i;i=r,r=u}const o=i[e.length];return o>n?void 0:o}var pa="[object Number]";function ma(t){return"number"==typeof t||Object(z["a"])(t)&&Object(V["a"])(t)==pa}var ya=ma;function ba(t,e,n){return t===t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}var va=ba;function xa(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=_(n),n=n===n?n:0),void 0!==e&&(e=_(e),e=e===e?e:0),va(_(t),e,n)}var wa=xa;function Pa(t,e){return(t%e+e)%e}function Ca(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)}function Aa(t){return"string"===typeof t&&"%"===t.slice(-1)}function Oa(t,e){if(null==t)return 0;let n;if("string"===typeof t){if(n=parseFloat(t),Aa(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 Ea(t,e){function n(e){const n=new RegExp(`(?:\\d+(?:\\.\\d+)*)(${e})$`).exec(t);return n?n[1]:null}const i=parseFloat(t);if(Number.isNaN(i))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 s=n(r);return null===s?null:{unit:s,value:i}}function Ma(t){if("object"===typeof t){let e=0,n=0,i=0,r=0;return null!=t.vertical&&Number.isFinite(t.vertical)&&(n=r=t.vertical),null!=t.horizontal&&Number.isFinite(t.horizontal)&&(i=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)&&(i=t.right),null!=t.bottom&&Number.isFinite(t.bottom)&&(r=t.bottom),{top:n,right:i,bottom:r,left:e}}let e=0;return null!=t&&Number.isFinite(t)&&(e=t),{top:e,right:e,bottom:e,left:e}}let Sa=!1,Ta=!1,Na=!1,ka=!1,ja=!1,La=!1,Ba=!1,Da=!1,Ia=!1,Ra=!1,Va=!1,za=!1,Fa=!1,$a=!1,Ga=!1,qa=!1;if("object"===typeof navigator){const t=navigator.userAgent;Sa=t.indexOf("Macintosh")>=0,Ta=!!t.match(/(iPad|iPhone|iPod)/g),Na=t.indexOf("Windows")>=0,ka=t.indexOf("MSIE")>=0,ja=!!t.match(/Trident\/7\./),La=!!t.match(/Edge\//),Ba=t.indexOf("Mozilla/")>=0&&t.indexOf("MSIE")<0&&t.indexOf("Edge/")<0,Ia=t.indexOf("Chrome/")>=0&&t.indexOf("Edge/")<0,Ra=t.indexOf("Opera/")>=0||t.indexOf("OPR/")>=0,Va=t.indexOf("Firefox/")>=0,za=t.indexOf("AppleWebKit/")>=0&&t.indexOf("Chrome/")<0&&t.indexOf("Edge/")<0,"object"===typeof document&&(qa=!document.createElementNS||""+document.createElementNS("http://www.w3.org/2000/svg","foreignObject")!=="[object SVGForeignObjectElement]"||t.indexOf("Opera/")>=0)}if("object"===typeof window&&(Da=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,$a=null!=window.PointerEvent&&!Sa),"object"===typeof document){Fa="ontouchstart"in document.documentElement;try{const t=Object.defineProperty({},"passive",{get(){Ga=!0}}),e=document.createElement("div");e.addEventListener&&e.addEventListener("click",()=>{},t)}catch(Yy){}}var Ha;(function(t){t.IS_MAC=Sa,t.IS_IOS=Ta,t.IS_WINDOWS=Na,t.IS_IE=ka,t.IS_IE11=ja,t.IS_EDGE=La,t.IS_NETSCAPE=Ba,t.IS_CHROME_APP=Da,t.IS_CHROME=Ia,t.IS_OPERA=Ra,t.IS_FIREFOX=Va,t.IS_SAFARI=za,t.SUPPORT_TOUCH=Fa,t.SUPPORT_POINTER=$a,t.SUPPORT_PASSIVE=Ga,t.NO_FOREIGNOBJECT=qa,t.SUPPORT_FOREIGNOBJECT=!t.NO_FOREIGNOBJECT})(Ha||(Ha={})),function(t){function e(){const t=window.module;return null!=t&&null!=t.hot&&null!=t.hot.status?t.hot.status():"unkonwn"}function n(){return"apply"===e()}t.getHMRStatus=e,t.isApplyingHMR=n;const i={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};function r(t){const e=document.createElement(i[t]||"div"),n="on"+t;let r=n in e;return r||(e.setAttribute(n,"return;"),r="function"===typeof e[n]),r}t.isEventSupported=r}(Ha||(Ha={}));const Ua=/[\t\r\n\f]/g,Wa=/\S+/g,Ja=t=>` ${t} `;function Xa(t){return t&&t.getAttribute&&t.getAttribute("class")||""}function _a(t,e){if(null==t||null==e)return!1;const n=Ja(Xa(t)),i=Ja(e);return 1===t.nodeType&&n.replace(Ua," ").includes(i)}function Ya(t,e){if(null!=t&&null!=e){if("function"===typeof e)return Ya(t,e(Xa(t)));if("string"===typeof e&&1===t.nodeType){const n=e.match(Wa)||[],i=Ja(Xa(t)).replace(Ua," ");let r=n.reduce((t,e)=>t.indexOf(Ja(e))<0?`${t}${e} `:t,i);r=r.trim(),i!==r&&t.setAttribute("class",r)}}}function Za(t,e){if(null!=t){if("function"===typeof e)return Za(t,e(Xa(t)));if((!e||"string"===typeof e)&&1===t.nodeType){const n=(e||"").match(Wa)||[],i=Ja(Xa(t)).replace(Ua," ");let r=n.reduce((t,e)=>{const n=Ja(e);return t.indexOf(n)>-1?t.replace(n," "):t},i);r=e?r.trim():"",i!==r&&t.setAttribute("class",r)}}}function Ka(t,e,n){if(null!=t&&null!=e)if(null==n||"string"!==typeof e){if("function"===typeof e)return Ka(t,e(Xa(t),n),n);if("string"===typeof e){const n=e.match(Wa)||[];n.forEach(e=>{_a(t,e)?Za(t,e):Ya(t,e)})}}else n?Ya(t,e):Za(t,e)}let Qa=0;function tl(){return Qa+=1,"v"+Qa}function el(t){return null!=t.id&&""!==t.id||(t.id=tl()),t.id}function nl(t){return null!=t&&("function"===typeof t.getScreenCTM&&t instanceof SVGElement)}const il={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"},rl="1.1";function sl(t,e=document){return e.createElement(t)}function ol(t,e=il.xhtml,n=document){return n.createElementNS(e,t)}function al(t,e=document){return ol(t,il.svg,e)}function ll(t){if(t){const e=`<svg xmlns="${il.svg}" xmlns:xlink="${il.xlink}" version="${rl}">${t}</svg>`,{documentElement:n}=cl(e,{async:!1});return n}const e=document.createElementNS(il.svg,"svg");return e.setAttributeNS(il.xmlns,"xmlns:xlink",il.xlink),e.setAttribute("version",rl),e}function cl(t,e={}){let n;try{const i=new DOMParser;if(null!=e.async){const t=i;t.async=e.async}n=i.parseFromString(t,e.mimeType||"text/xml")}catch(i){n=void 0}if(!n||n.getElementsByTagName("parsererror").length)throw new Error("Invalid XML: "+t);return n}function hl(t,e=!0){const n=t.nodeName;return e?n.toLowerCase():n.toUpperCase()}function ul(t){let e=0,n=t.previousSibling;while(n)1===n.nodeType&&(e+=1),n=n.previousSibling;return e}function dl(t,e){return t.querySelectorAll(e)}function gl(t,e){return t.querySelector(e)}function fl(t,e,n){const i=t.ownerSVGElement;let r=t.parentNode;while(r&&r!==n&&r!==i){if(_a(r,e))return r;r=r.parentNode}return null}function pl(t,e){const n=e&&e.parentNode;return t===n||!!(n&&1===n.nodeType&&16&t.compareDocumentPosition(n))}function ml(t){if(t){const e=Array.isArray(t)?t:[t];e.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)})}}function yl(t){while(t.firstChild)t.removeChild(t.firstChild)}function bl(t,e){const n=Array.isArray(e)?e:[e];n.forEach(e=>{null!=e&&t.appendChild(e)})}function vl(t,e){const n=t.firstChild;return n?xl(n,e):bl(t,e)}function xl(t,e){const n=t.parentNode;if(n){const i=Array.isArray(e)?e:[e];i.forEach(e=>{null!=e&&n.insertBefore(e,t)})}}function wl(t,e){const n=t.parentNode;if(n){const i=Array.isArray(e)?e:[e];i.forEach(e=>{null!=e&&n.insertBefore(e,t.nextSibling)})}}function Pl(t,e){null!=e&&e.appendChild(t)}function Cl(t){return!!t&&1===t.nodeType}function Al(t){try{return t instanceof HTMLElement}catch(e){return"object"===typeof t&&1===t.nodeType&&"object"===typeof t.style&&"object"===typeof t.ownerDocument}}function Ol(t,e){const n=[];let i=t.firstChild;for(;i;i=i.nextSibling)1===i.nodeType&&(e&&!_a(i,e)||n.push(i));return n}const El=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function Ml(t,e){return t.getAttribute(e)}function Sl(t,e){const n=jl(e);n.ns?t.hasAttributeNS(n.ns,n.local)&&t.removeAttributeNS(n.ns,n.local):t.hasAttribute(e)&&t.removeAttribute(e)}function Tl(t,e,n){if(null==n)return Sl(t,e);const i=jl(e);i.ns&&"string"===typeof n?t.setAttributeNS(i.ns,e,n):"id"===e?t.id=""+n:t.setAttribute(e,""+n)}function Nl(t,e){Object.keys(e).forEach(n=>{Tl(t,n,e[n])})}function kl(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?Nl(t,e):Tl(t,e,n)}function jl(t){if(-1!==t.indexOf(":")){const e=t.split(":");return{ns:il[e[0]],local:e[1]}}return{ns:null,local:t}}function Ll(t){const e={};return Object.keys(t).forEach(n=>{const i=El.includes(n)?n:ra(n);e[i]=t[n]}),e}function Bl(t){const e={},n=t.split(";");return n.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 Dl(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 i="object"===typeof t[n],r="object"===typeof e[n];let s,o;i&&r?(s=t[n],o=e[n]):i?(s=t[n],o=Bl(e[n])):r?(s=Bl(t[n]),o=e[n]):(s=Bl(t[n]),o=Bl(e[n])),t[n]=Dl(s,o)}else t[n]=e[n]}),t}function Il(t,e,n={}){const i=n.offset||0,s=[],o=[];let a,l,c=null;for(let h=0;h<t.length;h+=1){a=o[h]=t[h];for(let r=0,s=e.length;r<s;r+=1){const s=e[r],l=s.start+i,c=s.end+i;h>=l&&h<c&&("string"===typeof a?a=o[h]={t:t[h],attrs:s.attrs}:a.attrs=Dl(Dl({},a.attrs),s.attrs),n.includeAnnotationIndices&&(null==a.annotations&&(a.annotations=[]),a.annotations.push(r)))}l=o[h-1],l?r.isObject(a)&&r.isObject(l)?(c=c,JSON.stringify(a.attrs)===JSON.stringify(l.attrs)?c.t+=a.t:(s.push(c),c=a)):r.isObject(a)||r.isObject(l)?(c=c,s.push(c),c=a):c=(c||"")+a:c=a}return null!=c&&s.push(c),s}function Rl(t,e){return t?t.filter(t=>t.start<e&&e<=t.end):[]}function Vl(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):[]}function zl(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}function Fl(t){return t.replace(/ /g," ")}var $l;let Gl;(function(t){function e(t){const e="data:";return t.substr(0,e.length)===e}function n(t,n){if(!t||e(t))return void setTimeout(()=>n(null,t));const i=()=>{n(new Error("Failed to load image: "+t))},r=window.FileReader?t=>{if(200===t.status){const e=new FileReader;e.onload=t=>{const e=t.target.result;n(null,e)},e.onerror=i,e.readAsDataURL(t.response)}else i()}:e=>{const r=t=>{const e=32768,n=[];for(let i=0;i<t.length;i+=e)n.push(String.fromCharCode.apply(null,t.subarray(i,i+e)));return n.join("")};if(200===e.status){let i=t.split(".").pop()||"png";"svg"===i&&(i="svg+xml");const s=`data:image/${i};base64,`,o=new Uint8Array(e.response),a=s+btoa(r(o));n(null,a)}else i()},s=new XMLHttpRequest;s.responseType=window.FileReader?"blob":"arraybuffer",s.open("GET",t,!0),s.addEventListener("error",i),s.addEventListener("load",()=>r(s)),s.send()}function i(t){let e=t.replace(/\s/g,"");e=decodeURIComponent(e);const n=e.indexOf(","),i=e.slice(0,n),r=i.split(":")[1].split(";")[0],s=e.slice(n+1);let o;o=i.indexOf("base64")>=0?atob(s):unescape(encodeURIComponent(s));const a=new Uint8Array(o.length);for(let l=0;l<o.length;l+=1)a[l]=o.charCodeAt(l);return new Blob([a],{type:r})}function r(t,e){const n=window.navigator.msSaveBlob;if(n)n(t,e);else{const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n)}}function s(t,e){const n=i(t);r(n,e)}function o(t){const e=t.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return e&&e[2]?e[2].replace(/\s+/," ").split(" "):null}function a(t){const e=parseFloat(t);return Number.isNaN(e)?null:e}function l(t,e={}){let n=null;const i=e=>(null==n&&(n=o(t)),null!=n?a(n[e]):null),r=e=>{const n=t.match(e);return n&&n[2]?a(n[2]):null};let s=e.width;if(null==s&&(s=r(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==s&&(s=i(2)),null==s)throw new Error("Can not parse width from svg string");let l=e.height;if(null==l&&(l=r(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==l&&(l=i(3)),null==l)throw new Error("Can not parse height from svg string");const c=encodeURIComponent(t).replace(/'/g,"%27").replace(/"/g,"%22"),h="data:image/svg+xml",u=`${h},${c}`;return u}t.isDataUrl=e,t.imageToDataUri=n,t.dataUriToBlob=i,t.downloadBlob=r,t.downloadDataUri=s,t.svgToDataUrl=l})($l||($l={}));const ql={px(t){return t},mm(t){return Gl*t},cm(t){return Gl*t*10},in(t){return Gl*t*25.4},pt(t){return Gl*(25.4*t/72)},pc(t){return Gl*(25.4*t/6)}};var Hl;(function(t){function e(t,e,n){const i=document.createElement("div"),r=i.style;r.display="inline-block",r.position="absolute",r.left="-15000px",r.top="-15000px",r.width=t+(n||"px"),r.height=e+(n||"px"),document.body.appendChild(i);const s=i.getBoundingClientRect(),o={width:s.width||0,height:s.height||0};return document.body.removeChild(i),o}function n(t,n){null==Gl&&(Gl=e("1","1","mm").width);const i=n?ql[n]:null;return i?i(t):t}t.measure=e,t.toPx=n})(Hl||(Hl={}));const Ul=/-(.)/g;function Wl(t){return t.replace(Ul,(t,e)=>e.toUpperCase())}const Jl={},Xl=["webkit","ms","moz","o"],_l="undefined"!==typeof document?document.createElement("div").style:{};function Yl(t){for(let e=0;e<Xl.length;e+=1){const n=Xl[e]+t;if(n in _l)return n}return null}function Zl(t){const e=Wl(t);if(null==Jl[e]){const t=e.charAt(0).toUpperCase()+e.slice(1);Jl[e]=e in _l?e:Yl(t)}return Jl[e]}function Kl(t,e,n){const i=Zl(e);null!=i&&(t[i]=n),t[e]=n}function Ql(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}function tc(t){const e=Ql(t);return null!=e&&("scroll"===e.overflow||"auto"===e.overflow)}const ec=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(){}}(),nc={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 ic(t){return/^--/.test(t)}function rc(t,e,n){const i=window.getComputedStyle(t,null);return n?i.getPropertyValue(e)||void 0:i[e]||t.style[e]}function sc(t,e){return parseInt(rc(t,e),10)||0}function oc(t,e){return nc[t]||"number"!==typeof e?e:e+"px"}function ac(t,e,n){if("string"!==typeof e)for(const i in e)ac(t,i,e[i]);else{const i=ic(e);if(i||(e=Zl(e)),void 0===n)return rc(t,e,i);i||(n=oc(e,n));const r=t.style;i?r.setProperty(e,n):r[e]=n}}const lc=new WeakMap;function cc(t,e){const n=o.camelCase(e),i=lc.get(t);if(i)return i[n]}function hc(t,e,n){const i=o.camelCase(e),r=lc.get(t);r?r[i]=n:lc.set(t,{[i]:n})}function uc(t,e,n){if(!e){const e={};return Object.keys(lc).forEach(n=>{e[n]=cc(t,n)}),e}if("string"===typeof e)return void 0===n?cc(t,e):void hc(t,e,n);for(const i in e)uc(t,i,e[i])}const dc={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function gc(t,e,n){if(e){if("string"===typeof e)return e=dc[e]||e,arguments.length<3?t[e]:void(t[e]=n);for(const n in e)gc(t,n,e[n])}}class fc{get[Symbol.toStringTag](){return fc.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 i;if(fc.isVector(t))i=t.node;else if("string"===typeof t)if("svg"===t.toLowerCase())i=ll();else if("<"===t[0]){const e=ll(t);i=document.importNode(e.firstChild,!0)}else i=document.createElementNS(il.svg,t);else i=t;this.node=i,e&&this.setAttributes(e),n&&this.append(n)}transform(t,e){return null==t?Qc(this.node):(Qc(this.node,t,e),this)}translate(t,e=0,n={}){return null==t?th(this.node):(th(this.node,t,e,n),this)}rotate(t,e,n,i={}){return null==t?eh(this.node):(eh(this.node,t,e,n,i),this)}scale(t,e){return null==t?nh(this.node):(nh(this.node,t,e),this)}getTransformToElement(t){const e=fc.toNode(t);return ih(this.node,e)}removeAttribute(t){return Sl(this.node,t),this}getAttribute(t){return Ml(this.node,t)}setAttribute(t,e){return Tl(this.node,t,e),this}setAttributes(t){return Nl(this.node,t),this}attr(t,e){return null==t?kl(this.node):"string"===typeof t&&void 0===e?kl(this.node,t):("object"===typeof t?kl(this.node,t):kl(this.node,t,e),this)}svg(){return this.node instanceof SVGSVGElement?this:fc.create(this.node.ownerSVGElement)}defs(){const t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?fc.create(e):fc.create("defs").appendTo(t)}text(t,e={}){return xc(this.node,t,e),this}tagName(){return hl(this.node)}clone(){return fc.create(this.node.cloneNode(!0))}remove(){return ml(this.node),this}empty(){return yl(this.node),this}append(t){return bl(this.node,fc.toNodes(t)),this}appendTo(t){return Pl(this.node,fc.isVector(t)?t.node:t),this}prepend(t){return vl(this.node,fc.toNodes(t)),this}before(t){return xl(this.node,fc.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(fc.toNode(t),this.node),fc.create(t)}first(){return this.node.firstChild?fc.create(this.node.firstChild):null}last(){return this.node.lastChild?fc.create(this.node.lastChild):null}get(t){const e=this.node.childNodes[t];return e?fc.create(e):null}indexOf(t){const e=Array.prototype.slice.call(this.node.childNodes);return e.indexOf(fc.toNode(t))}find(t){const e=[],n=dl(this.node,t);if(n)for(let i=0,r=n.length;i<r;i+=1)e.push(fc.create(n[i]));return e}findOne(t){const e=gl(this.node,t);return e?fc.create(e):null}findParentByClass(t,e){const n=fl(this.node,t,e);return n?fc.create(n):null}matches(t){const e=this.node,n=(this.node.matches,e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null);return n&&n.call(e,t)}contains(t){return pl(this.node,fc.isVector(t)?t.node:t)}wrap(t){const e=fc.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=fc.create(e.node.parentNode),null==t)return e;do{if("string"===typeof t?e.matches(t):e instanceof t)return e}while(e=fc.create(e.node.parentNode));return e}children(){const t=this.node.childNodes,e=[];for(let n=0;n<t.length;n+=1){const i=t[n];1===i.nodeType&&e.push(fc.create(t[n]))}return e}eachChild(t,e){const n=this.children();for(let i=0,r=n.length;i<r;i+=1)t.call(n[i],n[i],i,n),e&&n[i].eachChild(t,e);return this}index(){return ul(this.node)}hasClass(t){return _a(this.node,t)}addClass(t){return Ya(this.node,t),this}removeClass(t){return Za(this.node,t),this}toggleClass(t,e){return Ka(this.node,t,e),this}toLocalPoint(t,e){return sh(this.node,t,e)}sample(t=1){return this.node instanceof SVGPathElement?Ec(this.node,t):[]}toPath(){return fc.create(Ic(this.node))}toPathData(){return Rc(this.node)}}function pc(t,e){const n=fc.create(e),i=fc.create("textPath"),r=t.d;if(r&&void 0===t["xlink:href"]){const t=fc.create("path").attr("d",r).appendTo(n.defs());i.attr("xlink:href","#"+t.id)}return"object"===typeof t&&i.attr(t),i.node}function mc(t,e,n){const i=n.eol,r=n.baseSize,s=n.lineHeight;let o,a=0;const l={},c=e.length-1;for(let h=0;h<=c;h+=1){let s=e[h],l=null;if("object"===typeof s){const t=s.attrs,e=fc.create("tspan",t);o=e.node;let u=s.t;i&&h===c&&(u+=i),o.textContent=u;const d=t.class;d&&e.addClass(d),n.includeAnnotationIndices&&e.attr("annotations",s.annotations.join(",")),l=parseFloat(t["font-size"]),void 0===l&&(l=r),l&&l>a&&(a=l)}else i&&h===c&&(s+=i),o=document.createTextNode(s||" "),r&&r>a&&(a=r);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],i=e;return(null==n||n===t.toStringTag)&&i.node instanceof SVGElement&&"function"===typeof i.sample&&"function"===typeof i.toPath}function n(e,n,i){return new t(e,n,i)}function i(t){if("<"===t[0]){const e=ll(t),i=[];for(let t=0,r=e.childNodes.length;t<r;t+=1){const r=e.childNodes[t];i.push(n(document.importNode(r,!0)))}return i}return[n(t)]}function r(t){return e(t)?t.node:t}function s(t){return Array.isArray(t)?t.map(t=>r(t)):[r(t)]}t.toStringTag="X6."+t.name,t.isVector=e,t.create=n,t.createVectors=i,t.toNode=r,t.toNodes=s})(fc||(fc={}));const yc=/em$/;function bc(t,e){const n=parseFloat(t);return yc.test(t)?n*e:n}function vc(t,e,n,i){if(!Array.isArray(e))return 0;const r=e.length;if(!r)return 0;let s=e[0];const o=bc(s.maxFontSize,n)||n;let a=0;const l=bc(i,n);for(let u=1;u<r;u+=1){s=e[u];const t=bc(s.lineHeight,n)||l;a+=t}const c=bc(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;case"top":default:h=.8*o;break}return h}function xc(t,e,n={}){e=l.sanitize(e);const i=n.eol;let r=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 c=n.includeAnnotationIndices;let h=n.annotations;h&&!Array.isArray(h)&&(h=[h]);const u=n.lineHeight,d="auto"===u,g=d?"1.5em":u||"1em";let f=!0;const p=t.childNodes;if(1===p.length){const t=p[0];t&&"TITLE"===t.tagName.toUpperCase()&&(f=!1)}f&&yl(t),kl(t,{"xml:space":"preserve",display:e||n.displayEmpty?null:"none"});const m=kl(t,"font-size");let y,b,v=parseFloat(m);v||(v=16,!o&&!h||m||kl(t,"font-size",""+v)),r?("string"===typeof r&&(r={d:r}),y=pc(r,t)):y=document.createDocumentFragment();let x,w=0;const P=e.split("\n"),C=[],A=P.length-1;for(let E=0;E<=A;E+=1){b=g;let t="v-line";const e=al("tspan");let n,s=P[E];if(s)if(h){const t=l.annotate(s,h,{offset:-w,includeAnnotationIndices:c});n=mc(e,t,{eol:E!==A&&i,baseSize:v,lineHeight:d?null:g,includeAnnotationIndices:c});const r=n.lineHeight;r&&d&&0!==E&&(b=r),0===E&&(x=.8*n.maxFontSize)}else i&&E!==A&&(s+=i),e.textContent=s;else{e.textContent="-",t+=" v-empty-line";const i=e.style;i.fillOpacity=0,i.strokeOpacity=0,h&&(n={})}n&&C.push(n),E>0&&e.setAttribute("dy",b),(E>0||r)&&e.setAttribute("x",a),e.className.baseVal=t,y.appendChild(e),w+=s.length+1}if(o)if(h)b=vc(s,C,v,g);else if("top"===s)b="0.8em";else{let t;switch(A>0?(t=parseFloat(g)||1,t*=A,yc.test(g)||(t/=v)):t=0,s){case"middle":b=.3-t/2+"em";break;case"bottom":b=-t-.3+"em";break;default:break}}else 0===s?b="0em":s?b=s:(b=0,null==t.getAttribute("y")&&t.setAttribute("y",""+(x||"0.8em")));const O=y.firstChild;O.setAttribute("dy",b),t.appendChild(y)}function wc(t,e={}){const n=document.createElement("canvas").getContext("2d");if(!t)return{width:0};const i=[],r=e["font-size"]?parseFloat(e["font-size"])+"px":"14px";return i.push(e["font-style"]||"normal"),i.push(e["font-variant"]||"normal"),i.push(e["font-weight"]||400),i.push(r),i.push(e["font-family"]||"sans-serif"),n.font=i.join(" "),n.measureText(t)}function Pc(t,e,n,i={}){if(e>=n)return[t,""];const r=t.length,s={};let o=Math.round(e/n*r-1);o<0&&(o=0);while(o>=0&&o<r){const n=t.slice(0,o),r=s[n]||wc(n,i).width,a=t.slice(0,o+1),l=s[a]||wc(a,i).width;if(s[n]=r,s[a]=l,r>e)o-=1;else{if(!(l<=e))break;o+=1}}return[t.slice(0,o),t.slice(o)]}function Cc(t,e,n={},i={}){const r=e.width,s=e.height,a=i.eol||"\n",l=n.fontSize||14,c=n.lineHeight?parseFloat(n.lineHeight):Math.ceil(1.4*l),h=Math.floor(s/c);if(t.indexOf(a)>-1){const r=o.uuid(),s=[];return t.split(a).map(t=>{const o=Cc(t,Object.assign(Object.assign({},e),{height:Number.MAX_SAFE_INTEGER}),n,Object.assign(Object.assign({},i),{eol:r}));o&&s.push(...o.split(r))}),s.slice(0,h).join(a)}const{width:u}=wc(t,n);if(u<r)return t;const d=[];let g=t,f=u,p=i.ellipsis,m=0;p&&("string"!==typeof p&&(p="…"),m=wc(p,n).width);for(let o=0;o<h;o+=1){if(!(f>r)){d.push(g);break}{const t=o===h-1;if(t){const[t]=Pc(g,r-m,f,n);d.push(p?`${t}${p}`:t)}else{const[t,e]=Pc(g,r,f,n);d.push(t),g=e,f=wc(g,n).width}}}return d.join(a)}const Ac=.551784;function Oc(t,e,n=NaN){const i=t.getAttribute(e);if(null==i)return n;const r=parseFloat(i);return Number.isNaN(r)?n:r}function Ec(t,e=1){const n=t.getTotalLength(),i=[];let r,s=0;while(s<n)r=t.getPointAtLength(s),i.push({distance:s,x:r.x,y:r.y}),s+=e;return i}function Mc(t){return["M",Oc(t,"x1"),Oc(t,"y1"),"L",Oc(t,"x2"),Oc(t,"y2")].join(" ")}function Sc(t){const e=kc(t);return 0===e.length?null:Nc(e)+" Z"}function Tc(t){const e=kc(t);return 0===e.length?null:Nc(e)}function Nc(t){const e=t.map(t=>`${t.x} ${t.y}`);return"M "+e.join(" L")}function kc(t){const e=[],n=t.points;if(n)for(let i=0,r=n.numberOfItems;i<r;i+=1)e.push(n.getItem(i));return e}function jc(t){const e=Oc(t,"cx",0),n=Oc(t,"cy",0),i=Oc(t,"r"),r=i*Ac;return["M",e,n-i,"C",e+r,n-i,e+i,n-r,e+i,n,"C",e+i,n+r,e+r,n+i,e,n+i,"C",e-r,n+i,e-i,n+r,e-i,n,"C",e-i,n-r,e-r,n-i,e,n-i,"Z"].join(" ")}function Lc(t){const e=Oc(t,"cx",0),n=Oc(t,"cy",0),i=Oc(t,"rx"),r=Oc(t,"ry")||i,s=i*Ac,o=r*Ac,a=["M",e,n-r,"C",e+s,n-r,e+i,n-o,e+i,n,"C",e+i,n+o,e+s,n+r,e,n+r,"C",e-s,n+r,e-i,n+o,e-i,n,"C",e-i,n-o,e-s,n-r,e,n-r,"Z"].join(" ");return a}function Bc(t){return Dc({x:Oc(t,"x",0),y:Oc(t,"y",0),width:Oc(t,"width",0),height:Oc(t,"height",0),rx:Oc(t,"rx",0),ry:Oc(t,"ry",0)})}function Dc(t){let e;const n=t.x,i=t.y,r=t.width,s=t.height,o=Math.min(t.rx||t["top-rx"]||0,r/2),a=Math.min(t.rx||t["bottom-rx"]||0,r/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,i+l,"v",s-l-c,"a",a,c,0,0,0,a,c,"h",r-2*a,"a",a,c,0,0,0,a,-c,"v",-(s-c-l),"a",o,l,0,0,0,-o,-l,"h",-(r-2*o),"a",o,l,0,0,0,-o,l,"Z"]:["M",n,i,"H",n+r,"V",i+s,"H",n,"V",i,"Z"],e.join(" ")}function Ic(t){const e=al("path");kl(e,kl(t));const n=Rc(t);return n&&e.setAttribute("d",n),e}function Rc(t){const e=t.tagName.toLowerCase();switch(e){case"path":return t.getAttribute("d");case"line":return Mc(t);case"polygon":return Sc(t);case"polyline":return Tc(t);case"ellipse":return Lc(t);case"circle":return jc(t);case"rect":return Bc(t);default:break}throw new Error(`"${e}" cannot be converted to svg path element.`)}function Vc(t,e,n,i){const r=2*Math.PI-1e-6,s=t,o=e;let a=n,l=i;if(l<a){const t=a;a=l,l=t}const c=l-a,h=c<Math.PI?"0":"1",u=Math.cos(a),d=Math.sin(a),g=Math.cos(l),f=Math.sin(l);return c>=r?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*d}A${o},${o} 0 ${h},1 ${o*g},${o*f}L${s*g},${s*f}A${s},${s} 0 ${h},0 ${s*u},${s*d}Z`:`M${o*u},${o*d}A${o},${o} 0 ${h},1 ${o*g},${o*f}L0,0Z`}const zc=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,Fc=/[ ,]+/,$c=/^(\w+)\((.*)\)/;function Gc(t,e){const n=al("svg"),i=n.createSVGPoint();return i.x=t,i.y=e,i}function qc(t){const e=al("svg"),n=e.createSVGMatrix();if(null!=t){const e=t,i=n;for(const t in e)i[t]=e[t]}return n}function Hc(t){const e=al("svg");return null!=t?(t instanceof DOMMatrix||(t=qc(t)),e.createSVGTransformFromMatrix(t)):e.createSVGTransform()}function Uc(t){let e=qc();const n=null!=t&&t.match(zc);if(!n)return e;for(let i=0,r=n.length;i<r;i+=1){const t=n[i],r=t.match($c);if(r){let t,n,i,s,o,a=qc();const l=r[2].split(Fc);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 Wc(t){const e=t||{},n=null!=e.a?e.a:1,i=null!=e.b?e.b:0,r=null!=e.c?e.c:0,s=null!=e.d?e.d:1,o=null!=e.e?e.e:0,a=null!=e.f?e.f:0;return`matrix(${n},${i},${r},${s},${o},${a})`}function Jc(t){let e,n,i;if(t){const r=Fc;if(t.trim().indexOf("matrix")>=0){const r=Uc(t),s=_c(r);e=[s.translateX,s.translateY],n=[s.rotation],i=[s.scaleX,s.scaleY];const o=[];0===e[0]&&0===e[1]||o.push(`translate(${e.join(",")})`),1===i[0]&&1===i[1]||o.push(`scale(${i.join(",")})`),0!==n[0]&&o.push(`rotate(${n[0]})`),t=o.join(" ")}else{const s=t.match(/translate\((.*?)\)/);s&&(e=s[1].split(r));const o=t.match(/rotate\((.*?)\)/);o&&(n=o[1].split(r));const a=t.match(/scale\((.*?)\)/);a&&(i=a[1].split(r))}}const r=i&&i[0]?parseFloat(i[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:r,sy:i&&i[1]?parseFloat(i[1]):r}}}function Xc(t,e){const n=e.x*t.a+e.y*t.c+0,i=e.x*t.b+e.y*t.d+0;return{x:n,y:i}}function _c(t){const e=Xc(t,{x:0,y:1}),n=Xc(t,{x:1,y:0}),i=180/Math.PI*Math.atan2(e.y,e.x)-90,r=180/Math.PI*Math.atan2(n.y,n.x);return{skewX:i,skewY:r,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:i}}function Yc(t){let e,n,i,r;return t?(e=null==t.a?1:t.a,r=null==t.d?1:t.d,n=t.b,i=t.c):e=r=1,{sx:n?Math.sqrt(e*e+n*n):e,sy:i?Math.sqrt(i*i+r*r):r}}function Zc(t){let e={x:0,y:1};t&&(e=Xc(t,e));const n=180*Math.atan2(e.y,e.x)/Math.PI%360-90,i=n%360+(n<0?360:0);return{angle:i}}function Kc(t){return{tx:t&&t.e||0,ty:t&&t.f||0}}function Qc(t,e,n={}){if(null==e)return Uc(kl(t,"transform"));if(n.absolute)return void t.setAttribute("transform",Wc(e));const i=t.transform,r=Hc(e);i.baseVal.appendItem(r)}function th(t,e,n=0,i={}){let r=kl(t,"transform");const s=Jc(r);if(null==e)return s.translation;r=s.raw,r=r.replace(/translate\([^)]*\)/g,"").trim();const o=i.absolute?e:s.translation.tx+e,a=i.absolute?n:s.translation.ty+n,l=`translate(${o},${a})`;t.setAttribute("transform",`${l} ${r}`.trim())}function eh(t,e,n,i,r={}){let s=kl(t,"transform");const o=Jc(s);if(null==e)return o.rotation;s=o.raw,s=s.replace(/rotate\([^)]*\)/g,"").trim(),e%=360;const a=r.absolute?e:o.rotation.angle+e,l=null!=n&&null!=i?`,${n},${i}`:"",c=`rotate(${a}${l})`;t.setAttribute("transform",`${s} ${c}`.trim())}function nh(t,e,n){let i=kl(t,"transform");const r=Jc(i);if(null==e)return r.scale;n=null==n?e:n,i=r.raw,i=i.replace(/scale\([^)]*\)/g,"").trim();const s=`scale(${e},${n})`;t.setAttribute("transform",`${i} ${s}`.trim())}function ih(t,e){if(nl(e)&&nl(t)){const n=e.getScreenCTM(),i=t.getScreenCTM();if(n&&i)return n.inverse().multiply(i)}return qc()}function rh(t,e){let n=qc();if(nl(e)&&nl(t)){let i=t;const r=[];while(i&&i!==e){const t=i.getAttribute("transform")||null,e=Uc(t);r.push(e),i=i.parentNode}r.reverse().forEach(t=>{n=n.multiply(t)})}return n}function sh(t,e,n){const i=t instanceof SVGSVGElement?t:t.ownerSVGElement,r=i.createSVGPoint();r.x=e,r.y=n;try{const e=i.getScreenCTM(),n=r.matrixTransform(e.inverse()),s=ih(t,i).inverse();return n.matrixTransform(s)}catch(s){return r}}var oh,ah,lh,ch;(function(t){const e={};function n(t){return e[t]||{}}function i(t,n){e[t]=n}function r(t){delete e[t]}t.get=n,t.register=i,t.unregister=r})(oh||(oh={})),function(t){const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{events:Object.create(null)}),e.get(t)}function i(t){return e.get(t)}function r(t){return e.delete(t)}t.ensure=n,t.get=i,t.remove=r}(ah||(ah={})),function(t){function e(t){t.stopPropagation()}function n(t,e,n){null!=t.addEventListener&&t.addEventListener(e,n)}function i(t,e,n){null!=t.removeEventListener&&t.removeEventListener(e,n)}t.returnTrue=()=>!0,t.returnFalse=()=>!1,t.stopPropagationCallback=e,t.addEventListener=n,t.removeEventListener=i}(lh||(lh={})),function(t){const e=/[^\x20\t\r\n\f]+/g,n=/^([^.]*)(?:\.(.+)|)/;function i(t){return(t||"").match(e)||[""]}function r(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():[]}}function s(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType}function o(t,e){if(e){const n=t;return null!=n.querySelector&&null!=n.querySelector(e)}return!0}t.splitType=i,t.normalizeType=r,t.isValidTarget=s,t.isValidSelector=o}(lh||(lh={})),function(t){let e=0;const n=new WeakMap;function i(t){return n.has(t)||(n.set(t,e),e+=1),n.get(t)}function r(t){return n.get(t)}function s(t){return n.delete(t)}function o(t,e){return n.set(t,e)}t.ensureHandlerId=i,t.getHandlerId=r,t.removeHandlerId=s,t.setHandlerId=o}(lh||(lh={})),function(t){function e(t,e){const n=[],i=ah.get(t),r=i&&i.events&&i.events[e.type],s=r&&r.handlers||[],o=r?r.delegateCount:0;if(o>0&&!("click"===e.type&&"number"===typeof e.button&&e.button>=1))for(let a=e.target;a!==t;a=a.parentNode||t)if(1===a.nodeType&&("click"!==e.type||!0!==a.disabled)){const e=[],i={};for(let n=0;n<o;n+=1){const r=s[n],o=r.selector;if(null!=o&&null==i[o]){const e=t,n=[];e.querySelectorAll(o).forEach(t=>{n.push(t)}),i[o]=n.includes(a)}i[o]&&e.push(r)}e.length&&n.push({elem:a,handlers:e})}return o<s.length&&n.push({elem:t,handlers:s.slice(o)}),n}t.getHandlerQueue=e}(lh||(lh={})),function(t){function e(t){return null!=t&&t===t.window}t.isWindow=e}(lh||(lh={})),function(t){function e(t,e){const n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}t.contains=e}(lh||(lh={}));class hh{constructor(t,e){this.isDefaultPrevented=lh.returnFalse,this.isPropagationStopped=lh.returnFalse,this.isImmediatePropagationStopped=lh.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{const t=this.originalEvent;this.isDefaultPrevented=lh.returnTrue,t&&!this.isSimulated&&t.preventDefault()},this.stopPropagation=()=>{const t=this.originalEvent;this.isPropagationStopped=lh.returnTrue,t&&!this.isSimulated&&t.stopPropagation()},this.stopImmediatePropagation=()=>{const t=this.originalEvent;this.isImmediatePropagationStopped=lh.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?lh.returnTrue:lh.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){function e(e){return e instanceof t?e:new t(e)}t.create=e})(hh||(hh={})),function(t){function e(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})}})}t.addProperty=e}(hh||(hh={})),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]))}(hh||(hh={})),function(t){oh.register("load",{noBubble:!0})}(ch||(ch={})),function(t){oh.register("beforeunload",{postDispatch(t,e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}})}(ch||(ch={})),function(t){oh.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(t,e){let n;const i=e.relatedTarget,r=e.handleObj;return i&&(i===t||lh.contains(t,i))||(e.type=r.originType,n=r.handler.call(t,e),e.type="mouseover"),n}}),oh.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(t,e){let n;const i=e.relatedTarget,r=e.handleObj;return i&&(i===t||lh.contains(t,i))||(e.type=r.originType,n=r.handler.call(t,e),e.type="mouseout"),n}})}(ch||(ch={}));var uh,dh,gh,fh=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};(function(t){let e;function n(t,n,i,s,o){if(!lh.isValidTarget(t))return;let a;if("function"!==typeof i){const{handler:t,selector:e}=i,n=fh(i,["handler","selector"]);i=t,o=e,a=n}const l=ah.ensure(t);let c=l.handler;null==c&&(c=l.handler=function(n,...i){return e!==n.type?r(t,n,...i):void 0});const h=lh.ensureHandlerId(i);lh.splitType(n).forEach(e=>{const{originType:n,namespaces:r}=lh.normalizeType(e);if(!n)return;let u=n,d=oh.get(u);u=(o?d.delegateType:d.bindType)||u,d=oh.get(u);const g=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},d.setup&&!1!==d.setup(t,s,r,c)||lh.addEventListener(t,u,c)),d.add&&(lh.removeHandlerId(g.handler),d.add(t,g),lh.setHandlerId(g.handler,h)),o?(p.handlers.splice(p.delegateCount,0,g),p.delegateCount+=1):p.handlers.push(g)})}function i(t,e,n,r,s){const o=ah.get(t);if(!o)return;const a=o.events;a&&(lh.splitType(e).forEach(e=>{const{originType:l,namespaces:c}=lh.normalizeType(e);if(!l)return void Object.keys(a).forEach(s=>{i(t,s+e,n,r,!0)});let h=l;const u=oh.get(h);h=(r?u.delegateType:u.bindType)||h;const d=a[h];if(!d)return;const g=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,f=d.handlers.length;for(let i=d.handlers.length-1;i>=0;i-=1){const e=d.handlers[i];!s&&l!==e.originType||n&&lh.getHandlerId(n)!==e.guid||!(null==g||e.namespace&&g.test(e.namespace))||!(null==r||r===e.selector||"**"===r&&e.selector)||(d.handlers.splice(i,1),e.selector&&(d.delegateCount-=1),u.remove&&u.remove(t,e))}f&&0===d.handlers.length&&(u.teardown&&!1!==u.teardown(t,c,o.handler)||lh.removeEventListener(t,h,o.handler),delete a[h])}),0===Object.keys(a).length&&ah.remove(t))}function r(t,e,...n){const i=hh.create(e);i.delegateTarget=t;const r=oh.get(i.type);if(r.preDispatch&&!1===r.preDispatch(t,i))return;const s=lh.getHandlerQueue(t,i);for(let o=0,a=s.length;o<a&&!i.isPropagationStopped();o+=1){const t=s[o];i.currentTarget=t.elem;for(let e=0,r=t.handlers.length;e<r&&!i.isImmediatePropagationStopped();e+=1){const r=t.handlers[e];if(null==i.rnamespace||r.namespace&&i.rnamespace.test(r.namespace)){i.handleObj=r,i.data=r.data;const e=oh.get(r.originType).handle,s=e?e(t.elem,i,...n):r.handler.call(t.elem,i,...n);void 0!==s&&(i.result=s,!1===s&&(i.preventDefault(),i.stopPropagation()))}}}return r.postDispatch&&r.postDispatch(t,i),i.result}function s(t,n,i,r){let s=t,o="string"===typeof t?t:t.type,a="string"===typeof t||null==s.namespace?[]:s.namespace.split(".");const l=i;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 hh?t:new hh(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=oh.get(o);if(!r&&u.trigger&&!1===u.trigger(l,s,n))return;let d;const g=[l];if(!r&&!u.noBubble&&!lh.isWindow(l)){d=u.delegateType||o;let t=l,e=l.parentNode;while(null!=e)g.push(e),t=e,e=e.parentNode;const n=l.ownerDocument||document;if(t===n){const e=t.defaultView||t.parentWindow||window;g.push(e)}}let f=l;for(let e=0,p=g.length;e<p&&!s.isPropagationStopped();e+=1){const t=g[e];f=t,s.type=e>1?d:u.bindType||o;const n=ah.get(t);n&&n.events[s.type]&&n.handler&&n.handler.call(t,...h);const i=c&&t[c]||null;i&&lh.isValidTarget(t)&&(s.result=i.call(t,...h),!1===s.result&&s.preventDefault())}if(s.type=o,!r&&!s.isDefaultPrevented()){const t=u.preventDefault;if((null==t||!1===t(g.pop(),s,n))&&lh.isValidTarget(l)&&c&&"function"===typeof l[o]&&!lh.isWindow(l)){const t=l[c];t&&(l[c]=null),e=o,s.isPropagationStopped()&&f.addEventListener(o,lh.stopPropagationCallback),l[o](),s.isPropagationStopped()&&f.removeEventListener(o,lh.stopPropagationCallback),e=void 0,t&&(l[c]=t)}}return s.result}t.on=n,t.off=i,t.dispatch=r,t.trigger=s})(uh||(uh={})),function(t){function e(t,e,n,i,r){return gh.on(t,e,n,i,r),t}function n(t,e,n,i,r){return gh.on(t,e,n,i,r,!0),t}function i(t,e,n,i){return gh.off(t,e,n,i),t}function r(t,e,n,i){return uh.trigger(e,n,t,i),t}t.on=e,t.once=n,t.off=i,t.trigger=r}(dh||(dh={})),function(t){function e(n,i,r,s,o,a){if("object"===typeof i)return"string"!==typeof r&&(s=s||r,r=void 0),void Object.keys(i).forEach(t=>e(n,t,r,s,i[t],a));if(null==s&&null==o?(o=r,s=r=void 0):null==o&&("string"===typeof r?(o=s,s=void 0):(o=s,s=r,r=void 0)),!1===o)o=lh.returnFalse;else if(!o)return;if(a){const e=o;o=function(i,...r){return t.off(n,i),e.call(this,i,...r)},lh.setHandlerId(o,lh.ensureHandlerId(e))}uh.on(n,i,o,s,r)}function n(t,e,i,r){const s=e;if(s&&null!=s.preventDefault&&null!=s.handleObj){const t=s.handleObj;n(s.delegateTarget,t.namespace?`${t.originType}.${t.namespace}`:t.originType,t.selector,t.handler)}else if("object"!==typeof e)!1!==i&&"function"!==typeof i||(r=i,i=void 0),!1===r&&(r=lh.returnFalse),uh.off(t,e,r,i);else{const r=e;Object.keys(r).forEach(e=>n(t,e,i,r[e]))}}t.on=e,t.off=n}(gh||(gh={}));class ph{constructor(t,e,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=Ha.isEventSupported("wheel")?"wheel":"mousewheel",this.target=t,this.onWheelCallback=e,this.onWheelGuard=n,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 mh(t){const e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}function yh(t){const e=t.getBoundingClientRect();return e.width}function bh(t){const e=t.getBoundingClientRect();return e.height}function vh(t){const e="fixed"===rc(t,"position");let n;if(e){const e=t.getBoundingClientRect();n={left:e.left,top:e.top}}else n=mh(t);if(!e){const e=t.ownerDocument;let i=t.offsetParent||e.documentElement;while((i===e.body||i===e.documentElement)&&"static"===rc(i,"position"))i=i.parentNode;if(i!==t&&Cl(i)){const t=mh(i);n.top-=t.top+sc(i,"borderTopWidth"),n.left-=t.left+sc(i,"borderLeftWidth")}}return{top:n.top-sc(t,"marginTop"),left:n.left-sc(t,"marginLeft")}}function xh(t,e=60){let n=null;return(...i)=>{n&&clearTimeout(n),n=window.setTimeout(()=>{t.apply(this,i)},e)}}function wh(t){let e=null,n=[];const i=()=>{if("static"===getComputedStyle(t).position){const e=t.style;e.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},r=xh(()=>{n.forEach(e=>e(t))}),s=t=>{e||(e=i()),-1===n.indexOf(t)&&n.push(t)},o=()=>{e&&e.parentNode&&(e.contentDocument&&e.contentDocument.defaultView.removeEventListener("resize",r),e.parentNode.removeChild(e),e=null,n=[])},a=t=>{const i=n.indexOf(t);-1!==i&&n.splice(i,1),0===n.length&&e&&o()};return{element:t,bind:s,destroy:o,unbind:a}}function Ph(t){let e=null,n=[];const i=xh(()=>{n.forEach(e=>{e(t)})}),r=()=>{const e=new ResizeObserver(i);return e.observe(t),i(),e},s=t=>{e||(e=r()),-1===n.indexOf(t)&&n.push(t)},o=()=>{e&&(e.disconnect(),n=[],e=null)},a=t=>{const i=n.indexOf(t);-1!==i&&n.splice(i,1),0===n.length&&e&&o()};return{element:t,bind:s,destroy:o,unbind:a}}const Ch="undefined"!==typeof ResizeObserver?Ph:wh;var Ah,Oh,Eh,Mh,Sh;(function(t){const e=new WeakMap;function n(t){let n=e.get(t);return n||(n=Ch(t),e.set(t,n),n)}function i(t){t.destroy(),e.delete(t.element)}t.bind=(t,e)=>{const i=n(t);return i.bind(e),()=>i.unbind(e)},t.clear=t=>{const e=n(t);i(e)}})(Ah||(Ah={}));class Th{constructor(t={}){this.comparator=t.comparator||Th.defaultComparator,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return 0===this.data.length}insert(t,e,n){const i={priority:t,value:e},r=this.data.length;return n&&(i.id=n,this.index[n]=r),this.data.push(i),this.bubbleUp(r),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("undefined"===typeof n)throw new Error(`Node with id '${t}' was not found in the heap.`);const i=this.data,r=i[n].priority,s=this.comparator(e,r);s<0?(i[n].priority=e,this.bubbleUp(n)):s>0&&(i[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,i,r=t;while(r>0){if(i=r-1>>>1,!(this.comparator(e[r].priority,e[i].priority)<0))break;{n=e[i],e[i]=e[r];let t=e[r].id;null!=t&&(this.index[t]=i),e[r]=n,t=e[r].id,null!=t&&(this.index[t]=r),r=i}}}bubbleDown(t){const e=this.data,n=e.length-1;let i=t;while(1){const t=1+(i<<1),r=t+1;let s=i;if(t<=n&&this.comparator(e[t].priority,e[s].priority)<0&&(s=t),r<=n&&this.comparator(e[r].priority,e[s].priority)<0&&(s=r),s===i)break;{const t=e[s];e[s]=e[i];let n=e[i].id;null!=n&&(this.index[n]=s),e[i]=t,n=e[i].id,null!=n&&(this.index[n]=i),i=s}}}}(function(t){t.defaultComparator=(t,e)=>t-e})(Th||(Th={})),function(t){function e(t,e,n=((t,e)=>1)){const i={},r={},s={},o=new Th;i[e]=0,Object.keys(t).forEach(t=>{t!==e&&(i[t]=1/0),o.insert(i[t],t,t)});while(!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=i[e]+n(e,l);t<i[l]&&(i[l]=t,r[l]=e,o.updatePriority(l,t))}}}return r}t.run=e}(Oh||(Oh={}));class Nh{constructor(t,e,n,i){return null==t?this.set(255,255,255,1):"number"===typeof t?this.set(t,e,n,i):"string"===typeof t?Nh.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=Nh.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,i){const r=Array.isArray(t)?t[0]:t,s=Array.isArray(t)?t[1]:e,o=Array.isArray(t)?t[2]:n,l=Array.isArray(t)?t[3]:i;return this.r=Math.round(a.clamp(r,0,255)),this.g=Math.round(a.clamp(s,0,255)),this.b=Math.round(a.clamp(o,0,255)),this.a=null==l?1:a.clamp(l,0,1),this}toHex(){const t=["r","g","b"].map(t=>{const e=this[t].toString(16);return e.length<2?"0"+e:e});return"#"+t.join("")}toRGBA(){return this.toArray()}toHSLA(){return Nh.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 Nh.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(e)}function n(e){return new t([...p(e),1])}function i(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 i=6*n;return i<1?t+(e-t)*i:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function s(e){const n=e.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(n){const e=n[2].split(/\s*,\s*/),i=(parseFloat(e[0])%360+360)%360/360,r=parseFloat(e[1])/100,s=parseFloat(e[2])/100,o=null==e[3]?1:parseInt(e[3],10);return new t(h(i,r,s,o))}return null}function o(e){if(e.startsWith("#"))return n(e);if(e.startsWith("rgb"))return i(e);const r=t.named[e];return r?n(r):s(e)}function l(e,n){return t.fromArray([e,e,e,n])}function c(t,e,n,i){const r=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]:i,l=Math.max(r,s,o),c=Math.min(r,s,o),h=(l+c)/2;let u=0,d=0;if(c!==l){const t=l-c;switch(d=h>.5?t/(2-l-c):t/(l+c),l){case r:u=(s-o)/t+(s<o?6:0);break;case s:u=(o-r)/t+2;break;case o:u=(r-s)/t+4;break;default:break}u/=6}return[u,d,h,null==a?1:a]}function h(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 u(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 d(){const t="0123456789ABCDEF";let e="#";for(let n=0;n<6;n+=1)e+=t[Math.floor(16*Math.random())];return e}function g(t){return u(t).toString()}function f(t,e){if("string"===typeof t){const n="#"===t[0],[i,r,s]=p(t);return e?.299*i+.587*r+.114*s>186?"#000000":"#ffffff":`${n?"#":""}${m(255-i,255-r,255-s)}`}const n=t[0],i=t[1],r=t[2],s=t[3];return e?.299*n+.587*i+.114*r>186?[0,0,0,s]:[255,255,255,s]:[255-n,255-i,255-r,s]}function p(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 i=4===e.length?4:8,r=(1<<i)-1,s=["b","g","r"].map(()=>{const t=n&r;return n>>=i,4===i?17*t:t});return[s[2],s[1],s[0]]}function m(t,e,n){const i=t=>t.length<2?"0"+t:t;return`${i(t.toString(16))}${i(e.toString(16))}${i(n.toString(16))}`}function y(t,e){return v(t,e)}function b(t,e){return v(t,-e)}function v(t,e){if("string"===typeof t){const n="#"===t[0],i=parseInt(n?t.substr(1):t,16),r=a.clamp((i>>16)+e,0,255),s=a.clamp((i>>8&255)+e,0,255),o=a.clamp((255&i)+e,0,255);return`${n?"#":""}${(o|s<<8|r<<16).toString(16)}`}const n=m(t[0],t[1],t[2]),i=p(v(n,e));return[i[0],i[1],i[2],t[3]]}t.fromArray=e,t.fromHex=n,t.fromRGBA=i,t.fromHSLA=s,t.fromString=o,t.makeGrey=l,t.rgba2hsla=c,t.hsla2rgba=h,t.random=u,t.randomHex=d,t.randomRGBA=g,t.invert=f,t.lighten=y,t.darken=b})(Nh||(Nh={})),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"}}(Nh||(Nh={}));class kh{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()}}(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}}function n(t,n){if(null!=t&&null!=n){const i=e(t),r=e(n),s=i.or.sort(),o=r.or.sort(),a=i.and.sort(),l=r.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}function i(t,n,i){if(null==n||Array.isArray(n)&&0===n.length)return!i||!0!==t.altKey&&!0!==t.ctrlKey&&!0!==t.metaKey&&!0!==t.shiftKey;const{or:r,and:s}=e(n),o=e=>{const n=e.toLowerCase()+"Key";return!0===t[n]};return r.some(t=>o(t))&&s.every(t=>o(t))}t.parse=e,t.equals=n,t.isMatch=i})(Eh||(Eh={})),function(t){t.linear=t=>t,t.quad=t=>t*t,t.cubic=t=>t*t*t,t.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)},t.exponential=t=>Math.pow(2,10*(t-1)),t.bounce=t=>{for(let e=0,n=1;1;e+=n,n/=2)if(t>=(7-4*e)/11){const i=(11-6*e-11*t)/4;return-i*i+n*n}}}(Mh||(Mh={})),function(t){t.decorators={reverse(t){return e=>1-t(1-e)},reflect(t){return e=>.5*(e<.5?t(2*e):2-t(2-2*e))},clamp(t,e=0,n=1){return i=>{const r=t(i);return r<e?e:r>n?n:r}},back(t=1.70158){return e=>e*e*((t+1)*e-t)},elastic(t=1.5){return e=>Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*t/3*e)}}}(Mh||(Mh={})),function(t){function e(t){return-1*Math.cos(t*(Math.PI/2))+1}function n(t){return Math.sin(t*(Math.PI/2))}function i(t){return-.5*(Math.cos(Math.PI*t)-1)}function r(t){return t*t}function s(t){return t*(2-t)}function o(t){return t<.5?2*t*t:(4-2*t)*t-1}function a(t){return t*t*t}function l(t){const e=t-1;return e*e*e+1}function c(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1}function h(t){return t*t*t*t}function u(t){const e=t-1;return 1-e*e*e*e}function d(t){const e=t-1;return t<.5?8*t*t*t*t:1-8*e*e*e*e}function g(t){return t*t*t*t*t}function f(t){const e=t-1;return 1+e*e*e*e*e}function p(t){const e=t-1;return t<.5?16*t*t*t*t*t:1+16*e*e*e*e*e}function m(t){return 0===t?0:Math.pow(2,10*(t-1))}function y(t){return 1===t?1:1-Math.pow(2,-10*t)}function b(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))}function v(t){const e=t/1;return-1*(Math.sqrt(1-e*t)-1)}function x(t){const e=t-1;return Math.sqrt(1-e*e)}function w(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)}function P(t,e=1.70158){return t*t*((e+1)*t-e)}function C(t,e=1.70158){const n=t/1-1;return n*n*((e+1)*n+e)+1}function A(t,e=1.70158){const n=2*t,i=n-2,r=1.525*e;return n<1?.5*n*n*((r+1)*n-r):.5*(i*i*((r+1)*i+r)+2)}function O(t,e=.7){if(0===t||1===t)return t;const n=t/1,i=n-1,r=1-e,s=r/(2*Math.PI)*Math.asin(1);return-Math.pow(2,10*i)*Math.sin((i-s)*(2*Math.PI)/r)}function E(t,e=.7){const n=1-e,i=2*t;if(0===t||1===t)return t;const r=n/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*i)*Math.sin((i-r)*(2*Math.PI)/n)+1}function M(t,e=.65){const n=1-e;if(0===t||1===t)return t;const i=2*t,r=i-1,s=n/(2*Math.PI)*Math.asin(1);return i<1?Math.pow(2,10*r)*Math.sin((r-s)*(2*Math.PI)/n)*-.5:Math.pow(2,-10*r)*Math.sin((r-s)*(2*Math.PI)/n)*.5+1}function S(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 T(t){return 1-S(1-t)}function N(t){return t<.5?.5*T(2*t):.5*S(2*t-1)+.5}t.easeInSine=e,t.easeOutSine=n,t.easeInOutSine=i,t.easeInQuad=r,t.easeOutQuad=s,t.easeInOutQuad=o,t.easeInCubic=a,t.easeOutCubic=l,t.easeInOutCubic=c,t.easeInQuart=h,t.easeOutQuart=u,t.easeInOutQuart=d,t.easeInQuint=g,t.easeOutQuint=f,t.easeInOutQuint=p,t.easeInExpo=m,t.easeOutExpo=y,t.easeInOutExpo=b,t.easeInCirc=v,t.easeOutCirc=x,t.easeInOutCirc=w,t.easeInBack=P,t.easeOutBack=C,t.easeInOutBack=A,t.easeInElastic=O,t.easeOutElastic=E,t.easeInOutElastic=M,t.easeOutBounce=S,t.easeInBounce=T,t.easeInOutBounce=N}(Mh||(Mh={})),function(t){t.number=(t,e)=>{const n=e-t;return e=>t+n*e},t.object=(t,e)=>{const n=Object.keys(t);return i=>{const r={};for(let s=n.length-1;-1!==s;s-=1){const o=n[s];r[o]=t[o]+(e[o]-t[o])*i}return r}},t.unit=(t,e)=>{const n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,i=n.exec(t),r=n.exec(e),s=r?r[1]:"",o=i?+i[1]:0,a=r?+r[1]:0,l=s.indexOf("."),c=l>0?s[1].length-l-1:0,h=a-o,u=i?i[2]:"";return t=>(o+h*t).toFixed(c)+u},t.color=(t,e)=>{const n=parseInt(t.slice(1),16),i=parseInt(e.slice(1),16),r=255&n,s=(255&i)-r,o=65280&n,a=(65280&i)-o,l=16711680&n,c=(16711680&i)-l;return t=>{const e=r+s*t&255,n=o+a*t&65280,i=l+c*t&16711680;return"#"+(1<<24|e|n|i).toString(16).slice(1)}}}(Sh||(Sh={}));const jh=[];function Lh(t,e){const n=jh.find(e=>e.name===t);if(!(n&&(n.loadTimes+=1,n.loadTimes>1))&&!Ha.isApplyingHMR()){const n=document.createElement("style");n.setAttribute("type","text/css"),n.textContent=e;const i=document.querySelector("head");i&&i.insertBefore(n,i.firstChild),jh.push({name:t,loadTimes:1,styleElement:n})}}function Bh(t){const e=jh.findIndex(e=>e.name===t);if(e>-1){const t=jh[e];if(t.loadTimes-=1,t.loadTimes>0)return;let n=t.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,jh.splice(e,1)}}var Dh,Ih;(function(t){function e(t){return 180*t/Math.PI%360}function n(t){return t%360+(t<0?360:0)}t.toDeg=e,t.toRad=function(t,e=!1){const n=e?t:t%360;return n*Math.PI/180},t.normalize=n})(Dh||(Dh={})),function(t){function e(t,e=0){return Number.isInteger(t)?t:+t.toFixed(e)}function n(t,e){let n,i;if(null==e?(i=null==t?1:t,n=0):(i=e,n=null==t?0:t),i<n){const t=n;n=i,i=t}return Math.floor(Math.random()*(i-n+1)+n)}function i(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}function r(t,e){return e*Math.round(t/e)}function s(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}function o(t,e){const n=t.x-e.x,i=t.y-e.y;return n*n+i*i}t.round=e,t.random=n,t.clamp=i,t.snapToGrid=r,t.containsPoint=s,t.squaredLength=o}(Ih||(Ih={}));class Rh{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class Vh extends Rh{constructor(t,e){super(),this.x=null==t?0:t,this.y=null==e?0:e}round(t=0){return this.x=Ih.round(this.x,t),this.y=Ih.round(this.y,t),this}add(t,e){const n=Vh.create(t,e);return this.x+=n.x,this.y+=n.y,this}update(t,e){const n=Vh.create(t,e);return this.x=n.x,this.y=n.y,this}translate(t,e){const n=Vh.create(t,e);return this.x+=n.x,this.y+=n.y,this}rotate(t,e){const n=Vh.rotate(this,t,e);return this.x=n.x,this.y=n.y,this}scale(t,e,n=new Vh){const i=Vh.create(n);return this.x=i.x+t*(this.x-i.x),this.y=i.y+e*(this.y-i.y),this}closest(t){if(1===t.length)return Vh.create(t[0]);let e=null,n=1/0;return t.forEach(t=>{const i=this.squaredDistance(t);i<n&&(e=t,n=i)}),e?Vh.create(e):null}distance(t){return Math.sqrt(this.squaredDistance(t))}squaredDistance(t){const e=Vh.create(t),n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistance(t){const e=Vh.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 Vh){const e=Vh.create(t),n=-(e.y-this.y),i=e.x-this.x;let r=Math.atan2(n,i);return r<0&&(r=2*Math.PI+r),180*r/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){const e=new Vh(0,0);return e.angleBetween(this,t)}toPolar(t){return this.update(Vh.toPolar(this,t)),this}changeInAngle(t,e,n=new Vh){return this.clone().translate(-t,-e).theta(n)-this.theta(n)}adhereToRect(t){return Ih.containsPoint(t,this)||(this.x=Math.min(Math.max(this.x,t.x),t.x+t.width),this.y=Math.min(Math.max(this.y,t.y),t.y+t.height)),this}bearing(t){const e=Vh.create(t),n=Dh.toRad(this.y),i=Dh.toRad(e.y),r=this.x,s=e.x,o=Dh.toRad(s-r),a=Math.sin(o)*Math.cos(i),l=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(o),c=Dh.toDeg(Math.atan2(a,l)),h=["NE","E","SE","S","SW","W","NW","N"];let u=c-22.5;return u<0&&(u+=360),u=parseInt(u/45,10),h[u]}cross(t,e){if(null!=t&&null!=e){const n=Vh.create(t),i=Vh.create(e);return(i.x-this.x)*(n.y-this.y)-(i.y-this.y)*(n.x-this.x)}return NaN}dot(t){const e=Vh.create(t);return this.x*e.x+this.y*e.y}diff(t,e){if("number"===typeof t)return new Vh(this.x-t,this.y-e);const n=Vh.create(t);return new Vh(this.x-n.x,this.y-n.y)}lerp(t,e){const n=Vh.create(t);return new Vh((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(t,e){const n=Vh.create(t),i=Dh.toRad(n.theta(this));return this.translate(Math.cos(i)*e,-Math.sin(i)*e)}reflection(t){return Vh.create(t).move(this,this.distance(t))}snapToGrid(t,e){return this.x=Ih.snapToGrid(this.x,t),this.y=Ih.snapToGrid(this.y,null==e?t:e),this}equals(t){const e=Vh.create(t);return null!=e&&e.x===this.x&&e.y===this.y}clone(){return Vh.clone(this)}toJSON(){return Vh.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}(function(t){function e(e){return null!=e&&e instanceof t}t.isPoint=e})(Vh||(Vh={})),function(t){function e(t){return null!=t&&"object"===typeof t&&"number"===typeof t.x&&"number"===typeof t.y}function n(t){return null!=t&&Array.isArray(t)&&2===t.length&&"number"===typeof t[0]&&"number"===typeof t[1]}t.isPointLike=e,t.isPointData=n}(Vh||(Vh={})),function(t){function e(e,i){return null==e||"number"===typeof e?new t(e,i):n(e)}function n(e){return t.isPoint(e)?new t(e.x,e.y):Array.isArray(e)?new t(e[0],e[1]):new t(e.x,e.y)}function i(e){return t.isPoint(e)?{x:e.x,y:e.y}:Array.isArray(e)?{x:e[0],y:e[1]}:{x:e.x,y:e.y}}function r(e,i,r=new t){let s=Math.abs(e*Math.cos(i)),o=Math.abs(e*Math.sin(i));const a=n(r),l=Dh.normalize(Dh.toDeg(i));return l<90?o=-o:l<180?(s=-s,o=-o):l<270&&(s=-s),new t(a.x+s,a.y+o)}function s(e,i=new t){const r=n(e),s=n(i),o=r.x-s.x,a=r.y-s.y;return new t(Math.sqrt(o*o+a*a),Dh.toRad(s.theta(r)))}function o(t,e){return t===e||null!=t&&null!=e&&(t.x===e.x&&t.y===e.y)}function a(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(!o(t[n],e[n]))return!1;return!0}function l(e,n,i,r){return new t(Ih.random(e,n),Ih.random(i,r))}function c(t,e,n){const i=Dh.toRad(Dh.normalize(-e)),r=Math.sin(i),s=Math.cos(i);return h(t,s,r,n)}function h(e,i,r,s=new t){const o=n(e),a=n(s),l=o.x-a.x,c=o.y-a.y,h=l*i-c*r,u=c*i+l*r;return new t(h+a.x,u+a.y)}t.create=e,t.clone=n,t.toJSON=i,t.fromPolar=r,t.toPolar=s,t.equals=o,t.equalPoints=a,t.random=l,t.rotate=c,t.rotateEx=h}(Vh||(Vh={}));class zh extends Rh{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 Vh(this.x,this.y)}get topLeft(){return new Vh(this.x,this.y)}get topCenter(){return new Vh(this.x+this.width/2,this.y)}get topRight(){return new Vh(this.x+this.width,this.y)}get center(){return new Vh(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new Vh(this.x,this.y+this.height)}get bottomCenter(){return new Vh(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new Vh(this.x+this.width,this.y+this.height)}get corner(){return new Vh(this.x+this.width,this.y+this.height)}get rightMiddle(){return new Vh(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new Vh(this.x,this.y+this.height/2)}get topLine(){return new Fh(this.topLeft,this.topRight)}get rightLine(){return new Fh(this.topRight,this.bottomRight)}get bottomLine(){return new Fh(this.bottomLeft,this.bottomRight)}get leftLine(){return new Fh(this.topLeft,this.bottomLeft)}constructor(t,e,n,i){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.width=null==n?0:n,this.height=null==i?0:i}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(t){if(!t)return this.clone();const e=Dh.toRad(t),n=Math.abs(Math.sin(e)),i=Math.abs(Math.cos(e)),r=this.width*i+this.height*n,s=this.width*n+this.height*i;return new zh(this.x+(this.width-r)/2,this.y+(this.height-s)/2,r,s)}round(t=0){return this.x=Ih.round(this.x,t),this.y=Ih.round(this.y,t),this.width=Ih.round(this.width,t),this.height=Ih.round(this.height,t),this}add(t,e,n,i){const r=zh.create(t,e,n,i),s=Math.min(this.x,r.x),o=Math.min(this.y,r.y),a=Math.max(this.x+this.width,r.x+r.width),l=Math.max(this.y+this.height,r.y+r.height);return this.x=s,this.y=o,this.width=a-s,this.height=l-o,this}update(t,e,n,i){const r=zh.create(t,e,n,i);return this.x=r.x,this.y=r.y,this.width=r.width,this.height=r.height,this}inflate(t,e){const n=t,i=null!=e?e:t;return this.x-=n,this.y-=i,this.width+=2*n,this.height+=2*i,this}snapToGrid(t,e){const n=this.origin.snapToGrid(t,e),i=this.corner.snapToGrid(t,e);return this.x=n.x,this.y=n.y,this.width=i.x-n.x,this.height=i.y-n.y,this}translate(t,e){const n=Vh.create(t,e);return this.x+=n.x,this.y+=n.y,this}scale(t,e,n=new Vh){const i=this.origin.scale(t,e,n);return this.x=i.x,this.y=i.y,this.width*=t,this.height*=e,this}rotate(t,e=this.getCenter()){if(0!==t){const n=Dh.toRad(t),i=Math.cos(n),r=Math.sin(n);let s=this.getOrigin(),o=this.getTopRight(),a=this.getBottomRight(),l=this.getBottomLeft();s=Vh.rotateEx(s,i,r,e),o=Vh.rotateEx(o,i,r,e),a=Vh.rotateEx(a,i,r,e),l=Vh.rotateEx(l,i,r,e);const c=new zh(s.x,s.y,0,0);c.add(o.x,o.y,0,0),c.add(a.x,a.y,0,0),c.add(l.x,l.y,0,0),this.update(c)}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=zh.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=zh.clone(t),i=e.x,r=e.y;let s=1/0,o=1/0,a=1/0,l=1/0,c=1/0,h=1/0,u=1/0,d=1/0;const g=n.topLeft;g.x<i&&(s=(this.x-i)/(g.x-i)),g.y<r&&(c=(this.y-r)/(g.y-r));const f=n.bottomRight;f.x>i&&(o=(this.x+this.width-i)/(f.x-i)),f.y>r&&(h=(this.y+this.height-r)/(f.y-r));const p=n.topRight;p.x>i&&(a=(this.x+this.width-i)/(p.x-i)),p.y<r&&(u=(this.y-r)/(p.y-r));const m=n.bottomLeft;return m.x<i&&(l=(this.x-i)/(m.x-i)),m.y>r&&(d=(this.y+this.height-r)/(m.y-r)),{sx:Math.min(s,o,a,l),sy:Math.min(c,h,u,d)}}getMaxUniformScaleToFit(t,e=this.center){const n=this.getMaxScaleToFit(t,e);return Math.min(n.sx,n.sy)}containsPoint(t,e){return Ih.containsPoint(this,Vh.create(t,e))}containsRect(t,e,n,i){const r=zh.create(t,e,n,i),s=this.x,o=this.y,a=this.width,l=this.height,c=r.x,h=r.y,u=r.width,d=r.height;return 0!==a&&0!==l&&0!==u&&0!==d&&(c>=s&&h>=o&&c+u<=s+a&&h+d<=o+l)}intersectsWithLine(t){const e=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],i=[];return e.forEach(e=>{const r=t.intersectsWithLine(e);null!==r&&i.indexOf(r.toString())<0&&(n.push(r),i.push(r.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(t,e){const n=Vh.clone(t),i=this.center;let r=null;null!=e&&0!==e&&n.rotate(e,i);const s=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],o=new Fh(i,n);for(let a=s.length-1;a>=0;a-=1){const t=s[a].intersectsWithLine(o);if(null!==t){r=t;break}}return r&&null!=e&&0!==e&&r.rotate(-e,i),r}intersectsWithRect(t,e,n,i){const r=zh.create(t,e,n,i);if(!this.isIntersectWithRect(r))return null;const s=this.origin,o=this.corner,a=r.origin,l=r.corner,c=Math.max(s.x,a.x),h=Math.max(s.y,a.y);return new zh(c,h,Math.min(o.x,l.x)-c,Math.min(o.y,l.y)-h)}isIntersectWithRect(t,e,n,i){const r=zh.create(t,e,n,i),s=this.origin,o=this.corner,a=r.origin,l=r.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,i=this.height;return this.width<0&&(t=this.x+this.width,n=-this.width),this.height<0&&(e=this.y+this.height,i=-this.height),this.x=t,this.y=e,this.width=n,this.height=i,this}union(t){const e=zh.clone(t),n=this.origin,i=this.corner,r=e.origin,s=e.corner,o=Math.min(n.x,r.x),a=Math.min(n.y,r.y),l=Math.max(i.x,s.x),c=Math.max(i.y,s.y);return new zh(o,a,l-o,c-a)}getNearestSideToPoint(t){const e=Vh.clone(t),n=e.x-this.x,i=this.x+this.width-e.x,r=e.y-this.y,s=this.y+this.height-e.y;let o=n,a="left";return i<o&&(o=i,a="right"),r<o&&(o=r,a="top"),s<o&&(a="bottom"),a}getNearestPointToPoint(t){const e=Vh.clone(t);if(this.containsPoint(e)){const t=this.getNearestSideToPoint(e);if("left"===t)return new Vh(this.x,e.y);if("top"===t)return new Vh(e.x,this.y);if("right"===t)return new Vh(this.x+this.width,e.y);if("bottom"===t)return new Vh(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 zh(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){function e(e){return null!=e&&e instanceof t}t.isRectangle=e})(zh||(zh={})),function(t){function e(t){return null!=t&&"object"===typeof t&&"number"===typeof t.x&&"number"===typeof t.y&&"number"===typeof t.width&&"number"===typeof t.height}t.isRectangleLike=e}(zh||(zh={})),function(t){function e(e,i,r,s){return null==e||"number"===typeof e?new t(e,i,r,s):n(e)}function n(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)}function i(e){return new t(e.x-e.a,e.y-e.b,2*e.a,2*e.b)}function r(e){return new t(0,0,e.width,e.height)}function s(e,n){return new t(e.x,e.y,n.width,n.height)}t.create=e,t.clone=n,t.fromEllipse=i,t.fromSize=r,t.fromPositionAndSize=s}(zh||(zh={}));class Fh extends Rh{get center(){return new Vh((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(t,e,n,i){super(),"number"===typeof t&&"number"===typeof e?(this.start=new Vh(t,e),this.end=new Vh(n,i)):(this.start=Vh.create(t),this.end=Vh.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:i}=e,r=n.clone().rotate(270,i),s=i.clone().rotate(90,n);return n.move(s,t),i.move(r,t),e}vector(){return new Vh(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const t=new Vh(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),i=Math.max(this.start.y,this.end.y);return new zh(t,e,n-t,i-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 Fh(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 i=!0;t<0&&(i=!1,t=-t);const r=this.length();if(t>=r)return i?n.clone():e.clone();const s=(i?t:r-t)/r;return this.pointAt(s)}divideAt(t){const e=this.pointAt(t);return[new Fh(this.start,e),new Fh(e,this.end)]}divideAtLength(t){const e=this.pointAtLength(t);return[new Fh(this.start,e),new Fh(e,this.end)]}containsPoint(t){const e=this.start,n=this.end;if(0!==e.cross(t,n))return!1;const i=this.length();return!(new Fh(e,t).length()>i)&&!(new Fh(t,n).length()>i)}intersect(t,e){const n=t.intersectsWithLine(this,e);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(t){const e=new Vh(this.end.x-this.start.x,this.end.y-this.start.y),n=new Vh(t.end.x-t.start.x,t.end.y-t.start.y),i=e.x*n.y-e.y*n.x,r=new Vh(t.start.x-this.start.x,t.start.y-this.start.y),s=r.x*n.y-r.y*n.x,o=r.x*e.y-r.y*e.x;if(0===i||s*i<0||o*i<0)return null;if(i>0){if(s>i||o>i)return null}else if(s<i||o<i)return null;return new Vh(this.start.x+s*e.x/i,this.start.y+s*e.y/i)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(t){const e=Vh.clone(t),n=this.start,i=this.end,r=(i.x-n.x)*(e.y-n.y)-(i.y-n.y)*(e.x-n.x);return r/this.length()}pointSquaredDistance(t,e){const n=Vh.create(t,e);return this.closestPoint(n).squaredDistance(n)}pointDistance(t,e){const n=Vh.create(t,e);return this.closestPoint(n).distance(n)}tangentAt(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAt(t),r=new Fh(e,n);return r.translate(i.x-e.x,i.y-e.y),r}tangentAtLength(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAtLength(t),r=new Fh(e,n);return r.translate(i.x-e.x,i.y-e.y),r}relativeCcw(t,e){const n=Vh.create(t,e);let i=n.x-this.start.x,r=n.y-this.start.y;const s=this.end.x-this.start.x,o=this.end.y-this.start.y;let a=i*o-r*s;return 0===a&&(a=i*s+r*o,a>0&&(i-=s,r-=o,a=i*s+r*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 Fh(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){function e(e){return null!=e&&e instanceof t}t.isLine=e})(Fh||(Fh={}));class $h extends Rh{get center(){return new Vh(this.x,this.y)}constructor(t,e,n,i){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.a=null==n?0:n,this.b=null==i?0:i}bbox(){return zh.fromEllipse(this)}getCenter(){return this.center}inflate(t,e){const n=t,i=null!=e?e:t;return this.a+=2*n,this.b+=2*i,this}normalizedDistance(t,e){const n=Vh.create(t,e),i=n.x-this.x,r=n.y-this.y,s=this.a,o=this.b;return i*i/(s*s)+r*r/(o*o)}containsPoint(t,e){return this.normalizedDistance(t,e)<=1}intersectsWithLine(t){const e=[],n=this.a,i=this.b,r=t.start,s=t.end,o=t.vector(),a=r.diff(new Vh(this.x,this.y)),l=new Vh(o.x/(n*n),o.y/(i*i)),c=new Vh(a.x/(n*n),a.y/(i*i)),h=o.dot(l),u=o.dot(c),d=a.dot(c)-1,g=u*u-h*d;if(g<0)return null;if(g>0){const t=Math.sqrt(g),n=(-u-t)/h,i=(-u+t)/h;if((n<0||n>1)&&(i<0||i>1))return null;n>=0&&n<=1&&e.push(r.lerp(s,n)),i>=0&&i<=1&&e.push(r.lerp(s,i))}else{const t=-u/h;if(!(t>=0&&t<=1))return null;e.push(r.lerp(s,t))}return e}intersectsWithLineFromCenterToPoint(t,e=0){const n=Vh.clone(t);e&&n.rotate(e,this.getCenter());const i=n.x-this.x,r=n.y-this.y;let s;if(0===i)return s=this.bbox().getNearestPointToPoint(n),e?s.rotate(-e,this.getCenter()):s;const o=r/i,a=o*o,l=this.a*this.a,c=this.b*this.b;let h=Math.sqrt(1/(1/l+a/c));h=i<0?-h:h;const u=o*h;return s=new Vh(this.x+h,this.y+u),e?s.rotate(-e,this.getCenter()):s}tangentTheta(t){const e=Vh.clone(t),n=e.x,i=e.y,r=this.a,s=this.b,o=this.bbox().center,a=o.x,l=o.y,c=30,h=n>o.x+r/2,u=n<o.x-r/2;let d,g;return h||u?(g=n>o.x?i-c:i+c,d=r*r/(n-a)-r*r*(i-l)*(g-l)/(s*s*(n-a))+a):(d=i>o.y?n+c:n-c,g=s*s/(i-l)-s*s*(n-a)*(d-a)/(r*r*(i-l))+l),new Vh(d,g).theta(e)}scale(t,e){return this.a*=t,this.b*=e,this}rotate(t,e){const n=zh.fromEllipse(this);n.rotate(t,e);const i=$h.fromRect(n);return this.a=i.a,this.b=i.b,this.x=i.x,this.y=i.y,this}translate(t,e){const n=Vh.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 $h(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){function e(e){return null!=e&&e instanceof t}t.isEllipse=e})($h||($h={})),function(t){function e(e,i,r,s){return null==e||"number"===typeof e?new t(e,i,r,s):n(e)}function n(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)}function i(e){const n=e.center;return new t(n.x,n.y,e.width/2,e.height/2)}t.create=e,t.parse=n,t.fromRect=i}($h||($h={}));const Gh=new RegExp("^[\\s\\dLMCZz,.]*$");function qh(t){return"string"===typeof t&&Gh.test(t)}function Hh(t,e){return(t%e+e)%e}function Uh(t,e,n,i,r){const s=[],o=t[t.length-1],a=null!=e&&e>0,l=e||0;if(i&&a){t=t.slice();const e=t[0],n=new Vh(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;n?s.push("M",c.x,c.y):s.push("L",c.x,c.y);while(h<(i?t.length:t.length-1)){let e=t[Hh(h,t.length)],n=c.x-e.x,i=c.y-e.y;if(a&&(0!==n||0!==i)&&(null==r||r.indexOf(h-1)<0)){let r=Math.sqrt(n*n+i*i);const o=n*Math.min(l,r/2)/r,a=i*Math.min(l,r/2)/r,c=e.x+o,u=e.y+a;s.push("L",c,u);let d=t[Hh(h+1,t.length)];while(h<t.length-2&&0===Math.round(d.x-e.x)&&0===Math.round(d.y-e.y))d=t[Hh(h+2,t.length)],h+=1;n=d.x-e.x,i=d.y-e.y,r=Math.max(1,Math.sqrt(n*n+i*i));const g=n*Math.min(l,r/2)/r,f=i*Math.min(l,r/2)/r,p=e.x+g,m=e.y+f;s.push("Q",e.x,e.y,p,m),e=new Vh(p,m)}else s.push("L",e.x,e.y);c=e,h+=1}return i?s.push("Z"):s.push("L",o.x,o.y),s.map(t=>"string"===typeof t?t:+t.toFixed(3)).join(" ")}function Wh(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})}),Uh(n,e.round,null==e.initialMove||e.initialMove,e.close,e.exclude)}function Jh(t,e,n,i,r=0,s=0,o=0,a,l){if(0===n||0===i)return[];a-=t,l-=e,n=Math.abs(n),i=Math.abs(i);const c=-a/2,h=-l/2,u=Math.cos(r*Math.PI/180),d=Math.sin(r*Math.PI/180),g=u*c+d*h,f=-1*d*c+u*h,p=g*g,m=f*f,y=n*n,b=i*i,v=p/y+m/b;let x;if(v>1)n=Math.sqrt(v)*n,i=Math.sqrt(v)*i,x=0;else{let t=1;s===o&&(t=-1),x=t*Math.sqrt((y*b-y*m-b*p)/(y*m+b*p))}const w=x*n*f/i,P=-1*x*i*g/n,C=u*w-d*P+a/2,A=d*w+u*P+l/2;let O=Math.atan2((f-P)/i,(g-w)/n)-Math.atan2(0,1),E=O>=0?O:2*Math.PI+O;O=Math.atan2((-f-P)/i,(-g-w)/n)-Math.atan2((f-P)/i,(g-w)/n);let M=O>=0?O:2*Math.PI+O;0===o&&M>0?M-=2*Math.PI:0!==o&&M<0&&(M+=2*Math.PI);const S=2*M/Math.PI,T=Math.ceil(S<0?-1*S:S),N=M/T,k=8/3*Math.sin(N/4)*Math.sin(N/4)/Math.sin(N/2),j=u*n,L=u*i,B=d*n,D=d*i;let I=Math.cos(E),R=Math.sin(E),V=-k*(j*R+D*I),z=-k*(B*R-L*I),F=0,$=0;const G=[];for(let q=0;q<T;q+=1){E+=N,I=Math.cos(E),R=Math.sin(E),F=j*I-D*R+C,$=B*I+L*R+A;const n=-k*(j*R+D*I),i=-k*(B*R-L*I),r=6*q;G[r]=Number(V+t),G[r+1]=Number(z+e),G[r+2]=Number(F-n+t),G[r+3]=Number($-i+e),G[r+4]=Number(F+t),G[r+5]=Number($+e),V=F+n,z=$+i}return G.map(t=>+t.toFixed(2))}function Xh(t,e,n,i,r=0,s=0,o=0,a,l){const c=[],h=Jh(t,e,n,i,r,s,o,a,l);if(null!=h)for(let u=0,d=h.length;u<d;u+=6)c.push("C",h[u],h[u+1],h[u+2],h[u+3],h[u+4],h[u+5]);return c.join(" ")}class _h extends Rh{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(t){if(super(),null!=t){if("string"===typeof t)return _h.parse(t);this.points=t.map(t=>Vh.create(t))}else this.points=[]}scale(t,e,n=new Vh){return this.points.forEach(i=>i.scale(t,e,n)),this}rotate(t,e){return this.points.forEach(n=>n.rotate(t,e)),this}translate(t,e){const n=Vh.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 zh;let t=1/0,e=-1/0,n=1/0,i=-1/0;const r=this.points;for(let s=0,o=r.length;s<o;s+=1){const o=r[s],a=o.x,l=o.y;a<t&&(t=a),a>e&&(e=a),l<n&&(n=l),l>i&&(i=l)}return new zh(t,n,e-t,i-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 i=0,r=0,s=1/0;for(let o=0,a=n-1;o<a;o+=1){const n=new Fh(e[o],e[o+1]),a=n.length(),l=n.closestPointNormalizedLength(t),c=n.pointAt(l),h=c.squaredDistance(t);h<s&&(s=h,r=i+l*a),i+=a}return r}closestPointNormalizedLength(t){const e=this.length();if(0===e)return 0;const n=this.closestPointLength(t);return n/e}closestPointTangent(t){const e=this.closestPointLength(t);return this.tangentAtLength(e)}containsPoint(t){if(0===this.points.length)return!1;const e=Vh.clone(t),n=e.x,i=e.y,r=this.points,s=r.length;let o=s-1,a=0;for(let l=0;l<s;l+=1){const s=r[o],c=r[l];if(e.equals(s))return!0;const h=new Fh(s,c);if(h.containsPoint(t))return!0;if(i<=s.y&&i>c.y||i>s.y&&i<=c.y){const e=s.x-n>c.x-n?s.x-n:c.x-n;if(e>=0){const r=new Vh(n+e,i),s=new Fh(t,r);h.intersectsWithLine(s)&&(a+=1)}}o=l}return a%2===1}intersectsWithLine(t){const e=[];for(let n=0,i=this.points.length-1;n<i;n+=1){const i=this.points[n],r=this.points[n+1],s=t.intersectsWithLine(new Fh(i,r));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],i=new Fh(e,n);if(i.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],i=this.points[e+1];t+=n.distance(i)}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 i=this.length(),r=i*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 i=!0;t<0&&(i=!1,t=-t);let r=0;for(let o=0,a=n-1;o<a;o+=1){const n=i?o:a-1-o,s=e[n],l=e[n+1],c=new Fh(s,l),h=s.distance(l);if(t<=r+h)return c.pointAtLength((i?1:-1)*(t-r));r+=h}const s=i?e[n-1]:e[0];return s.clone()}tangentAt(t){const e=this.points,n=e.length;if(0===n||1===n)return null;t<0&&(t=0),t>1&&(t=1);const i=this.length(),r=i*t;return this.tangentAtLength(r)}tangentAtLength(t){const e=this.points,n=e.length;if(0===n||1===n)return null;let i,r=!0;t<0&&(r=!1,t=-t);let s=0;for(let o=0,a=n-1;o<a;o+=1){const n=r?o:a-1-o,l=e[n],c=e[n+1],h=new Fh(l,c),u=l.distance(c);if(h.isDifferentiable()){if(t<=s+u)return h.tangentAtLength((r?1:-1)*(t-s));i=h}s+=u}if(i){const t=r?1:0;return i.tangentAt(t)}return null}simplify(t={}){const e=this.points;if(e.length<3)return this;const n=t.threshold||0;let i=0;while(e[i+2]){const t=i,r=i+1,s=i+2,o=e[t],a=e[r],l=e[s],c=new Fh(o,l),h=c.closestPoint(a),u=h.distance(a);u<=n?e.splice(r,1):i+=1}return this}toHull(){const t=this.points,e=t.length;if(0===e)return new _h;let n=t[0];for(let u=1;u<e;u+=1)(t[u].y<n.y||t[u].y===n.y&&t[u].x>n.x)&&(n=t[u]);const i=[];for(let u=0;u<e;u+=1){let e=n.theta(t[u]);0===e&&(e=360),i.push([t[u],u,e])}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 r={},s=[],o=t=>`${t[0].toString()}@${t[1]}`;while(0!==i.length){const t=i.pop(),e=t[0];if(r[o(t)])continue;let n=!1;while(!n)if(s.length<2)s.push(t),n=!0;else{const a=s.pop(),l=a[0],c=s.pop(),h=c[0],u=h.cross(l,e);if(u<0)s.push(c),s.push(a),s.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)?(r[o(a)]=l,s.push(c)):Math.abs((n+1)%360-1)<t&&(s.push(c),i.push(a))}else r[o(a)]=l,s.push(c)}}let a;s.length>2&&s.pop();let l=-1;for(let u=0,d=s.length;u<d;u+=1){const t=s[u][1];(void 0===a||t<a)&&(a=t,l=u)}let c=[];if(l>0){const t=s.slice(l),e=s.slice(0,l);c=t.concat(e)}else c=s;const h=[];for(let u=0,d=c.length;u<d;u+=1)h.push(c[u][0]);return new _h(h)}equals(t){return null!=t&&(t.points.length===this.points.length&&t.points.every((t,e)=>t.equals(this.points[e])))}clone(){return new _h(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){function e(e){return null!=e&&e instanceof t}t.isPolyline=e})(_h||(_h={})),function(t){function e(e){const n=e.trim();if(""===n)return new t;const i=[],r=n.split(/\s*,\s*|\s+/);for(let t=0,s=r.length;t<s;t+=2)i.push({x:+r[t],y:+r[t+1]});return new t(i)}t.parse=e}(_h||(_h={}));class Yh extends Rh{constructor(t,e,n,i){super(),this.PRECISION=3,this.start=Vh.create(t),this.controlPoint1=Vh.create(e),this.controlPoint2=Vh.create(n),this.end=Vh.create(i)}bbox(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end,r=t.x,s=t.y,o=e.x,a=e.y,l=n.x,c=n.y,h=i.x,u=i.y,d=[],g=[],f=[[],[]];let p,m,y,b,v,x,w,P,C,A,O;for(let j=0;j<2;j+=1)if(0===j?(m=6*r-12*o+6*l,p=-3*r+9*o-9*l+3*h,y=3*o-3*r):(m=6*s-12*a+6*c,p=-3*s+9*a-9*c+3*u,y=3*a-3*s),Math.abs(p)<1e-12){if(Math.abs(m)<1e-12)continue;b=-y/m,b>0&&b<1&&g.push(b)}else w=m*m-4*y*p,P=Math.sqrt(w),w<0||(v=(-m+P)/(2*p),v>0&&v<1&&g.push(v),x=(-m-P)/(2*p),x>0&&x<1&&g.push(x));let E=g.length;const M=E;while(E)E-=1,b=g[E],O=1-b,C=O*O*O*r+3*O*O*b*o+3*O*b*b*l+b*b*b*h,f[0][E]=C,A=O*O*O*s+3*O*O*b*a+3*O*b*b*c+b*b*b*u,f[1][E]=A,d[E]={X:C,Y:A};g[M]=0,g[M+1]=1,d[M]={X:r,Y:s},d[M+1]={X:h,Y:u},f[0][M]=r,f[1][M]=s,f[0][M+1]=h,f[1][M+1]=u,g.length=M+2,f[0].length=M+2,f[1].length=M+2,d.length=M+2;const S=Math.min.apply(null,f[0]),T=Math.min.apply(null,f[1]),N=Math.max.apply(null,f[0]),k=Math.max.apply(null,f[1]);return new zh(S,T,N-S,k-T)}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),i=this.closestPointLength(t,n);if(!i)return 0;const r=this.length(n);return 0===r?0:i/r}closestPointT(t,e={}){const n=this.getPrecision(e),i=this.getDivisions(e),r=Math.pow(10,-n);let s=null,o=0,a=0,l=0,c=0,h=0,u=null;const d=i.length;let g=d>0?1/d:0;i.forEach((e,n)=>{const i=e.start.distance(t),r=e.end.distance(t),d=i+r;(null==u||d<u)&&(s=e,o=n*g,a=(n+1)*g,l=i,c=r,u=d,h=e.endpointDistance())});while(1){const e=l?Math.abs(l-c)/l:0,n=null!=c?Math.abs(l-c)/c:0,i=e<r||n<r,u=!l||l<h*r,d=!c||c<h*r,f=u||d;if(i||f)return l<=c?o:a;const p=s.divide(.5);g/=2;const m=p[0].start.distance(t),y=p[0].end.distance(t),b=m+y,v=p[1].start.distance(t),x=p[1].end.distance(t),w=v+x;b<=w?(s=p[0],a-=g,l=m,c=y):(s=p[1],o+=g,l=v,c=x)}}closestPointTangent(t,e={}){return this.tangentAtT(this.closestPointT(t,e))}containsPoint(t,e={}){const n=this.toPolyline(e);return n.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,i=this.controlPoint2,r=this.end;if(t<=0)return[new Yh(e,e,e,e),new Yh(e,n,i,r)];if(t>=1)return[new Yh(e,n,i,r),new Yh(r,r,r,r)];const s=this.getSkeletonPoints(t),o=s.startControlPoint1,a=s.startControlPoint2,l=s.divider,c=s.dividerControlPoint1,h=s.dividerControlPoint2;return[new Yh(e,o,a,l),new Yh(l,c,h,r)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,r=this.end;if(t<=0)return{startControlPoint1:e.clone(),startControlPoint2:e.clone(),divider:e.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:i.clone()};if(t>=1)return{startControlPoint1:n.clone(),startControlPoint2:i.clone(),divider:r.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:r.clone()};const s=new Fh(e,n).pointAt(t),o=new Fh(n,i).pointAt(t),a=new Fh(i,r).pointAt(t),l=new Fh(s,o).pointAt(t),c=new Fh(o,a).pointAt(t),h=new Fh(l,c).pointAt(t);return{startControlPoint1:s,startControlPoint2:l,divider:h,dividerControlPoint1:c,dividerControlPoint2:a}}getSubdivisions(t={}){const e=this.getPrecision(t);let n=[new Yh(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===e)return n;let i=this.endpointDistance();const r=Math.pow(10,-e);let s=0;while(1){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),o=0!==e?(e-i)/e:0;if(s>1&&o<r)return t;n=t,i=e}}length(t={}){const e=this.getDivisions(t);return e.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,i=this.divide(t)[0];return i.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,i=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(i))}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,i=e.dividerControlPoint1,r=e.divider,s=new Fh(n,i);return s.translate(r.x-n.x,r.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={}){const e=this.getPrecision(t),n=this.getDivisions(t);return{precision:e,subdivisions:n}}tAt(t,e={}){if(t<=0)return 0;if(t>=1)return 1;const n=this.getOptions(e),i=this.length(n),r=i*t;return this.tAtLength(r,n)}tAtLength(t,e={}){let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),r=this.getDivisions(e),s={precision:i,subdivisions:r};let o,a,l=null,c=0,h=0,u=0;const d=r.length;let g=d>0?1/d:0;for(let m=0;m<d;m+=1){const e=n?m:d-1-m,i=r[m],s=i.endpointDistance();if(t<=u+s){l=i,o=e*g,a=(e+1)*g,c=n?t-u:s+u-t,h=n?s+u-t:t-u;break}u+=s}if(null==l)return n?1:0;const f=this.length(s),p=Math.pow(10,-i);while(1){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 i=l.divide(.5);g/=2;const r=i[0].endpointDistance(),s=i[1].endpointDistance();c<=r?(l=i[0],a-=g,e=c,n=r-e):(l=i[1],o+=g,e=c-r,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 _h(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 Yh(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){function e(e){return null!=e&&e instanceof t}t.isCurve=e})(Yh||(Yh={})),function(t){function e(t){const e=t.length,n=[],i=[];let r=2;n[0]=t[0]/r;for(let s=1;s<e;s+=1)i[s]=1/r,r=(s<e-1?4:3.5)-i[s],n[s]=(t[s]-n[s-1])/r;for(let s=1;s<e;s+=1)n[e-s-1]-=i[e-s]*n[e-s];return n}function n(t){const n=t.map(t=>Vh.clone(t)),i=[],r=[],s=n.length-1;if(1===s)return i[0]=new Vh((2*n[0].x+n[1].x)/3,(2*n[0].y+n[1].y)/3),r[0]=new Vh(2*i[0].x-n[0].x,2*i[0].y-n[0].y),[i,r];const o=[];for(let e=1;e<s-1;e+=1)o[e]=4*n[e].x+2*n[e+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 e=1;e<s-1;e+=1)o[e]=4*n[e].y+2*n[e+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 e=0;e<s;e+=1)i.push(new Vh(a[e],l[e])),e<s-1?r.push(new Vh(2*n[e+1].x-a[e+1],2*n[e+1].y-l[e+1])):r.push(new Vh((n[s].x+a[s-1])/2,(n[s].y+l[s-1])/2));return[i,r]}function i(e){if(null==e||Array.isArray(e)&&e.length<2)throw new Error("At least 2 points are required");const i=n(e),r=[];for(let n=0,s=i[0].length;n<s;n+=1){const s=new Vh(i[0][n].x,i[0][n].y),o=new Vh(i[1][n].x,i[1][n].y);r.push(new t(e[n],s,o,e[n+1]))}return r}t.throughPoints=i}(Yh||(Yh={}));class Zh extends Rh{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 Kh extends Zh{constructor(t,e){super(),Fh.isLine(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Vh.create(t,e).round(2)}get type(){return"L"}get line(){return new Fh(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 Kh(e[0]),new Kh(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[new Kh(e[0]),new Kh(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 Kh(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){function e(...e){const n=e.length,i=e[0];if(Fh.isLine(i))return new t(i);if(Vh.isPointLike(i))return 1===n?new t(i):e.map(e=>new t(e));if(2===n)return new t(+e[0],+e[1]);const r=[];for(let s=0;s<n;s+=2){const n=+e[s],i=+e[s+1];r.push(new t(n,i))}return r}t.create=e})(Kh||(Kh={}));class Qh extends Zh{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 Fh(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 Kh(e[0]):this.clone(),new Kh(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[e[1].isDifferentiable()?new Kh(e[0]):this.clone(),new Kh(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 Qh}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}(function(t){function e(){return new t}t.create=e})(Qh||(Qh={}));class tu extends Zh{constructor(t,e){super(),this.isVisible=!1,this.isSubpathStart=!0,Fh.isLine(t)||Yh.isCurve(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Vh.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 tu(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){function e(...e){const n=e.length,i=e[0];if(Fh.isLine(i))return new t(i);if(Yh.isCurve(i))return new t(i);if(Vh.isPointLike(i)){if(1===n)return new t(i);const r=[];for(let i=0;i<n;i+=1)0===i?r.push(new t(e[i])):r.push(new Kh(e[i]));return r}if(2===n)return new t(+e[0],+e[1]);const r=[];for(let s=0;s<n;s+=2){const n=+e[s],i=+e[s+1];0===s?r.push(new t(n,i)):r.push(new Kh(n,i))}return r}t.create=e})(tu||(tu={}));class eu extends Zh{constructor(t,e,n,i,r,s){super(),Yh.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 Vh(t,e).round(2),this.controlPoint2=new Vh(n,i).round(2),this.endPoint=new Vh(r,s).round(2)):(this.controlPoint1=Vh.create(t).round(2),this.controlPoint2=Vh.create(e).round(2),this.endPoint=Vh.create(n).round(2))}get type(){return"C"}get curve(){return new Yh(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 eu(n[0]),new eu(n[1])]}divideAtLength(t,e={}){const n=this.curve.divideAtLength(t,e);return[new eu(n[0]),new eu(n[1])]}divideAtT(t){const e=this.curve.divideAtT(t);return[new eu(e[0]),new eu(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,i=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(i))}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 eu(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 nu(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function iu(t,e,n,i,r,s){const o=1/3,a=2/3;return[o*t+a*n,o*e+a*i,o*r+a*n,o*s+a*i,r,s]}function ru(t,e,n,i,r,s,o,a,l,c){const h=120*Math.PI/180,u=Math.PI/180*(+r||0);let d,g,f,p,m,y=[];if(c)g=c[0],f=c[1],p=c[2],m=c[3];else{d=nu(t,e,-u),t=d.x,e=d.y,d=nu(a,l,-u),a=d.x,l=d.y;const r=(t-a)/2,c=(e-l)/2;let h=r*r/(n*n)+c*c/(i*i);h>1&&(h=Math.sqrt(h),n*=h,i*=h);const y=n*n,b=i*i,v=(s===o?-1:1)*Math.sqrt(Math.abs((y*b-y*c*c-b*r*r)/(y*c*c+b*r*r)));p=v*n*c/i+(t+a)/2,m=v*-i*r/n+(e+l)/2,g=Math.asin((e-m)/i),f=Math.asin((l-m)/i),g=t<p?Math.PI-g:g,f=a<p?Math.PI-f:f,g<0&&(g=2*Math.PI+g),f<0&&(f=2*Math.PI+f),o&&g>f&&(g-=2*Math.PI),!o&&f>g&&(f-=2*Math.PI)}let b=f-g;if(Math.abs(b)>h){const t=f,e=a,s=l;f=g+h*(o&&f>g?1:-1),a=p+n*Math.cos(f),l=m+i*Math.sin(f),y=ru(a,l,n,i,r,0,o,e,s,[f,t,p,m])}b=f-g;const v=Math.cos(g),x=Math.sin(g),w=Math.cos(f),P=Math.sin(f),C=Math.tan(b/4),A=4/3*(n*C),O=4/3*(i*C),E=[t,e],M=[t+A*x,e-O*v],S=[a+A*P,l-O*w],T=[a,l];if(M[0]=2*E[0]-M[0],M[1]=2*E[1]-M[1],c)return[M,S,T].concat(y);{y=[M,S,T].concat(y).join().split(",");const t=[],e=y.length;for(let n=0;n<e;n+=1)t[n]=n%2?nu(+y[n-1],+y[n],u).y:nu(+y[n],+y[n+1],u).x;return t}}function su(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"),i=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${e}]*,?[${e}]*`,"ig"),r={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(i,(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=r[a];while(o.length>=l)if(s.push([e,...o.splice(0,l)]),!l)break;return t}),s}function ou(t){const e=su(t);if(!e||!e.length)return[["M",0,0]];let n=0,i=0,r=0,s=0;const o=[];for(let a=0,l=e.length;a<l;a+=1){const t=[];o.push(t);const l=e[a],c=l[0];if(c!==c.toUpperCase())switch(t[0]=c.toUpperCase(),t[0]){case"A":t[1]=l[1],t[2]=l[2],t[3]=l[3],t[4]=l[4],t[5]=l[5],t[6]=+l[6]+n,t[7]=+l[7]+i;break;case"V":t[1]=+l[1]+i;break;case"H":t[1]=+l[1]+n;break;case"M":r=+l[1]+n,s=+l[2]+i;for(let e=1,r=l.length;e<r;e+=1)t[e]=+l[e]+(e%2?n:i);break;default:for(let e=1,r=l.length;e<r;e+=1)t[e]=+l[e]+(e%2?n:i);break}else for(let e=0,n=l.length;e<n;e+=1)t[e]=l[e];switch(t[0]){case"Z":n=+r,i=+s;break;case"H":n=t[1];break;case"V":i=t[1];break;case"M":r=t[t.length-2],s=t[t.length-1],n=t[t.length-2],i=t[t.length-1];break;default:n=t[t.length-2],i=t[t.length-1];break}}return o}function au(t){const e=ou(t),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function i(t,e,n){let i,r;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(ru.apply(0,[e.x,e.y].concat(t.slice(1))));case"S":return"C"===n||"S"===n?(i=2*e.x-e.bx,r=2*e.y-e.by):(i=e.x,r=e.y),["C",i,r].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(iu(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(iu(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]);case"L":break;case"Z":break;default:break}return t}function r(t,n){if(t[n].length>7){t[n].shift();const i=t[n];while(i.length)s[n]="A",n+=1,t.splice(n,0,["C"].concat(i.splice(0,6)));t.splice(n,1),a=e.length}}const s=[];let o="",a=e.length;for(let l=0;l<a;l+=1){let t="";e[l]&&(t=e[l][0]),"C"!==t&&(s[l]=t,l>0&&(o=s[l-1])),e[l]=i(e[l],n,o),"A"!==s[l]&&"C"===t&&(s[l]="C"),r(e,l);const a=e[l],c=a.length;n.x=a[c-2],n.y=a[c-1],n.bx=parseFloat(a[c-4])||n.x,n.by=parseFloat(a[c-3])||n.y}return e[0][0]&&"M"===e[0][0]||e.unshift(["M",0,0]),e}function lu(t){return au(t).map(t=>t.map(t=>"string"===typeof t?t:Ih.round(t,2))).join(",").split(",").join(" ")}(function(t){function e(...e){const n=e.length,i=e[0];if(Yh.isCurve(i))return new t(i);if(Vh.isPointLike(i)){if(3===n)return new t(e[0],e[1],e[2]);const i=[];for(let r=0;r<n;r+=3)i.push(new t(e[r],e[r+1],e[r+2]));return i}if(6===n)return new t(e[0],e[1],e[2],e[3],e[4],e[5]);const r=[];for(let s=0;s<n;s+=6)r.push(new t(e[s],e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]));return r}t.create=e})(eu||(eu={}));class cu extends Rh{constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t))if(Fh.isLine(t[0])||Yh.isCurve(t[0])){let e=null;const n=t;n.forEach((t,n)=>{0===n&&this.appendSegment(cu.createSegment("M",t.start)),null==e||e.end.equals(t.start)||this.appendSegment(cu.createSegment("M",t.start)),Fh.isLine(t)?this.appendSegment(cu.createSegment("L",t.end)):Yh.isCurve(t)&&this.appendSegment(cu.createSegment("C",t.controlPoint1,t.controlPoint2,t.end)),e=t})}else{const e=t;e.forEach(t=>{t.isSegment&&this.appendSegment(t)})}else null!=t&&(Fh.isLine(t)?(this.appendSegment(cu.createSegment("M",t.start)),this.appendSegment(cu.createSegment("L",t.end))):Yh.isCurve(t)?(this.appendSegment(cu.createSegment("M",t.start)),this.appendSegment(cu.createSegment("C",t.controlPoint1,t.controlPoint2,t.end))):_h.isPolyline(t)?t.points&&t.points.length&&t.points.forEach((t,e)=>{const n=0===e?cu.createSegment("M",t):cu.createSegment("L",t);this.appendSegment(n)}):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(tu.create.call(null,...t))}lineTo(...t){return this.appendSegment(Kh.create.call(null,...t))}curveTo(...t){return this.appendSegment(eu.create.call(null,...t))}arcTo(t,e,n,i,r,s,o){const a=this.end||new Vh,l="number"===typeof s?Jh(a.x,a.y,t,e,n,i,r,s,o):Jh(a.x,a.y,t,e,n,i,r,s.x,s.y);if(null!=l)for(let c=0,h=l.length;c<h;c+=6)this.curveTo(l[c],l[c+1],l[c+2],l[c+3],l[c+4],l[c+5]);return this}quadTo(t,e,n,i){const r=this.end||new Vh,s=["M",r.x,r.y];if("number"===typeof t)s.push("Q",t,e,n,i);else{const n=e;s.push("Q",t.x,t.y,n.x,n.y)}const o=cu.parse(s.join(" "));return this.appendSegment(o.segments.slice(1)),this}close(){return this.appendSegment(Qh.create())}drawPoints(t,e={}){const n=Wh(t,e),i=cu.parse(n);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 i=t[e-1];return new zh(i.end.x,i.end.y,0,0)}appendSegment(t){const e=this.segments.length;let n,i=0!==e?this.segments[e-1]:null;const r=null;if(Array.isArray(t))for(let s=0,o=t.length;s<o;s+=1){const e=t[s];n=this.prepareSegment(e,i,r),this.segments.push(n),i=n}else null!=t&&t.isSegment&&(n=this.prepareSegment(t,i,r),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 i,r=null,s=null;if(0!==n&&(t>=1?(r=this.segments[t-1],s=r.nextSegment):(r=null,s=this.segments[0])),Array.isArray(e))for(let o=0,a=e.length;o<a;o+=1){const n=e[o];i=this.prepareSegment(n,r,s),this.segments.splice(t+o,0,i),r=i}else i=this.prepareSegment(e,r,s),this.segments.splice(t,0,i);return this}removeSegment(t){const e=this.fixIndex(t),n=this.segments.splice(e,1)[0],i=n.previousSegment,r=n.nextSegment;return i&&(i.nextSegment=r),r&&(r.previousSegment=i),n.isSubpathStart&&r&&this.updateSubpathStartSegment(r),n}replaceSegment(t,e){const n=this.fixIndex(t);let i;const r=this.segments[n];let s=r.previousSegment;const o=r.nextSegment;let a=r.isSubpathStart;if(Array.isArray(e)){this.segments.splice(t,1);for(let n=0,r=e.length;n<r;n+=1){const r=e[n];i=this.prepareSegment(r,s,o),this.segments.splice(t+n,0,i),s=i,a&&i.isSubpathStart&&(a=!1)}}else i=this.prepareSegment(e,s,o),this.segments.splice(n,1,i),a&&i.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;while(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(t,e={}){if(0===this.segments.length)return null;const n=Ih.clamp(t,0,1),i=this.getOptions(e),r=this.length(i),s=r*n;return this.segmentIndexAtLength(s,i)}segmentIndexAtLength(t,e={}){const n=this.segments.length;if(0===n)return null;let i=!0;t<0&&(i=!1,t=-t);const r=this.getPrecision(e),s=this.getSubdivisions(e);let o=0,a=null;for(let l=0;l<n;l+=1){const e=i?l:n-1-l,c=this.segments[e],h=s[e],u=c.length({precision:r,subdivisions:h});if(c.isVisible){if(t<=o+u)return e;a=e}o+=u}return a}getSegmentSubdivisions(t={}){const e=this.getPrecision(t),n=[];for(let i=0,r=this.segments.length;i<r;i+=1){const t=this.segments[i],r=t.getSubdivisions({precision:e});n.push(r)}return n}updateSubpathStartSegment(t){let e=t.previousSegment,n=t;while(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 i=t;return t.isSubpathStart&&(t.subpathStartSegment=t,i=n),null!=i&&this.updateSubpathStartSegment(i),t}closestPoint(t,e={}){const n=this.closestPointT(t,e);return n?this.pointAtT(n):null}closestPointLength(t,e={}){const n=this.getOptions(e),i=this.closestPointT(t,n);return i?this.lengthAtT(i,n):0}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),i=this.closestPointLength(t,n);if(0===i)return 0;const r=this.length(n);return 0===r?0:i/r}closestPointT(t,e={}){if(0===this.segments.length)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let r,s=1/0;for(let o=0,a=this.segments.length;o<a;o+=1){const e=this.segments[o],a=i[o];if(e.isVisible){const i=e.closestPointT(t,{precision:n,subdivisions:a}),l=e.pointAtT(i),c=Ih.squaredLength(l,t);c<s&&(r={segmentIndex:o,value:i},s=c)}}return r||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(t,e={}){if(0===this.segments.length)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let r,s=1/0;for(let o=0,a=this.segments.length;o<a;o+=1){const e=this.segments[o],a=i[o];if(e.isDifferentiable()){const i=e.closestPointT(t,{precision:n,subdivisions:a}),o=e.pointAtT(i),l=Ih.squaredLength(o,t);l<s&&(r=e.tangentAtT(i),s=l)}}return r||null}containsPoint(t,e={}){const n=this.toPolylines(e);if(!n)return!1;let i=0;for(let r=0,s=n.length;r<s;r+=1){const e=n[r];e.containsPoint(t)&&(i+=1)}return i%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),i=this.length(n),r=i*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 i=this.getPrecision(e),r=this.getSubdivisions(e);let s,o=0;for(let l=0,c=this.segments.length;l<c;l+=1){const e=n?l:c-1-l,a=this.segments[e],h=r[e],u=a.length({precision:i,subdivisions:h});if(a.isVisible){if(t<=o+u)return a.pointAtLength((n?1:-1)*(t-o),{precision:i,subdivisions:h});s=a}o+=u}if(s)return n?s.end:s.start;const a=this.segments[this.segments.length-1];return a.end.clone()}pointAtT(t){const e=this.segments,n=e.length;if(0===n)return null;const i=t.segmentIndex;if(i<0)return e[0].pointAtT(0);if(i>=n)return e[n-1].pointAtT(1);const r=Ih.clamp(t.value,0,1);return e[i].pointAtT(r)}divideAt(t,e={}){if(0===this.segments.length)return null;const n=Ih.clamp(t,0,1),i=this.getOptions(e),r=this.length(i),s=r*n;return this.divideAtLength(s,i)}divideAtLength(t,e={}){if(0===this.segments.length)return null;let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),r=this.getSubdivisions(e);let s,o,a,l,c,h=0;for(let x=0,w=this.segments.length;x<w;x+=1){const e=n?x:w-1-x,c=this.getSegment(e),u=r[e],d={precision:i,subdivisions:u},g=c.length(d);if(c.isDifferentiable()&&(a=c,l=e,t<=h+g)){o=e,s=c.divideAtLength((n?1:-1)*(t-h),d);break}h+=g}if(!a)return null;s||(o=l,c=n?1:0,s=a.divideAtT(c));const u=this.clone(),d=o;u.replaceSegment(d,s);const g=d;let f=d+1,p=d+2;s[0].isDifferentiable()||(u.removeSegment(g),f-=1,p-=1);const m=u.getSegment(f).start;u.insertSegment(f,cu.createSegment("M",m)),p+=1,s[1].isDifferentiable()||(u.removeSegment(p-1),p-=1);const y=p-g-1;for(let x=p,w=u.segments.length;x<w;x+=1){const t=this.getSegment(x-y),e=u.getSegment(x);if("Z"===e.type&&!t.subpathStartSegment.end.equals(e.subpathStartSegment.end)){const e=cu.createSegment("L",t.end);u.replaceSegment(x,e)}}const b=new cu(u.segments.slice(0,f)),v=new cu(u.segments.slice(f));return[b,v]}intersectsWithLine(t,e={}){const n=this.toPolylines(e);if(null==n)return null;let i=null;for(let r=0,s=n.length;r<s;r+=1){const e=n[r],s=t.intersect(e);s&&(null==i&&(i=[]),Array.isArray(s)?i.push(...s):i.push(s))}return i}isDifferentiable(){for(let t=0,e=this.segments.length;t<e;t+=1){const e=this.segments[t];if(e.isDifferentiable())return!0}return!1}isValid(){const t=this.segments,e=0===t.length||"M"===t[0].type;return e}length(t={}){if(0===this.segments.length)return 0;const e=this.getSubdivisions(t);let n=0;for(let i=0,r=this.segments.length;i<r;i+=1){const t=this.segments[i],r=e[i];n+=t.length({subdivisions:r})}return n}lengthAtT(t,e={}){const n=this.segments.length;if(0===n)return 0;let i=t.segmentIndex;if(i<0)return 0;let r=Ih.clamp(t.value,0,1);i>=n&&(i=n-1,r=1);const s=this.getPrecision(e),o=this.getSubdivisions(e);let a=0;for(let h=0;h<i;h+=1){const t=this.segments[h],e=o[h];a+=t.length({precision:s,subdivisions:e})}const l=this.segments[i],c=o[i];return a+=l.lengthAtT(r,{precision:s,subdivisions:c}),a}tangentAt(t,e={}){if(0===this.segments.length)return null;const n=Ih.clamp(t,0,1),i=this.getOptions(e),r=this.length(i),s=r*n;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 i=this.getPrecision(e),r=this.getSubdivisions(e);let s,o=0;for(let a=0,l=this.segments.length;a<l;a+=1){const e=n?a:l-1-a,c=this.segments[e],h=r[e],u=c.length({precision:i,subdivisions:h});if(c.isDifferentiable()){if(t<=o+u)return c.tangentAtLength((n?1:-1)*(t-o),{precision:i,subdivisions:h});s=c}o+=u}if(s){const t=n?1:0;return s.tangentAtT(t)}return null}tangentAtT(t){const e=this.segments.length;if(0===e)return null;const n=t.segmentIndex;if(n<0)return this.segments[0].tangentAtT(0);if(n>=e)return this.segments[e-1].tangentAtT(1);const i=Ih.clamp(t.value,0,1);return this.segments[n].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={}){const e=this.getPrecision(t),n=this.getSubdivisions(t);return{precision:e,segmentSubdivisions:n}}toPoints(t={}){const e=this.segments,n=e.length;if(0===n)return null;const i=this.getSubdivisions(t),r=[];let s=[];for(let o=0;o<n;o+=1){const t=e[o];if(t.isVisible){const e=i[o];e.length>0?e.forEach(t=>s.push(t.start)):s.push(t.start)}else s.length>0&&(s.push(e[o-1].end),r.push(s),s=[])}return s.length>0&&(s.push(this.end),r.push(s)),r}toPolylines(t={}){const e=this.toPoints(t);return e?e.map(t=>new _h(t)):null}scale(t,e,n){return this.segments.forEach(i=>i.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 cu;return this.segments.forEach(e=>t.appendSegment(e.clone())),t}equals(t){if(null==t)return!1;const e=this.segments,n=t.segments,i=e.length;if(n.length!==i)return!1;for(let r=0;r<i;r+=1){const t=e[r],i=n[r];if(t.type!==i.type||!t.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){function e(e){return null!=e&&e instanceof t}t.isPath=e})(cu||(cu={})),function(t){function e(e){if(!e)return new t;const i=new t,r=/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g,s=t.normalize(e).match(r);if(null!=s)for(let t=0,o=s.length;t<o;t+=1){const e=s[t],r=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,o=e.match(r);if(null!=o){const t=o[0],e=o.slice(1).map(t=>+t),r=n.call(null,t,...e);i.appendSegment(r)}}return i}function n(t,...e){if("M"===t)return tu.create.call(null,...e);if("L"===t)return Kh.create.call(null,...e);if("C"===t)return eu.create.call(null,...e);if("z"===t||"Z"===t)return Qh.create();throw new Error(`Invalid path segment type "${t}"`)}t.parse=e,t.createSegment=n}(cu||(cu={})),function(t){t.normalize=lu,t.isValid=qh,t.drawArc=Xh,t.drawPoints=Wh,t.arcToCurves=Jh}(cu||(cu={}));class hu{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(t,e,n=!1){if("object"===typeof t)return void Object.entries(t).forEach(([t,n])=>{this.register(t,n,e)});!this.exist(t)||n||Ha.isApplyingHMR()||this.onDuplicated(t);const r=this.options.process,s=r?i.call(r,this,t,e):e;return this.data[t]=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&&i.call(this.options.onConflict,this,t),new Error(`${o.upperFirst(this.options.type)} with name '${t}' already registered.`)}catch(Yy){throw Yy}}onNotFound(t,e){throw new Error(this.getSpellingSuggestion(t,e))}getSpellingSuggestion(t,e){const n=this.getSpellingSuggestionForName(t),i=e?`${e} ${o.lowerFirst(this.options.type)}`:this.options.type;return`${o.upperFirst(i)} with name '${t}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(t){return o.getSpellingSuggestion(t,Object.keys(this.data),t=>t)}}(function(t){function e(e){return new t(e)}t.create=e})(hu||(hu={}));const uu={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.thickness*e.sx,i=e.thickness*e.sy;c.attr(t,{width:n,height:i,rx:n,ry:i,fill:e.color})}},du={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.sx<=1?e.thickness*e.sx:e.thickness;c.attr(t,{width:n,height:n,rx:n,ry:n,fill:e.color})}},gu={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const i=e.width,r=e.height,s=e.thickness;n=i-s>=0&&r-s>=0?["M",i,0,"H0 M0 0 V0",r].join(" "):"M 0 0 0 0",c.attr(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}},fu=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const i=e.width,r=e.height,s=e.thickness;n=i-s>=0&&r-s>=0?["M",i,0,"H0 M0 0 V0",r].join(" "):"M 0 0 0 0",c.attr(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 i=e.factor||1,r=e.width*i,s=e.height*i,o=e.thickness;n=r-o>=0&&s-o>=0?["M",r,0,"H0 M0 0 V0",s].join(" "):"M 0 0 0 0",e.width=r,e.height=s,c.attr(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}}];class pu{constructor(){this.patterns={},this.root=fc.create(c.createSvgDocument(),{width:"100%",height:"100%"},[c.createSvgElement("defs")]).node}add(t,e){const n=this.root.childNodes[0];n&&n.appendChild(e),this.patterns[t]=e,fc.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=u,t.registry=hu.create({type:"grid"}),t.registry.register(t.presets,!0)})(pu||(pu={}));const mu=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=2*n,e.height=i;const r=e.getContext("2d");return r.drawImage(t,0,0,n,i),r.translate(2*n,0),r.scale(-1,1),r.drawImage(t,0,0,n,i),e},yu=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=n,e.height=2*i;const r=e.getContext("2d");return r.drawImage(t,0,0,n,i),r.translate(0,2*i),r.scale(1,-1),r.drawImage(t,0,0,n,i),e},bu=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=2*n,e.height=2*i;const r=e.getContext("2d");return r.drawImage(t,0,0,n,i),r.setTransform(-1,0,0,-1,e.width,e.height),r.drawImage(t,0,0,n,i),r.setTransform(-1,0,0,1,e.width,0),r.drawImage(t,0,0,n,i),r.setTransform(1,0,0,-1,0,e.height),r.drawImage(t,0,0,n,i),e},vu=function(t,e){const n=t.width,i=t.height,r=document.createElement("canvas");r.width=3*n,r.height=3*i;const s=r.getContext("2d"),o=null!=e.angle?-e.angle:-20,a=Dh.toRad(o),l=r.width/4,c=r.height/4;for(let h=0;h<4;h+=1)for(let e=0;e<4;e+=1)(h+e)%2>0&&(s.setTransform(1,0,0,1,(2*h-1)*l,(2*e-1)*c),s.rotate(a),s.drawImage(t,-n/2,-i/2,n,i));return r};var xu,wu;function Pu(t,e){return null!=t?t:e}function Cu(t,e){return null!=t&&Number.isFinite(t)?t:e}function Au(t={}){const e=Pu(t.color,"blue"),n=Cu(t.width,1),i=Cu(t.margin,2),r=Cu(t.opacity,1),s=i,o=i+n;return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${r}" result="colored"/>\n <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${o}" />\n <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${s}" />\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()}function Ou(t={}){const e=Pu(t.color,"red"),n=Cu(t.blur,0),i=Cu(t.width,1),r=Cu(t.opacity,1);return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${r}" result="colored"/>\n <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${i}"/>\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()}function Eu(t={}){const e=Cu(t.x,2),n=null!=t.y&&Number.isFinite(t.y)?[e,t.y]:e;return`\n <filter>\n <feGaussianBlur stdDeviation="${n}"/>\n </filter>\n `.trim()}function Mu(t={}){const e=Cu(t.dx,0),n=Cu(t.dy,0),i=Pu(t.color,"black"),r=Cu(t.blur,4),s=Cu(t.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>\n <feDropShadow stdDeviation="${r}" dx="${e}" dy="${n}" flood-color="${i}" flood-opacity="${s}" />\n </filter>`.trim():`<filter>\n <feGaussianBlur in="SourceAlpha" stdDeviation="${r}" />\n <feOffset dx="${e}" dy="${n}" result="offsetblur" />\n <feFlood flood-color="${i}" />\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()}function Su(t={}){const e=Cu(t.amount,1),n=.2126+.7874*(1-e),i=.7152-.7152*(1-e),r=.0722-.0722*(1-e),s=.2126-.2126*(1-e),o=.7152+.2848*(1-e),a=.0722-.0722*(1-e),l=.2126-.2126*(1-e),c=.0722+.9278*(1-e);return`\n <filter>\n <feColorMatrix type="matrix" values="${n} ${i} ${r} 0 0 ${s} ${o} ${a} 0 0 ${l} ${i} ${c} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function Tu(t={}){const e=Cu(t.amount,1),n=.393+.607*(1-e),i=.769-.769*(1-e),r=.189-.189*(1-e),s=.349-.349*(1-e),o=.686+.314*(1-e),a=.168-.168*(1-e),l=.272-.272*(1-e),c=.534-.534*(1-e),h=.131+.869*(1-e);return`\n <filter>\n <feColorMatrix type="matrix" values="${n} ${i} ${r} 0 0 ${s} ${o} ${a} 0 0 ${l} ${c} ${h} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function Nu(t={}){const e=Cu(t.amount,1);return`\n <filter>\n <feColorMatrix type="saturate" values="${1-e}"/>\n </filter>\n `.trim()}function ku(t={}){const e=Cu(t.angle,0);return`\n <filter>\n <feColorMatrix type="hueRotate" values="${e}"/>\n </filter>\n `.trim()}function ju(t={}){const e=Cu(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()}function Lu(t={}){const e=Cu(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()}function Bu(t={}){const e=Cu(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()}(function(t){t.presets=Object.assign({},d),t.presets["flip-x"]=mu,t.presets["flip-y"]=yu,t.presets["flip-xy"]=bu,t.registry=hu.create({type:"background pattern"}),t.registry.register(t.presets,!0)})(xu||(xu={})),function(t){t.presets=g,t.registry=hu.create({type:"filter"}),t.registry.register(t.presets,!0)}(wu||(wu={}));const Du={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"},Iu={},Ru={position:od("x","width","origin")},Vu={position:od("y","height","origin")},zu={position:od("x","width","corner")},Fu={position:od("y","height","corner")},$u={set:ad("width","width")},Gu={set:ad("height","height")},qu={set:ad("rx","width")},Hu={set:ad("ry","height")},Uu={set:(t=>{const e=ad(t,"width"),n=ad(t,"height");return function(t,r){const s=r.refBBox,o=s.height>s.width?e:n;return i.call(o,this,t,r)}})("r")},Wu={set(t,{refBBox:e}){let n=parseFloat(t);const i=a.isPercentage(t);i&&(n/=100);const r=Math.sqrt(e.height*e.height+e.width*e.width);let s;return Number.isFinite(n)&&(s=i||n>=0&&n<=1?n*r:Math.max(n+r,0)),{r:s}}},Ju={set:ad("cx","width")},Xu={set:ad("cy","height")},_u={set:cd({resetOffset:!0})},Yu={set:cd({resetOffset:!1})},Zu={set:hd({resetOffset:!0})},Ku={set:hd({resetOffset:!1})},Qu=Uu,td=_u,ed=Zu,nd=Ru,id=Vu,rd=$u,sd=Gu;function od(t,e,n){return(i,{refBBox:r})=>{if(null==i)return null;let s=parseFloat(i);const o=a.isPercentage(i);let l;if(o&&(s/=100),Number.isFinite(s)){const i=r[n];l=o||s>0&&s<1?i[t]+r[e]*s:i[t]+s}const c=new Vh;return c[t]=l||0,c}}function ad(t,e){return function(n,{refBBox:i}){let r=parseFloat(n);const s=a.isPercentage(n);s&&(r/=100);const o={};if(Number.isFinite(r)){const n=s||r>=0&&r<=1?r*i[e]:Math.max(r+i[e],0);o[t]=n}return o}}function ld(t,e){const n="x6-shape",i=e&&e.resetOffset;return function(e,{elem:r,refBBox:s}){let o=c.data(r,n);if(!o||o.value!==e){const i=t(e);o={value:e,shape:i,shapeBBox:i.bbox()},c.data(r,n,o)}const a=o.shape.clone(),l=o.shapeBBox.clone(),h=l.getOrigin(),u=s.getOrigin();l.x=u.x,l.y=u.y;const d=s.getMaxScaleToFit(l,u),g=0===l.width||0===s.width?1:d.sx,f=0===l.height||0===s.height?1:d.sy;return a.scale(g,f,h),i&&a.translate(-h.x,-h.y),a}}function cd(t){function e(t){return cu.parse(t)}const n=ld(e,t);return(t,e)=>{const i=n(t,e);return{d:i.serialize()}}}function hd(t){const e=ld(t=>new _h(t),t);return(t,n)=>{const i=e(t,n);return{points:i.serialize()}}}const ud={qualify:r.isPlainObject,set(t,{view:e}){return`url(#${e.graph.defineGradient(t)})`}},dd={qualify:r.isPlainObject,set(t,{view:e}){const n=e.cell,i=Object.assign({},t);if(n.isEdge()&&"linearGradient"===i.type){const t=e,r=t.sourcePoint,s=t.targetPoint;i.id=`gradient-${i.type}-${n.id}`,i.attrs=Object.assign(Object.assign({},i.attrs),{x1:r.x,y1:r.y,x2:s.x,y2:s.y,gradientUnits:"userSpaceOnUse"}),e.graph.defs.remove(i.id)}return`url(#${e.graph.defineGradient(i)})`}},gd={qualify(t,{attrs:e}){return null==e.textWrap||!r.isPlainObject(e.textWrap)},set(t,{view:e,elem:n,attrs:i}){const r="x6-text",s=c.data(n,r),o=t=>{try{return JSON.parse(t)}catch(e){return t}},a={x:i.x,eol:i.eol,annotations:o(i.annotations),textPath:o(i["text-path"]||i.textPath),textVerticalAnchor:i["text-vertical-anchor"]||i.textVerticalAnchor,displayEmpty:"true"===(i["display-empty"]||i.displayEmpty),lineHeight:i["line-height"]||i.lineHeight},l=i["font-size"]||i.fontSize,h=JSON.stringify([t,a]);if(l&&n.setAttribute("font-size",l),null==s||s!==h){const i=a.textPath;if(null!=i&&"object"===typeof i){const t=i.selector;if("string"===typeof t){const n=e.find(t)[0];n instanceof SVGPathElement&&(c.ensureId(n),a.textPath=Object.assign({"xlink:href":"#"+n.id},i))}}c.text(n,""+t,a),c.data(n,r,h)}}},fd={qualify:r.isPlainObject,set(t,{view:e,elem:n,attrs:r,refBBox:s}){const o=t,l=o.width||0;a.isPercentage(l)?s.width*=parseFloat(l)/100:l<=0?s.width+=l:s.width=l;const h=o.height||0;let u;a.isPercentage(h)?s.height*=parseFloat(h)/100:h<=0?s.height+=h:s.height=h;let d=o.text;null==d&&(d=r.text||(null===n||void 0===n?void 0:n.textContent)),u=null!=d?c.breakText(""+d,s,{"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:o.ellipsis}):"",i.call(gd.set,this,u,{view:e,elem:n,attrs:r,refBBox:s,cell:e.cell})}},pd=(t,{attrs:e})=>void 0!==e.text,md={qualify:pd},yd={qualify:pd},bd={qualify:pd},vd={qualify:pd},xd={qualify:pd},wd={qualify:pd},Pd={qualify(t,{elem:e}){return e instanceof SVGElement},set(t,{elem:e}){const n="x6-title",i=""+t,r=c.data(e,n);if(null==r||r!==i){c.data(e,n,i);const t=e.firstChild;if(t&&"TITLE"===t.tagName.toUpperCase()){const e=t;e.textContent=i}else{const n=document.createElementNS(e.namespaceURI,"title");n.textContent=i,e.insertBefore(n,t)}}}},Cd={offset:Ed("x","width","right")},Ad={offset:Ed("y","height","bottom")},Od={offset(t,{refBBox:e}){return t?{x:-e.x,y:-e.y}:{x:0,y:0}}};function Ed(t,e,n){return(i,{refBBox:r})=>{const s=new Vh;let o;return o="middle"===i?r[e]/2:i===n?r[e]:"number"===typeof i&&Number.isFinite(i)?i>-1&&i<1?-r[e]*i:-i:a.isPercentage(i)?r[e]*parseFloat(i)/100:0,s[t]=-(r[t]+o),s}}const Md={qualify:r.isPlainObject,set(t,{elem:e}){c.css(e,t)}},Sd={set(t,{elem:e}){e.innerHTML=""+t}},Td={qualify:r.isPlainObject,set(t,{view:e}){return`url(#${e.graph.defineFilter(t)})`}},Nd={set(t){return null!=t&&"object"===typeof t&&t.id?t.id:t}};function kd(t,e,n){let i,r;"object"===typeof e?(i=e.x,r=e.y):(i=e,r=n);const s=cu.parse(t),o=s.bbox();if(o){let t=-o.height/2-o.y,e=-o.width/2-o.x;"number"===typeof i&&(e-=i),"number"===typeof r&&(t-=r),s.translate(e,t)}return s.serialize()}var jd=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const Ld=t=>{var{size:e,width:n,height:i,offset:r,open:s}=t,o=jd(t,["size","width","height","offset","open"]);return Dd({size:e,width:n,height:i,offset:r},!0===s,!0,void 0,o)},Bd=t=>{var{size:e,width:n,height:i,offset:r,factor:s}=t,o=jd(t,["size","width","height","offset","factor"]);return Dd({size:e,width:n,height:i,offset:r},!1,!1,s,o)};function Dd(t,e,n,i=3/4,r={}){const s=t.size||10,o=t.width||s,l=t.height||s,c=new cu,h={};if(e)c.moveTo(o,0).lineTo(0,l/2).lineTo(o,l),h.fill="none";else{if(c.moveTo(0,l/2),c.lineTo(o,0),!n){const t=a.clamp(i,0,1);c.lineTo(o*t,l/2)}c.lineTo(o,l),c.close()}return Object.assign(Object.assign(Object.assign({},h),r),{tagName:"path",d:kd(c.serialize(),{x:null!=t.offset?t.offset:-o/2})})}var Id=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const Rd=t=>{var{size:e,width:n,height:i,offset:r}=t,s=Id(t,["size","width","height","offset"]);const o=e||10,a=n||o,l=i||o,c=new cu;return c.moveTo(0,l/2).lineTo(a/2,0).lineTo(a,l/2).lineTo(a/2,l).close(),Object.assign(Object.assign({},s),{tagName:"path",d:kd(c.serialize(),null==r?-a/2:r)})};var Vd=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const zd=t=>{var{d:e,offsetX:n,offsetY:i}=t,r=Vd(t,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},r),{tagName:"path",d:kd(e,n,i)})};var Fd=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const $d=t=>{var{size:e,width:n,height:i,offset:r}=t,s=Fd(t,["size","width","height","offset"]);const o=e||10,a=n||o,l=i||o,c=new cu;return c.moveTo(0,0).lineTo(a,l).moveTo(0,l).lineTo(a,0),Object.assign(Object.assign({},s),{tagName:"path",fill:"none",d:kd(c.serialize(),r||-a/2)})};var Gd=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const qd=t=>{var{width:e,height:n,offset:i,open:r,flip:s}=t,o=Gd(t,["width","height","offset","open","flip"]);let a=n||6;const l=e||10,c=!0===r,h=!0===s,u=Object.assign(Object.assign({},o),{tagName:"path"});h&&(a=-a);const d=new cu;return d.moveTo(0,a).lineTo(l,0),c?u.fill="none":(d.lineTo(l,a),d.close()),u.d=kd(d.serialize(),{x:i||-l/2,y:a/2}),u};var Hd=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const Ud=t=>{var{r:e}=t,n=Hd(t,["r"]);const i=e||5;return Object.assign(Object.assign({cx:i},n),{tagName:"circle",r:i})},Wd=t=>{var{r:e}=t,n=Hd(t,["r"]);const i=e||5,r=new cu;return r.moveTo(i,0).lineTo(i,2*i),r.moveTo(0,i).lineTo(2*i,i),{children:[Object.assign(Object.assign({},Ud({r:i})),{fill:"none"}),Object.assign(Object.assign({},n),{tagName:"path",d:kd(r.serialize(),-i)})]}};var Jd=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const Xd=t=>{var{rx:e,ry:n}=t,i=Jd(t,["rx","ry"]);const r=e||5,s=n||5;return Object.assign(Object.assign({cx:r},i),{tagName:"ellipse",rx:r,ry:s})};var _d;(function(t){t.presets=f,t.registry=hu.create({type:"marker"}),t.registry.register(t.presets,!0)})(_d||(_d={})),function(t){t.normalize=kd}(_d||(_d={}));var Yd=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};function Zd(t){return"string"===typeof t||r.isPlainObject(t)}const Kd={qualify:Zd,set(t,{view:e,attrs:n}){return eg("marker-start",t,e,n)}},Qd={qualify:Zd,set(t,{view:e,attrs:n}){return eg("marker-end",t,e,n,{transform:"rotate(180)"})}},tg={qualify:Zd,set(t,{view:e,attrs:n}){return eg("marker-mid",t,e,n)}};function eg(t,e,n,i,r={}){const s="string"===typeof e?{name:e}:e,{name:o,args:a}=s,l=Yd(s,["name","args"]);let c=l;if(o&&"string"===typeof o){const t=_d.registry.get(o);if(!t)return _d.registry.onNotFound(o);c=t(Object.assign(Object.assign({},l),a))}const h=Object.assign(Object.assign(Object.assign({},ng(i,t)),r),c);return{[t]:`url(#${n.graph.defineMarker(h)})`}}function ng(t,e){const n={},i=t.stroke;"string"===typeof i&&(n.stroke=i,n.fill=i);let r=t.strokeOpacity;if(null==r&&(r=t["stroke-opacity"]),null==r&&(r=t.opacity),null!=r&&(n["stroke-opacity"]=r,n["fill-opacity"]=r),"marker-mid"!==e){const i=parseFloat(t.strokeWidth||t["stroke-width"]);if(Number.isFinite(i)&&i>1){const t=Math.ceil(i/2);n.refX="marker-start"===e?t:-t}}return n}const ig=(t,{view:e})=>e.cell.isEdge(),rg={qualify:ig,set(t,e){var n,i,r,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===(r=null===(i=null===(n=null===h||void 0===h?void 0:h.divideAtLength(t))||void 0===n?void 0:n[1])||void 0===i?void 0:i.divideAtLength(e))||void 0===r?void 0:r[0])||void 0===s?void 0:s.serialize()}else{let t;if(l<0){const e=o.getConnectionLength()||0;t=(e+l)/2}else t=l;const e=o.getConnection();if(e){const n=e.divideAtLength(t),i=e.divideAtLength(-t);n&&i&&(c=`${n[0].serialize()} ${i[1].serialize()}`)}}return{d:c||o.getConnectionPathData()}}},sg={qualify:ig,set:ug("getTangentAtLength",{rotate:!0})},og={qualify:ig,set:ug("getTangentAtLength",{rotate:!1})},ag={qualify:ig,set:ug("getTangentAtRatio",{rotate:!0})},lg={qualify:ig,set:ug("getTangentAtRatio",{rotate:!1})},cg=sg,hg=ag;function ug(t,e){const n={x:1,y:0};return(i,r)=>{let s,o;const a=r.view,l=a[t](Number(i));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 dg;(function(t){function e(t,e,n){if(null!=t){if("string"===typeof t)return!0;if("function"!==typeof t.qualify||i.call(t.qualify,this,e,n))return!0}return!1}t.isValidDefinition=e})(dg||(dg={})),function(t){t.presets=Object.assign(Object.assign({},Du),p),t.registry=hu.create({type:"attribute definition"}),t.registry.register(t.presets,!0)}(dg||(dg={}));const gg={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix(t){return`${gg.prefixCls}-${t}`}},fg=gg.prefix("highlighted"),pg={highlight(t,e,n){const i=n&&n.className||fg;c.addClass(e,i)},unhighlight(t,e,n){const i=n&&n.className||fg;c.removeClass(e,i)}},mg=gg.prefix("highlight-opacity"),yg={highlight(t,e){c.addClass(e,mg)},unhighlight(t,e){c.removeClass(e,mg)}};var bg;(function(t){function e(t,e){const n=c.createSVGPoint(t.x,t.y).matrixTransform(e);return new Vh(n.x,n.y)}function n(t,n){return new Fh(e(t.start,n),e(t.end,n))}function i(t,n){let i=t instanceof _h?t.points:t;return Array.isArray(i)||(i=[]),new _h(i.map(t=>e(t,n)))}function r(t,e){const n=c.createSvgElement("svg"),i=n.createSVGPoint();i.x=t.x,i.y=t.y;const r=i.matrixTransform(e);i.x=t.x+t.width,i.y=t.y;const s=i.matrixTransform(e);i.x=t.x+t.width,i.y=t.y+t.height;const o=i.matrixTransform(e);i.x=t.x,i.y=t.y+t.height;const a=i.matrixTransform(e),l=Math.min(r.x,s.x,o.x,a.x),h=Math.max(r.x,s.x,o.x,a.x),u=Math.min(r.y,s.y,o.y,a.y),d=Math.max(r.y,s.y,o.y,a.y);return new zh(l,u,h-l,d-u)}function s(t,e,n){let i;const s=t.ownerSVGElement;if(!s)return new zh(0,0,0,0);try{i=t.getBBox()}catch(a){i={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}if(e)return zh.create(i);const o=c.getTransformToElement(t,n||s);return r(i,o)}function o(t,e={}){let n;const i=t.ownerSVGElement;if(!i||!c.isSVGGraphicsElement(t)){if(c.isHTMLElement(t)){const{left:e,top:n,width:i,height:r}=a(t);return new zh(e,n,i,r)}return new zh(0,0,0,0)}let s=e.target;const l=e.recursive;if(!l){try{n=t.getBBox()}catch(h){n={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}if(!s)return zh.create(n);const e=c.getTransformToElement(t,s);return r(n,e)}{const e=t.childNodes,i=e.length;if(0===i)return o(t,{target:s});s||(s=t);for(let t=0;t<i;t+=1){const i=e[t];let r;r=0===i.childNodes.length?o(i,{target:s}):o(i,{target:s,recursive:!0}),n=n?n.union(r):r}return n}}function a(t){let e=0,n=0,i=0,r=0;if(t){let s=t;while(s)e+=s.offsetLeft,n+=s.offsetTop,s=s.offsetParent,s&&(e+=parseInt(c.getComputedStyle(s,"borderLeft"),10),n+=parseInt(c.getComputedStyle(s,"borderTop"),10));i=t.offsetWidth,r=t.offsetHeight}return{left:e,top:n,width:i,height:r}}function l(t){const e=e=>{const n=t.getAttribute(e),i=n?parseFloat(n):0;return Number.isNaN(i)?0:i};switch(t instanceof SVGElement&&t.nodeName.toLowerCase()){case"rect":return new zh(e("x"),e("y"),e("width"),e("height"));case"circle":return new $h(e("cx"),e("cy"),e("r"),e("r"));case"ellipse":return new $h(e("cx"),e("cy"),e("rx"),e("ry"));case"polyline":{const e=c.getPointsFromSvgElement(t);return new _h(e)}case"polygon":{const e=c.getPointsFromSvgElement(t);return e.length>1&&e.push(e[0]),new _h(e)}case"path":{let e=t.getAttribute("d");return cu.isValid(e)||(e=cu.normalize(e)),cu.parse(e)}case"line":return new Fh(e("x1"),e("y1"),e("x2"),e("y2"));default:break}return o(t)}function h(t,e,n,i){const r=Vh.create(e),s=Vh.create(n);if(!i){const e=t instanceof SVGSVGElement?t:t.ownerSVGElement;i=e}const a=c.scale(t);t.setAttribute("transform","");const l=o(t,{target:i}).scale(a.sx,a.sy),h=c.createSVGTransform();h.setTranslate(-l.x-l.width/2,-l.y-l.height/2);const u=c.createSVGTransform(),d=r.angleBetween(s,r.clone().translate(1,0));d&&u.setRotate(d,0,0);const g=c.createSVGTransform(),f=r.clone().move(s,l.width/2);g.setTranslate(2*r.x-f.x,2*r.y-f.y);const p=c.getTransformToElement(t,i),m=c.createSVGTransform();m.setMatrix(g.matrix.multiply(u.matrix.multiply(h.matrix.multiply(p.scale(a.sx,a.sy))))),t.setAttribute("transform",c.matrixToTransformString(m.matrix))}function u(t){if(null==t)return null;let e=t;do{let t=e.tagName;if("string"!==typeof t)return null;if(t=t.toUpperCase(),c.hasClass(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}function d(t){const e=u(t);if(!c.isSVGGraphicsElement(e)){if(c.isHTMLElement(t)){const{left:e,top:n,width:i,height:r}=a(t);return new zh(e,n,i,r)}return new zh(0,0,0,0)}const n=l(e),i=n.bbox()||zh.create();return i}t.normalizeMarker=kd,t.transformPoint=e,t.transformLine=n,t.transformPolyline=i,t.transformRectangle=r,t.bbox=s,t.getBBox=o,t.getBoundingOffsetRect=a,t.toGeometryShape=l,t.translateAndAutoOrient=h,t.findShapeNode=u,t.getBBoxV2=d})(bg||(bg={}));const vg={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},xg={highlight(t,e,n){const i=wg.getHighlighterId(e,n);if(wg.hasCache(i))return;n=r.defaultsDeep({},n,vg);const s=fc.create(e);let o,a;try{o=s.toPathData()}catch(d){a=bg.bbox(s.node,!0),o=c.rectToPathData(Object.assign(Object.assign({},n),a))}const l=c.createSvgElement("path");if(c.attr(l,Object.assign({d:o,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},n.attrs?c.kebablizeAttrs(n.attrs):null)),t.isEdgeElement(e))c.attr(l,"d",t.getConnectionPathData());else{let e=s.getTransformToElement(t.container);const i=n.padding;if(i){null==a&&(a=bg.bbox(s.node,!0));const t=a.x+a.width/2,n=a.y+a.height/2;a=bg.transformRectangle(a,e);const r=Math.max(a.width,1),o=Math.max(a.height,1),l=(r+i)/r,h=(o+i)/o,u=c.createSVGMatrix({a:l,b:0,c:0,d:h,e:t-l*t,f:n-h*n});e=e.multiply(u)}c.transform(l,e)}c.addClass(l,gg.prefix("highlight-stroke"));const h=t.cell,u=()=>wg.removeHighlighter(i);h.on("removed",u),h.model&&h.model.on("reseted",u),t.container.appendChild(l),wg.setCache(i,l)},unhighlight(t,e,n){wg.removeHighlighter(wg.getHighlighterId(e,n))}};var wg,Pg;function Cg(t,e={}){return new Vh(a.normalizePercentage(e.x,t.width),a.normalizePercentage(e.y,t.height))}function Ag(t,e,n){return Object.assign({angle:e,position:t.toJSON()},n)}(function(t){function e(t,e){return c.ensureId(t),t.id+JSON.stringify(e)}t.getHighlighterId=e;const n={};function i(t,e){n[t]=e}function r(t){return null!=n[t]}function s(t){const e=n[t];e&&(c.remove(e),delete n[t])}t.setCache=i,t.hasCache=r,t.removeHighlighter=s})(wg||(wg={})),function(t){function e(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`)}t.check=e}(Pg||(Pg={})),function(t){t.presets=m,t.registry=hu.create({type:"highlighter"}),t.registry.register(t.presets,!0)}(Pg||(Pg={}));const Og=(t,e)=>t.map(({x:t,y:n,angle:i})=>Ag(Cg(e,{x:t,y:n}),i||0)),Eg=(t,e,n)=>{const i=n.start||0,r=n.step||20;return Sg(t,e,i,(t,e)=>(t+.5-e/2)*r)},Mg=(t,e,n)=>{const i=n.start||0,r=n.step||360/t.length;return Sg(t,e,i,t=>t*r)};function Sg(t,e,n,i){const r=e.getCenter(),s=e.getTopCenter(),o=e.width/e.height,a=$h.fromRect(e),l=t.length;return t.map((t,e)=>{const c=n+i(e,l),h=s.clone().rotate(-c,r).scale(o,1,r),u=t.compensateRotate?-a.tangentTheta(h):0;return(t.dx||t.dy)&&h.translate(t.dx||0,t.dy||0),t.dr&&h.move(r,t.dr),Ag(h.round(),u,t)})}var Tg=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const Ng=(t,e,n)=>{const i=Cg(e,n.start||e.getOrigin()),r=Cg(e,n.end||e.getCorner());return Dg(t,i,r,n)},kg=(t,e,n)=>Dg(t,e.getTopLeft(),e.getBottomLeft(),n),jg=(t,e,n)=>Dg(t,e.getTopRight(),e.getBottomRight(),n),Lg=(t,e,n)=>Dg(t,e.getTopLeft(),e.getTopRight(),n),Bg=(t,e,n)=>Dg(t,e.getBottomLeft(),e.getBottomRight(),n);function Dg(t,e,n,i){const r=new Fh(e,n),s=t.length;return t.map((t,e)=>{var{strict:n}=t,o=Tg(t,["strict"]);const a=n||i.strict?(e+1)/(s+1):(e+.5)/s,l=r.pointAt(a);return(o.dx||o.dy)&&l.translate(o.dx||0,o.dy||0),Ag(l.round(),0,o)})}var Ig;(function(t){t.presets=y,t.registry=hu.create({type:"port layout"}),t.registry.register(t.presets,!0)})(Ig||(Ig={}));const Rg={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function Vg(t,e){const{x:n,y:i,angle:s,attrs:o}=e||{};return r.defaultsDeep({},{angle:s,attrs:o,position:{x:n,y:i}},t,Rg)}const zg=(t,e,n)=>Vg({position:e.getTopLeft()},n),Fg=(t,e,n)=>Vg({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},n),$g=(t,e,n)=>Vg({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},n),Gg=(t,e,n)=>Vg({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},n),qg=(t,e,n)=>Vg({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},n),Hg=(t,e,n)=>Xg(t,e,!1,n),Ug=(t,e,n)=>Xg(t,e,!0,n),Wg=(t,e,n)=>_g(t,e,!1,n),Jg=(t,e,n)=>_g(t,e,!0,n);function Xg(t,e,n,i){const r=null!=i.offset?i.offset:15,s=e.getCenter().theta(t),o=Yg(e);let a,l,c,h,u=0;return s<o[1]||s>o[2]?(a=".3em",l=r,c=0,h="start"):s<o[0]?(a="0",l=0,c=-r,n?(u=-90,h="start"):h="middle"):s<o[3]?(a=".3em",l=-r,c=0,h="end"):(a=".6em",l=0,c=r,n?(u=90,h="start"):h="middle"),Vg({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},i)}function _g(t,e,n,i){const r=null!=i.offset?i.offset:15,s=e.getCenter().theta(t),o=Yg(e);let a,l,c,h,u=0;return s<o[1]||s>o[2]?(a=".3em",l=-r,c=0,h="end"):s<o[0]?(a=".6em",l=0,c=r,n?(u=90,h="start"):h="middle"):s<o[3]?(a=".3em",l=r,c=0,h="start"):(a="0em",l=0,c=-r,n?(u=-90,h="start"):h="middle"),Vg({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},i)}function Yg(t){const e=t.getCenter(),n=e.theta(t.getTopLeft()),i=e.theta(t.getBottomLeft()),r=e.theta(t.getBottomRight()),s=e.theta(t.getTopRight());return[n,s,r,i]}const Zg=(t,e,n)=>Qg(t.diff(e.getCenter()),!1,n),Kg=(t,e,n)=>Qg(t.diff(e.getCenter()),!0,n);function Qg(t,e,n){const i=null!=n.offset?n.offset:20,r=new Vh(0,0),s=-t.theta(r),o=t.clone().move(r,i).diff(t).round();let a,l=".3em",c=s;return(s+90)%180===0?(a=e?"end":"middle",e||-270!==s||(l="0em")):s>-270&&s<-90?(a="start",c=s-180):a="end",Vg({position:o.round().toJSON(),angle:e?c:0,attrs:{".":{y:l,"text-anchor":a}}},n)}var tf;(function(t){t.presets=b,t.registry=hu.create({type:"port label layout"}),t.registry.register(t.presets,!0)})(tf||(tf={}));var ef,nf,rf=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class sf extends Mn{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=ef.uniqueId(),sf.views[this.cid]=this}confirmUpdate(t,e){return 0}empty(t=this.container){return c.empty(t),this}unmount(t=this.container){return c.remove(t),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),delete sf.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 c.addClass(e,Array.isArray(t)?t.join(" "):t),this}removeClass(t,e=this.container){return c.removeClass(e,Array.isArray(t)?t.join(" "):t),this}setStyle(t,e=this.container){return c.css(e,t),this}setAttrs(t,e=this.container){return null!=t&&null!=e&&c.attr(e,t),this}findAttr(t,e=this.container){let n=e;while(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 sf.find(t,e,n).elems}findOne(t,e=this.container,n=this.selectors){const i=this.find(t,e,n);return i.length>0?i[0]:null}findByAttr(t,e=this.container){let n=e;while(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 i=c.index(t)+1;n=`${t.tagName.toLowerCase()}:nth-child(${i})`,e&&(n+=" > "+e),n=this.getSelector(t.parentNode,n)}return n}prefixClassName(t){return gg.prefix(t)}delegateEvents(t,e){if(null==t)return this;e||this.undelegateEvents();const n=/^(\S+)\s*(.*)$/;return Object.keys(t).forEach(e=>{const i=e.match(n);if(null==i)return;const r=this.getEventHandler(t[e]);"function"===typeof r&&this.delegateEvent(i[1],i[2],r)}),this}undelegateEvents(){return c.Event.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 c.Event.on(this.container,t+this.getEventNamespace(),e,n),this}undelegateEvent(t,e,n){const i=t+this.getEventNamespace();return null==e?c.Event.off(this.container,i):"string"===typeof e?c.Event.off(this.container,i,e,n):c.Event.off(this.container,i,e),this}addEventListeners(t,e,n){if(null==e)return this;const i=this.getEventNamespace();return Object.keys(e).forEach(r=>{const s=this.getEventHandler(e[r]);"function"===typeof s&&c.Event.on(t,r+i,n,s)}),this}removeEventListeners(t){return null!=t&&c.Event.off(t,this.getEventNamespace()),this}getEventNamespace(){return`.${gg.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:i,clientX:r=0,clientY:s=0}=t;return e.fromPoint||"touchmove"===i||"touchend"===i?document.elementFromPoint(r,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 i=`__${this.cid}__`;return null==e?null==n?{}:n[i]||{}:(null==n&&(n=t.data={}),null==n[i]?n[i]=Object.assign({},e):n[i]=Object.assign(Object.assign({},n[i]),e),n[i])}normalizeEvent(t){return sf.normalizeEvent(t)}dispose(){this.remove()}}rf([sf.dispose()],sf.prototype,"dispose",null),function(t){function e(t,e){return e?c.createSvgElement(t||"g"):c.createElementNS(t||"div")}function n(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(gg.useCSSSelector){const n=t.includes(">")?":scope "+t:t;return{isCSSSelector:!0,elems:Array.prototype.slice.call(e.querySelectorAll(n))}}return{elems:[]}}function i(t){let e=t;const n=t.originalEvent,i=n&&n.changedTouches&&n.changedTouches[0];if(i){for(const e in t)void 0===i[e]&&(i[e]=t[e]);e=i}return e}t.createElement=e,t.find=n,t.normalizeEvent=i}(sf||(sf={})),function(t){function e(e){return t.views[e]||null}t.views={},t.getView=e}(sf||(sf={})),function(t){let e=0;function n(){const t="v"+e;return e+=1,t}t.uniqueId=n}(ef||(ef={}));class of{constructor(t){this.view=t,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new kh,this.pathCache={}}get(t){const e=this.elemCache;return e.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=c.getTransformToParentElement(t,n)}return c.createSVGMatrix(e.matrix)}getShape(t){const e=this.get(t);return null==e.shape&&(e.shape=bg.toGeometryShape(t)),e.shape.clone()}getBoundingRect(t){const e=this.get(t);return null==e.boundingRect&&(e.boundingRect=bg.getBBoxV2(t)),e.boundingRect.clone()}}(function(t){function e(t){return null!=t&&!n(t)}function n(t){return null!=t&&"string"===typeof t}function i(t){return null==t||n(t)?t:r.cloneDeep(t)}function s(t){return(""+t).trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")}function o(t,e={ns:c.ns.svg}){const n=document.createDocumentFragment(),i={},r={},s=[{markup:Array.isArray(t)?t:[t],parent:n,ns:e.ns}];while(s.length>0){const t=s.pop();let e=t.ns||c.ns.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?c.createElementNS(n,e):c.createElement(n),l=t.attrs;l&&c.attr(a,c.kebablizeAttrs(l));const h=t.style;h&&c.css(a,h);const u=t.className;null!=u&&a.setAttribute("class",Array.isArray(u)?u.join(" "):u),t.textContent&&(a.textContent=t.textContent);const d=t.selector;if(null!=d){if(r[d])throw new TypeError("Selector must be unique");r[d]=a}if(t.groupSelector){let e=t.groupSelector;Array.isArray(e)||(e=[e]),e.forEach(t=>{i[t]||(i[t]=[]),i[t].push(a)})}o.appendChild(a);const g=t.children;Array.isArray(g)&&s.push({ns:e,markup:g,parent:a})})}return Object.keys(i).forEach(t=>{if(r[t])throw new Error("Ambiguous group selector");r[t]=i[t]}),{fragment:n,selectors:r,groups:i}}function a(t){return t instanceof SVGElement?c.createSvgElement("g"):c.createElement("div")}function l(t){if(n(t)){const e=fc.createVectors(t),n=e.length;if(1===n)return{elem:e[0].node};if(n>1){const t=a(e[0].node);return e.forEach(e=>{t.appendChild(e.node)}),{elem:t}}return{}}const e=o(t),i=e.fragment;let r=null;return i.childNodes.length>1?(r=a(i.firstChild),r.appendChild(i)):r=i.firstChild,{elem:r,selectors:e.selectors}}function h(t){const e=fc.createVectors(t),n=document.createDocumentFragment();for(let i=0,r=e.length;i<r;i+=1){const t=e[i].node;n.appendChild(t)}return{fragment:n,selectors:{}}}t.isJSONMarkup=e,t.isStringMarkup=n,t.clone=i,t.sanitize=s,t.parseJSONMarkup=o,t.renderMarkup=l,t.parseLabelStringMarkup=h})(nf||(nf={})),function(t){function e(t,n,i){if(null!=t){let r;const s=t.tagName.toLowerCase();if(t===n)return r="string"===typeof i?`> ${s} > ${i}`:"> "+s,r;const o=t.parentNode;if(o&&o.childNodes.length>1){const e=c.index(t)+1;r=`${s}:nth-child(${e})`}else r=s;return i&&(r+=" > "+i),e(t.parentNode,n,r)}return i}t.getSelector=e}(nf||(nf={})),function(t){function e(){return"g"}function n(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}}function i(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}t.getPortContainerMarkup=e,t.getPortMarkup=n,t.getPortLabelMarkup=i}(nf||(nf={})),function(t){function e(){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.getEdgeMarkup=e}(nf||(nf={})),function(t){function e(t=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:c.ns.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:c.ns.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:t?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}t.getForeignObjectMarkup=e}(nf||(nf={}));class af{constructor(t){this.view=t}get cell(){return this.view.cell}getDefinition(t){return this.cell.getAttrDefinition(t)}processAttrs(t,e){let n,r,s,a;const l=[];return Object.keys(e).forEach(r=>{const s=e[r],a=this.getDefinition(r),h=i.call(dg.isValidDefinition,this.view,a,s,{elem:t,attrs:e,cell:this.cell,view:this.view});if(a&&h)"string"===typeof a?(null==n&&(n={}),n[a]=s):null!==s&&l.push({name:r,definition:a});else{null==n&&(n={});const t=c.CASE_SENSITIVE_ATTR.includes(r)?r:o.kebabCase(r);n[t]=s}}),l.forEach(({name:t,definition:n})=>{const i=e[t],o=n;"function"===typeof o.set&&(null==r&&(r={}),r[t]=i);const l=n;"function"===typeof l.offset&&(null==s&&(s={}),s[t]=i);const c=n;"function"===typeof c.position&&(null==a&&(a={}),a[t]=i)}),{raw:e,normal:n,set:r,offset:s,position:a}}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,i){const o=[],a=new kh;return Object.keys(t).forEach(l=>{const c=t[l];if(!r.isPlainObject(c))return;const{isCSSSelector:h,elems:u}=sf.find(l,e,i);n[l]=u;for(let t=0,e=u.length;t<e;t+=1){const n=u[t],r=i&&i[l]===n,d=a.get(n);if(d){d.array||(o.push(n),d.array=!0,d.attrs=[d.attrs],d.priority=[d.priority]);const t=d.attrs,i=d.priority;if(r)t.unshift(c),i.unshift(-1);else{const n=s.sortedIndex(i,h?-1:e);t.splice(n,0,c),i.splice(n,0,e)}}else a.set(n,{elem:n,attrs:c,priority:r?-1:e,array:!1})}}),o.forEach(t=>{const e=a.get(t),n=e.attrs;e.attrs=n.reduceRight((t,e)=>r.merge(t,e),{})}),a}updateRelativeAttrs(t,e,n){const r=e.raw||{};let s=e.normal||{};const o=e.set,a=e.position,l=e.offset,h=()=>({elem:t,cell:this.cell,view:this.view,attrs:r,refBBox:n.clone()});if(null!=o&&Object.keys(o).forEach(t=>{const e=o[t],n=this.getDefinition(t);if(null!=n){const r=i.call(n.set,this.view,e,h());"object"===typeof r?s=Object.assign(Object.assign({},s),r):null!=r&&(s[t]=r)}}),t instanceof HTMLElement)return void this.view.setAttrs(s,t);const u=s.transform,d=u?""+u:null,g=c.transformStringToMatrix(d),f=new Vh(g.e,g.f);u&&(delete s.transform,g.e=0,g.f=0);let p=!1;null!=a&&Object.keys(a).forEach(t=>{const e=a[t],n=this.getDefinition(t);if(null!=n){const t=i.call(n.position,this.view,e,h());null!=t&&(p=!0,f.translate(Vh.create(t)))}}),this.view.setAttrs(s,t);let m=!1;if(null!=l){const e=this.view.getBoundingRectOfElement(t);if(e.width>0&&e.height>0){const n=bg.transformRectangle(e,g);Object.keys(l).forEach(e=>{const s=l[e],o=this.getDefinition(e);if(null!=o){const e=i.call(o.offset,this.view,s,{elem:t,cell:this.cell,view:this.view,attrs:r,refBBox:n});null!=e&&(m=!0,f.translate(Vh.create(e)))}})}}(null!=u||p||m)&&(f.round(1),g.e=f.x,g.f=f.y,t.setAttribute("transform",c.matrixToTransformString(g)))}update(t,e,n){const i={},r=this.findAttrs(n.attrs||e,t,i,n.selectors),s=n.attrs?this.findAttrs(e,t,i,n.selectors):r,o=[];r.each(e=>{const r=e.elem,a=e.attrs,l=this.processAttrs(r,a);if(null==l.set&&null==l.position&&null==l.offset)this.view.setAttrs(l.normal,r);else{const e=s.get(r),c=e?e.attrs:null,h=c&&null==a.ref?c.ref:a.ref;let u;if(h){if(u=(i[h]||this.view.find(h,t,n.selectors))[0],!u)throw new Error(`"${h}" reference does not exist.`)}else u=null;const d={node:r,refNode:u,attributes:c,processedAttributes:l},g=o.findIndex(t=>t.refNode===r);g>-1?o.splice(g,0,d):o.push(d)}});const a=new kh;let l;o.forEach(e=>{const i=e.node,r=e.refNode;let s;const o=null!=r&&null!=n.rotatableNode&&c.contains(n.rotatableNode,r);if(r&&(s=a.get(r)),!s){const e=o?n.rotatableNode:t;s=r?bg.getBBox(r,{target:e}):n.rootBBox,r&&a.set(r,s)}let h;n.attrs&&e.attributes?(h=this.processAttrs(i,e.attributes),this.mergeProcessedAttrs(h,e.processedAttributes)):h=e.processedAttributes;let u=s;o&&null!=n.rotatableNode&&!n.rotatableNode.contains(i)&&(l||(l=c.transformStringToMatrix(c.attr(n.rotatableNode,"transform"))),u=bg.transformRectangle(s,l)),this.updateRelativeAttrs(i,h,u)})}}class lf{get cell(){return this.view.cell}constructor(t,e,n=[]){this.view=t;const i={},r={};let s=0;Object.keys(e).forEach(t=>{let n=e[t];Array.isArray(n)||(n=[n]),n.forEach(e=>{let n=i[e];n||(s+=1,n=i[e]=1<<s),r[t]|=n})});let o=n;if(Array.isArray(o)||(o=[o]),o.forEach(t=>{i[t]||(s+=1,i[t]=1<<s)}),s>25)throw new Error("Maximum number of flags exceeded.");this.flags=i,this.attrs=r,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}}var cf=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o},hf=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class uf extends sf{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){const e=(t,e)=>null!=e?s.uniq([...Array.isArray(t)?t:[t],...Array.isArray(e)?e:[e]]):Array.isArray(t)?[...t]:[t],n=r.cloneDeep(this.getDefaults()),{bootstrap:i,actions:o,events:a,documentEvents:l}=t,c=hf(t,["bootstrap","actions","events","documentEvents"]);return i&&(n.bootstrap=e(n.bootstrap,i)),o&&Object.entries(o).forEach(([t,i])=>{const r=n.actions[t];i&&r?n.actions[t]=e(r,i):i&&(n.actions[t]=e(i))}),a&&(n.events=Object.assign(Object.assign({},n.events),a)),t.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),l)),r.merge(n,c)}get[Symbol.toStringTag](){return uf.toStringTag}constructor(t,e={}){super(),this.cell=t,this.options=this.ensureOptions(e),this.graph=this.options.graph,this.attr=new af(this),this.flag=new lf(this,this.options.actions,this.options.bootstrap),this.cache=new of(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 sf.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 i=this.getContainerClassName();null!=i&&this.addClass(i,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,i){if(this.hasAction(t,e)){n();const r=[e];return i&&("string"===typeof i?r.push(i):r.push(...i)),this.removeAction(t,r)}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(t,e){const n=nf.parseJSONMarkup(t),i=n.selectors,r=this.rootSelector;if(e&&r){if(i[r])throw new Error("Invalid root selector");i[r]=e}return n}can(t){let e=this.graph.options.interacting;if("function"===typeof e&&(e=i.call(e,this.graph,this)),"object"===typeof e){let n=e[t];return"function"===typeof n&&(n=i.call(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(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootRotatedMatrix(),r=this.getRootTranslatedMatrix();return bg.transformRectangle(e,r.multiply(i).multiply(n))}getUnrotatedBBoxOfElement(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootTranslatedMatrix();return bg.transformRectangle(e,i.multiply(n))}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 c.createSVGMatrix().translate(e.x,e.y)}getRootRotatedMatrix(){let t=c.createSVGMatrix();const e=this.cell,n=e.isNode()?e.getAngle():0;if(n){const i=e.getBBox(),r=i.width/2,s=i.height/2;t=t.translate(r,s).rotate(n).translate(-r,-s)}return t}findMagnet(t=this.container){return this.findByAttr("magnet",t)}updateAttrs(t,e,n={}){null==n.rootBBox&&(n.rootBBox=new zh),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,i,r){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,i=t.port;let r,s=t.magnet;return null!=i&&e.isNode()&&e.hasPort(i)?r=this.findPortElem(i,s)||n:(s||(s=t.selector),s||null==i||(s=`[port="${i}"]`),r=this.findOne(s,n,this.selectors)),r}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=df.isToolsView(t)?t:new df(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 i=this,r=i.cell;return null==e||null==n?{e:t,view:i,cell:r}:{e:t,x:e,y:n,view:i,cell:r}}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,i){this.notify("cell:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,i){this.notify("cell:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),this.notify(e,Object.assign({},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){}onMagnetDblClick(t,e,n,i){}onMagnetContextMenu(t,e,n,i){}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)}}uf.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},cf([uf.dispose()],uf.prototype,"dispose",null),function(t){t.Flag=lf,t.Attr=af}(uf||(uf={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate}t.toStringTag="X6."+t.name,t.isCellView=e}(uf||(uf={})),function(t){function e(t){return function(e){e.config({priority:t})}}function n(t){return function(e){e.config({bootstrap:t})}}t.priority=e,t.bootstrap=n}(uf||(uf={})),function(t){t.registry=hu.create({type:"view"})}(uf||(uf={}));class df extends sf{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return df.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?sf.createElement("g",!0):sf.createElement("div",!1);return c.addClass(n,this.prefixClassName("cell-tools")),e.className&&c.addClass(n,e.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!uf.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(c.addClass(this.svgContainer,this.prefixClassName("edge-tools")),c.addClass(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(c.addClass(this.svgContainer,this.prefixClassName("node-tools")),c.addClass(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(df.ToolItem.isToolItem(t))"vertices"===t.name?n.unshift(t):n.push(t);else{const e="object"===typeof t?t.name:t;"vertices"===e?n.unshift(t):n.push(t)}});for(let i=0;i<n.length;i+=1){const t=n[i];let e;if(df.ToolItem.isToolItem(t))e=t;else{const n="object"===typeof t?t.name:t,i="object"===typeof t&&t.args||{};if(n)if(this.cell.isNode()){const t=If.registry.get(n);if(!t)return If.registry.onNotFound(n);e=new t(i)}else if(this.cell.isEdge()){const t=Rf.registry.get(n);if(!t)return Rf.registry.onNotFound(n);e=new t(i)}}if(e){e.config(this.cellView,this),e.render();const t=!1!==e.options.isSVGElement?this.svgContainer:this.htmlContainer;t.appendChild(e.container),this.tools.push(e)}}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),c.remove(this.svgContainer),c.remove(this.htmlContainer),super.remove()}mount(){const t=this.tools,e=this.cellView;if(e&&t){const n=t.some(t=>!1!==t.options.isSVGElement),i=t.some(t=>!1===t.options.isSVGElement);if(n){const t=this.options.local?e.container:e.graph.view.decorator;t.appendChild(this.svgContainer)}i&&this.graph.container.appendChild(this.htmlContainer)}return this}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&null!=i.graph&&null!=i.cell&&"function"===typeof i.config&&"function"===typeof i.update&&"function"===typeof i.focus&&"function"===typeof i.blur&&"function"===typeof i.show&&"function"===typeof i.hide}t.toStringTag="X6."+t.name,t.isToolsView=e})(df||(df={})),function(t){class e extends sf{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){return r.merge(r.cloneDeep(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 e.toStringTag}constructor(t={}){super(),this.visible=!0,this.options=this.getOptions(t),this.container=sf.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),c.addClass(this.container,this.prefixClassName("cell-tool")),"string"===typeof this.options.className&&c.addClass(this.container,this.options.className),this.init()}init(){}getOptions(t){const e=this.constructor;return e.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()?c.addClass(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&c.addClass(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();const t=this.options.markup;if(t){const e=nf.parseJSONMarkup(t);this.container.appendChild(e.fragment),this.childNodes=e.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)}}e.defaults={isSVGElement:!0,tagName:"g"},t.ToolItem=e,function(t){let e=0;function n(t){return t?o.pascalCase(t):(e+=1,"CustomTool"+e)}function i(t){const e=r.createClass(n(t.name),this);return e.config(t),e}t.define=i}(e=t.ToolItem||(t.ToolItem={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&null!=i.graph&&null!=i.cell&&"function"===typeof i.config&&"function"===typeof i.update&&"function"===typeof i.focus&&"function"===typeof i.blur&&"function"===typeof i.show&&"function"===typeof i.hide&&"function"===typeof i.isVisible}t.toStringTag="X6."+t.name,t.isToolItem=e}(e=t.ToolItem||(t.ToolItem={}))}(df||(df={}));const gf=t=>t;function ff(t,e){return 0===e?"0%":Math.round(t/e*100)+"%"}function pf(t){const e=(e,n,i,r)=>n.isEdgeElement(i)?yf(t,e,n,i,r):mf(t,e,n,i,r);return e}function mf(t,e,n,i,r){const s=n.cell,o=s.getAngle(),a=n.getUnrotatedBBoxOfElement(i),l=s.getBBox().getCenter(),c=Vh.create(r).rotate(o,l);let h=c.x-a.x,u=c.y-a.y;return t&&(h=ff(h,a.width),u=ff(u,a.height)),e.anchor={name:"topLeft",args:{dx:h,dy:u,rotate:!0}},e}function yf(t,e,n,i,r){const s=n.getConnection();if(!s)return e;const o=s.closestPointLength(r);if(t){const t=s.length();e.anchor={name:"ratio",args:{ratio:o/t}}}else e.anchor={name:"length",args:{length:o}};return e}const bf=pf(!0),vf=pf(!1);var xf;function wf(t,e,n,r){const s=i.call(xf.presets.pinRelative,this.graph,{},e,n,t,this.cell,r,{});return s.anchor}function Pf(t,e){return e?t.cell.getBBox():t.cell.isEdge()?t.getConnection().bbox():t.getUnrotatedBBoxOfElement(t.container)}(function(t){t.presets=v,t.registry=hu.create({type:"connection strategy"}),t.registry.register(t.presets,!0)})(xf||(xf={}));class Cf extends df.ToolItem{onRender(){c.addClass(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){const t=this.cellView,e=t.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();c.transform(this.container,e,{absolute:!0})}getNodeMatrix(){const t=this.cellView,e=this.options;let{x:n=0,y:i=0}=e;const{offset:r,useCellGeometry:s,rotate:o}=e;let l=Pf(t,s);const h=t.cell.getAngle();o||(l=l.bbox(h));let u=0,d=0;"number"===typeof r?(u=r,d=r):"object"===typeof r&&(u=r.x,d=r.y),n=a.normalizePercentage(n,l.width),i=a.normalizePercentage(i,l.height);let g=c.createSVGMatrix().translate(l.x+l.width/2,l.y+l.height/2);return o&&(g=g.rotate(h)),g=g.translate(n+u-l.width/2,i+d-l.height/2),g}getEdgeMatrix(){const t=this.cellView,e=this.options,{offset:n=0,distance:i=0,rotate:r}=e;let s,o,l;const h=a.normalizePercentage(i,1);s=h>=0&&h<=1?t.getTangentAtRatio(h):t.getTangentAtLength(h),s?(o=s.start,l=s.vector().vectorAngle(new Vh(1,0))||0):(o=t.getConnection().start,l=0);let u=c.createSVGMatrix().translate(o.x,o.y).rotate(l);return u="object"===typeof n?u.translate(n.x||0,n.y||0):u.translate(0,n),r||(u=u.rotate(-l)),u}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.options.onClick;"function"===typeof e&&i.call(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"}})})(Cf||(Cf={})),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})}})}(Cf||(Cf={}));var Af=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class Of extends df.ToolItem{onRender(){if(c.addClass(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const t=this.options.attrs,{class:e}=t,n=Af(t,["class"]);c.attr(this.container,c.kebablizeAttrs(n)),e&&c.addClass(this.container,e)}this.update()}update(){const t=this.cellView,e=this.options,{useCellGeometry:n,rotate:i}=e,r=a.normalizeSides(e.padding);let s=Pf(t,n).moveAndExpand({x:-r.left,y:-r.top,width:r.left+r.right,height:r.top+r.bottom});const o=t.cell;if(o.isNode()){const t=o.getAngle();if(t)if(i){const e=o.getBBox().getCenter();c.rotate(this.container,t,e.x,e.y,{absolute:!0})}else s=s.bbox(t)}return c.attr(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"}})})(Of||(Of={}));class Ef extends df.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(){const t=this.vertices;return t.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],i=this.options.createHandle,r=this.options.processHandle,s=i({index:e,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});r&&r(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],i=this.handles[e];i&&i.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,i=t>0?n[t-1]:e.sourceAnchor,r=t<n.length-1?n[t+1]:e.targetAnchor;return{prev:Vh.create(i),next:Vh.create(r)}}getMouseEventArgs(t){const e=this.normalizeEvent(t),{x:n,y:i}=this.graph.snapToGrid(e.clientX,e.clientY);return{e:e,x:n,y:i}}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:i,y:r}=this.getMouseEventArgs(t);this.eventData(n,{start:{x:i,y:r}}),e.notifyMouseDown(n,i,r)}}onHandleChanging({handle:t,e:e}){const n=this.cellView,i=t.options.index,{e:r,x:s,y:o}=this.getMouseEventArgs(e),a={x:s,y:o};this.snapVertex(a,i),n.cell.setVertexAt(i,a,{ui:!0,toolId:this.cid}),t.updatePosition(a.x,a.y),this.options.stopPropagation||n.notifyMouseMove(r,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);const i=n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});i&&this.render(),this.blur(),this.stopBatch(this.eventData(t).vertexAdded);const{e:r,x:s,y:o}=this.getMouseEventArgs(t);if(!this.options.stopPropagation){n.notifyMouseUp(r,s,o);const{start:t}=this.eventData(r);if(t){const{x:e,y:i}=t;e===s&&i===o&&n.onClick(r,s,o)}}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 i=this.getNeighborPoints(e),r=i.prev,s=i.next;Math.abs(t.x-r.x)<n?t.x=r.x:Math.abs(t.x-s.x)<n&&(t.x=s.x),Math.abs(t.y-r.y)<n?t.y=i.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,i=this.cellView;i.cell.removeVertexAt(n,{ui:!0}),this.options.addable&&this.updatePath(),i.checkMouseleave(this.normalizeEvent(e))}}allowAddVertex(t){const e=this.guard(t),n=this.options.addable&&this.cellView.can("vertexAddable"),i=!this.options.modifiers||Eh.isMatch(t,this.options.modifiers);return!e&&n&&i}onPathMouseDown(t){const e=this.cellView;if(!this.allowAddVertex(t))return;t.stopPropagation(),t.preventDefault();const n=this.normalizeEvent(t),i=this.graph.snapToGrid(n.clientX,n.clientY).toJSON();e.cell.startBatch("add-vertex",{ui:!0,toolId:this.cid});const r=e.getVertexIndex(i.x,i.y);this.snapVertex(i,r),e.cell.insertVertex(i,r,{ui:!0,toolId:this.cid}),this.render();const s=this.handles[r];this.eventData(n,{vertexAdded:!0}),s.onMouseDown(n)}onRemove(){this.resetHandles()}}(function(t){class e extends sf{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=sf.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})}}t.Handle=e})(Ef||(Ef={})),function(t){const e=gg.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"}})}(Ef||(Ef={}));class Mf extends df.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){c.addClass(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 n=0,i=e.length;n<i-1;n+=1){const t=e[n],i=e[n+1],r=this.renderHandle(t,i,n);this.stamp(r.container),this.handles.push(r)}return this}renderHandle(t,e,n){const i=this.options.createHandle({index:n,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(i),this.updateHandle(i,t,e),this.container.appendChild(i.container),this.startHandleListening(i),i}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,i=e.length;n<i;n+=1)e[n].options.index+=t}resetAnchor(t,e){const n=this.cellView.cell,i={ui:!0,toolId:this.cid};e?n.prop([t,"anchor"],e,i):n.removeProp([t,"anchor"],i)}snapHandle(t,e,n){const i=t.options.axis,r=t.options.index,s=this.cellView,o=s.cell,a=o.getVertices(),l=a[r-2]||n.sourceAnchor,c=a[r+1]||n.targetAnchor,h=this.options.snapRadius;return Math.abs(e[i]-l[i])<h?e[i]=l[i]:Math.abs(e[i]-c[i])<h&&(e[i]=c[i]),e}onHandleChanging({handle:t,e:e}){const n=this.graph,s=this.options,o=this.cellView,a=s.anchor,l=t.options.axis,c=t.options.index-1,h=this.getEventData(e),u=this.normalizeEvent(e),d=n.snapToGrid(u.clientX,u.clientY),g=this.snapHandle(t,d.clone(),h),f=r.cloneDeep(this.vertices);let p=f[c],m=f[c+1];const y=o.sourceView,b=o.sourceBBox;let v=!1,x=!1;if(p?0===c?b.containsPoint(p)?(f.shift(),this.shiftHandleIndexes(-1),v=!0):(p[l]=g[l],x=!0):p[l]=g[l]:(p=o.sourceAnchor.toJSON(),p[l]=g[l],b.containsPoint(p)?v=!0:(f.unshift(p),this.shiftHandleIndexes(1),x=!0)),"function"===typeof a&&y){if(v){const t=h.sourceAnchor.clone();t[l]=g[l];const e=i.call(a,o,t,y,o.sourceMagnet||y.container,"source",o,this);this.resetAnchor("source",e)}x&&this.resetAnchor("source",h.sourceAnchorDef)}const w=o.targetView,P=o.targetBBox;let C=!1,A=!1;if(m?c===f.length-2?P.containsPoint(m)?(f.pop(),C=!0):(m[l]=g[l],A=!0):m[l]=g[l]:(m=o.targetAnchor.toJSON(),m[l]=g[l],P.containsPoint(m)?C=!0:(f.push(m),A=!0)),"function"===typeof a&&w){if(C){const t=h.targetAnchor.clone();t[l]=g[l];const e=i.call(a,o,t,w,o.targetMagnet||w.container,"target",o,this);this.resetAnchor("target",e)}A&&this.resetAnchor("target",h.targetAnchorDef)}Vh.equalPoints(f,this.vertices)||this.cellView.cell.setVertices(f,{ui:!0,toolId:this.cid}),this.updateHandle(t,p,m,0),s.stopPropagation||o.notifyMouseMove(u,d.x,d.y)}onHandleChange({handle:t,e:e}){const n=this.options,i=this.handles,s=this.cellView,o=t.options.index;if(Array.isArray(i)){for(let t=0,e=i.length;t<e;t+=1)t!==o&&i[t].hide();if(this.focus(),this.setEventData(e,{sourceAnchor:s.sourceAnchor.clone(),targetAnchor:s.targetAnchor.clone(),sourceAnchorDef:r.cloneDeep(this.cell.prop(["source","anchor"])),targetAnchorDef:r.cloneDeep(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);s.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 i=this.normalizeEvent(t),r=this.graph.snapToGrid(i.clientX,i.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),e.stopPropagation||n.notifyMouseUp(i,r.x,r.y),n.checkMouseleave(i),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}updateHandle(t,e,n,i=0){const r=this.options.precision||0,s=Math.abs(e.x-n.x)<r,o=Math.abs(e.y-n.y)<r;if(s||o){const r=new Fh(e,n),o=r.length();if(o<this.options.threshold)t.hide();else{const e=r.getCenter(),n=s?"x":"y";e[n]+=i||0;const o=r.vector().vectorAngle(new Vh(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){class e extends sf{constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=sf.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,i){const r=i.getClosestPoint(new Vh(t,e))||new Vh(t,e);let s=c.createSVGMatrix().translate(r.x,r.y);if(r.equals({x:t,y:e}))s=s.rotate(n);else{const n=new Fh(t,e,r.x,r.y);let i=n.vector().vectorAngle(new Vh(1,0));0!==i&&(i+=90),s=s.rotate(i)}this.setAttrs({transform:c.matrixToTransformString(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"}}t.Handle=e})(Mf||(Mf={})),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:wf})}(Mf||(Mf={}));class Sf extends df.ToolItem{get type(){return this.options.type}onRender(){c.addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){const t=this.type,e=this.cellView,n=e.getTerminalView(t);return n?(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,i=this.cellView,r=this.options,s=i.getTerminalAnchor(n),o=i.cell.prop([n,"anchor"]);e.setAttribute("transform",`translate(${s.x}, ${s.y})`);const a=o?r.customAnchorAttrs:r.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,i=this.cellView,r=i.getTerminalView(n);if(r){const t=r.cell,s=i.getTerminalMagnet(n);let o,a,l,h=this.options.areaPadding||0;Number.isFinite(h)||(h=0),r.isEdgeElement(s)?(o=r.getBBox(),a=0,l=o.getCenter()):(o=r.getUnrotatedBBoxOfElement(s),a=t.getAngle(),l=o.getCenter(),a&&l.rotate(-a,t.getBBox().getCenter())),o.inflate(h),c.attr(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 s=this.normalizeEvent(t),o=r.cell,a=n.getTerminalMagnet(e);let l=this.graph.coord.clientToLocalPoint(s.clientX,s.clientY);const c=this.options.snap;if("function"===typeof c){const t=i.call(c,n,l,r,a,e,n,this);l=Vh.create(t)}if(this.options.restrictArea)if(r.isEdgeElement(a)){const t=r.getClosestPoint(l);t&&(l=t)}else{const t=r.getUnrotatedBBoxOfElement(a),e=o.getAngle(),n=o.getBBox().getCenter(),i=l.clone().rotate(e,n);t.containsPoint(i)||(l=t.getNearestPointToPoint(i).rotate(-e,n))}let h;const u=this.options.anchor;"function"===typeof u&&(h=i.call(u,n,l,r,a,e,n,this)),this.resetAnchor(h),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:wf,snap(t,e,n,i,r,s){const o=s.options.snapRadius||0,a="source"===i,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}})})(Sf||(Sf={}));const Tf=Sf.define({name:"source-anchor",type:"source"}),Nf=Sf.define({name:"target-anchor",type:"target"});var kf=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class jf extends df.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){const t=this.options.attrs,{class:e}=t,n=kf(t,["class"]);this.setAttrs(n,this.container),e&&c.addClass(this.container,e)}}onRender(){c.addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){const t=this.ratio,e=this.cellView,n=e.getTangentAtRatio(t),i=n?n.start:e.getPointAtRatio(t),r=n&&n.vector().vectorAngle(new Vh(1,0))||0;if(!i)return this;const s=c.createSVGMatrix().translate(i.x,i.y).rotate(r);return c.transform(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),i=e.prepareArrowheadDragging(this.type,{x:n.x,y:n.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(t,i),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,i=this.graph.snapToGrid(e.clientX,e.clientY);n.onMouseUp(e,i.x,i.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"}})})(jf||(jf={}));const Lf=jf.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"}}),Bf=jf.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 Df extends df.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=df.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:i}=this.options;n.fontSize=i.fontSize+"px",n.fontFamily=i.fontFamily,n.color=i.color,n.backgroundColor=i.backgroundColor;const r=this.getCellText()||"";return e.innerText=r,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:t,cell:e,editor:n}=this;if(!n)return;let i=Vh.create(),r=20,s="",{x:o,y:l}=this.options;const{width:c,height:h}=this.options;if("undefined"!==typeof o&&"undefined"!==typeof l){const t=e.getBBox();o=a.normalizePercentage(o,t.width),l=a.normalizePercentage(l,t.height),i=t.topLeft.translate(o,l),r=t.width-2*o}else{const t=e.getBBox();i=t.center,r=t.width-4,s="translate(-50%, -50%)"}const u=t.scale(),{style:d}=n;i=t.localToGraph(i),d.left=i.x+"px",d.top=i.y+"px",d.transform=`scale(${u.sx}, ${u.sy}) ${s}`,d.minWidth=r+"px","number"===typeof c&&(d.width=c+"px"),"number"===typeof h&&(d.height=h+"px")}updateEdgeEditorTransform(){if(!this.event)return;const{graph:t,editor:e}=this;if(!e)return;let n=Vh.create(),i=20;const{style:r}=e,s=this.event.target,o=s.parentElement,a=o&&c.hasClass(o,this.prefixClassName("edge-label"));if(a){const t=o.getAttribute("data-index")||"0";this.labelIndex=parseInt(t,10);const e=o.getAttribute("transform"),{translation:r}=c.parseTransformString(e);n=new Vh(r.tx,r.ty),i=bg.getBBox(s).width}else{if(!this.options.labelAddable)return this;n=t.clientToLocal(Vh.create(this.event.clientX,this.event.clientY));const e=this.cellView,i=e.path.closestPointLength(n);this.distance=i,this.labelIndex=-1}n=t.localToGraph(n);const l=t.scale();r.left=n.x+"px",r.top=n.y+"px",r.minWidth=i+"px",r.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 i.call(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 i={position:{distance:this.distance},attrs:{}};r.setByPath(i,"attrs/"+e,t),n.appendLabel(i)}}else null!==t?n.prop(`labels/${this.labelIndex}/attrs/${e}`,t):"number"===typeof this.labelIndex&&n.removeLabelAt(this.labelIndex)}}}else i.call(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()}}(function(t){t.config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}})})(Df||(Df={})),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"})}(Df||(Df={}));var If,Rf,Vf=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};(function(t){t.presets={boundary:Of,button:Cf,"button-remove":Cf.Remove,"node-editor":Df.NodeEditor},t.registry=hu.create({type:"node tool",process(t,e){if("function"===typeof e)return e;let n=df.ToolItem;const{inherit:i}=e,r=Vf(e,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):n=t}return null==r.name&&(r.name=t),n.define.call(n,r)}}),t.registry.register(t.presets,!0)})(If||(If={})),function(t){t.presets={boundary:Of,vertices:Ef,segments:Mf,button:Cf,"button-remove":Cf.Remove,"source-anchor":Tf,"target-anchor":Nf,"source-arrowhead":Lf,"target-arrowhead":Bf,"edge-editor":Df.EdgeEditor},t.registry=hu.create({type:"edge tool",process(t,e){if("function"===typeof e)return e;let n=df.ToolItem;const{inherit:i}=e,r=Vf(e,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):n=t}return null==r.name&&(r.name=t),n.define.call(n,r)}}),t.registry.register(t.presets,!0)}(Rf||(Rf={}));const zf=Xf("center"),Ff=Xf("topCenter"),$f=Xf("bottomCenter"),Gf=Xf("leftMiddle"),qf=Xf("rightMiddle"),Hf=Xf("topLeft"),Uf=Xf("topRight"),Wf=Xf("bottomLeft"),Jf=Xf("bottomRight");function Xf(t){return function(e,n,i,r={}){const s=r.rotate?e.getUnrotatedBBoxOfElement(n):e.getBBoxOfElement(n),o=s[t];o.x+=a.normalizePercentage(r.dx,s.width),o.y+=a.normalizePercentage(r.dy,s.height);const l=e.cell;return r.rotate?o.rotate(-l.getAngle(),l.getBBox().getCenter()):o}}function _f(t){return function(e,n,i,r){if(i instanceof Element){const s=this.graph.findViewByElem(i);let o;if(s)if(s.isEdgeElement(i)){const t=null!=r.fixedAt?r.fixedAt:"50%";o=Yf(s,t)}else o=s.getBBoxOfElement(i).getCenter();else o=new Vh;return t.call(this,e,n,o,r)}return t.apply(this,arguments)}}function Yf(t,e){const n=a.isPercentage(e),i="string"===typeof e?parseFloat(e):e;return n?t.getPointAtRatio(i/100):t.getPointAtLength(i)}const Zf=function(t,e,n,i){const r=Dh.normalize(t.cell.getAngle()),s=t.getBBoxOfElement(e),o=s.getCenter(),a=s.getTopLeft(),l=s.getBottomRight();let c=i.padding;if(Number.isFinite(c)||(c=0),a.y+c<=n.y&&n.y<=l.y-c){const t=n.y-o.y;o.x+=0===r||180===r?0:1*t/Math.tan(Dh.toRad(r)),o.y+=t}else if(a.x+c<=n.x&&n.x<=l.x-c){const t=n.x-o.x;o.y+=90===r||270===r?0:t*Math.tan(Dh.toRad(r)),o.x+=t}return o},Kf=_f(Zf),Qf=function(t,e,n,i,r){const s=t.cell.getConnectionPoint(this.cell,r);return(i.dx||i.dy)&&s.translate(i.dx||0,i.dy||0),s},tp=function(t,e,n,i){let r,s,o=0;const a=t.cell;i.rotate?(r=t.getUnrotatedBBoxOfElement(e),s=a.getBBox().getCenter(),o=a.getAngle()):r=t.getBBoxOfElement(e);const l=i.padding;null!=l&&Number.isFinite(l)&&r.inflate(l),i.rotate&&n.rotate(o,s);const c=r.getNearestSideToPoint(n);let h;switch(c){case"left":h=r.getLeftMiddle();break;case"right":h=r.getRightMiddle();break;case"top":h=r.getTopCenter();break;case"bottom":h=r.getBottomCenter();break;default:break}const u=i.direction;return"H"===u?"top"!==c&&"bottom"!==c||(h=n.x<=r.x+r.width?r.getLeftMiddle():r.getRightMiddle()):"V"===u&&(h=n.y<=r.y+r.height?r.getTopCenter():r.getBottomCenter()),i.rotate?h.rotate(-o,s):h},ep=_f(tp);var np;(function(t){t.presets=x,t.registry=hu.create({type:"node endpoint"}),t.registry.register(t.presets,!0)})(np||(np={}));const ip=function(t,e,n,i){let r=null!=i.ratio?i.ratio:.5;return r>1&&(r/=100),t.getPointAtRatio(r)},rp=function(t,e,n,i){const r=null!=i.length?i.length:20;return t.getPointAtLength(r)},sp=function(t,e,n,i){const r=t.getClosestPoint(n);return null!=r?r:new Vh},op=_f(sp),ap=function(t,e,n,r){const s=1e6,o=t.getConnection(),a=t.getConnectionSubdivisions(),l=new Fh(n.clone().translate(0,s),n.clone().translate(0,-s)),c=new Fh(n.clone().translate(s,0),n.clone().translate(-s,0)),h=l.intersect(o,{segmentSubdivisions:a}),u=c.intersect(o,{segmentSubdivisions:a}),d=[];return h&&d.push(...h),u&&d.push(...u),d.length>0?n.closest(d):null!=r.fallbackAt?Yf(t,r.fallbackAt):i.call(sp,this,t,e,n,r)},lp=_f(ap);var cp;function hp(t,e,n){let i;if("object"===typeof n){if(Number.isFinite(n.y)){const i=new Fh(e,t),{start:r,end:s}=i.parallel(n.y);e=r,t=s}i=n.x}else i=n;if(null==i||!Number.isFinite(i))return t;const r=t.distance(e);return 0===i&&r>0?t:t.move(e,-Math.min(i,r-1))}function up(t){const e=t.getAttribute("stroke-width");return null===e?0:parseFloat(e)||0}function dp(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}(function(t){t.presets=w,t.registry=hu.create({type:"edge endpoint"}),t.registry.register(t.presets,!0)})(cp||(cp={}));const gp=function(t,e,n,i){const r=e.getBBoxOfElement(n);i.stroked&&r.inflate(up(n)/2);const s=t.intersect(r),o=s&&s.length?t.start.closest(s):t.end;return hp(o,t.start,i.offset)},fp=function(t,e,n,r,s){const o=e.cell,a=o.isNode()?o.getAngle():0;if(0===a)return i.call(gp,this,t,e,n,r,s);const l=e.getUnrotatedBBoxOfElement(n);r.stroked&&l.inflate(up(n)/2);const c=l.getCenter(),h=t.clone().rotate(a,c),u=h.setLength(1e6).intersect(l),d=u&&u.length?h.start.closest(u).rotate(-a,c):t.end;return hp(d,t.start,r.offset)},pp=function(t,e,n,i){let s,o;const a=t.end,l=i.selector;if(s="string"===typeof l?e.findOne(l):Array.isArray(l)?r.getByPath(n,l):dp(n),!c.isSVGGraphicsElement(s)){if(s===n||!c.isSVGGraphicsElement(n))return a;s=n}const h=e.getShapeOfElement(s),u=e.getMatrixOfElement(s),d=e.getRootTranslatedMatrix(),g=e.getRootRotatedMatrix(),f=d.multiply(g).multiply(u),p=f.inverse(),m=bg.transformLine(t,p),y=m.start.clone(),b=e.getDataOfElement(s);if(!1===i.insideout){null==b.shapeBBox&&(b.shapeBBox=h.bbox());const t=b.shapeBBox;if(null!=t&&t.containsPoint(y))return a}let v;if(!0===i.extrapolate&&m.setLength(1e6),cu.isPath(h)){const t=i.precision||2;null==b.segmentSubdivisions&&(b.segmentSubdivisions=h.getSegmentSubdivisions({precision:t})),v={precision:t,segmentSubdivisions:b.segmentSubdivisions},o=m.intersect(h,v)}else o=m.intersect(h);o?Array.isArray(o)&&(o=y.closest(o)):!0===i.sticky&&(o=zh.isRectangle(h)?h.getNearestPointToPoint(y):$h.isEllipse(h)?h.intersectsWithLineFromCenterToPoint(y):h.closestPoint(y,v));const x=o?bg.transformPoint(o,f):a;let w=i.offset||0;return!1!==i.stroked&&("object"===typeof w?(w=Object.assign({},w),null==w.x&&(w.x=0),w.x+=up(s)/2):w+=up(s)/2),hp(x,t.start,w)};function mp(t,e,n=0){const{start:i,end:r}=t;let s,o,a,l;switch(e){case"left":l="x",s=r,o=i,a=-1;break;case"right":l="x",s=i,o=r,a=1;break;case"top":l="y",s=r,o=i,a=-1;break;case"bottom":l="y",s=i,o=r,a=1;break;default:return}i[l]<r[l]?s[l]=o[l]:o[l]=s[l],Number.isFinite(n)&&(s[l]+=a*n,o[l]+=a*n)}const yp=function(t,e,n,i){const{alignOffset:r,align:s}=i;return s&&mp(t,s,r),hp(t.end,t.start,i.offset)};var bp;(function(t){t.presets=P,t.registry=hu.create({type:"connection point"}),t.registry.register(t.presets,!0)})(bp||(bp={}));const vp=function(t){return[...t]},xp=function(t,e,n){const i=e.side||"bottom",r=a.normalizeSides(e.padding||40),s=n.sourceBBox,o=n.targetBBox,l=s.getCenter(),c=o.getCenter();let h,u,d;switch(i){case"top":d=-1,h="y",u="height";break;case"left":d=-1,h="x",u="width";break;case"right":d=1,h="x",u="width";break;case"bottom":default:d=1,h="y",u="height";break}return l[h]+=d*(s[u]/2+r[i]),c[h]+=d*(o[u]/2+r[i]),d*(l[h]-c[h])>0?c[h]=l[h]:l[h]=c[h],[l.toJSON(),...t,c.toJSON()]};function wp(t){return new zh(t.x,t.y,0,0)}function Pp(t={}){const e=a.normalizeSides(t.padding||20);return{x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}function Cp(t,e={}){return t.sourceBBox.clone().moveAndExpand(Pp(e))}function Ap(t,e={}){return t.targetBBox.clone().moveAndExpand(Pp(e))}function Op(t,e={}){if(t.sourceAnchor)return t.sourceAnchor;const n=Cp(t,e);return n.getCenter()}function Ep(t,e={}){if(t.targetAnchor)return t.targetAnchor;const n=Ap(t,e);return n.getCenter()}const Mp=function(t,e,n){let i=Cp(n,e),r=Ap(n,e);const s=Op(n,e),o=Ep(n,e);i=i.union(wp(s)),r=r.union(wp(o));const a=t.map(t=>Vh.create(t));a.unshift(s),a.push(o);let l=null;const c=[];for(let h=0,u=a.length-1;h<u;h+=1){let t=null;const n=a[h],s=a[h+1],o=null!=Sp.getBearing(n,s);if(0===h)h+1===u?i.intersectsWithRect(r.clone().inflate(1))?t=Sp.insideNode(n,s,i,r):o||(t=Sp.nodeToNode(n,s,i,r)):i.containsPoint(s)?t=Sp.insideNode(n,s,i,wp(s).moveAndExpand(Pp(e))):o||(t=Sp.nodeToVertex(n,s,i));else if(h+1===u){const i=o&&Sp.getBearing(s,n)===l;r.containsPoint(n)||i?t=Sp.insideNode(n,s,wp(n).moveAndExpand(Pp(e)),r,l):o||(t=Sp.vertexToNode(n,s,r,l))}else o||(t=Sp.vertexToVertex(n,s,l));t?(c.push(...t.points),l=t.direction):l=Sp.getBearing(n,s),h+1<u&&c.push(s)}return c};var Sp;(function(t){const e={N:"S",S:"N",E:"W",W:"E"},n={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function i(t,e,n){let i=new Vh(t.x,e.y);return n.containsPoint(i)&&(i=new Vh(e.x,t.y)),i}function r(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,n,i){const r=new Vh(t.x,n.y),s=new Vh(n.x,t.y),a=o(t,r),l=o(t,s),c=i?e[i]:null,h=a===i||a!==c&&(l===c||l!==i)?r:s;return{points:[h],direction:o(h,n)}}function l(t,e,n){const r=i(t,e,n);return{points:[r],direction:o(r,e)}}function c(t,e,n,a){const l=[new Vh(t.x,e.y),new Vh(e.x,t.y)],c=l.filter(t=>!n.containsPoint(t)),h=c.filter(e=>o(e,t)!==a);let u;if(h.length>0)return u=h.filter(e=>o(t,e)===a).pop(),u=u||h[0],{points:[u],direction:o(u,e)};{u=s.difference(l,c)[0];const h=Vh.create(e).move(u,-r(n,a)/2),d=i(h,t,n);return{points:[d,h],direction:o(h,e)}}}function h(t,e,n,i){let s=l(e,t,i);const c=s.points[0];if(n.containsPoint(c)){s=l(t,e,n);const h=s.points[0];if(i.containsPoint(h)){const u=Vh.create(t).move(h,-r(n,o(t,h))/2),d=Vh.create(e).move(c,-r(i,o(e,c))/2),g=new Fh(u,d).getCenter(),f=l(t,g,n),p=a(g,e,f.direction);s.points=[f.points[0],p.points[0]],s.direction=p.direction}}return s}function u(t,e,r,s,a){const l=r.union(s).inflate(1),c=l.getCenter(),h=c.distance(e)>c.distance(t),u=h?e:t,d=h?t:e;let g,f,p,m;a?(g=Vh.fromPolar(l.width+l.height,n[a],u),g=l.getNearestPointToPoint(g).move(g,-1)):g=l.getNearestPointToPoint(u).move(u,1),f=i(g,d,l),g.round().equals(f.round())?(f=Vh.fromPolar(l.width+l.height,Dh.toRad(g.theta(u))+Math.PI/2,d),f=l.getNearestPointToPoint(f).move(d,1).round(),p=i(g,f,l),m=h?[f,p,g]:[g,p,f]):m=h?[f,g]:[g,f];const y=o(h?g:f,e);return{points:m,direction:y}}t.getBBoxSize=r,t.getBearing=o,t.vertexToVertex=a,t.nodeToVertex=l,t.vertexToNode=c,t.nodeToNode=h,t.insideNode=u})(Sp||(Sp={}));const Tp={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(){const t=Np(this.step,this);return t},directions(){const t=Np(this.step,this),e=Np(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=Np(this.step,this);return{0:0,45:t/2,90:t/2}},paddingBox(){const t=Np(this.step,this);return{x:-t,y:-t,width:2*t,height:2*t}},fallbackRouter:Mp,draggingRouter:null,snapToGrid:!0};function Np(t,e){return"function"===typeof t?t.call(e):t}function kp(t){const e=Object.keys(t).reduce((e,n)=>{const i=e;return i[n]="fallbackRouter"===n||"draggingRouter"===n||"fallbackRoute"===n?t[n]:Np(t[n],t),e},{});if(e.padding){const t=a.normalizeSides(e.padding);e.paddingBox={x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}return e.directions.forEach(t=>{const e=new Vh(0,0),n=new Vh(t.offsetX,t.offsetY);t.angle=Dh.normalize(e.theta(n))}),e}const jp=1,Lp=2;class Bp{constructor(){this.items=[],this.hash={},this.values={}}add(t,e){this.hash[t]?this.items.splice(this.items.indexOf(t),1):this.hash[t]=jp,this.values[t]=e;const n=s.sortedIndexBy(this.items,t,t=>this.values[t]);this.items.splice(n,0,t)}pop(){const t=this.items.shift();return t&&(this.hash[t]=Lp),t}isOpen(t){return this.hash[t]===jp}isClose(t){return this.hash[t]===Lp}isEmpty(){return 0===this.items.length}}class Dp{constructor(t){this.options=t,this.mapGridSize=100,this.map={}}build(t,e){const n=this.options,i=n.excludeTerminals.reduce((n,i)=>{const r=e[i];if(r){const e=t.getCell(r.cell);e&&n.push(e)}return n},[]);let r=[];const o=t.getCell(e.getSourceCellId());o&&(r=s.union(r,o.getAncestors().map(t=>t.id)));const a=t.getCell(e.getTargetCellId());a&&(r=s.union(r,a.getAncestors().map(t=>t.id)));const l=this.mapGridSize;return t.getNodes().reduce((t,e)=>{const s=i.some(t=>t.id===e.id),o=!!e.shape&&n.excludeShapes.includes(e.shape),a=n.excludeNodes.some(t=>"string"===typeof t?e.id===t:t===e),c=r.includes(e.id),h=o||s||a||c;if(e.isVisible()&&!h){const i=e.getBBox().moveAndExpand(n.paddingBox),r=i.getOrigin().snapToGrid(l),s=i.getCorner().snapToGrid(l);for(let e=r.x;e<=s.x;e+=l)for(let n=r.y;n<=s.y;n+=l){const r=new Vh(e,n).toString();null==t[r]&&(t[r]=[]),t[r].push(i)}}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 Ip(t,e){const n=t.sourceBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function Rp(t,e){const n=t.targetBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function Vp(t,e){if(t.sourceAnchor)return t.sourceAnchor;const n=Ip(t,e);return n.getCenter()}function zp(t,e){if(t.targetAnchor)return t.targetAnchor;const n=Rp(t,e);return n.getCenter()}function Fp(t,e,n,i,r){const s=360/n,o=t.theta($p(t,e,i,r)),a=Dh.normalize(o+s/2);return s*Math.floor(a/s)}function $p(t,e,n,i){const r=i.step,s=e.x-t.x,o=e.y-t.y,a=s/n.x,l=o/n.y,c=a*r,h=l*r;return new Vh(t.x+c,t.y+h)}function Gp(t,e){const n=Math.abs(t-e);return n>180?360-n:n}function qp(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}function Hp(t,e,n){return{source:e.clone(),x:Up(n.x-e.x,t),y:Up(n.y-e.y,t)}}function Up(t,e){if(!t)return e;const n=Math.abs(t),i=Math.round(n/e);if(!i)return n;const r=i*e,s=n-r,o=s/i;return e+o}function Wp(t,e){const n=e.source,i=Ih.snapToGrid(t.x-n.x,e.x)+n.x,r=Ih.snapToGrid(t.y-n.y,e.y)+n.y;return new Vh(i,r)}function Jp(t,e){return t.round(e)}function Xp(t,e,n){return Jp(Wp(t.clone(),e),n)}function _p(t){return t.toString()}function Yp(t){return new Vh(0===t.x?0:Math.abs(t.x)/t.x,0===t.y?0:Math.abs(t.y)/t.y)}function Zp(t,e){let n=1/0;for(let i=0,r=e.length;i<r;i+=1){const r=t.manhattanDistance(e[i]);r<n&&(n=r)}return n}function Kp(t,e,n,i,r){const s=r.precision,o=r.directionMap,a=t.diff(e.getCenter()),l=Object.keys(o).reduce((r,l)=>{if(n.includes(l)){const n=o[l],c=new Vh(t.x+n.x*(Math.abs(a.x)+e.width),t.y+n.y*(Math.abs(a.y)+e.height)),h=new Fh(t,c),u=h.intersect(e)||[];let d,g=null;for(let e=0;e<u.length;e+=1){const n=u[e],i=t.squaredDistance(n);(null==d||i>d)&&(d=i,g=n)}if(g){let t=Xp(g,i,s);e.containsPoint(t)&&(t=Xp(t.translate(n.x*i.x,n.y*i.y),i,s)),r.push(t)}}return r},[]);return e.containsPoint(t)||l.push(Xp(t,i,s)),l}function Qp(t,e,n,i,r){const s=[];let o,a=Yp(r.diff(n)),l=_p(n),c=t[l];while(c){o=e[l];const n=Yp(o.diff(c));n.equals(a)||(s.unshift(o),a=n),l=_p(c),c=t[l]}const h=e[l],u=Yp(h.diff(i));return u.equals(a)||s.unshift(h),s}function tm(t,e,n,r,s){const o=s.precision;let a,l;a=zh.isRectangle(e)?Jp(Vp(t,s).clone(),o):Jp(e.clone(),o),l=zh.isRectangle(n)?Jp(zp(t,s).clone(),o):Jp(n.clone(),o);const c=Hp(s.step,a,l),h=a,u=l;let d,g;if(d=zh.isRectangle(e)?Kp(h,e,s.startDirections,c,s):[h],g=zh.isRectangle(n)?Kp(l,n,s.endDirections,c,s):[u],d=d.filter(t=>r.isAccessible(t)),g=g.filter(t=>r.isAccessible(t)),d.length>0&&g.length>0){const t=new Bp,e={},n={},i={};for(let r=0,s=d.length;r<s;r+=1){const n=d[r],s=_p(n);t.add(s,Zp(n,g)),e[s]=n,i[s]=0}const a=s.previousDirectionAngle,l=void 0===a;let f,p;const m=qp(c,s),y=m.length,b=g.reduce((t,e)=>{const n=_p(e);return t.push(n),t},[]),v=Vh.equalPoints(d,g);let x=s.maxLoopCount;while(!t.isEmpty()&&x>0){const d=t.pop(),w=e[d],P=n[d],C=i[d],A=w.equals(h),O=null==P;let E;E=O?l?A?null:Fp(h,w,y,c,s):a:Fp(P,w,y,c,s);const M=O&&v;if(!M&&b.indexOf(d)>=0)return s.previousDirectionAngle=E,Qp(n,e,w,h,u);for(let a=0;a<y;a+=1){f=m[a];const h=f.angle;if(p=Gp(E,h),(!l||!A)&&p>s.maxDirectionChange)continue;const d=Xp(w.clone().translate(f.gridOffsetX||0,f.gridOffsetY||0),c,o),v=_p(d);if(t.isClose(v)||!r.isAccessible(d))continue;if(b.indexOf(v)>=0){const t=d.equals(u);if(!t){const t=Fp(d,u,y,c,s),e=Gp(h,t);if(e>s.maxDirectionChange)continue}}const x=f.cost,P=A?0:s.penalties[p],O=C+x+P;(!t.isOpen(v)||O<i[v])&&(e[v]=d,n[v]=w,i[v]=O,t.add(v,O+Zp(d,g)))}x-=1}}return s.fallbackRoute?i.call(s.fallbackRoute,this,h,u,s):null}function em(t,e=10){if(t.length<=1)return t;for(let n=0,i=t.length;n<i-1;n+=1){const i=t[n],r=t[n+1];if(i.x===r.x){const t=e*Math.round(i.x/e);i.x!==t&&(i.x=t,r.x=t)}else if(i.y===r.y){const t=e*Math.round(i.y/e);i.y!==t&&(i.y=t,r.y=t)}}return t}const nm=function(t,e,n){const r=kp(e),s=Ip(n,r),o=Rp(n,r),a=Vp(n,r),l=new Dp(r).build(n.graph.model,n.cell),c=t.map(t=>Vh.create(t)),h=[];let u,d,g=a;for(let f=0,p=c.length;f<=p;f+=1){let e=null;if(u=d||s,d=c[f],null==d){d=o;const t=n.cell,l=null==t.getSourceCellId()||null==t.getTargetCellId();if(l&&"function"===typeof r.draggingRouter){const t=u===s?a:u,o=d.getOrigin();e=i.call(r.draggingRouter,n,t,o,r)}}if(null==e&&(e=tm(n,u,d,l,r)),null===e)return console.warn("Unable to execute manhattan algorithm, use orth instead"),i.call(r.fallbackRouter,this,t,r,n);const p=e[0];p&&p.equals(g)&&e.shift(),g=e[e.length-1]||g,h.push(...e)}return r.snapToGrid?em(h,n.graph.grid.getGridSize()):h},im=function(t,e,n){return i.call(nm,this,t,Object.assign(Object.assign({},Tp),e),n)},rm={maxDirectionChange:45,directions(){const t=Np(this.step,this),e=Np(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(t,e,n){const i=t.theta(e),r=[];let s={x:e.x,y:t.y},o={x:t.x,y:e.y};if(i%180>90){const t=s;s=o,o=t}const a=i%90<45?s:o,l=new Fh(t,a),c=90*Math.ceil(i/90),h=Vh.fromPolar(l.squaredLength(),Dh.toRad(c+135),a),u=new Fh(e,h),d=l.intersectsWithLine(u),g=d||e,f=d?g:t,p=360/n.directions.length,m=f.theta(e),y=Dh.normalize(m+p/2),b=p*Math.floor(y/p);return n.previousDirectionAngle=b,g&&r.push(g.round()),r.push(e),r}},sm=function(t,e,n){return i.call(im,this,t,Object.assign(Object.assign({},rm),e),n)},om=function(t,e,n){const i=e.offset||32,r=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 i&&(s=i),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,d,g;"H"===o?o=h.x-c.x>=0?"L":"R":"V"===o&&(o=h.y-c.y>=0?"T":"B"),"center"===i&&("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];g="L"===o?1:-1,u="x",d="width"}else{if(h.x===c.x)return[...t];g="T"===o?1:-1,u="y",d="height"}const p=c.clone(),m=h.clone();if(p[u]+=g*(a[d]/2+s),m[u]-=g*(l[d]/2+s),f){const t=p.x,e=m.x,n=a.width/2+r,i=l.width/2+r;h.x>c.x?e<=t&&(p.x=Math.max(e,c.x+n),m.x=Math.min(t,h.x-i)):e>=t&&(p.x=Math.min(e,c.x-n),m.x=Math.max(t,h.x+i))}else{const t=p.y,e=m.y,n=a.height/2+r,i=l.height/2+r;h.y>c.y?e<=t&&(p.y=Math.max(e,c.y+n),m.y=Math.min(t,h.y-i)):e>=t&&(p.y=Math.min(e,c.y-n),m.y=Math.max(t,h.y+i))}return[p.toJSON(),...t,m.toJSON()]};function am(t,e){if(null!=e&&!1!==e){const n="boolean"===typeof e?0:e;if(n>0){const e=Vh.create(t[1]).move(t[2],n),i=Vh.create(t[1]).move(t[0],n);return[e.toJSON(),...t,i.toJSON()]}{const e=t[1];return[Object.assign({},e),...t,Object.assign({},e)]}}return t}const lm=function(t,e,n){const i=e.width||50,r=e.height||80,s=r/2,o=e.angle||"auto",a=n.sourceAnchor,l=n.targetAnchor,c=n.sourceBBox,h=n.targetBBox;if(a.equals(l)){const t=t=>{const e=Dh.toRad(t),n=Math.sin(e),r=Math.cos(e),o=new Vh(a.x+r*i,a.y+n*i),l=new Vh(o.x-r*s,o.y-n*s),c=l.clone().rotate(-90,o),h=l.clone().rotate(90,o);return[c.toJSON(),o.toJSON(),h.toJSON()]},n=t=>{const e=a.clone().move(t,-1),n=new Fh(e,t);return!c.containsPoint(t)&&!c.intersectsWithLine(n)},r=[0,90,180,270,45,135,225,315];if("number"===typeof o)return am(t(o),e.merge);const l=c.getCenter();if(l.equals(a))return am(t(0),e.merge);const h=l.angleBetween(a,l.clone().translate(1,0));let u=t(h);if(n(u[1]))return am(u,e.merge);for(let i=1,s=r.length;i<s;i+=1)if(u=t(h+r[i]),n(u[1]))return am(u,e.merge);return am(u,e.merge)}{const t=new Fh(a,l);let r=t.parallel(-i),o=r.getCenter(),u=r.start.clone().move(r.end,s),d=r.end.clone().move(r.start,s);const g=t.parallel(-1),f=new Fh(g.start,o),p=new Fh(g.end,o);if((c.containsPoint(o)||h.containsPoint(o)||c.intersectsWithLine(f)||c.intersectsWithLine(p)||h.intersectsWithLine(f)||h.intersectsWithLine(p))&&(r=t.parallel(i),o=r.getCenter(),u=r.start.clone().move(r.end,s),d=r.end.clone().move(r.start,s)),e.merge){const t=new Fh(a,l),e=new Fh(o,t.center).setLength(Number.MAX_SAFE_INTEGER),i=c.intersectsWithLine(e),r=h.intersectsWithLine(e),s=i?Array.isArray(i)?i:[i]:[];r&&(Array.isArray(r)?s.push(...r):s.push(r));const u=t.center.closest(s);u?(n.sourceAnchor=u.clone(),n.targetAnchor=u.clone()):(n.sourceAnchor=t.center.clone(),n.targetAnchor=t.center.clone())}return am([u.toJSON(),o.toJSON(),d.toJSON()],e.merge)}};var cm;(function(t){t.presets=C,t.registry=hu.create({type:"router"}),t.registry.register(t.presets,!0)})(cm||(cm={}));const hm=function(t,e,n,i={}){const r=[t,...n,e],s=new _h(r),o=new cu(s);return i.raw?o:o.serialize()},um=function(t,e,n,i={}){const r=3===n.length?0:1,s=Vh.create(n[0+r]),o=Vh.create(n[2+r]),a=Vh.create(n[1+r]);if(!Vh.equals(t,e)){const n=new Vh((t.x+e.x)/2,(t.y+e.y)/2),i=n.angleBetween(Vh.create(t).rotate(90,n),a);i>1&&(s.rotate(180-i,n),o.rotate(180-i,n),a.rotate(180-i,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 i.raw?cu.parse(l):l},dm=function(t,e,n,i={}){const r=new cu;r.appendSegment(cu.createSegment("M",t));const s=1/3,o=2/3,a=i.radius||10;let l,c;for(let h=0,u=n.length;h<u;h+=1){const i=Vh.create(n[h]),u=n[h-1]||t,d=n[h+1]||e;l=c||i.distance(u)/2,c=i.distance(d)/2;const g=-Math.min(a,l),f=-Math.min(a,c),p=i.clone().move(u,g).round(),m=i.clone().move(d,f).round(),y=new Vh(s*p.x+o*i.x,o*i.y+s*p.y),b=new Vh(s*m.x+o*i.x,o*i.y+s*m.y);r.appendSegment(cu.createSegment("L",p)),r.appendSegment(cu.createSegment("C",y,b,m))}return r.appendSegment(cu.createSegment("L",e)),i.raw?r:r.serialize()},gm=function(t,e,n,i={}){let r,s=i.direction;if(n&&0!==n.length){const i=[t,...n,e],s=Yh.throughPoints(i);r=new cu(s)}else if(r=new cu,r.appendSegment(cu.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;r.appendSegment(cu.createSegment("C",n,t.y,n,e.y,e.x,e.y))}else{const n=(t.y+e.y)/2;r.appendSegment(cu.createSegment("C",t.x,n,e.x,n,e.x,e.y))}return i.raw?r:r.serialize()},fm=1,pm=1/3,mm=2/3;function ym(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)}}function bm(t,e,n=[]){const i=[t,...n,e],r=[];return i.forEach((t,e)=>{const n=i[e+1];null!=n&&r.push(new Fh(t,n))}),r}function vm(t,e){const n=[];return e.forEach(e=>{const i=t.intersectsWithLine(e);i&&n.push(i)}),n}function xm(t,e){return new Fh(t,e).squaredLength()}function wm(t,e,n){return e.reduce((i,r,s)=>{if(Om.includes(r))return i;const o=i.pop()||t,a=Vh.create(r).move(o.start,-n);let l=Vh.create(r).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),Om.push(c))}else{const t=a.distance(o.end);if(t<2*n+fm)return i.push(o),i}const h=l.distance(o.start);if(h<2*n+fm)return i.push(o),i;const u=new Fh(a,l);return Am.push(u),i.push(new Fh(o.start,a),u,new Fh(l,o.end)),i},[])}function Pm(t,e,n,i){const r=new cu;let s;return s=cu.createSegment("M",t[0].start),r.appendSegment(s),t.forEach((o,a)=>{if(Am.includes(o)){let t,i,a,l;if("arc"===n){t=-90,i=o.start.diff(o.end);const e=i.x<0||0===i.x&&i.y<0;e&&(t+=180);const n=o.getCenter(),c=new Fh(n,o.end).rotate(t,n);let h;h=new Fh(o.start,n),a=h.pointAt(2/3).rotate(t,o.start),l=c.pointAt(1/3).rotate(-t,c.end),s=cu.createSegment("C",a,l,c.end),r.appendSegment(s),h=new Fh(n,o.end),a=c.pointAt(1/3).rotate(t,c.end),l=h.pointAt(1/3).rotate(-t,o.end),s=cu.createSegment("C",a,l,o.end),r.appendSegment(s)}else if("gap"===n)s=cu.createSegment("M",o.end),r.appendSegment(s);else if("cubic"===n){t=o.start.theta(o.end);const n=.6*e;let c=1.35*e;i=o.start.diff(o.end);const h=i.x<0||0===i.x&&i.y<0;h&&(c*=-1),a=new Vh(o.start.x+n,o.start.y+c).rotate(t,o.start),l=new Vh(o.end.x-n,o.end.y+c).rotate(t,o.end),s=cu.createSegment("C",a,l,o.end),r.appendSegment(s)}}else{const e=t[a+1];0===i||!e||Am.includes(e)?(s=cu.createSegment("L",o.end),r.appendSegment(s)):Cm(i,r,o.end,o.start,e.end)}}),r}function Cm(t,e,n,i,r){const s=n.distance(i)/2,o=n.distance(r)/2,a=-Math.min(t,s),l=-Math.min(t,o),c=n.clone().move(i,a).round(),h=n.clone().move(r,l).round(),u=new Vh(pm*c.x+mm*n.x,mm*n.y+pm*c.y),d=new Vh(pm*h.x+mm*n.x,mm*n.y+pm*h.y);let g;g=cu.createSegment("L",c),e.appendSegment(g),g=cu.createSegment("C",u,d,h),e.appendSegment(g)}let Am,Om;const Em=function(t,e,n,i={}){Am=[],Om=[],ym(this);const r=i.size||5,s=i.type||"arc",o=i.radius||0,a=i.ignoreConnectors||["smooth"],l=this.graph,c=l.model,h=c.getEdges();if(1===h.length)return Pm(bm(t,e,n),r,s,o);const u=this.cell,d=h.indexOf(u),g=l.options.connecting.connector||{},f=h.filter((t,e)=>{const n=t.getConnector()||g;return!a.includes(n.name)&&(!(e>d)||"jumpover"!==n.name)}),p=f.map(t=>l.findViewByCell(t)),m=bm(t,e,n),y=p.map(t=>null==t?[]:t===this?m:bm(t.sourcePoint,t.targetPoint,t.routePoints)),b=[];m.forEach(t=>{const e=f.reduce((e,n,i)=>{if(n!==u){const n=vm(t,y[i]);e.push(...n)}return e},[]).sort((e,n)=>xm(t.start,e)-xm(t.start,n));e.length>0?b.push(...wm(t,e,r)):b.push(t)});const v=Pm(b,r,s,o);return Am=[],Om=[],i.raw?v:v.serialize()};var Mm;(function(t){t.presets=A,t.registry=hu.create({type:"connector"}),t.registry.register(t.presets,!0)})(Mm||(Mm={}));var Sm=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Tm extends Mn{constructor(t={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(r.cloneDeep(t)),this.changed={}}mutate(t,e={}){const n=!0===e.unset,i=!0===e.silent,s=[],o=this.changing;this.changing=!0,o||(this.previous=r.cloneDeep(this.data),this.changed={});const a=this.data,l=this.previous,c=this.changed;if(Object.keys(t).forEach(e=>{const i=e,o=t[i];r.isEqual(a[i],o)||s.push(i),r.isEqual(l[i],o)?delete c[i]:c[i]=o,n?delete a[i]:a[i]=o}),!i&&s.length>0&&(this.pending=!0,this.pendingOptions=e,s.forEach(t=>{this.emit("change:*",{key:t,options:e,store:this,current:a[t],previous:l[t]})})),o)return this;if(!i)while(this.pending)this.pending=!1,this.emit("changed",{current:a,previous:l,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,i={};let r;if("string"===typeof t)i[t]=n,r=e;else if(Array.isArray(t))t.forEach(t=>i[t]=n),r=e;else{for(const t in this.data)i[t]=n;r=t}return this.mutate(i,Object.assign(Object.assign({},r),{unset:!0})),this}getByPath(t){return r.getByPath(this.data,t,"/")}setByPath(t,e,n={}){const i="/",s=Array.isArray(t)?[...t]:t.split(i),o=Array.isArray(t)?t.join(i):t,a=s[0],l=s.length;if(n.propertyPath=o,n.propertyValue=e,n.propertyPathArray=s,1===l)this.set(a,e,n);else{const o={};let c=o,h=a;for(let t=1;t<l;t+=1){const e=s[t],n=Number.isFinite(Number(e));c=c[h]=n?[]:{},h=e}r.setByPath(o,s,e,i);const u=r.cloneDeep(this.data);n.rewrite&&r.unsetByPath(u,t,i);const d=r.merge(u,o);this.set(a,d[a],n)}return this}removeByPath(t,e){const n=Array.isArray(t)?t:t.split("/"),i=n[0];if(1===n.length)this.remove(i,e);else{const t=n.slice(1),s=r.cloneDeep(this.get(i));s&&r.unsetByPath(s,t),this.set(i,s,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()?r.cloneDeep(this.changed):null;const e=this.changing?this.previous:this.data,n={};let i;for(const s in t){const o=t[s];r.isEqual(e[s],o)||(n[s]=o,i=!0)}return i?r.cloneDeep(n):null}toJSON(){return r.cloneDeep(this.data)}clone(){const t=this.constructor;return new t(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})}}Sm([Mn.dispose()],Tm.prototype,"dispose",null);class Nm{constructor(t){this.cell=t,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(t,e,n={},i="/"){const s=this.cell.getPropByPath(t),o=r.defaults(n,Nm.defaultOptions),a=this.getTiming(o.timing),l=this.getInterp(o.interp,s,e);let c=0;const h=Array.isArray(t)?t.join(i):t,u=Array.isArray(t)?t:t.split(i),d=()=>{const t=(new Date).getTime();0===c&&(c=t);const e=t-c;let i=e/o.duration;i<1?this.ids[h]=requestAnimationFrame(d):i=1;const r=l(a(i));this.cell.setPropByPath(u,r),n.progress&&n.progress(Object.assign({progress:i,currentValue:r},this.getArgs(h))),1===i&&(this.cell.notify("transition:complete",this.getArgs(h)),n.complete&&n.complete(this.getArgs(h)),this.cell.notify("transition:finish",this.getArgs(h)),n.finish&&n.finish(this.getArgs(h)),this.clean(h))};return setTimeout(()=>{this.stop(t,void 0,i),this.cache[h]={startValue:s,targetValue:e,options:o},this.ids[h]=requestAnimationFrame(d),this.cell.notify("transition:start",this.getArgs(h)),n.start&&n.start(this.getArgs(h))},n.delay),this.stop.bind(this,t,i,n)}stop(t,e={},n="/"){const i=Array.isArray(t)?t:t.split(n);return Object.keys(this.ids).filter(t=>r.isEqual(i,t.split(n).slice(0,i.length))).forEach(t=>{cancelAnimationFrame(this.ids[t]);const n=this.cache[t],i=this.getArgs(t),r=Object.assign(Object.assign({},n.options),e),s=r.jumpedToEnd;s&&null!=n.targetValue&&(this.cell.setPropByPath(t,n.targetValue),this.cell.notify("transition:end",Object.assign({},i)),this.cell.notify("transition:complete",Object.assign({},i)),r.complete&&r.complete(Object.assign({},i)));const o=Object.assign({jumpedToEnd:s},i);this.cell.notify("transition:stop",Object.assign({},o)),r.stop&&r.stop(Object.assign({},o)),this.cell.notify("transition:finish",Object.assign({},i)),r.finish&&r.finish(Object.assign({},i)),this.clean(t)}),this}clean(t){delete this.ids[t],delete this.cache[t]}getTiming(t){return"string"===typeof t?Mh[t]:t}getInterp(t,e,n){return t?t(e,n):"number"===typeof n?Sh.number(e,n):"string"===typeof n?"#"===n[0]?Sh.color(e,n):Sh.unit(e,n):Sh.object(e,n)}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"}})(Nm||(Nm={}));var km,jm=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o},Lm=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class Bm extends Mn{static config(t){const{markup:e,propHooks:n,attrHooks:i}=t,s=Lm(t,["markup","propHooks","attrHooks"]);null!=e&&(this.markup=e),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):"function"===typeof n?this.propHooks.push(n):Object.values(n).forEach(t=>{"function"===typeof t&&this.propHooks.push(t)})),i&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),i)),this.defaults=r.merge({},this.defaults,s)}static getMarkup(){return this.markup}static getDefaults(t){return t?this.defaults:r.cloneDeep(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(t,e){return this.propHooks.reduce((e,n)=>n?i.call(n,t,e):e,e)}get[Symbol.toStringTag](){return Bm.toStringTag}constructor(t={}){super();const e=this.constructor,n=e.getDefaults(!0),i=r.merge({},this.preprocess(n),this.preprocess(t));this.id=i.id||o.uuid(),this.store=new Tm(i),this.animation=new Nm(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,i=this.constructor,r=i.applyPropHooks(this,t);return null==n&&!0!==e&&(r.id=o.uuid()),r}postprocess(t){}setup(){this.store.on("change:*",t=>{const{key:e,current:n,previous:i,options:r}=t;this.notify("change:*",{key:e,options:r,current:n,previous:i,cell:this}),this.notify("change:"+e,{options:r,current:n,previous:i,cell:this});const s=e;"source"!==s&&"target"!==s||this.notify("change:terminal",{type:s,current:n,previous:i,options:r,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(r.merge({},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,i=e.getMaxZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this],i=i-n.length+1;const r=e.total();let s=e.indexOf(this)!==r-n.length;s||(s=n.some((t,e)=>t.getZIndex()!==i+e)),s&&this.batchUpdate("to-front",()=>{i+=n.length,n.forEach((e,n)=>{e.setZIndex(i+n,t)})})}return this}toBack(t={}){const e=this.model;if(e){let n,i=e.getMinZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this];let r=0!==e.indexOf(this);r||(r=n.some((t,e)=>t.getZIndex()!==i+e)),r&&this.batchUpdate("to-back",()=>{i-=n.length,n.forEach((e,n)=>{e.setZIndex(i+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){const e=this.constructor;t=e.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 i=this.getAttrs();!1===e.deep?n(Object.assign(Object.assign({},i),t)):n(r.merge({},i,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,n=e.getAttrHooks()||{};let i=n[t]||dg.registry.get(t);if(!i){const e=o.camelCase(t);i=n[e]||dg.registry.get(e)}return i||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?t:!this.isVisible(),i="boolean"===typeof t?e:t;return n?this.show(i):this.hide(i),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 i=this.getData();!1===e.deep?n("object"===typeof t?Object.assign(Object.assign({},i),t):t):n(r.merge({},i,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();while(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()||[];while(e.length>0){const n=e.shift(),i=n.getChildren();t.push(n),i&&e.push(...i)}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();while(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 Bm.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 i=this.getChildIndex(t);-1!==i&&(n.splice(i,1),t.setParent(null,e),this.setChildren(n,e))}return this}embed(t,e={}){return t.addTo(this,e),this}addTo(t,e={}){return Bm.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 i=t.getParent(),r=this!==i;let s=e;if(null==s&&(s=this.getChildCount(),r||(s-=1)),i){const e=i.getChildren();if(e){const r=e.indexOf(t);r>=0&&(t.setParent(null,n),e.splice(r,1),i.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),r&&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),i=this.children;return null!=i&&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={},i="/"){return this.animation.start(t,e,n,i)}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,i){return this}addTools(t,e,n){const i=Array.isArray(t)?t:[t],s="string"===typeof e?e:null,o="object"===typeof e?e:"object"===typeof n?n:{};if(o.reset)return this.setTools({name:s,items:i,local:o.local},o);let a=r.cloneDeep(this.getTools());return null==a||null==s||a.name===s?(null==a&&(a={}),a.items||(a.items=[]),a.name=s,a.items=[...a.items,...i],this.setTools(Object.assign({},a),o)):void 0}setTools(t,e={}){return null==t?this.removeTools():this.store.set("tools",Bm.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=r.cloneDeep(this.getTools());if(n){let i=!1;const r=n.items.slice(),s=t=>{r.splice(t,1),i=!0};if("number"===typeof t)s(t);else for(let e=r.length-1;e>=0;e-=1){const n=r[e],i="string"===typeof n?n===t:n.name===t;i&&s(e)}i&&(n.items=r,this.setTools(n,e))}return this}getBBox(t){return new zh}getConnectionPoint(t,e){return new Vh}toJSON(t={}){const e=Object.assign({},this.store.get()),n=Object.prototype.toString,i=this.isNode()?"node":this.isEdge()?"edge":"cell";if(!e.shape){const t=this.constructor;throw new Error(`Unable to serialize ${i} missing "shape" prop, check the ${i} "${t.name||n.call(t)}"`)}const s=this.constructor,o=!0===t.diff,a=e.attrs||{},l=s.getDefaults(!0),c=o?this.preprocess(l,!0):l,h=c.attrs||{},u={};Object.entries(e).forEach(([t,s])=>{if(null!=s&&!Array.isArray(s)&&"object"===typeof s&&!r.isPlainObject(s))throw new Error(`Can only serialize ${i} with plain-object props, but got a "${n.call(s)}" type of key "${t}" on ${i} "${this.id}"`);if("attrs"!==t&&"shape"!==t&&o){const n=c[t];r.isEqual(s,n)&&delete e[t]}}),Object.keys(a).forEach(t=>{const e=a[t],n=h[t];Object.keys(e).forEach(i=>{const s=e[i],o=n?n[i]:null;null==s||"object"!==typeof s||Array.isArray(s)?null!=n&&r.isEqual(o,s)||(null==u[t]&&(u[t]={}),u[t][i]=s):Object.keys(s).forEach(e=>{const a=s[e];if(null==n||null==o||!r.isObject(o)||!r.isEqual(o[e],a)){null==u[t]&&(u[t]={}),null==u[t][i]&&(u[t][i]={});const n=u[t][i];n[e]=a}})})});const d=Object.assign(Object.assign({},e),{attrs:r.isEmpty(u)?void 0:u});null==d.attrs&&delete d.attrs;const g=d;return 0===g.angle&&delete g.angle,r.cloneDeep(g)}clone(t={}){if(!t.deep){const e=Object.assign({},this.store.get());t.keepId||delete e.id,delete e.parent,delete e.children;const n=this.constructor;return new n(e)}const e=Bm.deepClone(this);return e[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 i=this.model;this.startBatch(t,n,i);const r=e();return this.stopBatch(t,n,i),r}dispose(){this.removeFromParent(),this.store.dispose()}}Bm.defaults={},Bm.attrHooks={},Bm.propHooks=[],jm([Mn.dispose()],Bm.prototype,"dispose",null),function(t){function e(t){return"string"===typeof t?{items:[t]}:Array.isArray(t)?{items:t}:t.items?t:{items:[t]}}t.normalizeTools=e}(Bm||(Bm={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr}t.toStringTag="X6."+t.name,t.isCell=e}(Bm||(Bm={})),function(t){function e(...t){const e=t.filter(t=>null!=t).map(t=>t.getAncestors()).sort((t,e)=>t.length-e.length),n=e.shift();return n.find(t=>e.every(e=>e.includes(t)))||null}function n(t,e={}){let n=null;for(let i=0,r=t.length;i<r;i+=1){const r=t[i];let s=r.getBBox(e);if(s){if(r.isNode()){const t=r.getAngle();null!=t&&0!==t&&(s=s.bbox(t))}n=null==n?s:n.union(s)}}return n}function i(e){const n=[e,...e.getDescendants({deep:!0})];return t.cloneCells(n)}function r(t){const e=s.uniq(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(),i=e.getTargetCellId();t&&n[t]&&e.setSource(Object.assign(Object.assign({},e.getSource()),{cell:n[t].id})),i&&n[i]&&e.setTarget(Object.assign(Object.assign({},e.getTarget()),{cell:n[i].id}))}const i=t.getParent();i&&n[i.id]&&e.setParent(n[i.id]);const r=t.getChildren();if(r&&r.length){const t=r.reduce((t,e)=>(n[e.id]&&t.push(n[e.id]),t),[]);t.length>0&&e.setChildren(t)}}),n}t.getCommonAncestor=e,t.getCellsBBox=n,t.deepClone=i,t.cloneCells=r}(Bm||(Bm={})),function(t){t.config({propHooks(e){var{tools:n}=e,i=Lm(e,["tools"]);return n&&(i.tools=t.normalizeTools(n)),i}})}(Bm||(Bm={})),function(t){let e,n;function i(t,i){return i?null!=e&&e.exist(t):null!=n&&n.exist(t)}function r(t){e=t}function s(t){n=t}t.exist=i,t.setEdgeRegistry=r,t.setNodeRegistry=s}(km||(km={}));class Dm{constructor(t){this.ports=[],this.groups={},this.init(r.cloneDeep(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),i=t?this.getGroup(t):null,r=i?i.position:null,s=r?r.name:null;let o;if(null!=s){const t=Ig.registry.get(s);if(null==t)return Ig.registry.onNotFound(s);o=t}else o=Ig.presets.left;const a=n.map(t=>t&&t.position&&t.position.args||{}),l=r&&r.args||{},c=o(a,e,l);return c.map((t,i)=>{const r=n[i];return{portLayout:t,portId:r.id,portSize:r.size,portAttrs:r.attrs,labelSize:r.label.size,labelLayout:this.getPortLabelLayout(r,Vh.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=r.merge({},n.attrs,e.attrs),e.position=this.createPosition(n,e),e.label=r.merge({},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 r.merge({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 i=t.label.position.name||"left",r=t.label.position.args||{},s=tf.registry.get(i)||tf.presets.left;return s?s(e,n,r):null}}var Im=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class Rm extends Bm{get[Symbol.toStringTag](){return Rm.toStringTag}constructor(t={}){super(t),this.initPorts()}preprocess(t,e){const{x:n,y:i,width:r,height:s}=t,o=Im(t,["x","y","width","height"]);if(null!=n||null!=i){const t=o.position;o.position=Object.assign(Object.assign({},t),{x:null!=n?n:t?t.x:0,y:null!=i?i:t?t.y:0})}if(null!=r||null!=s){const t=o.size;o.size=Object.assign(Object.assign({},t),{width:null!=r?r:t?t.width:0,height:null!=s?s:t?t.height:0})}return super.preprocess(o,e)}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(t,e,n={}){this.startBatch("resize",n);const i=n.direction;if(i){const r=this.getSize();switch(i){case"left":case"right":e=r.height;break;case"top":case"bottom":t=r.width;break;default:break}const s={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3};let o=s[i];const a=Dh.normalize(this.getAngle()||0);n.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(t*t+e*e)/2;let d=o*Math.PI/2;d+=Math.atan(o%2===0?e/t:t/e),d-=Dh.toRad(a);const g=Vh.fromPolar(u,d,h),f=g.clone().translate(t/-2,e/-2);this.store.set("size",{width:t,height:e},n),this.setPosition(f.x,f.y,n)}else this.store.set("size",{width:t,height:e},n);return this.stopBatch("resize",n),this}scale(t,e,n,i={}){const r=this.getBBox().scale(t,e,null==n?void 0:n);return this.startBatch("scale",i),this.setPosition(r.x,r.y,i),this.resize(r.width,r.height,i),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 i,r,s;if("object"===typeof t?(i=t.x,r=t.y,s=e||{}):(i=t,r=e,s=n||{}),s.relative){const t=this.getParent();if(null!=t&&t.isNode()){const e=t.getPosition();i+=e.x,r+=e.y}}if(s.deep){const t=this.getPosition();this.translate(i-t.x,r-t.y,s)}else this.store.set("position",{x:i,y:r},s);return this}translate(t=0,e=0,n={}){if(0===t&&0===e)return this;n.translateBy=n.translateBy||this.id;const i=this.getPosition();if(null!=n.restrict&&n.translateBy===this.id){const r=this.getBBox({deep:!0}),s=n.restrict,o=i.x-r.x,a=i.y-r.y,l=Math.max(s.x+o,Math.min(s.x+s.width+o-r.width,i.x+t)),c=Math.max(s.y+a,Math.min(s.y+s.height+a-r.height,i.y+e));t=l-i.x,e=c-i.y}const r={x:i.x+t,y:i.y+e};return n.tx=t,n.ty=e,n.transition?("object"!==typeof n.transition&&(n.transition={}),this.transition("position",r,Object.assign(Object.assign({},n.transition),{interp:Sh.object})),this.eachChild(i=>{var r;const s=null===(r=n.exclude)||void 0===r?void 0:r.includes(i);s||i.translate(t,e,n)})):(this.startBatch("translate",n),this.store.set("position",r,n),this.eachChild(i=>{var r;const s=null===(r=n.exclude)||void 0===r?void 0:r.includes(i);s||i.translate(t,e,n)}),this.stopBatch("translate",n)),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 i=this.getSize(),r=this.getPosition(),s=this.getBBox().getCenter();s.rotate(n-t,e.center);const o=s.x-i.width/2-r.x,a=s.y-i.height/2-r.y;this.startBatch("rotate",{angle:t,options:e}),this.setPosition(r.x+o,r.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),Bm.getCellsBBox(t)}return zh.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(t,e){const n=this.getBBox(),i=n.getCenter(),r=t.getTerminal(e);if(null==r)return i;const s=r.port;if(!s||!this.hasPort(s))return i;const o=this.getPort(s);if(!o||!o.group)return i;const a=this.getPortsPosition(o.group),l=a[s].position,c=Vh.create(l).translate(n.getOrigin()),h=this.getAngle();return h&&c.rotate(-h,i),c}fit(t={}){const e=this.getChildren()||[],n=e.filter(t=>t.isNode());if(0===n.length)return this;this.startBatch("fit-embeds",t),t.deep&&n.forEach(e=>e.fit(t));let{x:i,y:r,width:s,height:o}=Bm.getCellsBBox(n);const l=a.normalizeSides(t.padding);return i-=l.left,r-=l.top,s+=l.left+l.right,o+=l.bottom+l.top,this.store.set({position:{x:i,y:r},size:{width:s,height:o}},t),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(t){this.setPortContainerMarkup(t)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||nf.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(t,e={}){return this.store.set("portContainerMarkup",nf.clone(t),e),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(t){this.setPortMarkup(t)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||nf.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(t,e={}){return this.store.set("portMarkup",nf.clone(t),e),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(t){this.setPortLabelMarkup(t)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||nf.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(t,e={}){return this.store.set("portLabelMarkup",nf.clone(t),e),this}get ports(){const t=this.store.get("ports",{items:[]});return null==t.items&&(t.items=[]),t}getPorts(){return r.cloneDeep(this.ports.items)}getPortsByGroup(t){return this.getPorts().filter(e=>e.group===t)}getPort(t){return r.cloneDeep(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(),n=this.port.getPortsLayoutByGroup(t,new zh(0,0,e.width,e.height));return n.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,i){if("string"===typeof e||Array.isArray(e)){const r=this.prefixPortPath(t,e),s=n;return this.setPropByPath(r,s,i)}const r=this.prefixPortPath(t),s=e;return this.setPropByPath(r,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,i){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,i):this.setPortProp(t,e,n,i):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 i=[...this.ports.items];return i.splice(t,0,e),this.setPropByPath("ports/items",i,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],i=e.filter(e=>!t.some(t=>{const n="string"===typeof t?t:t.id;return e.id===n}));this.setPropByPath("ports/items",i,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={},i=this.store.getPrevious("ports")||{items:[]};i.items.forEach(t=>{t.id&&!e[t.id]&&(n[t.id]=!0)});const s=this.model;if(s&&!r.isEmpty(n)){const t=s.getConnectedEdges(this,{incoming:!0});t.forEach(t=>{const e=t.getTargetPortId();e&&n[e]&&t.remove()});const e=s.getConnectedEdges(this,{outgoing:!0});e.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 o.uuid()}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 Dm(this.ports);const n=this.port.getPorts(),i=e?n.filter(t=>e.find(e=>e.id===t.id)?null:t):[...n],r=e?e.filter(t=>n.find(e=>e.id===t.id)?null:t):[];i.length>0&&this.notify("ports:added",{added:i,cell:this,node:this}),r.length>0&&this.notify("ports:removed",{removed:r,cell:this,node:this})}}Rm.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr&&"function"===typeof i.size&&"function"===typeof i.position}t.toStringTag="X6."+t.name,t.isNode=e}(Rm||(Rm={})),function(t){t.config({propHooks(t){var{ports:e}=t,n=Im(t,["ports"]);return e&&(n.ports=Array.isArray(e)?{items:e}:e),n}})}(Rm||(Rm={})),function(t){t.registry=hu.create({type:"node",process(e,n){if(km.exist(e,!0))throw new Error(`Node with name '${e}' was registered by anthor Edge`);if("function"===typeof n)return n.config({shape:e}),n;let i=t;const{inherit:r}=n,s=Im(n,["inherit"]);if(r)if("string"===typeof r){const t=this.get(r);null==t?this.onNotFound(r,"inherited"):i=t}else i=r;null==s.constructorName&&(s.constructorName=e);const o=i.define.call(i,s);return o.config({shape:e}),o}}),km.setNodeRegistry(t.registry)}(Rm||(Rm={})),function(t){let e=0;function n(t){return t?o.pascalCase(t):(e+=1,"CustomNode"+e)}function i(e){const{constructorName:i,overwrite:s}=e,o=Im(e,["constructorName","overwrite"]),a=r.createClass(n(i||o.shape),this);return a.config(o),o.shape&&t.registry.register(o.shape,a,s),a}function s(e){const n=e.shape||"rect",i=t.registry.get(n);return i?new i(e):t.registry.onNotFound(n)}t.define=i,t.create=s}(Rm||(Rm={}));var Vm=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class zm extends Bm{get[Symbol.toStringTag](){return zm.toStringTag}constructor(t={}){super(t)}preprocess(t,e){const{source:n,sourceCell:i,sourcePort:r,sourcePoint:s,target:o,targetCell:a,targetPort:l,targetPoint:c}=t,h=Vm(t,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),u=h,d=t=>"string"===typeof t||"number"===typeof t;if(null!=n)if(Bm.isCell(n))u.source={cell:n.id};else if(d(n))u.source={cell:n};else if(Vh.isPoint(n))u.source=n.toJSON();else if(Array.isArray(n))u.source={x:n[0],y:n[1]};else{const t=n.cell;Bm.isCell(t)?u.source=Object.assign(Object.assign({},n),{cell:t.id}):u.source=n}if(null!=i||null!=r){let t=u.source;if(null!=i){const e=d(i)?i:i.id;t?t.cell=e:t=u.source={cell:e}}null!=r&&t&&(t.port=r)}else null!=s&&(u.source=Vh.create(s).toJSON());if(null!=o)if(Bm.isCell(o))u.target={cell:o.id};else if(d(o))u.target={cell:o};else if(Vh.isPoint(o))u.target=o.toJSON();else if(Array.isArray(o))u.target={x:o[0],y:o[1]};else{const t=o.cell;Bm.isCell(t)?u.target=Object.assign(Object.assign({},o),{cell:t.id}):u.target=o}if(null!=a||null!=l){let t=u.target;if(null!=a){const e=d(a)?a:a.id;t?t.cell=e:t=u.target={cell:e}}null!=l&&t&&(t.port=l)}else null!=c&&(u.target=Vh.create(c).toJSON());return super.preprocess(u,e)}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,i={}){if(Bm.isCell(e))return this.store.set(t,r.merge({},n,{cell:e.id}),i),this;const s=e;return Vh.isPoint(e)||null!=s.x&&null!=s.y?(this.store.set(t,r.merge({},n,{x:s.x,y:s.y}),i),this):(this.store.set(t,r.cloneDeep(e),i),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(t){const e=this[t];if(Vh.isPointLike(e))return Vh.create(e);const n=this.getTerminalCell(t);return n?n.getConnectionPoint(this,t):new Vh}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={};while(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,e=this.store.get("defaultLabel")||t.defaultLabel||{};return r.cloneDeep(e)}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 i=this.getLabels(),r=i.length;let s=null!=e&&Number.isFinite(e)?e:r;return s<0&&(s=r+s+1),i.splice(s,0,this.parseLabel(t)),this.setLabels(i,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 i=this.getLabels();i[t]=this.parseLabel(e),this.setLabels(i,n)}return this}removeLabelAt(t,e={}){const n=this.getLabels(),i=null!=t&&Number.isFinite(t)?t:-1,r=n.splice(i,1);return this.setLabels(n,e),r.length?r[0]:null}parseLabel(t){if("string"===typeof t){const e=this.constructor;return e.parseStringLabel(t)}return t}onLabelsChanged({previous:t,current:e}){const n=t&&e?e.filter(e=>t.find(t=>e===t||r.isEqual(e,t))?null:e):e?[...e]:[],i=t&&e?t.filter(t=>e.find(e=>t===e||r.isEqual(t,e))?null:t):t?[...t]:[];n.length>0&&this.notify("labels:added",{added:n,cell:this,edge:this}),i.length>0&&this.notify("labels:removed",{removed:i,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=>Vh.toJSON(t)),e),this}insertVertex(t,e,n={}){const i=this.getVertices(),r=i.length;let s=null!=e&&Number.isFinite(e)?e:r;return s<0&&(s=r+s+1),i.splice(s,0,Vh.toJSON(t)),this.setVertices(i,n)}appendVertex(t,e={}){return this.insertVertex(t,-1,e)}getVertexAt(t){if(null!=t&&Number.isFinite(t)){const e=this.getVertices();return e[t]}return null}setVertexAt(t,e,n={}){if(null!=t&&Number.isFinite(t)){const i=this.getVertices();i[t]=e,this.setVertices(i,n)}return this}removeVertexAt(t,e={}){const n=this.getVertices(),i=null!=t&&Number.isFinite(t)?t:-1;return n.splice(i,1),this.setVertices(n,e)}onVertexsChanged({previous:t,current:e}){const n=t&&e?e.filter(e=>t.find(t=>Vh.equals(e,t))?null:e):e?[...e]:[],i=t&&e?t.filter(t=>e.find(e=>Vh.equals(t,e))?null:t):t?[...t]:[];n.length>0&&this.notify("vertexs:added",{added:n,cell:this,edge:this}),i.length>0&&this.notify("vertexs:removed",{removed:i,cell:this,edge:this})}getDefaultMarkup(){return this.store.get("defaultMarkup")||nf.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,i={}){return this.applyToPoints(i=>Vh.create(i).scale(t,e,n).toJSON(),i)}applyToPoints(t,e={}){const n={},i=this.getSource(),r=this.getTarget();Vh.isPointLike(i)&&(n.source=t(i)),Vh.isPointLike(r)&&(n.target=t(r));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=>Vh.create(t)),this.getTargetPoint()];return new _h(t)}updateParent(t){let e=null;const n=this.getSourceCell(),i=this.getTargetCell(),r=this.getParent();return n&&i&&(e=n===i||n.isDescendantOf(i)?i:i.isDescendantOf(n)?n:Bm.getCommonAncestor(n,i)),r&&e&&e.id!==r.id&&r.unembed(this,t),!e||r&&r.id===e.id||e.embed(this,t),e}hasLoop(t={}){const e=this.getSource(),n=this.getTarget(),i=e.cell,r=n.cell;if(!i||!r)return!1;let s=i===r;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))}}zm.defaults={},function(t){function e(t,e){const n=t,i=e;return n.cell===i.cell&&(n.port===i.port||null==n.port&&null==i.port)}t.equalTerminals=e}(zm||(zm={})),function(t){function e(t){return{attrs:{label:{text: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=e}(zm||(zm={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr&&"function"===typeof i.disconnect&&"function"===typeof i.getSource&&"function"===typeof i.getTarget}t.toStringTag="X6."+t.name,t.isEdge=e}(zm||(zm={})),function(t){t.registry=hu.create({type:"edge",process(e,n){if(km.exist(e,!1))throw new Error(`Edge with name '${e}' was registered by anthor Node`);if("function"===typeof n)return n.config({shape:e}),n;let i=t;const{inherit:r="edge"}=n,s=Vm(n,["inherit"]);if("string"===typeof r){const t=this.get(r||"edge");null==t&&r?this.onNotFound(r,"inherited"):i=t}else i=r;null==s.constructorName&&(s.constructorName=e);const o=i.define.call(i,s);return o.config({shape:e}),o}}),km.setEdgeRegistry(t.registry)}(zm||(zm={})),function(t){let e=0;function n(t){return t?o.pascalCase(t):(e+=1,"CustomEdge"+e)}function i(e){const{constructorName:i,overwrite:s}=e,o=Vm(e,["constructorName","overwrite"]),a=r.createClass(n(i||o.shape),this);return a.config(o),o.shape&&t.registry.register(o.shape,a,s),a}function s(e){const n=e.shape||"edge",i=t.registry.get(n);return i?new i(e):t.registry.onNotFound(n)}t.define=i,t.create=s}(zm||(zm={})),function(t){const e="basic.edge";t.config({shape:e,propHooks(e){const{label:n,vertices:i}=e,r=Vm(e,["label","vertices"]);if(n){null==r.labels&&(r.labels=[]);const e="string"===typeof n?t.parseStringLabel(n):n;r.labels.push(e)}return i&&Array.isArray(i)&&(r.vertices=i.map(t=>Vh.create(t).toJSON())),r}}),t.registry.register(e,t)}(zm||(zm={}));var Fm=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class $m extends Mn{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 i,r;"number"===typeof e?(i=e,r=Object.assign({merge:!1},n)):(i=this.length,r=Object.assign({merge:!1},e)),i>this.length&&(i=this.length),i<0&&(i+=this.length+1);const s=Array.isArray(t)?t:[t],o=this.comparator&&"number"!==typeof e&&!1!==r.sort,a=this.comparator||null;let l=!1;const c=[],h=[];return s.forEach(t=>{const e=this.get(t);e?r.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(i,0,...c),this.length=this.cells.length),l&&this.sort({silent:!0}),r.silent||(c.forEach((t,e)=>{const n={cell:t,index:i+e,options:r};this.trigger("added",n),r.dryrun||t.notify("added",Object.assign({},n))}),l&&this.trigger("sorted"),(c.length||h.length)&&this.trigger("updated",{added:c,merged:h,removed:[],options:r})),this}remove(t,e={}){const n=Array.isArray(t)?t:[t],i=this.removeCells(n,e);return!e.silent&&i.length>0&&this.trigger("updated",{options:e,removed:i,added:[],merged:[]}),Array.isArray(t)?i:i[0]}removeCells(t,e){const n=[];for(let i=0;i<t.length;i+=1){const r=this.get(t[i]);if(null==r)continue;const s=this.cells.indexOf(r);this.cells.splice(s,1),this.length-=1,delete this.map[r.id],n.push(r),this.unreference(r),e.dryrun||r.remove(),e.silent||(this.trigger("removed",{cell:r,index:s,options:e}),e.dryrun||r.notify("removed",{cell:r,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 i=[],r=[];t.forEach(t=>{const e=n.some(e=>e.id===t.id);e||i.push(t)}),n.forEach(e=>{const n=t.some(t=>t.id===e.id);n||r.push(e)}),this.trigger("updated",{options:e,added:i,removed:r,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=s.sortBy(this.cells,this.comparator),t.silent||this.trigger("sorted")),this}clone(){const t=this.constructor;return new t(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([])}}Fm([$m.dispose()],$m.prototype,"dispose",null);var Gm=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class qm extends Mn{get[Symbol.toStringTag](){return qm.toStringTag}constructor(t=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new $m(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(),i=t.getTarget();if(e&&e.cell){const t=this.outgoings[e.cell],i=t?t.indexOf(n):-1;i>=0&&(t.splice(i,1),0===t.length&&delete this.outgoings[e.cell])}if(i&&i.cell){const t=this.incomings[i.cell],e=t?t.indexOf(n):-1;e>=0&&(t.splice(e,1),0===t.length&&delete this.incomings[i.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,i=t.previous(e);if(i&&i.cell){const e=Bm.isCell(i.cell)?i.cell.id:i.cell,r=n[e],s=r?r.indexOf(t.id):-1;s>=0&&(r.splice(s,1),0===r.length&&delete n[e])}const r=t.getTerminal(e);if(r&&r.cell){const e=Bm.isCell(r.cell)?r.cell.id:r.cell,i=n[e]||[],s=i.indexOf(t.id);-1===s&&i.push(t.id),n[e]=i}}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)=>{const n=t.isEdge()?1:2,i=e.isEdge()?1:2;return n-i});while(t.length>0){const e=t.shift();e&&e.remove(n)}},n),this}addNode(t,e={}){const n=Rm.isNode(t)?t:this.createNode(t);return this.addCell(n,e),n}updateNode(t,e={}){const n=this.createNode(t),i=n.getProp();return n.dispose(),this.updateCell(i,e)}createNode(t){return Rm.create(t)}addEdge(t,e={}){const n=zm.isEdge(t)?t:this.createEdge(t);return this.addCell(n,e),n}createEdge(t){return zm.create(t)}updateEdge(t,e={}){const n=this.createEdge(t),i=n.getProp();return n.dispose(),this.updateCell(i,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 i=Object.assign(Object.assign({},e),{position:n-1,maxPosition:n-1});return this.startBatch("add",Object.assign(Object.assign({},i),{cells:t})),t.forEach(t=>{this.addCell(t,i),i.position-=1}),this.stopBatch("add",Object.assign(Object.assign({},i),{cells:t})),this}updateCell(t,e={}){const n=t.id&&this.getCell(t.id);return!!n&&this.batchUpdate("update",()=>(Object.entries(t).forEach(([t,i])=>n.setProp(t,i,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);const i=this.getConnectedEdges(t);return i.forEach(n=>{const i=n.getSourceCell(),r=n.getTargetCell();i===t&&n.setSource(Object.assign(Object.assign({},n.getSource()),{cell:e})),r===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 i=t.getSourceCellId(),r=t.getTargetCellId();i===n&&t.setSource({x:0,y:0},e),r===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=[],i="string"===typeof t?this.getCell(t):t;if(null==i)return n;const r={},s=e.indirect;let o=e.incoming,a=e.outgoing;null==o&&null==a&&(o=a=!0);const l=(t,e)=>{const i=e?this.getOutgoingEdges(t):this.getIncomingEdges(t);if(null!=i&&i.forEach(t=>{r[t.id]||(n.push(t),r[t.id]=!0,s&&(o&&l(t,!1),a&&l(t,!0)))}),s&&t.isEdge()){const i=e?t.getTargetCell():t.getSourceCell();i&&i.isEdge()&&(r[i.id]||(n.push(i),l(i,e)))}};if(a&&l(i,!0),o&&l(i,!1),e.deep){const t=i.getDescendants({deep:!0}),s={};t.forEach(t=>{t.isNode()&&(s[t.id]=!0)});const l=(t,i)=>{const o=i?this.getOutgoingEdges(t.id):this.getIncomingEdges(t.id);null!=o&&o.forEach(t=>{if(!r[t.id]){const i=t.getSourceCell(),o=t.getTargetCell();if(!e.enclosed&&i&&s[i.id]&&o&&s[o.id])return;n.push(t),r[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,i=e?this.getIncomingEdges(n):this.getOutgoingEdges(n);return null==i||0===i.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,i=e.outgoing;null==n&&null==i&&(n=i=!0);const r=this.getConnectedEdges(t,e),s=r.reduce((r,s)=>{const o=s.hasLoop(e),a=s.getSourceCell(),l=s.getTargetCell();return n&&a&&a.isNode()&&!r[a.id]&&(!o&&(a===t||e.deep&&a.isDescendantOf(t))||(r[a.id]=a)),i&&l&&l.isNode()&&!r[l.id]&&(!o&&(l===t||e.deep&&l.isDescendantOf(t))||(r[l.id]=l)),r},{});if(t.isEdge()){if(n){const e=t.getSourceCell();e&&e.isNode()&&!s[e.id]&&(s[e.id]=e)}if(i){const e=t.getTargetCell();e&&e.isNode()&&!s[e.id]&&(s[e.id]=e)}}return Object.keys(s).map(t=>s[t])}isNeighbor(t,e,n={}){let i=n.incoming,r=n.outgoing;return null==i&&null==r&&(i=r=!0),this.getConnectedEdges(t,n).some(t=>{const n=t.getSourceCell(),s=t.getTargetCell();return!(!i||!n||n.id!==e.id)||!(!r||!s||s.id!==e.id)})}getSuccessors(t,e={}){const n=[];return this.search(t,(i,r)=>{i!==t&&this.matchDistance(r,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{outgoing:!0})),n}isSuccessor(t,e,n={}){let i=!1;return this.search(t,(r,s)=>{if(r===e&&r!==t&&this.matchDistance(s,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{outgoing:!0})),i}getPredecessors(t,e={}){const n=[];return this.search(t,(i,r)=>{i!==t&&this.matchDistance(r,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{incoming:!0})),n}isPredecessor(t,e,n={}){let i=!1;return this.search(t,(r,s)=>{if(r===e&&r!==t&&this.matchDistance(s,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),i}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))}),Bm.getCommonAncestor(...e)}getSubGraph(t,e={}){const n=[],i={},r=[],s=[],o=t=>{i[t.id]||(n.push(t),i[t.id]=t,t.isEdge()&&s.push(t),t.isNode()&&r.push(t))};return t.forEach(t=>{if(o(t),e.deep){const e=t.getDescendants({deep:!0});e.forEach(t=>o(t))}}),s.forEach(t=>{const e=t.getSourceCell(),s=t.getTargetCell();e&&!i[e.id]&&(n.push(e),i[e.id]=e,e.isNode()&&r.push(e)),s&&!i[s.id]&&(n.push(s),i[s.id]=s,s.isNode()&&r.push(s))}),r.forEach(t=>{const r=this.getConnectedEdges(t,e);r.forEach(t=>{const e=t.getSourceCell(),r=t.getTargetCell();!i[t.id]&&e&&i[e.id]&&r&&i[r.id]&&(n.push(t),i[t.id]=t)})}),n}cloneSubGraph(t,e={}){const n=this.getSubGraph(t,e);return this.cloneCells(n)}cloneCells(t){return Bm.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,i,r){const s="number"===typeof t?new zh(t,e,n,i):zh.create(t),o="number"===typeof t?r: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,i,r){const s="number"===typeof t?new zh(t,e,n,i):zh.create(t),o="number"===typeof t?r: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(),i=null==e.by||"bbox"===e.by?this.getNodesInArea(n):this.getNodesFromPoint(n[e.by]);return i.filter(e=>t.id!==e.id&&!e.isDescendantOf(t))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(t,e={}){return Bm.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=[],s={},o={};r.push(t),o[t.id]=0;while(r.length>0){const t=r.shift();if(null==t||s[t.id])continue;if(s[t.id]=!0,!1===i.call(e,this,t,o[t.id]))continue;const a=this.getNeighbors(t,n);a.forEach(e=>{o[e.id]=o[t.id]+1,r.push(e)})}}depthFirstSearch(t,e,n={}){const r=[],s={},o={};r.push(t),o[t.id]=0;while(r.length>0){const t=r.pop();if(null==t||s[t.id])continue;if(s[t.id]=!0,!1===i.call(e,this,t,o[t.id]))continue;const a=this.getNeighbors(t,n),l=r.length;a.forEach(e=>{o[e.id]=o[t.id]+1,r.splice(l,0,e)})}}getShortestPath(t,e,n={}){const i={};this.getEdges().forEach(t=>{const e=t.getSourceCellId(),r=t.getTargetCellId();e&&r&&(i[e]||(i[e]=[]),i[r]||(i[r]=[]),i[e].push(r),n.directed||i[r].push(e))});const r="string"===typeof t?t:t.id,s=Oh.run(i,r,n.weight),o=[];let a="string"===typeof e?e:e.id;s[a]&&o.push(a);while(a=s[a])o.unshift(a);return o}translate(t,e,n){return this.getCells().filter(t=>!t.hasParent()).forEach(i=>i.translate(t,e,n)),this}resize(t,e,n){return this.resizeCells(t,e,this.getCells(),n)}resizeCells(t,e,n,i={}){const r=this.getCellsBBox(n);if(r){const s=Math.max(t/r.width,0),o=Math.max(e/r.height,0),a=r.getOrigin();n.forEach(t=>t.scale(s,o,a,i))}return this}toJSON(t={}){return qm.toJSON(this.getCells(),t)}parseJSON(t){return qm.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 i=e();return this.stopBatch(t,n),i}hasActiveBatch(t=Object.keys(this.batches)){const e=Array.isArray(t)?t:[t];return e.some(t=>this.batches[t]>0)}dispose(){this.collection.dispose()}}Gm([qm.dispose()],qm.prototype,"dispose",null),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.addNode&&"function"===typeof i.addEdge&&null!=i.collection}t.toStringTag="X6."+t.name,t.isModel=e}(qm||(qm={})),function(t){function e(t,e={}){return{cells:t.map(t=>t.toJSON(e))}}function n(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(Rm.registry.exist(e))return Rm.create(t);if(zm.registry.exist(e))return zm.create(t)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}t.toJSON=e,t.fromJSON=n}(qm||(qm={}));var Hm=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class Um extends Rm{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(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:e}=t,n=Hm(t,["label"]);return e&&r.setByPath(n,"attrs/text/text",e),n},visible:!0})})(Um||(Um={}));var Wm=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};function Jm(t,e="body"){return[{tagName:t,selector:e},{tagName:"text",selector:"label"}]}function Xm(t="xlink:href"){const e=e=>{const{imageUrl:n,imageWidth:i,imageHeight:r}=e,s=Wm(e,["imageUrl","imageWidth","imageHeight"]);if(null!=n||null!=i||null!=r){const e=()=>{if(s.attrs){const e=s.attrs.image;null!=n&&(e[t]=n),null!=i&&(e.width=i),null!=r&&(e.height=r),s.attrs.image=e}};s.attrs?(null==s.attrs.image&&(s.attrs.image={}),e()):(s.attrs={image:{}},e())}return s};return e}function _m(t,e,n={}){const i={constructorName:t,markup:Jm(t,n.selector),attrs:{[t]:Object.assign({},Um.bodyAttr)}},s=n.parent||Um;return s.define(r.merge(i,e,{shape:t}))}const Ym=_m("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}}),Zm=zm.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"}}}),Km=_m("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var Qm=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class ty extends Um{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",ty.pointsToString(t),e),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}(function(t){function e(t){return"string"===typeof t?t:t.map(t=>Array.isArray(t)?t.join(","):Vh.isPointLike(t)?`${t.x}, ${t.y}`:"").join(" ")}t.pointsToString=e,t.config({propHooks(t){const{points:n}=t,i=Qm(t,["points"]);if(n){const t=e(n);t&&r.setByPath(i,"attrs/body/refPoints",t)}return i}})})(ty||(ty={}));const ey=_m("polygon",{},{parent:ty}),ny=_m("polyline",{},{parent:ty});var iy=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const ry=Um.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:e}=t,n=iy(t,["path"]);return e&&r.setByPath(n,"attrs/body/refD",e),n}});var sy=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};const oy=Um.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},Ha.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:c.ns.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({},Um.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(t){const{text:e}=t,n=sy(t,["text"]);return e&&r.setByPath(n,"attrs/label/text",e),n},attrHooks:{text:{set(t,{cell:e,view:n,refBBox:r,elem:s,attrs:o}){if(!(s instanceof HTMLElement)){const a=o.style||{},l={text:t,width:-5,height:"100%"},c=Object.assign({textVerticalAnchor:"middle"},a),h=dg.presets.textWrap;return i.call(h.set,this,l,{cell:e,view:n,elem:s,refBBox:r,attrs:c}),{fill:a.color||null}}s.textContent=t},position(t,{refBBox:e,elem:n}){if(n instanceof SVGElement)return e.getCenter()}}}}),ay=_m("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:Xm()},{selector:"image"}),ly=_m("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class cy extends uf{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return cy.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")?c.removeClass(e,t):c.addClass(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(),gg.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(),gg.useCSSSelector&&this.removePorts();const e=this.cell,n=e.getSize(),i=e.getAttrs();this.updateAttrs(this.container,i,{attrs:t===i?null:t,rootBBox:new zh(0,0,n.width,n.height),selectors:this.selectors}),gg.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(),gg.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 i=n.portContentElement,r=n.portContentSelectors||{};return this.findOne(e,i,r)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(t=>{c.remove(t.portElement)})}renderPorts(){const t=this.container,e=[];t.childNodes.forEach(t=>{e.push(t)});const n=this.cell.getParsedPorts(),i=s.groupBy(n,"zIndex"),r="auto";i[r]&&i[r].forEach(n=>{const i=this.getPortElement(n);t.append(i),e.push(i)}),Object.keys(i).forEach(t=>{if(t!==r){const n=parseInt(t,10);this.appendPorts(i[t],n,e)}}),this.updatePorts()}appendPorts(t,e,n){const i=t.map(t=>this.getPortElement(t));n[e]||e<0?c.before(n[Math.max(e,0)],i):c.append(this.container,i)}getPortElement(t){const e=this.portsCache[t.id];return e?e.portElement:this.createPortElement(t)}createPortElement(t){let e=nf.renderMarkup(this.cell.getPortContainerMarkup());const n=e.elem;if(null==n)throw new Error("Invalid port container markup.");e=nf.renderMarkup(this.getPortMarkup(t));const i=e.elem,r=e.selectors;if(null==i)throw new Error("Invalid port markup.");this.setAttrs({port:t.id,"port-group":t.group},i);let s="x6-port";t.group&&(s+=" x6-port-"+t.group),c.addClass(n,s),c.addClass(n,"x6-port"),c.addClass(i,"x6-port-body"),n.appendChild(i);let o,a,l=r;const h=this.existPortLabel(t);if(h){if(e=nf.renderMarkup(this.getPortLabelMarkup(t.label)),o=e.elem,a=e.selectors,null==o)throw new Error("Invalid port label markup.");if(r&&a){for(const t in a)if(r[t]&&t!==this.rootSelector)throw new Error("Selectors within port must be unique.");l=Object.assign(Object.assign({},r),a)}c.addClass(o,"x6-port-label"),n.appendChild(o)}return this.portsCache[t.id]={portElement:n,portSelectors:l,portLabelElement:o,portLabelSelectors:a,portContentElement:i,portContentSelectors:r},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:t,node:this.cell,container:n,selectors:l,labelContainer:o,labelSelectors:a,contentContainer:i,contentSelectors:r}),n}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=zh.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(t,e);for(let i=0,r=n.length;i<r;i+=1){const t=n[i],e=t.portId,r=this.portsCache[e]||{},s=t.portLayout;if(this.applyPortTransform(r.portElement,s),null!=t.portAttrs){const e={selectors:r.portSelectors||{}};t.portSize&&(e.rootBBox=zh.fromSize(t.portSize)),this.updateAttrs(r.portElement,t.portAttrs,e)}const o=t.labelLayout;if(o&&r.portLabelElement&&(this.applyPortTransform(r.portLabelElement,o,-(s.angle||0)),o.attrs)){const e={selectors:r.portLabelSelectors||{}};t.labelSize&&(e.rootBBox=zh.fromSize(t.labelSize)),this.updateAttrs(r.portLabelElement,o.attrs,e)}}}applyPortTransform(t,e,n=0){const i=e.angle,r=e.position,s=c.createSVGMatrix().rotate(n).translate(r.x||0,r.y||0).rotate(i||0);c.transform(t,s,{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 i=this,r=i.cell,s=r;return null==e||null==n?{e:t,view:i,node:r,cell:s}:{e:t,x:e,y:n,view:i,node:r,cell:s}}getPortEventArgs(t,e,n){const i=this,r=i.cell,s=r;return n?{e:t,x:n.x,y:n.y,view:i,node:r,cell:s,port:e}:{e:t,view:i,node:r,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 i=this.findAttr("port",e.target);if(i){const r=e.type;"node:port:mouseenter"===t?e.type="mouseenter":"node:port:mouseleave"===t&&(e.type="mouseleave"),this.notify(t,this.getPortEventArgs(e,i,n)),e.type=r}}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 i=this.getEventData(t),r=i.action;if("magnet"===r)this.dragMagnet(t,e,n);else{if("move"===r){const r=i,s=r.targetView||this;s.dragNode(t,e,n),s.notify("node:moving",{e:t,x:e,y:n,view:s,cell:s.cell,node:s.cell})}this.notifyMouseMove(t,e,n),this.notifyPortEvent("node:port:mousemove",t,{x:e,y:n})}this.setEventData(t,i)}onMouseUp(t,e,n){const i=this.getEventData(t),r=i.action;if("magnet"===r)this.stopMagnetDragging(t,e,n);else if(this.notifyMouseUp(t,e,n),this.notifyPortEvent("node:port:mouseup",t,{x:e,y:n}),"move"===r){const r=i,s=r.targetView||this;s.stopNodeDragging(t,e,n)}const s=i.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,i){super.onMouseWheel(t,e,n,i),this.notify("node:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onMagnetClick(t,e,n,i){const r=this.graph,s=r.view.getMouseMovedCount(t);s>r.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetDblClick(t,e,n,i){this.notify("node:magnet:dblclick",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetContextMenu(t,e,n,i){this.notify("node:magnet:contextmenu",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){this.startMagnetDragging(t,n,i)}onCustomEvent(t,e,n,i){this.notify("node:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),super.onCustomEvent(t,e,n,i)}prepareEmbedding(t){const e=this.graph,n=this.getEventData(t),i=n.cell||this.cell,r=e.findViewByCell(i),s=e.snapToGrid(t.clientX,t.clientY);this.notify("node:embed",{e:t,node:i,view:r,cell:i,x:s.x,y:s.y,currentParent:i.getParent()})}processEmbedding(t,e){const n=e.cell||this.cell,r=e.graph||this.graph,o=r.options.embedding,a=o.findParent;let l="function"===typeof a?i.call(a,r,{view:this,node:this.cell}).filter(t=>Bm.isCell(t)&&this.cell.id!==t.id&&!t.isDescendantOf(this.cell)):r.model.getNodesUnderNode(n,{by:a});if(o.frontOnly&&l.length>0){const t=s.groupBy(l,"zIndex"),e=s.max(Object.keys(t).map(t=>parseInt(t,10)));e&&(l=t[e])}l=l.filter(t=>t.visible);let c=null;const h=e.candidateEmbedView,u=o.validate;for(let s=l.length-1;s>=0;s-=1){const t=l[s];if(h&&h.cell.id===t.id){c=h;break}{const e=t.findView(r);if(u&&i.call(u,r,{child:this.cell,parent:e.cell,childView:this,parentView:e})){c=e;break}}}this.clearEmbedding(e),c&&c.highlight(null,{type:"embedding"}),e.candidateEmbedView=c;const d=r.snapToGrid(t.clientX,t.clientY);this.notify("node:embedding",{e:t,cell:n,node:n,view:r.findViewByCell(n),x:d.x,y:d.y,currentParent:n.getParent(),candidateParent:c?c.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,i=e.graph||this.graph,r=i.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}),i.model.getConnectedEdges(n,{deep:!0}).forEach(t=>{t.updateParent({ui:!0})}),r&&o){const e=i.snapToGrid(t.clientX,t.clientY);r.notify("node:embedded",{e:t,cell:n,x:e.x,y:e.y,node:n,view:i.findViewByCell(n),previousParent:s,currentParent:n.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let t=this.cell,e=this;while(e){if(t.isEdge())break;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||i.call(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 i=t.currentTarget,r=this.graph;this.setEventData(t,{targetMagnet:i}),this.validateMagnet(this,i,t)?(r.options.magnetThreshold<=0&&this.startConnectting(t,i,e,n),this.setEventData(t,{action:"magnet"}),this.stopPropagation(t)):this.onMouseDown(t,e,n),r.view.delegateDragEvents(t,this)}startConnectting(t,e,n,i){this.graph.model.startBatch("add-edge");const r=this.createEdgeFromMagnet(e,n,i);r.setEventData(t,r.prepareArrowheadDragging("target",{x:n,y:i,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(t,{edgeView:r}),r.notifyMouseDown(t,n,i)}getDefaultEdge(t,e){let n;const r=this.graph.options.connecting.createEdge;return r&&(n=i.call(r,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),n}createEdgeFromMagnet(t,e,n){const i=this.graph,r=i.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(r,{async:!1,ui:!0}),s.findView(i)}dragMagnet(t,e,n){const i=this.getEventData(t),r=i.edgeView;if(r)r.onMouseMove(t,e,n),this.autoScrollGraph(t.clientX,t.clientY);else{const r=this.graph,s=r.options.magnetThreshold,o=this.getEventTarget(t),a=i.targetMagnet;if("onleave"===s){if(a===o||a.contains(o))return}else if(r.view.getMouseMovedCount(t)<=s)return;this.startConnectting(t,a,e,n)}}stopMagnetDragging(t,e,n){const i=this.eventData(t),r=i.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,i,r){let s=[r];const o=this.graph.getPlugin("selection");if(o&&o.isSelectionMovable()){const t=o.getSelectedCells();t.includes(r)&&(s=t.filter(t=>t.isNode()))}s.forEach(r=>{this.notify(t,{e:e,x:n,y:i,cell:r,node:r,view:r.findView(this.graph)})})}getRestrictArea(t){const e=this.graph.options.translating.restrict,n="function"===typeof e?i.call(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 i=this.getDelegatedView();if(null==i||!i.can("nodeMovable"))return this.notifyUnhandledMouseDown(t,e,n);this.setEventData(t,{targetView:i,action:"move"});const r=Vh.create(i.cell.getPosition());i.setEventData(t,{moving:!1,offset:r.diff(e,n),restrict:this.getRestrictArea(i)})}dragNode(t,e,n){const i=this.cell,r=this.graph,s=r.getGridSize(),o=this.getEventData(t),a=o.offset,l=o.restrict;o.moving||(o.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",t,e,n,this.cell)),this.autoScrollGraph(t.clientX,t.clientY);const c=Ih.snapToGrid(e+a.x,s),h=Ih.snapToGrid(n+a.y,s);i.setPosition(c,h,{restrict:l,deep:!0,ui:!0}),r.options.embedding.enabled&&(o.embedding||(this.prepareEmbedding(t),o.embedding=!0),this.processEmbedding(t,o))}stopNodeDragging(t,e,n){const i=this.getEventData(t);i.embedding&&this.finalizeEmbedding(t,i),i.moving&&(this.removeClass("node-moving"),this.notifyNodeMove("node:moved",t,e,n,this.cell)),i.moving=!1,i.embedding=!1}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");n&&n.autoScroll(t,e)}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate&&"function"===typeof i.update&&"function"===typeof i.findPortElem&&"function"===typeof i.resize&&"function"===typeof i.rotate&&"function"===typeof i.translate}t.toStringTag="X6."+t.name,t.isNodeView=e})(cy||(cy={})),cy.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"]}}),cy.registry.register("node",cy,!0);var hy=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class uy extends uf{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return uy.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const t=this.sourceView;if(!t){const t=this.cell.getSource();return new zh(t.x,t.y)}const e=this.sourceMagnet;return t.isEdgeElement(e)?new zh(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 zh(t.x,t.y)}const e=this.targetMagnet;return t.isEdgeElement(e)?new zh(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,i=e.length;n<i;n+=1){const i=e[n],r=this.labelCache[n],s=this.labelSelectors[n],o=this.graph.options.onEdgeLabelRendered;if(o){const e=o({edge:t,label:i,container:r,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],i=this.labelCache[e],r=this.labelSelectors[e];n&&i&&r&&n({edge:this.cell,label:t[e],container:i,selectors:r})}this.labelDestroyFn={}}renderLabels(){const t=this.cell,e=t.getLabels(),n=e.length;let i=this.labelContainer;if(this.labelCache={},this.labelSelectors={},n<=0)return i&&i.parentNode&&i.parentNode.removeChild(i),this;i?this.empty(i):(i=c.createSvgElement("g"),this.addClass(this.prefixClassName("edge-labels"),i),this.labelContainer=i);for(let r=0,s=e.length;r<s;r+=1){const n=e[r],s=this.normalizeLabelMarkup(this.parseLabelMarkup(n.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",""+r),i.appendChild(o);const l=this.rootSelector;if(a[l])throw new Error("Ambiguous label root selector.");a[l]=o,this.labelCache[r]=o,this.labelSelectors[r]=a}return null==i.parentNode&&this.container.appendChild(i),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||[],i=n.length;if(i>1){const s=n[1];if(e[s]){if(2===i)return"object"===typeof t.propertyValue&&r.has(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=fc.createVectors(t),n=document.createDocumentFragment();for(let i=0,r=e.length;i<r;i+=1){const t=e[i].node;n.appendChild(t)}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 i=e.childNodes;return n=i.length>1||"G"!==i[0].nodeName.toUpperCase()?fc.create("g").append(e):fc.create(i[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"),i=t.getDefaultLabel();for(let s=0,o=e.length;s<o;s+=1){const t=this.labelCache[s],o=this.labelSelectors[s];t.setAttribute("cursor",n?"move":"default");const a=e[s],l=r.merge({},i.attrs,a.attrs);this.updateAttrs(t,l,{selectors:o,rootBBox:a.size?zh.fromSize(a.size):void 0})}}}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}update(t={}){this.cleanCache(),this.updateConnection(t);const e=this.cell.getAttrs(),{text:n}=e,i=hy(e,["text"]);return null!=i&&this.updateAttrs(this.container,i,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(t),this}removeRedundantLinearVertices(t={}){const e=this.cell,n=e.getVertices(),i=[this.sourceAnchor,...n,this.targetAnchor],r=i.length,s=new _h(i);s.simplify({threshold:.01});const o=s.points.map(t=>t.toJSON()),a=o.length;return r===a?0:(e.setVertices(o.slice(1,a-1),t),r-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 Vh.create(this.sourceAnchor);case"target":return Vh.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalConnectionPoint(t){switch(t){case"source":return Vh.create(this.sourcePoint);case"target":return Vh.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 _h(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 i=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=i.source,this.targetPoint=i.target;const r=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,r.source||this.sourcePoint,r.target||this.targetPoint)}this.cleanCache()}findAnchors(t){const e=this.cell,n=e.source,i=e.target,r=t[0],s=t[t.length-1];return i.priority&&!n.priority?this.findAnchorsOrdered("target",s,"source",r):this.findAnchorsOrdered("source",r,"target",s)}findAnchorsOrdered(t,e,n,i){let r,s;const o=this.cell,a=o[t],l=o[n],c=this.getTerminalView(t),h=this.getTerminalView(n),u=this.getTerminalMagnet(t),d=this.getTerminalMagnet(n);if(c){let n;n=e?Vh.create(e):h?d:Vh.create(l),r=this.getAnchor(a.anchor,c,u,n,t)}else r=Vh.create(a);if(h){const t=Vh.create(i||r);s=this.getAnchor(l.anchor,h,d,t,n)}else s=Vh.isPointLike(l)?Vh.create(l):new Vh;return{[t]:r,[n]:s}}getAnchor(t,e,n,r,s){const o=e.isEdgeElement(n),a=this.graph.options.connecting;let l,c="string"===typeof t?{name:t}:t;if(!c){const t=o?("source"===s?a.sourceEdgeAnchor:a.targetEdgeAnchor)||a.edgeAnchor:("source"===s?a.sourceAnchor:a.targetAnchor)||a.anchor;c="string"===typeof t?{name:t}:t}if(!c)throw new Error("Anchor should be specified.");const h=c.name;if(o){const t=cp.registry.get(h);if("function"!==typeof t)return cp.registry.onNotFound(h);l=i.call(t,this,e,n,r,c.args||{},s)}else{const t=np.registry.get(h);if("function"!==typeof t)return np.registry.onNotFound(h);l=i.call(t,this,e,n,r,c.args||{},s)}return l?l.round(this.POINT_ROUNDING):new Vh}findRoutePoints(t=[]){const e=this.graph.options.connecting.router||cm.presets.normal,n=this.cell.getRouter()||e;let r;if("function"===typeof n)r=i.call(n,this,t,{},this);else{const e="string"===typeof n?n:n.name,s="string"===typeof n?{}:n.args||{},o=e?cm.registry.get(e):cm.presets.normal;if("function"!==typeof o)return cm.registry.onNotFound(e);r=i.call(o,this,t,s,this)}return null==r?t.map(t=>Vh.create(t)):r.map(t=>Vh.create(t))}findConnectionPoints(t,e,n){const i=this.cell,r=this.graph.options.connecting,s=i.getSource(),o=i.getTarget(),a=this.sourceView,l=this.targetView,c=t[0],h=t[t.length-1];let u,d;if(a&&!a.isEdgeElement(this.sourceMagnet)){const t=this.sourceMagnet||a.container,i=c||n,o=new Fh(i,e),l=s.connectionPoint||r.sourceConnectionPoint||r.connectionPoint;u=this.getConnectionPoint(l,a,t,o,"source")}else u=e;if(l&&!l.isEdgeElement(this.targetMagnet)){const t=this.targetMagnet||l.container,i=o.connectionPoint||r.targetConnectionPoint||r.connectionPoint,s=h||e,a=new Fh(s,n);d=this.getConnectionPoint(i,l,t,a,"target")}else d=n;return{source:u,target:d}}getConnectionPoint(t,e,n,r,s){const o=r.end;if(null==t)return o;const a="string"===typeof t?t:t.name,l="string"===typeof t?{}:t.args,c=bp.registry.get(a);if("function"!==typeof c)return bp.registry.onNotFound(a);const h=i.call(c,this,r,e,n,l||{},s);return h?h.round(this.POINT_ROUNDING):o}findMarkerPoints(t,e,n){const i=t=>{const e=this.cell.getAttrs(),n=Object.keys(e);for(let i=0,r=n.length;i<r;i+=1){const r=e[n[i]];if(r[t+"Marker"]||r[t+"-marker"]){const t=r.strokeWidth||r["stroke-width"];if(t)return parseFloat(t);break}}return null},r=t[0],s=t[t.length-1];let o,a;const l=i("source");l&&(o=e.clone().move(r||n,-l));const c=i("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 s,o,a;if("string"===typeof r?s=r:(s=r.name,o=r.args),s){const t=Mm.registry.get(s);if("function"!==typeof t)return Mm.registry.onNotFound(s);a=t}else a=Mm.presets.normal;const l=i.call(a,this,e,n,t,Object.assign(Object.assign({},o),{raw:!0}),this);return"string"===typeof l?cu.parse(l):l}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;const t=this.path;if(!t)return this;const e=this.cell,n=e.getLabels();if(0===n.length)return this;const i=e.getDefaultLabel(),s=this.normalizeLabelPosition(i.position);for(let o=0,a=n.length;o<a;o+=1){const t=n[o],e=this.labelCache[o];if(!e)continue;const i=this.normalizeLabelPosition(t.position),a=r.merge({},s,i),l=this.getLabelTransformationMatrix(a);e.setAttribute("transform",c.matrixToTransformString(l))}return this}updateTerminalProperties(t){const e=this.cell,n=this.graph,i=e[t],r=i&&i.cell,s=t+"View";if(!r)return this[s]=null,this.updateTerminalMagnet(t),!0;const o=n.getCellById(r);if(!o)throw new Error(`Edge's ${t} node with id "${r}" 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 i=n.getMagnetFromEdgeTerminal(this.cell[t]);i===n.container&&(i=null),this[e]=i}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:r.merge({},e,t)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";const t=this.cache.pathCache;return r.has(t,"data")||(t.data=this.path.serialize()),t.data||""}getConnectionSubdivisions(){if(null==this.path)return null;const t=this.cache.pathCache;return r.has(t,"segmentSubdivisions")||(t.segmentSubdivisions=this.path.getSegmentSubdivisions()),t.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;const t=this.cache.pathCache;return r.has(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:(a.isPercentage(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,i){const r={distance:0};let s,o=0;"number"===typeof n?(o=n,s=i):s=n,null!=s&&(r.options=s);const a=s&&s.absoluteOffset,l=!(s&&s.absoluteDistance),c=s&&s.absoluteDistance&&s.reverseDistance,h=this.path,u={segmentSubdivisions:this.getConnectionSubdivisions()},d=new Vh(t,e),g=h.closestPointT(d,u),f=this.getConnectionLength()||0;let p,m,y=h.lengthAtT(g,u);if(l&&(y=f>0?y/f:0),c&&(y=-1*(f-y)||1),r.distance=y,a||(p=h.tangentAtT(g)),p)m=p.pointOffset(d);else{const t=h.pointAtT(g),e=d.diff(t);m={x:e.x,y:e.y}}return r.offset=m,r.angle=o,r}normalizeLabelPosition(t){return"number"===typeof t?{distance:t}:t}getLabelTransformationMatrix(t){const e=this.normalizeLabelPosition(t),n=e.options||{},i=e.angle||0,r=e.distance,s=r>0&&r<=1;let o=0;const a={x:0,y:0},l=e.offset;l&&("number"===typeof l?o=l:(null!=l.x&&(a.x=l.x),null!=l.y&&(a.y=l.y)));const h=0!==a.x||0!==a.y||0===o,u=n.keepGradient,d=n.ensureLegibility,g=this.path,f={segmentSubdivisions:this.getConnectionSubdivisions()},p=s?r*this.getConnectionLength():r,m=g.tangentAtLength(p,f);let y,b=i;if(m){if(h)y=m.start,y.translate(a);else{const t=m.clone();t.rotate(-90,m.start),t.setLength(o),y=t.end}u&&(b=m.angle()+i,d&&(b=Dh.normalize((b+90)%180-90)))}else y=g.start,h&&y.translate(a);return c.createSVGMatrix().translate(y.x,y.y).rotate(b)}getVertexIndex(t,e){const n=this.cell,i=n.getVertices(),r=this.getClosestPointLength(new Vh(t,e));let s=0;if(null!=r)for(const o=i.length;s<o;s+=1){const t=i[s],e=this.getClosestPointLength(t);if(null!=e&&r<e)break}return s}getEventArgs(t,e,n){const i=this,r=i.cell,s=r;return null==e||null==n?{e:t,view:i,edge:r,cell:s}:{e:t,x:e,y:n,view:i,edge:r,cell:s}}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 i=this.getEventData(t);switch(i.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);break;default:break}return this.notifyMouseMove(t,e,n),i}onMouseUp(t,e,n){const i=this.getEventData(t);switch(i.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);break;default:break}return this.notifyMouseUp(t,e,n),this.checkMouseleave(t),i}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,i){super.onMouseWheel(t,e,n,i),this.notify("edge:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,i){const r=c.findParentByClass(t.target,"edge-tool",this.container);if(r){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,i)))}this.notifyMouseDown(t,n,i)}else this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),super.onCustomEvent(t,e,n,i)}onLabelMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startLabelDragging(t,e,n);const i=this.getEventData(t).stopPropagation;i&&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 i=this.getEventData(t);i.moving||(i.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-i.x,n-i.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 i=this.getEventData(t);i.moving&&(this.removeClass("edge-moving"),this.notify("edge:moved",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),i.moving=!1}prepareArrowheadDragging(t,e){const n=this.getTerminalMagnet(t),i={action:"drag-arrowhead",x:e.x,y:e.y,isNewEdge:!0===e.isNewEdge,terminalType:t,initialMagnet:n,initialTerminal:r.clone(this.cell[t]),fallbackAction:e.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(t),options:e.options};return this.beforeArrowheadDragging(i),i}createValidateConnectionArgs(t){const e=[];let n;e[4]=t,e[5]=this;let i=0,r=0;"source"===t?(i=2,n="target"):(r=2,n="source");const s=this.cell[n],o=s.cell;if(o){let t;const n=e[i]=this.graph.findViewByCell(o);n&&(t=n.getMagnetFromEdgeTerminal(s),t===n.container&&(t=void 0)),e[i+1]=t}return(t,n)=>(e[r]=t,e[r+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);const e=this.container;e.style.pointerEvents=t.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(t)}validateConnection(t,e,n,r,s,o,a){const l=this.graph.options.connecting,c=l.allowLoop,h=l.allowNode,u=l.allowEdge,d=l.allowPort,g=l.allowMulti,f=l.validateConnection,p=o?o.cell:null,m="target"===s?n:t,y="target"===s?r:e;let b=!0;const v=l=>{const c="source"===s?a?a.port:null:p?p.getSourcePortId():null,h="target"===s?a?a.port:null:p?p.getTargetPortId():null;return i.call(l,this.graph,{edge:p,edgeView:o,sourceView:t,targetView:n,sourcePort:c,targetPort:h,sourceMagnet:e,targetMagnet:r,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:s})};if(null!=c&&("boolean"===typeof c?c||t!==n||(b=!1):b=v(c)),b&&null!=d&&("boolean"===typeof d?!d&&y&&(b=!1):b=v(d)),b&&null!=u&&("boolean"===typeof u?!u&&uy.isEdgeView(m)&&(b=!1):b=v(u)),b&&null!=h&&null==y&&("boolean"===typeof h?!h&&cy.isNodeView(m)&&(b=!1):b=v(h)),b&&null!=g&&o){const t=o.cell,e="source"===s?a:t.getSource(),n="target"===s?a:t.getTarget(),i=a?this.graph.getCellById(a.cell):null;if(e&&n&&e.cell&&n.cell&&i)if("function"===typeof g)b=v(g);else{const t=this.graph.model.getConnectedEdges(i,{outgoing:"source"===s,incoming:"target"===s});if(t.length)if("withPort"===g){const i=t.some(t=>{const i=t.getSource(),r=t.getTarget();return i&&r&&i.cell===e.cell&&r.cell===n.cell&&null!=i.port&&i.port===e.port&&null!=r.port&&r.port===n.port});i&&(b=!1)}else if(!g){const i=t.some(t=>{const i=t.getSource(),r=t.getTarget();return i&&r&&i.cell===e.cell&&r.cell===n.cell});i&&(b=!1)}}}return b&&null!=f&&(b=v(f)),b}allowConnectToBlank(t){const e=this.graph,n=e.options.connecting,r=n.allowBlank;if("function"!==typeof r)return!!r;const s=e.findViewByCell(t),o=t.getSourceCell(),a=t.getTargetCell(),l=e.findViewByCell(o),c=e.findViewByCell(a);return i.call(r,e,{edge:t,edgeView:s,sourceCell:o,targetCell:a,sourceView:l,targetView:c,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:s.sourceMagnet,targetMagnet:s.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 s=r.options.connecting.validateEdge;return!s||i.call(s,r,{edge:t,type:e,previous:n})}arrowheadDragging(t,e,n,i){i.x=e,i.y=n,i.currentTarget!==t&&(i.currentMagnet&&i.currentView&&i.currentView.unhighlight(i.currentMagnet,{type:"magnetAdsorbed"}),i.currentView=this.graph.findViewByElem(t),i.currentView?(i.currentMagnet=i.currentView.findMagnet(t),i.currentMagnet&&this.validateConnection(...i.getValidateConnectionArgs(i.currentView,i.currentMagnet),i.currentView.getEdgeTerminal(i.currentMagnet,e,n,this.cell,i.terminalType))?i.currentView.highlight(i.currentMagnet,{type:"magnetAdsorbed"}):i.currentMagnet=null):i.currentMagnet=null),i.currentTarget=t,this.cell.prop(i.terminalType,{x:e,y:n},Object.assign(Object.assign({},i.options),{ui:!0}))}arrowheadDragged(t,e,n){const i=t.currentView,r=t.currentMagnet;if(!r||!i)return;i.unhighlight(r,{type:"magnetAdsorbed"});const s=t.terminalType,o=i.getEdgeTerminal(r,e,n,this.cell,s);this.cell.setTerminal(s,o,{ui:!0})}snapArrowhead(t,e,n){const i=this.graph,{snap:r,allowEdge:s}=i.options.connecting,o="object"===typeof r&&r.radius||50,a="object"===typeof r&&r.anchor||"center",l=i.renderer.findViewsInArea({x:t-o,y:e-o,width:2*o,height:2*o},{nodeOnly:!0});if(s){const n=i.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 d=Number.MAX_SAFE_INTEGER;const g=new Vh(t,e);let f;l.forEach(i=>{if("false"!==i.container.getAttribute("magnet")){if(i.isNodeView())u="center"===a?i.cell.getBBox().getCenter().distance(g):i.cell.getBBox().getNearestPointToPoint(g).distance(g);else if(i.isEdgeView()){const t=i.getClosestPoint(g);u=t?t.distance(g):Number.MAX_SAFE_INTEGER}u<o&&u<d&&(h===i.container||this.validateConnection(...n.getValidateConnectionArgs(i,null),i.getEdgeTerminal(i.container,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=i,n.closestMagnet=i.container)}i.container.querySelectorAll("[magnet]").forEach(r=>{if("false"!==r.getAttribute("magnet")){const s=i.getBBoxOfElement(r);u=g.distance(s.getCenter()),u<o&&u<d&&(h===r||this.validateConnection(...n.getValidateConnectionArgs(i,r),i.getEdgeTerminal(r,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=i,n.closestMagnet=r)}})});const p=n.terminalType,m=n.closestView,y=n.closestMagnet,b=h!==y;if(c&&b&&c.unhighlight(h,{type:"magnetAdsorbed"}),m){if(!b)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){switch(t.fallbackAction){case"remove":this.cell.remove({ui:!0});break;case"revert":default:this.cell.prop(t.terminalType,t.initialTerminal,{ui:!0});break}}notifyConnectionEvent(t,e){const n=t.terminalType,i=t.initialTerminal,r=this.cell[n],s=r&&!zm.equalTerminals(i,r);if(s){const s=this.graph,o=i,a=o.cell?s.getCellById(o.cell):null,l=o.port,c=a?s.findViewByCell(a):null,h=a||t.isNewEdge?null:Vh.create(i).toJSON(),u=r,d=u.cell?s.getCellById(u.cell):null,g=u.port,f=d?s.findViewByCell(d):null,p=d?null:Vh.create(r).toJSON();this.notify("edge:connected",{e:e,previousCell:a,previousPort:l,previousView:c,previousPoint:h,currentCell:d,currentView:f,currentPort:g,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 i=0,r=n.length;i<r;i+=1){const r=e.findViewByCell(n[i]);if(!r||r.cell.id===this.cell.id)continue;const s=Array.prototype.slice.call(r.container.querySelectorAll("[magnet]"));"false"!==r.container.getAttribute("magnet")&&s.push(r.container);const o=s.filter(e=>this.validateConnection(...t.getValidateConnectionArgs(r,e),r.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)r.highlight(o[t],{type:"magnetAvailable"});r.highlight(null,{type:"nodeAvailable"}),t.marked[r.cell.id]=o}}}unhighlightAvailableMagnets(t){const e=t.marked||{};Object.keys(e).forEach(t=>{const n=this.graph.findViewByCell(t);if(n){const i=e[t];i.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 i=t.target,r=i.getAttribute("data-terminal"),s=this.prepareArrowheadDragging(r,{x:e,y:n});this.setEventData(t,s)}dragArrowhead(t,e,n){const i=this.getEventData(t);this.graph.options.connecting.snap?this.snapArrowhead(e,n,i):this.arrowheadDragging(this.getEventTarget(t),e,n,i)}stopArrowheadDragging(t,e,n){const i=this.graph,r=this.getEventData(t);i.options.connecting.snap?this.snapArrowheadEnd(r):this.arrowheadDragged(r,e,n);const s=this.validateEdge(this.cell,r.terminalType,r.initialTerminal);s?(this.finishEmbedding(r),this.notifyConnectionEvent(r,t)):this.fallbackConnection(r),this.afterArrowheadDragging(r)}startLabelDragging(t,e,n){if(this.can("edgeLabelMovable")){const e=t.currentTarget,n=parseInt(e.getAttribute("data-index"),10),i=this.getLabelPositionAngle(n),r=this.getLabelPositionArgs(n),s=this.getDefaultLabelPositionArgs(),o=this.mergeLabelPositionArgs(r,s);this.setEventData(t,{index:n,positionAngle:i,positionArgs:o,stopPropagation:!0,action:"drag-label"})}else this.setEventData(t,{stopPropagation:!0});this.graph.view.delegateDragEvents(t,this)}dragLabel(t,e,n){const i=this.getEventData(t),s=this.cell.getLabelAt(i.index),o=r.merge({},s,{position:this.getLabelPosition(e,n,i.positionAngle,i.positionArgs)});this.cell.setLabelAt(i.index,o)}stopLabelDragging(t,e,n){}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate&&"function"===typeof i.update&&"function"===typeof i.getConnection}t.toStringTag="X6."+t.name,t.isEdgeView=e})(uy||(uy={})),uy.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"]}}),uy.registry.register("edge",uy,!0);var dy=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class gy extends sf{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(t){super(),this.graph=t;const{selectors:e,fragment:n}=nf.parseJSONMarkup(gy.markup);this.background=e.background,this.grid=e.grid,this.svg=e.svg,this.defs=e.defs,this.viewport=e.viewport,this.primer=e.primer,this.stage=e.stage,this.decorator=e.decorator,this.overlay=e.overlay,this.container=this.options.container,this.restore=gy.snapshoot(this.container),c.addClass(this.container,this.prefixClassName("graph")),c.append(this.container,n),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&&Bm.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 i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onDblClick(e,i.x,i.y):this.graph.trigger("blank:dblclick",{e:e,x:i.x,y:i.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 i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onClick(e,i.x,i.y):this.graph.trigger("blank:click",{e:e,x:i.x,y:i.y})}}isPreventDefaultContextMenu(t){let e=this.options.preventDefaultContextMenu;return"function"===typeof e&&(e=i.call(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 i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onContextMenu(e,i.x,i.y):this.graph.trigger("blank:contextmenu",{e:e,x:i.x,y:i.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){const e=this.getEventData(t);return e.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 i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onMouseDown(e,i.x,i.y):(this.options.preventDefaultBlankAction&&["touchstart"].includes(e.type)&&t.preventDefault(),this.graph.trigger("blank:mousedown",{e:e,x:i.x,y:i.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;const i=e.mouseMovedCount;if(i<=this.options.moveThreshold)return;const r=this.normalizeEvent(t),s=this.graph.snapToGrid(r.clientX,r.clientY),o=e.currentView;o?o.onMouseMove(r,s.x,s.y):this.graph.trigger("blank:mousemove",{e:r,x:s.x,y:s.y}),this.setEventData(r,e)}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY),i=this.getEventData(t),r=i.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 c.EventObject(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 i=this.graph.findViewByElem(e.relatedTarget);if(n){if(i===n)return;n.onMouseEnter(e)}else{if(i)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 i=this.graph.findViewByElem(e.relatedTarget);if(n){if(i===n)return;n.onMouseLeave(e)}else{if(i)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 i=e.originalEvent,r=this.graph.snapToGrid(i.clientX,i.clientY),s=Math.max(-1,Math.min(1,i.wheelDelta||-i.detail));n?n.onMouseWheel(e,r.x,r.y,s):this.graph.trigger("blank:mousewheel",{e:e,delta:s,x:r.x,y:r.y})}onCustomEvent(t){const e=t.currentTarget,n=e.getAttribute("event")||e.getAttribute("data-event");if(n){const i=this.findView(e);if(i){const e=this.normalizeEvent(t);if(this.guard(e,i))return;const r=this.graph.snapToGrid(e.clientX,e.clientY);i.onCustomEvent(e,n,r.x,r.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 s=this.normalizeEvent(t);if(this.guard(s,r))return;const o=this.graph.snapToGrid(s.clientX,s.clientY);i.call(e,this.graph,r,s,n,o.x,o.y)}}}onMagnetMouseDown(t){this.handleMagnetEvent(t,(t,e,n,i,r)=>{t.onMagnetMouseDown(e,n,i,r)})}onMagnetDblClick(t){this.handleMagnetEvent(t,(t,e,n,i,r)=>{t.onMagnetDblClick(e,n,i,r)})}onMagnetContextMenu(t){const e=this.findView(t.target);this.isPreventDefaultContextMenu(e)&&t.preventDefault(),this.handleMagnetEvent(t,(t,e,n,i,r)=>{t.onMagnetContextMenu(e,n,i,r)})}onLabelMouseDown(t){const e=t.currentTarget,n=this.findView(e);if(n){const e=this.normalizeEvent(t);if(this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n.onLabelMouseDown(e,i.x,i.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}dy([sf.dispose()],gy.prototype,"dispose",null),function(t){const e=gg.prefixCls+"-graph";function n(t){const e=t.cloneNode();return t.childNodes.forEach(t=>e.appendChild(t)),()=>{c.empty(t);while(t.attributes.length>0)t.removeAttribute(t.attributes[0].name);for(let n=0,i=e.attributes.length;n<i;n+=1){const i=e.attributes[n];t.setAttribute(i.name,i.value)}e.childNodes.forEach(e=>t.appendChild(e))}}t.markup=[{ns:c.ns.xhtml,tagName:"div",selector:"background",className:e+"-background"},{ns:c.ns.xhtml,tagName:"div",selector:"grid",className:e+"-grid"},{ns:c.ns.svg,tagName:"svg",selector:"svg",className:e+"-svg",attrs:{width:"100%",height:"100%","xmlns:xlink":c.ns.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=n}(gy||(gy={})),function(t){const e=gg.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"}}(gy||(gy={}));const fy=".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";class py extends E{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(){}}var my=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class yy extends py{init(){gg.autoInsertCSS&&h.ensure("core",fy)}dispose(){h.clean("core")}}my([yy.dispose()],yy.prototype,"dispose",null);var by,vy=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};(function(t){function e(e){const{grid:n,panning:i,mousewheel:s,embedding:o}=e,a=vy(e,["grid","panning","mousewheel","embedding"]),l=e.container;if(null==l)throw new Error("Ensure the container of the graph is specified and valid");null==a.width&&(a.width=l.clientWidth),null==a.height&&(a.height=l.clientHeight);const c=r.merge({},t.defaults,a),h={size:10,visible:!1};c.grid="number"===typeof n?{size:n,visible:!1}:"boolean"===typeof n?Object.assign(Object.assign({},h),{visible:n}):Object.assign(Object.assign({},h),n);const u=["panning","mousewheel","embedding"];return u.forEach(t=>{const n=e[t];"boolean"===typeof n?c[t].enabled=n:c[t]=Object.assign(Object.assign({},c[t]),n)}),c}t.get=e})(by||(by={})),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:gg.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:gg.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}){const i="target"===t?n:e;return null!=i},createEdge(){return new Zm}},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}}(by||(by={}));var xy=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o},wy=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class Py extends py{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 e=this.grid.size;if(e<=1||!this.grid.visible)return this.clear();const n=this.graph.matrix(),i=this.getInstance(),r=Array.isArray(t)?t:[t];this.patterns.forEach((t,s)=>{const o="pattern_"+s,a=n.a||1,l=n.d||1,{update:h,markup:u}=t,d=wy(t,["update","markup"]),g=Object.assign(Object.assign(Object.assign({},d),r[s]),{sx:a,sy:l,ox:n.e||0,oy:n.f||0,width:e*a,height:e*l});i.has(o)||i.add(o,fc.create("pattern",{id:o,patternUnits:"userSpaceOnUse"},fc.createVectors(u)).node);const f=i.get(o);"function"===typeof h&&h(f.childNodes[0],g);let p=g.ox%g.width;p<0&&(p+=g.width);let m=g.oy%g.height;m<0&&(m+=g.height),c.attr(f,{x:p,y:m,width:g.width,height:g.height})});const s=(new XMLSerializer).serializeToString(i.root),o=`url(data:image/svg+xml;base64,${btoa(s)})`;this.elem.style.backgroundImage=o}getInstance(){return this.instance||(this.instance=new pu),this.instance}resolveGrid(t){if(!t)return[];const e=t.type;if(null==e)return[Object.assign(Object.assign({},pu.presets.dot),t.args)];const n=pu.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 pu.registry.onNotFound(e)}dispose(){this.stopListening(),this.clear()}}xy([py.dispose()],Py.prototype,"dispose",null);class Cy extends py{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),c.createSVGMatrix(this.viewportMatrix)}setMatrix(t){const e=c.createSVGMatrix(t),n=c.matrixToTransformString(e);this.viewport.setAttribute("transform",n),this.viewportMatrix=e,this.viewportTransformString=n}resize(t,e){let n=void 0===t?this.options.width:t,i=void 0===e?this.options.height:e;this.options.width=n,this.options.height=i,"number"===typeof n&&(n=Math.round(n)),"number"===typeof i&&(i=Math.round(i)),this.container.style.width=null==n?"":n+"px",this.container.style.height=null==i?"":i+"px";const r=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},r)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return a.isNumber(t)||(t=this.container.clientWidth),a.isNumber(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return c.matrixToScale(this.getMatrix())}scale(t,e=t,n=0,i=0){if(t=this.clampScale(t),e=this.clampScale(e),n||i){const r=this.getTranslation(),s=r.tx-n*(t-1),o=r.ty-i*(e-1);s===r.tx&&o===r.ty||this.translate(s,o)}const r=this.getMatrix();return r.a=t,r.d=e,this.setMatrix(r),this.graph.trigger("scale",{sx:t,sy:e,ox:n,oy:i}),this}clampScale(t){const e=this.graph.options.scaling;return a.clamp(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,i=t;const r=this.getScale(),s=this.getComputedSize();let o=s.width/2,a=s.height/2;if(e.absolute||(n+=r.sx,i+=r.sy),e.scaleGrid&&(n=Math.round(n/e.scaleGrid)*e.scaleGrid,i=Math.round(i/e.scaleGrid)*e.scaleGrid),e.maxScale&&(n=Math.min(e.maxScale,n),i=Math.min(e.maxScale,i)),e.minScale&&(n=Math.max(e.minScale,n),i=Math.max(e.minScale,i)),e.center&&(o=e.center.x,a=e.center.y),n=this.clampScale(n),i=this.clampScale(i),o||a){const t=this.getTranslation(),e=o-(o-t.tx)*(n/r.sx),s=a-(a-t.ty)*(i/r.sy);e===t.tx&&s===t.ty||this.translate(e,s)}return this.scale(n,i),this}getRotation(){return c.matrixToRotation(this.getMatrix())}rotate(t,e,n){if(null==e||null==n){const t=bg.getBBox(this.stage);e=t.width/2,n=t.height/2}const i=this.getMatrix().translate(e,n).rotate(t).translate(-e,-n);return this.setMatrix(i),this}getTranslation(){return c.matrixToTranslation(this.getMatrix())}translate(t,e){const n=this.getMatrix();n.e=t||0,n.f=e||0,this.setMatrix(n);const i=this.getTranslation();return this.options.x=i.tx,this.options.y=i.ty,this.graph.trigger("translate",Object.assign({},i)),this}setOrigin(t,e){return this.translate(t||0,e||0)}fitToContent(t,e,n,i){if("object"===typeof t){const r=t;t=r.gridWidth||1,e=r.gridHeight||1,n=r.padding||0,i=r}else t=t||1,e=e||1,n=n||0,null==i&&(i={});const r=a.normalizeSides(n),s=i.border||0,o=i.contentArea?zh.create(i.contentArea):this.getContentArea(i);s>0&&o.inflate(s);const l=this.getScale(),c=this.getTranslation(),h=l.sx,u=l.sy;o.x*=h,o.y*=u,o.width*=h,o.height*=u;let d=Math.max(Math.ceil((o.width+o.x)/t),1)*t,g=Math.max(Math.ceil((o.height+o.y)/e),1)*e,f=0,p=0;("negative"===i.allowNewOrigin&&o.x<0||"positive"===i.allowNewOrigin&&o.x>=0||"any"===i.allowNewOrigin)&&(f=Math.ceil(-o.x/t)*t,f+=r.left,d+=f),("negative"===i.allowNewOrigin&&o.y<0||"positive"===i.allowNewOrigin&&o.y>=0||"any"===i.allowNewOrigin)&&(p=Math.ceil(-o.y/e)*e,p+=r.top,g+=p),d+=r.right,g+=r.bottom,d=Math.max(d,i.minWidth||0),g=Math.max(g,i.minHeight||0),d=Math.min(d,i.maxWidth||Number.MAX_SAFE_INTEGER),g=Math.min(g,i.maxHeight||Number.MAX_SAFE_INTEGER);const m=this.getComputedSize(),y=d!==m.width||g!==m.height,b=f!==c.tx||p!==c.ty;return b&&this.translate(f,p),y&&this.resize(d,g),new zh(-f/h,-p/u,d/h,g/u)}scaleContentToFit(t={}){this.scaleContentToFitImpl(t)}scaleContentToFitImpl(t={},e=!0){let n,i;if(t.contentArea){const e=t.contentArea;n=this.graph.localToGraph(e),i=Vh.create(e)}else n=this.getContentBBox(t),i=this.graph.graphToLocal(n);if(!n.width||!n.height)return;const r=a.normalizeSides(t.padding),s=t.minScale||0,o=t.maxScale||Number.MAX_SAFE_INTEGER,l=t.minScaleX||s,c=t.maxScaleX||o,h=t.minScaleY||s,u=t.maxScaleY||o;let d;if(t.viewportArea)d=t.viewportArea;else{const t=this.getComputedSize(),e=this.getTranslation();d={x:e.tx,y:e.ty,width:t.width,height:t.height}}d=zh.create(d).moveAndExpand({x:r.left,y:r.top,width:-r.left-r.right,height:-r.top-r.bottom});const g=this.getScale();let f=d.width/n.width*g.sx,p=d.height/n.height*g.sy;!1!==t.preserveAspectRatio&&(f=p=Math.min(f,p));const m=t.scaleGrid;if(m&&(f=m*Math.floor(f/m),p=m*Math.floor(p/m)),f=a.clamp(f,l,c),p=a.clamp(p,h,u),this.scale(f,p),e){const t=this.options,e=d.x-i.x*f-t.x,n=d.y-i.y*p-t.y;this.translate(e,n)}}getContentArea(t={}){return!1!==t.useCellGeometry?this.model.getAllCellsBBox()||new zh:bg.getBBox(this.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){const t=zh.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){const n=zh.create(t),i=this.graph;e.contentArea=n,null==e.viewportArea&&(e.viewportArea={x:i.options.x,y:i.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(e,!1);const r=n.getCenter();return this.centerPoint(r.x,r.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){const n=this.getComputedSize(),i=this.getScale(),r=this.getTranslation(),s=n.width/2,o=n.height/2;t="number"===typeof t?t:s,e="number"===typeof e?e:o,t=s-t*i.sx,e=o-e*i.sy,r.tx===t&&r.ty===e||this.translate(t,e)}centerContent(t){const e=this.graph.getContentArea(t),n=e.getCenter();this.centerPoint(n.x,n.y)}centerCell(t){return this.positionCell(t,"center")}positionPoint(t,e,n){const i=this.getComputedSize();e=a.normalizePercentage(e,Math.max(0,i.width)),e<0&&(e=i.width+e),n=a.normalizePercentage(n,Math.max(0,i.height)),n<0&&(n=i.height+n);const r=this.getTranslation(),s=this.getScale(),o=e-t.x*s.sx,l=n-t.y*s.sy;r.tx===o&&r.ty===l||this.translate(o,l)}positionRect(t,e){const n=zh.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)}}var Ay=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Oy extends py{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 i=this.graph.transform.getScale(),r=this.graph.translate();if("object"===typeof n){const t=r.tx+i.sx*(n.x||0),e=r.ty+i.sy*(n.y||0);n=`${t}px ${e}px`}"object"===typeof e&&(e=zh.fromSize(e).scale(i.sx,i.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 i;const s=e.opacity,o=e.size;let a=e.repeat||"no-repeat";const l=xu.registry.get(a);if("function"===typeof l){const n=e.quality||1;t.width*=n,t.height*=n;const r=l(t,e);if(!(r instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");i=r.toDataURL("image/png"),a=e.repeat&&a!==e.repeat?e.repeat:"repeat","object"===typeof o?(o.width*=r.width/t.width,o.height*=r.height/t.height):void 0===o&&(e.size={width:r.width/n,height:r.height/n})}else i=t.src,void 0===o&&(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=r.clone(e.size));const c=this.elem.style;c.backgroundImage=`url(${i})`,c.backgroundRepeat=a,c.opacity=null==s||s>=1?"":""+s,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=r.clone(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()}}Ay([py.dispose()],Oy.prototype,"dispose",null);var Ey=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class My extends py{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&!0===this.widgetOptions.enabled}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onSpaceKeyDown=this.onSpaceKeyDown.bind(this),this.onSpaceKeyUp=this.onSpaceKeyUp.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),c.Event.on(this.graph.container,"mousedown",this.onRightMouseDown),c.Event.on(document.body,{keydown:this.onSpaceKeyDown,keyup:this.onSpaceKeyUp}),this.mousewheelHandle=new c.MouseWheelHandle(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),c.Event.off(this.graph.container,"mousedown",this.onRightMouseDown),c.Event.off(document.body,{keydown:this.onSpaceKeyDown,keyup:this.onSpaceKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(t,e){return t.spaceKey=this.isSpaceKeyPressed,this.pannable&&Eh.isMatch(t,this.widgetOptions.modifiers,e)}startPanning(t){const e=this.view.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.panning=!0,this.updateClassName(),c.Event.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)}),c.Event.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(t){const e=this.view.normalizeEvent(t),n=e.clientX-this.clientX,i=e.clientY-this.clientY;this.clientX=e.clientX,this.clientY=e.clientY,this.graph.translateBy(n,i)}stopPanning(t){this.panning=!1,this.updateClassName(),c.Event.off(document.body,".panning"),c.Event.off(window,".panning")}updateClassName(){const t=this.view.container,e=this.view.prefixClassName("graph-panning"),n=this.view.prefixClassName("graph-pannable");this.pannable?this.panning?(c.addClass(t,e),c.removeClass(t,n)):(c.removeClass(t,e),c.addClass(t,n)):(c.removeClass(t,e),c.removeClass(t,n))}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?void 0:e.includes("rightMouseDown"))&&2===t.button&&this.allowPanning(t,!0)&&this.startPanning(t)}onMouseWheel(t,e,n){this.graph.translateBy(-e,-n)}onSpaceKeyDown(t){32===t.which&&(this.isSpaceKeyPressed=!0)}onSpaceKeyUp(t){32===t.which&&(this.isSpaceKeyPressed=!1)}allowBlankMouseDown(t){const e=this.widgetOptions.eventTypes;return(null===e||void 0===e?void 0:e.includes("leftMouseDown"))&&0===t.button||(null===e||void 0===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,i=this.graph.getGraphArea();let r=0,s=0;t<=i.left+n&&(r=-n),e<=i.top+n&&(s=-n),t>=i.right-n&&(r=n),e>=i.bottom-n&&(s=n),0===r&&0===s||this.graph.translateBy(-r,-s)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}Ey([py.dispose()],My.prototype,"dispose",null);var Sy=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Ty extends py{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 c.MouseWheelHandle(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(t){const e=this.widgetOptions.guard;return(null==e||e(t))&&Eh.isMatch(t,this.widgetOptions.modifiers)}onMouseWheel(t){const e=this.widgetOptions.guard;if((null==e||e(t))&&Eh.isMatch(t,this.widgetOptions.modifiers)){const e=this.widgetOptions.factor||1.2;null==this.currentScale&&(this.startPos={x:t.clientX,y:t.clientY},this.currentScale=this.graph.transform.getScale().sx);const n=t.deltaY;n<0?this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:(this.cumulatedFactor=Math.round(this.currentScale*e*20)/20/this.currentScale,1===this.cumulatedFactor&&(this.cumulatedFactor=1.05)):this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:(this.cumulatedFactor=Math.round(this.currentScale*(1/e)*20)/20/this.currentScale,1===this.cumulatedFactor&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const i=this.currentScale;let r=this.graph.transform.clampScale(i*this.cumulatedFactor);const s=this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,o=this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER;if(r=a.clamp(r,s,o),r!==i)if(this.widgetOptions.zoomAtMousePosition){const t=!!this.graph.getPlugin("scroller"),e=t?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(r,{absolute:!0,center:e.clone()})}else this.graph.zoom(r,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}Sy([E.dispose()],Ty.prototype,"dispose",null);var Ny,ky=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class jy extends py{init(){this.resetRenderArea=i.throttle(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()}}ky([py.dispose()],jy.prototype,"dispose",null);class Ly{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(t){if(t.priority&Ny.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;while(e=this.queue.shift())if(e.cb(),this.getCurrentTime()-t>=this.frameInterval)break;this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){let t;this.isFlushPending=!1,this.isFlushing=!0;while(t=this.queue.shift())try{t.cb()}catch(e){console.log(e)}this.isFlushing=!1}findInsertionIndex(t){let e=0,n=this.queue.length,i=n-1;const r=t.priority;while(e<=i){const t=(i-e>>1)+e;r<=this.queue[t].priority?e=t+1:(n=t,i=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(){const t="object"===typeof performance&&"function"===typeof performance.now;return t?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"})(Ny||(Ny={}));var By=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Dy extends E{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(t){super(),this.views={},this.willRemoveViews={},this.queue=new Ly,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,Dy.FLAG_INSERT,e,Ny.Update,!0)}onCellVisibleChanged({cell:t,current:e}){this.toggleVisible(t,!!e)}requestViewUpdate(t,e,n={},i=Ny.Update,r=!0){const s=t.cell.id,o=this.views[s];if(!o)return;o.flag=e,o.options=n;const a=t.hasAction(e,["translate","resize","rotate"]);(a||!1===n.async)&&(i=Ny.PRIOR,r=!1),this.queue.queueJob({id:s,priority:i,cb:()=>{this.renderViewInArea(t,e,n);const i=n.queue;if(i){const e=i.indexOf(t.cell.id);e>=0&&i.splice(e,1),0===i.length&&this.graph.trigger("render:done")}}});const l=this.getEffectedEdges(t);l.forEach(t=>{this.requestViewUpdate(t.view,t.flag,n,i,!1)}),r&&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===Dy.ViewState.MOUNTED}renderViews(t,e={}){t.sort((t,e)=>t.isNode()&&e.isEdge()?-1:0),t.forEach(t=>{const n=t.id,i=this.views;let r=0,s=i[n];if(s)r=Dy.FLAG_INSERT;else{const i=this.createCellView(t);i&&(i.graph=this.graph,r=Dy.FLAG_INSERT|i.getBootstrapFlag(),s={view:i,flag:r,options:e,state:Dy.ViewState.CREATED},this.views[n]=s)}s&&this.requestViewUpdate(s.view,r,e,this.getRenderPriority(s.view),!1)}),this.flush()}renderViewInArea(t,e,n={}){const i=t.cell,r=i.id,s=this.views[r];if(!s)return;let o=0;this.isUpdatable(t)||s.state===Dy.ViewState.MOUNTED?(o=this.updateView(t,e,n),s.flag=o):s.state=Dy.ViewState.WAITING,o&&i.isEdge()&&0===(o&t.getFlag(["source","target"]))&&this.queue.queueJob({id:r,priority:Ny.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===Dy.ViewState.WAITING){const{view:e,flag:n,options:i}=t;this.requestViewUpdate(e,n,i,this.getRenderPriority(e),!1)}}),this.flush()}updateView(t,e,n={}){if(null==t)return 0;if(uf.isCellView(t)){if(e&Dy.FLAG_REMOVE)return this.removeView(t.cell),0;e&Dy.FLAG_INSERT&&(this.insertView(t),e^=Dy.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(),i=this.addZPivot(n);this.container.insertBefore(t.container,i),t.cell.isVisible()||this.toggleVisible(t.cell,!1),e.state=Dy.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 r=0,s=n.length;r<s;r+=1){const t=n[r];if(e){const e=t.getSourceCell(),n=t.getTargetCell();if(e&&!e.isVisible()||n&&!n.isVisible())continue;this.toggleVisible(t,!0)}else this.toggleVisible(t,!1)}const i=this.views[t.id];i&&c.css(i.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 i=-1/0;for(const s in e){const e=+s;e<t&&e>i&&(i=e)}const r=this.container;if(i!==-1/0){const t=e[i];r.insertBefore(n,t.nextSibling)}else r.insertBefore(n,r.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=i.call(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=uf.registry.get(r);return n?new n(t,e):uf.registry.onNotFound(r)}return t.isNode()?new cy(t,e):t.isEdge()?new uy(t,e):null}getEffectedEdges(t){const e=[],n=t.cell,i=this.model.getConnectedEdges(n);for(let r=0,s=i.length;r<s;r+=1){const t=i[r],s=this.views[t.id];if(!s)continue;const o=s.view;if(!this.isViewMounted(o))continue;const a=["update"];t.getTargetCell()===n&&a.push("target"),t.getSourceCell()===n&&a.push("source"),e.push({id:t.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(),i=e.getTargetCell();if(this.renderArea&&n&&i)return this.renderArea.isIntersectWithRect(n.getBBox())||this.renderArea.isIntersectWithRect(i.getBBox())}return!0}getRenderPriority(t){return t.cell.isNode()?Ny.RenderNode:Ny.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(t=>{this.views[t].view.dispose()}),this.views={}}}By([E.dispose()],Dy.prototype,"dispose",null),function(t){t.FLAG_INSERT=1<<30,t.FLAG_REMOVE=1<<29,t.FLAG_RENDER=67108863}(Dy||(Dy={})),function(t){let e;(function(t){t[t["CREATED"]=0]="CREATED",t[t["MOUNTED"]=1]="MOUNTED",t[t["WAITING"]=2]="WAITING"})(e=t.ViewState||(t.ViewState={}))}(Dy||(Dy={}));var Iy=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Ry extends py{constructor(){super(...arguments),this.schedule=new Dy(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=Bm.isCell(t)?t.id:t,n=this.schedule.views;return n[e]?n[e].view:null}findViewsFromPoint(t){const e={x:t.x,y:t.y};return this.model.getCells().map(t=>this.findViewByCell(t)).filter(t=>null!=t&&bg.getBBox(t.container,{target:this.view.stage}).containsPoint(e))}findEdgeViewsFromPoint(t,e=5){return this.model.getEdges().map(t=>this.findViewByCell(t)).filter(n=>{if(null!=n){const i=n.getClosestPoint(t);if(i)return i.distance(t)<=e}return!1})}findViewsInArea(t,e={}){const n=zh.create(t);return this.model.getCells().map(t=>this.findViewByCell(t)).filter(t=>{if(t){if(e.nodeOnly&&!t.isNodeView())return!1;const i=bg.getBBox(t.container,{target:this.view.stage});return 0===i.width?i.inflate(1,0):0===i.height&&i.inflate(0,1),e.strict?n.containsRect(i):n.isIntersectWithRect(i)}return!1})}dispose(){this.schedule.dispose()}}Iy([py.dispose()],Ry.prototype,"dispose",null);var Vy=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class zy extends py{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(t){let e=t.id;const n=t.name;if(e||(e=`filter-${n}-${this.cid}-${o.hashcode(JSON.stringify(t))}`),!this.isDefined(e)){const i=wu.registry.get(n);if(null==i)return wu.registry.onNotFound(n);const r=i(t.args||{}),s=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},t.attrs),{id:e});fc.create(nf.sanitize(r),s).appendTo(this.defs)}return e}gradient(t){let e=t.id;const n=t.type;if(e||(e=`gradient-${n}-${this.cid}-${o.hashcode(JSON.stringify(t))}`),!this.isDefined(e)){const i=t.stops,r=i.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}"/>`}),s=`<${n}>${r.join("")}</${n}>`,o=Object.assign({id:e},t.attrs);fc.create(s,o).appendTo(this.defs)}return e}marker(t){const{id:e,refX:n,refY:i,markerUnits:r,markerOrient:s,tagName:a,children:l}=t,h=Vy(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let u=e;if(u||(u=`marker-${this.cid}-${o.hashcode(JSON.stringify(t))}`),!this.isDefined(u)){"path"!==a&&delete h.d;const t=fc.create("marker",{refX:n,refY:i,id:u,overflow:"visible",orient:null!=s?s:"auto",markerUnits:r||"userSpaceOnUse"},l?l.map(t=>{var{tagName:e}=t,n=Vy(t,["tagName"]);return fc.create(""+e||"path",c.kebablizeAttrs(Object.assign(Object.assign({},h),n)))}):[fc.create(a||"path",c.kebablizeAttrs(h))]);this.defs.appendChild(t.node)}return u}remove(t){const e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}}class Fy extends py{getClientMatrix(){return c.createSVGMatrix(this.view.stage.getScreenCTM())}getClientOffset(){const t=this.view.svg.getBoundingClientRect();return new Vh(t.left,t.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(t,e){const n="number"===typeof t?this.clientToLocalPoint(t,e):this.clientToLocalPoint(t.x,t.y);return n.snapToGrid(this.graph.getGridSize())}localToGraphPoint(t,e){const n=Vh.create(t,e);return bg.transformPoint(n,this.graph.matrix())}localToClientPoint(t,e){const n=Vh.create(t,e);return bg.transformPoint(n,this.getClientMatrix())}localToPagePoint(t,e){const n="number"===typeof t?this.localToGraphPoint(t,e):this.localToGraphPoint(t);return n.translate(this.getPageOffset())}localToGraphRect(t,e,n,i){const r=zh.create(t,e,n,i);return bg.transformRectangle(r,this.graph.matrix())}localToClientRect(t,e,n,i){const r=zh.create(t,e,n,i);return bg.transformRectangle(r,this.getClientMatrix())}localToPageRect(t,e,n,i){const r="number"===typeof t?this.localToGraphRect(t,e,n,i):this.localToGraphRect(t);return r.translate(this.getPageOffset())}graphToLocalPoint(t,e){const n=Vh.create(t,e);return bg.transformPoint(n,this.graph.matrix().inverse())}clientToLocalPoint(t,e){const n=Vh.create(t,e);return bg.transformPoint(n,this.getClientMatrix().inverse())}clientToGraphPoint(t,e){const n=Vh.create(t,e);return bg.transformPoint(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){const n=Vh.create(t,e),i=n.diff(this.getPageOffset());return this.graphToLocalPoint(i)}graphToLocalRect(t,e,n,i){const r=zh.create(t,e,n,i);return bg.transformRectangle(r,this.graph.matrix().inverse())}clientToLocalRect(t,e,n,i){const r=zh.create(t,e,n,i);return bg.transformRectangle(r,this.getClientMatrix().inverse())}clientToGraphRect(t,e,n,i){const r=zh.create(t,e,n,i);return bg.transformRectangle(r,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,i){const r=zh.create(t,e,n,i),s=this.getPageOffset();return r.x-=s.x,r.y-=s.y,this.graphToLocalRect(r)}}var $y=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Gy extends py{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 i=this.resolveHighlighter(n);if(!i)return;const r=this.getHighlighterId(e,i);if(!this.highlights[r]){const n=i.highlighter;n.highlight(t,e,Object.assign({},i.args)),this.highlights[r]={cellView:t,magnet:e,highlighter:n,args:i.args}}}onCellUnhighlight({magnet:t,options:e={}}){const n=this.resolveHighlighter(e);if(!n)return;const i=this.getHighlighterId(t,n);this.unhighlight(i)}resolveHighlighter(t){const e=this.options;let n=t.highlighter;if(null==n){const i=t.type;n=i&&e.highlighting[i]||e.highlighting.default}if(null==n)return null;const i="string"===typeof n?{name:n}:n,r=i.name,s=Pg.registry.get(r);return null==s?Pg.registry.onNotFound(r):(Pg.check(r,s),{name:r,highlighter:s,args:i.args||{}})}getHighlighterId(t,e){return c.ensureId(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()}}$y([Gy.dispose()],Gy.prototype,"dispose",null);var qy=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Hy extends py{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(){const t=this.options.autoResize;if(t){const t=this.getSensorTarget();t&&Ah.bind(t,()=>{const e=t.offsetWidth,n=t.offsetHeight;this.resize(e,n)})}}resize(t,e){const n=this.getScroller();n?n.resize(t,e):this.graph.transform.resize(t,e)}dispose(){Ah.clear(this.graph.container)}}qy([py.dispose()],Hy.prototype,"dispose",null);var Uy=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class Wy extends Mn{get container(){return this.options.container}get[Symbol.toStringTag](){return Wy.toStringTag}constructor(t){super(),this.installedPlugins=new Set,this.options=by.get(t),this.css=new yy(this),this.view=new gy(this),this.defs=new zy(this),this.coord=new Fy(this),this.transform=new Cy(this),this.highlight=new Gy(this),this.grid=new Py(this),this.background=new Oy(this),this.options.model?this.model=this.options.model:(this.model=new qm,this.model.graph=this),this.renderer=new Ry(this),this.panning=new My(this),this.mousewheel=new Ty(this),this.virtualRender=new jy(this),this.size=new Hy(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=>Rm.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=>zm.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,i,r){return this.model.getNodesInArea(t,e,n,i,r)}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 i="string"===typeof t?t:"update",r="string"===typeof t?e:t,s="function"===typeof e?n:e;this.startBatch(i,s);const o=r();return this.stopBatch(i,s),o}updateCellId(t,e){return this.model.updateCellId(t,e)}findView(t){return Bm.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return zh.isRectangleLike(t)?this.findViewsInArea(t):Vh.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,i,r){const s="number"===typeof t?{x:t,y:e,width:n,height:i}:t,o="number"===typeof t?r:e;return this.renderer.findViewsInArea(s,o)}matrix(t){return"undefined"===typeof 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,i=0){return"undefined"===typeof t?this.transform.getScale():(this.transform.scale(t,e,n,i),this)}zoom(t,e){const n=this.getPlugin("scroller");if(n){if("undefined"===typeof t)return n.zoom();n.zoom(t,e)}else{if("undefined"===typeof 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"undefined"===typeof t?this.transform.getRotation():(this.transform.rotate(t,e,n),this)}translate(t,e){return"undefined"===typeof t?this.transform.getTranslation():(this.transform.translate(t,e),this)}translateBy(t,e){const n=this.translate(),i=n.tx+t,r=n.ty+e;return this.translate(i,r)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(t={}){return this.transform.getContentArea(t)}getContentBBox(t={}){return this.transform.getContentBBox(t)}fitToContent(t,e,n,i){return this.transform.fitToContent(t,e,n,i)}scaleContentToFit(t={}){return this.transform.scaleContentToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const i=this.getPlugin("scroller");return i?i.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,i={}){const r=this.getPlugin("scroller");return r?r.positionPoint(t,e,n,i):this.transform.positionPoint(t,e,n),this}positionRect(t,e,n){const i=this.getPlugin("scroller");return i?i.positionRect(t,e,n):this.transform.positionRect(t,e),this}positionCell(t,e,n){const i=this.getPlugin("scroller");return i?i.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,i){return zh.isRectangleLike(t)?this.coord.pageToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.pageToLocalRect(t,e,n,i):this.coord.pageToLocalPoint(t,e)}localToPage(t,e,n,i){return zh.isRectangleLike(t)?this.coord.localToPageRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToPageRect(t,e,n,i):this.coord.localToPagePoint(t,e)}clientToLocal(t,e,n,i){return zh.isRectangleLike(t)?this.coord.clientToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToLocalRect(t,e,n,i):this.coord.clientToLocalPoint(t,e)}localToClient(t,e,n,i){return zh.isRectangleLike(t)?this.coord.localToClientRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToClientRect(t,e,n,i):this.coord.localToClientPoint(t,e)}localToGraph(t,e,n,i){return zh.isRectangleLike(t)?this.coord.localToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToGraphRect(t,e,n,i):this.coord.localToGraphPoint(t,e)}graphToLocal(t,e,n,i){return zh.isRectangleLike(t)?this.coord.graphToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.graphToLocalRect(t,e,n,i):this.coord.graphToLocalPoint(t,e)}clientToGraph(t,e,n,i){return zh.isRectangleLike(t)?this.coord.clientToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToGraphRect(t,e,n,i):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||void 0===n||n.forEach(t=>{var e;null===(e=null===t||void 0===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||void 0===n||n.forEach(t=>{var e;null===(e=null===t||void 0===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?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||void 0===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()})}}Uy([Mn.dispose()],Wy.prototype,"dispose",null),function(t){t.View=gy,t.Renderer=Ry,t.MouseWheel=Ty,t.DefsManager=zy,t.GridManager=Py,t.CoordManager=Fy,t.TransformManager=Cy,t.HighlightManager=Gy,t.BackgroundManager=Oy,t.PanningManager=My}(Wy||(Wy={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag];return null==n||n===t.toStringTag}t.toStringTag="X6."+t.name,t.isGraph=e}(Wy||(Wy={})),function(t){function e(e,n){const i=e instanceof HTMLElement?new t({container:e}):new t(e);return null!=n&&i.fromJSON(n),i}t.render=e}(Wy||(Wy={})),function(t){t.registerNode=Rm.registry.register,t.registerEdge=zm.registry.register,t.registerView=uf.registry.register,t.registerAttr=dg.registry.register,t.registerGrid=pu.registry.register,t.registerFilter=wu.registry.register,t.registerNodeTool=If.registry.register,t.registerEdgeTool=Rf.registry.register,t.registerBackground=xu.registry.register,t.registerHighlighter=Pg.registry.register,t.registerPortLayout=Ig.registry.register,t.registerPortLabelLayout=tf.registry.register,t.registerMarker=_d.registry.register,t.registerRouter=cm.registry.register,t.registerConnector=Mm.registry.register,t.registerAnchor=np.registry.register,t.registerEdgeAnchor=cp.registry.register,t.registerConnectionPoint=bp.registry.register}(Wy||(Wy={})),function(t){t.unregisterNode=Rm.registry.unregister,t.unregisterEdge=zm.registry.unregister,t.unregisterView=uf.registry.unregister,t.unregisterAttr=dg.registry.unregister,t.unregisterGrid=pu.registry.unregister,t.unregisterFilter=wu.registry.unregister,t.unregisterNodeTool=If.registry.unregister,t.unregisterEdgeTool=Rf.registry.unregister,t.unregisterBackground=xu.registry.unregister,t.unregisterHighlighter=Pg.registry.unregister,t.unregisterPortLayout=Ig.registry.unregister,t.unregisterPortLabelLayout=tf.registry.unregister,t.unregisterMarker=_d.registry.unregister,t.unregisterRouter=cm.registry.unregister,t.unregisterConnector=Mm.registry.unregister,t.unregisterAnchor=np.registry.unregister,t.unregisterEdgeAnchor=cp.registry.unregister,t.unregisterConnectionPoint=bp.registry.unregister}(Wy||(Wy={}));var Jy=function(t,e,n,i){var r,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,n,o):r(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o},Xy=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};class _y extends Rm{}(function(t){class e extends cy{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){c.empty(e);const n=t.shapeMaps[this.cell.shape];if(!n)return;let{html:i}=n;"function"===typeof i&&(i=i(this.cell)),i&&("string"===typeof i?e.innerHTML=i:c.append(e,i))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}Jy([e.dispose()],e.prototype,"dispose",null),t.View=e,function(t){t.action="html",t.config({bootstrap:[t.action],actions:{html:t.action}}),cy.registry.register("html-view",t,!0)}(e=t.View||(t.View={}))})(_y||(_y={})),function(t){t.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},nf.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),Rm.registry.register("html",t,!0)}(_y||(_y={})),function(t){function e(e){const{shape:n,html:i,effect:r,inherit:s}=e,o=Xy(e,["shape","html","effect","inherit"]);if(!n)throw new Error("should specify shape in config");t.shapeMaps[n]={html:i,effect:r},Wy.registerNode(n,Object.assign({inherit:s||"html"},o),!0)}t.shapeMaps={},t.register=e}(_y||(_y={}))},6362:function(t,e){"object"===typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),"undefined"!==typeof window&&function(t){t.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)}})})}([Element.prototype,Document.prototype,DocumentFragment.prototype])}}]);