@wyltils/ems-editor 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,807 @@
1
+ (function(lt,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue"),require("element-plus"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus","pinia"],f):(lt=typeof globalThis<"u"?globalThis:lt||self,f(lt.EmsEditor={},lt.Vue,lt.ElementPlus,lt.Pinia))})(this,function(lt,f,de,ge){"use strict";/*! Element Plus Icons Vue v2.3.2 */var Cd=f.defineComponent({name:"Document",__name:"document",setup(s){return(t,e)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"})]))}}),Ad=Cd,wd=f.defineComponent({name:"Menu",__name:"menu",setup(s){return(t,e)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M160 448a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zM160 896a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32z"})]))}}),xd=wd,vd=f.defineComponent({name:"Plus",__name:"plus",setup(s){return(t,e)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),Ed=vd,Sd=f.defineComponent({name:"Search",__name:"search",setup(s){return(t,e)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),Md=Sd;function K(s,t){var e={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&t.indexOf(n)<0&&(e[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(e[n[i]]=s[n[i]]);return e}function H(s,t,e,n){var i=arguments.length,o=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(i<3?r(o):i>3?r(t,e,o):r(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o}function Qs(s,t,e,n){function i(o){return o instanceof e?o:new e(function(r){r(o)})}return new(e||(e=Promise))(function(o,r){function a(h){try{c(n.next(h))}catch(u){r(u)}}function l(h){try{c(n.throw(h))}catch(u){r(u)}}function c(h){h.done?o(h.value):i(h.value).then(a,l)}c((n=n.apply(s,t||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function Bd(s){s.forEach(t=>{Object.hasOwn(t,"append")||Object.defineProperty(t,"append",{configurable:!0,enumerable:!0,writable:!0,value(...e){const n=document.createDocumentFragment();e.forEach(i=>{const o=i instanceof Node;n.appendChild(o?i:document.createTextNode(String(i)))}),this.appendChild(n)}})})}typeof window=="object"&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),typeof window<"u"&&(s=>{Bd(s)})([Element.prototype,Document.prototype,DocumentFragment.prototype]);var kr=typeof global=="object"&&global&&global.Object===Object&&global,Id=typeof self=="object"&&self&&self.Object===Object&&self,_t=kr||Id||Function("return this")(),Jt=_t.Symbol,Or=Object.prototype,Pd=Or.hasOwnProperty,Td=Or.toString,Pn=Jt?Jt.toStringTag:void 0;function kd(s){var t=Pd.call(s,Pn),e=s[Pn];try{s[Pn]=void 0;var n=!0}catch{}var i=Td.call(s);return n&&(t?s[Pn]=e:delete s[Pn]),i}var Od=Object.prototype,Nd=Od.toString;function Rd(s){return Nd.call(s)}var Dd="[object Null]",Qd="[object Undefined]",Nr=Jt?Jt.toStringTag:void 0;function Se(s){return s==null?s===void 0?Qd:Dd:Nr&&Nr in Object(s)?kd(s):Rd(s)}function $t(s){return s!=null&&typeof s=="object"}var Ld="[object Symbol]";function re(s){return typeof s=="symbol"||$t(s)&&Se(s)==Ld}function Mi(s,t){for(var e=-1,n=s==null?0:s.length,i=Array(n);++e<n;)i[e]=t(s[e],e,s);return i}var St=Array.isArray,Rr=Jt?Jt.prototype:void 0,Dr=Rr?Rr.toString:void 0;function Qr(s){if(typeof s=="string")return s;if(St(s))return Mi(s,Qr)+"";if(re(s))return Dr?Dr.call(s):"";var t=s+"";return t=="0"&&1/s==-1/0?"-0":t}var Fd=/\s/;function zd(s){for(var t=s.length;t--&&Fd.test(s.charAt(t)););return t}var Ud=/^\s+/;function Kd(s){return s&&s.slice(0,zd(s)+1).replace(Ud,"")}function ht(s){var t=typeof s;return s!=null&&(t=="object"||t=="function")}var Lr=NaN,Jd=/^[-+]0x[0-9a-f]+$/i,jd=/^0b[01]+$/i,Vd=/^0o[0-7]+$/i,Gd=parseInt;function Tn(s){if(typeof s=="number")return s;if(re(s))return Lr;if(ht(s)){var t=typeof s.valueOf=="function"?s.valueOf():s;s=ht(t)?t+"":t}if(typeof s!="string")return s===0?s:+s;s=Kd(s);var e=jd.test(s);return e||Vd.test(s)?Gd(s.slice(2),e?2:8):Jd.test(s)?Lr:+s}function _e(s){return s}var Yd="[object AsyncFunction]",Hd="[object Function]",qd="[object GeneratorFunction]",Wd="[object Proxy]";function Ls(s){if(!ht(s))return!1;var t=Se(s);return t==Hd||t==qd||t==Yd||t==Wd}var Fs=_t["__core-js_shared__"],Fr=function(){var s=/[^.]+$/.exec(Fs&&Fs.keys&&Fs.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}();function Xd(s){return!!Fr&&Fr in s}var _d=Function.prototype,$d=_d.toString;function Fe(s){if(s!=null){try{return $d.call(s)}catch{}try{return s+""}catch{}}return""}var Zd=/[\\^$.*+?()[\]{}|]/g,tg=/^\[object .+?Constructor\]$/,eg=Function.prototype,ng=Object.prototype,ig=eg.toString,sg=ng.hasOwnProperty,og=RegExp("^"+ig.call(sg).replace(Zd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function rg(s){if(!ht(s)||Xd(s))return!1;var t=Ls(s)?og:tg;return t.test(Fe(s))}function ag(s,t){return s==null?void 0:s[t]}function ze(s,t){var e=ag(s,t);return rg(e)?e:void 0}var zs=ze(_t,"WeakMap"),zr=Object.create,lg=function(){function s(){}return function(t){if(!ht(t))return{};if(zr)return zr(t);s.prototype=t;var e=new s;return s.prototype=void 0,e}}();function Ur(s,t,e){switch(e.length){case 0:return s.call(t);case 1:return s.call(t,e[0]);case 2:return s.call(t,e[0],e[1]);case 3:return s.call(t,e[0],e[1],e[2])}return s.apply(t,e)}function cg(){}function Kr(s,t){var e=-1,n=s.length;for(t||(t=Array(n));++e<n;)t[e]=s[e];return t}var hg=800,ug=16,dg=Date.now;function gg(s){var t=0,e=0;return function(){var n=dg(),i=ug-(n-e);if(e=n,i>0){if(++t>=hg)return arguments[0]}else t=0;return s.apply(void 0,arguments)}}function fg(s){return function(){return s}}var Bi=function(){try{var s=ze(Object,"defineProperty");return s({},"",{}),s}catch{}}(),pg=Bi?function(s,t){return Bi(s,"toString",{configurable:!0,enumerable:!1,value:fg(t),writable:!0})}:_e,Jr=gg(pg);function mg(s,t){for(var e=-1,n=s==null?0:s.length;++e<n&&t(s[e],e,s)!==!1;);return s}function bg(s,t,e,n){for(var i=s.length,o=e+-1;++o<i;)if(t(s[o],o,s))return o;return-1}function yg(s){return s!==s}function Cg(s,t,e){for(var n=e-1,i=s.length;++n<i;)if(s[n]===t)return n;return-1}function Ag(s,t,e){return t===t?Cg(s,t,e):bg(s,yg,e)}function jr(s,t){var e=s==null?0:s.length;return!!e&&Ag(s,t,0)>-1}var wg=9007199254740991,xg=/^(?:0|[1-9]\d*)$/;function Ii(s,t){var e=typeof s;return t=t??wg,!!t&&(e=="number"||e!="symbol"&&xg.test(s))&&s>-1&&s%1==0&&s<t}function Pi(s,t,e){t=="__proto__"&&Bi?Bi(s,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):s[t]=e}function $e(s,t){return s===t||s!==s&&t!==t}var vg=Object.prototype,Eg=vg.hasOwnProperty;function Us(s,t,e){var n=s[t];(!(Eg.call(s,t)&&$e(n,e))||e===void 0&&!(t in s))&&Pi(s,t,e)}function kn(s,t,e,n){var i=!e;e||(e={});for(var o=-1,r=t.length;++o<r;){var a=t[o],l=void 0;l===void 0&&(l=s[a]),i?Pi(e,a,l):Us(e,a,l)}return e}var Vr=Math.max;function Gr(s,t,e){return t=Vr(t===void 0?s.length-1:t,0),function(){for(var n=arguments,i=-1,o=Vr(n.length-t,0),r=Array(o);++i<o;)r[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=e(r),Ur(s,this,a)}}function Ze(s,t){return Jr(Gr(s,t,_e),s+"")}var Sg=9007199254740991;function Ks(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Sg}function Ue(s){return s!=null&&Ks(s.length)&&!Ls(s)}function Ti(s,t,e){if(!ht(e))return!1;var n=typeof t;return(n=="number"?Ue(e)&&Ii(t,e.length):n=="string"&&t in e)?$e(e[t],s):!1}function Yr(s){return Ze(function(t,e){var n=-1,i=e.length,o=i>1?e[i-1]:void 0,r=i>2?e[2]:void 0;for(o=s.length>3&&typeof o=="function"?(i--,o):void 0,r&&Ti(e[0],e[1],r)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var a=e[n];a&&s(t,a,n,o)}return t})}var Mg=Object.prototype;function ki(s){var t=s&&s.constructor,e=typeof t=="function"&&t.prototype||Mg;return s===e}function Bg(s,t){for(var e=-1,n=Array(s);++e<s;)n[e]=t(e);return n}var Ig="[object Arguments]";function Hr(s){return $t(s)&&Se(s)==Ig}var qr=Object.prototype,Pg=qr.hasOwnProperty,Tg=qr.propertyIsEnumerable,tn=Hr(function(){return arguments}())?Hr:function(s){return $t(s)&&Pg.call(s,"callee")&&!Tg.call(s,"callee")};function kg(){return!1}var Wr=typeof lt=="object"&&lt&&!lt.nodeType&&lt,Xr=Wr&&typeof module=="object"&&module&&!module.nodeType&&module,Og=Xr&&Xr.exports===Wr,_r=Og?_t.Buffer:void 0,Ng=_r?_r.isBuffer:void 0,en=Ng||kg,Rg="[object Arguments]",Dg="[object Array]",Qg="[object Boolean]",Lg="[object Date]",Fg="[object Error]",zg="[object Function]",Ug="[object Map]",Kg="[object Number]",Jg="[object Object]",jg="[object RegExp]",Vg="[object Set]",Gg="[object String]",Yg="[object WeakMap]",Hg="[object ArrayBuffer]",qg="[object DataView]",Wg="[object Float32Array]",Xg="[object Float64Array]",_g="[object Int8Array]",$g="[object Int16Array]",Zg="[object Int32Array]",tf="[object Uint8Array]",ef="[object Uint8ClampedArray]",nf="[object Uint16Array]",sf="[object Uint32Array]",ot={};ot[Wg]=ot[Xg]=ot[_g]=ot[$g]=ot[Zg]=ot[tf]=ot[ef]=ot[nf]=ot[sf]=!0,ot[Rg]=ot[Dg]=ot[Hg]=ot[Qg]=ot[qg]=ot[Lg]=ot[Fg]=ot[zg]=ot[Ug]=ot[Kg]=ot[Jg]=ot[jg]=ot[Vg]=ot[Gg]=ot[Yg]=!1;function of(s){return $t(s)&&Ks(s.length)&&!!ot[Se(s)]}function Oi(s){return function(t){return s(t)}}var $r=typeof lt=="object"&&lt&&!lt.nodeType&&lt,On=$r&&typeof module=="object"&&module&&!module.nodeType&&module,rf=On&&On.exports===$r,Js=rf&&kr.process,nn=function(){try{var s=On&&On.require&&On.require("util").types;return s||Js&&Js.binding&&Js.binding("util")}catch{}}(),Zr=nn&&nn.isTypedArray,Ni=Zr?Oi(Zr):of,af=Object.prototype,lf=af.hasOwnProperty;function ta(s,t){var e=St(s),n=!e&&tn(s),i=!e&&!n&&en(s),o=!e&&!n&&!i&&Ni(s),r=e||n||i||o,a=r?Bg(s.length,String):[],l=a.length;for(var c in s)(t||lf.call(s,c))&&!(r&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ii(c,l)))&&a.push(c);return a}function ea(s,t){return function(e){return s(t(e))}}var cf=ea(Object.keys,Object),hf=Object.prototype,uf=hf.hasOwnProperty;function na(s){if(!ki(s))return cf(s);var t=[];for(var e in Object(s))uf.call(s,e)&&e!="constructor"&&t.push(e);return t}function Nn(s){return Ue(s)?ta(s):na(s)}function df(s){var t=[];if(s!=null)for(var e in Object(s))t.push(e);return t}var gf=Object.prototype,ff=gf.hasOwnProperty;function pf(s){if(!ht(s))return df(s);var t=ki(s),e=[];for(var n in s)n=="constructor"&&(t||!ff.call(s,n))||e.push(n);return e}function sn(s){return Ue(s)?ta(s,!0):pf(s)}var mf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bf=/^\w*$/;function js(s,t){if(St(s))return!1;var e=typeof s;return e=="number"||e=="symbol"||e=="boolean"||s==null||re(s)?!0:bf.test(s)||!mf.test(s)||t!=null&&s in Object(t)}var Rn=ze(Object,"create");function yf(){this.__data__=Rn?Rn(null):{},this.size=0}function Cf(s){var t=this.has(s)&&delete this.__data__[s];return this.size-=t?1:0,t}var Af="__lodash_hash_undefined__",wf=Object.prototype,xf=wf.hasOwnProperty;function vf(s){var t=this.__data__;if(Rn){var e=t[s];return e===Af?void 0:e}return xf.call(t,s)?t[s]:void 0}var Ef=Object.prototype,Sf=Ef.hasOwnProperty;function Mf(s){var t=this.__data__;return Rn?t[s]!==void 0:Sf.call(t,s)}var Bf="__lodash_hash_undefined__";function If(s,t){var e=this.__data__;return this.size+=this.has(s)?0:1,e[s]=Rn&&t===void 0?Bf:t,this}function Ke(s){var t=-1,e=s==null?0:s.length;for(this.clear();++t<e;){var n=s[t];this.set(n[0],n[1])}}Ke.prototype.clear=yf,Ke.prototype.delete=Cf,Ke.prototype.get=vf,Ke.prototype.has=Mf,Ke.prototype.set=If;function Pf(){this.__data__=[],this.size=0}function Ri(s,t){for(var e=s.length;e--;)if($e(s[e][0],t))return e;return-1}var Tf=Array.prototype,kf=Tf.splice;function Of(s){var t=this.__data__,e=Ri(t,s);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():kf.call(t,e,1),--this.size,!0}function Nf(s){var t=this.__data__,e=Ri(t,s);return e<0?void 0:t[e][1]}function Rf(s){return Ri(this.__data__,s)>-1}function Df(s,t){var e=this.__data__,n=Ri(e,s);return n<0?(++this.size,e.push([s,t])):e[n][1]=t,this}function fe(s){var t=-1,e=s==null?0:s.length;for(this.clear();++t<e;){var n=s[t];this.set(n[0],n[1])}}fe.prototype.clear=Pf,fe.prototype.delete=Of,fe.prototype.get=Nf,fe.prototype.has=Rf,fe.prototype.set=Df;var Dn=ze(_t,"Map");function Qf(){this.size=0,this.__data__={hash:new Ke,map:new(Dn||fe),string:new Ke}}function Lf(s){var t=typeof s;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?s!=="__proto__":s===null}function Di(s,t){var e=s.__data__;return Lf(t)?e[typeof t=="string"?"string":"hash"]:e.map}function Ff(s){var t=Di(this,s).delete(s);return this.size-=t?1:0,t}function zf(s){return Di(this,s).get(s)}function Uf(s){return Di(this,s).has(s)}function Kf(s,t){var e=Di(this,s),n=e.size;return e.set(s,t),this.size+=e.size==n?0:1,this}function pe(s){var t=-1,e=s==null?0:s.length;for(this.clear();++t<e;){var n=s[t];this.set(n[0],n[1])}}pe.prototype.clear=Qf,pe.prototype.delete=Ff,pe.prototype.get=zf,pe.prototype.has=Uf,pe.prototype.set=Kf;var Jf="Expected a function";function Vs(s,t){if(typeof s!="function"||t!=null&&typeof t!="function")throw new TypeError(Jf);var e=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=e.cache;if(o.has(i))return o.get(i);var r=s.apply(this,n);return e.cache=o.set(i,r)||o,r};return e.cache=new(Vs.Cache||pe),e}Vs.Cache=pe;var jf=500;function Vf(s){var t=Vs(s,function(n){return e.size===jf&&e.clear(),n}),e=t.cache;return t}var Gf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yf=/\\(\\)?/g,Hf=Vf(function(s){var t=[];return s.charCodeAt(0)===46&&t.push(""),s.replace(Gf,function(e,n,i,o){t.push(i?o.replace(Yf,"$1"):n||e)}),t});function on(s){return s==null?"":Qr(s)}function Qi(s,t){return St(s)?s:js(s,t)?[s]:Hf(on(s))}function Qn(s){if(typeof s=="string"||re(s))return s;var t=s+"";return t=="0"&&1/s==-1/0?"-0":t}function Li(s,t){t=Qi(t,s);for(var e=0,n=t.length;s!=null&&e<n;)s=s[Qn(t[e++])];return e&&e==n?s:void 0}function qf(s,t,e){var n=s==null?void 0:Li(s,t);return n===void 0?e:n}function Gs(s,t){for(var e=-1,n=t.length,i=s.length;++e<n;)s[i+e]=t[e];return s}var ia=Jt?Jt.isConcatSpreadable:void 0;function Wf(s){return St(s)||tn(s)||!!(ia&&s&&s[ia])}function Fi(s,t,e,n,i){var o=-1,r=s.length;for(e||(e=Wf),i||(i=[]);++o<r;){var a=s[o];e(a)?Gs(i,a):n||(i[i.length]=a)}return i}function Xf(s){var t=s==null?0:s.length;return t?Fi(s):[]}function _f(s){return Jr(Gr(s,void 0,Xf),s+"")}var Ys=ea(Object.getPrototypeOf,Object),$f="[object Object]",Zf=Function.prototype,tp=Object.prototype,sa=Zf.toString,ep=tp.hasOwnProperty,np=sa.call(Object);function Zt(s){if(!$t(s)||Se(s)!=$f)return!1;var t=Ys(s);if(t===null)return!0;var e=ep.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&sa.call(e)==np}function ip(s,t,e){var n=-1,i=s.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=s[n+t];return o}function sp(s,t,e){var n=s.length;return e=e===void 0?n:e,!t&&e>=n?s:ip(s,t,e)}var op="\\ud800-\\udfff",rp="\\u0300-\\u036f",ap="\\ufe20-\\ufe2f",lp="\\u20d0-\\u20ff",cp=rp+ap+lp,hp="\\ufe0e\\ufe0f",up="\\u200d",dp=RegExp("["+up+op+cp+hp+"]");function oa(s){return dp.test(s)}function gp(s){return s.split("")}var ra="\\ud800-\\udfff",fp="\\u0300-\\u036f",pp="\\ufe20-\\ufe2f",mp="\\u20d0-\\u20ff",bp=fp+pp+mp,yp="\\ufe0e\\ufe0f",Cp="["+ra+"]",Hs="["+bp+"]",qs="\\ud83c[\\udffb-\\udfff]",Ap="(?:"+Hs+"|"+qs+")",aa="[^"+ra+"]",la="(?:\\ud83c[\\udde6-\\uddff]){2}",ca="[\\ud800-\\udbff][\\udc00-\\udfff]",wp="\\u200d",ha=Ap+"?",ua="["+yp+"]?",xp="(?:"+wp+"(?:"+[aa,la,ca].join("|")+")"+ua+ha+")*",vp=ua+ha+xp,Ep="(?:"+[aa+Hs+"?",Hs,la,ca,Cp].join("|")+")",Sp=RegExp(qs+"(?="+qs+")|"+Ep+vp,"g");function Mp(s){return s.match(Sp)||[]}function Bp(s){return oa(s)?Mp(s):gp(s)}function da(s){return function(t){t=on(t);var e=oa(t)?Bp(t):void 0,n=e?e[0]:t.charAt(0),i=e?sp(e,1).join(""):t.slice(1);return n[s]()+i}}var zi=da("toUpperCase");function Ip(s){return zi(on(s).toLowerCase())}function Pp(s,t,e,n){for(var i=-1,o=s==null?0:s.length;++i<o;)e=t(e,s[i],i,s);return e}function Tp(s){return function(t){return s==null?void 0:s[t]}}var kp={À:"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",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\u20ff",qp=Gp+Yp+Hp,fa="\\u2700-\\u27bf",pa="a-z\\xdf-\\xf6\\xf8-\\xff",Wp="\\xac\\xb1\\xd7\\xf7",Xp="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",_p="\\u2000-\\u206f",$p=" \\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",ma="A-Z\\xc0-\\xd6\\xd8-\\xde",Zp="\\ufe0e\\ufe0f",ba=Wp+Xp+_p+$p,ya="['’]",Ca="["+ba+"]",tm="["+qp+"]",Aa="\\d+",em="["+fa+"]",wa="["+pa+"]",xa="[^"+ga+ba+Aa+fa+pa+ma+"]",nm="\\ud83c[\\udffb-\\udfff]",im="(?:"+tm+"|"+nm+")",sm="[^"+ga+"]",va="(?:\\ud83c[\\udde6-\\uddff]){2}",Ea="[\\ud800-\\udbff][\\udc00-\\udfff]",rn="["+ma+"]",om="\\u200d",Sa="(?:"+wa+"|"+xa+")",rm="(?:"+rn+"|"+xa+")",Ma="(?:"+ya+"(?:d|ll|m|re|s|t|ve))?",Ba="(?:"+ya+"(?:D|LL|M|RE|S|T|VE))?",Ia=im+"?",Pa="["+Zp+"]?",am="(?:"+om+"(?:"+[sm,va,Ea].join("|")+")"+Pa+Ia+")*",lm="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",cm="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hm=Pa+Ia+am,um="(?:"+[em,va,Ea].join("|")+")"+hm,dm=RegExp([rn+"?"+wa+"+"+Ma+"(?="+[Ca,rn,"$"].join("|")+")",rm+"+"+Ba+"(?="+[Ca,rn+Sa,"$"].join("|")+")",rn+"?"+Sa+"+"+Ma,rn+"+"+Ba,cm,lm,Aa,um].join("|"),"g");function gm(s){return s.match(dm)||[]}function fm(s,t,e){return s=on(s),t=t,t===void 0?Vp(s)?gm(s):Jp(s):s.match(t)||[]}var pm="['’]",mm=RegExp(pm,"g");function Ta(s){return function(t){return Pp(fm(Up(t).replace(mm,"")),s,"")}}var Ln=Ta(function(s,t,e){return t=t.toLowerCase(),s+(e?Ip(t):t)});function ka(){if(!arguments.length)return[];var s=arguments[0];return St(s)?s:[s]}function bm(s,t,e){return s===s&&(e!==void 0&&(s=s<=e?s:e),t!==void 0&&(s=s>=t?s:t)),s}function Je(s,t,e){return e===void 0&&(e=t,t=void 0),e!==void 0&&(e=Tn(e),e=e===e?e:0),t!==void 0&&(t=Tn(t),t=t===t?t:0),bm(Tn(s),t,e)}function ym(){this.__data__=new fe,this.size=0}function Cm(s){var t=this.__data__,e=t.delete(s);return this.size=t.size,e}function Am(s){return this.__data__.get(s)}function wm(s){return this.__data__.has(s)}var xm=200;function vm(s,t){var e=this.__data__;if(e instanceof fe){var n=e.__data__;if(!Dn||n.length<xm-1)return n.push([s,t]),this.size=++e.size,this;e=this.__data__=new pe(n)}return e.set(s,t),this.size=e.size,this}function te(s){var t=this.__data__=new fe(s);this.size=t.size}te.prototype.clear=ym,te.prototype.delete=Cm,te.prototype.get=Am,te.prototype.has=wm,te.prototype.set=vm;function Em(s,t){return s&&kn(t,Nn(t),s)}function Sm(s,t){return s&&kn(t,sn(t),s)}var Oa=typeof lt=="object"&&lt&&!lt.nodeType&&lt,Na=Oa&&typeof module=="object"&&module&&!module.nodeType&&module,Mm=Na&&Na.exports===Oa,Ra=Mm?_t.Buffer:void 0,Da=Ra?Ra.allocUnsafe:void 0;function Qa(s,t){if(t)return s.slice();var e=s.length,n=Da?Da(e):new s.constructor(e);return s.copy(n),n}function Bm(s,t){for(var e=-1,n=s==null?0:s.length,i=0,o=[];++e<n;){var r=s[e];t(r,e,s)&&(o[i++]=r)}return o}function La(){return[]}var Im=Object.prototype,Pm=Im.propertyIsEnumerable,Fa=Object.getOwnPropertySymbols,Ws=Fa?function(s){return s==null?[]:(s=Object(s),Bm(Fa(s),function(t){return Pm.call(s,t)}))}:La;function Tm(s,t){return kn(s,Ws(s),t)}var km=Object.getOwnPropertySymbols,za=km?function(s){for(var t=[];s;)Gs(t,Ws(s)),s=Ys(s);return t}:La;function Om(s,t){return kn(s,za(s),t)}function Ua(s,t,e){var n=t(s);return St(s)?n:Gs(n,e(s))}function Xs(s){return Ua(s,Nn,Ws)}function Nm(s){return Ua(s,sn,za)}var _s=ze(_t,"DataView"),$s=ze(_t,"Promise"),an=ze(_t,"Set"),Ka="[object Map]",Rm="[object Object]",Ja="[object Promise]",ja="[object Set]",Va="[object WeakMap]",Ga="[object DataView]",Dm=Fe(_s),Qm=Fe(Dn),Lm=Fe($s),Fm=Fe(an),zm=Fe(zs),jt=Se;(_s&&jt(new _s(new ArrayBuffer(1)))!=Ga||Dn&&jt(new Dn)!=Ka||$s&&jt($s.resolve())!=Ja||an&&jt(new an)!=ja||zs&&jt(new zs)!=Va)&&(jt=function(s){var t=Se(s),e=t==Rm?s.constructor:void 0,n=e?Fe(e):"";if(n)switch(n){case Dm:return Ga;case Qm:return Ka;case Lm:return Ja;case Fm:return ja;case zm:return Va}return t});var Um=Object.prototype,Km=Um.hasOwnProperty;function Jm(s){var t=s.length,e=new s.constructor(t);return t&&typeof s[0]=="string"&&Km.call(s,"index")&&(e.index=s.index,e.input=s.input),e}var Ui=_t.Uint8Array;function Zs(s){var t=new s.constructor(s.byteLength);return new Ui(t).set(new Ui(s)),t}function jm(s,t){var e=t?Zs(s.buffer):s.buffer;return new s.constructor(e,s.byteOffset,s.byteLength)}var Vm=/\w*$/;function Gm(s){var t=new s.constructor(s.source,Vm.exec(s));return t.lastIndex=s.lastIndex,t}var Ya=Jt?Jt.prototype:void 0,Ha=Ya?Ya.valueOf:void 0;function Ym(s){return Ha?Object(Ha.call(s)):{}}function qa(s,t){var e=t?Zs(s.buffer):s.buffer;return new s.constructor(e,s.byteOffset,s.length)}var Hm="[object Boolean]",qm="[object Date]",Wm="[object Map]",Xm="[object Number]",_m="[object RegExp]",$m="[object Set]",Zm="[object String]",t0="[object Symbol]",e0="[object ArrayBuffer]",n0="[object DataView]",i0="[object Float32Array]",s0="[object Float64Array]",o0="[object Int8Array]",r0="[object Int16Array]",a0="[object Int32Array]",l0="[object Uint8Array]",c0="[object Uint8ClampedArray]",h0="[object Uint16Array]",u0="[object Uint32Array]";function d0(s,t,e){var n=s.constructor;switch(t){case e0:return Zs(s);case Hm:case qm:return new n(+s);case n0:return jm(s,e);case i0:case s0:case o0:case r0:case a0:case l0:case c0:case h0:case u0:return qa(s,e);case Wm:return new n;case Xm:case Zm:return new n(s);case _m:return Gm(s);case $m:return new n;case t0:return Ym(s)}}function Wa(s){return typeof s.constructor=="function"&&!ki(s)?lg(Ys(s)):{}}var g0="[object Map]";function f0(s){return $t(s)&&jt(s)==g0}var Xa=nn&&nn.isMap,p0=Xa?Oi(Xa):f0,m0="[object Set]";function b0(s){return $t(s)&&jt(s)==m0}var _a=nn&&nn.isSet,y0=_a?Oi(_a):b0,C0=1,A0=2,w0=4,$a="[object Arguments]",x0="[object Array]",v0="[object Boolean]",E0="[object Date]",S0="[object Error]",Za="[object Function]",M0="[object GeneratorFunction]",B0="[object Map]",I0="[object Number]",tl="[object Object]",P0="[object RegExp]",T0="[object Set]",k0="[object String]",O0="[object Symbol]",N0="[object WeakMap]",R0="[object ArrayBuffer]",D0="[object DataView]",Q0="[object Float32Array]",L0="[object Float64Array]",F0="[object Int8Array]",z0="[object Int16Array]",U0="[object Int32Array]",K0="[object Uint8Array]",J0="[object Uint8ClampedArray]",j0="[object Uint16Array]",V0="[object Uint32Array]",it={};it[$a]=it[x0]=it[R0]=it[D0]=it[v0]=it[E0]=it[Q0]=it[L0]=it[F0]=it[z0]=it[U0]=it[B0]=it[I0]=it[tl]=it[P0]=it[T0]=it[k0]=it[O0]=it[K0]=it[J0]=it[j0]=it[V0]=!0,it[S0]=it[Za]=it[N0]=!1;function Fn(s,t,e,n,i,o){var r,a=t&C0,l=t&A0,c=t&w0;if(r!==void 0)return r;if(!ht(s))return s;var h=St(s);if(h){if(r=Jm(s),!a)return Kr(s,r)}else{var u=jt(s),d=u==Za||u==M0;if(en(s))return Qa(s,a);if(u==tl||u==$a||d&&!i){if(r=l||d?{}:Wa(s),!a)return l?Om(s,Sm(r,s)):Tm(s,Em(r,s))}else{if(!it[u])return i?s:{};r=d0(s,u,a)}}o||(o=new te);var g=o.get(s);if(g)return g;o.set(s,r),y0(s)?s.forEach(function(b){r.add(Fn(b,t,e,b,s,o))}):p0(s)&&s.forEach(function(b,y){r.set(y,Fn(b,t,e,y,s,o))});var p=c?l?Nm:Xs:l?sn:Nn,m=h?void 0:p(s);return mg(m||s,function(b,y){m&&(y=b,b=s[y]),Us(r,y,Fn(b,t,e,y,s,o))}),r}var G0=4;function to(s){return Fn(s,G0)}var Y0=1,H0=4;function rt(s){return Fn(s,Y0|H0)}var q0="__lodash_hash_undefined__";function W0(s){return this.__data__.set(s,q0),this}function X0(s){return this.__data__.has(s)}function ln(s){var t=-1,e=s==null?0:s.length;for(this.__data__=new pe;++t<e;)this.add(s[t])}ln.prototype.add=ln.prototype.push=W0,ln.prototype.has=X0;function _0(s,t){for(var e=-1,n=s==null?0:s.length;++e<n;)if(t(s[e],e,s))return!0;return!1}function eo(s,t){return s.has(t)}var $0=1,Z0=2;function el(s,t,e,n,i,o){var r=e&$0,a=s.length,l=t.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(s),h=o.get(t);if(c&&h)return c==t&&h==s;var u=-1,d=!0,g=e&Z0?new ln:void 0;for(o.set(s,t),o.set(t,s);++u<a;){var p=s[u],m=t[u];if(n)var b=r?n(m,p,u,t,s,o):n(p,m,u,s,t,o);if(b!==void 0){if(b)continue;d=!1;break}if(g){if(!_0(t,function(y,C){if(!eo(g,C)&&(p===y||i(p,y,e,n,o)))return g.push(C)})){d=!1;break}}else if(!(p===m||i(p,m,e,n,o))){d=!1;break}}return o.delete(s),o.delete(t),d}function tb(s){var t=-1,e=Array(s.size);return s.forEach(function(n,i){e[++t]=[i,n]}),e}function no(s){var t=-1,e=Array(s.size);return s.forEach(function(n){e[++t]=n}),e}var eb=1,nb=2,ib="[object Boolean]",sb="[object Date]",ob="[object Error]",rb="[object Map]",ab="[object Number]",lb="[object RegExp]",cb="[object Set]",hb="[object String]",ub="[object Symbol]",db="[object ArrayBuffer]",gb="[object DataView]",nl=Jt?Jt.prototype:void 0,io=nl?nl.valueOf:void 0;function fb(s,t,e,n,i,o,r){switch(e){case gb:if(s.byteLength!=t.byteLength||s.byteOffset!=t.byteOffset)return!1;s=s.buffer,t=t.buffer;case db:return!(s.byteLength!=t.byteLength||!o(new Ui(s),new Ui(t)));case ib:case sb:case ab:return $e(+s,+t);case ob:return s.name==t.name&&s.message==t.message;case lb:case hb:return s==t+"";case rb:var a=tb;case cb:var l=n&eb;if(a||(a=no),s.size!=t.size&&!l)return!1;var c=r.get(s);if(c)return c==t;n|=nb,r.set(s,t);var h=el(a(s),a(t),n,i,o,r);return r.delete(s),h;case ub:if(io)return io.call(s)==io.call(t)}return!1}var pb=1,mb=Object.prototype,bb=mb.hasOwnProperty;function yb(s,t,e,n,i,o){var r=e&pb,a=Xs(s),l=a.length,c=Xs(t),h=c.length;if(l!=h&&!r)return!1;for(var u=l;u--;){var d=a[u];if(!(r?d in t:bb.call(t,d)))return!1}var g=o.get(s),p=o.get(t);if(g&&p)return g==t&&p==s;var m=!0;o.set(s,t),o.set(t,s);for(var b=r;++u<l;){d=a[u];var y=s[d],C=t[d];if(n)var w=r?n(C,y,d,t,s,o):n(y,C,d,s,t,o);if(!(w===void 0?y===C||i(y,C,e,n,o):w)){m=!1;break}b||(b=d=="constructor")}if(m&&!b){var x=s.constructor,E=t.constructor;x!=E&&"constructor"in s&&"constructor"in t&&!(typeof x=="function"&&x instanceof x&&typeof E=="function"&&E instanceof E)&&(m=!1)}return o.delete(s),o.delete(t),m}var Cb=1,il="[object Arguments]",sl="[object Array]",Ki="[object Object]",Ab=Object.prototype,ol=Ab.hasOwnProperty;function wb(s,t,e,n,i,o){var r=St(s),a=St(t),l=r?sl:jt(s),c=a?sl:jt(t);l=l==il?Ki:l,c=c==il?Ki:c;var h=l==Ki,u=c==Ki,d=l==c;if(d&&en(s)){if(!en(t))return!1;r=!0,h=!1}if(d&&!h)return o||(o=new te),r||Ni(s)?el(s,t,e,n,i,o):fb(s,t,l,e,n,i,o);if(!(e&Cb)){var g=h&&ol.call(s,"__wrapped__"),p=u&&ol.call(t,"__wrapped__");if(g||p){var m=g?s.value():s,b=p?t.value():t;return o||(o=new te),i(m,b,e,n,o)}}return d?(o||(o=new te),yb(s,t,e,n,i,o)):!1}function Ji(s,t,e,n,i){return s===t?!0:s==null||t==null||!$t(s)&&!$t(t)?s!==s&&t!==t:wb(s,t,e,n,Ji,i)}var xb=1,vb=2;function Eb(s,t,e,n){var i=e.length,o=i;if(s==null)return!o;for(s=Object(s);i--;){var r=e[i];if(r[2]?r[1]!==s[r[0]]:!(r[0]in s))return!1}for(;++i<o;){r=e[i];var a=r[0],l=s[a],c=r[1];if(r[2]){if(l===void 0&&!(a in s))return!1}else{var h=new te,u;if(!(u===void 0?Ji(c,l,xb|vb,n,h):u))return!1}}return!0}function rl(s){return s===s&&!ht(s)}function Sb(s){for(var t=Nn(s),e=t.length;e--;){var n=t[e],i=s[n];t[e]=[n,i,rl(i)]}return t}function al(s,t){return function(e){return e==null?!1:e[s]===t&&(t!==void 0||s in Object(e))}}function Mb(s){var t=Sb(s);return t.length==1&&t[0][2]?al(t[0][0],t[0][1]):function(e){return e===s||Eb(e,s,t)}}function Bb(s,t){return s!=null&&t in Object(s)}function ll(s,t,e){t=Qi(t,s);for(var n=-1,i=t.length,o=!1;++n<i;){var r=Qn(t[n]);if(!(o=s!=null&&e(s,r)))break;s=s[r]}return o||++n!=i?o:(i=s==null?0:s.length,!!i&&Ks(i)&&Ii(r,i)&&(St(s)||tn(s)))}function cl(s,t){return s!=null&&ll(s,t,Bb)}var Ib=1,Pb=2;function Tb(s,t){return js(s)&&rl(t)?al(Qn(s),t):function(e){var n=qf(e,s);return n===void 0&&n===t?cl(e,s):Ji(t,n,Ib|Pb)}}function kb(s){return function(t){return t==null?void 0:t[s]}}function Ob(s){return function(t){return Li(t,s)}}function Nb(s){return js(s)?kb(Qn(s)):Ob(s)}function so(s){return typeof s=="function"?s:s==null?_e:typeof s=="object"?St(s)?Tb(s[0],s[1]):Mb(s):Nb(s)}function Rb(s,t,e,n){for(var i=-1,o=s==null?0:s.length;++i<o;){var r=s[i];t(n,r,e(r),s)}return n}function Db(s){return function(t,e,n){for(var i=-1,o=Object(t),r=n(t),a=r.length;a--;){var l=r[++i];if(e(o[l],l,o)===!1)break}return t}}var hl=Db();function Qb(s,t){return s&&hl(s,t,Nn)}function Lb(s,t){return function(e,n){if(e==null)return e;if(!Ue(e))return s(e,n);for(var i=e.length,o=-1,r=Object(e);++o<i&&n(r[o],o,r)!==!1;);return e}}var ul=Lb(Qb);function Fb(s,t,e,n){return ul(s,function(i,o,r){t(n,i,e(i),r)}),n}function zb(s,t){return function(e,n){var i=St(e)?Rb:Fb,o=t?t():{};return i(e,s,so(n),o)}}var oo=function(){return _t.Date.now()},Ub="Expected a function",Kb=Math.max,Jb=Math.min;function ji(s,t,e){var n,i,o,r,a,l,c=0,h=!1,u=!1,d=!0;if(typeof s!="function")throw new TypeError(Ub);t=Tn(t)||0,ht(e)&&(h=!!e.leading,u="maxWait"in e,o=u?Kb(Tn(e.maxWait)||0,t):o,d="trailing"in e?!!e.trailing:d);function g(B){var v=n,M=i;return n=i=void 0,c=B,r=s.apply(M,v),r}function p(B){return c=B,a=setTimeout(y,t),h?g(B):r}function m(B){var v=B-l,M=B-c,I=t-v;return u?Jb(I,o-M):I}function b(B){var v=B-l,M=B-c;return l===void 0||v>=t||v<0||u&&M>=o}function y(){var B=oo();if(b(B))return C(B);a=setTimeout(y,m(B))}function C(B){return a=void 0,d&&n?g(B):(n=i=void 0,r)}function w(){a!==void 0&&clearTimeout(a),c=0,n=l=i=a=void 0}function x(){return a===void 0?r:C(oo())}function E(){var B=oo(),v=b(B);if(n=arguments,i=this,l=B,v){if(a===void 0)return p(l);if(u)return clearTimeout(a),a=setTimeout(y,t),g(l)}return a===void 0&&(a=setTimeout(y,t)),r}return E.cancel=w,E.flush=x,E}var dl=Object.prototype,jb=dl.hasOwnProperty,Vb=Ze(function(s,t){s=Object(s);var e=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&Ti(t[0],t[1],i)&&(n=1);++e<n;)for(var o=t[e],r=sn(o),a=-1,l=r.length;++a<l;){var c=r[a],h=s[c];(h===void 0||$e(h,dl[c])&&!jb.call(s,c))&&(s[c]=o[c])}return s});function ro(s,t,e){(e!==void 0&&!$e(s[t],e)||e===void 0&&!(t in s))&&Pi(s,t,e)}function Vi(s){return $t(s)&&Ue(s)}function ao(s,t){if(!(t==="constructor"&&typeof s[t]=="function")&&t!="__proto__")return s[t]}function Gb(s){return kn(s,sn(s))}function Yb(s,t,e,n,i,o,r){var a=ao(s,e),l=ao(t,e),c=r.get(l);if(c){ro(s,e,c);return}var h=o?o(a,l,e+"",s,t,r):void 0,u=h===void 0;if(u){var d=St(l),g=!d&&en(l),p=!d&&!g&&Ni(l);h=l,d||g||p?St(a)?h=a:Vi(a)?h=Kr(a):g?(u=!1,h=Qa(l,!0)):p?(u=!1,h=qa(l,!0)):h=[]:Zt(l)||tn(l)?(h=a,tn(a)?h=Gb(a):(!ht(a)||Ls(a))&&(h=Wa(l))):u=!1}u&&(r.set(l,h),i(h,l,n,o,r),r.delete(l)),ro(s,e,h)}function Gi(s,t,e,n,i){s!==t&&hl(t,function(o,r){if(i||(i=new te),ht(o))Yb(s,t,r,e,Gi,n,i);else{var a=n?n(ao(s,r),o,r+"",s,t,i):void 0;a===void 0&&(a=o),ro(s,r,a)}},sn)}function gl(s,t,e,n,i,o){return ht(s)&&ht(t)&&(o.set(t,s),Gi(s,t,void 0,gl,o),o.delete(t)),s}var Hb=Yr(function(s,t,e,n){Gi(s,t,e,n)}),fl=Ze(function(s){return s.push(void 0,gl),Ur(Hb,void 0,s)}),qb=200;function Wb(s,t,e,n){var i=-1,o=jr,r=!0,a=s.length,l=[],c=t.length;if(!a)return l;t.length>=qb&&(o=eo,r=!1,t=new ln(t));t:for(;++i<a;){var h=s[i],u=h;if(h=h!==0?h:0,r&&u===u){for(var d=c;d--;)if(t[d]===u)continue t;l.push(h)}else o(t,u,n)||l.push(h)}return l}var Xb=Ze(function(s,t){return Vi(s)?Wb(s,Fi(t,1,Vi,!0)):[]});function _b(s,t){var e=-1,n=Ue(s)?Array(s.length):[];return ul(s,function(i,o,r){n[++e]=t(i,o,r)}),n}var $b=Object.prototype,Zb=$b.hasOwnProperty,pl=zb(function(s,t,e){Zb.call(s,e)?s[e].push(t):Pi(s,e,[t])});function ty(s,t){return s>t}var ey=Object.prototype,ny=ey.hasOwnProperty;function iy(s,t){return s!=null&&ny.call(s,t)}function Yi(s,t){return s!=null&&ll(s,t,iy)}var sy="[object Map]",oy="[object Set]",ry=Object.prototype,ay=ry.hasOwnProperty;function lo(s){if(s==null)return!0;if(Ue(s)&&(St(s)||typeof s=="string"||typeof s.splice=="function"||en(s)||Ni(s)||tn(s)))return!s.length;var t=jt(s);if(t==sy||t==oy)return!s.size;if(ki(s))return!na(s).length;for(var e in s)if(ay.call(s,e))return!1;return!0}function me(s,t){return Ji(s,t)}var ly="[object Number]";function be(s){return typeof s=="number"||$t(s)&&Se(s)==ly}var cy=da("toLowerCase");function hy(s,t,e){for(var n=-1,i=s.length;++n<i;){var o=s[n],r=t(o);if(r!=null&&(a===void 0?r===r&&!re(r):e(r,a)))var a=r,l=o}return l}function uy(s){return s&&s.length?hy(s,_e,ty):void 0}var ct=Yr(function(s,t,e){Gi(s,t,e)});function dy(s,t,e,n){if(!ht(s))return s;t=Qi(t,s);for(var i=-1,o=t.length,r=o-1,a=s;a!=null&&++i<o;){var l=Qn(t[i]),c=e;if(l==="__proto__"||l==="constructor"||l==="prototype")return s;if(i!=r){var h=a[l];c=void 0,c===void 0&&(c=ht(h)?h:Ii(t[i+1])?[]:{})}Us(a,l,c),a=a[l]}return s}function gy(s,t,e){for(var n=-1,i=t.length,o={};++n<i;){var r=t[n],a=Li(s,r);e(a,r)&&dy(o,Qi(r,s),a)}return o}function fy(s,t){var e=s.length;for(s.sort(t);e--;)s[e]=s[e].value;return s}function py(s,t){if(s!==t){var e=s!==void 0,n=s===null,i=s===s,o=re(s),r=t!==void 0,a=t===null,l=t===t,c=re(t);if(!a&&!c&&!o&&s>t||o&&r&&l&&!a&&!c||n&&r&&l||!e&&l||!i)return 1;if(!n&&!o&&!c&&s<t||c&&e&&i&&!n&&!o||a&&e&&i||!r&&i||!l)return-1}return 0}function my(s,t,e){for(var n=-1,i=s.criteria,o=t.criteria,r=i.length,a=e.length;++n<r;){var l=py(i[n],o[n]);if(l){if(n>=a)return l;var c=e[n];return l*(c=="desc"?-1:1)}}return s.index-t.index}function by(s,t,e){t.length?t=Mi(t,function(o){return St(o)?function(r){return Li(r,o.length===1?o[0]:o)}:o}):t=[_e];var n=-1;t=Mi(t,Oi(so));var i=_b(s,function(o,r,a){var l=Mi(t,function(c){return c(o)});return{criteria:l,index:++n,value:o}});return fy(i,function(o,r){return my(o,r,e)})}function yy(s,t){return gy(s,t,function(e,n){return cl(s,n)})}var ml=_f(function(s,t){return s==null?{}:yy(s,t)}),co=Ze(function(s,t){if(s==null)return[];var e=t.length;return e>1&&Ti(s,t[0],t[1])?t=[]:e>2&&Ti(t[0],t[1],t[2])&&(t=[t[0]]),by(s,Fi(t),[])}),Cy=4294967295,Ay=Cy-1,wy=Math.floor,xy=Math.min;function bl(s,t,e,n){var i=0,o=s==null?0:s.length;if(o===0)return 0;t=e(t);for(var r=t!==t,a=t===null,l=re(t),c=t===void 0;i<o;){var h=wy((i+o)/2),u=e(s[h]),d=u!==void 0,g=u===null,p=u===u,m=re(u);if(r)var b=p;else c?b=p&&d:a?b=p&&d&&!g:l?b=p&&d&&!g&&!m:g||m?b=!1:b=u<t;b?i=h+1:o=h}return xy(o,Ay)}var vy=4294967295,Ey=vy>>>1;function Sy(s,t,e){var n=0,i=s==null?n:s.length;if(typeof t=="number"&&t===t&&i<=Ey){for(;n<i;){var o=n+i>>>1,r=s[o];r!==null&&!re(r)&&r<t?n=o+1:i=o}return i}return bl(s,t,_e)}function My(s,t){return Sy(s,t)}function By(s,t,e){return bl(s,t,so(e))}var Iy=Ta(function(s,t,e){return s+(e?" ":"")+zi(t)}),Py="Expected a function";function Ty(s,t,e){var n=!0,i=!0;if(typeof s!="function")throw new TypeError(Py);return ht(e)&&(n="leading"in e?!0:n,i="trailing"in e?!!e.trailing:i),ji(s,t,{leading:n,maxWait:t,trailing:i})}var ky=1/0,Oy=an&&1/no(new an([,-0]))[1]==ky?function(s){return new an(s)}:cg,Ny=200;function yl(s,t,e){var n=-1,i=jr,o=s.length,r=!0,a=[],l=a;if(o>=Ny){var c=Oy(s);if(c)return no(c);r=!1,i=eo,l=new ln}else l=a;t:for(;++n<o;){var h=s[n],u=h;if(h=h!==0?h:0,r&&u===u){for(var d=l.length;d--;)if(l[d]===u)continue t;a.push(h)}else i(l,u,e)||(l!==a&&l.push(u),a.push(h))}return a}var Cl=Ze(function(s){return yl(Fi(s,1,Vi,!0))});function Al(s){return s&&s.length?yl(s):[]}var Ry=0;function Dy(s){var t=++Ry;return on(s)+t}function ye(s){return typeof s=="string"&&s.slice(-1)==="%"}function zt(s,t){if(s==null)return 0;let e;if(typeof s=="string"){if(e=parseFloat(s),ye(s)&&(e/=100,Number.isFinite(e)))return e*t}else e=s;return Number.isFinite(e)?e>0&&e<1?e*t:e:0}function ee(s){if(typeof s=="object"){let e=0,n=0,i=0,o=0;return s.vertical!=null&&Number.isFinite(s.vertical)&&(n=o=s.vertical),s.horizontal!=null&&Number.isFinite(s.horizontal)&&(i=e=s.horizontal),s.left!=null&&Number.isFinite(s.left)&&(e=s.left),s.top!=null&&Number.isFinite(s.top)&&(n=s.top),s.right!=null&&Number.isFinite(s.right)&&(i=s.right),s.bottom!=null&&Number.isFinite(s.bottom)&&(o=s.bottom),{top:n,right:i,bottom:o,left:e}}let t=0;return s!=null&&Number.isFinite(s)&&(t=s),{top:t,right:t,bottom:t,left:t}}let wl=!1,xl=!1,vl=!1,Qy=!1,El=!1;if(typeof navigator=="object"){const s=navigator.userAgent;s.indexOf("Macintosh")>=0,s.match(/(iPad|iPhone|iPod)/g),s.indexOf("Windows")>=0,wl=s.indexOf("MSIE")>=0,s.match(/Trident\/7\./),xl=!!s.match(/Edge\//),s.indexOf("Mozilla/")>=0&&s.indexOf("MSIE")<0&&s.indexOf("Edge/")<0,s.indexOf("Chrome/")>=0&&s.indexOf("Edge/")<0,s.indexOf("Opera/")>=0||s.indexOf("OPR/")>=0,s.indexOf("Firefox/")>=0,vl=s.indexOf("AppleWebKit/")>=0&&s.indexOf("Chrome/")<0&&s.indexOf("Edge/")<0,typeof document=="object"&&(El=!document.createElementNS||`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`!="[object SVGForeignObjectElement]"||s.indexOf("Opera/")>=0)}if(typeof window=="object"&&window.chrome!=null&&window.chrome.app!=null&&window.chrome.app.runtime!=null,typeof document=="object")try{const s=Object.defineProperty({},"passive",{get(){Qy=!0}}),t=document.createElement("div");t.addEventListener&&t.addEventListener("click",()=>{},s)}catch{}const Sl=wl,Ml=xl,Ly=vl,Fy=!El;function zy(){const s=window.module;return s!=null&&s.hot!=null&&s.hot.status!=null?s.hot.status():"unkonwn"}function Bl(){return zy()==="apply"}const Uy={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};function Ky(s){const t=document.createElement(Uy[s]||"div"),e=`on${s}`;let n=e in t;return n||(t.setAttribute(e,"return;"),n=typeof t[e]=="function"),n}const zn=[];function Me(s,t){const e=zn.find(n=>n.name===s);if(!(e&&(e.loadTimes+=1,e.loadTimes>1))&&!Bl()){const n=document.createElement("style");n.setAttribute("type","text/css"),n.textContent=t;const i=document.querySelector("head");i&&i.insertBefore(n,i.firstChild),zn.push({name:s,loadTimes:1,styleElement:n})}}function Be(s){const t=zn.findIndex(e=>e.name===s);if(t>-1){const e=zn[t];if(e.loadTimes-=1,e.loadTimes>0)return;let n=e.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,zn.splice(t,1)}}function Jy(s){const t=s.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return t&&t[2]?t[2].replace(/\s+/," ").split(" "):null}function Il(s){const t=parseFloat(s);return Number.isNaN(t)?null:t}function jy(s){const t="data:";return s.substr(0,t.length)===t}function Vy(s,t){if(!s||jy(s)){setTimeout(()=>t(null,s));return}const e=()=>{t(new Error(`Failed to load image: ${s}`))},n=window.FileReader?o=>{if(o.status===200){const r=new FileReader;r.onload=a=>{const l=a.target.result;t(null,l)},r.onerror=e,r.readAsDataURL(o.response)}else e()}:o=>{const r=a=>{const c=[];for(let h=0;h<a.length;h+=32768)c.push(String.fromCharCode.apply(null,a.subarray(h,h+32768)));return c.join("")};if(o.status===200){let a=s.split(".").pop()||"png";a==="svg"&&(a="svg+xml");const l=`data:image/${a};base64,`,c=new Uint8Array(o.response),h=l+btoa(r(c));t(null,h)}else e()},i=new XMLHttpRequest;i.responseType=window.FileReader?"blob":"arraybuffer",i.open("GET",s,!0),i.addEventListener("error",e),i.addEventListener("load",()=>n(i)),i.send()}function Gy(s){let t=s.replace(/\s/g,"");t=decodeURIComponent(t);const e=t.indexOf(","),n=t.slice(0,e),i=n.split(":")[1].split(";")[0],o=t.slice(e+1);let r;n.indexOf("base64")>=0?r=atob(o):r=unescape(encodeURIComponent(o));const a=new Uint8Array(r.length);for(let l=0;l<r.length;l+=1)a[l]=r.charCodeAt(l);return new Blob([a],{type:i})}function Yy(s,t){const e=window.navigator.msSaveBlob;if(e)e(s,t);else{const n=window.URL.createObjectURL(s),i=document.createElement("a");i.href=n,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n)}}function ho(s,t){const e=Gy(s);Yy(e,t)}function Hy(s,t={}){let e=null;const n=h=>(e==null&&(e=Jy(s)),e!=null?Il(e[h]):null),i=h=>{const u=s.match(h);return u&&u[2]?Il(u[2]):null};let o=t.width;if(o==null&&(o=i(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),o==null&&(o=n(2)),o==null)throw new Error("Can not parse width from svg string");let r=t.height;if(r==null&&(r=i(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),r==null&&(r=n(3)),r==null)throw new Error("Can not parse height from svg string");return`data:image/svg+xml,${encodeURIComponent(s).replace(/'/g,"%27").replace(/"/g,"%22")}`}function qy(s){return typeof s=="object"&&s.then&&typeof s.then=="function"}function uo(s){return s!=null&&(s instanceof Promise||qy(s))}function go(...s){const t=[];if(s.forEach(n=>{Array.isArray(n)?t.push(...n):t.push(n)}),t.some(n=>uo(n))){const n=t.map(i=>uo(i)?i:Promise.resolve(i!==!1));return Promise.all(n).then(i=>i.reduce((o,r)=>r!==!1&&o,!0))}return t.every(n=>n!==!1)}function Wy(...s){const t=go(s);return typeof t=="boolean"?Promise.resolve(t):t}function Pl(s,t,e){if(e)switch(e.length){case 0:return s.call(t);case 1:return s.call(t,e[0]);case 2:return s.call(t,e[0],e[1]);case 3:return s.call(t,e[0],e[1],e[2]);case 4:return s.call(t,e[0],e[1],e[2],e[3]);case 5:return s.call(t,e[0],e[1],e[2],e[3],e[4]);case 6:return s.call(t,e[0],e[1],e[2],e[3],e[4],e[5]);default:return s.apply(t,e)}return s.call(t)}function D(s,t,...e){return Pl(s,t,e)}function Tl(s){return 180*s/Math.PI%360}const It=function(s,t=!1){return(t?s:s%360)*Math.PI/180};function Tt(s){return s%360+(s<0?360:0)}function je(s,t=0){return Number.isInteger(s)?s:+s.toFixed(t)}function kl(s,t){let e,n;if(t==null?(n=s??1,e=0):(n=t,e=s??0),n<e){const i=e;e=n,n=i}return Math.floor(Math.random()*(n-e+1)+e)}function cn(s,t,e){return Number.isNaN(s)?NaN:Number.isNaN(t)||Number.isNaN(e)?0:s<t?t:s>e?e:s}function ne(s,t){return t*Math.round(s/t)}function Ol(s,t){return t!=null&&s!=null&&t.x>=s.x&&t.x<=s.x+s.width&&t.y>=s.y&&t.y<=s.y+s.height}function Nl(s,t){const e=s.x-t.x,n=s.y-t.y;return e*e+n*n}class Ie{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class A extends Ie{static create(t,e){return t==null||typeof t=="number"?new A(t,e):A.clone(t)}static clone(t){return A.isPoint(t)?new A(t.x,t.y):Array.isArray(t)?new A(t[0],t[1]):new A(t.x,t.y)}static equals(t,e){return t===e?!0:t!=null&&e!=null?t.x===e.x&&t.y===e.y:!1}static rotateEx(t,e,n,i=new A){const o=A.clone(t),r=A.clone(i),a=o.x-r.x,l=o.y-r.y,c=a*e-l*n,h=l*e+a*n;return new A(c+r.x,h+r.y)}static toJSON(t){return A.isPoint(t)?{x:t.x,y:t.y}:Array.isArray(t)?{x:t[0],y:t[1]}:{x:t.x,y:t.y}}static fromPolar(t,e,n=new A){let i=Math.abs(t*Math.cos(e)),o=Math.abs(t*Math.sin(e));const r=A.clone(n),a=Tt(Tl(e));return a<90?o=-o:a<180?(i=-i,o=-o):a<270&&(i=-i),new A(r.x+i,r.y+o)}static toPolar(t,e=new A){const n=A.clone(t),i=A.clone(e),o=n.x-i.x,r=n.y-i.y;return new A(Math.sqrt(o*o+r*r),It(i.theta(n)))}static equalPoints(t,e){if(t==null&&e!=null||t!=null&&e==null||t!=null&&e!=null&&t.length!==e.length)return!1;if(t!=null&&e!=null){for(let n=0,i=t.length;n<i;n+=1)if(!A.equals(t[n],e[n]))return!1}return!0}static random(t,e,n,i){return new A(kl(t,e),kl(n,i))}static rotate(t,e,n){const i=It(Tt(-e)),o=Math.sin(i),r=Math.cos(i);return A.rotateEx(t,r,o,n)}static isPoint(t){return t!=null&&t instanceof A}static isPointLike(t){return t!=null&&typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"}static isPointData(t){return t!=null&&Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}constructor(t,e){super(),this.x=t??0,this.y=e??0}round(t=0){return this.x=je(this.x,t),this.y=je(this.y,t),this}add(t,e){const n=A.create(t,e);return this.x+=n.x,this.y+=n.y,this}update(t,e){const n=A.create(t,e);return this.x=n.x,this.y=n.y,this}translate(t,e){const n=A.create(t,e);return this.x+=n.x,this.y+=n.y,this}rotate(t,e){const n=A.rotate(this,t,e);return this.x=n.x,this.y=n.y,this}scale(t,e,n=new A){const i=A.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(t.length===1)return A.create(t[0]);let e=null,n=1/0;return t.forEach(i=>{const o=this.squaredDistance(i);o<n&&(e=i,n=o)}),e?A.create(e):null}distance(t){return Math.sqrt(this.squaredDistance(t))}squaredDistance(t){const e=A.create(t),n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistance(t){const e=A.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 A){const e=A.create(t),n=-(e.y-this.y),i=e.x-this.x;let o=Math.atan2(n,i);return o<0&&(o=2*Math.PI+o),180*o/Math.PI}angleBetween(t,e){if(this.equals(t)||this.equals(e))return NaN;let n=this.theta(e)-this.theta(t);return n<0&&(n+=360),n}vectorAngle(t){return new A(0,0).angleBetween(this,t)}toPolar(t){return this.update(A.toPolar(this,t)),this}changeInAngle(t,e,n=new A){return this.clone().translate(-t,-e).theta(n)-this.theta(n)}adhereToRect(t){return Ol(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=A.create(t),n=It(this.y),i=It(e.y),o=this.x,r=e.x,a=It(r-o),l=Math.sin(a)*Math.cos(i),c=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(a),h=Tl(Math.atan2(l,c)),u=["NE","E","SE","S","SW","W","NW","N"];let d=h-22.5;return d<0&&(d+=360),d=parseInt(d/45,10),u[d]}cross(t,e){if(t!=null&&e!=null){const n=A.create(t),i=A.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=A.create(t);return this.x*e.x+this.y*e.y}diff(t,e){if(typeof t=="number")return new A(this.x-t,this.y-e);const n=A.create(t);return new A(this.x-n.x,this.y-n.y)}lerp(t,e){const n=A.create(t);return new A((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=A.create(t),i=It(n.theta(this));return this.translate(Math.cos(i)*e,-Math.sin(i)*e)}reflection(t){return A.create(t).move(this,this.distance(t))}snapToGrid(t,e){return this.x=ne(this.x,t),this.y=ne(this.y,e??t),this}equals(t){const e=A.create(t);return e!=null&&e.x===this.x&&e.y===this.y}clone(){return A.clone(this)}toJSON(){return A.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}class P extends Ie{static isRectangle(t){return t!=null&&t instanceof P}static isRectangleLike(t){return t!=null&&typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.width=="number"&&typeof t.height=="number"}static create(t,e,n,i){return t==null||typeof t=="number"?new P(t,e,n,i):P.clone(t)}static clone(t){return P.isRectangle(t)?t.clone():Array.isArray(t)?new P(t[0],t[1],t[2],t[3]):new P(t.x,t.y,t.width,t.height)}static fromEllipse(t){return new P(t.x-t.a,t.y-t.b,2*t.a,2*t.b)}static fromSize(t){return new P(0,0,t.width,t.height)}static fromPositionAndSize(t,e){return new P(t.x,t.y,e.width,e.height)}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 A(this.x,this.y)}get topLeft(){return new A(this.x,this.y)}get topCenter(){return new A(this.x+this.width/2,this.y)}get topRight(){return new A(this.x+this.width,this.y)}get center(){return new A(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new A(this.x,this.y+this.height)}get bottomCenter(){return new A(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new A(this.x+this.width,this.y+this.height)}get corner(){return new A(this.x+this.width,this.y+this.height)}get rightMiddle(){return new A(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new A(this.x,this.y+this.height/2)}get topLine(){return new N(this.topLeft,this.topRight)}get rightLine(){return new N(this.topRight,this.bottomRight)}get bottomLine(){return new N(this.bottomLeft,this.bottomRight)}get leftLine(){return new N(this.topLeft,this.bottomLeft)}constructor(t,e,n,i){super(),this.x=t??0,this.y=e??0,this.width=n??0,this.height=i??0}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=It(t),n=Math.abs(Math.sin(e)),i=Math.abs(Math.cos(e)),o=this.width*i+this.height*n,r=this.width*n+this.height*i;return new P(this.x+(this.width-o)/2,this.y+(this.height-r)/2,o,r)}round(t=0){return this.x=je(this.x,t),this.y=je(this.y,t),this.width=je(this.width,t),this.height=je(this.height,t),this}add(t,e,n,i){const o=P.create(t,e,n,i),r=Math.min(this.x,o.x),a=Math.min(this.y,o.y),l=Math.max(this.x+this.width,o.x+o.width),c=Math.max(this.y+this.height,o.y+o.height);return this.x=r,this.y=a,this.width=l-r,this.height=c-a,this}update(t,e,n,i){const o=P.create(t,e,n,i);return this.x=o.x,this.y=o.y,this.width=o.width,this.height=o.height,this}inflate(t,e){const n=t,i=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=A.create(t,e);return this.x+=n.x,this.y+=n.y,this}scale(t,e,n=new A){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(t!==0){const n=It(t),i=Math.cos(n),o=Math.sin(n);let r=this.getOrigin(),a=this.getTopRight(),l=this.getBottomRight(),c=this.getBottomLeft();r=A.rotateEx(r,i,o,e),a=A.rotateEx(a,i,o,e),l=A.rotateEx(l,i,o,e),c=A.rotateEx(c,i,o,e);const h=new P(r.x,r.y,0,0);h.add(a.x,a.y,0,0),h.add(l.x,l.y,0,0),h.add(c.x,c.y,0,0),this.update(h)}return this}rotate90(){const t=(this.width-this.height)/2;this.x+=t,this.y-=t;const e=this.width;return this.width=this.height,this.height=e,this}moveAndExpand(t){const e=P.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=P.clone(t),i=e.x,o=e.y;let r=1/0,a=1/0,l=1/0,c=1/0,h=1/0,u=1/0,d=1/0,g=1/0;const p=n.topLeft;p.x<i&&(r=(this.x-i)/(p.x-i)),p.y<o&&(h=(this.y-o)/(p.y-o));const m=n.bottomRight;m.x>i&&(a=(this.x+this.width-i)/(m.x-i)),m.y>o&&(u=(this.y+this.height-o)/(m.y-o));const b=n.topRight;b.x>i&&(l=(this.x+this.width-i)/(b.x-i)),b.y<o&&(d=(this.y-o)/(b.y-o));const y=n.bottomLeft;return y.x<i&&(c=(this.x-i)/(y.x-i)),y.y>o&&(g=(this.y+this.height-o)/(y.y-o)),{sx:Math.min(r,a,l,c),sy:Math.min(h,u,d,g)}}getMaxUniformScaleToFit(t,e=this.center){const n=this.getMaxScaleToFit(t,e);return Math.min(n.sx,n.sy)}containsPoint(t,e){return Ol(this,A.create(t,e))}containsRect(t,e,n,i){const o=P.create(t,e,n,i),r=this.x,a=this.y,l=this.width,c=this.height,h=o.x,u=o.y,d=o.width,g=o.height;return l===0||c===0||d===0||g===0?!1:h>=r&&u>=a&&h+d<=r+l&&u+g<=a+c}intersectsWithLine(t){const e=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],i=[];return e.forEach(o=>{const r=t.intersectsWithLine(o);r!==null&&i.indexOf(r.toString())<0&&(n.push(r),i.push(r.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(t,e){const n=A.clone(t),i=this.center;let o=null;e!=null&&e!==0&&n.rotate(e,i);const r=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],a=new N(i,n);for(let l=r.length-1;l>=0;l-=1){const c=r[l].intersectsWithLine(a);if(c!==null){o=c;break}}return o&&e!=null&&e!==0&&o.rotate(-e,i),o}intersectsWithRect(t,e,n,i){const o=P.create(t,e,n,i);if(!this.isIntersectWithRect(o))return null;const r=this.origin,a=this.corner,l=o.origin,c=o.corner,h=Math.max(r.x,l.x),u=Math.max(r.y,l.y);return new P(h,u,Math.min(a.x,c.x)-h,Math.min(a.y,c.y)-u)}isIntersectWithRect(t,e,n,i){const o=P.create(t,e,n,i),r=this.origin,a=this.corner,l=o.origin,c=o.corner;return!(c.x<=r.x||c.y<=r.y||l.x>=a.x||l.y>=a.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=P.clone(t),n=this.origin,i=this.corner,o=e.origin,r=e.corner,a=Math.min(n.x,o.x),l=Math.min(n.y,o.y),c=Math.max(i.x,r.x),h=Math.max(i.y,r.y);return new P(a,l,c-a,h-l)}getNearestSideToPoint(t){const e=A.clone(t),n=e.x-this.x,i=this.x+this.width-e.x,o=e.y-this.y,r=this.y+this.height-e.y;let a=n,l="left";return i<a&&(a=i,l="right"),o<a&&(a=o,l="top"),r<a&&(l="bottom"),l}getNearestPointToPoint(t){const e=A.clone(t);if(this.containsPoint(e)){const n=this.getNearestSideToPoint(e);if(n==="left")return new A(this.x,e.y);if(n==="top")return new A(e.x,this.y);if(n==="right")return new A(this.x+this.width,e.y);if(n==="bottom")return new A(e.x,this.y+this.height)}return e.adhereToRect(this)}equals(t){return t!=null&&t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height}clone(){return new P(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}`}}class N extends Ie{static isLine(t){return t!=null&&t instanceof N}get center(){return new A((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(t,e,n,i){super(),typeof t=="number"&&typeof e=="number"?(this.start=new A(t,e),this.end=new A(n,i)):(this.start=A.create(t),this.end=A.create(e))}getCenter(){return this.center}round(t=0){return this.start.round(t),this.end.round(t),this}translate(t,e){return typeof t=="number"?(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,o=n.clone().rotate(270,i),r=i.clone().rotate(90,n);return n.move(r,t),i.move(o,t),e}vector(){return new A(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const t=new A(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 P(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 N(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 o=this.length();if(t>=o)return i?n.clone():e.clone();const r=(i?t:o-t)/o;return this.pointAt(r)}divideAt(t){const e=this.pointAt(t);return[new N(this.start,e),new N(e,this.end)]}divideAtLength(t){const e=this.pointAtLength(t);return[new N(this.start,e),new N(e,this.end)]}containsPoint(t){const e=this.start,n=this.end;if(e.cross(t,n)!==0)return!1;const i=this.length();return!(new N(e,t).length()>i||new N(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 A(this.end.x-this.start.x,this.end.y-this.start.y),n=new A(t.end.x-t.start.x,t.end.y-t.start.y),i=e.x*n.y-e.y*n.x,o=new A(t.start.x-this.start.x,t.start.y-this.start.y),r=o.x*n.y-o.y*n.x,a=o.x*e.y-o.y*e.x;if(i===0||r*i<0||a*i<0)return null;if(i>0){if(r>i||a>i)return null}else if(r<i||a<i)return null;return new A(this.start.x+r*e.x/i,this.start.y+r*e.y/i)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(t){const e=A.clone(t),n=this.start,i=this.end;return((i.x-n.x)*(e.y-n.y)-(i.y-n.y)*(e.x-n.x))/this.length()}pointSquaredDistance(t,e){const n=A.create(t,e);return this.closestPoint(n).squaredDistance(n)}pointDistance(t,e){const n=A.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),o=new N(e,n);return o.translate(i.x-e.x,i.y-e.y),o}tangentAtLength(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAtLength(t),o=new N(e,n);return o.translate(i.x-e.x,i.y-e.y),o}relativeCcw(t,e){const n=A.create(t,e);let i=n.x-this.start.x,o=n.y-this.start.y;const r=this.end.x-this.start.x,a=this.end.y-this.start.y;let l=i*a-o*r;return l===0&&(l=i*r+o*a,l>0&&(i-=r,o-=a,l=i*r+o*a,l<0&&(l=0))),l<0?-1:l>0?1:0}equals(t){return t!=null&&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 N(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}class Lt extends Ie{static isEllipse(t){return t!=null&&t instanceof Lt}static create(t,e,n,i){return t==null||typeof t=="number"?new Lt(t,e,n,i):Lt.parse(t)}static parse(t){return Lt.isEllipse(t)?t.clone():Array.isArray(t)?new Lt(t[0],t[1],t[2],t[3]):new Lt(t.x,t.y,t.a,t.b)}static fromRect(t){const e=t.center;return new Lt(e.x,e.y,t.width/2,t.height/2)}get center(){return new A(this.x,this.y)}constructor(t,e,n,i){super(),this.x=t??0,this.y=e??0,this.a=n??0,this.b=i??0}bbox(){return P.fromEllipse(this)}getCenter(){return this.center}inflate(t,e){const n=t,i=e??t;return this.a+=2*n,this.b+=2*i,this}normalizedDistance(t,e){const n=A.create(t,e),i=n.x-this.x,o=n.y-this.y,r=this.a,a=this.b;return i*i/(r*r)+o*o/(a*a)}containsPoint(t,e){return this.normalizedDistance(t,e)<=1}intersectsWithLine(t){const e=[],n=this.a,i=this.b,o=t.start,r=t.end,a=t.vector(),l=o.diff(new A(this.x,this.y)),c=new A(a.x/(n*n),a.y/(i*i)),h=new A(l.x/(n*n),l.y/(i*i)),u=a.dot(c),d=a.dot(h),g=l.dot(h)-1,p=d*d-u*g;if(p<0)return null;if(p>0){const m=Math.sqrt(p),b=(-d-m)/u,y=(-d+m)/u;if((b<0||b>1)&&(y<0||y>1))return null;b>=0&&b<=1&&e.push(o.lerp(r,b)),y>=0&&y<=1&&e.push(o.lerp(r,y))}else{const m=-d/u;if(m>=0&&m<=1)e.push(o.lerp(r,m));else return null}return e}intersectsWithLineFromCenterToPoint(t,e=0){const n=A.clone(t);e&&n.rotate(e,this.getCenter());const i=n.x-this.x,o=n.y-this.y;let r;if(i===0)return r=this.bbox().getNearestPointToPoint(n),e?r.rotate(-e,this.getCenter()):r;const a=o/i,l=a*a,c=this.a*this.a,h=this.b*this.b;let u=Math.sqrt(1/(1/c+l/h));u=i<0?-u:u;const d=a*u;return r=new A(this.x+u,this.y+d),e?r.rotate(-e,this.getCenter()):r}tangentTheta(t){const e=A.clone(t),n=e.x,i=e.y,o=this.a,r=this.b,a=this.bbox().center,l=a.x,c=a.y,h=30,u=n>a.x+o/2,d=n<a.x-o/2;let g,p;return u||d?(p=n>a.x?i-h:i+h,g=o*o/(n-l)-o*o*(i-c)*(p-c)/(r*r*(n-l))+l):(g=i>a.y?n+h:n-h,p=r*r/(i-c)-r*r*(n-l)*(g-l)/(o*o*(i-c))+c),new A(g,p).theta(e)}scale(t,e){return this.a*=t,this.b*=e,this}rotate(t,e){const n=P.fromEllipse(this);n.rotate(t,e);const i=Lt.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=A.create(t,e);return this.x+=n.x,this.y+=n.y,this}equals(t){return t!=null&&t.x===this.x&&t.y===this.y&&t.a===this.a&&t.b===this.b}clone(){return new Lt(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}`}}const Xy=new RegExp("^[\\s\\dLMCZz,.]*$");function _y(s){return typeof s!="string"?!1:Xy.test(s)}function fo(s,t){return(s%t+t)%t}function $y(s,t,e,n,i){if(!s||s.length===0)return"";const o=[],r=s[s.length-1],a=t!=null&&t>0,l=t||0;if(n&&a){s=s.slice();const u=s[0],d=new A(r.x+(u.x-r.x)/2,r.y+(u.y-r.y)/2);s.splice(0,0,d)}let c=s[0],h=1;for(e?o.push("M",c.x,c.y):o.push("L",c.x,c.y);h<(n?s.length:s.length-1);){let u=s[fo(h,s.length)],d=c.x-u.x,g=c.y-u.y;if(a&&(d!==0||g!==0)&&(i==null||i.indexOf(h-1)<0)){let p=Math.sqrt(d*d+g*g);const m=d*Math.min(l,p/2)/p,b=g*Math.min(l,p/2)/p,y=u.x+m,C=u.y+b;o.push("L",y,C);let w=s[fo(h+1,s.length)];for(;h<s.length-2&&Math.round(w.x-u.x)===0&&Math.round(w.y-u.y)===0;)w=s[fo(h+2,s.length)],h+=1;d=w.x-u.x,g=w.y-u.y,p=Math.max(1,Math.sqrt(d*d+g*g));const x=d*Math.min(l,p/2)/p,E=g*Math.min(l,p/2)/p,B=u.x+x,v=u.y+E;o.push("Q",u.x,u.y,B,v),u=new A(B,v)}else o.push("L",u.x,u.y);c=u,h+=1}return n?o.push("Z"):o.push("L",r.x,r.y),o.map(u=>typeof u=="string"?u:+u.toFixed(3)).join(" ")}function Zy(s,t={}){const e=[];return s&&s.length&&s.forEach(n=>{Array.isArray(n)?e.push({x:n[0],y:n[1]}):e.push({x:n.x,y:n.y})}),$y(e,t.round,t.initialMove==null||t.initialMove,t.close,t.exclude)}function Rl(s,t,e,n,i=0,o=0,r=0,a,l){if(e===0||n===0)return[];a-=s,l-=t,e=Math.abs(e),n=Math.abs(n);const c=-a/2,h=-l/2,u=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180),g=u*c+d*h,p=-1*d*c+u*h,m=g*g,b=p*p,y=e*e,C=n*n,w=m/y+b/C;let x;if(w>1)e=Math.sqrt(w)*e,n=Math.sqrt(w)*n,x=0;else{let W=1;o===r&&(W=-1),x=W*Math.sqrt((y*C-y*b-C*m)/(y*b+C*m))}const E=x*e*p/n,B=-1*x*n*g/e,v=u*E-d*B+a/2,M=d*E+u*B+l/2;let I=Math.atan2((p-B)/n,(g-E)/e)-Math.atan2(0,1),T=I>=0?I:2*Math.PI+I;I=Math.atan2((-p-B)/n,(-g-E)/e)-Math.atan2((p-B)/n,(g-E)/e);let k=I>=0?I:2*Math.PI+I;r===0&&k>0?k-=2*Math.PI:r!==0&&k<0&&(k+=2*Math.PI);const R=k*2/Math.PI,z=Math.ceil(R<0?-1*R:R),J=k/z,Z=8/3*Math.sin(J/4)*Math.sin(J/4)/Math.sin(J/2),Y=u*e,Et=u*n,Rt=d*e,Dt=d*n;let pt=Math.cos(T),Q=Math.sin(T),X=-Z*(Y*Q+Dt*pt),tt=-Z*(Rt*Q-Et*pt),j=0,et=0;const mt=[];for(let W=0;W<z;W+=1){T+=J,pt=Math.cos(T),Q=Math.sin(T),j=Y*pt-Dt*Q+v,et=Rt*pt+Et*Q+M;const bt=-Z*(Y*Q+Dt*pt),Ee=-Z*(Rt*Q-Et*pt),Qt=W*6;mt[Qt]=Number(X+s),mt[Qt+1]=Number(tt+t),mt[Qt+2]=Number(j-bt+s),mt[Qt+3]=Number(et-Ee+t),mt[Qt+4]=Number(j+s),mt[Qt+5]=Number(et+t),X=j+bt,tt=et+Ee}return mt.map(W=>+W.toFixed(2))}class yt extends Ie{static isPolyline(t){return t!=null&&t instanceof yt}static parse(t){const e=t.trim();if(e==="")return new yt;const n=[],i=e.split(/\s*,\s*|\s+/);for(let o=0,r=i.length;o<r;o+=2)n.push({x:+i[o],y:+i[o+1]});return new yt(n)}get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(t){if(super(),t!=null){if(typeof t=="string")return yt.parse(t);this.points=t.map(e=>A.create(e))}else this.points=[]}scale(t,e,n=new A){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=A.create(t,e);return this.points.forEach(i=>i.translate(n.x,n.y)),this}round(t=0){return this.points.forEach(e=>e.round(t)),this}bbox(){if(this.points.length===0)return new P;let t=1/0,e=-1/0,n=1/0,i=-1/0;const o=this.points;for(let r=0,a=o.length;r<a;r+=1){const l=o[r],c=l.x,h=l.y;c<t&&(t=c),c>e&&(e=c),h<n&&(n=h),h>i&&(i=h)}return new P(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(n===0||n===1)return 0;let i=0,o=0,r=1/0;for(let a=0,l=n-1;a<l;a+=1){const c=new N(e[a],e[a+1]),h=c.length(),u=c.closestPointNormalizedLength(t),g=c.pointAt(u).squaredDistance(t);g<r&&(r=g,o=i+u*h),i+=h}return o}closestPointNormalizedLength(t){const e=this.length();return e===0?0:this.closestPointLength(t)/e}closestPointTangent(t){const e=this.closestPointLength(t);return this.tangentAtLength(e)}containsPoint(t){if(this.points.length===0)return!1;const e=A.clone(t),n=e.x,i=e.y,o=this.points,r=o.length;let a=r-1,l=0;for(let c=0;c<r;c+=1){const h=o[a],u=o[c];if(e.equals(h))return!0;const d=new N(h,u);if(d.containsPoint(t))return!0;if(i<=h.y&&i>u.y||i>h.y&&i<=u.y){const g=h.x-n>u.x-n?h.x-n:u.x-n;if(g>=0){const p=new A(n+g,i),m=new N(t,p);d.intersectsWithLine(m)&&(l+=1)}}a=c}return l%2===1}intersectsWithLine(t){const e=[];for(let n=0,i=this.points.length-1;n<i;n+=1){const o=this.points[n],r=this.points[n+1],a=t.intersectsWithLine(new N(o,r));a&&e.push(a)}return e.length>0?e:null}isDifferentiable(){for(let t=0,e=this.points.length-1;t<e;t+=1){const n=this.points[t],i=this.points[t+1];if(new N(n,i).isDifferentiable())return!0}return!1}length(){let t=0;for(let e=0,n=this.points.length-1;e<n;e+=1){const i=this.points[e],o=this.points[e+1];t+=i.distance(o)}return t}pointAt(t){const e=this.points,n=e.length;if(n===0)return null;if(n===1||t<=0)return e[0].clone();if(t>=1)return e[n-1].clone();const o=this.length()*t;return this.pointAtLength(o)}pointAtLength(t){const e=this.points,n=e.length;if(n===0)return null;if(n===1)return e[0].clone();let i=!0;t<0&&(i=!1,t=-t);let o=0;for(let a=0,l=n-1;a<l;a+=1){const c=i?a:l-1-a,h=e[c],u=e[c+1],d=new N(h,u),g=h.distance(u);if(t<=o+g)return d.pointAtLength((i?1:-1)*(t-o));o+=g}return(i?e[n-1]:e[0]).clone()}tangentAt(t){const n=this.points.length;if(n===0||n===1)return null;t<0&&(t=0),t>1&&(t=1);const o=this.length()*t;return this.tangentAtLength(o)}tangentAtLength(t){const e=this.points,n=e.length;if(n===0||n===1)return null;let i=!0;t<0&&(i=!1,t=-t);let o,r=0;for(let a=0,l=n-1;a<l;a+=1){const c=i?a:l-1-a,h=e[c],u=e[c+1],d=new N(h,u),g=h.distance(u);if(d.isDifferentiable()){if(t<=r+g)return d.tangentAtLength((i?1:-1)*(t-r));o=d}r+=g}if(o){const a=i?1:0;return o.tangentAt(a)}return null}simplify(t={}){const e=this.points;if(e.length<3)return this;const n=t.threshold||0;let i=0;for(;e[i+2];){const o=i,r=i+1,a=i+2,l=e[o],c=e[r],h=e[a];new N(l,h).closestPoint(c).distance(c)<=n?e.splice(r,1):i+=1}return this}toHull(){const t=this.points,e=t.length;if(e===0)return new yt;let n=t[0];for(let d=1;d<e;d+=1)(t[d].y<n.y||t[d].y===n.y&&t[d].x>n.x)&&(n=t[d]);const i=[];for(let d=0;d<e;d+=1){let g=n.theta(t[d]);g===0&&(g=360),i.push([t[d],d,g])}if(i.sort((d,g)=>{let p=d[2]-g[2];return p===0&&(p=g[1]-d[1]),p}),i.length>2){const d=i[i.length-1];i.unshift(d)}const o={},r=[],a=d=>`${d[0].toString()}@${d[1]}`;for(;i.length!==0;){const d=i.pop(),g=d[0];if(o[a(d)])continue;let p=!1;for(;!p;)if(r.length<2)r.push(d),p=!0;else{const m=r.pop(),b=m[0],y=r.pop(),C=y[0],w=C.cross(b,g);if(w<0)r.push(y),r.push(m),r.push(d),p=!0;else if(w===0){const E=b.angleBetween(C,g);Math.abs(E-180)<1e-10||b.equals(g)||C.equals(b)?(o[a(m)]=b,r.push(y)):Math.abs((E+1)%360-1)<1e-10&&(r.push(y),i.push(m))}else o[a(m)]=b,r.push(y)}}r.length>2&&r.pop();let l,c=-1;for(let d=0,g=r.length;d<g;d+=1){const p=r[d][1];(l===void 0||p<l)&&(l=p,c=d)}let h=[];if(c>0){const d=r.slice(c),g=r.slice(0,c);h=d.concat(g)}else h=r;const u=[];for(let d=0,g=h.length;d<g;d+=1)u.push(h[d][0]);return new yt(u)}equals(t){return t==null||t.points.length!==this.points.length?!1:t.points.every((e,n)=>e.equals(this.points[n]))}clone(){return new yt(this.points.map(t=>t.clone()))}toJSON(){return this.points.map(t=>t.toJSON())}serialize(){return this.points.map(t=>`${t.serialize()}`).join(" ")}}class dt extends Ie{static isCurve(t){return t!=null&&t instanceof dt}static throughPoints(t){if(t==null||Array.isArray(t)&&t.length<2)throw new Error("At least 2 points are required");const e=tC(t),n=[];for(let i=0,o=e[0].length;i<o;i+=1){const r=new A(e[0][i].x,e[0][i].y),a=new A(e[1][i].x,e[1][i].y);n.push(new dt(t[i],r,a,t[i+1]))}return n}constructor(t,e,n,i){super(),this.PRECISION=3,this.start=A.create(t),this.controlPoint1=A.create(e),this.controlPoint2=A.create(n),this.end=A.create(i)}bbox(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end,o=t.x,r=t.y,a=e.x,l=e.y,c=n.x,h=n.y,u=i.x,d=i.y,g=[],p=[[],[]];let m,b,y,C,w,x,E,B;for(let Y=0;Y<2;Y+=1){if(Y===0?(b=6*o-12*a+6*c,m=-3*o+9*a-9*c+3*u,y=3*a-3*o):(b=6*r-12*l+6*h,m=-3*r+9*l-9*h+3*d,y=3*l-3*r),Math.abs(m)<1e-12){if(Math.abs(b)<1e-12)continue;C=-y/b,C>0&&C<1&&g.push(C);continue}E=b*b-4*y*m,B=Math.sqrt(E),!(E<0)&&(w=(-b+B)/(2*m),w>0&&w<1&&g.push(w),x=(-b-B)/(2*m),x>0&&x<1&&g.push(x))}let v,M,I,T=g.length;const k=T;for(;T;)T-=1,C=g[T],I=1-C,v=I*I*I*o+3*I*I*C*a+3*I*C*C*c+C*C*C*u,p[0][T]=v,M=I*I*I*r+3*I*I*C*l+3*I*C*C*h+C*C*C*d,p[1][T]=M;g[k]=0,g[k+1]=1,p[0][k]=o,p[1][k]=r,p[0][k+1]=u,p[1][k+1]=d,g.length=k+2,p[0].length=k+2,p[1].length=k+2;const R=Math.min.apply(null,p[0]),z=Math.min.apply(null,p[1]),J=Math.max.apply(null,p[0]),Z=Math.max.apply(null,p[1]);return new P(R,z,J-R,Z-z)}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 o=this.length(n);return o===0?0:i/o}closestPointT(t,e={}){const n=this.getPrecision(e),i=this.getDivisions(e),o=Math.pow(10,-n);let r=null,a=0,l=0,c=0,h=0,u=0,d=null;const g=i.length;let p=g>0?1/g:0;for(i.forEach((m,b)=>{const y=m.start.distance(t),C=m.end.distance(t),w=y+C;(d==null||w<d)&&(r=m,a=b*p,l=(b+1)*p,c=y,h=C,d=w,u=m.endpointDistance())});;){const m=c?Math.abs(c-h)/c:0,b=h!=null?Math.abs(c-h)/h:0,y=m<o||b<o,C=c?c<u*o:!0,w=h?h<u*o:!0;if(y||(C||w))return c<=h?a:l;const E=r.divide(.5);p/=2;const B=E[0].start.distance(t),v=E[0].end.distance(t),M=B+v,I=E[1].start.distance(t),T=E[1].end.distance(t),k=I+T;M<=k?(r=E[0],l-=p,c=B,h=v):(r=E[1],a+=p,c=I,h=T)}}closestPointTangent(t,e={}){return this.tangentAtT(this.closestPointT(t,e))}containsPoint(t,e={}){return this.toPolyline(e).containsPoint(t)}divideAt(t,e={}){if(t<=0)return this.divideAtT(0);if(t>=1)return this.divideAtT(1);const n=this.tAt(t,e);return this.divideAtT(n)}divideAtLength(t,e={}){const n=this.tAtLength(t,e);return this.divideAtT(n)}divide(t){return this.divideAtT(t)}divideAtT(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,o=this.end;if(t<=0)return[new dt(e,e,e,e),new dt(e,n,i,o)];if(t>=1)return[new dt(e,n,i,o),new dt(o,o,o,o)];const r=this.getSkeletonPoints(t),a=r.startControlPoint1,l=r.startControlPoint2,c=r.divider,h=r.dividerControlPoint1,u=r.dividerControlPoint2;return[new dt(e,a,l,c),new dt(c,h,u,o)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,o=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:o.clone(),dividerControlPoint1:o.clone(),dividerControlPoint2:o.clone()};const r=new N(e,n).pointAt(t),a=new N(n,i).pointAt(t),l=new N(i,o).pointAt(t),c=new N(r,a).pointAt(t),h=new N(a,l).pointAt(t),u=new N(c,h).pointAt(t);return{startControlPoint1:r,startControlPoint2:c,divider:u,dividerControlPoint1:h,dividerControlPoint2:l}}getSubdivisions(t={}){const e=this.getPrecision(t);let n=[new dt(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(e===0)return n;let i=this.endpointDistance();const o=Math.pow(10,-e);let r=0;for(;;){r+=1;const a=[];n.forEach(h=>{const u=h.divide(.5);a.push(u[0],u[1])});const l=a.reduce((h,u)=>h+u.endpointDistance(),0),c=l!==0?(l-i)/l:0;if(r>1&&c<o)return a;n=a,i=l}}length(t={}){return this.getDivisions(t).reduce((n,i)=>n+i.endpointDistance(),0)}lengthAtT(t,e={}){if(t<=0)return 0;const n=e.precision===void 0?this.PRECISION:e.precision;return this.divide(t)[0].length({precision:n})}pointAt(t,e={}){if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.tAt(t,e);return this.pointAtT(n)}pointAtLength(t,e={}){const n=this.tAtLength(t,e);return this.pointAtT(n)}pointAtT(t){return t<=0?this.start.clone():t>=1?this.end.clone():this.getSkeletonPoints(t).divider}isDifferentiable(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,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,o=e.divider,r=new N(n,i);return r.translate(o.x-n.x,o.y-n.y),r}getPrecision(t={}){return t.precision==null?this.PRECISION:t.precision}getDivisions(t={}){if(t.subdivisions!=null)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),o=this.length(n)*t;return this.tAtLength(o,n)}tAtLength(t,e={}){let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),o=this.getDivisions(e),r={precision:i,subdivisions:o};let a=null,l,c,h=0,u=0,d=0;const g=o.length;let p=g>0?1/g:0;for(let y=0;y<g;y+=1){const C=n?y:g-1-y,w=o[y],x=w.endpointDistance();if(t<=d+x){a=w,l=C*p,c=(C+1)*p,h=n?t-d:x+d-t,u=n?x+d-t:t-d;break}d+=x}if(a==null)return n?1:0;const m=this.length(r),b=Math.pow(10,-i);for(;;){let y;if(y=m!==0?h/m:0,y<b)return l;if(y=m!==0?u/m:0,y<b)return c;let C,w;const x=a.divide(.5);p/=2;const E=x[0].endpointDistance(),B=x[1].endpointDistance();h<=E?(a=x[0],c-=p,C=h,w=E-C):(a=x[1],l+=p,C=h-E,w=B-C),h=C,u=w}}toPoints(t={}){const e=this.getDivisions(t),n=[e[0].start.clone()];return e.forEach(i=>n.push(i.end.clone())),n}toPolyline(t={}){return new yt(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 typeof t=="number"?(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 t!=null&&this.start.equals(t.start)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)&&this.end.equals(t.end)}clone(){return new dt(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 Dl(s){const t=s.length,e=[],n=[];let i=2;e[0]=s[0]/i;for(let o=1;o<t;o+=1)n[o]=1/i,i=(o<t-1?4:3.5)-n[o],e[o]=(s[o]-e[o-1])/i;for(let o=1;o<t;o+=1)e[t-o-1]-=n[t-o]*e[t-o];return e}function tC(s){const t=s.map(l=>A.clone(l)),e=[],n=[],i=t.length-1;if(i===1)return e[0]=new A((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),n[0]=new A(2*e[0].x-t[0].x,2*e[0].y-t[0].y),[e,n];const o=[];for(let l=1;l<i-1;l+=1)o[l]=4*t[l].x+2*t[l+1].x;o[0]=t[0].x+2*t[1].x,o[i-1]=(8*t[i-1].x+t[i].x)/2;const r=Dl(o);for(let l=1;l<i-1;l+=1)o[l]=4*t[l].y+2*t[l+1].y;o[0]=t[0].y+2*t[1].y,o[i-1]=(8*t[i-1].y+t[i].y)/2;const a=Dl(o);for(let l=0;l<i;l+=1)e.push(new A(r[l],a[l])),l<i-1?n.push(new A(2*t[l+1].x-r[l+1],2*t[l+1].y-a[l+1])):n.push(new A((t[i].x+r[i-1])/2,(t[i].y+a[i-1])/2));return[e,n]}class Hi extends Ie{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(this.previousSegment==null)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 gt extends Hi{static create(...t){const e=t.length,n=t[0];if(N.isLine(n))return new gt(n);if(A.isPointLike(n))return e===1?new gt(n):t.map(o=>new gt(o));if(e===2)return new gt(+t[0],+t[1]);const i=[];for(let o=0;o<e;o+=2){const r=+t[o],a=+t[o+1];i.push(new gt(r,a))}return i}constructor(t,e){super(),N.isLine(t)?this.endPoint=t.end.clone().round(2):this.endPoint=A.create(t,e).round(2)}get type(){return"L"}get line(){return new N(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 gt(e[0]),new gt(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[new gt(e[0]),new gt(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==null?!1:!this.start.equals(this.end)}clone(){return new gt(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 typeof t=="number"?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}`}}class Un extends Hi{static create(){return new Un}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 N(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 gt(e[0]):this.clone(),new gt(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[e[1].isDifferentiable()?new gt(e[0]):this.clone(),new gt(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?!1:!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 Un}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}class ae extends Hi{static create(...t){const e=t.length,n=t[0];if(N.isLine(n))return new ae(n);if(dt.isCurve(n))return new ae(n);if(A.isPointLike(n)){if(e===1)return new ae(n);const o=[];for(let r=0;r<e;r+=1)r===0?o.push(new ae(t[r])):o.push(new gt(t[r]));return o}if(e===2)return new ae(+t[0],+t[1]);const i=[];for(let o=0;o<e;o+=2){const r=+t[o],a=+t[o+1];o===0?i.push(new ae(r,a)):i.push(new gt(r,a))}return i}constructor(t,e){super(),this.isVisible=!1,this.isSubpathStart=!0,N.isLine(t)||dt.isCurve(t)?this.endPoint=t.end.clone().round(2):this.endPoint=A.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 typeof t=="number"?this.end.translate(t,e):this.end.translate(t),this}clone(){return new ae(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}`}}class kt extends Hi{static create(...t){const e=t.length,n=t[0];if(dt.isCurve(n))return new kt(n);if(A.isPointLike(n)){if(e===3)return new kt(t[0],t[1],t[2]);const o=[];for(let r=0;r<e;r+=3)o.push(new kt(t[r],t[r+1],t[r+2]));return o}if(e===6)return new kt(t[0],t[1],t[2],t[3],t[4],t[5]);const i=[];for(let o=0;o<e;o+=6)i.push(new kt(t[o],t[o+1],t[o+2],t[o+3],t[o+4],t[o+5]));return i}constructor(t,e,n,i,o,r){super(),dt.isCurve(t)?(this.controlPoint1=t.controlPoint1.clone().round(2),this.controlPoint2=t.controlPoint2.clone().round(2),this.endPoint=t.end.clone().round(2)):typeof t=="number"?(this.controlPoint1=new A(t,e).round(2),this.controlPoint2=new A(n,i).round(2),this.endPoint=new A(o,r).round(2)):(this.controlPoint1=A.create(t).round(2),this.controlPoint2=A.create(e).round(2),this.endPoint=A.create(n).round(2))}get type(){return"C"}get curve(){return new dt(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 kt(n[0]),new kt(n[1])]}divideAtLength(t,e={}){const n=this.curve.divideAtLength(t,e);return[new kt(n[0]),new kt(n[1])]}divideAtT(t){const e=this.curve.divideAtT(t);return[new kt(e[0]),new kt(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 typeof t=="number"?(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 kt(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 qi(s,t,e){return{x:s*Math.cos(e)-t*Math.sin(e),y:s*Math.sin(e)+t*Math.cos(e)}}function Ql(s,t,e,n,i,o){const r=.3333333333333333,a=2/3;return[r*s+a*e,r*t+a*n,r*i+a*e,r*o+a*n,i,o]}function Ll(s,t,e,n,i,o,r,a,l,c){const h=Math.PI*120/180,u=Math.PI/180*(+i||0);let d=[],g,p,m,b,y;if(c)p=c[0],m=c[1],b=c[2],y=c[3];else{g=qi(s,t,-u),s=g.x,t=g.y,g=qi(a,l,-u),a=g.x,l=g.y;const J=(s-a)/2,Z=(t-l)/2;let Y=J*J/(e*e)+Z*Z/(n*n);Y>1&&(Y=Math.sqrt(Y),e=Y*e,n=Y*n);const Et=e*e,Rt=n*n,Dt=(o===r?-1:1)*Math.sqrt(Math.abs((Et*Rt-Et*Z*Z-Rt*J*J)/(Et*Z*Z+Rt*J*J)));b=Dt*e*Z/n+(s+a)/2,y=Dt*-n*J/e+(t+l)/2,p=Math.asin((t-y)/n),m=Math.asin((l-y)/n),p=s<b?Math.PI-p:p,m=a<b?Math.PI-m:m,p<0&&(p=Math.PI*2+p),m<0&&(m=Math.PI*2+m),r&&p>m&&(p-=Math.PI*2),!r&&m>p&&(m-=Math.PI*2)}let C=m-p;if(Math.abs(C)>h){const J=m,Z=a,Y=l;m=p+h*(r&&m>p?1:-1),a=b+e*Math.cos(m),l=y+n*Math.sin(m),d=Ll(a,l,e,n,i,0,r,Z,Y,[m,J,b,y])}C=m-p;const w=Math.cos(p),x=Math.sin(p),E=Math.cos(m),B=Math.sin(m),v=Math.tan(C/4),M=4/3*(e*v),I=4/3*(n*v),T=[s,t],k=[s+M*x,t-I*w],R=[a+M*B,l-I*E],z=[a,l];if(k[0]=2*T[0]-k[0],k[1]=2*T[1]-k[1],c)return[k,R,z].concat(d);{d=[k,R,z].concat(d).join().split(",");const J=[],Z=d.length;for(let Y=0;Y<Z;Y+=1)J[Y]=Y%2?qi(+d[Y-1],+d[Y],u).y:qi(+d[Y],+d[Y+1],u).x;return J}}function eC(s){if(!s)return null;const t=`
2
+ \v\f\r   ᠎              \u2028\u2029`,e=new RegExp(`([a-z])[${t},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${t}]*,?[${t}]*)+)`,"ig"),n=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${t}]*,?[${t}]*`,"ig"),i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return s.replace(e,(r,a,l)=>{const c=[];let h=a.toLowerCase();l.replace(n,(d,g)=>(g&&c.push(+g),d)),h==="m"&&c.length>2&&(o.push([a,...c.splice(0,2)]),h="l",a=a==="m"?"l":"L");const u=i[h];for(;c.length>=u&&(o.push([a,...c.splice(0,u)]),!!u););return r}),o}function nC(s){const t=eC(s);if(!t||!t.length)return[["M",0,0]];let e=0,n=0,i=0,o=0;const r=[];for(let a=0,l=t.length;a<l;a+=1){const c=[];r.push(c);const h=t[a],u=h[0];if(u!==u.toUpperCase())switch(c[0]=u.toUpperCase(),c[0]){case"A":c[1]=h[1],c[2]=h[2],c[3]=h[3],c[4]=h[4],c[5]=h[5],c[6]=+h[6]+e,c[7]=+h[7]+n;break;case"V":c[1]=+h[1]+n;break;case"H":c[1]=+h[1]+e;break;case"M":i=+h[1]+e,o=+h[2]+n;for(let d=1,g=h.length;d<g;d+=1)c[d]=+h[d]+(d%2?e:n);break;default:for(let d=1,g=h.length;d<g;d+=1)c[d]=+h[d]+(d%2?e:n);break}else for(let d=0,g=h.length;d<g;d+=1)c[d]=h[d];switch(c[0]){case"Z":e=+i,n=+o;break;case"H":e=c[1];break;case"V":n=c[1];break;case"M":i=c[c.length-2],o=c[c.length-1],e=c[c.length-2],n=c[c.length-1];break;default:e=c[c.length-2],n=c[c.length-1];break}}return r}function iC(s){const t=nC(s),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function n(l,c,h){let u,d;if(!l)return["C",c.x,c.y,c.x,c.y,c.x,c.y];switch(l[0]in{T:1,Q:1}||(c.qx=null,c.qy=null),l[0]){case"M":c.X=l[1],c.Y=l[2];break;case"A":return parseFloat(l[1])===0||parseFloat(l[2])===0?["L",l[6],l[7]]:["C"].concat(Ll.apply(0,[c.x,c.y].concat(l.slice(1))));case"S":return h==="C"||h==="S"?(u=c.x*2-c.bx,d=c.y*2-c.by):(u=c.x,d=c.y),["C",u,d].concat(l.slice(1));case"T":return h==="Q"||h==="T"?(c.qx=c.x*2-c.qx,c.qy=c.y*2-c.qy):(c.qx=c.x,c.qy=c.y),["C"].concat(Ql(c.x,c.y,c.qx,c.qy,l[1],l[2]));case"Q":return c.qx=l[1],c.qy=l[2],["C"].concat(Ql(c.x,c.y,l[1],l[2],l[3],l[4]));case"H":return["L"].concat(l[1],c.y);case"V":return["L"].concat(c.x,l[1])}return l}function i(l,c){if(l[c].length>7){l[c].shift();const h=l[c];for(;h.length;)o[c]="A",c+=1,l.splice(c,0,["C"].concat(h.splice(0,6)));l.splice(c,1),a=t.length}}const o=[];let r="",a=t.length;for(let l=0;l<a;l+=1){let c="";t[l]&&(c=t[l][0]),c!=="C"&&(o[l]=c,l>0&&(r=o[l-1])),t[l]=n(t[l],e,r),o[l]!=="A"&&c==="C"&&(o[l]="C"),i(t,l);const h=t[l],u=h.length;e.x=h[u-2],e.y=h[u-1],e.bx=parseFloat(h[u-4])||e.x,e.by=parseFloat(h[u-3])||e.y}return(!t[0][0]||t[0][0]!=="M")&&t.unshift(["M",0,0]),t}function Fl(s){return iC(s).map(t=>t.map(e=>typeof e=="string"?e:je(e,2))).join(",").split(",").join(" ")}class F extends Ie{static isPath(t){return t!=null&&t instanceof F}static parse(t){if(!t)return new F;const e=new F,n=/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g,i=Fl(t).match(n);if(i!=null)for(let o=0,r=i.length;o<r;o+=1){const a=i[o],l=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,c=a.match(l);if(c!=null){const h=c[0],u=c.slice(1).map(g=>+g),d=F.createSegment.call(null,h,...u);e.appendSegment(d)}}return e}static createSegment(t,...e){if(t==="M")return ae.create.call(null,...e);if(t==="L")return gt.create.call(null,...e);if(t==="C")return kt.create.call(null,...e);if(t==="z"||t==="Z")return Un.create();throw new Error(`Invalid path segment type "${t}"`)}constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t))if(N.isLine(t[0])||dt.isCurve(t[0])){let e=null;t.forEach((i,o)=>{o===0&&this.appendSegment(F.createSegment("M",i.start)),e!=null&&!e.end.equals(i.start)&&this.appendSegment(F.createSegment("M",i.start)),N.isLine(i)?this.appendSegment(F.createSegment("L",i.end)):dt.isCurve(i)&&this.appendSegment(F.createSegment("C",i.controlPoint1,i.controlPoint2,i.end)),e=i})}else t.forEach(n=>{n.isSegment&&this.appendSegment(n)});else t!=null&&(N.isLine(t)?(this.appendSegment(F.createSegment("M",t.start)),this.appendSegment(F.createSegment("L",t.end))):dt.isCurve(t)?(this.appendSegment(F.createSegment("M",t.start)),this.appendSegment(F.createSegment("C",t.controlPoint1,t.controlPoint2,t.end))):yt.isPolyline(t)?t.points&&t.points.length&&t.points.forEach((e,n)=>{const i=n===0?F.createSegment("M",e):F.createSegment("L",e);this.appendSegment(i)}):t.isSegment&&this.appendSegment(t))}get start(){const t=this.segments,e=t.length;if(e===0)return null;for(let n=0;n<e;n+=1){const i=t[n];if(i.isVisible)return i.start}return t[e-1].end}get end(){const t=this.segments,e=t.length;if(e===0)return null;for(let n=e-1;n>=0;n-=1){const i=t[n];if(i.isVisible)return i.end}return t[e-1].end}moveTo(...t){return this.appendSegment(ae.create.call(null,...t))}lineTo(...t){return this.appendSegment(gt.create.call(null,...t))}curveTo(...t){return this.appendSegment(kt.create.call(null,...t))}arcTo(t,e,n,i,o,r,a){const l=this.end||new A,c=typeof r=="number"?Rl(l.x,l.y,t,e,n,i,o,r,a):Rl(l.x,l.y,t,e,n,i,o,r.x,r.y);if(c!=null)for(let h=0,u=c.length;h<u;h+=6)this.curveTo(c[h],c[h+1],c[h+2],c[h+3],c[h+4],c[h+5]);return this}quadTo(t,e,n,i){const o=this.end||new A,r=["M",o.x,o.y];if(typeof t=="number")r.push("Q",t,e,n,i);else{const l=e;r.push("Q",t.x,t.y,l.x,l.y)}const a=F.parse(r.join(" "));return this.appendSegment(a.segments.slice(1)),this}close(){return this.appendSegment(Un.create())}drawPoints(t,e={}){const n=Zy(t,e),i=F.parse(n);i&&i.segments&&this.appendSegment(i.segments)}bbox(){const t=this.segments,e=t.length;if(e===0)return null;let n;for(let o=0;o<e;o+=1){const r=t[o];if(r.isVisible){const a=r.bbox();a!=null&&(n=n?n.union(a):a)}}if(n!=null)return n;const i=t[e-1];return new P(i.end.x,i.end.y,0,0)}appendSegment(t){const e=this.segments.length;let n=e!==0?this.segments[e-1]:null,i;const o=null;if(Array.isArray(t))for(let r=0,a=t.length;r<a;r+=1){const l=t[r];i=this.prepareSegment(l,n,o),this.segments.push(i),n=i}else t!=null&&t.isSegment&&(i=this.prepareSegment(t,n,o),this.segments.push(i));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,o=null,r=null;if(n!==0&&(t>=1?(o=this.segments[t-1],r=o.nextSegment):(o=null,r=this.segments[0])),!Array.isArray(e))i=this.prepareSegment(e,o,r),this.segments.splice(t,0,i);else for(let a=0,l=e.length;a<l;a+=1){const c=e[a];i=this.prepareSegment(c,o,r),this.segments.splice(t+a,0,i),o=i}return this}removeSegment(t){const e=this.fixIndex(t),n=this.segments.splice(e,1)[0],i=n.previousSegment,o=n.nextSegment;return i&&(i.nextSegment=o),o&&(o.previousSegment=i),n.isSubpathStart&&o&&this.updateSubpathStartSegment(o),n}replaceSegment(t,e){const n=this.fixIndex(t);let i;const o=this.segments[n];let r=o.previousSegment;const a=o.nextSegment;let l=o.isSubpathStart;if(!Array.isArray(e))i=this.prepareSegment(e,r,a),this.segments.splice(n,1,i),l&&i.isSubpathStart&&(l=!1);else{this.segments.splice(t,1);for(let c=0,h=e.length;c<h;c+=1){const u=e[c];i=this.prepareSegment(u,r,a),this.segments.splice(t+c,0,i),r=i,l&&i.isSubpathStart&&(l=!1)}}l&&a&&this.updateSubpathStartSegment(a)}getSegment(t){const e=this.fixIndex(t);return this.segments[e]}fixIndex(t){const e=this.segments.length;if(e===0)throw new Error("Path has no segments.");let n=t;for(;n<0;)n=e+n;if(n>=e||n<0)throw new Error("Index out of range.");return n}segmentAt(t,e={}){const n=this.segmentIndexAt(t,e);return n?this.getSegment(n):null}segmentAtLength(t,e={}){const n=this.segmentIndexAtLength(t,e);return n?this.getSegment(n):null}segmentIndexAt(t,e={}){if(this.segments.length===0)return null;const n=cn(t,0,1),i=this.getOptions(e),r=this.length(i)*n;return this.segmentIndexAtLength(r,i)}segmentIndexAtLength(t,e={}){const n=this.segments.length;if(n===0)return null;let i=!0;t<0&&(i=!1,t=-t);const o=this.getPrecision(e),r=this.getSubdivisions(e);let a=0,l=null;for(let c=0;c<n;c+=1){const h=i?c:n-1-c,u=this.segments[h],d=r[h],g=u.length({precision:o,subdivisions:d});if(u.isVisible){if(t<=a+g)return h;l=h}a+=g}return l}getSegmentSubdivisions(t={}){const e=this.getPrecision(t),n=[];for(let i=0,o=this.segments.length;i<o;i+=1){const a=this.segments[i].getSubdivisions({precision:e});n.push(a)}return n}updateSubpathStartSegment(t){let e=t.previousSegment,n=t;for(;n&&!n.isSubpathStart;)e!=null?n.subpathStartSegment=e.subpathStartSegment:n.subpathStartSegment=null,e=n,n=n.nextSegment}prepareSegment(t,e,n){t.previousSegment=e,t.nextSegment=n,e!=null&&(e.nextSegment=t),n!=null&&(n.previousSegment=t);let i=t;return t.isSubpathStart&&(t.subpathStartSegment=t,i=n),i!=null&&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(i===0)return 0;const o=this.length(n);return o===0?0:i/o}closestPointT(t,e={}){if(this.segments.length===0)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let o,r=1/0;for(let a=0,l=this.segments.length;a<l;a+=1){const c=this.segments[a],h=i[a];if(c.isVisible){const u=c.closestPointT(t,{precision:n,subdivisions:h}),d=c.pointAtT(u),g=Nl(d,t);g<r&&(o={segmentIndex:a,value:u},r=g)}}return o||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(t,e={}){if(this.segments.length===0)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let o,r=1/0;for(let a=0,l=this.segments.length;a<l;a+=1){const c=this.segments[a],h=i[a];if(c.isDifferentiable()){const u=c.closestPointT(t,{precision:n,subdivisions:h}),d=c.pointAtT(u),g=Nl(d,t);g<r&&(o=c.tangentAtT(u),r=g)}}return o||null}containsPoint(t,e={}){const n=this.toPolylines(e);if(!n)return!1;let i=0;for(let o=0,r=n.length;o<r;o+=1)n[o].containsPoint(t)&&(i+=1);return i%2===1}pointAt(t,e={}){if(this.segments.length===0)return null;if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.getOptions(e),o=this.length(n)*t;return this.pointAtLength(o,n)}pointAtLength(t,e={}){if(this.segments.length===0)return null;if(t===0)return this.start.clone();let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),o=this.getSubdivisions(e);let r,a=0;for(let c=0,h=this.segments.length;c<h;c+=1){const u=n?c:h-1-c,d=this.segments[u],g=o[u],p=d.length({precision:i,subdivisions:g});if(d.isVisible){if(t<=a+p)return d.pointAtLength((n?1:-1)*(t-a),{precision:i,subdivisions:g});r=d}a+=p}return r?n?r.end:r.start:this.segments[this.segments.length-1].end.clone()}pointAtT(t){const e=this.segments,n=e.length;if(n===0)return null;const i=t.segmentIndex;if(i<0)return e[0].pointAtT(0);if(i>=n)return e[n-1].pointAtT(1);const o=cn(t.value,0,1);return e[i].pointAtT(o)}divideAt(t,e={}){if(this.segments.length===0)return null;const n=cn(t,0,1),i=this.getOptions(e),r=this.length(i)*n;return this.divideAtLength(r,i)}divideAtLength(t,e={}){if(this.segments.length===0)return null;let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),o=this.getSubdivisions(e);let r=0,a,l,c,h,u;for(let E=0,B=this.segments.length;E<B;E+=1){const v=n?E:B-1-E,M=this.getSegment(v),I=o[v],T={precision:i,subdivisions:I},k=M.length(T);if(M.isDifferentiable()&&(c=M,h=v,t<=r+k)){l=v,a=M.divideAtLength((n?1:-1)*(t-r),T);break}r+=k}if(!c)return null;a||(l=h,u=n?1:0,a=c.divideAtT(u));const d=this.clone(),g=l;d.replaceSegment(g,a);const p=g;let m=g+1,b=g+2;a[0].isDifferentiable()||(d.removeSegment(p),m-=1,b-=1);const y=d.getSegment(m).start;d.insertSegment(m,F.createSegment("M",y)),b+=1,a[1].isDifferentiable()||(d.removeSegment(b-1),b-=1);const C=b-p-1;for(let E=b,B=d.segments.length;E<B;E+=1){const v=this.getSegment(E-C),M=d.getSegment(E);if(M.type==="Z"&&!v.subpathStartSegment.end.equals(M.subpathStartSegment.end)){const I=F.createSegment("L",v.end);d.replaceSegment(E,I)}}const w=new F(d.segments.slice(0,m)),x=new F(d.segments.slice(m));return[w,x]}intersectsWithLine(t,e={}){const n=this.toPolylines(e);if(n==null)return null;let i=null;for(let o=0,r=n.length;o<r;o+=1){const a=n[o],l=t.intersect(a);l&&(i==null&&(i=[]),Array.isArray(l)?i.push(...l):i.push(l))}return i}isDifferentiable(){for(let t=0,e=this.segments.length;t<e;t+=1)if(this.segments[t].isDifferentiable())return!0;return!1}isValid(){const t=this.segments;return t.length===0||t[0].type==="M"}length(t={}){if(this.segments.length===0)return 0;const e=this.getSubdivisions(t);let n=0;for(let i=0,o=this.segments.length;i<o;i+=1){const r=this.segments[i],a=e[i];n+=r.length({subdivisions:a})}return n}lengthAtT(t,e={}){const n=this.segments.length;if(n===0)return 0;let i=t.segmentIndex;if(i<0)return 0;let o=cn(t.value,0,1);i>=n&&(i=n-1,o=1);const r=this.getPrecision(e),a=this.getSubdivisions(e);let l=0;for(let u=0;u<i;u+=1){const d=this.segments[u],g=a[u];l+=d.length({precision:r,subdivisions:g})}const c=this.segments[i],h=a[i];return l+=c.lengthAtT(o,{precision:r,subdivisions:h}),l}tangentAt(t,e={}){if(this.segments.length===0)return null;const n=cn(t,0,1),i=this.getOptions(e),r=this.length(i)*n;return this.tangentAtLength(r,i)}tangentAtLength(t,e={}){if(this.segments.length===0)return null;let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),o=this.getSubdivisions(e);let r,a=0;for(let l=0,c=this.segments.length;l<c;l+=1){const h=n?l:c-1-l,u=this.segments[h],d=o[h],g=u.length({precision:i,subdivisions:d});if(u.isDifferentiable()){if(t<=a+g)return u.tangentAtLength((n?1:-1)*(t-a),{precision:i,subdivisions:d});r=u}a+=g}if(r){const l=n?1:0;return r.tangentAtT(l)}return null}tangentAtT(t){const e=this.segments.length;if(e===0)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=cn(t.value,0,1);return this.segments[n].tangentAtT(i)}getPrecision(t={}){return t.precision==null?this.PRECISION:t.precision}getSubdivisions(t={}){if(t.segmentSubdivisions==null){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(n===0)return null;const i=this.getSubdivisions(t),o=[];let r=[];for(let a=0;a<n;a+=1){const l=e[a];if(l.isVisible){const c=i[a];c.length>0?c.forEach(h=>r.push(h.start)):r.push(l.start)}else r.length>0&&(r.push(e[a-1].end),o.push(r),r=[])}return r.length>0&&(r.push(this.end),o.push(r)),o}toPolylines(t={}){const e=this.toPoints(t);return e?e.map(n=>new yt(n)):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 typeof t=="number"?this.segments.forEach(n=>n.translate(t,e)):this.segments.forEach(n=>n.translate(t)),this}clone(){const t=new F;return this.segments.forEach(e=>t.appendSegment(e.clone())),t}equals(t){if(t==null)return!1;const e=this.segments,n=t.segments,i=e.length;if(n.length!==i)return!1;for(let o=0;o<i;o+=1){const r=e[o],a=n[o];if(r.type!==a.type||!r.equals(a))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 hn(s,t,e){let n,i;typeof t=="object"?(n=t.x,i=t.y):(n=t,i=e);const o=F.parse(s),r=o.bbox();if(r){let a=-r.height/2-r.y,l=-r.width/2-r.x;typeof n=="number"&&(l-=n),typeof i=="number"&&(a-=i),o.translate(l,a)}return o.serialize()}const po=/[\t\r\n\f]/g,mo=/\S+/g,un=s=>` ${s} `;function dn(s){return s&&s.getAttribute&&s.getAttribute("class")||""}function le(s,t){if(s==null||t==null)return!1;const e=un(dn(s)),n=un(t);return s.nodeType===1?e.replace(po," ").includes(n):!1}function O(s,t){if(!(s==null||t==null)){if(typeof t=="function")return O(s,t(dn(s)));if(typeof t=="string"&&s.nodeType===1){const e=t.match(mo)||[],n=un(dn(s)).replace(po," ");let i=e.reduce((o,r)=>o.indexOf(un(r))<0?`${o}${r} `:o,n);i=i.trim(),n!==i&&s.setAttribute("class",i)}}}function st(s,t){if(s!=null){if(typeof t=="function")return st(s,t(dn(s)));if((!t||typeof t=="string")&&s.nodeType===1){const e=(t||"").match(mo)||[],n=un(dn(s)).replace(po," ");let i=e.reduce((o,r)=>{const a=un(r);return o.indexOf(a)>-1?o.replace(a," "):o},n);i=t?i.trim():"",n!==i&&s.setAttribute("class",i)}}}function ie(s,t,e){if(!(s==null||t==null)){if(e!=null&&typeof t=="string"){e?O(s,t):st(s,t);return}if(typeof t=="function")return ie(s,t(dn(s),e),e);typeof t=="string"&&(t.match(mo)||[]).forEach(i=>{le(s,i)?st(s,i):O(s,i)})}}let zl=0;function sC(){return zl+=1,`v${zl}`}function bo(s){return(s.id==null||s.id==="")&&(s.id=sC()),s.id}function Pe(s){return s==null?!1:typeof s.getScreenCTM=="function"&&s instanceof SVGElement}const Ct={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"},Ul="1.1";function Kl(s,t=document){return t.createElement(s)}function yo(s,t=Ct.xhtml,e=document){return e.createElementNS(t,s)}function se(s,t=document){return yo(s,Ct.svg,t)}function Wi(s){if(s){const e=`<svg xmlns="${Ct.svg}" xmlns:xlink="${Ct.xlink}" version="${Ul}">${s}</svg>`,{documentElement:n}=oC(e,{async:!1});return n}const t=document.createElementNS(Ct.svg,"svg");return t.setAttributeNS(Ct.xmlns,"xmlns:xlink",Ct.xlink),t.setAttribute("version",Ul),t}function oC(s,t={}){let e;try{const n=new DOMParser;if(t.async!=null){const i=n;i.async=t.async}e=n.parseFromString(s,t.mimeType||"text/xml")}catch{e=void 0}if(!e||e.getElementsByTagName("parsererror").length)throw new Error(`Invalid XML: ${s}`);return e}function rC(s,t=!0){const e=s.nodeName;return t?e.toLowerCase():e.toUpperCase()}function Co(s){let t=0,e=s.previousSibling;for(;e;)e.nodeType===1&&(t+=1),e=e.previousSibling;return t}function aC(s,t){return s.querySelectorAll(t)}function lC(s,t){return s.querySelector(t)}function Jl(s,t,e){const n=s.ownerSVGElement;let i=s.parentNode;for(;i&&i!==e&&i!==n;){if(le(i,t))return i;i=i.parentNode}return null}function Ao(s,t){const e=t&&t.parentNode;return s===e||!!(e&&e.nodeType===1&&s.compareDocumentPosition(e)&16)}function Vt(s){s&&(Array.isArray(s)?s:[s]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}function Kn(s){for(;s.firstChild;)s.removeChild(s.firstChild)}function Mt(s,t){(Array.isArray(t)?t:[t]).forEach(n=>{n!=null&&s.appendChild(n)})}function jl(s,t){const e=s.firstChild;return e?Jn(e,t):Mt(s,t)}function Jn(s,t){const e=s.parentNode;e&&(Array.isArray(t)?t:[t]).forEach(i=>{i!=null&&e.insertBefore(i,s)})}function cC(s,t){const e=s.parentNode;e&&(Array.isArray(t)?t:[t]).forEach(i=>{i!=null&&e.insertBefore(i,s.nextSibling)})}function Gt(s,t){t!=null&&t.appendChild(s)}function hC(s){return!!s&&s.nodeType===1}function Vl(s){try{return s instanceof HTMLElement}catch{return typeof s=="object"&&s.nodeType===1&&typeof s.style=="object"&&typeof s.ownerDocument=="object"}}function uC(s,t){const e=[];let n=s.firstChild;for(;n;n=n.nextSibling)n.nodeType===1&&(!t||le(n,t))&&e.push(n);return e}const Gl=s=>{const t=Object.create(null);return e=>t[e]||(t[e]=s(e))},Yl=Gl(s=>s.replace(/\B([A-Z])/g,"-$1").toLowerCase()),wo=Gl(s=>Iy(Ln(s)).replace(/ /g,"")),Hl=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits","preserveAspectRatio"];function dC(s,t){return s.getAttribute(t)}function xo(s,t){const e=Wl(t);e.ns?s.hasAttributeNS(e.ns,e.local)&&s.removeAttributeNS(e.ns,e.local):s.hasAttribute(t)&&s.removeAttribute(t)}function vo(s,t,e){if(e==null)return xo(s,t);const n=Wl(t);n.ns&&typeof e=="string"?s.setAttributeNS(n.ns,t,e):t==="id"?s.id=`${e}`:s.setAttribute(t,`${e}`)}function ql(s,t){Object.keys(t).forEach(e=>{vo(s,e,t[e])})}function V(s,t,e){if(t==null){const n=s.attributes,i={};for(let o=0;o<n.length;o+=1)i[n[o].name]=n[o].value;return i}if(typeof t=="string"&&e===void 0)return s.getAttribute(t);typeof t=="object"?ql(s,t):vo(s,t,e)}function Wl(s){if(s.indexOf(":")!==-1){const t=s.split(":");return{ns:Ct[t[0]],local:t[1]}}return{ns:null,local:s}}function jn(s){const t={};return Object.keys(s).forEach(e=>{const n=Hl.includes(e)?e:Yl(e);t[n]=s[e]}),t}function Xi(s){const t={};return s.split(";").forEach(n=>{const i=n.trim();if(i){const o=i.split("=");o.length&&(t[o[0].trim()]=o[1]?o[1].trim():"")}}),t}function Eo(s,t){return Object.keys(t).forEach(e=>{if(e==="class")s[e]=s[e]?`${s[e]} ${t[e]}`:t[e];else if(e==="style"){const n=typeof s[e]=="object",i=typeof t[e]=="object";let o,r;n&&i?(o=s[e],r=t[e]):n?(o=s[e],r=Xi(t[e])):i?(o=Xi(s[e]),r=t[e]):(o=Xi(s[e]),r=Xi(t[e])),s[e]=Eo(o,r)}else s[e]=t[e]}),s}const gC=/-(.)/g;function fC(s){return s.replace(gC,(t,e)=>e.toUpperCase())}const So={},Xl=["webkit","ms","moz","o"],_l=typeof document<"u"?document.createElement("div").style:{};function pC(s){for(let t=0;t<Xl.length;t+=1){const e=Xl[t]+s;if(e in _l)return e}return null}function mC(s){const t=fC(s);if(So[t]==null){const e=t.charAt(0).toUpperCase()+t.slice(1);So[t]=t in _l?t:pC(e)}return So[t]}function $l(s,t){const e=s.ownerDocument&&s.ownerDocument.defaultView&&s.ownerDocument.defaultView.opener?s.ownerDocument.defaultView.getComputedStyle(s,null):window.getComputedStyle(s,null);return e&&t?e.getPropertyValue(t)||e[t]:e}const bC={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 yC(s){return/^--/.test(s)}function _i(s,t,e){const n=window.getComputedStyle(s,null);return e?n.getPropertyValue(t)||void 0:n[t]||s.style[t]}function $i(s,t){return parseInt(_i(s,t),10)||0}function CC(s,t){return!bC[s]&&typeof t=="number"?`${t}px`:t}function $(s,t,e){if(typeof t=="string"){const n=yC(t);if(n||(t=mC(t)),e===void 0)return _i(s,t,n);n||(e=CC(t,e));const i=s.style;n?i.setProperty(t,e):i[t]=e;return}for(const n in t)$(s,n,t[n])}function Mo(s){let t=2166136261,e=!1,n=s;for(let i=0,o=n.length;i<o;i+=1){let r=n.charCodeAt(i);r>127&&!e&&(n=unescape(encodeURIComponent(n)),r=n.charCodeAt(i),e=!0),t^=r,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function Bo(){let s="";const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let e=0,n=t.length;e<n;e+=1){const i=t[e],o=Math.random()*16|0,r=i==="x"?o:i==="y"?o&3|8:i;s+=r.toString(16)}return s}function AC(s,t,e){const n=Math.min(2,Math.floor(s.length*.34));let i=Math.floor(s.length*.4)+1,o,r=!1;const a=s.toLowerCase();for(const l of t){const c=e(l);if(c!==void 0&&Math.abs(c.length-a.length)<=n){const h=c.toLowerCase();if(h===a){if(c===s)continue;return l}if(r||c.length<3)continue;const u=wC(a,h,i-1);if(u===void 0)continue;u<3?(r=!0,o=l):(i=u,o=l)}}return o}function wC(s,t,e){let n=new Array(t.length+1),i=new Array(t.length+1);const o=e+1;for(let a=0;a<=t.length;a+=1)n[a]=a;for(let a=1;a<=s.length;a+=1){const l=s.charCodeAt(a-1),c=a>e?a-e:1,h=t.length>e+a?e+a:t.length;i[0]=a;let u=a;for(let g=1;g<c;g+=1)i[g]=o;for(let g=c;g<=h;g+=1){const p=l===t.charCodeAt(g-1)?n[g-1]:Math.min(n[g]+1,i[g-1]+1,n[g-1]+2);i[g]=p,u=Math.min(u,p)}for(let g=h+1;g<=t.length;g+=1)i[g]=o;if(u>e)return;const d=n;n=i,i=d}const r=n[t.length];return r>e?void 0:r}const Zi=new WeakMap;function xC(s,t){const e=Ln(t),n=Zi.get(s);if(n)return n[e]}function vC(s,t,e){const n=Ln(t),i=Zi.get(s);i?i[n]=e:Zi.set(s,{[n]:e})}function Ve(s,t,e){if(!t)return Zi.get(s);if(typeof t=="string"){if(e===void 0)return xC(s,t);vC(s,t,e);return}for(const n in t)Ve(s,n,t[n])}const EC={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function Io(s,t,e){if(t){if(typeof t=="string"){if(t=EC[t]||t,arguments.length<3)return s[t];s[t]=e;return}for(const n in t)Io(s,n,t[n])}}function SC(s,...t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(s.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}const MC=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,t){s.__proto__=t}||function(s,t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s[e]=t[e])};function BC(s,t){MC(s,t);function e(){this.constructor=s}s.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}class IC{}const PC=/^\s*class\s+/.test(`${IC}`)||/^\s*class\s*\{/.test(`${class{}}`);function Po(s,t){let e;return PC?e=class extends t{}:(e=function(){return t.apply(this,arguments)},BC(e,t)),Object.defineProperty(e,"name",{value:s}),e}function Zl(s){return s==="__proto__"}function To(s,t,e="/"){let n;const i=Array.isArray(t)?t:t.split(e);if(i.length)for(n=s;i.length;){const o=i.shift();if(Object(n)===n&&o&&o in n)n=n[o];else return}return n}function gn(s,t,e,n="/"){const i=Array.isArray(t)?t:t.split(n),o=i.pop();if(o&&!Zl(o)){let r=s;i.forEach(a=>{Zl(a)||(r[a]==null&&(r[a]={}),r=r[a])}),r[o]=e}return s}function tc(s,t,e="/"){const n=Array.isArray(t)?t.slice():t.split(e),i=n.pop();if(i)if(n.length>0){const o=To(s,n);o&&delete o[i]}else delete s[i];return s}function TC(s,t,e={}){const n=e.offset||0,i=[],o=[];let r,a,l=null;for(let c=0;c<s.length;c+=1){r=o[c]=s[c];for(let h=0,u=t.length;h<u;h+=1){const d=t[h],g=d.start+n,p=d.end+n;c>=g&&c<p&&(typeof r=="string"?r=o[c]={t:s[c],attrs:d.attrs}:r.attrs=Eo(Eo({},r.attrs),d.attrs),e.includeAnnotationIndices&&(r.annotations==null&&(r.annotations=[]),r.annotations.push(h)))}a=o[c-1],a?ht(r)&&ht(a)?(l=l,JSON.stringify(r.attrs)===JSON.stringify(a.attrs)?l.t+=r.t:(i.push(l),l=r)):ht(r)||ht(a)?(l=l,i.push(l),l=r):l=String(l||"")+String(r):l=r}return l!=null&&i.push(l),i}function kC(s){return s.replace(/ /g," ")}class L{get[Symbol.toStringTag](){return ec}get type(){return this.node.nodeName}get id(){return this.node.id}set id(t){this.node.id=t}static isVector(t){if(t==null)return!1;if(t instanceof L)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===ec)&&n.node instanceof SVGElement&&typeof n.sample=="function"&&typeof n.toPath=="function"}static create(t,e,n){return new L(t,e,n)}static createVectors(t){if(t[0]==="<"){const e=Wi(t),n=[];for(let i=0,o=e.childNodes.length;i<o;i+=1){const r=e.childNodes[i];n.push(L.create(document.importNode(r,!0)))}return n}return[L.create(t)]}static toNode(t){return L.isVector(t)?t.node:t}static toNodes(t){return Array.isArray(t)?t.map(e=>L.toNode(e)):[L.toNode(t)]}constructor(t,e,n){if(!t)throw new TypeError("Invalid element to create vector");let i;if(L.isVector(t))i=t.node;else if(typeof t=="string")if(t.toLowerCase()==="svg")i=Wi();else if(t[0]==="<"){const o=Wi(t);i=document.importNode(o.firstChild,!0)}else i=document.createElementNS(Ct.svg,t);else i=t;this.node=i,e&&this.setAttributes(e),n&&this.append(n)}transform(t,e){return t==null?fn(this.node):(fn(this.node,t,e),this)}translate(t,e=0,n={}){return t==null?hc(this.node):(hc(this.node,t,e,n),this)}rotate(t,e,n,i={}){return t==null?No(this.node):(No(this.node,t,e,n,i),this)}scale(t,e){return t==null?uc(this.node):(uc(this.node,t,e),this)}getTransformToElement(t){const e=L.toNode(t);return Ro(this.node,e)}removeAttribute(t){return xo(this.node,t),this}getAttribute(t){return dC(this.node,t)}setAttribute(t,e){return vo(this.node,t,e),this}setAttributes(t){return ql(this.node,t),this}attr(t,e){return t==null?V(this.node):typeof t=="string"&&e===void 0?V(this.node,t):(typeof t=="object"?V(this.node,t):V(this.node,t,e),this)}svg(){return this.node instanceof SVGSVGElement?this:L.create(this.node.ownerSVGElement)}defs(){const t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?L.create(e):L.create("defs").appendTo(t)}text(t,e={}){return ic(this.node,t,e),this}tagName(){return rC(this.node)}clone(){return L.create(this.node.cloneNode(!0))}remove(){return Vt(this.node),this}empty(){return Kn(this.node),this}append(t){return Mt(this.node,L.toNodes(t)),this}appendTo(t){return Gt(this.node,L.isVector(t)?t.node:t),this}prepend(t){return jl(this.node,L.toNodes(t)),this}before(t){return Jn(this.node,L.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(L.toNode(t),this.node),L.create(t)}first(){return this.node.firstChild?L.create(this.node.firstChild):null}last(){return this.node.lastChild?L.create(this.node.lastChild):null}get(t){const e=this.node.childNodes[t];return e?L.create(e):null}indexOf(t){return Array.prototype.slice.call(this.node.childNodes).indexOf(L.toNode(t))}find(t){const e=[],n=aC(this.node,t);if(n)for(let i=0,o=n.length;i<o;i+=1)e.push(L.create(n[i]));return e}findOne(t){const e=lC(this.node,t);return e?L.create(e):null}findParentByClass(t,e){const n=Jl(this.node,t,e);return n?L.create(n):null}matches(t){const e=this.node;this.node.matches;const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return n&&n.call(e,t)}contains(t){return Ao(this.node,L.isVector(t)?t.node:t)}wrap(t){const e=L.create(t),n=this.node.parentNode;return n!=null&&n.insertBefore(e.node,this.node),e.append(this)}parent(t){let e=this;if(e.node.parentNode==null)return null;if(e=L.create(e.node.parentNode),t==null)return e;do if(typeof t=="string"?e.matches(t):e instanceof t)return e;while(e=L.create(e.node.parentNode));return e}children(){const t=this.node.childNodes,e=[];for(let n=0;n<t.length;n+=1)t[n].nodeType===1&&e.push(L.create(t[n]));return e}eachChild(t,e){const n=this.children();for(let i=0,o=n.length;i<o;i+=1)t.call(n[i],n[i],i,n),e&&n[i].eachChild(t,e);return this}index(){return Co(this.node)}hasClass(t){return le(this.node,t)}addClass(t){return O(this.node,t),this}removeClass(t){return st(this.node,t),this}toggleClass(t,e){return ie(this.node,t,e),this}toLocalPoint(t,e){return $C(this.node,t,e)}sample(t=1){return this.node instanceof SVGPathElement?DC(this.node,t):[]}toPath(){return L.create(JC(this.node))}toPathData(){return lc(this.node)}}const ec=`X6.${L.name}`;function OC(s,t){const e=L.create(t),n=L.create("textPath"),i=s.d;if(i&&s["xlink:href"]===void 0){const o=L.create("path").attr("d",i).appendTo(e.defs());n.attr("xlink:href",`#${o.id}`)}return typeof s=="object"&&n.attr(s),n.node}function NC(s,t,e){const n=e.eol,i=e.baseSize,o=e.lineHeight;let r=0,a;const l={},c=t.length-1;for(let h=0;h<=c;h+=1){let u=t[h],d=null;if(typeof u=="object"){const g=u.attrs,p=L.create("tspan",g);a=p.node;let m=u.t;n&&h===c&&(m+=n),a.textContent=m;const b=g.class;b&&p.addClass(b),e.includeAnnotationIndices&&p.attr("annotations",u.annotations.join(",")),d=parseFloat(g["font-size"]),d===void 0&&(d=i),d&&d>r&&(r=d)}else n&&h===c&&(u+=n),a=document.createTextNode(u||" "),i&&i>r&&(r=i);s.appendChild(a)}return r&&(l.maxFontSize=r),o?l.lineHeight=o:r&&(l.lineHeight=r*1.2),l}const nc=/em$/;function ts(s,t){const e=parseFloat(s);return nc.test(s)?e*t:e}function RC(s,t,e,n){if(!Array.isArray(t))return 0;const i=t.length;if(!i)return 0;let o=t[0];const r=ts(o.maxFontSize,e)||e;let a=0;const l=ts(n,e);for(let u=1;u<i;u+=1){o=t[u];const d=ts(o.lineHeight,e)||l;a+=d}const c=ts(o.maxFontSize,e)||e;let h;switch(s){case"middle":h=r/2-.15*c-a/2;break;case"bottom":h=-(.25*c)-a;break;case"top":default:h=.8*r;break}return h}function ic(s,t,e={}){t=kC(t);const n=e.eol;let i=e.textPath;const o=e.textVerticalAnchor,r=o==="middle"||o==="bottom"||o==="top";let a=e.x;a===void 0&&(a=s.getAttribute("x")||0);const l=e.includeAnnotationIndices;let c=e.annotations;c&&!Array.isArray(c)&&(c=[c]);const h=e.lineHeight,u=h==="auto",d=u?"1.5em":h||"1em";let g=!0;const p=s.childNodes;if(p.length===1){const I=p[0];I&&I.tagName.toUpperCase()==="TITLE"&&(g=!1)}g&&Kn(s),V(s,{"xml:space":"preserve",display:t||e.displayEmpty?null:"none"});const m=V(s,"font-size");let b=parseFloat(m);b||(b=16,(r||c)&&!m&&V(s,"font-size",`${b}`));let y;i?(typeof i=="string"&&(i={d:i}),y=OC(i,s)):y=document.createDocumentFragment();let C,w=0,x;const E=t.split(`
3
+ `),B=[],v=E.length-1;for(let I=0;I<=v;I+=1){C=d;let T="v-line";const k=se("tspan");let R,z=E[I];if(z)if(c){const J=TC(z,c,{offset:-w,includeAnnotationIndices:l});R=NC(k,J,{eol:I!==v&&n,baseSize:b,lineHeight:u?null:d,includeAnnotationIndices:l});const Z=R.lineHeight;Z&&u&&I!==0&&(C=Z),I===0&&(x=R.maxFontSize*.8)}else n&&I!==v&&(z+=n),k.textContent=z;else{k.textContent="-",T+=" v-empty-line";const J=k.style;J.fillOpacity=0,J.strokeOpacity=0,c&&(R={})}R&&B.push(R),I>0&&k.setAttribute("dy",C),(I>0||i)&&k.setAttribute("x",a),k.className.baseVal=T,y.appendChild(k),w+=z.length+1}if(r)if(c)C=RC(o,B,b,d);else if(o==="top")C="0.8em";else{let I;switch(v>0?(I=parseFloat(d)||1,I*=v,nc.test(d)||(I/=b)):I=0,o){case"middle":C=`${.3-I/2}em`;break;case"bottom":C=`${-I-.3}em`;break}}else o===0?C="0em":o?C=o:(C=0,s.getAttribute("y")==null&&s.setAttribute("y",`${x||"0.8em"}`));y.firstChild.setAttribute("dy",C),s.appendChild(y)}function Vn(s,t={}){const e=document.createElement("canvas").getContext("2d");if(!s)return{width:0};const n=[],i=t["font-size"]?`${parseFloat(t["font-size"])}px`:"14px";return n.push(t["font-style"]||"normal"),n.push(t["font-variant"]||"normal"),n.push(t["font-weight"]||400),n.push(i),n.push(t["font-family"]||"sans-serif"),e.font=n.join(" "),e.measureText(s)}function sc(s,t,e,n={}){if(t>=e)return[s,""];const i=s.length,o={};let r=Math.round(t/e*i-1);for(r<0&&(r=0);r>=0&&r<i;){const a=s.slice(0,r),l=o[a]||Vn(a,n).width,c=s.slice(0,r+1),h=o[c]||Vn(c,n).width;if(o[a]=l,o[c]=h,l>t)r-=1;else if(h<=t)r+=1;else break}return[s.slice(0,r),s.slice(r)]}function oc(s,t,e={},n={}){const i=t.width,o=t.height,r=n.eol||`
4
+ `,a=e.fontSize||14,l=e.lineHeight?parseFloat(e.lineHeight):Math.ceil(a*1.4),c=Math.floor(o/l);if(s.indexOf(r)>-1){const b=Bo(),y=[];return s.split(r).forEach(C=>{const w=oc(C,Object.assign(Object.assign({},t),{height:Number.MAX_SAFE_INTEGER}),e,Object.assign(Object.assign({},n),{eol:b}));w&&y.push(...w.split(b))}),y.slice(0,c).join(r)}const{width:h}=Vn(s,e);if(h<i)return s;const u=[];let d=s,g=h,p=n.ellipsis,m=0;p&&(typeof p!="string"&&(p="…"),m=Vn(p,e).width);for(let b=0;b<c;b+=1)if(g>i)if(b===c-1){const[C]=sc(d,i-m,g,e);u.push(p?`${C}${p}`:C)}else{const[C,w]=sc(d,i,g,e);u.push(C),d=w,g=Vn(d,e).width}else{u.push(d);break}return u.join(r)}const ko=.551784;function Bt(s,t,e=NaN){const n=s.getAttribute(t);if(n==null)return e;const i=parseFloat(n);return Number.isNaN(i)?e:i}function DC(s,t=1){const e=s.getTotalLength(),n=[];let i=0,o;for(;i<e;)o=s.getPointAtLength(i),n.push({distance:i,x:o.x,y:o.y}),i+=t;return n}function QC(s){return["M",Bt(s,"x1"),Bt(s,"y1"),"L",Bt(s,"x2"),Bt(s,"y2")].join(" ")}function LC(s){const t=es(s);return t.length===0?null:`${rc(t)} Z`}function FC(s){const t=es(s);return t.length===0?null:rc(t)}function rc(s){return`M ${s.map(e=>`${e.x} ${e.y}`).join(" L")}`}function es(s){const t=[],e=s.points;if(e)for(let n=0,i=e.numberOfItems;n<i;n+=1)t.push(e.getItem(n));return t}function zC(s){const t=Bt(s,"cx",0),e=Bt(s,"cy",0),n=Bt(s,"r"),i=n*ko;return["M",t,e-n,"C",t+i,e-n,t+n,e-i,t+n,e,"C",t+n,e+i,t+i,e+n,t,e+n,"C",t-i,e+n,t-n,e+i,t-n,e,"C",t-n,e-i,t-i,e-n,t,e-n,"Z"].join(" ")}function UC(s){const t=Bt(s,"cx",0),e=Bt(s,"cy",0),n=Bt(s,"rx"),i=Bt(s,"ry")||n,o=n*ko,r=i*ko;return["M",t,e-i,"C",t+o,e-i,t+n,e-r,t+n,e,"C",t+n,e+r,t+o,e+i,t,e+i,"C",t-o,e+i,t-n,e+r,t-n,e,"C",t-n,e-r,t-o,e-i,t,e-i,"Z"].join(" ")}function KC(s){return ac({x:Bt(s,"x",0),y:Bt(s,"y",0),width:Bt(s,"width",0),height:Bt(s,"height",0),rx:Bt(s,"rx",0),ry:Bt(s,"ry",0)})}function ac(s){let t;const e=s.x,n=s.y,i=s.width,o=s.height,r=Math.min(s.rx||s["top-rx"]||0,i/2),a=Math.min(s.rx||s["bottom-rx"]||0,i/2),l=Math.min(s.ry||s["top-ry"]||0,o/2),c=Math.min(s.ry||s["bottom-ry"]||0,o/2);return r||a||l||c?t=["M",e,n+l,"v",o-l-c,"a",a,c,0,0,0,a,c,"h",i-2*a,"a",a,c,0,0,0,a,-c,"v",-(o-c-l),"a",r,l,0,0,0,-r,-l,"h",-(i-2*r),"a",r,l,0,0,0,-r,l,"Z"]:t=["M",e,n,"H",e+i,"V",n+o,"H",e,"V",n,"Z"],t.join(" ")}function JC(s){const t=se("path");V(t,V(s));const e=lc(s);return e&&t.setAttribute("d",e),t}function lc(s){const t=s.tagName.toLowerCase();switch(t){case"path":return s.getAttribute("d");case"line":return QC(s);case"polygon":return LC(s);case"polyline":return FC(s);case"ellipse":return UC(s);case"circle":return zC(s);case"rect":return KC(s)}throw new Error(`"${t}" cannot be converted to svg path element.`)}const jC=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,cc=/[ ,]+/,VC=/^(\w+)\((.*)\)/;function GC(s,t){const n=se("svg").createSVGPoint();return n.x=s,n.y=t,n}function At(s){const e=se("svg").createSVGMatrix();if(s!=null){const n=s,i=["a","b","c","d","e","f"];for(const o of i)n[o]!==void 0&&(e[o]=n[o])}return e}function YC(s){const t=se("svg");return s!=null?(s instanceof DOMMatrix||(s=At(s)),t.createSVGTransformFromMatrix(s)):t.createSVGTransform()}function Gn(s){let t=At();const e=s!=null&&s.match(jC);if(!e)return t;for(let n=0,i=e.length;n<i;n+=1){const r=e[n].match(VC);if(r){let a,l,c,h,u,d=At();const g=r[2].split(cc);switch(r[1].toLowerCase()){case"scale":a=parseFloat(g[0]),l=g[1]===void 0?a:parseFloat(g[1]),d=d.scaleNonUniform(a,l);break;case"translate":c=parseFloat(g[0]),h=parseFloat(g[1]),d=d.translate(c,h);break;case"rotate":u=parseFloat(g[0]),c=parseFloat(g[1])||0,h=parseFloat(g[2])||0,c!==0||h!==0?d=d.translate(c,h).rotate(u).translate(-c,-h):d=d.rotate(u);break;case"skewx":u=parseFloat(g[0]),d=d.skewX(u);break;case"skewy":u=parseFloat(g[0]),d=d.skewY(u);break;case"matrix":d.a=parseFloat(g[0]),d.b=parseFloat(g[1]),d.c=parseFloat(g[2]),d.d=parseFloat(g[3]),d.e=parseFloat(g[4]),d.f=parseFloat(g[5]);break;default:continue}t=t.multiply(d)}}return t}function Yn(s){const t=s||{},e=t.a!=null?t.a:1,n=t.b!=null?t.b:0,i=t.c!=null?t.c:0,o=t.d!=null?t.d:1,r=t.e!=null?t.e:0,a=t.f!=null?t.f:0;return`matrix(${e},${n},${i},${o},${r},${a})`}function ns(s){let t,e,n;if(s){const o=cc;if(s.trim().indexOf("matrix")>=0){const r=Gn(s),a=HC(r);t=[a.translateX,a.translateY],e=[a.rotation],n=[a.scaleX,a.scaleY];const l=[];(t[0]!==0||t[1]!==0)&&l.push(`translate(${t.join(",")})`),(n[0]!==1||n[1]!==1)&&l.push(`scale(${n.join(",")})`),e[0]!==0&&l.push(`rotate(${e[0]})`),s=l.join(" ")}else{const r=s.match(/translate\((.*?)\)/);r&&(t=r[1].split(o));const a=s.match(/rotate\((.*?)\)/);a&&(e=a[1].split(o));const l=s.match(/scale\((.*?)\)/);l&&(n=l[1].split(o))}}const i=n&&n[0]?parseFloat(n[0]):1;return{raw:s||"",translation:{tx:t&&t[0]?parseInt(t[0],10):0,ty:t&&t[1]?parseInt(t[1],10):0},rotation:{angle:e&&e[0]?parseInt(e[0],10):0,cx:e&&e[1]?parseInt(e[1],10):void 0,cy:e&&e[2]?parseInt(e[2],10):void 0},scale:{sx:i,sy:n&&n[1]?parseFloat(n[1]):i}}}function Oo(s,t){const e=t.x*s.a+t.y*s.c+0,n=t.x*s.b+t.y*s.d+0;return{x:e,y:n}}function HC(s){const t=Oo(s,{x:0,y:1}),e=Oo(s,{x:1,y:0}),n=180/Math.PI*Math.atan2(t.y,t.x)-90,i=180/Math.PI*Math.atan2(e.y,e.x);return{skewX:n,skewY:i,translateX:s.e,translateY:s.f,scaleX:Math.sqrt(s.a*s.a+s.b*s.b),scaleY:Math.sqrt(s.c*s.c+s.d*s.d),rotation:n}}function qC(s){let t,e,n,i;return s?(t=s.a==null?1:s.a,i=s.d==null?1:s.d,e=s.b,n=s.c):t=i=1,{sx:e?Math.sqrt(t*t+e*e):t,sy:n?Math.sqrt(n*n+i*i):i}}function WC(s){let t={x:0,y:1};s&&(t=Oo(s,t));const e=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:e%360+(e<0?360:0)}}function XC(s){return{tx:s&&s.e||0,ty:s&&s.f||0}}function fn(s,t,e={}){if(t==null)return Gn(V(s,"transform"));if(e.absolute){s.setAttribute("transform",Yn(t));return}const n=s.transform,i=YC(t);n.baseVal.appendItem(i)}function hc(s,t,e=0,n={}){let i=V(s,"transform");const o=ns(i);if(t==null)return o.translation;i=o.raw,i=i.replace(/translate\([^)]*\)/g,"").trim();const r=n.absolute?t:o.translation.tx+t,a=n.absolute?e:o.translation.ty+e,l=`translate(${r},${a})`;s.setAttribute("transform",`${l} ${i}`.trim())}function No(s,t,e,n,i={}){let o=V(s,"transform");const r=ns(o);if(t==null)return r.rotation;o=r.raw,o=o.replace(/rotate\([^)]*\)/g,"").trim(),t%=360;const a=i.absolute?t:r.rotation.angle+t,l=e!=null&&n!=null?`,${e},${n}`:"",c=`rotate(${a}${l})`;s.setAttribute("transform",`${o} ${c}`.trim())}function uc(s,t,e){let n=V(s,"transform");const i=ns(n);if(t==null)return i.scale;e=e??t,n=i.raw,n=n.replace(/scale\([^)]*\)/g,"").trim();const o=`scale(${t},${e})`;s.setAttribute("transform",`${n} ${o}`.trim())}function Ro(s,t){if(Pe(t)&&Pe(s)){const e=t.getScreenCTM(),n=s.getScreenCTM();if(e&&n)return e.inverse().multiply(n)}return At()}function _C(s,t){let e=At();if(Pe(t)&&Pe(s)){let n=s;const i=[];for(;n&&n!==t;){const o=n.getAttribute("transform")||null,r=Gn(o);i.push(r),n=n.parentNode}i.reverse().forEach(o=>{e=e.multiply(o)})}return e}function $C(s,t,e){const n=s instanceof SVGSVGElement?s:s.ownerSVGElement,i=n.createSVGPoint();i.x=t,i.y=e;try{const o=n.getScreenCTM(),r=i.matrixTransform(o.inverse()),a=Ro(s,n).inverse();return r.matrixTransform(a)}catch{return i}}const dc={};function pn(s){return dc[s]||{}}function is(s,t){dc[s]=t}const Hn=new WeakMap;function ZC(s){return Hn.has(s)||Hn.set(s,{events:Object.create(null)}),Hn.get(s)}function Do(s){return Hn.get(s)}function tA(s){return Hn.delete(s)}const ss=()=>!0,mn=()=>!1;function gc(s){s.stopPropagation()}function eA(s,t,e){s.addEventListener!=null&&s.addEventListener(t,e)}function nA(s,t,e){s.removeEventListener!=null&&s.removeEventListener(t,e)}const iA=/[^\x20\t\r\n\f]+/g,sA=/^([^.]*)(?:\.(.+)|)/;function fc(s){return(s||"").match(iA)||[""]}function pc(s){const t=sA.exec(s)||[];return{originType:t[1]?t[1].trim():t[1],namespaces:t[2]?t[2].split(".").map(e=>e.trim()).sort():[]}}function Qo(s){return s.nodeType===1||s.nodeType===9||!+s.nodeType}let mc=0;const bn=new WeakMap;function bc(s){return bn.has(s)||(bn.set(s,mc),mc+=1),bn.get(s)}function oA(s){return bn.get(s)}function rA(s){return bn.delete(s)}function yc(s,t){return bn.set(s,t)}function aA(s,t){const e=[],n=Do(s),i=n&&n.events&&n.events[t.type],o=i&&i.handlers||[],r=i?i.delegateCount:0;if(r>0&&!(t.type==="click"&&typeof t.button=="number"&&t.button>=1)){for(let a=t.target;a!==s;a=a.parentNode||s)if(a.nodeType===1&&!(t.type==="click"&&a.disabled===!0)){const l=[],c={};for(let h=0;h<r;h+=1){const u=o[h],d=u.selector;if(d!=null&&c[d]==null){const g=s,p=[];g.querySelectorAll(d).forEach(m=>{p.push(m)}),c[d]=p.includes(a)}c[d]&&l.push(u)}l.length&&e.push({elem:a,handlers:l})}}return r<o.length&&e.push({elem:s,handlers:o.slice(r)}),e}function Cc(s){return s!=null&&s===s.window}function Ac(s,t){const e=s.nodeType===9?s.documentElement:s,n=t&&t.parentNode;return s===n||!!(n&&n.nodeType===1&&(e.contains?e.contains(n):s.compareDocumentPosition&&s.compareDocumentPosition(n)&16))}class Ce{static create(t){return t instanceof Ce?t:new Ce(t)}static addProperty(t,e){Object.defineProperty(Ce.prototype,t,{enumerable:!0,configurable:!0,get:typeof e=="function"?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set(n){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:n})}})}constructor(t,e){this.isDefaultPrevented=mn,this.isPropagationStopped=mn,this.isImmediatePropagationStopped=mn,this.isSimulated=!1,this.preventDefault=()=>{const n=this.originalEvent;this.isDefaultPrevented=ss,n&&!this.isSimulated&&n.preventDefault()},this.stopPropagation=()=>{const n=this.originalEvent;this.isPropagationStopped=ss,n&&!this.isSimulated&&n.stopPropagation()},this.stopImmediatePropagation=()=>{const n=this.originalEvent;this.isImmediatePropagationStopped=ss,n&&!this.isSimulated&&n.stopImmediatePropagation(),this.stopPropagation()},typeof t=="string"?this.type=t:t.type&&(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?ss:mn,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())}}const wc={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(wc).forEach(s=>Ce.addProperty(s,wc[s])),is("load",{noBubble:!0}),is("beforeunload",{postDispatch(s,t){t.result!==void 0&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}),is("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(s,t){let e;const n=t.relatedTarget,i=t.handleObj;return(!n||n!==s&&!Ac(s,n))&&(t.type=i.originType,e=i.handler.call(s,t),t.type="mouseover"),e}}),is("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(s,t){let e;const n=t.relatedTarget,i=t.handleObj;return(!n||n!==s&&!Ac(s,n))&&(t.type=i.originType,e=i.handler.call(s,t),t.type="mouseout"),e}});let Lo;function lA(s,t,e,n,i){if(!Qo(s))return;let o;if(typeof e!="function"){const{handler:c,selector:h}=e,u=K(e,["handler","selector"]);e=c,i=h,o=u}const r=ZC(s);let a=r.handler;a==null&&(a=r.handler=function(c,...h){return Lo!==c.type?cA(s,c,...h):void 0});const l=bc(e);fc(t).forEach(c=>{const{originType:h,namespaces:u}=pc(c);if(!h)return;let d=h,g=pn(d);d=(i?g.delegateType:g.bindType)||d,g=pn(d);const p=Object.assign({type:d,originType:h,data:n,selector:i,guid:l,handler:e,namespace:u.join(".")},o),m=r.events;let b=m[d];b||(b=m[d]={handlers:[],delegateCount:0},(!g.setup||g.setup(s,n,u,a)===!1)&&eA(s,d,a)),g.add&&(rA(p.handler),g.add(s,p),yc(p.handler,l)),i?(b.handlers.splice(b.delegateCount,0,p),b.delegateCount+=1):b.handlers.push(p)})}function xc(s,t,e,n,i){const o=Do(s);if(!o)return;const r=o.events;r&&(fc(t).forEach(a=>{const{originType:l,namespaces:c}=pc(a);if(!l){Object.keys(r).forEach(m=>{xc(s,m+a,e,n,!0)});return}let h=l;const u=pn(h);h=(n?u.delegateType:u.bindType)||h;const d=r[h];if(!d)return;const g=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,p=d.handlers.length;for(let m=d.handlers.length-1;m>=0;m-=1){const b=d.handlers[m];(i||l===b.originType)&&(!e||oA(e)===b.guid)&&(g==null||b.namespace&&g.test(b.namespace))&&(n==null||n===b.selector||n==="**"&&b.selector)&&(d.handlers.splice(m,1),b.selector&&(d.delegateCount-=1),u.remove&&u.remove(s,b))}p&&d.handlers.length===0&&((!u.teardown||u.teardown(s,c,o.handler)===!1)&&nA(s,h,o.handler),delete r[h])}),Object.keys(r).length===0&&tA(s))}function cA(s,t,...e){const n=Ce.create(t);n.delegateTarget=s;const i=pn(n.type);if(i.preDispatch&&i.preDispatch(s,n)===!1)return;const o=aA(s,n);for(let r=0,a=o.length;r<a&&!n.isPropagationStopped();r+=1){const l=o[r];n.currentTarget=l.elem;for(let c=0,h=l.handlers.length;c<h&&!n.isImmediatePropagationStopped();c+=1){const u=l.handlers[c];if(n.rnamespace==null||u.namespace&&n.rnamespace.test(u.namespace)){n.handleObj=u,n.data=u.data;const d=pn(u.originType).handle,g=d?d(l.elem,n,...e):u.handler.call(l.elem,n,...e);g!==void 0&&(n.result=g,g===!1&&(n.preventDefault(),n.stopPropagation()))}}}return i.postDispatch&&i.postDispatch(s,n),n.result}function hA(s,t,e,n){let i=s,o=typeof s=="string"?s:s.type,r=typeof s=="string"||i.namespace==null?[]:i.namespace.split(".");const a=e;if(a.nodeType===3||a.nodeType===8)return;o.indexOf(".")>-1&&(r=o.split("."),o=r.shift(),r.sort());const l=o.indexOf(":")<0&&`on${o}`;i=s instanceof Ce?s:new Ce(o,typeof s=="object"?s:null),i.namespace=r.join("."),i.rnamespace=i.namespace?new RegExp(`(^|\\.)${r.join("\\.(?:.*\\.|)")}(\\.|$)`):null,i.result=void 0,i.target||(i.target=a);const c=[i];Array.isArray(t)?c.push(...t):c.push(t);const h=pn(o);if(!n&&h.trigger&&h.trigger(a,i,t)===!1)return;let u;const d=[a];if(!n&&!h.noBubble&&!Cc(a)){u=h.delegateType||o;let p=a,m=a.parentNode;for(;m!=null;)d.push(m),p=m,m=m.parentNode;const b=a.ownerDocument||document;if(p===b){const y=p.defaultView||p.parentWindow||window;d.push(y)}}let g=a;for(let p=0,m=d.length;p<m&&!i.isPropagationStopped();p+=1){const b=d[p];g=b,i.type=p>1?u:h.bindType||o;const y=Do(b);y&&y.events[i.type]&&y.handler&&y.handler.call(b,...c);const C=l&&b[l]||null;C&&Qo(b)&&(i.result=C.call(b,...c),i.result===!1&&i.preventDefault())}if(i.type=o,!n&&!i.isDefaultPrevented()){const p=h.preventDefault;if((p==null||p(d.pop(),i,t)===!1)&&Qo(a)&&l&&typeof a[o]=="function"&&!Cc(a)){const m=a[l];m&&(a[l]=null),Lo=o,i.isPropagationStopped()&&g.addEventListener(o,gc),a[o](),i.isPropagationStopped()&&g.removeEventListener(o,gc),Lo=void 0,m&&(a[l]=m)}}return i.result}class nt{static on(t,e,n,i,o){return qn.on(t,e,n,i,o),t}static once(t,e,n,i,o){return qn.on(t,e,n,i,o,!0),t}static off(t,e,n,i){return qn.off(t,e,n,i),t}static trigger(t,e,n,i){return hA(e,n,t,i),t}}var qn;(function(s){function t(n,i,o,r,a,l){if(typeof i=="object"){typeof o!="string"&&(r=r||o,o=void 0),Object.keys(i).forEach(c=>t(n,c,o,r,i[c],l));return}if(r==null&&a==null?(a=o,r=o=void 0):a==null&&(typeof o=="string"?(a=r,r=void 0):(a=r,r=o,o=void 0)),a===!1)a=mn;else if(!a)return;if(l){const c=a;a=function(h,...u){return s.off(n,h),c.call(this,h,...u)},yc(a,bc(c))}lA(n,i,a,r,o)}s.on=t;function e(n,i,o,r){const a=i;if(a&&a.preventDefault!=null&&a.handleObj!=null){const l=a.handleObj;e(a.delegateTarget,l.namespace?`${l.originType}.${l.namespace}`:l.originType,l.selector,l.handler);return}if(typeof i=="object"){const l=i;Object.keys(l).forEach(c=>e(n,c,o,l[c]));return}(o===!1||typeof o=="function")&&(r=o,o=void 0),r===!1&&(r=mn),xc(n,i,r,o)}s.off=e})(qn||(qn={}));class vc{constructor(t,e,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=Ky("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(this.onWheelGuard!=null&&!this.onWheelGuard(t))return;this.deltaX+=t.deltaX,this.deltaY+=t.deltaY,t.preventDefault();let e;(this.deltaX!==0||this.deltaY!==0)&&(t.stopPropagation(),e=!0),e===!0&&this.animationFrameId===0&&(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 yn(s){const t=s.getBoundingClientRect(),e=s.ownerDocument.defaultView;return{top:t.top+e.pageYOffset,left:t.left+e.pageXOffset}}function uA(s){return s.getBoundingClientRect().width}function dA(s){return s.getBoundingClientRect().height}function gA(s){const t=_i(s,"position")==="fixed";let e;if(t){const n=s.getBoundingClientRect();e={left:n.left,top:n.top}}else e=yn(s);if(!t){const n=s.ownerDocument;let i=s.offsetParent||n.documentElement;for(;(i===n.body||i===n.documentElement)&&_i(i,"position")==="static";)i=i.parentNode;if(i!==s&&hC(i)){const o=yn(i);e.top-=o.top+$i(i,"borderTopWidth"),e.left-=o.left+$i(i,"borderLeftWidth")}}return{top:e.top-$i(s,"marginTop"),left:e.left-$i(s,"marginLeft")}}function Ae(s,t){const e=GC(s.x,s.y).matrixTransform(t);return new A(e.x,e.y)}function fA(s,t){return new N(Ae(s.start,t),Ae(s.end,t))}function Yt(s,t){const n=se("svg").createSVGPoint();n.x=s.x,n.y=s.y;const i=n.matrixTransform(t);n.x=s.x+s.width,n.y=s.y;const o=n.matrixTransform(t);n.x=s.x+s.width,n.y=s.y+s.height;const r=n.matrixTransform(t);n.x=s.x,n.y=s.y+s.height;const a=n.matrixTransform(t),l=Math.min(i.x,o.x,r.x,a.x),c=Math.max(i.x,o.x,r.x,a.x),h=Math.min(i.y,o.y,r.y,a.y),u=Math.max(i.y,o.y,r.y,a.y);return new P(l,h,c-l,u-h)}function Ec(s,t,e){let n=null;if(!s.ownerSVGElement)return new P(0,0,0,0);try{n=s.getBBox()}catch{n={x:s.clientLeft,y:s.clientTop,width:s.clientWidth,height:s.clientHeight}}return P.create(n)}function ce(s,t={}){let e=null;if(!s.ownerSVGElement||!Pe(s)){if(Vl(s)){const{left:r,top:a,width:l,height:c}=Sc(s);return new P(r,a,l,c)}return new P(0,0,0,0)}let i=t.target;if(!t.recursive){try{e=s.getBBox()}catch{e={x:s.clientLeft,y:s.clientTop,width:s.clientWidth,height:s.clientHeight}}if(!i)return P.create(e);const r=Ro(s,i);return Yt(e,r)}{const r=s.childNodes,a=r.length;if(a===0)return ce(s,{target:i});i||(i=s);let l=null;for(let c=0;c<a;c+=1){const h=r[c];let u=null;h.childNodes.length===0?u=ce(h,{target:i}):u=ce(h,{target:i,recursive:!0}),l?l=l.union(u):l=P.create(u)}return l||new P(0,0,0,0)}}function Sc(s){let t=0,e=0,n=0,i=0;if(s){let o=s;for(;o;)t+=o.offsetLeft,e+=o.offsetTop,o=o.offsetParent,o&&(t+=parseInt($l(o,"borderLeft"),10),e+=parseInt($l(o,"borderTop"),10));n=s.offsetWidth,i=s.offsetHeight}return{left:t,top:e,width:n,height:i}}function Mc(s){const t=e=>{const n=s.getAttribute(e),i=n?parseFloat(n):0;return Number.isNaN(i)?0:i};switch(s instanceof SVGElement&&s.nodeName.toLowerCase()){case"rect":return new P(t("x"),t("y"),t("width"),t("height"));case"circle":return new Lt(t("cx"),t("cy"),t("r"),t("r"));case"ellipse":return new Lt(t("cx"),t("cy"),t("rx"),t("ry"));case"polyline":{const e=es(s);return new yt(e)}case"polygon":{const e=es(s);return e.length>1&&e.push(e[0]),new yt(e)}case"path":{let e=s.getAttribute("d");return _y(e)||(e=Fl(e)),F.parse(e)}case"line":return new N(t("x1"),t("y1"),t("x2"),t("y2"))}return ce(s)}function pA(s){if(s==null)return null;let t=s;do{let e=t.tagName;if(typeof e!="string")return null;if(e=e.toUpperCase(),le(t,"x6-port"))t=t.nextElementSibling;else if(e==="G")t=t.firstElementChild;else if(e==="TITLE")t=t.nextElementSibling;else break}while(t);return t}function mA(s){const t=pA(s);if(!Pe(t)){if(Vl(s)){const{left:i,top:o,width:r,height:a}=Sc(s);return new P(i,o,r,a)}return new P(0,0,0,0)}return Mc(t).bbox()||P.create()}const bA=(s,t)=>s-t;class yA{constructor(t={}){this.comparator=t.comparator||bA,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return this.data.length===0}insert(t,e,n){const i={priority:t,value:e},o=this.data.length;return n&&(i.id=n,this.index[n]=o),this.data.push(i),this.bubbleUp(o),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(typeof n>"u")throw new Error(`Node with id '${t}' was not found in the heap.`);const i=this.data,o=i[n].priority,r=this.comparator(e,o);r<0?(i[n].priority=e,this.bubbleUp(n)):r>0&&(i[n].priority=e,this.bubbleDown(n))}remove(){const t=this.data,e=t[0],n=t.pop();return e!=null&&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,o=t;for(;o>0&&(i=o-1>>>1,this.comparator(e[o].priority,e[i].priority)<0);){n=e[i],e[i]=e[o];let r=e[o].id;r!=null&&(this.index[r]=i),e[o]=n,r=e[o].id,r!=null&&(this.index[r]=o),o=i}}bubbleDown(t){const e=this.data,n=e.length-1;let i=t;for(;;){const o=(i<<1)+1,r=o+1;let a=i;if(o<=n&&this.comparator(e[o].priority,e[a].priority)<0&&(a=o),r<=n&&this.comparator(e[r].priority,e[a].priority)<0&&(a=r),a!==i){const l=e[a];e[a]=e[i];let c=e[i].id;c!=null&&(this.index[c]=a),e[i]=l,c=e[i].id,c!=null&&(this.index[c]=i),i=a}else break}}}function CA(s,t,e=(n,i)=>1){const n={},i={},o={},r=new yA;for(n[t]=0,Object.keys(s).forEach(a=>{a!==t&&(n[a]=1/0),r.insert(n[a],a,a)});!r.isEmpty();){const a=r.remove();o[a]=!0;const l=s[a];for(let c=0;c<l.length;c+=1){const h=l[c];if(!o[h]){const u=n[a]+e(a,h);u<n[h]&&(n[h]=u,i[h]=a,r.updatePriority(h,u))}}}return i}const Wn=/(-?(?:\d*\.\d+|\d+))\s*(px|em|rem|ch|vh|vw|vmin|vmax|%|cm|mm|in|pt|pc|ex|fr|deg|rad|turn)$/,Bc=(s,t)=>{const e=t-s;return n=>s+e*n},Ic=(s,t)=>{const e=Wn,n=e.exec(s),i=e.exec(t),o=i?i[1]:"",r=n?+n[1]:0,a=i?+i[1]:0,l=o.indexOf("."),c=l>0?o[1].length-l-1:0,h=a-r,u=n?n[2]:"";return d=>(r+h*d).toFixed(c)+u},AA=(s,t)=>{const e=parseInt(s.slice(1),16),n=parseInt(t.slice(1),16),i=e&255,o=(n&255)-i,r=e&65280,a=(n&65280)-r,l=e&16711680,c=(n&16711680)-l;return h=>{const u=i+o*h&255,d=r+a*h&65280,g=l+c*h&16711680;return`#${(1<<24|u|d|g).toString(16).slice(1)}`}},wA=(s,t)=>{const e=o=>{const r=[];if(!o)return r;const a=/(\w+)\(([^)]+)\)/g;let l=a.exec(o);for(;l!==null;)l[1]&&l[2]&&r.push({name:l[1],values:l[2].split(/\s*,\s*/).filter(Boolean)}),l=a.exec(o);return r},n=e(s),i=e(t);return n.length===0||i.length===0?()=>s:o=>{const r=[];for(let a=0;a<Math.min(n.length,i.length);a++){const l=n[a],c=i[a];if(!(!l||!c)&&l.name===c.name&&l.values.length>0&&l.values.length===c.values.length){const h=[];for(let u=0;u<l.values.length;u++){const d=l.values[u],g=c.values[u];if(!(d===void 0||g===void 0))if(Wn.test(d)||Wn.test(g)){const p=Ic(d,g);h.push(p(o))}else if(!Number.isNaN(parseFloat(d))&&!Number.isNaN(parseFloat(g))){const p=Bc(parseFloat(d),parseFloat(g));h.push(p(o).toString())}else h.push(d)}h.length>0&&r.push(`${l.name}(${h.join(", ")})`)}}return r.length>0?r.join(" "):s}},Pc=s=>s,xA=s=>s*s,vA=s=>s*s*s,EA=s=>{if(s<=0)return 0;if(s>=1)return 1;const t=s*s,e=t*s;return 4*(s<.5?e:3*(s-t)+e-.75)},SA=s=>Math.pow(2,10*(s-1)),MA=s=>{for(let t=0,e=1;;t+=e,e/=2)if(s>=(7-4*t)/11){const n=(11-6*t-11*s)/4;return-n*n+e*e}},BA={reverse(s){return t=>1-s(1-t)},reflect(s){return t=>.5*(t<.5?s(2*t):2-s(2-2*t))},clamp(s,t=0,e=1){return n=>{const i=s(n);return i<t?t:i>e?e:i}},back(s=1.70158){return t=>t*t*((s+1)*t-s)},elastic(s=1.5){return t=>Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*s/3*t)}};function IA(s){return-1*Math.cos(s*(Math.PI/2))+1}function PA(s){return Math.sin(s*(Math.PI/2))}function TA(s){return-.5*(Math.cos(Math.PI*s)-1)}function kA(s){return s*s}function OA(s){return s*(2-s)}function NA(s){return s<.5?2*s*s:-1+(4-2*s)*s}function RA(s){return s*s*s}function DA(s){const t=s-1;return t*t*t+1}function QA(s){return s<.5?4*s*s*s:(s-1)*(2*s-2)*(2*s-2)+1}function LA(s){return s*s*s*s}function FA(s){const t=s-1;return 1-t*t*t*t}function zA(s){const t=s-1;return s<.5?8*s*s*s*s:1-8*t*t*t*t}function UA(s){return s*s*s*s*s}function KA(s){const t=s-1;return 1+t*t*t*t*t}function JA(s){const t=s-1;return s<.5?16*s*s*s*s*s:1+16*t*t*t*t*t}function jA(s){return s===0?0:Math.pow(2,10*(s-1))}function VA(s){return s===1?1:-Math.pow(2,-10*s)+1}function GA(s){if(s===0||s===1)return s;const t=s*2,e=t-1;return t<1?.5*Math.pow(2,10*e):.5*(-Math.pow(2,-10*e)+2)}function YA(s){const t=s/1;return-1*(Math.sqrt(1-t*s)-1)}function HA(s){const t=s-1;return Math.sqrt(1-t*t)}function qA(s){const t=s*2,e=t-2;return t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-e*e)+1)}function WA(s,t=1.70158){return s*s*((t+1)*s-t)}function XA(s,t=1.70158){const e=s/1-1;return e*e*((t+1)*e+t)+1}function _A(s,t=1.70158){const e=s*2,n=e-2,i=t*1.525;return e<1?.5*e*e*((i+1)*e-i):.5*(n*n*((i+1)*n+i)+2)}function $A(s,t=.7){if(s===0||s===1)return s;const n=s/1-1,i=1-t,o=i/(2*Math.PI)*Math.asin(1);return-(Math.pow(2,10*n)*Math.sin((n-o)*(2*Math.PI)/i))}function ZA(s,t=.7){const e=1-t,n=s*2;if(s===0||s===1)return s;const i=e/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*n)*Math.sin((n-i)*(2*Math.PI)/e)+1}function tw(s,t=.65){const e=1-t;if(s===0||s===1)return s;const n=s*2,i=n-1,o=e/(2*Math.PI)*Math.asin(1);return n<1?-.5*(Math.pow(2,10*i)*Math.sin((i-o)*(2*Math.PI)/e)):Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/e)*.5+1}function Fo(s){const t=s/1;if(t<1/2.75)return 7.5625*t*t;if(t<2/2.75){const e=t-.5454545454545454;return 7.5625*e*e+.75}if(t<2.5/2.75){const e=t-.8181818181818182;return 7.5625*e*e+.9375}{const e=t-.9545454545454546;return 7.5625*e*e+.984375}}function Tc(s){return 1-Fo(1-s)}function ew(s){return s<.5?Tc(s*2)*.5:Fo(s*2-1)*.5+.5}const nw=Object.freeze(Object.defineProperty({__proto__:null,bounce:MA,cubic:vA,decorators:BA,easeInBack:WA,easeInBounce:Tc,easeInCirc:YA,easeInCubic:RA,easeInElastic:$A,easeInExpo:jA,easeInOutBack:_A,easeInOutBounce:ew,easeInOutCirc:qA,easeInOutCubic:QA,easeInOutElastic:tw,easeInOutExpo:GA,easeInOutQuad:NA,easeInOutQuart:zA,easeInOutQuint:JA,easeInOutSine:TA,easeInQuad:kA,easeInQuart:LA,easeInQuint:UA,easeInSine:IA,easeOutBack:XA,easeOutBounce:Fo,easeOutCirc:HA,easeOutCubic:DA,easeOutElastic:ZA,easeOutExpo:VA,easeOutQuad:OA,easeOutQuart:FA,easeOutQuint:KA,easeOutSine:PA,exponential:SA,inout:EA,linear:Pc,quad:xA},Symbol.toStringTag,{value:"Module"}));function zo(s,t){const e=[];for(let n=0;n<s.length;n+=2){const i=s[n],o=s[n+1],r=Array.isArray(t)?t:[t],a=Pl(i,o,r);e.push(a)}return go(e)}class iw{constructor(){this.listeners={}}on(t,e,n){return e==null?this:(this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e,n),this)}once(t,e,n){const i=(...o)=>(this.off(t,i),zo([e,n],o));return this.on(t,i,this)}off(t,e,n){if(!(t||e||n))return this.listeners={},this;const i=this.listeners;return(t?[t]:Object.keys(i)).forEach(r=>{const a=i[r];if(a){if(!(e||n)){delete i[r];return}for(let l=a.length-2;l>=0;l-=2)e&&a[l]!==e||n&&a[l+1]!==n||a.splice(l,2)}}),this}trigger(t,...e){let n=!0;if(t!=="*"){const o=this.listeners[t];o!=null&&(n=zo([...o],e))}const i=this.listeners["*"];return i!=null?go([n,zo([...i],[t,...e])]):n}emit(t,...e){return this.trigger(t,...e)}}class Cn{get disposed(){return this._disposed===!0}dispose(){this._disposed=!0}}function q(){return(s,t,e)=>{const n=e.value,i=s.__proto__;e.value=function(...o){this.disposed||(n.call(this,...o),i.dispose.call(this))}}}class Ot extends iw{dispose(){this.off()}}H([q()],Ot.prototype,"dispose",null),SC(Ot,Cn);class Uo{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 Ko(s){const t=[],e=[];return Array.isArray(s)?t.push(...s):s.split("|").forEach(n=>{n.indexOf("&")===-1?t.push(n):e.push(...n.split("&"))}),{or:t,and:e}}function sw(s,t){if(s!=null&&t!=null){const e=Ko(s),n=Ko(t),i=e.or.sort(),o=n.or.sort(),r=e.and.sort(),a=n.and.sort(),l=(c,h)=>c.length===h.length&&(c.length===0||c.every((u,d)=>u===h[d]));return l(i,o)&&l(r,a)}return s==null&&t==null}function Te(s,t,e){if(t==null||Array.isArray(t)&&t.length===0)return e?s.altKey!==!0&&s.ctrlKey!==!0&&s.metaKey!==!0&&s.shiftKey!==!0:!0;const{or:n,and:i}=Ko(t),o=r=>{const a=`${r.toLowerCase()}Key`;return s[a]===!0};return n.some(r=>o(r))&&i.every(r=>o(r))}class ut{static create(t){return new ut(t)}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(typeof t=="object"){Object.entries(t).forEach(([r,a])=>{this.register(r,a,e)});return}this.exist(t)&&!n&&!Bl()&&this.onDuplicated(t);const i=this.options.process,o=i?D(i,this,t,e):e;return this.data[t]=o,o}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?this.data[t]!=null:!1}onDuplicated(t){try{throw this.options.onConflict&&D(this.options.onConflict,this,t),new Error(`${zi(this.options.type)} with name '${t}' already registered.`)}catch(e){throw e}}onNotFound(t,e){throw new Error(this.getSpellingSuggestion(t,e))}getSpellingSuggestion(t,e){const n=this.getSpellingSuggestionForName(t),i=e?`${e} ${cy(this.options.type)}`:this.options.type;return`${zi(i)} with name '${t}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(t){return AC(t,Object.keys(this.data),e=>e)}}const ow={},kc={position:os("x","width","origin")},Oc={position:os("y","height","origin")},rw={position:os("x","width","corner")},aw={position:os("y","height","corner")},Nc={set:ke("width","width")},Rc={set:ke("height","height")},lw={set:ke("rx","width")},cw={set:ke("ry","height")},Dc={set:(s=>{const t=ke(s,"width"),e=ke(s,"height");return function(n,i){const o=i.refBBox,r=o.height>o.width?t:e;return D(r,this,n,i)}})("r")},hw={set(s,{refBBox:t}){let e=parseFloat(s);const n=ye(s);n&&(e/=100);const i=Math.sqrt(t.height*t.height+t.width*t.width);let o;return Number.isFinite(e)&&(n||e>=0&&e<=1?o=e*i:o=Math.max(e+i,0)),{r:o}}},uw={set:ke("cx","width")},dw={set:ke("cy","height")},Qc={set:zc({resetOffset:!0})},gw={set:zc({resetOffset:!1})},Lc={set:Uc({resetOffset:!0})},fw={set:Uc({resetOffset:!1})},pw=Dc,mw=Qc,bw=Lc,yw=kc,Cw=Oc,Aw=Nc,ww=Rc;function os(s,t,e){return(n,{refBBox:i})=>{if(n==null)return null;let o=parseFloat(n);const r=ye(n);r&&(o/=100);let a;if(Number.isFinite(o)){const c=i[e];r||o>0&&o<1?a=c[s]+i[t]*o:a=c[s]+o}const l=new A;return l[s]=a||0,l}}function ke(s,t){return(e,{refBBox:n})=>{let i=parseFloat(e);const o=ye(e);o&&(i/=100);const r={};if(Number.isFinite(i)){const a=o||i>=0&&i<=1?i*n[t]:Math.max(i+n[t],0);r[s]=a}return r}}function Fc(s,t){const e="x6-shape",n=t&&t.resetOffset;return(i,{elem:o,refBBox:r})=>{let a=Ve(o,e);if(!a||a.value!==i){const m=s(i);a={value:i,shape:m,shapeBBox:m.bbox()},Ve(o,e,a)}const l=a.shape.clone(),c=a.shapeBBox.clone(),h=c.getOrigin(),u=r.getOrigin();c.x=u.x,c.y=u.y;const d=r.getMaxScaleToFit(c,u),g=c.width===0||r.width===0?1:d.sx,p=c.height===0||r.height===0?1:d.sy;return l.scale(g,p,h),n&&l.translate(-h.x,-h.y),l}}function zc(s){function t(n){return F.parse(n)}const e=Fc(t,s);return(n,i)=>({d:e(n,i).serialize()})}function Uc(s){const t=Fc(e=>new yt(e),s);return(e,n)=>({points:t(e,n).serialize()})}const xw={qualify:Zt,set(s,{view:t}){return`url(#${t.graph.defineGradient(s)})`}},vw={qualify:Zt,set(s,{view:t}){const e=t.cell,n=Object.assign({},s);if(e.isEdge()&&n.type==="linearGradient"){const i=t,o=i.sourcePoint,r=i.targetPoint;n.id=`gradient-${n.type}-${e.id}`,n.attrs=Object.assign(Object.assign({},n.attrs),{x1:o.x,y1:o.y,x2:r.x,y2:r.y,gradientUnits:"userSpaceOnUse"}),t.graph.defs.remove(n.id)}return`url(#${t.graph.defineGradient(n)})`}},Kc={qualify(s,{attrs:t}){return t.textWrap==null||!Zt(t.textWrap)},set(s,{view:t,elem:e,attrs:n}){const i="x6-text",o=Ve(e,i),r=h=>{try{return JSON.parse(h)}catch{return h}},a={x:n.x,eol:n.eol,annotations:r(n.annotations),textPath:r(n["text-path"]||n.textPath),textVerticalAnchor:n["text-vertical-anchor"]||n.textVerticalAnchor,displayEmpty:(n["display-empty"]||n.displayEmpty)==="true",lineHeight:n["line-height"]||n.lineHeight},l=n["font-size"]||n.fontSize,c=JSON.stringify([s,a]);if(l&&e.setAttribute("font-size",l),o==null||o!==c){const h=a.textPath;if(h!=null&&typeof h=="object"){const u=h.selector;if(typeof u=="string"){const d=t.find(u)[0];d instanceof SVGPathElement&&(bo(d),a.textPath=Object.assign({"xlink:href":`#${d.id}`},h))}}ic(e,`${s}`,a),Ve(e,i,c)}}},Ew={qualify:Zt,set(s,{view:t,elem:e,attrs:n,refBBox:i}){const o=s,r=o.width||0;ye(r)?i.width*=parseFloat(r)/100:r<=0?i.width+=r:i.width=r;const a=o.height||0;ye(a)?i.height*=parseFloat(a)/100:a<=0?i.height+=a:i.height=a;let l,c=o.text;c==null&&(c=n.text||(e==null?void 0:e.textContent)),c!=null?l=oc(`${c}`,i,{"font-weight":n["font-weight"]||n.fontWeight,"font-size":n["font-size"]||n.fontSize,"font-family":n["font-family"]||n.fontFamily,lineHeight:n.lineHeight},{ellipsis:o.ellipsis}):l="",D(Kc.set,this,l,{view:t,elem:e,attrs:n,refBBox:i,cell:t.cell})}},An=(s,{attrs:t})=>t.text!==void 0,Sw={qualify:An},Mw={qualify:An},Bw={qualify:An},Iw={qualify:An},Pw={qualify:An},Tw={qualify:An},kw={qualify(s,{elem:t}){return t instanceof SVGElement},set(s,{elem:t}){const e="x6-title",n=`${s}`,i=Ve(t,e);if(i==null||i!==n){Ve(t,e,n);const o=t.firstChild;if(o&&o.tagName.toUpperCase()==="TITLE"){const r=o;r.textContent=n}else{const r=document.createElementNS(t.namespaceURI,"title");r.textContent=n,t.insertBefore(r,o)}}}},Ow={offset:Jc("x","width","right")},Nw={offset:Jc("y","height","bottom")},Rw={offset(s,{refBBox:t}){return s?{x:-t.x,y:-t.y}:{x:0,y:0}}};function Jc(s,t,e){return(n,{refBBox:i})=>{const o=new A;let r;return n==="middle"?r=i[t]/2:n===e?r=i[t]:typeof n=="number"&&Number.isFinite(n)?r=n>-1&&n<1?-i[t]*n:-n:ye(n)?r=i[t]*parseFloat(n)/100:r=0,o[s]=-(i[s]+r),o}}const Dw={qualify:Zt,set(s,{elem:t}){$(t,s)}},Qw={set(s,{elem:t}){t.innerHTML=`${s}`}},Lw={qualify:Zt,set(s,{view:t}){return`url(#${t.graph.defineFilter(s)})`}},Fw={set(s){return s!=null&&typeof s=="object"&&s.id?s.id:s}},zw=s=>{var{size:t,width:e,height:n,offset:i,open:o}=s,r=K(s,["size","width","height","offset","open"]);return jc({size:t,width:e,height:n,offset:i},o===!0,!0,void 0,r)},Uw=s=>{var{size:t,width:e,height:n,offset:i,factor:o}=s,r=K(s,["size","width","height","offset","factor"]);return jc({size:t,width:e,height:n,offset:i},!1,!1,o,r)};function jc(s,t,e,n=3/4,i={}){const o=s.size||10,r=s.width||o,a=s.height||o,l=new F,c={};if(t)l.moveTo(r,0).lineTo(0,a/2).lineTo(r,a),c.fill="none";else{if(l.moveTo(0,a/2),l.lineTo(r,0),!e){const h=Je(n,0,1);l.lineTo(r*h,a/2)}l.lineTo(r,a),l.close()}return Object.assign(Object.assign(Object.assign({},c),i),{tagName:"path",d:hn(l.serialize(),{x:s.offset!=null?s.offset:-r/2})})}const Kw=s=>{var{size:t,width:e,height:n,offset:i}=s,o=K(s,["size","width","height","offset"]);const r=t||10,a=e||r,l=n||r,c=new F;return c.moveTo(0,l/2).lineTo(a/2,0).lineTo(a,l/2).lineTo(a/2,l).close(),Object.assign(Object.assign({},o),{tagName:"path",d:hn(c.serialize(),i??-a/2)})},Jw=s=>{var{d:t,offsetX:e,offsetY:n}=s,i=K(s,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},i),{tagName:"path",d:hn(t,e,n)})},jw=s=>{var{size:t,width:e,height:n,offset:i}=s,o=K(s,["size","width","height","offset"]);const r=t||10,a=e||r,l=n||r,c=new F;return c.moveTo(0,0).lineTo(a,l).moveTo(0,l).lineTo(a,0),Object.assign(Object.assign({},o),{tagName:"path",fill:"none",d:hn(c.serialize(),i||-a/2)})},Vw=s=>{var{width:t,height:e,offset:n,open:i,flip:o}=s,r=K(s,["width","height","offset","open","flip"]);let a=e||6;const l=t||10,c=i===!0,h=o===!0,u=Object.assign(Object.assign({},r),{tagName:"path"});h&&(a=-a);const d=new F;return d.moveTo(0,a).lineTo(l,0),c?u.fill="none":(d.lineTo(l,a),d.close()),u.d=hn(d.serialize(),{x:n||-l/2,y:a/2}),u},Vc=s=>{var{r:t}=s,e=K(s,["r"]);const n=t||5;return Object.assign(Object.assign({cx:n},e),{tagName:"circle",r:n})},Gw=Object.freeze(Object.defineProperty({__proto__:null,async:Vw,block:zw,circle:Vc,circlePlus:s=>{var{r:t}=s,e=K(s,["r"]);const n=t||5,i=new F;return i.moveTo(n,0).lineTo(n,n*2),i.moveTo(0,n).lineTo(n*2,n),{children:[Object.assign(Object.assign({},Vc({r:n})),{fill:"none"}),Object.assign(Object.assign({},e),{tagName:"path",d:hn(i.serialize(),-n)})]}},classic:Uw,cross:jw,diamond:Kw,ellipse:s=>{var{rx:t,ry:e}=s,n=K(s,["rx","ry"]);const i=t||5,o=e||5;return Object.assign(Object.assign({cx:i},n),{tagName:"ellipse",rx:i,ry:o})},path:Jw},Symbol.toStringTag,{value:"Module"})),Xn=ut.create({type:"marker"});Xn.register(Gw,!0);function Jo(s){return typeof s=="string"||Zt(s)}const Yw={qualify:Jo,set(s,{view:t,attrs:e}){return jo("marker-start",s,t,e)}},Hw={qualify:Jo,set(s,{view:t,attrs:e}){return jo("marker-end",s,t,e,{transform:"rotate(180)"})}},qw={qualify:Jo,set(s,{view:t,attrs:e}){return jo("marker-mid",s,t,e)}};function jo(s,t,e,n,i={}){const o=typeof t=="string"?{name:t}:t,{name:r,args:a}=o,l=K(o,["name","args"]);let c=l;if(r&&typeof r=="string"){const u=Xn.get(r);if(u)c=u(Object.assign(Object.assign({},l),a));else return Xn.onNotFound(r)}const h=Object.assign(Object.assign(Object.assign({},Ww(n,s)),i),c);return{[s]:`url(#${e.graph.defineMarker(h)})`}}function Ww(s,t){const e={},n=s.stroke;if(typeof n=="string"&&(e.stroke=n,e.fill=n),t!=="marker-mid"){const i=parseFloat(s.strokeWidth||s["stroke-width"]);if(Number.isFinite(i)&&i>1){const o=Math.ceil(i/2);e.refX=t==="marker-start"?o:-o}}return e}const _n=(s,{view:t})=>t.cell.isEdge(),Xw={qualify:_n,set(s,t){var e,n,i,o;const r=t.view,a=s.reverse||!1,l=s.stubs||0;let c;if(Number.isFinite(l)&&l!==0)if(a){let h,u;const d=r.getConnectionLength()||0;l<0?(h=(d+l)/2,u=-l):(h=l,u=d-l*2);const g=r.getConnection();c=(o=(i=(n=(e=g==null?void 0:g.divideAtLength(h))===null||e===void 0?void 0:e[1])===null||n===void 0?void 0:n.divideAtLength(u))===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.serialize()}else{let h;l<0?h=((r.getConnectionLength()||0)+l)/2:h=l;const u=r.getConnection();if(u){const d=u.divideAtLength(h),g=u.divideAtLength(-h);d&&g&&(c=`${d[0].serialize()} ${g[1].serialize()}`)}}return{d:c||r.getConnectionPathData()}}},Gc={qualify:_n,set:rs("getTangentAtLength",{rotate:!0})},_w={qualify:_n,set:rs("getTangentAtLength",{rotate:!1})},Yc={qualify:_n,set:rs("getTangentAtRatio",{rotate:!0})},$w={qualify:_n,set:rs("getTangentAtRatio",{rotate:!1})},Zw=Gc,tx=Yc;function rs(s,t){const e={x:1,y:0};return(n,i)=>{let o,r;const a=i.view,l=a[s](Number(n));return l?(r=t.rotate?l.vector().vectorAngle(e):0,o=l.start):(o=a.path.start,r=0),r===0||Number.isNaN(r)?{transform:`translate(${o.x},${o.y})`}:{transform:`translate(${o.x},${o.y}) rotate(${r})`}}}const ex=Object.freeze(Object.defineProperty({__proto__:null,annotations:Iw,atConnectionLength:Zw,atConnectionLengthIgnoreGradient:_w,atConnectionLengthKeepGradient:Gc,atConnectionRatio:tx,atConnectionRatioIgnoreGradient:$w,atConnectionRatioKeepGradient:Yc,connection:Xw,displayEmpty:Tw,eol:Pw,fill:xw,filter:Lw,html:Qw,lineHeight:Sw,port:Fw,ref:ow,refCx:uw,refCy:dw,refD:mw,refDKeepOffset:gw,refDResetOffset:Qc,refDx:rw,refDy:aw,refHeight:Rc,refHeight2:ww,refPoints:bw,refPointsKeepOffset:fw,refPointsResetOffset:Lc,refR:pw,refRCircumscribed:hw,refRInscribed:Dc,refRx:lw,refRy:cw,refWidth:Nc,refWidth2:Aw,refX:kc,refX2:yw,refY:Oc,refY2:Cw,resetOffset:Rw,sourceMarker:Yw,stroke:vw,style:Dw,targetMarker:Hw,text:Kc,textPath:Bw,textVerticalAnchor:Mw,textWrap:Ew,title:kw,vertexMarker:qw,xAlign:Ow,yAlign:Nw},Symbol.toStringTag,{value:"Module"})),nx={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"};function ix(s,t,e){return!!(s!=null&&(typeof s=="string"||typeof s.qualify!="function"||D(s.qualify,this,t,e)))}const Hc=Object.assign(Object.assign({},nx),ex),$n=ut.create({type:"attribute definition"});$n.register(Hc,!0);const qc=s=>{const t=document.createElement("canvas"),e=s.width,n=s.height;t.width=e*2,t.height=n;const i=t.getContext("2d");return i.drawImage(s,0,0,e,n),i.translate(2*e,0),i.scale(-1,1),i.drawImage(s,0,0,e,n),t},Wc=s=>{const t=document.createElement("canvas"),e=s.width,n=s.height;t.width=e,t.height=n*2;const i=t.getContext("2d");return i.drawImage(s,0,0,e,n),i.translate(0,2*n),i.scale(1,-1),i.drawImage(s,0,0,e,n),t},Xc=s=>{const t=document.createElement("canvas"),e=s.width,n=s.height;t.width=2*e,t.height=2*n;const i=t.getContext("2d");return i.drawImage(s,0,0,e,n),i.setTransform(-1,0,0,-1,t.width,t.height),i.drawImage(s,0,0,e,n),i.setTransform(-1,0,0,1,t.width,0),i.drawImage(s,0,0,e,n),i.setTransform(1,0,0,-1,0,t.height),i.drawImage(s,0,0,e,n),t},as=Object.assign({},Object.freeze(Object.defineProperty({__proto__:null,flipX:qc,flipXY:Xc,flipY:Wc,watermark:(s,t)=>{const e=s.width,n=s.height,i=document.createElement("canvas");i.width=e*3,i.height=n*3;const o=i.getContext("2d"),r=t.angle!=null?-t.angle:-20,a=It(r),l=i.width/4,c=i.height/4;for(let h=0;h<4;h+=1)for(let u=0;u<4;u+=1)(h+u)%2>0&&(o.setTransform(1,0,0,1,(2*h-1)*l,(2*u-1)*c),o.rotate(a),o.drawImage(s,-e/2,-n/2,e,n));return i}},Symbol.toStringTag,{value:"Module"})));as["flip-x"]=qc,as["flip-y"]=Wc,as["flip-xy"]=Xc;const ls=ut.create({type:"background pattern"});ls.register(as,!0);function cs(s,t,e){let n;if(typeof e=="object"){if(Number.isFinite(e.y)){const o=new N(t,s),{start:r,end:a}=o.parallel(e.y);t=r,s=a}n=e.x}else n=e;if(n==null||!Number.isFinite(n))return s;const i=s.distance(t);return n===0&&i>0?s:s.move(t,-Math.min(n,i-1))}function hs(s){const t=s.getAttribute("stroke-width");return t===null?0:parseFloat(t)||0}function sx(s){if(s==null)return null;let t=s;do{let e=t.tagName;if(typeof e!="string")return null;if(e=e.toUpperCase(),e==="G")t=t.firstElementChild;else if(e==="TITLE")t=t.nextElementSibling;else break}while(t);return t}const _c=(s,t,e,n)=>{const i=t.getBBoxOfElement(e);n.stroked&&i.inflate(hs(e)/2);const o=s.intersect(i),r=o&&o.length?s.start.closest(o):s.end;return cs(r,s.start,n.offset)},ox=function(s,t,e,n,i){const o=t.cell,r=o.isNode()?o.getAngle():0;if(r===0)return D(_c,this,s,t,e,n,i);const a=t.getUnrotatedBBoxOfElement(e);n.stroked&&a.inflate(hs(e)/2);const l=a.getCenter(),c=s.clone().rotate(r,l),h=c.setLength(1e6).intersect(a),u=h&&h.length?c.start.closest(h).rotate(-r,l):s.end;return cs(u,s.start,n.offset)},rx=(s,t,e,n)=>{let i,o;const r=s.end,a=n.selector;if(typeof a=="string"?i=t.findOne(a):Array.isArray(a)?i=To(e,a):i=sx(e),!Pe(i)){if(i===e||!Pe(e))return r;i=e}const l=t.getShapeOfElement(i),c=t.getMatrixOfElement(i),h=t.getRootTranslatedMatrix(),u=t.getRootRotatedMatrix(),d=h.multiply(u).multiply(c),g=d.inverse(),p=fA(s,g),m=p.start.clone(),b=t.getDataOfElement(i);if(n.insideout===!1){b.shapeBBox==null&&(b.shapeBBox=l.bbox());const x=b.shapeBBox;if(x!=null&&x.containsPoint(m))return r}n.extrapolate===!0&&p.setLength(1e6);let y;if(F.isPath(l)){const x=n.precision||2;b.segmentSubdivisions==null&&(b.segmentSubdivisions=l.getSegmentSubdivisions({precision:x})),y={precision:x,segmentSubdivisions:b.segmentSubdivisions},o=p.intersect(l,y)}else o=p.intersect(l);o?Array.isArray(o)&&(o=m.closest(o)):n.sticky===!0&&(P.isRectangle(l)?o=l.getNearestPointToPoint(m):Lt.isEllipse(l)?o=l.intersectsWithLineFromCenterToPoint(m):o=l.closestPoint(m,y));const C=o?Ae(o,d):r;let w=n.offset||0;return n.stroked!==!1&&(typeof w=="object"?(w=Object.assign({},w),w.x==null&&(w.x=0),w.x+=hs(i)/2):w+=hs(i)/2),cs(C,s.start,w)};function ax(s,t,e=0){const{start:n,end:i}=s;let o,r,a,l;switch(t){case"left":l="x",o=i,r=n,a=-1;break;case"right":l="x",o=n,r=i,a=1;break;case"top":l="y",o=i,r=n,a=-1;break;case"bottom":l="y",o=n,r=i,a=1;break;default:return}n[l]<i[l]?o[l]=r[l]:r[l]=o[l],Number.isFinite(e)&&(o[l]+=a*e,r[l]+=a*e)}const lx=Object.freeze(Object.defineProperty({__proto__:null,anchor:(s,t,e,n)=>{const{alignOffset:i,align:o}=n;return o&&ax(s,o,i),cs(s.end,s.start,n.offset)},bbox:_c,boundary:rx,rect:ox},Symbol.toStringTag,{value:"Module"})),Zn=ut.create({type:"connection point"});Zn.register(lx,!0);const $c=1,us=1/3,ds=2/3;let ti=[],gs=[];function cx(s){let t=s.graph._jumpOverUpdateList;if(t==null&&(t=s.graph._jumpOverUpdateList=[],s.graph.on("cell:mouseup",()=>{const e=s.graph._jumpOverUpdateList;setTimeout(()=>{for(let n=0;n<e.length;n+=1)e[n].update()})}),s.graph.on("model:reseted",()=>{t=s.graph._jumpOverUpdateList=[]})),t.indexOf(s)<0){t.push(s);const e=()=>t.splice(t.indexOf(s),1);s.cell.once("change:connector",e),s.cell.once("removed",e)}}function Vo(s,t,e=[]){const n=[s,...e,t],i=[];return n.forEach((o,r)=>{const a=n[r+1];a!=null&&i.push(new N(o,a))}),i}function hx(s,t){const e=[];return t.forEach(n=>{const i=s.intersectsWithLine(n);if(i){const{x:o,y:r}=i,{start:a,end:l}=n,c=Math.round(a.x)===Math.round(o)&&Math.round(a.y)===Math.round(r),h=Math.round(l.x)===Math.round(o)&&Math.round(l.y)===Math.round(r);if(c||h)return;e.push(i)}}),e}function Zc(s,t){return new N(s,t).squaredLength()}function ux(s,t,e){return t.reduce((n,i,o)=>{if(gs.includes(i))return n;const r=n.pop()||s,a=A.create(i).move(r.start,-e);let l=A.create(i).move(r.start,+e);const c=t[o+1];if(c!=null){const d=l.distance(c);d<=e&&(l=c.move(r.start,d),gs.push(c))}else if(a.distance(r.end)<e*2+$c)return n.push(r),n;if(l.distance(r.start)<e*2+$c)return n.push(r),n;const u=new N(a,l);return ti.push(u),n.push(new N(r.start,a),u,new N(l,r.end)),n},[])}function th(s,t,e,n){const i=new F;let o;return o=F.createSegment("M",s[0].start),i.appendSegment(o),s.forEach((r,a)=>{if(ti.includes(r)){let l,c,h,u;if(e==="arc"){l=-90,c=r.start.diff(r.end),(c.x<0||c.x===0&&c.y<0)&&(l+=180);const g=r.getCenter(),p=new N(g,r.end).rotate(l,g);let m;m=new N(r.start,g),h=m.pointAt(2/3).rotate(l,r.start),u=p.pointAt(1/3).rotate(-l,p.end),o=F.createSegment("C",h,u,p.end),i.appendSegment(o),m=new N(g,r.end),h=p.pointAt(1/3).rotate(l,p.end),u=m.pointAt(1/3).rotate(-l,r.end),o=F.createSegment("C",h,u,r.end),i.appendSegment(o)}else if(e==="gap")o=F.createSegment("M",r.end),i.appendSegment(o);else if(e==="cubic"){l=r.start.theta(r.end);const d=t*.6;let g=t*1.35;c=r.start.diff(r.end),(c.x<0||c.x===0&&c.y<0)&&(g*=-1),h=new A(r.start.x+d,r.start.y+g).rotate(l,r.start),u=new A(r.end.x-d,r.end.y+g).rotate(l,r.end),o=F.createSegment("C",h,u,r.end),i.appendSegment(o)}}else{const l=s[a+1];n===0||!l||ti.includes(l)?(o=F.createSegment("L",r.end),i.appendSegment(o)):dx(n,i,r.end,r.start,l.end)}}),i}function dx(s,t,e,n,i){const o=e.distance(n)/2,r=e.distance(i)/2,a=-Math.min(s,o),l=-Math.min(s,r),c=e.clone().move(n,a).round(),h=e.clone().move(i,l).round(),u=new A(us*c.x+ds*e.x,ds*e.y+us*c.y),d=new A(us*h.x+ds*e.x,ds*e.y+us*h.y);let g;g=F.createSegment("L",c),t.appendSegment(g),g=F.createSegment("C",u,d,h),t.appendSegment(g)}const eh=Object.freeze(Object.defineProperty({__proto__:null,jumpover:function(s,t,e,n={}){ti=[],gs=[],cx(this);const i=n.size||5,o=n.type||"arc",r=n.radius||0,a=n.ignoreConnectors||["smooth"],l=this.graph,h=l.model.getEdges();if(h.length===1)return th(Vo(s,t,e),i,o,r);const u=this.cell,d=h.indexOf(u),g=l.options.connecting.connector||{},p=h.filter((x,E)=>{const B=x.getConnector()||g;return a.includes(B.name)?!1:E>d?B.name!=="jumpover":!0}),m=p.map(x=>l.findViewByCell(x)),b=Vo(s,t,e),y=m.map(x=>x==null?[]:x===this?b:Vo(x.sourcePoint,x.targetPoint,x.routePoints)),C=[];b.forEach(x=>{const E=p.reduce((B,v,M)=>{if(v!==u){const I=hx(x,y[M]);B.push(...I)}return B},[]).sort((B,v)=>Zc(x.start,B)-Zc(x.start,v));E.length>0?C.push(...ux(x,E,i)):C.push(x)});const w=th(C,i,o,r);return ti=[],gs=[],n.raw?w:w.serialize()},loop:(s,t,e,n={})=>{const i=e.length===3?0:1,o=A.create(e[0+i]),r=A.create(e[2+i]),a=A.create(e[1+i]);if(!A.equals(s,t)){const c=new A((s.x+t.x)/2,(s.y+t.y)/2),h=c.angleBetween(A.create(s).rotate(90,c),a);h>1&&(o.rotate(180-h,c),r.rotate(180-h,c),a.rotate(180-h,c))}const l=`
5
+ M ${s.x} ${s.y}
6
+ Q ${o.x} ${o.y} ${a.x} ${a.y}
7
+ Q ${r.x} ${r.y} ${t.x} ${t.y}
8
+ `;return n.raw?F.parse(l):l},normal:(s,t,e,n={})=>{const i=[s,...e,t],o=new yt(i),r=new F(o);return n.raw?r:r.serialize()},rounded:(s,t,e,n={})=>{const i=new F;i.appendSegment(F.createSegment("M",s));const o=1/3,r=2/3,a=n.radius||10;let l,c;for(let h=0,u=e.length;h<u;h+=1){const d=A.create(e[h]),g=e[h-1]||s,p=e[h+1]||t;l=c||d.distance(g)/2,c=d.distance(p)/2;const m=-Math.min(a,l),b=-Math.min(a,c),y=d.clone().move(g,m).round(),C=d.clone().move(p,b).round(),w=new A(o*y.x+r*d.x,r*d.y+o*y.y),x=new A(o*C.x+r*d.x,r*d.y+o*C.y);i.appendSegment(F.createSegment("L",y)),i.appendSegment(F.createSegment("C",w,x,C))}return i.appendSegment(F.createSegment("L",t)),n.raw?i:i.serialize()},smooth:(s,t,e,n={})=>{let i,o=n.direction;if(e&&e.length!==0){const r=[s,...e,t],a=dt.throughPoints(r);i=new F(a)}else if(i=new F,i.appendSegment(F.createSegment("M",s)),o||(o=Math.abs(s.x-t.x)>=Math.abs(s.y-t.y)?"H":"V"),o==="H"){const r=(s.x+t.x)/2;i.appendSegment(F.createSegment("C",r,s.y,r,t.y,t.x,t.y))}else{const r=(s.y+t.y)/2;i.appendSegment(F.createSegment("C",s.x,r,t.x,r,t.x,t.y))}return n.raw?i:i.serialize()}},Symbol.toStringTag,{value:"Module"})),ei=ut.create({type:"connector"});ei.register(eh,!0);function fs(s){return function(t,e,n,i){if(n instanceof Element){const o=this.graph.findViewByElem(n);let r;if(o)if(o.isEdgeElement(n)){const a=i.fixedAt!=null?i.fixedAt:"50%";r=nh(o,a)}else r=o.getBBoxOfElement(n).getCenter();else r=new A;return s.call(this,t,e,r,i)}return s.apply(this,arguments)}}function nh(s,t){const e=ye(t),n=typeof t=="string"?parseFloat(t):t;return e?s.getPointAtRatio(n/100):s.getPointAtLength(n)}const ih=(s,t,e,n)=>{const i=s.getClosestPoint(e);return i??new A},gx=fs(ih),fx=(s,t,e,n)=>{const i=n.length!=null?n.length:20;return s.getPointAtLength(i)},px=fs(function(s,t,e,n){const o=s.getConnection(),r=s.getConnectionSubdivisions(),a=new N(e.clone().translate(0,1e6),e.clone().translate(0,-1e6)),l=new N(e.clone().translate(1e6,0),e.clone().translate(-1e6,0)),c=a.intersect(o,{segmentSubdivisions:r}),h=l.intersect(o,{segmentSubdivisions:r}),u=[];return c&&u.push(...c),h&&u.push(...h),u.length>0?e.closest(u):n.fallbackAt!=null?nh(s,n.fallbackAt):D(ih,this,s,t,e,n)}),mx=Object.freeze(Object.defineProperty({__proto__:null,closest:gx,length:fx,orth:px,ratio:(s,t,e,n)=>{let i=n.ratio!=null?n.ratio:.5;return i>1&&(i/=100),s.getPointAtRatio(i)}},Symbol.toStringTag,{value:"Module"})),ni=ut.create({type:"edge endpoint"});ni.register(mx,!0);function Go(s,t){return s??t}function wt(s,t){return s!=null&&Number.isFinite(s)?s:t}function bx(s={}){const t=Go(s.color,"blue"),e=wt(s.width,1),n=wt(s.margin,2),i=wt(s.opacity,1),o=n,r=n+e;return`
9
+ <filter>
10
+ <feFlood flood-color="${t}" flood-opacity="${i}" result="colored"/>
11
+ <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${r}" />
12
+ <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${o}" />
13
+ <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>
14
+ <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>
15
+ <feMerge>
16
+ <feMergeNode in="outline"/>
17
+ <feMergeNode in="SourceGraphic"/>
18
+ </feMerge>
19
+ </filter>
20
+ `.trim()}function yx(s={}){const t=Go(s.color,"red"),e=wt(s.blur,0),n=wt(s.width,1),i=wt(s.opacity,1);return`
21
+ <filter>
22
+ <feFlood flood-color="${t}" flood-opacity="${i}" result="colored"/>
23
+ <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${n}"/>
24
+ <feComposite result="composed" in="colored" in2="morphed" operator="in"/>
25
+ <feGaussianBlur result="blured" in="composed" stdDeviation="${e}"/>
26
+ <feBlend in="SourceGraphic" in2="blured" mode="normal"/>
27
+ </filter>
28
+ `.trim()}function Cx(s={}){const t=wt(s.x,2);return`
29
+ <filter>
30
+ <feGaussianBlur stdDeviation="${s.y!=null&&Number.isFinite(s.y)?[t,s.y]:t}"/>
31
+ </filter>
32
+ `.trim()}function Ax(s={}){const t=wt(s.dx,0),e=wt(s.dy,0),n=Go(s.color,"black"),i=wt(s.blur,4),o=wt(s.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>
33
+ <feDropShadow stdDeviation="${i}" dx="${t}" dy="${e}" flood-color="${n}" flood-opacity="${o}" />
34
+ </filter>`.trim():`<filter>
35
+ <feGaussianBlur in="SourceAlpha" stdDeviation="${i}" />
36
+ <feOffset dx="${t}" dy="${e}" result="offsetblur" />
37
+ <feFlood flood-color="${n}" />
38
+ <feComposite in2="offsetblur" operator="in" />
39
+ <feComponentTransfer>
40
+ <feFuncA type="linear" slope="${o}" />
41
+ </feComponentTransfer>
42
+ <feMerge>
43
+ <feMergeNode/>
44
+ <feMergeNode in="SourceGraphic"/>
45
+ </feMerge>
46
+ </filter>`.trim()}function wx(s={}){const t=wt(s.amount,1),e=.2126+.7874*(1-t),n=.7152-.7152*(1-t),i=.0722-.0722*(1-t),o=.2126-.2126*(1-t),r=.7152+.2848*(1-t),a=.0722-.0722*(1-t),l=.2126-.2126*(1-t),c=.0722+.9278*(1-t);return`
47
+ <filter>
48
+ <feColorMatrix type="matrix" values="${e} ${n} ${i} 0 0 ${o} ${r} ${a} 0 0 ${l} ${n} ${c} 0 0 0 0 0 1 0"/>
49
+ </filter>
50
+ `.trim()}function xx(s={}){const t=wt(s.amount,1),e=.393+.607*(1-t),n=.769-.769*(1-t),i=.189-.189*(1-t),o=.349-.349*(1-t),r=.686+.314*(1-t),a=.168-.168*(1-t),l=.272-.272*(1-t),c=.534-.534*(1-t),h=.131+.869*(1-t);return`
51
+ <filter>
52
+ <feColorMatrix type="matrix" values="${e} ${n} ${i} 0 0 ${o} ${r} ${a} 0 0 ${l} ${c} ${h} 0 0 0 0 0 1 0"/>
53
+ </filter>
54
+ `.trim()}function vx(s={}){return`
55
+ <filter>
56
+ <feColorMatrix type="saturate" values="${1-wt(s.amount,1)}"/>
57
+ </filter>
58
+ `.trim()}function Ex(s={}){return`
59
+ <filter>
60
+ <feColorMatrix type="hueRotate" values="${wt(s.angle,0)}"/>
61
+ </filter>
62
+ `.trim()}function Sx(s={}){const t=wt(s.amount,1),e=1-t;return`
63
+ <filter>
64
+ <feComponentTransfer>
65
+ <feFuncR type="table" tableValues="${t} ${e}"/>
66
+ <feFuncG type="table" tableValues="${t} ${e}"/>
67
+ <feFuncB type="table" tableValues="${t} ${e}"/>
68
+ </feComponentTransfer>
69
+ </filter>
70
+ `.trim()}function Mx(s={}){const t=wt(s.amount,1);return`
71
+ <filter>
72
+ <feComponentTransfer>
73
+ <feFuncR type="linear" slope="${t}"/>
74
+ <feFuncG type="linear" slope="${t}"/>
75
+ <feFuncB type="linear" slope="${t}"/>
76
+ </feComponentTransfer>
77
+ </filter>
78
+ `.trim()}function Bx(s={}){const t=wt(s.amount,1),e=.5-t/2;return`
79
+ <filter>
80
+ <feComponentTransfer>
81
+ <feFuncR type="linear" slope="${t}" intercept="${e}"/>
82
+ <feFuncG type="linear" slope="${t}" intercept="${e}"/>
83
+ <feFuncB type="linear" slope="${t}" intercept="${e}"/>
84
+ </feComponentTransfer>
85
+ </filter>
86
+ `.trim()}const Ix=Object.freeze(Object.defineProperty({__proto__:null,blur:Cx,brightness:Mx,contrast:Bx,dropShadow:Ax,grayScale:wx,highlight:yx,hueRotate:Ex,invert:Sx,outline:bx,saturate:vx,sepia:xx},Symbol.toStringTag,{value:"Module"})),ii=ut.create({type:"filter"});ii.register(Ix,!0);const Px=Object.freeze(Object.defineProperty({__proto__:null,dot:{color:"#aaaaaa",thickness:1,markup:"rect",update(s,t){const e=t.thickness*t.sx,n=t.thickness*t.sy;V(s,{width:e,height:n,rx:e,ry:n,fill:t.color})}},doubleMesh:[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(s,t){let e;const n=t.width,i=t.height,o=t.thickness;n-o>=0&&i-o>=0?e=["M",n,0,"H0 M0 0 V0",i].join(" "):e="M 0 0 0 0",V(s,{d:e,stroke:t.color,"stroke-width":t.thickness})}},{color:"rgba(224,224,224,0.2)",thickness:3,factor:4,markup:"path",update(s,t){let e;const n=t.factor||1,i=t.width*n,o=t.height*n,r=t.thickness;i-r>=0&&o-r>=0?e=["M",i,0,"H0 M0 0 V0",o].join(" "):e="M 0 0 0 0",t.width=i,t.height=o,V(s,{d:e,stroke:t.color,"stroke-width":t.thickness})}}],fixedDot:{color:"#aaaaaa",thickness:1,markup:"rect",update(s,t){const e=t.sx<=1?t.thickness*t.sx:t.thickness;V(s,{width:e,height:e,rx:e,ry:e,fill:t.color})}},mesh:{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(s,t){let e;const n=t.width,i=t.height,o=t.thickness;n-o>=0&&i-o>=0?e=["M",n,0,"H0 M0 0 V0",i].join(" "):e="M 0 0 0 0",V(s,{d:e,stroke:t.color,"stroke-width":t.thickness})}}},Symbol.toStringTag,{value:"Module"}));class Tx{constructor(){this.patterns={},this.root=L.create(Wi(),{width:"100%",height:"100%"},[se("defs")]).node}add(t,e){const n=this.root.childNodes[0];n&&n.appendChild(e),this.patterns[t]=e,L.create("rect",{width:"100%",height:"100%",fill:`url(#${t})`}).appendTo(this.root)}get(t){return this.patterns[t]}has(t){return this.patterns[t]!=null}}const sh=Px,si=ut.create({type:"grid"});si.register(sh,!0);const _={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix(s){return`${_.prefixCls}-${s}`}},oh=_.prefix("highlighted"),kx={highlight(s,t,e){const n=e&&e.className||oh;O(t,n)},unhighlight(s,t,e){const n=e&&e.className||oh;st(t,n)}},rh=_.prefix("highlight-opacity"),Ox={highlight(s,t){O(t,rh)},unhighlight(s,t){st(t,rh)}},Nx={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},Rx={highlight(s,t,e){const n=ah(t,e);if(Qx(n))return;e=fl({},e,Nx);const i=L.create(t);let o,r;try{o=i.toPathData()}catch{r=Ec(i.node),o=ac(Object.assign(Object.assign({},e),r))}const a=se("path");if(V(a,Object.assign({d:o,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},e.attrs?jn(e.attrs):null)),s.isEdgeElement(t))V(a,"d",s.getConnectionPathData());else{let h=i.getTransformToElement(s.container);const u=e.padding;if(u){r==null&&(r=Ec(i.node));const d=r.x+r.width/2,g=r.y+r.height/2;r=Yt(r,h);const p=Math.max(r.width,1),m=Math.max(r.height,1),b=(p+u)/p,y=(m+u)/m,C=At({a:b,b:0,c:0,d:y,e:d-b*d,f:g-y*g});h=h.multiply(C)}fn(a,h)}O(a,_.prefix("highlight-stroke"));const l=s.cell,c=()=>lh(n);l.on("removed",c),l.model&&l.model.on("reseted",c),s.container.appendChild(a),Dx(n,a)},unhighlight(s,t,e){lh(ah(t,e))}};function ah(s,t){return bo(s),s.id+JSON.stringify(t)}const ps={};function Dx(s,t){ps[s]=t}function Qx(s){return ps[s]!=null}function lh(s){const t=ps[s];t&&(Vt(t),delete ps[s])}const Lx=Object.freeze(Object.defineProperty({__proto__:null,className:kx,opacity:Ox,stroke:Rx},Symbol.toStringTag,{value:"Module"}));function Fx(s,t){if(typeof t.highlight!="function")throw new Error(`Highlighter '${s}' is missing required \`highlight()\` method`);if(typeof t.unhighlight!="function")throw new Error(`Highlighter '${s}' is missing required \`unhighlight()\` method`)}const zx=Lx,oi=ut.create({type:"highlighter"});oi.register(zx,!0);const Ux=we("center"),Kx=we("topCenter"),Jx=we("bottomCenter"),jx=we("leftMiddle"),Vx=we("rightMiddle"),Gx=we("topLeft"),Yx=we("topRight"),Hx=we("bottomLeft"),qx=we("bottomRight");function we(s){return(t,e,n,i={})=>{let o;t.cell.visible?o=i.rotate?t.getUnrotatedBBoxOfElement(e):t.getBBoxOfElement(e):o=t.cell.getBBox();const r=o[s];r.x+=zt(i.dx,o.width),r.y+=zt(i.dy,o.height);const a=t.cell;return i.rotate?r.rotate(-a.getAngle(),a.getBBox().getCenter()):r}}const Wx=fs((s,t,e,n)=>{const i=Tt(s.cell.getAngle()),o=s.cell.visible?s.getBBoxOfElement(t):s.cell.getBBox(),r=o.getCenter(),a=o.getTopLeft(),l=o.getBottomRight();let c=n.padding;if(Number.isFinite(c)||(c=0),a.y+c<=e.y&&e.y<=l.y-c){const h=e.y-r.y;r.x+=i===0||i===180?0:h*1/Math.tan(It(i)),r.y+=h}else if(a.x+c<=e.x&&e.x<=l.x-c){const h=e.x-r.x;r.y+=i===90||i===270?0:h*Math.tan(It(i)),r.x+=h}return r}),Xx=function(s,t,e,n,i){const o=s.cell.getConnectionPoint(this.cell,i);return(n.dx||n.dy)&&o.translate(n.dx||0,n.dy||0),o},_x=fs((s,t,e,n)=>{let i,o=0,r;const a=s.cell;n.rotate?(i=s.getUnrotatedBBoxOfElement(t),r=a.getBBox().getCenter(),o=a.getAngle()):a.visible?i=s.getBBoxOfElement(t):i=s.cell.getBBox();const l=n.padding;l!=null&&Number.isFinite(l)&&i.inflate(l),n.rotate&&e.rotate(o,r);const c=i.getNearestSideToPoint(e);let h;switch(c){case"left":h=i.getLeftMiddle();break;case"right":h=i.getRightMiddle();break;case"top":h=i.getTopCenter();break;case"bottom":h=i.getBottomCenter();break}const u=n.direction;return u==="H"?(c==="top"||c==="bottom")&&(e.x<=i.x+i.width?h=i.getLeftMiddle():h=i.getRightMiddle()):u==="V"&&(e.y<=i.y+i.height?h=i.getTopCenter():h=i.getBottomCenter()),n.rotate?h.rotate(-o,r):h}),$x=Object.freeze(Object.defineProperty({__proto__:null,bottom:Jx,bottomLeft:Hx,bottomRight:qx,center:Ux,left:jx,midSide:_x,nodeCenter:Xx,orth:Wx,right:Vx,top:Kx,topLeft:Gx,topRight:Yx},Symbol.toStringTag,{value:"Module"})),ri=ut.create({type:"node endpoint"});ri.register($x,!0);const Zx={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function Oe(s,t){const{x:e,y:n,angle:i,attrs:o}=t||{};return fl({},{angle:i,attrs:o,position:{x:e,y:n}},s,Zx)}const t1=(s,t,e)=>Oe({position:t.getTopLeft()},e),e1=(s,t,e)=>Oe({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},e),n1=(s,t,e)=>Oe({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},e),i1=(s,t,e)=>Oe({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},e),s1=(s,t,e)=>Oe({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},e),o1=(s,t,e)=>ch(s,t,!1,e),r1=(s,t,e)=>ch(s,t,!0,e),a1=(s,t,e)=>hh(s,t,!1,e),l1=(s,t,e)=>hh(s,t,!0,e);function ch(s,t,e,n){const i=n.offset!=null?n.offset:15,o=t.getCenter().theta(s),r=uh(t);let a,l,c,h,u=0;return o<r[1]||o>r[2]?(a=".3em",l=i,c=0,h="start"):o<r[0]?(a="0",l=0,c=-i,e?(u=-90,h="start"):h="middle"):o<r[3]?(a=".3em",l=-i,c=0,h="end"):(a=".6em",l=0,c=i,e?(u=90,h="start"):h="middle"),Oe({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},n)}function hh(s,t,e,n){const i=n.offset!=null?n.offset:15,o=t.getCenter().theta(s),r=uh(t);let a,l,c,h,u=0;return o<r[1]||o>r[2]?(a=".3em",l=-i,c=0,h="end"):o<r[0]?(a=".6em",l=0,c=i,e?(u=90,h="start"):h="middle"):o<r[3]?(a=".3em",l=i,c=0,h="start"):(a="0em",l=0,c=-i,e?(u=-90,h="start"):h="middle"),Oe({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},n)}function uh(s){const t=s.getCenter(),e=t.theta(s.getTopLeft()),n=t.theta(s.getBottomLeft()),i=t.theta(s.getBottomRight()),o=t.theta(s.getTopRight());return[e,o,i,n]}const c1=(s,t,e)=>dh(s.diff(t.getCenter()),!1,e),h1=(s,t,e)=>dh(s.diff(t.getCenter()),!0,e);function dh(s,t,e){const n=e.offset!=null?e.offset:20,i=new A(0,0),o=-s.theta(i),r=s.clone().move(i,n).diff(s).round();let a=".3em",l,c=o;return(o+90)%180===0?(l=t?"end":"middle",!t&&o===-270&&(a="0em")):o>-270&&o<-90?(l="start",c=o-180):l="end",Oe({position:r.round().toJSON(),angle:t?c:0,attrs:{".":{y:a,"text-anchor":l}}},e)}const gh=Object.freeze(Object.defineProperty({__proto__:null,bottom:s1,inside:a1,insideOriented:l1,left:e1,manual:t1,outside:o1,outsideOriented:r1,radial:c1,radialOriented:h1,right:n1,top:i1},Symbol.toStringTag,{value:"Module"})),ms=ut.create({type:"port label layout"});ms.register(gh,!0);function Yo(s,t={}){return new A(zt(t.x,s.width),zt(t.y,s.height))}function Ho(s,t,e){return Object.assign({angle:t,position:s.toJSON()},e)}const u1=(s,t)=>s.map(({x:e,y:n,angle:i})=>Ho(Yo(t,{x:e,y:n}),i||0)),d1=(s,t,e)=>{const n=e.start||0,i=e.step||20;return fh(s,t,n,(o,r)=>(o+.5-r/2)*i)},g1=(s,t,e)=>{const n=e.start||0,i=e.step||360/s.length;return fh(s,t,n,o=>o*i)};function fh(s,t,e,n){const i=t.getCenter(),o=t.getTopCenter(),r=t.width/t.height,a=Lt.fromRect(t),l=s.length;return s.map((c,h)=>{const u=e+n(h,l),d=o.clone().rotate(-u,i).scale(r,1,i),g=c.compensateRotate?-a.tangentTheta(d):0;return(c.dx||c.dy)&&d.translate(c.dx||0,c.dy||0),c.dr&&d.move(i,c.dr),Ho(d.round(),g,c)})}const f1=(s,t,e)=>{const n=Yo(t,e.start||t.getOrigin()),i=Yo(t,e.end||t.getCorner());return ai(s,n,i,e)},p1=(s,t,e)=>ai(s,t.getTopLeft(),t.getBottomLeft(),e),m1=(s,t,e)=>ai(s,t.getTopRight(),t.getBottomRight(),e),b1=(s,t,e)=>ai(s,t.getTopLeft(),t.getTopRight(),e),y1=(s,t,e)=>ai(s,t.getBottomLeft(),t.getBottomRight(),e);function ai(s,t,e,n){const i=new N(t,e),o=s.length;return s.map((r,a)=>{var{strict:l}=r,c=K(r,["strict"]);const h=l||n.strict?(a+1)/(o+1):(a+.5)/o,u=i.pointAt(h);return(c.dx||c.dy)&&u.translate(c.dx||0,c.dy||0),Ho(u.round(),0,c)})}const ph=Object.freeze(Object.defineProperty({__proto__:null,absolute:u1,bottom:y1,ellipse:d1,ellipseSpread:g1,left:p1,line:f1,right:m1,top:b1},Symbol.toStringTag,{value:"Module"})),li=ut.create({type:"port layout"});li.register(ph,!0);const C1=s=>[...s],A1=(s,t,e)=>{const n=t.side||"bottom",i=ee(t.padding||40),o=e.sourceBBox,r=e.targetBBox,a=o.getCenter(),l=r.getCenter();let c,h,u;switch(n){case"top":u=-1,c="y",h="height";break;case"left":u=-1,c="x",h="width";break;case"right":u=1,c="x",h="width";break;case"bottom":default:u=1,c="y",h="height";break}return a[c]+=u*(o[h]/2+i[n]),l[c]+=u*(r[h]/2+i[n]),u*(a[c]-l[c])>0?l[c]=a[c]:a[c]=l[c],[a.toJSON(),...s,l.toJSON()]};function bs(s){return new P(s.x,s.y,0,0)}function ys(s={}){const t=ee(s.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function mh(s,t={}){return s.sourceBBox.clone().moveAndExpand(ys(t))}function bh(s,t={}){return s.targetBBox.clone().moveAndExpand(ys(t))}function w1(s,t={}){return s.sourceAnchor?s.sourceAnchor:mh(s,t).getCenter()}function x1(s,t={}){return s.targetAnchor?s.targetAnchor:bh(s,t).getCenter()}const yh=(s,t,e)=>{let n=mh(e,t),i=bh(e,t);const o=w1(e,t),r=x1(e,t);n=n.union(bs(o)),i=i.union(bs(r));const a=s.map(h=>A.create(h));a.unshift(o),a.push(r);let l=null;const c=[];for(let h=0,u=a.length-1;h<u;h+=1){let d=null;const g=a[h],p=a[h+1],m=Nt(g,p)!=null;if(h===0)h+1===u?n.intersectsWithRect(i.clone().inflate(1))?d=Wo(g,p,n,i):m||(d=M1(g,p,n,i)):n.containsPoint(p)?d=Wo(g,p,n,bs(p).moveAndExpand(ys(t))):m||(d=As(g,p,n));else if(h+1===u){const b=m&&Nt(p,g)===l;i.containsPoint(g)||b?d=Wo(g,p,bs(g).moveAndExpand(ys(t)),i,l):m||(d=S1(g,p,i,l))}else m||(d=Ch(g,p,l));d?(c.push(...d.points),l=d.direction):l=Nt(g,p),h+1<u&&c.push(p)}return c},v1={N:"S",S:"N",E:"W",W:"E"},E1={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function Cs(s,t,e){let n=new A(s.x,t.y);return e.containsPoint(n)&&(n=new A(t.x,s.y)),n}function qo(s,t){return s[t==="W"||t==="E"?"width":"height"]}function Nt(s,t){return s.x===t.x?s.y>t.y?"N":"S":s.y===t.y?s.x>t.x?"W":"E":null}function Ch(s,t,e){const n=new A(s.x,t.y),i=new A(t.x,s.y),o=Nt(s,n),r=Nt(s,i),a=e?v1[e]:null,l=o===e||o!==a&&(r===a||r!==e)?n:i;return{points:[l],direction:Nt(l,t)}}function As(s,t,e){const n=Cs(s,t,e);return{points:[n],direction:Nt(n,t)}}function S1(s,t,e,n){const i=[new A(s.x,t.y),new A(t.x,s.y)],o=i.filter(l=>!e.containsPoint(l)),r=o.filter(l=>Nt(l,s)!==n);let a;if(r.length>0)return a=r.filter(l=>Nt(s,l)===n).pop(),a=a||r[0],{points:[a],direction:Nt(a,t)};{a=Xb(i,o)[0];const l=A.create(t).move(a,-qo(e,n)/2);return{points:[Cs(l,s,e),l],direction:Nt(l,t)}}}function M1(s,t,e,n){let i=As(t,s,n);const o=i.points[0];if(e.containsPoint(o)){i=As(s,t,e);const r=i.points[0];if(n.containsPoint(r)){const a=A.create(s).move(r,-qo(e,Nt(s,r))/2),l=A.create(t).move(o,-qo(n,Nt(t,o))/2),c=new N(a,l).getCenter(),h=As(s,c,e),u=Ch(c,t,h.direction);i.points=[h.points[0],u.points[0]],i.direction=u.direction}}return i}function Wo(s,t,e,n,i){const o=e.union(n).inflate(1),r=o.getCenter(),a=r.distance(t)>r.distance(s),l=a?t:s,c=a?s:t;let h,u,d;i?(h=A.fromPolar(o.width+o.height,E1[i],l),h=o.getNearestPointToPoint(h).move(h,-1)):h=o.getNearestPointToPoint(l).move(l,1),u=Cs(h,c,o);let g;h.round().equals(u.round())?(u=A.fromPolar(o.width+o.height,It(h.theta(l))+Math.PI/2,c),u=o.getNearestPointToPoint(u).move(c,1).round(),d=Cs(h,u,o),g=a?[u,d,h]:[h,d,u]):g=a?[u,h]:[h,u];const p=Nt(a?h:u,t);return{points:g,direction:p}}const B1={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost(){return Ne(this.step,this)},directions(){const s=Ne(this.step,this),t=Ne(this.cost,this);return[{cost:t,offsetX:s,offsetY:0},{cost:t,offsetX:-s,offsetY:0},{cost:t,offsetX:0,offsetY:s},{cost:t,offsetX:0,offsetY:-s}]},penalties(){const s=Ne(this.step,this);return{0:0,45:s/2,90:s/2}},paddingBox(){const s=Ne(this.step,this);return{x:-s,y:-s,width:2*s,height:2*s}},fallbackRouter:yh,draggingRouter:null,snapToGrid:!0};function Ne(s,t){return typeof s=="function"?s.call(t):s}function I1(s){const t=Object.keys(s).reduce((e,n)=>{const i=e;return n==="fallbackRouter"||n==="draggingRouter"||n==="fallbackRoute"?i[n]=s[n]:i[n]=Ne(s[n],s),e},{});if(t.padding){const e=ee(t.padding);t.paddingBox={x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}return t.directions.forEach(e=>{const n=new A(0,0),i=new A(e.offsetX,e.offsetY);e.angle=Tt(n.theta(i))}),t}class P1{constructor(t){this.options=t,this.mapGridSize=100,this.map={}}build(t,e){const n=this.options,i=n.excludeTerminals.reduce((c,h)=>{const u=e[h];if(u){const d=t.getCell(u.cell);d&&c.push(d)}return c},[]);let o=[];const r=t.getCell(e.getSourceCellId());r&&(o=Cl(o,r.getAncestors().map(c=>c.id)));const a=t.getCell(e.getTargetCellId());a&&(o=Cl(o,a.getAncestors().map(c=>c.id)));const l=this.mapGridSize;return t.getNodes().reduce((c,h)=>{const u=i.some(b=>b.id===h.id),d=h.shape?n.excludeShapes.includes(h.shape):!1,g=n.excludeNodes.some(b=>typeof b=="string"?h.id===b:b===h),p=o.includes(h.id),m=d||u||g||p;if(h.isVisible()&&!m){const b=h.getBBox().moveAndExpand(n.paddingBox),y=b.getOrigin().snapToGrid(l),C=b.getCorner().snapToGrid(l);for(let w=y.x;w<=C.x;w+=l)for(let x=y.y;x<=C.y;x+=l){const E=new A(w,x).toString();c[E]==null&&(c[E]=[]),c[E].push(b)}}return c},this.map),this}isAccessible(t){const e=t.clone().snapToGrid(this.mapGridSize).toString(),n=this.map[e];return n?n.every(i=>!i.containsPoint(t)):!0}}const Ah=1,wh=2;class T1{constructor(){this.items=[],this.hash={},this.values={}}add(t,e){this.hash[t]?this.items.splice(this.items.indexOf(t),1):this.hash[t]=Ah,this.values[t]=e;const n=By(this.items,t,i=>this.values[i]);this.items.splice(n,0,t)}pop(){const t=this.items.shift();return t&&(this.hash[t]=wh),t}isOpen(t){return this.hash[t]===Ah}isClose(t){return this.hash[t]===wh}isEmpty(){return this.items.length===0}}function xh(s,t){const e=s.sourceBBox.clone();return t&&t.paddingBox?e.moveAndExpand(t.paddingBox):e}function vh(s,t){const e=s.targetBBox.clone();return t&&t.paddingBox?e.moveAndExpand(t.paddingBox):e}function Eh(s,t){return s.sourceAnchor?s.sourceAnchor:xh(s,t).getCenter()}function k1(s,t){return s.targetAnchor?s.targetAnchor:vh(s,t).getCenter()}function Xo(s,t,e,n,i){const o=360/e,r=s.theta(O1(s,t,n,i)),a=Tt(r+o/2);return o*Math.floor(a/o)}function O1(s,t,e,n){const i=n.step,o=t.x-s.x,r=t.y-s.y,a=o/e.x,l=r/e.y,c=a*i,h=l*i;return new A(s.x+c,s.y+h)}function Sh(s,t){const e=Math.abs(s-t);return e>180?360-e:e}function N1(s,t){const e=t.step;return t.directions.forEach(n=>{n.gridOffsetX=n.offsetX/e*s.x,n.gridOffsetY=n.offsetY/e*s.y}),t.directions}function R1(s,t,e){return{source:t.clone(),x:Mh(e.x-t.x,s),y:Mh(e.y-t.y,s)}}function Mh(s,t){if(!s)return t;const e=Math.abs(s),n=Math.round(e/t);if(!n)return e;const i=n*t,r=(e-i)/n;return t+r}function D1(s,t){const e=t.source,n=ne(s.x-e.x,t.x)+e.x,i=ne(s.y-e.y,t.y)+e.y;return new A(n,i)}function ci(s,t){return s.round(t)}function ws(s,t,e){return ci(D1(s.clone(),t),e)}function hi(s){return s.toString()}function _o(s){return new A(s.x===0?0:Math.abs(s.x)/s.x,s.y===0?0:Math.abs(s.y)/s.y)}function Bh(s,t){let e=1/0;for(let n=0,i=t.length;n<i;n+=1){const o=s.manhattanDistance(t[n]);o<e&&(e=o)}return e}function Ih(s,t,e,n,i){const o=i.precision,r=i.directionMap,a=s.diff(t.getCenter()),l=Object.keys(r).reduce((c,h)=>{if(e.includes(h)){const u=r[h],d=new A(s.x+u.x*(Math.abs(a.x)+t.width),s.y+u.y*(Math.abs(a.y)+t.height)),p=new N(s,d).intersect(t)||[];let m,b=null;for(let y=0;y<p.length;y+=1){const C=p[y],w=s.squaredDistance(C);(m==null||w>m)&&(m=w,b=C)}if(b){let y=ws(b,n,o);t.containsPoint(y)&&(y=ws(y.translate(u.x*n.x,u.y*n.y),n,o)),c.push(y)}}return c},[]);return t.containsPoint(s)||l.push(ws(s,n,o)),l}function Q1(s,t,e,n,i){const o=[];let r=_o(i.diff(e)),a=hi(e),l=s[a],c;for(;l;){c=t[a];const d=_o(c.diff(l));d.equals(r)||(o.unshift(c),r=d),a=hi(l),l=s[a]}const h=t[a];return _o(h.diff(n)).equals(r)||o.unshift(h),o}function L1(s,t,e,n,i){const o=i.precision;let r,a;P.isRectangle(t)?r=ci(Eh(s,i).clone(),o):r=ci(t.clone(),o),P.isRectangle(e)?a=ci(k1(s,i).clone(),o):a=ci(e.clone(),o);const l=R1(i.step,r,a),c=r,h=a;let u,d;if(P.isRectangle(t)?u=Ih(c,t,i.startDirections,l,i):u=[c],P.isRectangle(e)?d=Ih(a,e,i.endDirections,l,i):d=[h],u=u.filter(g=>n.isAccessible(g)),d=d.filter(g=>n.isAccessible(g)),u.length>0&&d.length>0){const g=new T1,p={},m={},b={};for(let T=0,k=u.length;T<k;T+=1){const R=u[T],z=hi(R);g.add(z,Bh(R,d)),p[z]=R,b[z]=0}const y=i.previousDirectionAngle,C=y===void 0;let w,x;const E=N1(l,i),B=E.length,v=d.reduce((T,k)=>{const R=hi(k);return T.push(R),T},[]),M=A.equalPoints(u,d);let I=i.maxLoopCount;for(;!g.isEmpty()&&I>0;){const T=g.pop(),k=p[T],R=m[T],z=b[T],J=k.equals(c),Z=R==null;let Y;if(Z?C?J?Y=null:Y=Xo(c,k,B,l,i):Y=y:Y=Xo(R,k,B,l,i),!(Z&&M)&&v.indexOf(T)>=0)return i.previousDirectionAngle=Y,Q1(m,p,k,c,h);for(let Rt=0;Rt<B;Rt+=1){w=E[Rt];const Dt=w.angle;if(x=Sh(Y,Dt),!(C&&J)&&x>i.maxDirectionChange)continue;const pt=ws(k.clone().translate(w.gridOffsetX||0,w.gridOffsetY||0),l,o),Q=hi(pt);if(g.isClose(Q)||!n.isAccessible(pt))continue;if(v.indexOf(Q)>=0&&!pt.equals(h)){const mt=Xo(pt,h,B,l,i);if(Sh(Dt,mt)>i.maxDirectionChange)continue}const X=w.cost,tt=J?0:i.penalties[x],j=z+X+tt;(!g.isOpen(Q)||j<b[Q])&&(p[Q]=pt,m[Q]=k,b[Q]=j,g.add(Q,j+Bh(pt,d)))}I-=1}}return i.fallbackRoute?D(i.fallbackRoute,this,c,h,i):null}function F1(s,t=10){if(s.length<=1)return s;for(let e=0,n=s.length;e<n-1;e+=1){const i=s[e],o=s[e+1];if(i.x===o.x){const r=t*Math.round(i.x/t);i.x!==r&&(i.x=r,o.x=r)}else if(i.y===o.y){const r=t*Math.round(i.y/t);i.y!==r&&(i.y=r,o.y=r)}}return s}const z1=function(s,t,e){const n=I1(t),i=xh(e,n),o=vh(e,n),r=Eh(e,n),a=new P1(n).build(e.graph.model,e.cell),l=s.map(g=>A.create(g)),c=[];let h=r,u,d;for(let g=0,p=l.length;g<=p;g+=1){let m=null;if(u=d||i,d=l[g],d==null){d=o;const y=e.cell;if((y.getSourceCellId()==null||y.getTargetCellId()==null)&&typeof n.draggingRouter=="function"){const w=u===i?r:u,x=d.getOrigin();m=D(n.draggingRouter,e,w,x,n)}}if(m==null&&(m=L1(e,u,d,a,n)),m===null)return console.warn("Unable to execute manhattan algorithm, use orth instead"),D(n.fallbackRouter,this,s,n,e);const b=m[0];b&&b.equals(h)&&m.shift(),h=m[m.length-1]||h,c.push(...m)}return n.snapToGrid?F1(c,e.graph.grid.getGridSize()):c},Ph=function(s,t,e){return D(z1,this,s,Object.assign(Object.assign({},B1),t),e)},U1={maxDirectionChange:45,directions(){const s=Ne(this.step,this),t=Ne(this.cost,this),e=Math.ceil(Math.sqrt(s*s<<1));return[{cost:t,offsetX:s,offsetY:0},{cost:e,offsetX:s,offsetY:s},{cost:t,offsetX:0,offsetY:s},{cost:e,offsetX:-s,offsetY:s},{cost:t,offsetX:-s,offsetY:0},{cost:e,offsetX:-s,offsetY:-s},{cost:t,offsetX:0,offsetY:-s},{cost:e,offsetX:s,offsetY:-s}]},fallbackRoute(s,t,e){const n=s.theta(t),i=[];let o={x:t.x,y:s.y},r={x:s.x,y:t.y};if(n%180>90){const w=o;o=r,r=w}const a=n%90<45?o:r,l=new N(s,a),c=90*Math.ceil(n/90),h=A.fromPolar(l.squaredLength(),It(c+135),a),u=new N(t,h),d=l.intersectsWithLine(u),g=d||t,p=d?g:s,m=360/e.directions.length,b=p.theta(t),y=Tt(b+m/2),C=m*Math.floor(y/m);return e.previousDirectionAngle=C,g&&i.push(g.round()),i.push(t),i}},K1=function(s,t,e){return D(Ph,this,s,Object.assign(Object.assign({},U1),t),e)},J1=(s,t,e)=>{const n=t.offset||32,i=t.min==null?16:t.min;let o=0,r=t.direction;const a=e.sourceBBox,l=e.targetBBox,c=a.getCenter(),h=l.getCenter();if(typeof n=="number"&&(o=n),r==null){let y=l.left-a.right,C=l.top-a.bottom;y>=0&&C>=0?r=y>=C?"L":"T":y<=0&&C>=0?(y=a.left-l.right,y>=0?r=y>=C?"R":"T":r="T"):y>=0&&C<=0?(C=a.top-l.bottom,C>=0?r=y>=C?"L":"B":r="L"):(y=a.left-l.right,C=a.top-l.bottom,y>=0&&C>=0?r=y>=C?"R":"B":y<=0&&C>=0?r="B":y>=0&&C<=0?r="R":r=Math.abs(y)>Math.abs(C)?"R":"B")}r==="H"?r=h.x-c.x>=0?"L":"R":r==="V"&&(r=h.y-c.y>=0?"T":"B"),n==="center"&&(r==="L"?o=(l.left-a.right)/2:r==="R"?o=(a.left-l.right)/2:r==="T"?o=(l.top-a.bottom)/2:r==="B"&&(o=(a.top-l.bottom)/2));let u,d,g;const p=r==="L"||r==="R";if(p){if(h.y===c.y)return[...s];g=r==="L"?1:-1,u="x",d="width"}else{if(h.x===c.x)return[...s];g=r==="T"?1:-1,u="y",d="height"}const m=c.clone(),b=h.clone();if(m[u]+=g*(a[d]/2+o),b[u]-=g*(l[d]/2+o),p){const y=m.x,C=b.x,w=a.width/2+i,x=l.width/2+i;h.x>c.x?C<=y&&(m.x=Math.max(C,c.x+w),b.x=Math.min(y,h.x-x)):C>=y&&(m.x=Math.min(C,c.x-w),b.x=Math.max(y,h.x+x))}else{const y=m.y,C=b.y,w=a.height/2+i,x=l.height/2+i;h.y>c.y?C<=y&&(m.y=Math.max(C,c.y+w),b.y=Math.min(y,h.y-x)):C>=y&&(m.y=Math.min(C,c.y-w),b.y=Math.max(y,h.y+x))}return[m.toJSON(),...s,b.toJSON()]};function wn(s,t){if(t!=null&&t!==!1){const e=typeof t=="boolean"?0:t;if(e>0){const n=A.create(s[1]).move(s[2],e),i=A.create(s[1]).move(s[0],e);return[n.toJSON(),...s,i.toJSON()]}{const n=s[1];return[Object.assign({},n),...s,Object.assign({},n)]}}return s}const $o=Object.freeze(Object.defineProperty({__proto__:null,er:J1,loop:(s,t,e)=>{const n=t.width||50,o=(t.height||80)/2,r=t.angle||"auto",a=e.sourceAnchor,l=e.targetAnchor,c=e.sourceBBox,h=e.targetBBox;if(a.equals(l)){const u=y=>{const C=It(y),w=Math.sin(C),x=Math.cos(C),E=new A(a.x+x*n,a.y+w*n),B=new A(E.x-x*o,E.y-w*o),v=B.clone().rotate(-90,E),M=B.clone().rotate(90,E);return[v.toJSON(),E.toJSON(),M.toJSON()]},d=y=>{const C=a.clone().move(y,-1),w=new N(C,y);return!c.containsPoint(y)&&!c.intersectsWithLine(w)},g=[0,90,180,270,45,135,225,315];if(typeof r=="number")return wn(u(r),t.merge);const p=c.getCenter();if(p.equals(a))return wn(u(0),t.merge);const m=p.angleBetween(a,p.clone().translate(1,0));let b=u(m);if(d(b[1]))return wn(b,t.merge);for(let y=1,C=g.length;y<C;y+=1)if(b=u(m+g[y]),d(b[1]))return wn(b,t.merge);return wn(b,t.merge)}{const u=new N(a,l);let d=u.parallel(-n),g=d.getCenter(),p=d.start.clone().move(d.end,o),m=d.end.clone().move(d.start,o);const b=u.parallel(-1),y=new N(b.start,g),C=new N(b.end,g);if((c.containsPoint(g)||h.containsPoint(g)||c.intersectsWithLine(y)||c.intersectsWithLine(C)||h.intersectsWithLine(y)||h.intersectsWithLine(C))&&(d=u.parallel(n),g=d.getCenter(),p=d.start.clone().move(d.end,o),m=d.end.clone().move(d.start,o)),t.merge){const w=new N(a,l),x=new N(g,w.center).setLength(Number.MAX_SAFE_INTEGER),E=c.intersectsWithLine(x),B=h.intersectsWithLine(x),v=E?Array.isArray(E)?E:[E]:[];B&&(Array.isArray(B)?v.push(...B):v.push(B));const M=w.center.closest(v);M?(e.sourceAnchor=M.clone(),e.targetAnchor=M.clone()):(e.sourceAnchor=w.center.clone(),e.targetAnchor=w.center.clone())}return wn([p.toJSON(),g.toJSON(),m.toJSON()],t.merge)}},manhattan:Ph,metro:K1,normal:C1,oneSide:A1,orth:yh},Symbol.toStringTag,{value:"Module"})),ui=ut.create({type:"router"});ui.register($o,!0);function j1(s){return s!=null&&!xs(s)}function xs(s){return s!=null&&typeof s=="string"}function V1(s){return s==null||xs(s)?s:rt(s)}function G1(s){return`${s}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")}function Th(s,t={ns:Ct.svg}){const e=document.createDocumentFragment(),n={},i={},o=[{markup:Array.isArray(s)?s:[s],parent:e,ns:t.ns}];for(;o.length>0;){const r=o.pop();let a=r.ns||Ct.svg;const l=r.markup,c=r.parent;l.forEach(h=>{const u=h.tagName;if(!u)throw new TypeError("Invalid tagName");h.ns&&(a=h.ns);const d=a?yo(u,a):Kl(u),g=h.attrs;g&&V(d,jn(g));const p=h.style;p&&$(d,p);const m=h.className;m!=null&&d.setAttribute("class",Array.isArray(m)?m.join(" "):m),h.textContent&&(d.textContent=h.textContent);const b=h.selector;if(b!=null){if(i[b])throw new TypeError("Selector must be unique");i[b]=d}if(h.groupSelector){let C=h.groupSelector;Array.isArray(C)||(C=[C]),C.forEach(w=>{n[w]||(n[w]=[]),n[w].push(d)})}c.appendChild(d);const y=h.children;Array.isArray(y)&&o.push({ns:a,markup:y,parent:d})})}return Object.keys(n).forEach(r=>{if(i[r])throw new Error("Ambiguous group selector");i[r]=n[r]}),{fragment:e,selectors:i,groups:n}}function Zo(s){return s instanceof SVGElement?se("g"):Kl("div")}function Y1(s){if(xs(s)){const i=L.createVectors(s),o=i.length;if(o===1)return{elem:i[0].node};if(o>1){const r=Zo(i[0].node);return i.forEach(a=>{r.appendChild(a.node)}),{elem:r}}return{}}const t=Th(s),e=t.fragment;let n=null;return e.childNodes.length>1?(n=Zo(e.firstChild),n.appendChild(e)):n=e.firstChild,{elem:n,selectors:t.selectors}}function H1(s){const t=L.createVectors(s),e=document.createDocumentFragment();for(let n=0,i=t.length;n<i;n+=1){const o=t[n].node;e.appendChild(o)}return{fragment:e,selectors:{}}}function kh(s,t,e){if(s!=null){let n;const i=s.tagName.toLowerCase();if(s===t)return typeof e=="string"?n=`> ${i} > ${e}`:n=`> ${i}`,n;const o=s.parentNode;if(o&&o.childNodes.length>1){const r=Co(s)+1;n=`${i}:nth-child(${r})`}else n=i;return e&&(n+=` > ${e}`),kh(s.parentNode,t,n)}return e}function q1(){return"g"}function W1(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}}function X1(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}function _1(){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"}}]}function $1(s=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:Ct.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:Ct.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:s?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}const Pt={isJSONMarkup:j1,isStringMarkup:xs,clone:V1,sanitize:G1,parseJSONMarkup:Th,createContainer:Zo,renderMarkup:Y1,parseLabelStringMarkup:H1,getSelector:kh,getPortContainerMarkup:q1,getPortMarkup:W1,getPortLabelMarkup:X1,getEdgeMarkup:_1,getForeignObjectMarkup:$1};function NM(s,t){}function RM(s){}function Ge(s,t){return t?se(s||"g"):yo(s||"div")}function Oh(s,t,e){if(!s||s===".")return{elems:[t]};if(e){const n=e[s];if(n)return{elems:Array.isArray(n)?n:[n]}}{const n=s.includes(">")?`:scope ${s}`:s;return{isCSSSelector:!0,elems:Array.prototype.slice.call(t.querySelectorAll(n))}}}function Z1(s){var t;let e=s;const n=s.originalEvent,i=(t=n==null?void 0:n.changedTouches)===null||t===void 0?void 0:t[0];if(i){for(const o in s)i[o]===void 0&&(i[o]=s[o]);e=i}return e}let Ft=class extends Ot{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=Dy("v"),this.cid}confirmUpdate(t,e){return 0}empty(t=this.container){return Kn(t),this}unmount(t=this.container){return Vt(t),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),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 O(e,Array.isArray(t)?t.join(" "):t),this}removeClass(t,e=this.container){return st(e,Array.isArray(t)?t.join(" "):t),this}setStyle(t,e=this.container){return $(e,t),this}setAttrs(t,e=this.container){return t!=null&&e!=null&&V(e,t),this}findAttr(t,e=this.container){let n=e;for(;n&&n.nodeType===1;){const i=n.getAttribute(t);if(i!=null)return i;if(n===this.container)return null;n=n.parentNode}return null}find(t,e=this.container,n=this.selectors){return Oh(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;for(;n!=null&&n.getAttribute;){const i=n.getAttribute(t);if((i!=null||n===this.container)&&i!=="false")return n;n=n.parentNode}return null}getSelector(t,e){let n;if(t===this.container)return typeof e=="string"&&(n=`> ${e}`),n;if(t){const i=Co(t)+1;n=`${t.tagName.toLowerCase()}:nth-child(${i})`,e&&(n+=` > ${e}`),n=this.getSelector(t.parentNode,n)}return n}prefixClassName(t){return _.prefix(t)}delegateEvents(t,e){if(t==null)return this;e||this.undelegateEvents();const n=/^(\S+)\s*(.*)$/;return Object.keys(t).forEach(i=>{const o=i.match(n);if(o==null)return;const r=this.getEventHandler(t[i]);typeof r=="function"&&this.delegateEvent(o[1],o[2],r)}),this}undelegateEvents(){return nt.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 nt.on(this.container,t+this.getEventNamespace(),e,n),this}undelegateEvent(t,e,n){const i=t+this.getEventNamespace();return e==null?nt.off(this.container,i):typeof e=="string"?nt.off(this.container,i,e,n):nt.off(this.container,i,e),this}addEventListeners(t,e,n){if(e==null)return this;const i=this.getEventNamespace();return Object.keys(e).forEach(o=>{const r=this.getEventHandler(e[o]);typeof r=="function"&&nt.on(t,o+i,n,r)}),this}removeEventListeners(t){return t!=null&&nt.off(t,this.getEventNamespace()),this}getEventNamespace(){return`.${_.prefixCls}-event-${this.cid}`}getEventHandler(t){let e;if(typeof t=="string"){const n=this[t];typeof n=="function"&&(e=(...i)=>n.call(this,...i))}else e=(...n)=>t.call(this,...n);return e}getEventTarget(t,e={}){const{target:n,type:i,clientX:o=0,clientY:r=0}=t;return e.fromPoint||i==="touchmove"||i==="touchend"?document.elementFromPoint(o,r):n}stopPropagation(t){return this.setEventData(t,{propagationStopped:!0}),this}isPropagationStopped(t){return this.getEventData(t).propagationStopped===!0}getEventData(t){return this.eventData(t)}setEventData(t,e){return this.eventData(t,e)}eventData(t,e){if(t==null)throw new TypeError("Event object required");let n=t.data;const i=`__${this.cid}__`;return e==null?n==null?{}:n[i]||{}:(n==null&&(n=t.data={}),n[i]==null?n[i]=Object.assign({},e):n[i]=Object.assign(Object.assign({},n[i]),e),n[i])}normalizeEvent(t){return Z1(t)}dispose(){this.remove()}};H([q()],Ft.prototype,"dispose",null);let Nh=0;function tv(s){return s?wo(s):(Nh+=1,`CustomTool${Nh}`)}class at extends Ft{static isToolItem(t){if(t==null)return!1;if(t instanceof at)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===Rh)&&n.graph!=null&&n.cell!=null&&typeof n.config=="function"&&typeof n.update=="function"&&typeof n.focus=="function"&&typeof n.blur=="function"&&typeof n.show=="function"&&typeof n.hide=="function"&&typeof n.isVisible=="function"}static define(t){const e=Po(tv(t.name),at);return e.config(t),e}static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){return ct(rt(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 Rh}constructor(t={}){super(),this.visible=!0,this.options=this.getOptions(t),this.container=Ge(this.options.tagName||"g",this.options.isSVGElement!==!1),O(this.container,this.prefixClassName("cell-tool")),typeof this.options.className=="string"&&O(this.container,this.options.className),this.init()}init(){}getOptions(t){return this.constructor.getOptions(t)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(t,e){return this.cellView=t,this.parent=e,this.stamp(this.container),this.cell.isEdge()?O(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&O(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=Pt.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 t!=null&&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 this.graph==null||this.cellView==null?!0:this.graph.view.guard(t,this.cellView)}}at.toStringTag=`X6.${at.name}`,at.defaults={isSVGElement:!0,tagName:"g"};const Rh=`X6.${at.name}`;class ev{constructor(t){this.view=t}get cell(){return this.view.cell}getDefinition(t){return this.cell.getAttrDefinition(t)}processAttrs(t,e){let n,i,o,r;const a=[];return Object.keys(e).forEach(l=>{const c=e[l],h=this.getDefinition(l),u=D(ix,this.view,h,c,{elem:t,attrs:e,cell:this.cell,view:this.view});if(h&&u)typeof h=="string"?(n==null&&(n={}),n[h]=c):c!==null&&a.push({name:l,definition:h});else{n==null&&(n={});const d=Hl.includes(l)?l:Yl(l);n[d]=c}}),a.forEach(({name:l,definition:c})=>{const h=e[l];typeof c.set=="function"&&(i==null&&(i={}),i[l]=h),typeof c.offset=="function"&&(o==null&&(o={}),o[l]=h),typeof c.position=="function"&&(r==null&&(r={}),r[l]=h)}),{raw:e,normal:n,set:i,offset:o,position:r}}mergeProcessedAttrs(t,e){var n;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 i=(n=t.normal)===null||n===void 0?void 0:n.transform;i!=null&&e.normal&&(e.normal.transform=i),t.normal=e.normal}findAttrs(t,e,n,i){const o=[],r=new Uo;return Object.keys(t).forEach(a=>{const l=t[a];if(!Zt(l))return;const{isCSSSelector:c,elems:h}=Oh(a,e,i);n[a]=h;for(let u=0,d=h.length;u<d;u+=1){const g=h[u],p=i&&i[a]===g,m=r.get(g);if(m){m.array||(o.push(g),m.array=!0,m.attrs=[m.attrs],m.priority=[m.priority]);const b=m.attrs,y=m.priority;if(p)b.unshift(l),y.unshift(-1);else{const C=My(y,c?-1:d);b.splice(C,0,l),y.splice(C,0,d)}}else r.set(g,{elem:g,attrs:l,priority:p?-1:d,array:!1})}}),o.forEach(a=>{const l=r.get(a),c=l.attrs;l.attrs=c.reduceRight((h,u)=>ct(h,u),{})}),r}updateRelativeAttrs(t,e,n){const i=e.raw||{};let o=e.normal||{};const r=e.set,a=e.position,l=e.offset,c=()=>({elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:n.clone()});if(r!=null&&Object.keys(r).forEach(b=>{const y=r[b],C=this.getDefinition(b);if(C!=null){const w=D(C.set,this.view,y,c());typeof w=="object"?o=Object.assign(Object.assign({},o),w):w!=null&&(o[b]=w)}}),t instanceof HTMLElement){this.view.setAttrs(o,t);return}const h=o.transform,u=h?`${h}`:null,d=Gn(u),g=new A(d.e,d.f);h&&(delete o.transform,d.e=0,d.f=0);let p=!1;a!=null&&Object.keys(a).forEach(b=>{const y=a[b],C=this.getDefinition(b);if(C!=null){const w=D(C.position,this.view,y,c());w!=null&&(p=!0,g.translate(A.create(w)))}}),this.view.setAttrs(o,t);let m=!1;if(l!=null){const b=this.view.getBoundingRectOfElement(t);if(b.width>0&&b.height>0){const y=Yt(b,d);Object.keys(l).forEach(C=>{const w=l[C],x=this.getDefinition(C);if(x!=null){const E=D(x.offset,this.view,w,{elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:y});E!=null&&(m=!0,g.translate(A.create(E)))}})}}(h!=null||p||m)&&(g.round(1),d.e=g.x,d.f=g.y,t.setAttribute("transform",Yn(d)))}update(t,e,n){const i={},o=this.findAttrs(n.attrs||e,t,i,n.selectors),r=n.attrs?this.findAttrs(e,t,i,n.selectors):o,a=[];o.each(h=>{const u=h.elem,d=h.attrs,g=this.processAttrs(u,d);if(g.set==null&&g.position==null&&g.offset==null)this.view.setAttrs(g.normal,u);else{const p=r.get(u),m=p?p.attrs:null,b=m&&d.ref==null?m.ref:d.ref;let y;if(b){if(y=(i[b]||this.view.find(b,t,n.selectors))[0],!y)throw new Error(`"${b}" reference does not exist.`)}else y=null;const C={node:u,refNode:y,attributes:m,processedAttributes:g},w=a.findIndex(x=>x.refNode===u);w>-1?a.splice(w,0,C):a.push(C)}});const l=new Uo;let c;a.forEach(h=>{const u=h.node,d=h.refNode;let g;const p=d!=null&&n.rotatableNode!=null&&Ao(n.rotatableNode,d);if(d&&(g=l.get(d)),!g){const y=p?n.rotatableNode:t;g=d?ce(d,{target:y}):n.rootBBox,d&&l.set(d,g)}let m;n.attrs&&h.attributes?(m=this.processAttrs(u,h.attributes),this.mergeProcessedAttrs(m,h.processedAttributes)):m=h.processedAttributes;let b=g;p&&n.rotatableNode!=null&&!n.rotatableNode.contains(u)&&(c||(c=Gn(V(n.rotatableNode,"transform"))),b=Yt(g,c)),this.updateRelativeAttrs(u,m,b)})}}class nv{constructor(t){this.view=t,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Uo,this.pathCache={}}get(t){return this.elemCache.has(t)||this.elemCache.set(t,{}),this.elemCache.get(t)}getData(t){const e=this.get(t);return e.data||(e.data={}),e.data}getMatrix(t){const e=this.get(t);if(e.matrix==null){const n=this.view.container;e.matrix=_C(t,n)}return At(e.matrix)}getShape(t){const e=this.get(t);return e.shape==null&&(e.shape=Mc(t)),e.shape.clone()}getBoundingRect(t){const e=this.get(t);return e.boundingRect==null&&(e.boundingRect=mA(t)),e.boundingRect.clone()}}class iv{get cell(){return this.view.cell}constructor(t,e,n=[]){this.view=t;const i={},o={};let r=0;Object.keys(e).forEach(l=>{let c=e[l];Array.isArray(c)||(c=[c]),c.forEach(h=>{let u=i[h];u||(r+=1,u=i[h]=1<<r),o[l]|=u})});let a=n;if(Array.isArray(a)||(a=[a]),a.forEach(l=>{i[l]||(r+=1,i[l]=1<<r)}),r>25)throw new Error("Maximum number of flags exceeded.");this.flags=i,this.attrs=o,this.bootstrap=n}getFlag(t){const e=this.flags;return e==null?0:Array.isArray(t)?t.reduce((n,i)=>n|e[i],0):e[t]|0}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}}class xt extends Ft{static getDefaults(){return xt.defaults}static isCellView(t){if(t==null)return!1;if(t instanceof xt)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===Dh)&&typeof n.isNodeView=="function"&&typeof n.isEdgeView=="function"&&typeof n.confirmUpdate=="function"}static config(t){xt.defaults=xt.getOptions(t)}static getOptions(t){const e=(c,h)=>h!=null?Al([...Array.isArray(c)?c:[c],...Array.isArray(h)?h:[h]]):Array.isArray(c)?[...c]:[c],n=rt(xt.getDefaults()),{bootstrap:i,actions:o,events:r,documentEvents:a}=t,l=K(t,["bootstrap","actions","events","documentEvents"]);return i&&(n.bootstrap=e(n.bootstrap,i)),o&&Object.entries(o).forEach(([c,h])=>{const u=n.actions[c];h&&u?n.actions[c]=e(u,h):h&&(n.actions[c]=e(h))}),r&&(n.events=Object.assign(Object.assign({},n.events),r)),t.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),a)),ct(n,l)}get[Symbol.toStringTag](){return Dh}constructor(t,e={}){super(),this.cell=t,this.options=this.ensureOptions(e),this.graph=this.options.graph,this.attr=new ev(this),this.flag=new iv(this,this.options.actions,this.options.bootstrap),this.cache=new nv(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 Ge(this.getContainerTagName(),this.options.isSvgElement)}setContainer(t){if(this.container!==t){this.undelegateEvents(),this.container=t,this.options.events!=null&&this.delegateEvents(this.options.events);const e=this.getContainerAttrs();e!=null&&this.setAttrs(e,t);const n=this.getContainerStyle();n!=null&&this.setStyle(n,t);const i=this.getContainerClassName();i!=null&&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 o=[e];return i&&(typeof i=="string"?o.push(i):o.push(...i)),this.removeAction(t,o)}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),this.graph!=null&&this.graph.renderer.requestViewUpdate(this,e,t))}parseJSONMarkup(t,e){const n=Pt.parseJSONMarkup(t),i=n.selectors,o=this.rootSelector;if(e&&o){if(i[o])throw new Error("Invalid root selector");i[o]=e}return n}can(t){let e=this.graph.options.interacting;if(typeof e=="function"&&(e=D(e,this.graph,this)),typeof e=="object"){let n=e[t];return typeof n=="function"&&(n=D(n,this.graph,this)),n!==!1}return typeof e=="boolean"?e:!1}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(),o=this.getRootTranslatedMatrix();return Yt(e,o.multiply(i).multiply(n))}getUnrotatedBBoxOfElement(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootTranslatedMatrix();return Yt(e,i.multiply(n))}getBBox(t={}){let e;if(t.useCellGeometry){const n=this.cell,i=n.isNode()?n.getAngle():0;e=n.getBBox().bbox(i)}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 At().translate(e.x,e.y)}getRootRotatedMatrix(){let t=At();const e=this.cell,n=e.isNode()?e.getAngle():0;if(n){const i=e.getBBox(),o=i.width/2,r=i.height/2;t=t.translate(o,r).rotate(n).translate(-o,-r)}return t}findMagnet(t=this.container){return this.findByAttr("magnet",t)}updateAttrs(t,e,n={}){n.rootBBox==null&&(n.rootBBox=new P),n.selectors==null&&(n.selectors=this.selectors),this.attr.update(t,e,n)}isEdgeElement(t){return this.cell.isEdge()&&(t==null||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,o){const r=this.cell,a=this.findAttr("port",t),l=t.getAttribute("data-selector"),c={cell:r.id};return l!=null&&(c.magnet=l),a!=null?(c.port=a,r.isNode()&&!r.hasPort(a)&&l==null&&(c.selector=this.getSelector(t))):l==null&&this.container!==t&&(c.selector=this.getSelector(t)),c}getMagnetFromEdgeTerminal(t){const e=this.cell,n=this.container,i=t.port;let o=t.magnet,r;return i!=null&&e.isNode()&&e.hasPort(i)?r=this.findPortElem(i,o)||n:(o||(o=t.selector),!o&&i!=null&&(o=`[port="${i}"]`),r=this.findOne(o,n,this.selectors)),r}hasTools(t){const e=this.tools;return e==null?!1:t==null?!0:e.name===t}addTools(t){if(this.removeTools(),t){if(!this.can("toolsAddable"))return this;const e=Ye.isToolsView(t)?t:new Ye(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,o=i.cell;return e==null||n==null?{e:t,view:i,cell:o}:{e:t,x:e,y:n,view:i,cell:o}}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)}}xt.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},xt.registry=ut.create({type:"view"}),H([q()],xt.prototype,"dispose",null);const Dh=`X6.${xt.name}`;class Ye extends Ft{static isToolsView(t){if(t==null)return!1;if(t instanceof Ye)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===Qh)&&n.graph!=null&&n.cell!=null&&typeof n.config=="function"&&typeof n.update=="function"&&typeof n.focus=="function"&&typeof n.blur=="function"&&typeof n.show=="function"&&typeof n.hide=="function"}get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return Qh}constructor(t={}){super(),this.svgContainer=this.createContainer(!0,t),this.htmlContainer=this.createContainer(!1,t),this.config(t)}createContainer(t,e){const n=t?Ge("g",!0):Ge("div",!1);return O(n,this.prefixClassName("cell-tools")),e.className&&O(n,e.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!xt.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(O(this.svgContainer,this.prefixClassName("edge-tools")),O(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(O(this.svgContainer,this.prefixClassName("node-tools")),O(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(i=>{at.isToolItem(i)?i.name==="vertices"?n.unshift(i):n.push(i):(typeof i=="object"?i.name:i)==="vertices"?n.unshift(i):n.push(i)});for(let i=0;i<n.length;i+=1){const o=n[i];let r;if(at.isToolItem(o))r=o;else{const a=typeof o=="object"?o.name:o,l=typeof o=="object"?o.args||{}:{};if(a){if(this.cell.isNode()){const c=mi.get(a);if(c)r=new c(l);else return mi.onNotFound(a)}else if(this.cell.isEdge()){const c=bi.get(a);if(c)r=new c(l);else return bi.onNotFound(a)}}}r&&(r.config(this.cellView,this),r.render(),(r.options.isSVGElement!==!1?this.svgContainer:this.htmlContainer).appendChild(r.container),this.tools.push(r))}return this}update(t={}){const e=this.tools;return e&&e.forEach(n=>{t.toolId!==n.cid&&n.isVisible()&&n.update()}),this}focus(t){const e=this.tools;return e&&e.forEach(n=>{t===n?n.show():n.hide()}),this}blur(t){const e=this.tools;return e&&e.forEach(n=>{n!==t&&!n.isVisible()&&(n.show(),n.update())}),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){const t=this.tools;return t&&(t.forEach(e=>e.remove()),this.tools=null),Vt(this.svgContainer),Vt(this.htmlContainer),super.remove()}mount(){const t=this.tools,e=this.cellView;if(e&&t){const n=t.some(o=>o.options.isSVGElement!==!1),i=t.some(o=>o.options.isSVGElement===!1);n&&(this.options.local?e.container:e.graph.view.decorator).appendChild(this.svgContainer),i&&this.graph.container.appendChild(this.htmlContainer)}return this}}Ye.toStringTag=`X6.${Ye.name}`;const Qh=`X6.${Ye.name}`,sv=s=>s;function Lh(s,t){return t===0?"0%":`${Math.round(s/t*100)}%`}function Fh(s){return(e,n,i,o)=>n.isEdgeElement(i)?rv(s,e,n,i,o):ov(s,e,n,i,o)}function ov(s,t,e,n,i){const o=e.cell,r=o.getAngle(),a=e.getUnrotatedBBoxOfElement(n),l=o.getBBox().getCenter(),c=A.create(i).rotate(r,l);let h=c.x-a.x,u=c.y-a.y;return s&&(h=Lh(h,a.width),u=Lh(u,a.height)),t.anchor={name:"topLeft",args:{dx:h,dy:u,rotate:!0}},t}function rv(s,t,e,n,i){const o=e.getConnection();if(!o)return t;const r=o.closestPointLength(i);if(s){const a=o.length();t.anchor={name:"ratio",args:{ratio:r/a}}}else t.anchor={name:"length",args:{length:r}};return t}const av=Fh(!0),lv=Fh(!1),zh=Object.freeze(Object.defineProperty({__proto__:null,noop:sv,pinAbsolute:lv,pinRelative:av},Symbol.toStringTag,{value:"Module"}));ut.create({type:"connection strategy"}).register(zh,!0);function Uh(s,t,e,n){return D(zh.pinRelative,this.graph,{},t,e,s,this.cell,n,{}).anchor}function Kh(s,t){return t?s.cell.getBBox():s.cell.isEdge()?s.getConnection().bbox():s.getUnrotatedBBoxOfElement(s.container)}class di extends at{get type(){return this.options.type}onRender(){O(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){const t=this.type;return this.cellView.getTerminalView(t)?(this.updateAnchor(),this.updateArea(),this.container.style.display=""):this.container.style.display="none",this}updateAnchor(){const t=this.childNodes;if(!t)return;const e=t.anchor;if(!e)return;const n=this.type,i=this.cellView,o=this.options,r=i.getTerminalAnchor(n),a=i.cell.prop([n,"anchor"]);e.setAttribute("transform",`translate(${r.x}, ${r.y})`);const l=a?o.customAnchorAttrs:o.defaultAnchorAttrs;l&&Object.keys(l).forEach(c=>{e.setAttribute(c,l[c])})}updateArea(){const t=this.childNodes;if(!t)return;const e=t.area;if(!e)return;const n=this.type,i=this.cellView,o=i.getTerminalView(n);if(o){const r=o.cell,a=i.getTerminalMagnet(n);let l=this.options.areaPadding||0;Number.isFinite(l)||(l=0);let c,h,u;o.isEdgeElement(a)?(c=o.getBBox(),h=0,u=c.getCenter()):(c=o.getUnrotatedBBoxOfElement(a),h=r.getAngle(),u=c.getCenter(),h&&u.rotate(-h,r.getBBox().getCenter())),c.inflate(l),V(e,{x:-c.width/2,y:-c.height/2,width:c.width,height:c.height,transform:`translate(${u.x}, ${u.y}) rotate(${h})`})}}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,i=n.getTerminalView(e);if(i==null)return;const o=this.normalizeEvent(t),r=i.cell,a=n.getTerminalMagnet(e);let l=this.graph.coord.clientToLocalPoint(o.clientX,o.clientY);const c=this.options.snap;if(typeof c=="function"){const d=D(c,n,l,i,a,e,n,this);l=A.create(d)}if(this.options.restrictArea)if(i.isEdgeElement(a)){const d=i.getClosestPoint(l);d&&(l=d)}else{const d=i.getUnrotatedBBoxOfElement(a),g=r.getAngle(),p=r.getBBox().getCenter(),m=l.clone().rotate(g,p);d.containsPoint(m)||(l=d.getNearestPointToPoint(m).rotate(-g,p))}let h;const u=this.options.anchor;typeof u=="function"&&(h=D(u,n,l,i,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(t===!0?void 0:t),this.update()}}di.defaults=Object.assign(Object.assign({},at.getDefaults()),{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:Uh,snap(s,t,e,n,i,o){const r=o.options.snapRadius||0,a=n==="source",l=a?0:-1,c=this.cell.getVertexAt(l)||this.getTerminalAnchor(a?"target":"source");return c&&(Math.abs(c.x-s.x)<r&&(s.x=c.x),Math.abs(c.y-s.y)<r&&(s.y=c.y)),s}});class Jh extends di{}Jh.defaults=Object.assign(Object.assign({},di.getDefaults()),{name:"source-anchor",type:"source"});class jh extends di{}jh.defaults=Object.assign(Object.assign({},di.getDefaults()),{name:"target-anchor",type:"target"});class gi extends at{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=K(t,["class"]);this.setAttrs(n,this.container),e&&O(this.container,e)}}onRender(){O(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),o=n&&n.vector().vectorAngle(new A(1,0))||0;if(!i)return this;const r=At().translate(i.x,i.y).rotate(o);return fn(this.container,r,{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})}}gi.defaults=Object.assign(Object.assign({},at.getDefaults()),{tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}});class Vh extends gi{}Vh.defaults=Object.assign(Object.assign({},gi.getDefaults()),{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"}});class Gh extends gi{}Gh.defaults=Object.assign(Object.assign({},gi.getDefaults()),{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 tr extends at{onRender(){if(O(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const t=this.options.attrs,{class:e}=t,n=K(t,["class"]);V(this.container,jn(n)),e&&O(this.container,e)}this.update()}update(){const t=this.cellView,e=this.options,{useCellGeometry:n,rotate:i}=e,o=ee(e.padding);let r=Kh(t,n);this.parent.options.local&&(r=r.translate({x:-r.x,y:-r.y})),r=r.moveAndExpand({x:-o.left,y:-o.top,width:o.left+o.right,height:o.top+o.bottom});const a=t.cell;if(a.isNode()){const l=a.getAngle();if(l!=null)if(i&&!this.parent.options.local){const c=a.getBBox().getCenter();No(this.container,l,c.x,c.y,{absolute:!0})}else i||(r=r.bbox(l))}return V(this.container,r.toJSON()),this}}tr.defaults=Object.assign(Object.assign({},at.getDefaults()),{name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}});class fi extends at{onRender(){O(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){const e=this.cellView.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();fn(this.container,e,{absolute:!0})}getNodeMatrix(){const t=this.cellView,e=this.options;let{x:n=0,y:i=0}=e;const{offset:o,useCellGeometry:r,rotate:a}=e;let l=Kh(t,r);const c=t.cell.getAngle();a||(l=l.bbox(c));let h=0,u=0;typeof o=="number"?(h=o,u=o):typeof o=="object"&&(h=o.x,u=o.y),n=zt(n,l.width),i=zt(i,l.height);let d=At();return this.parent.options.local?d=d.translate(l.width/2,l.height/2):d=d.translate(l.x+l.width/2,l.y+l.height/2),a&&(d=d.rotate(c)),d=d.translate(n+h-l.width/2,i+u-l.height/2),d}getEdgeMatrix(){const t=this.cellView,e=this.options,{offset:n=0,distance:i=0,rotate:o}=e,r=zt(i,1),a=r>=0&&r<=1?t.getTangentAtRatio(r):t.getTangentAtLength(r),l=a?a.start:t.getConnection().start,c=a&&a.vector().vectorAngle(new A(1,0))||0;let h=At().translate(l.x,l.y).rotate(c);return typeof n=="object"?h=h.translate(n.x||0,n.y||0):h=h.translate(0,n),o||(h=h.rotate(-c)),h}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.options.onClick;typeof e=="function"&&D(e,this.cellView,{e:t,view:this.cellView,cell:this.cellView.cell,btn:this})}}fi.defaults=Object.assign(Object.assign({},at.getDefaults()),{name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}});class er extends fi{}er.defaults=Object.assign(Object.assign({},fi.getDefaults()),{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:s,btn:t}){t.parent.remove(),s.cell.remove({ui:!0,toolId:t.cid})}});class pi extends at{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=Ge("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 o=this.getCellText()||"";return e.innerText=o,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:t,cell:e,editor:n}=this;if(!n)return;let i=A.create(),o=20,r="",{x:a,y:l}=this.options;const{width:c,height:h}=this.options;if(typeof a<"u"&&typeof l<"u"){const g=e.getBBox();a=zt(a,g.width),l=zt(l,g.height),i=g.topLeft.translate(a,l),o=g.width-a*2}else{const g=e.getBBox();i=g.center,o=g.width-4,r="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}) ${r}`,d.minWidth=`${o}px`,typeof c=="number"&&(d.width=`${c}px`),typeof h=="number"&&(d.height=`${h}px`)}updateEdgeEditorTransform(){if(!this.event)return;const{graph:t,editor:e}=this;if(!e)return;let n=A.create(),i=20;const{style:o}=e,r=this.event.target,a=r.parentElement;if(a&&le(a,this.prefixClassName("edge-label"))){const h=a.getAttribute("data-index")||"0";this.labelIndex=parseInt(h,10);const u=a.getAttribute("transform"),{translation:d}=ns(u);n=new A(d.tx,d.ty),i=ce(r).width}else{if(!this.options.labelAddable)return this;n=t.clientToLocal(A.create(this.event.clientX,this.event.clientY));const u=this.cellView.path.closestPointLength(n);this.distance=u,this.labelIndex=-1}n=t.localToGraph(n);const c=t.scale();o.left=`${n.x}px`,o.top=`${n.y}px`,o.minWidth=`${i}px`,o.transform=`scale(${c.sx}, ${c.sy}) translate(-50%, -50%)`}updateCell(){const t=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(t!==""?t:null),this.removeElement()}onDocumentMouseUp(t){this.editor&&t.target!==this.editor&&this.updateCell()}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(typeof t=="function")return D(t,this.cellView,{cell:this.cell,index:this.labelIndex});if(typeof t=="string"){if(this.cell.isNode())return this.cell.attr(t);if(this.cell.isEdge()&&this.labelIndex!==-1)return this.cell.prop(`labels/${this.labelIndex}/attrs/${t}`)}}setCellText(t){const e=this.options.setText;if(typeof e=="function"){D(e,this.cellView,{cell:this.cell,value:t,index:this.labelIndex,distance:this.distance});return}if(typeof e=="string"){if(this.cell.isNode()){t!==null&&this.cell.attr(e,t);return}if(this.cell.isEdge()){const n=this.cell;if(this.labelIndex===-1){if(t){const i={position:{distance:this.distance},attrs:{}};gn(i,`attrs/${e}`,t),n.appendLabel(i)}}else t!==null?n.prop(`labels/${this.labelIndex}/attrs/${e}`,t):typeof this.labelIndex=="number"&&n.removeLabelAt(this.labelIndex)}}}onRemove(){const t=this.cellView;t&&t.off("cell:dblclick",this.dblClick),this.removeElement()}}pi.defaults=Object.assign(Object.assign({},at.getDefaults()),{tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}});class Yh extends pi{}Yh.defaults=ct({},pi.defaults,{attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"});class Hh extends pi{}Hh.defaults=ct({},pi.defaults,{attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"});class nr extends at{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}getPoints(){const e=this.cellView.routePoints;if(e.length<=2)return e;const n=[e[0]];for(let i=1;i<e.length-1;i++){const o=n[n.length-1],r=e[i],a=e[i+1];(r.x-o.x)*(a.y-o.y)-(r.y-o.y)*(a.x-o.x)!==0&&n.push(r)}return n.push(e[e.length-1]),n}onRender(){O(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();const t=this.cellView,e=[...this.getPoints()];e.unshift(t.sourcePoint),e.push(t.targetPoint);for(let n=0,i=e.length;n<i-1;n+=1){const o=e[n],r=e[n+1],a=this.renderHandle(o,r,n);this.stamp(a.container),this.handles.push(a)}return this}renderHandle(t,e,n){const i=this.options.createHandle({index:n,graph:this.graph,guard:o=>this.guard(o),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(e=>{this.stopHandleListening(e),e.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,o=t.options.index,l=this.cellView.cell.getVertices(),c=l[o-2]||n.sourceAnchor,h=l[o+1]||n.targetAnchor,u=this.options.snapRadius;return Math.abs(e[i]-c[i])<u?e[i]=c[i]:Math.abs(e[i]-h[i])<u&&(e[i]=h[i]),e}onHandleChanging({handle:t,e}){const n=this.graph,i=this.options,o=this.cellView,r=i.anchor,a=t.options.axis,l=t.options.index-1,c=this.getEventData(e),h=this.normalizeEvent(e),u=n.snapToGrid(h.clientX,h.clientY),d=this.snapHandle(t,u.clone(),c),g=rt(this.vertices);let p=g[l],m=g[l+1];const b=o.sourceView,y=o.sourceBBox;let C=!1,w=!1;if(p?l===0?y.containsPoint(p)?(g.shift(),this.shiftHandleIndexes(-1),C=!0):(p[a]=d[a],w=!0):p[a]=d[a]:(p=o.sourceAnchor.toJSON(),p[a]=d[a],y.containsPoint(p)?C=!0:(g.unshift(p),this.shiftHandleIndexes(1),w=!0)),typeof r=="function"&&b){if(C){const M=c.sourceAnchor.clone();M[a]=d[a];const I=D(r,o,M,b,o.sourceMagnet||b.container,"source",o,this);this.resetAnchor("source",I)}w&&this.resetAnchor("source",c.sourceAnchorDef)}const x=o.targetView,E=o.targetBBox;let B=!1,v=!1;if(m?l===g.length-2?E.containsPoint(m)?(g.pop(),B=!0):(m[a]=d[a],v=!0):m[a]=d[a]:(m=o.targetAnchor.toJSON(),m[a]=d[a],E.containsPoint(m)?B=!0:(g.push(m),v=!0)),typeof r=="function"&&x){if(B){const M=c.targetAnchor.clone();M[a]=d[a];const I=D(r,o,M,x,o.targetMagnet||x.container,"target",o,this);this.resetAnchor("target",I)}v&&this.resetAnchor("target",c.targetAnchorDef)}A.equalPoints(g,this.vertices)||this.cellView.cell.setVertices(g,{ui:!0,toolId:this.cid}),this.updateHandle(t,p,m,0),i.stopPropagation||o.notifyMouseMove(h,u.x,u.y)}onHandleChange({handle:t,e}){const n=this.options,i=this.handles,o=this.cellView,r=t.options.index;if(Array.isArray(i)){for(let a=0,l=i.length;a<l;a+=1)a!==r&&i[a].hide();if(this.focus(),this.setEventData(e,{sourceAnchor:o.sourceAnchor.clone(),targetAnchor:o.targetAnchor.clone(),sourceAnchorDef:rt(this.cell.prop(["source","anchor"])),targetAnchorDef:rt(this.cell.prop(["target","anchor"]))}),this.cell.startBatch("move-segment",{ui:!0,toolId:this.cid}),!n.stopPropagation){const a=this.normalizeEvent(e),l=this.graph.snapToGrid(a.clientX,a.clientY);o.notifyMouseDown(a,l.x,l.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),o=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,o.x,o.y),n.checkMouseleave(i),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}updateHandle(t,e,n,i=0){const o=this.options.precision||0,r=Math.abs(e.x-n.x)<o,a=Math.abs(e.y-n.y)<o;if(r||a){const l=new N(e,n);if(l.length()<this.options.threshold)t.hide();else{const h=l.getCenter(),u=r?"x":"y";h[u]+=i||0;const d=l.vector().vectorAngle(new A(1,0));t.updatePosition(h.x,h.y,d,this.cellView),t.show(),t.options.axis=u}}else t.hide()}onRemove(){this.resetHandles()}}nr.defaults=Object.assign(Object.assign({},at.defaults),{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:s=>new cv(s),anchor:Uh});let cv=class extends Ft{constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=Ge("rect",!0);const t=this.options.attrs;if(typeof t=="function"){const e=nr.getDefaults();this.setAttrs(Object.assign(Object.assign({},e.attrs),t(this)))}else this.setAttrs(t);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(t,e,n,i){const o=i.getClosestPoint(new A(t,e))||new A(t,e);let r=At().translate(o.x,o.y);if(o.equals({x:t,y:e}))r=r.rotate(n);else{let l=new N(t,e,o.x,o.y).vector().vectorAngle(new A(1,0));l!==0&&(l+=90),r=r.rotate(l)}this.setAttrs({transform:Yn(r),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"}};const ir=_.prefix("edge-tool-vertex-path");class sr extends at{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){return this.vertices.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach(e=>{this.stopHandleListening(e),e.remove()})}renderHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const i=t[e],o=this.options.createHandle,r=this.options.processHandle,a=o({index:e,graph:this.graph,guard:l=>this.guard(l),attrs:this.options.attrs||{}});r&&r(a),a.updatePosition(i.x,i.y),this.stamp(a.container),this.container.appendChild(a.container),this.handles.push(a),this.startHandleListening(a)}}updateHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const i=t[e],o=this.handles[e];o&&o.updatePosition(i.x,i.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,o=t<n.length-1?n[t+1]:e.targetAnchor;return{prev:A.create(i),next:A.create(o)}}getMouseEventArgs(t){const e=this.normalizeEvent(t),{x:n,y:i}=this.graph.snapToGrid(e.clientX,e.clientY);return{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:o}=this.getMouseEventArgs(t);this.eventData(n,{start:{x:i,y:o}}),e.notifyMouseDown(n,i,o)}}onHandleChanging({handle:t,e}){const n=this.cellView,i=t.options.index,{e:o,x:r,y:a}=this.getMouseEventArgs(e),l={x:r,y:a};this.snapVertex(l,i),n.cell.setVertexAt(i,l,{ui:!0,toolId:this.cid}),t.updatePosition(l.x,l.y),this.options.stopPropagation||n.notifyMouseMove(o,r,a)}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){this.stopBatch(this.eventData(t).vertexAdded);return}n.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(t).vertexAdded);const{e:o,x:r,y:a}=this.getMouseEventArgs(t);if(!this.options.stopPropagation){n.notifyMouseUp(o,r,a);const{start:l}=this.eventData(o);if(l){const{x:c,y:h}=l;c===r&&h===a&&n.onClick(o,r,a)}}n.checkMouseleave(o),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),o=i.prev,r=i.next;Math.abs(t.x-o.x)<n?t.x=o.x:Math.abs(t.x-r.x)<n&&(t.x=r.x),Math.abs(t.y-o.y)<n?t.y=i.prev.y:Math.abs(t.y-r.y)<n&&(t.y=r.y)}}onHandleRemove({handle:t,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?Te(t,this.options.modifiers):!0;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 o=e.getVertexIndex(i.x,i.y);this.snapVertex(i,o),e.cell.insertVertex(i,o,{ui:!0,toolId:this.cid}),this.render();const r=this.handles[o];this.eventData(n,{vertexAdded:!0}),r.onMouseDown(n)}onRemove(){this.resetHandles()}}sr.defaults=Object.assign(Object.assign({},at.getDefaults()),{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:s=>new hv(s),markup:[{tagName:"path",selector:"connection",className:ir,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${ir}`]:"onPathMouseDown",[`touchstart .${ir}`]:"onPathMouseDown"}});class hv extends Ft{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=Ge("circle",!0);const t=this.options.attrs;if(typeof t=="function"){const e=sr.getDefaults();this.setAttrs(Object.assign(Object.assign({},e.attrs),t(this)))}else this.setAttrs(t);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})}}const uv={boundary:tr,button:fi,"button-remove":er,"node-editor":Yh},mi=ut.create({type:"node tool",process(s,t){if(typeof t=="function")return t;let e=at;const{inherit:n}=t,i=K(t,["inherit"]);if(n){const o=this.get(n);o==null?this.onNotFound(n,"inherited"):e=o}return i.name==null&&(i.name=s),e.define.call(e,i)}});mi.register(uv,!0);const dv={boundary:tr,vertices:sr,segments:nr,button:fi,"button-remove":er,"source-anchor":Jh,"target-anchor":jh,"source-arrowhead":Vh,"target-arrowhead":Gh,"edge-editor":Hh},bi=ut.create({type:"edge tool",process(s,t){if(typeof t=="function")return t;let e=at;const{inherit:n}=t,i=K(t,["inherit"]);if(n){const o=this.get(n);o==null?this.onNotFound(n,"inherited"):e=o}return i.name==null&&(i.name=s),e.define.call(e,i)}});bi.register(dv,!0);class qh{constructor(t,e,n,i){var o;this.target=t,this.cell=(o=this.target.effect)===null||o===void 0?void 0:o.target,this.type=e,this.bubbles=!1,this.currentTarget=t,this.defaultPrevented=!1,this.eventPhase=0,this.timeStamp=performance.now(),this.currentTime=n,this.timelineTime=i}}function vs(s){return s!=="offset"&&s!=="easing"&&s!=="composite"&&s!=="computedOffset"}function Wh(s,t){return s==="reverse"||s==="alternate"&&t%2===1||s==="alternate-reverse"&&t%2===0}class gv{constructor(t,e){this._effect=null,this._currentTime=null,this._playbackRate=1,this._playState="idle",this._rafId=null,this._startTime=null,this._pausedTime=null,this._timeline=null,this.id="",this.onfinish=null,this.oncancel=null,this._effect=t,this._timeline=e??document.timeline}get effect(){return this._effect}get currentTime(){return this._currentTime}set currentTime(t){const e=this._timeline.currentTime;be(e)&&(this._startTime=e-t,this._currentTime=t)}get playbackRate(){return this._playbackRate}set playbackRate(t){const e=this._playbackRate;this._playbackRate=t;const n=this._timeline.currentTime;if(this._playState==="running"&&this._startTime!=null&&be(n)){const i=(n-this._startTime)*e;this._startTime=n-i/t}}get playState(){return this._playState}get timeline(){return this._timeline}play(){if(this._playState==="running"||!this._effect)return;const t=this._timeline.currentTime;be(t)&&(this._playState==="paused"?(this._startTime=t-this._pausedTime/this._playbackRate,this._pausedTime=null):(this._currentTime=0,this._startTime=t),this._playState="running",this._tick())}pause(){this._playState==="running"&&(this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._pausedTime=this._currentTime,this._playState="paused")}finish(){var t;if(!this._effect)return;const e=this._effect.getComputedTiming(),n=this._playbackRate<0,{duration:i,endTime:o,direction:r,fill:a,iterations:l}=e;if(a==="forwards"||a==="both"){const h=n?0:l-1,u=Wh(r,h);this._effect.apply(u||n?0:i)}else(a==="none"||a==="backwards")&&this._effect.apply(null);this._currentTime=n?0:o,this._playState="finished",this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null);const c=new qh(this,"finish",this._currentTime,this._timeline.currentTime);(t=this.onfinish)===null||t===void 0||t.call(this,c),this._effect.target.notify("animation:finish",c)}cancel(){var t;if(!this._effect)return;this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._playState="idle",this._currentTime=null,this._startTime=null,this._pausedTime=null,this._effect.apply(null);const e=new qh(this,"cancel",this._currentTime,this._timeline.currentTime);(t=this.oncancel)===null||t===void 0||t.call(this,e),this._effect.target.notify("animation:cancel",e)}updatePlaybackRate(t){this.playbackRate=t}reverse(){this.playbackRate=this.playbackRate*-1}_tick(){const t=this._timeline.currentTime;if(this._playState!=="running"||!this._effect||!be(t))return;const e=this._effect.getComputedTiming(),{duration:n,delay:i,iterations:o,direction:r,endTime:a}=e,l=(t-this._startTime)*this._playbackRate,c=l-i;let h=Math.floor(c/n);if(l>=a||l<0||n<=0){this.finish();return}if(l>=i){let u=c%n;h=Math.min(h,o-1),Wh(r,h)&&(u=n-u),this._effect.apply(u)}this._currentTime=l,this._rafId=requestAnimationFrame(()=>this._tick())}}class fv{constructor(){this.animations=[]}addAnimation(t){this.animations.push(t)}getAnimations(){return this.animations}cancelAnimations(){this.animations.forEach(t=>{t.cancel()})}}class pv{constructor(t,e,n){this._originProps={},this._target=t,this._options=be(n)?{duration:n}:Object.assign({},n),this.setKeyframes(e)}get target(){return this._target}getKeyframes(){if(!this._keyframes||this._keyframes.length===0)return[];let t=[];if(Array.isArray(this._keyframes)&&(t=[...this._keyframes]),Zt(this._keyframes)){const n=Object.values(this._keyframes).map(o=>ka(o).length),i=Math.max(...n);for(let o=0;o<i;o++){const r={};Object.entries(this._keyframes).forEach(([a,l])=>{const c=ka(l)[o];vs(a)&&c!=null&&(r[a]=c)}),t.push(r)}}return t=t.map((e,n,i)=>{var o,r,a;const l=e??{},c={};return c.offset=l.offset,c.easing=(a=(o=l.easing)!==null&&o!==void 0?o:(r=i[n-1])===null||r===void 0?void 0:r.easing)!==null&&a!==void 0?a:this.getComputedTiming().easing,Object.keys(l).forEach(h=>{vs(h)&&(c[h]=l[h])}),c}),t=t.map((e,n)=>(e.offset==null?n===t.length-1?e.computedOffset=1:n===0?e.computedOffset=0:e.computedOffset=n/(t.length-1):e.computedOffset=e.offset,e)),t}setKeyframes(t){this._keyframes=t,this._computedKeyframes=this.getKeyframes(),this._computedKeyframes.forEach(e=>{Object.keys(e).forEach(n=>{vs(n)&&this._originProps[n]==null&&(this._originProps[n]=this.target.getPropByPath(n))})})}getTiming(){return Vb(this._options,mv)}getComputedTiming(){const t=this.getTiming(),e=t.duration*t.iterations;return Object.assign(Object.assign({},t),{activeDuration:e,endTime:e+t.delay})}apply(t){var e,n,i,o;if(!this._target||!this._computedKeyframes.length)return;if(t==null){Object.entries(this._originProps).forEach(([C,w])=>{this.target.setPropByPath(C,w)});return}const a=this.getComputedTiming().duration;if(a<0)return;const l=Math.min(t/a,1),c=this._computedKeyframes;if(c.length===0)return;let h={computedOffset:0},u={computedOffset:1};for(const C of c)if(l===0&&C.computedOffset===0&&(h=C),l===1&&C.computedOffset===1&&(u=C),C.computedOffset<l&&(h=C),C.computedOffset>l){u=C;break}const d=h.computedOffset,g=u.computedOffset,p=(l-d)/(g-d),m=(e=h.easing)!==null&&e!==void 0?e:u.easing,b=Ln(m),y=(n=nw[b])!==null&&n!==void 0?n:Pc;for(const C in Object.assign(Object.assign({},h),u))if(vs(C)&&(h[C]!=null||u[C]!=null)){const w=(i=h[C])!==null&&i!==void 0?i:this._originProps[C],x=(o=u[C])!==null&&o!==void 0?o:this._originProps[C];let E;String(w).startsWith("#")?E=AA:C.endsWith("transform")&&!be(w)?E=wA:Wn.test(String(w))||Wn.test(String(x))?E=Ic:E=Bc;const v=E(w,x)(y(p));this.target.setPropByPath(C,v)}}}const mv={delay:0,direction:"normal",duration:0,easing:"linear",fill:"none",iterations:1};class Xh extends Ot{constructor(t={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(rt(t)),this.changed={}}mutate(t,e={}){const n=e.unset===!0,i=e.silent===!0,o=[],r=this.changing;this.changing=!0,r||(this.previous=rt(this.data),this.changed={});const a=this.data,l=this.previous,c=this.changed;if(Object.keys(t).forEach(h=>{const u=h,d=t[u];me(a[u],d)||o.push(u),me(l[u],d)?delete c[u]:c[u]=d,n?delete a[u]:a[u]=d}),!i&&o.length>0&&(this.pending=!0,this.pendingOptions=e,o.forEach(h=>{this.emit("change:*",{key:h,options:e,store:this,current:a[h],previous:l[h]})})),r)return this;if(!i)for(;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(t==null)return this.data;const n=this.data[t];return n??e}getPrevious(t){if(this.previous){const e=this.previous[t];return e??void 0}}set(t,e,n){return t!=null&&(typeof t=="object"?this.mutate(t,e):this.mutate({[t]:e},n)),this}remove(t,e){const i={};let o;if(typeof t=="string")i[t]=void 0,o=e;else if(Array.isArray(t))t.forEach(r=>i[r]=void 0),o=e;else{for(const r in this.data)i[r]=void 0;o=t}return this.mutate(i,Object.assign(Object.assign({},o),{unset:!0})),this}getByPath(t){return To(this.data,t,"/")}setByPath(t,e,n={}){const i="/",o=Array.isArray(t)?[...t]:t.split(i),r=Array.isArray(t)?t.join(i):t,a=o[0],l=o.length;if(n.propertyPath=r,n.propertyValue=e,n.propertyPathArray=o,l===1)this.set(a,e,n);else{const c={};let h=c,u=a;for(let p=1;p<l;p+=1){const m=o[p],b=Number.isFinite(Number(m));h=h[u]=b?[]:{},u=m}gn(c,o,e,i);const d=rt(this.data);n.rewrite&&tc(d,t,i);const g=ct(d,c);this.set(a,g[a],n)}return this}removeByPath(t,e){const n=Array.isArray(t)?t:t.split("/"),i=n[0];if(n.length===1)this.remove(i,e);else{const o=n.slice(1),r=rt(this.get(i));r&&tc(r,o),this.set(i,r,e)}return this}hasChanged(t){return t==null?Object.keys(this.changed).length>0:t in this.changed}getChanges(t){if(t==null)return this.hasChanged()?rt(this.changed):null;const e=this.changing?this.previous:this.data,n={};let i;for(const o in t){const r=t[o];me(e[o],r)||(n[o]=r,i=!0)}return i?rt(n):null}toJSON(){return rt(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})}}H([q()],Xh.prototype,"dispose",null);class G extends Ot{static isCell(t){if(t==null)return!1;if(t instanceof G)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===G.toStringTag)&&typeof n.isNode=="function"&&typeof n.isEdge=="function"&&typeof n.prop=="function"&&typeof n.attr=="function"}static normalizeTools(t){if(typeof t=="string")return{items:[t]};if(Array.isArray(t))return{items:t};if(t.items)return t;if(Reflect.has(t,"local")){const e=t,{local:n}=e,i=K(e,["local"]);return{local:n,items:[i]}}return{items:[t]}}static getCommonAncestor(...t){const e=t.filter(i=>i!=null).map(i=>i.getAncestors()).sort((i,o)=>i.length-o.length);return e.shift().find(i=>e.every(o=>o.includes(i)))||null}static getCellsBBox(t,e={}){let n=null;for(let i=0,o=t.length;i<o;i+=1){const r=t[i];let a=r.getBBox(e);if(a){if(r.isNode()){const l=r.getAngle();l!=null&&l!==0&&(a=a.bbox(l))}n=n==null?a:n.union(a)}}return n}static deepClone(t){const e=[t,...t.getDescendants({deep:!0})];return G.cloneCells(e)}static cloneCells(t){const e=Al(t),n=e.reduce((i,o)=>(i[o.id]=o.clone(),i),{});return e.forEach(i=>{const o=n[i.id];if(o.isEdge()){const l=o.getSourceCellId(),c=o.getTargetCellId();l&&n[l]&&o.setSource(Object.assign(Object.assign({},o.getSource()),{cell:n[l].id})),c&&n[c]&&o.setTarget(Object.assign(Object.assign({},o.getTarget()),{cell:n[c].id}))}const r=i.getParent();r&&n[r.id]&&o.setParent(n[r.id]);const a=i.getChildren();if(a&&a.length){const l=a.reduce((c,h)=>(n[h.id]&&c.push(n[h.id]),c),[]);l.length>0&&o.setChildren(l)}}),n}static config(t){const{markup:e,propHooks:n,attrHooks:i}=t,o=K(t,["markup","propHooks","attrHooks"]);e!=null&&(this.markup=e),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):typeof n=="function"?this.propHooks.push(n):Object.values(n).forEach(r=>{typeof r=="function"&&this.propHooks.push(r)})),i&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),i)),this.defaults=ct({},this.defaults,o)}static getMarkup(){return this.markup}static getDefaults(t){return t?this.defaults:rt(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(t,e){return this.propHooks.reduce((n,i)=>i?D(i,t,n):n,e)}static generateId(t={}){return Bo()}get[Symbol.toStringTag](){return G.toStringTag}constructor(t={}){super();const n=this.constructor.getDefaults(!0),i=ct({},this.preprocess(n),this.preprocess(t));this.id=i.id||G.generateId(t),this.store=new Xh(i),this.animationManager=new fv,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,o=this.constructor.applyPropHooks(this,t);return n==null&&e!==!0&&(o.id=G.generateId(t)),o}postprocess(t){}setup(){this.store.on("change:*",t=>{const{key:e,current:n,previous:i,options:o}=t;this.notify("change:*",{key:e,options:o,current:n,previous:i,cell:this}),this.notify(`change:${e}`,{options:o,current:n,previous:i,cell:this});const r=e;(r==="source"||r==="target")&&this.notify("change:terminal",{type:r,current:n,previous:i,options:o,cell:this})}),this.store.on("changed",({options:t})=>this.notify("changed",{options:t,cell:this})),this.on("added",({cell:t})=>{const e=this.store.get("animation");lo(e)||e.forEach(n=>{t.animate(...n)})})}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 t==null?this.store.get():this.store.get(t,e)}setProp(t,e,n){if(typeof t=="string")this.store.set(t,e,n);else{const i=this.preprocess(t,!0);this.store.set(ct({},this.getProp(),i),e),this.postprocess(t)}return this}removeProp(t,e){return typeof t=="string"||Array.isArray(t)?this.store.removeByPath(t,e):this.store.remove(e),this}hasChanged(t){return t==null?this.store.hasChanged():this.store.hasChanged(t)}getPropByPath(t){return this.store.getByPath(t)}setPropByPath(t,e,n={}){return this.model&&(t==="children"?this._children=e?e.map(i=>this.model.getCell(i)).filter(i=>i!=null):null:t==="parent"&&(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 n[0]==="attrs"&&(e.dirty=!0),this.store.removeByPath(n,e),this}prop(t,e,n){return t==null?this.getProp():typeof t=="string"||Array.isArray(t)?arguments.length===1?this.getPropByPath(t):e==null?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){t==null?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=e.getMaxZIndex(),i;t.deep?(i=this.getDescendants({deep:!0,breadthFirst:!0}),i.unshift(this)):i=[this],n=n-i.length+1;const o=e.total();let r=e.indexOf(this)!==o-i.length;r||(r=i.some((a,l)=>a.getZIndex()!==n+l)),r&&this.batchUpdate("to-front",()=>{n+=i.length,i.forEach((a,l)=>{a.setZIndex(n+l,t)})})}return this}toBack(t={}){const e=this.model;if(e){let n=e.getMinZIndex(),i;t.deep?(i=this.getDescendants({deep:!0,breadthFirst:!0}),i.unshift(this)):i=[this];let o=e.indexOf(this)!==0;o||(o=i.some((r,a)=>r.getZIndex()!==n+a)),o&&this.batchUpdate("to-back",()=>{n-=i.length,i.forEach((r,a)=>{r.setZIndex(n+a,t)})})}return this}get markup(){return this.getMarkup()}set markup(t){t==null?this.removeMarkup():this.setMarkup(t)}getMarkup(){let t=this.store.get("markup");return t==null&&(t=this.constructor.getMarkup()),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){t==null?this.removeAttrs():this.setAttrs(t)}getAttrs(){const t=this.store.get("attrs");return t?Object.assign({},t):{}}setAttrs(t,e={}){if(t==null)this.removeAttrs(e);else{const n=i=>this.store.set("attrs",i,e);if(e.overwrite===!0)n(t);else{const i=this.getAttrs();e.deep===!1?n(Object.assign(Object.assign({},i),t)):n(ct({},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 n=this.constructor.getAttrHooks()||{};let i=n[t]||$n.get(t);if(!i){const o=Ln(t);i=n[o]||$n.get(o)}return i||null}getAttrByPath(t){return t==null||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 t==null?this.getAttrByPath():typeof t=="string"||Array.isArray(t)?arguments.length===1?this.getAttrByPath(t):e==null?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 this.store.get("visible")!==!1}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=typeof t=="boolean"?t:!this.isVisible(),i=typeof t=="boolean"?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(t==null)this.removeData(e);else{const n=i=>this.store.set("data",i,e);if(e.overwrite===!0)n(t);else{const i=this.getData();e.deep===!1?n(typeof t=="object"?Object.assign(Object.assign({},i),t):t):n(ct({},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(n=>{var i;return(i=this.model)===null||i===void 0?void 0:i.getCell(n)}).filter(n=>n!=null);return this._children=e,[...e]}return null}hasParent(){return this.parent!=null}isParentOf(t){return t!=null&&t.getParent()===this}isChildOf(t){return t!=null&&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 this.children==null?0:this.children.length}getChildIndex(t){return this.children==null?-1:this.children.indexOf(t)}getChildAt(t){return this.children!=null&&t>=0?this.children[t]:null}getAncestors(t={}){const e=[];let n=this.getParent();for(;n;)e.push(n),n=t.deep!==!1?n.getParent():null;return e}getDescendants(t={}){if(t.deep!==!1){if(t.breadthFirst){const e=[],n=this.getChildren()||[];for(;n.length>0;){const i=n.shift(),o=i.getChildren();e.push(i),o&&n.push(...o)}return e}{const e=this.getChildren()||[];return e.forEach(n=>{e.push(...n.getDescendants(t))}),e}}return this.getChildren()||[]}isDescendantOf(t,e={}){if(t==null)return!1;if(e.deep!==!1){let n=this.getParent();for(;n;){if(n===t)return!0;n=n.getParent()}return!1}return this.isChildOf(t)}isAncestorOf(t,e={}){return t==null?!1:t.isDescendantOf(this,e)}contains(t){return this.isAncestorOf(t)}getCommonAncestor(...t){return G.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,t!=null?this.store.set("children",t.map(n=>n.id),e):this.store.remove("children",e),this}unembed(t,e={}){const n=this.children;if(n!=null&&t!=null){const i=this.getChildIndex(t);i!==-1&&(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 G.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(t!=null&&t!==this){const i=t.getParent(),o=this!==i;let r=e;if(r==null&&(r=this.getChildCount(),o||(r-=1)),i){const l=i.getChildren();if(l){const c=l.indexOf(t);c>=0&&(t.setParent(null,n),l.splice(c,1),i.setChildren(l,n))}}let a=this.children;if(a==null?(a=[],a.push(t)):a.splice(r,0,t),t.setParent(this,n),this.setChildren(a,n),o&&this.model){const l=this.model.getIncomingEdges(this),c=this.model.getOutgoingEdges(this);l&&l.forEach(h=>h.updateParent(n)),c&&c.forEach(h=>h.updateParent(n))}this.model&&this.model.addCell(t,n)}return this}removeFromParent(t={}){const e=this.getParent();if(e!=null){const n=e.getChildIndex(this);e.removeChildAt(n,t)}return this}removeChild(t,e={}){const n=this.getChildIndex(t);return this.removeChildAt(n,e)}removeChildAt(t,e={}){const n=this.getChildAt(t);return this.children!=null&&n!=null&&(this.unembed(n,e),n.remove(e)),n}remove(t={}){return this.batchUpdate("remove",()=>{const e=this.getParent();e&&e.removeChild(this,t),t.deep!==!1&&this.eachChild(n=>n.remove(t)),this.model&&this.model.removeCell(this,t),this.dispose()}),this}animate(t,e){var n;const i=be(e)?{duration:e}:Object.assign({},e),o=new pv(this,t,i),r=new gv(o,i.timeline);return this.animationManager.addAnimation(r),r.id=(n=i.id)!==null&&n!==void 0?n:"",r.play(),r}getAnimations(){return this.animationManager.getAnimations()}translate(t,e,n){return this}scale(t,e,n,i){return this}addTools(t,e,n){const i=Array.isArray(t)?t:[t],o=typeof e=="string"?e:null,r=typeof e=="object"?e:typeof n=="object"?n:{};if(r.reset)return this.setTools({name:o,items:i,local:r.local},r);let a=rt(this.getTools());if(a==null||o==null||a.name===o)return a==null&&(a={}),a.items||(a.items=[]),a.name=o,a.items=[...a.items,...i],this.setTools(Object.assign({},a),r)}setTools(t,e={}){return t==null?this.removeTools():this.store.set("tools",G.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 e==null?!1:t==null?!0:e.name===t}hasTool(t){const e=this.getTools();return e==null?!1:e.items.some(n=>typeof n=="string"?n===t:n.name===t)}removeTool(t,e={}){const n=rt(this.getTools());if(n){let i=!1;const o=n.items.slice(),r=a=>{o.splice(a,1),i=!0};if(typeof t=="number")r(t);else for(let a=o.length-1;a>=0;a-=1){const l=o[a];(typeof l=="string"?l===t:l.name===t)&&r(a)}i&&(n.items=o,this.setTools(n,e))}return this}getBBox(t){return new P}getConnectionPoint(t,e){return new A}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 p=this.constructor;throw new Error(`Unable to serialize ${i} missing "shape" prop, check the ${i} "${p.name||n.call(p)}"`)}const o=this.constructor,r=t.diff===!0,a=e.attrs||{},l=o.getDefaults(!0),c=r?this.preprocess(l,!0):l,h=c.attrs||{},u={};Object.entries(e).forEach(([p,m])=>{if(m!=null&&!Array.isArray(m)&&typeof m=="object"&&!Zt(m))throw new Error(`Can only serialize ${i} with plain-object props, but got a "${n.call(m)}" type of key "${p}" on ${i} "${this.id}"`);if(p!=="attrs"&&p!=="shape"&&r){const b=c[p];me(m,b)&&delete e[p]}}),Object.keys(a).forEach(p=>{const m=a[p],b=h[p];Object.keys(m).forEach(y=>{const C=m[y],w=b?b[y]:null;C!=null&&typeof C=="object"&&!Array.isArray(C)?Object.keys(C).forEach(x=>{const E=C[x];if(b==null||w==null||!ht(w)||!me(w[x],E)){u[p]==null&&(u[p]={}),u[p][y]==null&&(u[p][y]={});const B=u[p][y];B[x]=E}}):(b==null||!me(w,C))&&(u[p]==null&&(u[p]={}),u[p][y]=C)})});const d=Object.assign(Object.assign({},e),{attrs:lo(u)?void 0:u});d.attrs==null&&delete d.attrs;const g=d;return g.angle===0&&delete g.angle,rt(g)}clone(t={}){if(!t.deep){const n=Object.assign({},this.store.get());t.keepId||delete n.id,delete n.parent,delete n.children;const i=this.constructor;return new i(n)}return G.deepClone(this)[this.id]}findView(t){return t.findViewByCell(this)}startBatch(t,e={},n=this.model){return this.notify("batch:start",{name:t,data:e,cell:this}),n&&n.startBatch(t,Object.assign(Object.assign({},e),{cell:this})),this}stopBatch(t,e={},n=this.model){return n&&n.stopBatch(t,Object.assign(Object.assign({},e),{cell:this})),this.notify("batch:stop",{name:t,data:e,cell:this}),this}batchUpdate(t,e,n){const i=this.model;this.startBatch(t,n,i);const o=e();return this.stopBatch(t,n,i),o}dispose(){this.removeFromParent(),this.animationManager.cancelAnimations(),this.store.dispose()}}G.toStringTag="X6.cell",G.defaults={},G.attrHooks={},G.propHooks=[],H([q()],G.prototype,"dispose",null),G.config({propHooks(s){var{tools:t}=s,e=K(s,["tools"]);return t&&(e.tools=G.normalizeTools(t)),e}});class bv{constructor(t){this.ports=[],this.groups={},this.init(rt(t))}getPorts(){return this.ports}getGroup(t){return t!=null?this.groups[t]:null}getPortsByGroup(t){return this.ports.filter(e=>e.group===t||e.group==null&&t==null)}getPortsLayoutByGroup(t,e){const n=this.getPortsByGroup(t),i=t?this.getGroup(t):null,o=i?i.position:null,r=o?o.name:null;let a;if(r!=null){const u=li.get(r);if(u==null)return li.onNotFound(r);a=u}else a=ph.left;const l=n.map(u=>u&&u.position&&u.position.args||{}),c=o&&o.args||{};return a(l,e,c).map((u,d)=>{const g=n[d];return{portLayout:u,portId:g.id,portSize:g.size,portAttrs:g.attrs,labelSize:g.label.size,labelLayout:this.getPortLabelLayout(g,A.create(u.position),e)}})}init(t){const{groups:e,items:n}=t;e!=null&&Object.keys(e).forEach(i=>{this.groups[i]=this.parseGroup(e[i])}),Array.isArray(n)&&n.forEach(i=>{this.ports.push(this.parsePort(i))})}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=ct({},n.attrs,e.attrs),e.position=this.createPosition(n,e),e.label=ct({},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 typeof e.zIndex=="number"?e.zIndex:typeof t.zIndex=="number"||t.zIndex==="auto"?t.zIndex:"auto"}createPosition(t,e){return ct({name:"left",args:{}},t.position,{args:e.args})}getPortPosition(t,e=!1){if(t==null){if(e)return{name:"left",args:{}}}else{if(typeof t=="string")return{name:t,args:{}};if(Array.isArray(t))return{name:"absolute",args:{x:t[0],y:t[1]}};if(typeof t=="object")return t}return{args:{}}}getPortLabelPosition(t,e=!1){if(t==null){if(e)return{name:"left",args:{}}}else{if(typeof t=="string")return{name:t,args:{}};if(typeof t=="object")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",o=t.label.position.args||{},r=ms.get(i)||gh.left;return r?r(e,n,o):null}}let or,rr;function _h(s,t){return t?or!=null&&or.exist(s):rr!=null&&rr.exist(s)}function yv(s){or=s}function Cv(s){rr=s}const $h="X6.node";let Zh=0;function Av(s){return s?wo(s):(Zh+=1,`CustomNode${Zh}`)}let vt=class Bn extends G{static isNode(t){if(t==null)return!1;if(t instanceof Bn)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===$h)&&typeof n.isNode=="function"&&typeof n.isEdge=="function"&&typeof n.prop=="function"&&typeof n.attr=="function"&&typeof n.size=="function"&&typeof n.position=="function"}static define(t){const{constructorName:e,overwrite:n}=t,i=K(t,["constructorName","overwrite"]),o=Po(Av(e||i.shape),this);return o.config(i),i.shape&&Bn.registry.register(i.shape,o,n),o}static create(t){const e=t.shape||"rect",n=Bn.registry.get(e);return n?new n(t):Bn.registry.onNotFound(e)}get[Symbol.toStringTag](){return Bn.toStringTag}constructor(t={}){super(t),this.initPorts()}preprocess(t,e){const{x:n,y:i,width:o,height:r}=t,a=K(t,["x","y","width","height"]);if(n!=null||i!=null){const l=a.position;a.position=Object.assign(Object.assign({},l),{x:n??(l?l.x:0),y:i??(l?l.y:0)})}if(o!=null||r!=null){const l=a.size;a.size=Object.assign(Object.assign({},l),{width:o??(l?l.width:0),height:r??(l?l.height:0)})}return super.preprocess(a,e)}isNode(){return!0}size(t,e,n){return t===void 0?this.getSize():typeof t=="number"?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 typeof t=="object"?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 o=this.getSize();switch(i){case"left":case"right":e=o.height;break;case"top":case"bottom":t=o.width;break}let a={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[i];const l=Tt(this.getAngle()||0);n.absolute&&(a+=Math.floor((l+45)/90),a%=4);const c=this.getBBox();let h;a===0?h=c.getBottomLeft():a===1?h=c.getCorner():a===2?h=c.getTopRight():h=c.getOrigin();const u=h.clone().rotate(-l,c.getCenter()),d=Math.sqrt(t*t+e*e)/2;let g=a*Math.PI/2;g+=Math.atan(a%2===0?e/t:t/e),g-=It(l);const m=A.fromPolar(d,g,u).clone().translate(t/-2,e/-2);this.store.set("size",{width:t,height:e},n),this.setPosition(m.x,m.y,n)}else this.store.set("size",{width:t,height:e},n);return this.stopBatch("resize",n),this}scale(t,e,n,i={}){const o=this.getBBox().scale(t,e,n??void 0);return this.startBatch("scale",i),this.setPosition(o.x,o.y,i),this.resize(o.width,o.height,i),this.stopBatch("scale"),this}position(t,e,n){return typeof t=="number"?this.setPosition(t,e,n):this.getPosition(t)}getPosition(t={}){if(t.relative){const n=this.getParent();if(n!=null&&n.isNode()){const i=this.getPosition(),o=n.getPosition();return{x:i.x-o.x,y:i.y-o.y}}}const e=this.store.get("position");return e?Object.assign({},e):{x:0,y:0}}setPosition(t,e,n={}){let i,o,r;if(typeof t=="object"?(i=t.x,o=t.y,r=e||{}):(i=t,o=e,r=n||{}),r.relative){const a=this.getParent();if(a!=null&&a.isNode()){const l=a.getPosition();i+=l.x,o+=l.y}}if(r.deep){const a=this.getPosition();this.translate(i-a.x,o-a.y,r)}else this.store.set("position",{x:i,y:o},r);return this}translate(t=0,e=0,n={}){if(t===0&&e===0)return this;n.translateBy=n.translateBy||this.id;const i=this.getPosition();if(n.restrict!=null&&n.translateBy===this.id){const r=this.getBBox({deep:!0}),a=n.restrict,l=i.x-r.x,c=i.y-r.y,h=Math.max(a.x+l,Math.min(a.x+a.width+l-r.width,i.x+t)),u=Math.max(a.y+c,Math.min(a.y+a.height+c-r.height,i.y+e));t=h-i.x,e=u-i.y}const o={x:i.x+t,y:i.y+e};if(n.tx=t,n.ty=e,n.transition){let r=typeof n.transition!="object"?{}:Object.assign({},n.transition);r=Object.assign({duration:100,fill:"forwards"},r),this.animate({"position/x":o.x,"position/y":o.y},r),this.eachChild(a=>{var l;((l=n.exclude)===null||l===void 0?void 0:l.includes(a))||a.translate(t,e,n)})}else this.startBatch("translate",n),this.store.set("position",o,n),this.eachChild(r=>{var a;((a=n.exclude)===null||a===void 0?void 0:a.includes(r))||r.translate(t,e,n)}),this.stopBatch("translate",n);return this}angle(t,e){return t==null?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(),o=this.getPosition(),r=this.getBBox().getCenter();r.rotate(n-t,e.center);const a=r.x-i.width/2-o.x,l=r.y-i.height/2-o.y;this.startBatch("rotate",{angle:t,options:e}),this.setPosition(o.x+a,o.y+l,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 e=this.getDescendants({deep:!0,breadthFirst:!0});return e.push(this),G.getCellsBBox(e)}return P.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(t,e){const n=this.getBBox(),i=n.getCenter(),o=t.getTerminal(e);if(o==null)return i;const r=o.port;if(!r||!this.hasPort(r))return i;const a=this.getPort(r);if(!a||!a.group)return i;const c=this.getPortsPosition(a.group)[r].position,h=A.create(c).translate(n.getOrigin()),u=this.getAngle();return u&&h.rotate(-u,i),h}fit(t={}){const n=(this.getChildren()||[]).filter(c=>c.isNode());if(n.length===0)return this;this.startBatch("fit-embeds",t),t.deep&&n.forEach(c=>{c.fit(t)});let{x:i,y:o,width:r,height:a}=G.getCellsBBox(n);const l=ee(t.padding);return i-=l.left,o-=l.top,r+=l.left+l.right,a+=l.bottom+l.top,this.store.set({position:{x:i,y:o},size:{width:r,height:a}},t),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(t){this.setPortContainerMarkup(t)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||Pt.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(t,e={}){return this.store.set("portContainerMarkup",Pt.clone(t),e),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(t){this.setPortMarkup(t)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||Pt.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(t,e={}){return this.store.set("portMarkup",Pt.clone(t),e),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(t){this.setPortLabelMarkup(t)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||Pt.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(t,e={}){return this.store.set("portLabelMarkup",Pt.clone(t),e),this}get ports(){const t=this.store.get("ports",{items:[]});return t.items==null&&(t.items=[]),t}getPorts(){return rt(this.ports.items)}getPortsByGroup(t){return this.getPorts().filter(e=>e.group===t)}getPort(t){return rt(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 this.getPortIndex(t)!==-1}getPortIndex(t){const e=typeof t=="string"?t:t.id;return e!=null?this.ports.items.findIndex(n=>n.id===e):-1}getPortsPosition(t){const e=this.getSize();return this.port.getPortsLayoutByGroup(t,new P(0,0,e.width,e.height)).reduce((i,o)=>{const r=o.portLayout;return i[o.portId]={position:Object.assign({},r.position),angle:r.angle||0},i},{})}getPortProp(t,e){return this.getPropByPath(this.prefixPortPath(t,e))}setPortProp(t,e,n,i){if(typeof e=="string"||Array.isArray(e)){const a=this.prefixPortPath(t,e),l=n;return this.setPropByPath(a,l,i)}const o=this.prefixPortPath(t),r=e;return this.setPropByPath(o,r,n)}removePortProp(t,e,n){return typeof e=="string"||Array.isArray(e)?this.removePropByPath(this.prefixPortPath(t,e),n):this.removePropByPath(this.prefixPortPath(t),e)}portProp(t,e,n,i){return e==null?this.getPortProp(t):typeof e=="string"||Array.isArray(e)?arguments.length===2?this.getPortProp(t,e):n==null?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(n===-1)throw new Error(`Unable to find port with id: "${t}"`);return e==null||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 o=[...this.ports.items].filter(r=>!t.some(a=>{const l=typeof a=="string"?a:a.id;return r.id===l}));this.setPropByPath("ports/items",o,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(r=>{r.id&&(e[r.id]=!0)});const n={};(this.store.getPrevious("ports")||{items:[]}).items.forEach(r=>{r.id&&!e[r.id]&&(n[r.id]=!0)});const o=this.model;o&&!lo(n)&&(o.getConnectedEdges(this,{incoming:!0}).forEach(l=>{const c=l.getTargetPortId();c&&n[c]&&l.remove()}),o.getConnectedEdges(this,{outgoing:!0}).forEach(l=>{const c=l.getSourcePortId();c&&n[c]&&l.remove()}))}validatePorts(){const t={},e=[];return this.ports.items.forEach(n=>{typeof n!="object"&&e.push(`Invalid port ${n}.`),n.id==null&&(n.id=this.generatePortId()),t[n.id]&&e.push("Duplicitied port id."),t[n.id]=!0}),e}generatePortId(){return Bo()}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 bv(this.ports);const n=this.port.getPorts(),i=e?n.filter(r=>e.find(a=>a.id===r.id)?null:r):[...n],o=e?e.filter(r=>n.find(a=>a.id===r.id)?null:r):[];i.length>0&&this.notify("ports:added",{added:i,cell:this,node:this}),o.length>0&&this.notify("ports:removed",{removed:o,cell:this,node:this})}};vt.toStringTag=$h,vt.registry=ut.create({type:"node",process(s,t){if(_h(s,!0))throw new Error(`Node with name '${s}' was registered by anthor Edge`);if(typeof t=="function")return t.config({shape:s}),t;let e=vt;const{inherit:n}=t,i=K(t,["inherit"]);if(n)if(typeof n=="string"){const r=this.get(n);r==null?this.onNotFound(n,"inherited"):e=r}else e=n;i.constructorName==null&&(i.constructorName=s);const o=e.define.call(e,i);return o.config({shape:s}),o}}),vt.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},vt.config({propHooks(s){var{ports:t}=s,e=K(s,["ports"]);return t&&(e.ports=Array.isArray(t)?{items:t}:t),e}}),Cv(vt.registry);const tu="X6.edge",eu="basic.edge";let nu=0;function wv(s){return s?wo(s):(nu+=1,`CustomEdge${nu}`)}let ft=class In extends G{static parseStringLabel(t){return{attrs:{label:{text:t}}}}static isEdge(t){if(t==null)return!1;if(t instanceof In)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===tu)&&typeof n.isNode=="function"&&typeof n.isEdge=="function"&&typeof n.prop=="function"&&typeof n.attr=="function"&&typeof n.disconnect=="function"&&typeof n.getSource=="function"&&typeof n.getTarget=="function"}static equalTerminals(t,e){const n=t,i=e;return n.cell===i.cell?n.port===i.port||n.port==null&&i.port==null:!1}static define(t){const{constructorName:e,overwrite:n}=t,i=K(t,["constructorName","overwrite"]),o=Po(wv(e||i.shape),this);return o.config(i),i.shape&&In.registry.register(i.shape,o,n),o}static create(t){const e=t.shape||"edge",n=In.registry.get(e);return n?new n(t):In.registry.onNotFound(e)}get[Symbol.toStringTag](){return In.toStringTag}constructor(t={}){super(t)}preprocess(t,e){const{source:n,sourceCell:i,sourcePort:o,sourcePoint:r,target:a,targetCell:l,targetPort:c,targetPoint:h}=t,d=K(t,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),g=p=>typeof p=="string"||typeof p=="number";if(n!=null)if(G.isCell(n))d.source={cell:n.id};else if(g(n))d.source={cell:n};else if(A.isPoint(n))d.source=n.toJSON();else if(Array.isArray(n))d.source={x:n[0],y:n[1]};else{const p=n.cell;G.isCell(p)?d.source=Object.assign(Object.assign({},n),{cell:p.id}):d.source=n}if(i!=null||o!=null){let p=d.source;if(i!=null){const m=g(i)?i:i.id;p?p.cell=m:p=d.source={cell:m}}o!=null&&p&&(p.port=o)}else r!=null&&(d.source=A.create(r).toJSON());if(a!=null)if(G.isCell(a))d.target={cell:a.id};else if(g(a))d.target={cell:a};else if(A.isPoint(a))d.target=a.toJSON();else if(Array.isArray(a))d.target={x:a[0],y:a[1]};else{const p=a.cell;G.isCell(p)?d.target=Object.assign(Object.assign({},a),{cell:p.id}):d.target=a}if(l!=null||c!=null){let p=d.target;if(l!=null){const m=g(l)?l:l.id;p?p.cell=m:p=d.target={cell:m}}c!=null&&p&&(p.port=c)}else h!=null&&(d.target=A.create(h).toJSON());return super.preprocess(d,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(G.isCell(e))return this.store.set(t,ct({},n,{cell:e.id}),i),this;const o=e;return A.isPoint(e)||o.x!=null&&o.y!=null?(this.store.set(t,ct({},n,{x:o.x,y:o.y}),i),this):(this.store.set(t,rt(e),i),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(t){const e=this[t];if(A.isPointLike(e))return A.create(e);const n=this.getTerminalCell(t);return n?n.getConnectionPoint(this,t):new A}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(t){if(this.model){const e=t==="source"?this.getSourceCellId():this.getTargetCellId();if(e)return this.model.getCell(e)}return null}getSourceNode(){return this.getTerminalNode("source")}getTargetNode(){return this.getTerminalNode("target")}getTerminalNode(t){let e=this;const n={};for(;e&&e.isEdge();){if(n[e.id])return null;n[e.id]=!0,e=e.getTerminalCell(t)}return e&&e.isNode()?e:null}get router(){return this.getRouter()}set router(t){t==null?this.removeRouter():this.setRouter(t)}getRouter(){return this.store.get("router")}setRouter(t,e,n){return typeof t=="object"?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){t==null?this.removeConnector():this.setConnector(t)}getConnector(){return this.store.get("connector")}setConnector(t,e,n){return typeof t=="object"?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 rt(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(),o=i.length;let r=e!=null&&Number.isFinite(e)?e:o;return r<0&&(r=o+r+1),i.splice(r,0,this.parseLabel(t)),this.setLabels(i,n)}appendLabel(t,e={}){return this.insertLabel(t,-1,e)}getLabelAt(t){const e=this.getLabels();return t!=null&&Number.isFinite(t)?this.parseLabel(e[t]):null}setLabelAt(t,e,n={}){if(t!=null&&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=t!=null&&Number.isFinite(t)?t:-1,o=n.splice(i,1);return this.setLabels(n,e),o.length?o[0]:null}parseLabel(t){return typeof t=="string"?this.constructor.parseStringLabel(t):t}onLabelsChanged({previous:t,current:e}){const n=t&&e?e.filter(o=>t.find(r=>o===r||me(o,r))?null:o):e?[...e]:[],i=t&&e?t.filter(o=>e.find(r=>o===r||me(o,r))?null:o):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(i=>A.toJSON(i)),e),this}insertVertex(t,e,n={}){const i=this.getVertices(),o=i.length;let r=e!=null&&Number.isFinite(e)?e:o;return r<0&&(r=o+r+1),i.splice(r,0,A.toJSON(t)),this.setVertices(i,n)}appendVertex(t,e={}){return this.insertVertex(t,-1,e)}getVertexAt(t){return t!=null&&Number.isFinite(t)?this.getVertices()[t]:null}setVertexAt(t,e,n={}){if(t!=null&&Number.isFinite(t)){const i=this.getVertices();i[t]=e,this.setVertices(i,n)}return this}removeVertexAt(t,e={}){const n=this.getVertices(),i=t!=null&&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(o=>t.find(r=>A.equals(o,r))?null:o):e?[...e]:[],i=t&&e?t.filter(o=>e.find(r=>A.equals(o,r))?null:o):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")||Pt.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(i=>({x:(i.x||0)+t,y:(i.y||0)+e}),n)}scale(t,e,n,i={}){return this.applyToPoints(o=>A.create(o).scale(t,e,n).toJSON(),i)}applyToPoints(t,e={}){const n={},i=this.getSource(),o=this.getTarget();A.isPointLike(i)&&(n.source=t(i)),A.isPointLike(o)&&(n.target=t(o));const r=this.getVertices();return r.length>0&&(n.vertices=r.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(e=>A.create(e)),this.getTargetPoint()];return new yt(t)}updateParent(t){let e=null;const n=this.getSourceCell(),i=this.getTargetCell(),o=this.getParent();return n&&i&&(n===i||n.isDescendantOf(i)?e=i:i.isDescendantOf(n)?e=n:e=G.getCommonAncestor(n,i)),o&&e&&e.id!==o.id&&o.unembed(this,t),e&&(!o||o.id!==e.id)&&e.embed(this,t),e}hasLoop(t={}){const e=this.getSource(),n=this.getTarget(),i=e.cell,o=n.cell;if(!i||!o)return!1;let r=i===o;if(!r&&t.deep&&this._model){const a=this.getSourceCell(),l=this.getTargetCell();a&&l&&(r=a.isAncestorOf(l,t)||l.isAncestorOf(a,t))}return r}getFragmentAncestor(){const t=[this,this.getSourceNode(),this.getTargetNode()].filter(e=>e!=null);return this.getCommonAncestor(...t)}isFragmentDescendantOf(t){const e=this.getFragmentAncestor();return!!e&&(e.id===t.id||e.isDescendantOf(t))}};ft.toStringTag=tu,ft.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}},ft.registry=ut.create({type:"edge",process(s,t){if(_h(s,!1))throw new Error(`Edge with name '${s}' was registered by anthor Node`);if(typeof t=="function")return t.config({shape:s}),t;let e=ft;const{inherit:n="edge"}=t,i=K(t,["inherit"]);if(typeof n=="string"){const r=this.get(n||"edge");r==null&&n?this.onNotFound(n,"inherited"):e=r}else e=n;i.constructorName==null&&(i.constructorName=s);const o=e.define.call(e,i);return o.config({shape:s}),o}}),ft.defaults={},yv(ft.registry),ft.config({shape:eu,propHooks(s){const{label:t,vertices:e}=s,n=K(s,["label","vertices"]);if(t){n.labels==null&&(n.labels=[]);const i=typeof t=="string"?ft.parseStringLabel(t):t;n.labels.push(i)}return e&&Array.isArray(e)&&(n.vertices=e.map(i=>A.create(i).toJSON())),n}}),ft.registry.register(eu,ft);class ar extends Ot{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,o;typeof e=="number"?(i=e,o=Object.assign({merge:!1},n)):(i=this.length,o=Object.assign({merge:!1},e)),i>this.length&&(i=this.length),i<0&&(i+=this.length+1);const r=Array.isArray(t)?t:[t],a=this.comparator&&typeof e!="number"&&o.sort!==!1,l=this.comparator||null;let c=!1;const h=[],u=[];return r.forEach(d=>{const g=this.get(d);g?o.merge&&!d.isSameStore(g)&&(g.setProp(d.getProp(),n),u.push(g),a&&!c&&(l==null||typeof l=="function"?c=g.hasChanged():typeof l=="string"?c=g.hasChanged(l):c=l.some(p=>g.hasChanged(p)))):(h.push(d),this.reference(d))}),h.length&&(a&&(c=!0),this.cells.splice(i,0,...h),this.length=this.cells.length),c&&this.sort({silent:!0}),o.silent||(h.forEach((d,g)=>{const p={cell:d,index:i+g,options:o};this.trigger("added",p),o.dryrun||d.notify("added",Object.assign({},p))}),c&&this.trigger("sorted"),(h.length||u.length)&&this.trigger("updated",{added:h,merged:u,removed:[],options:o})),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 o=this.get(t[i]);if(o==null)continue;const r=this.cells.indexOf(o);this.cells.splice(r,1),this.length-=1,delete this.map[o.id],n.push(o),this.unreference(o),e.silent||(this.trigger("removed",{cell:o,index:r,options:e}),e.dryrun||o.notify("removed",{cell:o,index:r,options:e})),e.dryrun||o.remove()}return n}reset(t,e={}){const n=this.cells.slice();if(e.diff||(n.forEach(i=>{this.unreference(i),i.remove()}),this.clean()),this.add(t,Object.assign({silent:!0},e)),!e.silent){const i=this.cells.slice();this.trigger("reseted",{options:e,previous:n,current:i});const o=[],r=[];i.forEach(a=>{n.some(c=>c.id===a.id)||o.push(a)}),n.forEach(a=>{i.some(c=>c.id===a.id)||r.push(a)}),this.trigger("updated",{options:e,added:o,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 e?this.remove(e,t):null}unshift(t,e){return this.add(t,0,e)}shift(t){const e=this.at(0);return e?this.remove(e,t):null}get(t){if(t==null)return null;const e=typeof t=="string"||typeof t=="number"?t:t.id;return this.map[e]||null}has(t){return this.get(t)!=null}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 this.comparator!=null&&(this.cells=co(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([])}}H([q()],ar.prototype,"dispose",null);const xv="X6.Model";class Ut extends Ot{static isModel(t){if(t==null)return!1;if(t instanceof Ut)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===xv)&&typeof n.addNode=="function"&&typeof n.addEdge=="function"&&n.collection!=null}static toJSON(t,e={}){return{cells:t.map(n=>n.toJSON(e))}}static fromJSON(t){const e=[];return Array.isArray(t)?e.push(...t):(t.cells&&e.push(...t.cells),t.nodes&&t.nodes.forEach(n=>{n.shape==null&&(n.shape="rect"),e.push(n)}),t.edges&&t.edges.forEach(n=>{n.shape==null&&(n.shape="edge"),e.push(n)})),e.map(n=>{const i=n.shape;if(i){if(vt.registry.exist(i))return vt.create(n);if(ft.registry.exist(i))return ft.create(n)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}constructor(t=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new ar(t),this.setup()}notify(t,e){this.trigger(t,e);const n=this.graph;return n&&(t==="sorted"||t==="reseted"||t==="updated"?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",e=>this.notify("updated",e)),t.on("cell:change:zIndex",()=>this.sortOnChangeZ()),t.on("added",({cell:e})=>{this.onCellAdded(e)}),t.on("removed",e=>{const n=e.cell;this.onCellRemoved(n,e.options),this.notify("cell:removed",e),n.isNode()?this.notify("node:removed",Object.assign(Object.assign({},e),{node:n})):n.isEdge()&&this.notify("edge:removed",Object.assign(Object.assign({},e),{edge:n}))}),t.on("reseted",e=>{this.onReset(e.current),this.notify("reseted",e)}),t.on("edge:change:source",({edge:e})=>this.onEdgeTerminalChanged(e,"source")),t.on("edge:change:target",({edge:e})=>{this.onEdgeTerminalChanged(e,"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 i=t.getSource(),o=t.getTarget();if(i!=null&&i.cell){const r=this.outgoings[i.cell],a=r?r.indexOf(n):-1;a>=0&&(r.splice(a,1),r.length===0&&delete this.outgoings[i.cell])}if(o!=null&&o.cell){const r=this.incomings[o.cell],a=r?r.indexOf(n):-1;a>=0&&(r.splice(a,1),r.length===0&&delete this.incomings[o.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(e=>{this.onCellAdded(e)})}onEdgeTerminalChanged(t,e){const n=e==="source"?this.outgoings:this.incomings,i=t.previous(e);if(i!=null&&i.cell){const r=G.isCell(i.cell)?i.cell.id:i.cell,a=n[r],l=a?a.indexOf(t.id):-1;l>=0&&(a.splice(l,1),a.length===0&&delete n[r])}const o=t.getTerminal(e);if(o!=null&&o.cell){const r=G.isCell(o.cell)?o.cell.id:o.cell,a=n[r]||[];a.indexOf(t.id)===-1&&a.push(t.id),n[r]=a}}prepareCell(t,e){return!t.model&&(!e||!e.dryrun)&&(t.model=this),t.zIndex==null&&t.setZIndex(this.getMaxZIndex()+1,{silent:!0}),t}resetCells(t,e={}){return t.map(n=>this.prepareCell(n,Object.assign(Object.assign({},e),{dryrun:!0}))),this.collection.reset(t,e),t.map(n=>this.prepareCell(n,{options:e})),this}clear(t={}){const e=this.getCells();if(e.length===0)return this;const n=Object.assign(Object.assign({},t),{clear:!0});return this.batchUpdate("clear",()=>{const i=e.sort((o,r)=>{const a=o.isEdge()?1:2,l=r.isEdge()?1:2;return a-l});for(;i.length>0;){const o=i.shift();o&&o.remove(n)}},n),this}addNode(t,e={}){const n=vt.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 vt.create(t)}addEdge(t,e={}){const n=ft.isEdge(t)?t:this.createEdge(t);return this.addCell(n,e),n}createEdge(t){return ft.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(n=>this.addCell(n,e)),this.addings.delete(t)),this)}addCells(t,e={}){const n=t.length;if(n===0)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(o=>{this.addCell(o,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(([i,o])=>{n.setProp(i,o,e)}),!0),t):!1}removeCell(t,e={}){const n=typeof t=="string"?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});return this.addCell(n),this.getConnectedEdges(t).forEach(o=>{const r=o.getSourceCell(),a=o.getTargetCell();r===t&&o.setSource(Object.assign(Object.assign({},o.getSource()),{cell:e})),a===t&&o.setTarget(Object.assign(Object.assign({},o.getTarget()),{cell:e}))}),this.removeCell(t),this.stopBatch("update",{id:e}),n}removeCells(t,e={}){return t.length?this.batchUpdate("remove",()=>t.map(n=>this.removeCell(n,e))):[]}removeConnectedEdges(t,e={}){const n=this.getConnectedEdges(t);return n.forEach(i=>{i.remove(e)}),n}disconnectConnectedEdges(t,e={}){const n=typeof t=="string"?t:t.id;this.getConnectedEdges(t).forEach(i=>{const o=i.getSourceCellId(),r=i.getTargetCellId();o===n&&i.setSource({x:0,y:0},e),r===n&&i.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(e=>this.getCell(e)).filter(e=>e!=null):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(t){const e=typeof t=="string"?t:t.id,n=this.outgoings[e];return n?n.map(i=>this.getCell(i)).filter(i=>i==null?void 0:i.isEdge()):null}getIncomingEdges(t){const e=typeof t=="string"?t:t.id,n=this.incomings[e];return n?n.map(i=>this.getCell(i)).filter(i=>i==null?void 0:i.isEdge()):null}getConnectedEdges(t,e={}){const n=[],i=typeof t=="string"?this.getCell(t):t;if(i==null)return n;const o={},r=e.indirect;let a=e.incoming,l=e.outgoing;a==null&&l==null&&(a=l=!0);const c=(h,u)=>{const d=u?this.getOutgoingEdges(h):this.getIncomingEdges(h);if(d!=null&&d.forEach(g=>{o[g.id]||(n.push(g),o[g.id]=!0,r&&(a&&c(g,!1),l&&c(g,!0)))}),r&&h.isEdge()){const g=u?h.getTargetCell():h.getSourceCell();g!=null&&g.isEdge()&&(o[g.id]||(n.push(g),c(g,u)))}};if(l&&c(i,!0),a&&c(i,!1),e.deep){const h=i.getDescendants({deep:!0}),u={};h.forEach(g=>{g.isNode()&&(u[g.id]=!0)});const d=(g,p)=>{const m=p?this.getOutgoingEdges(g.id):this.getIncomingEdges(g.id);m!=null&&m.forEach(b=>{if(!o[b.id]){const y=b.getSourceCell(),C=b.getTargetCell();if(!e.enclosed&&y&&u[y.id]&&C&&u[C.id])return;n.push(b),o[b.id]=!0}})};h.forEach(g=>{g.isEdge()||(l&&d(g,!0),a&&d(g,!1))})}return n}isBoundary(t,e){const n=typeof t=="string"?this.getCell(t):t,i=e?this.getIncomingEdges(n):this.getOutgoingEdges(n);return i==null||i.length===0}getBoundaryNodes(t){const e=[];return Object.keys(this.nodes).forEach(n=>{if(this.isBoundary(n,t)){const i=this.getCell(n);i&&e.push(i)}}),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;n==null&&i==null&&(n=i=!0);const r=this.getConnectedEdges(t,e).reduce((a,l)=>{const c=l.hasLoop(e),h=l.getSourceCell(),u=l.getTargetCell();return n&&h&&h.isNode()&&!a[h.id]&&(c||h!==t&&(!e.deep||!h.isDescendantOf(t)))&&(a[h.id]=h),i&&u&&u.isNode()&&!a[u.id]&&(c||u!==t&&(!e.deep||!u.isDescendantOf(t)))&&(a[u.id]=u),a},{});if(t.isEdge()){if(n){const a=t.getSourceCell();a!=null&&a.isNode()&&!r[a.id]&&(r[a.id]=a)}if(i){const a=t.getTargetCell();a!=null&&a.isNode()&&!r[a.id]&&(r[a.id]=a)}}return Object.keys(r).map(a=>r[a])}isNeighbor(t,e,n={}){let i=n.incoming,o=n.outgoing;return i==null&&o==null&&(i=o=!0),this.getConnectedEdges(t,n).some(r=>{const a=r.getSourceCell(),l=r.getTargetCell();return!!(i&&a&&a.id===e.id||o&&l&&l.id===e.id)})}getSuccessors(t,e={}){const n=[];return this.search(t,(i,o)=>{i!==t&&this.matchDistance(o,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{outgoing:!0})),n}isSuccessor(t,e,n={}){let i=!1;return this.search(t,(o,r)=>{if(o===e&&o!==t&&this.matchDistance(r,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{outgoing:!0})),i}getPredecessors(t,e={}){const n=[];return this.search(t,(i,o)=>{i!==t&&this.matchDistance(o,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{incoming:!0})),n}isPredecessor(t,e,n={}){let i=!1;return this.search(t,(o,r)=>{if(o===e&&o!==t&&this.matchDistance(r,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),i}matchDistance(t,e){return e==null?!0:typeof e=="function"?e(t):Array.isArray(e)&&e.includes(t)?!0:t===e}getCommonAncestor(...t){const e=[];return t.forEach(n=>{n&&(Array.isArray(n)?e.push(...n):e.push(n))}),G.getCommonAncestor(...e)}getSubGraph(t,e={}){const n=[],i={},o=[],r=[],a=l=>{i[l.id]||(n.push(l),i[l.id]=l,l.isEdge()&&r.push(l),l.isNode()&&o.push(l))};return t.forEach(l=>{a(l),e.deep&&l.getDescendants({deep:!0}).forEach(h=>{a(h)})}),r.forEach(l=>{const c=l.getSourceCell(),h=l.getTargetCell();c&&!i[c.id]&&(n.push(c),i[c.id]=c,c.isNode()&&o.push(c)),h&&!i[h.id]&&(n.push(h),i[h.id]=h,h.isNode()&&o.push(h))}),o.forEach(l=>{this.getConnectedEdges(l,e).forEach(h=>{const u=h.getSourceCell(),d=h.getTargetCell();!i[h.id]&&u&&i[u.id]&&d&&i[d.id]&&(n.push(h),i[h.id]=h)})}),n}cloneSubGraph(t,e={}){const n=this.getSubGraph(t,e);return this.cloneCells(n)}cloneCells(t){return G.cloneCells(t)}getNodesFromPoint(t,e){const n=typeof t=="number"?{x:t,y:e||0}:t;return this.getNodes().filter(i=>i.getBBox().containsPoint(n))}getNodesInArea(t,e,n,i,o){const r=typeof t=="number"?new P(t,e,n,i):P.create(t),a=typeof t=="number"?o:e,l=a==null?void 0:a.strict;return this.getNodes().filter(c=>{const h=c.angle(),u=c.getBBox().bbox(h);return l?r.containsRect(u):r.isIntersectWithRect(u)})}getEdgesInArea(t,e,n,i,o){const r=typeof t=="number"?new P(t,e,n,i):P.create(t),a=typeof t=="number"?o:e,l=a==null?void 0:a.strict;return this.getEdges().filter(c=>{const h=c.getBBox();return h.width===0?h.inflate(1,0):h.height===0&&h.inflate(0,1),l?r.containsRect(h):r.isIntersectWithRect(h)})}getNodesUnderNode(t,e={}){const n=t.getBBox();return(e.by==null||e.by==="bbox"?this.getNodesInArea(n):this.getNodesFromPoint(n[e.by])).filter(o=>t.id!==o.id&&!o.isDescendantOf(t))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(t,e={}){return G.getCellsBBox(t,e)}search(t,e,n={}){n.breadthFirst?this.breadthFirstSearch(t,e,n):this.depthFirstSearch(t,e,n)}breadthFirstSearch(t,e,n={}){const i=[],o={},r={};for(i.push(t),r[t.id]=0;i.length>0;){const a=i.shift();if(a==null||o[a.id]||(o[a.id]=!0,D(e,this,a,r[a.id])===!1))continue;this.getNeighbors(a,n).forEach(c=>{r[c.id]=r[a.id]+1,i.push(c)})}}depthFirstSearch(t,e,n={}){const i=[],o={},r={};for(i.push(t),r[t.id]=0;i.length>0;){const a=i.pop();if(a==null||o[a.id]||(o[a.id]=!0,D(e,this,a,r[a.id])===!1))continue;const l=this.getNeighbors(a,n),c=i.length;l.forEach(h=>{r[h.id]=r[a.id]+1,i.splice(c,0,h)})}}getShortestPath(t,e,n={}){const i={};this.getEdges().forEach(c=>{const h=c.getSourceCellId(),u=c.getTargetCellId();h&&u&&(i[h]||(i[h]=[]),i[u]||(i[u]=[]),i[h].push(u),n.directed||i[u].push(h))});const o=typeof t=="string"?t:t.id,r=CA(i,o,n.weight),a=[];let l=typeof e=="string"?e:e.id;for(r[l]&&a.push(l);r[l];){const c=r[l];a.unshift(c),l=c}return a}translate(t,e,n){return this.getCells().filter(i=>!i.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 o=this.getCellsBBox(n);if(o){const r=Math.max(t/o.width,0),a=Math.max(e/o.height,0),l=o.getOrigin();n.forEach(c=>{c.scale(r,a,l,i)})}return this}toJSON(t={}){return Ut.toJSON(this.getCells(),t)}parseJSON(t){return Ut.fromJSON(t)}fromJSON(t,e={}){let n=[];if(!e.diff)n=this.parseJSON(t);else{const i=t,{nodes:o=[],edges:r=[]}=i,a=K(i,["nodes","edges"]),l=o.filter(h=>!this.nodes[h.id])||[],c=r.filter(h=>!this.edges[h.id])||[];n=this.parseJSON(Object.assign(Object.assign({},a),{nodes:l,edges:c}))}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)){return(Array.isArray(t)?t:[t]).some(n=>this.batches[n]>0)}dispose(){this.collection.dispose()}}H([q()],Ut.prototype,"dispose",null);const iu={fill:"#ffffff",stroke:"#333333",strokeWidth:2},vv={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"};let yi=class extends vt{get label(){return this.getLabel()}set label(t){this.setLabel(t)}getLabel(){return this.getAttrByPath("text/text")}setLabel(t,e){return t==null?this.removeLabel():this.setAttrByPath("text/text",t,e),this}removeLabel(){return this.removeAttrByPath("text/text"),this}};yi.config({attrs:{text:Object.assign({},vv)},propHooks(s){const{label:t}=s,e=K(s,["label"]);return t&&gn(e,"attrs/text/text",t),e},visible:!0});function Ev(s,t="body"){return[{tagName:s,selector:t},{tagName:"text",selector:"label"}]}function Sv(s="xlink:href"){return e=>{const{imageUrl:n,imageWidth:i,imageHeight:o}=e,r=K(e,["imageUrl","imageWidth","imageHeight"]);if(n!=null||i!=null||o!=null){const a=()=>{if(r.attrs){const l=r.attrs.image;n!=null&&(l[s]=n),i!=null&&(l.width=i),o!=null&&(l.height=o),r.attrs.image=l}};r.attrs?(r.attrs.image==null&&(r.attrs.image={}),a()):(r.attrs={image:{}},a())}return r}}function xn(s,t,e={}){const n={constructorName:s,markup:Ev(s,e.selector),attrs:{[s]:Object.assign({},iu)}};return(e.parent||yi).define(ct(n,t,{shape:s}))}function su(s){return typeof s=="string"?s:s.map(t=>Array.isArray(t)?t.join(","):A.isPointLike(t)?`${t.x}, ${t.y}`:"").join(" ")}xn("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});const ou=ft.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"}}});xn("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});class Ht extends Cn{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(){}}const ru={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onDragEnd"},Re=1<<30,Mv=1<<29;class qt extends xt{constructor(){super(...arguments),this.portsCache={}}static isNodeView(t){if(t==null)return!1;if(t instanceof qt)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===au)&&typeof n.isNodeView=="function"&&typeof n.isEdgeView=="function"&&typeof n.confirmUpdate=="function"&&typeof n.update=="function"&&typeof n.findPortElem=="function"&&typeof n.resize=="function"&&typeof n.rotate=="function"&&typeof n.translate=="function"}get[Symbol.toStringTag](){return au}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 n=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?st(e,n):O(e,n)}else{const n=this.prefixClassName("node-immovable");this.can("nodeMovable")?this.removeClass(n):this.addClass(n)}}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(),"ports"),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(),this.removePorts();const e=this.cell,n=e.getSize(),i=e.getAttrs();this.updateAttrs(this.container,i,{attrs:t===i?null:t,rootBBox:new P(0,0,n.width,n.height),selectors:this.selectors}),this.renderPorts()}renderMarkup(){const t=this.cell.markup;if(t){if(typeof t=="string")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(),this.renderTools(),this.notify("view:render",{view:this}),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,o=n.portContentSelectors||{};return this.findOne(e,i,o)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(t=>{Vt(t.portElement)})}renderPorts(){const t=this.container,e=[];t.childNodes.forEach(r=>{e.push(r)});const n=this.cell.getParsedPorts(),i=pl(n,"zIndex"),o="auto";i[o]&&i[o].forEach(r=>{const a=this.getPortElement(r);t.append(a),e.push(a)}),Object.keys(i).forEach(r=>{if(r!==o){const a=parseInt(r,10);this.appendPorts(i[r],a,e)}}),this.updatePorts()}appendPorts(t,e,n){const i=t.map(o=>this.getPortElement(o));n[e]||e<0?Jn(n[Math.max(e,0)],i):Mt(this.container,i)}getPortElement(t){const e=this.portsCache[t.id];return e?e.portElement:this.createPortElement(t)}createPortElement(t){let e=Pt.renderMarkup(this.cell.getPortContainerMarkup());const n=e.elem;if(n==null)throw new Error("Invalid port container markup.");e=Pt.renderMarkup(this.getPortMarkup(t));const i=e.elem,o=e.selectors;if(i==null)throw new Error("Invalid port markup.");this.setAttrs({port:t.id,"port-group":t.group},i);let r="x6-port";t.group&&(r+=` x6-port-${t.group}`),O(n,r),O(n,"x6-port"),O(i,"x6-port-body"),n.appendChild(i);let a=o,l,c;if(this.existPortLabel(t)){if(e=Pt.renderMarkup(this.getPortLabelMarkup(t.label)),l=e.elem,c=e.selectors,l==null)throw new Error("Invalid port label markup.");if(o&&c){for(const u in c)if(o[u]&&u!==this.rootSelector)throw new Error("Selectors within port must be unique.");a=Object.assign(Object.assign({},o),c)}O(l,"x6-port-label"),n.appendChild(l)}return this.portsCache[t.id]={portElement:n,portSelectors:a,portLabelElement:l,portLabelSelectors:c,portContentElement:i,portContentSelectors:o},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:t,node:this.cell,container:n,selectors:a,labelContainer:l,labelSelectors:c,contentContainer:i,contentSelectors:o}),n}updatePorts(){const t=this.cell.getParsedGroups(),e=Object.keys(t);e.length===0?this.updatePortGroup():e.forEach(n=>{this.updatePortGroup(n)})}updatePortGroup(t){const e=P.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(t,e);for(let i=0,o=n.length;i<o;i+=1){const r=n[i],a=r.portId,l=this.portsCache[a]||{},c=r.portLayout;if(this.applyPortTransform(l.portElement,c),r.portAttrs!=null){const u={selectors:l.portSelectors||{}};r.portSize&&(u.rootBBox=P.fromSize(r.portSize)),this.updateAttrs(l.portElement,r.portAttrs,u)}const h=r.labelLayout;if(h&&l.portLabelElement&&(this.applyPortTransform(l.portLabelElement,h,-(c.angle||0)),h.attrs)){const u={selectors:l.portLabelSelectors||{}};r.labelSize&&(u.rootBBox=P.fromSize(r.labelSize)),this.updateAttrs(l.portLabelElement,h.attrs,u)}}}applyPortTransform(t,e,n=0){const i=e.angle,o=e.position,r=At().rotate(n).translate(o.x||0,o.y||0).rotate(i||0);fn(t,r,{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,o=i.cell,r=o;return e==null||n==null?{e:t,view:i,node:o,cell:r}:{e:t,x:e,y:n,view:i,node:o,cell:r}}getPortEventArgs(t,e,n){const i=this,o=i.cell,r=o;return n?{e:t,x:n.x,y:n.y,view:i,node:o,cell:r,port:e}:{e:t,view:i,node:o,cell:r,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 o=e.type;t==="node:port:mouseenter"?e.type="mouseenter":t==="node:port:mouseleave"&&(e.type="mouseleave"),this.notify(t,this.getPortEventArgs(e,i,n)),e.type=o}}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),o=i.action;if(o==="magnet")this.dragMagnet(t,e,n);else{if(o==="move"){const a=i.targetView||this;a.dragNode(t,e,n),a.notify("node:moving",{e:t,x:e,y:n,view:a,cell:a.cell,node:a.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),o=i.action;o==="magnet"?this.stopMagnetDragging(t,e,n):(this.notifyMouseUp(t,e,n),this.notifyPortEvent("node:port:mouseup",t,{x:e,y:n}),o==="move"&&(i.targetView||this).stopNodeDragging(t,e,n));const r=i.targetMagnet;r&&this.onMagnetClick(t,r,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 o=this.graph;o.view.getMouseMovedCount(t)>o.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,i=this.getEventData(t).cell||this.cell,o=e.findViewByCell(i),r=e.snapToGrid(t.clientX,t.clientY);this.notify("node:embed",{e:t,node:i,view:o,cell:i,x:r.x,y:r.y,currentParent:i.getParent()})}processEmbedding(t,e){const n=e.cell||this.cell,i=e.graph||this.graph,o=i.options.embedding,r=o.findParent;let a=typeof r=="function"?D(r,i,{view:this,node:this.cell}).filter(d=>G.isCell(d)&&this.cell.id!==d.id&&!d.isDescendantOf(this.cell)):i.model.getNodesUnderNode(n,{by:r});if(o.frontOnly&&a.length>0){const d=pl(a,"zIndex"),g=uy(Object.keys(d).map(p=>parseInt(p,10)));g&&(a=d[g])}a=a.filter(d=>d.visible);let l=null;const c=e.candidateEmbedView,h=o.validate;for(let d=a.length-1;d>=0;d-=1){const g=a[d];if(c&&c.cell.id===g.id){l=c;break}else{const p=g.findView(i);if(h&&D(h,i,{child:this.cell,parent:p.cell,childView:this,parentView:p})){l=p;break}}}this.clearEmbedding(e),l&&l.highlight(null,{type:"embedding"}),e.candidateEmbedView=l;const u=i.snapToGrid(t.clientX,t.clientY);this.notify("node:embedding",{e:t,cell:n,node:n,view:i.findViewByCell(n),x:u.x,y:u.y,currentParent:n.getParent(),candidateParent:l?l.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,o=i.findViewByCell(n),r=n.getParent(),a=e.candidateEmbedView;if(a?(a.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null,(r==null||r.id!==a.cell.id)&&a.cell.insertChild(n,void 0,{ui:!0})):r&&r.unembed(n,{ui:!0}),i.model.getConnectedEdges(n,{deep:!0}).forEach(l=>{l.updateParent({ui:!0})}),o&&a){const l=i.snapToGrid(t.clientX,t.clientY);o.notify("node:embedded",{e:t,cell:n,x:l.x,y:l.y,node:n,view:i.findViewByCell(n),previousParent:r,currentParent:n.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let t=this.cell,e=this;for(;e&&!t.isEdge();){if(!t.hasParent()||e.can("stopDelegateOnDragging"))return e;t=t.getParent(),e=this.graph.findViewByCell(t)}return null}validateMagnet(t,e,n){if(e.getAttribute("magnet")!=="passive"){const i=this.graph.options.connecting.validateMagnet;return i?D(i,this.graph,{e:n,magnet:e,view:t,cell:t.cell}):!0}return!1}startMagnetDragging(t,e,n){if(!this.can("magnetConnectable"))return;t.stopPropagation();const i=t.currentTarget,o=this.graph;this.setEventData(t,{targetMagnet:i}),this.validateMagnet(this,i,t)?(o.options.magnetThreshold<=0&&this.startConnectting(t,i,e,n),this.setEventData(t,{action:"magnet"}),this.stopPropagation(t)):this.onMouseDown(t,e,n),o.view.delegateDragEvents(t,this)}startConnectting(t,e,n,i){this.graph.model.startBatch("add-edge");const o=this.createEdgeFromMagnet(e,n,i);o.setEventData(t,o.prepareArrowheadDragging("target",{x:n,y:i,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(t,{edgeView:o}),o.notifyMouseDown(t,n,i)}getDefaultEdge(t,e){let n;const i=this.graph.options.connecting.createEdge;return i&&(n=D(i,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),n}createEdgeFromMagnet(t,e,n){const i=this.graph,o=i.model,r=this.getDefaultEdge(this,t);return r.setSource(Object.assign(Object.assign({},r.getSource()),this.getEdgeTerminal(t,e,n,r,"source"))),r.setTarget(Object.assign(Object.assign({},r.getTarget()),{x:e,y:n})),r.addTo(o,{async:!1,ui:!0}),r.findView(i)}dragMagnet(t,e,n){const i=this.getEventData(t),o=i.edgeView;if(o)o.onMouseMove(t,e,n),this.autoScrollGraph(t.clientX,t.clientY);else{const r=this.graph,a=r.options.magnetThreshold,l=this.getEventTarget(t),c=i.targetMagnet;if(a==="onleave"){if(c===l||c.contains(l))return}else if(r.view.getMouseMovedCount(t)<=a)return;this.startConnectting(t,c,e,n)}}stopMagnetDragging(t,e,n){const o=this.eventData(t).edgeView;o&&(o.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,o){let r=[o];const a=this.graph.getPlugin("selection");if(a&&a.isSelectionMovable()){const l=a.getSelectedCells();l.includes(o)&&(r=l.filter(c=>c.isNode()))}r.forEach(l=>{this.notify(t,{e,x:n,y:i,cell:l,node:l,view:l.findView(this.graph)})})}getRestrictArea(t){const e=this.graph.options.translating.restrict,n=typeof e=="function"?D(e,this.graph,t):e;return typeof n=="number"?this.graph.transform.getGraphArea().inflate(n):n===!0?this.graph.transform.getGraphArea():n||null}startNodeDragging(t,e,n){const i=this.getDelegatedView();if(i==null||!i.can("nodeMovable"))return this.notifyUnhandledMouseDown(t,e,n);this.setEventData(t,{targetView:i,action:"move"});const o=A.create(i.cell.getPosition());i.setEventData(t,{moving:!1,offset:o.diff(e,n),restrict:this.getRestrictArea(i)})}dragNode(t,e,n){const i=this.cell,o=this.graph,r=o.getGridSize(),a=this.getEventData(t),l=a.offset,c=a.restrict;a.moving||(a.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",t,e,n,this.cell)),this.autoScrollGraph(t.clientX,t.clientY);const h=ne(e+l.x,r),u=ne(n+l.y,r);i.setPosition(h,u,{restrict:c,deep:!0,ui:!0}),o.options.embedding.enabled&&(a.embedding||(this.prepareEmbedding(t),a.embedding=!0),this.processEmbedding(t,a))}autoOffsetNode(){const t=this.cell,e=this.graph,n=Object.assign({id:t.id},t.getPosition()),o=e.getNodes().map(c=>{const h=c.getPosition();return{id:c.id,x:h.x,y:h.y}}).filter(c=>c.id!==n.id),r=[[1,1],[1,-1],[-1,1],[-1,-1]];let a=e.getGridSize();const l=c=>o.some(h=>h.x===c.x&&h.y===c.y);for(;l(n);){let c=!1;for(let h=0;h<r.length;h+=1){const u=r[h],d={x:n.x+u[0]*a,y:n.y+u[1]*a};if(!l(d)){t.translate(u[0]*a,u[1]*a),c=!0;break}}if(c)break;a+=e.getGridSize()}}stopNodeDragging(t,e,n){const i=this.getEventData(t),o=this.graph;i.embedding&&this.finalizeEmbedding(t,i),i.moving&&(o.options.translating.autoOffset&&this.autoOffsetNode(),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)}}const au=`X6.${qt.name}`;qt.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"]}}),qt.registry.register("node",qt,!0);class De extends xt{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}static isEdgeView(t){if(t==null)return!1;if(t instanceof De)return!0;const e=t[Symbol.toStringTag],n=t;return(e==null||e===lu)&&typeof n.isNodeView=="function"&&typeof n.isEdgeView=="function"&&typeof n.confirmUpdate=="function"&&typeof n.update=="function"&&typeof n.getConnection=="function"}get[Symbol.toStringTag](){return lu}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const t=this.sourceView;if(!t){const n=this.cell.getSource();return new P(n.x,n.y)}const e=this.sourceMagnet;return t.isEdgeElement(e)?new P(this.sourceAnchor.x,this.sourceAnchor.y):t.getBBoxOfElement(e||t.container)}get targetBBox(){const t=this.targetView;if(!t){const n=this.cell.getTarget();return new P(n.x,n.y)}const e=this.targetMagnet;return t.isEdgeElement(e)?new P(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.notify("view:render",{view:this}),this}renderMarkup(){const t=this.cell.markup;if(t){if(typeof t=="string")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 o=e[n],r=this.labelCache[n],a=this.labelSelectors[n],l=this.graph.options.onEdgeLabelRendered;if(l){const c=l({edge:t,label:o,container:r,selectors:a});c&&(this.labelDestroyFn[n]=c)}}}}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 i=this.labelDestroyFn[e],o=this.labelCache[e],r=this.labelSelectors[e];i&&o&&r&&i({edge:this.cell,label:t[e],container:o,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=se("g"),this.addClass(this.prefixClassName("edge-labels"),i),this.labelContainer=i);for(let o=0,r=e.length;o<r;o+=1){const a=e[o],l=this.normalizeLabelMarkup(this.parseLabelMarkup(a.markup));let c,h;if(l)c=l.node,h=l.selectors;else{const d=t.getDefaultLabel(),g=this.normalizeLabelMarkup(this.parseLabelMarkup(d.markup));c=g.node,h=g.selectors}c.setAttribute("data-index",`${o}`),i.appendChild(c);const u=this.rootSelector;if(h[u])throw new Error("Ambiguous label root selector.");h[u]=c,this.labelCache[o]=c,this.labelSelectors[o]=h}return i.parentNode==null&&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(e==null)return!0;if("propertyPathArray"in t&&"propertyValue"in t){const n=t.propertyPathArray||[],i=n.length;if(i>1){const o=n[1];if(e[o]){if(i===2)return typeof t.propertyValue=="object"&&Yi(t.propertyValue,"markup");if(n[2]!=="markup")return!1}}}return!0}parseLabelMarkup(t){return t?typeof t=="string"?this.parseLabelStringMarkup(t):this.parseJSONMarkup(t):null}parseLabelStringMarkup(t){const e=L.createVectors(t),n=document.createDocumentFragment();for(let i=0,o=e.length;i<o;i+=1){const r=e[i].node;n.appendChild(r)}return{fragment:n,selectors:{}}}normalizeLabelMarkup(t){if(t==null)return;const e=t.fragment;if(!(e instanceof DocumentFragment)||!e.hasChildNodes())throw new Error("Invalid label markup.");let n;const i=e.childNodes;return i.length>1||i[0].nodeName.toUpperCase()!=="G"?n=L.create("g").append(e):n=L.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 o=0,r=e.length;o<r;o+=1){const a=this.labelCache[o],l=this.labelSelectors[o];a.setAttribute("cursor",n?"move":"default");const c=e[o],h=ct({},i.attrs,c.attrs);this.updateAttrs(a,h,{selectors:l,rootBBox:c.size?P.fromSize(c.size):void 0})}}}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}update(t={}){var e;this.cleanCache(),this.updateConnection(t);const n=this.cell.getAttrs(),{text:i}=n,o=K(n,["text"]);if(o!=null){if(((e=this.container)===null||e===void 0?void 0:e.tagName)==="g"&&this.isEdgeElement(this.container)&&Ly){const r=this.container.parentNode;if(r){const a=this.container.nextSibling;r.removeChild(this.container),r.insertBefore(this.container,a)}}this.updateAttrs(this.container,o,{selectors:this.selectors})}return this.updateLabelPositions(),this.updateTools(t),this}removeRedundantLinearVertices(t={}){const e=this.cell,n=e.getVertices(),i=[this.sourceAnchor,...n,this.targetAnchor],o=i.length,r=new yt(i);r.simplify({threshold:.01});const a=r.points.map(c=>c.toJSON()),l=a.length;return o===l?0:(e.setVertices(a.slice(1,l-1),t),o-l)}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 A.create(this.sourceAnchor);case"target":return A.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalConnectionPoint(t){switch(t){case"source":return A.create(this.sourcePoint);case"target":return A.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 n=this.sourceView;return n?this.sourceMagnet||n.container:null}case"target":{if(e.raw)return this.targetMagnet;const n=this.targetView;return n?this.targetMagnet||n.container:null}default:throw new Error(`Unknown terminal type '${t}'`)}}updateConnection(t={}){const e=this.cell;if(t.translateBy&&e.isFragmentDescendantOf(t.translateBy)){const n=t.tx||0,i=t.ty||0;this.routePoints=new yt(this.routePoints).translate(n,i).points,this.translateConnectionPoints(n,i),this.path.translate(n,i)}else{const n=e.getVertices(),i=this.findAnchors(n);this.sourceAnchor=i.source,this.targetAnchor=i.target,this.routePoints=this.findRoutePoints(n);const o=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=o.source,this.targetPoint=o.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,o=t[0],r=t[t.length-1];return i.priority&&!n.priority?this.findAnchorsOrdered("target",r,"source",o):this.findAnchorsOrdered("source",o,"target",r)}findAnchorsOrdered(t,e,n,i){let o,r;const a=this.cell,l=a[t],c=a[n],h=this.getTerminalView(t),u=this.getTerminalView(n),d=this.getTerminalMagnet(t),g=this.getTerminalMagnet(n);if(h){let p;e?p=A.create(e):u?p=g:p=A.create(c),o=this.getAnchor(l.anchor,h,d,p,t)}else o=A.create(l);if(u){const p=A.create(i||o);r=this.getAnchor(c.anchor,u,g,p,n)}else r=A.isPointLike(c)?A.create(c):new A;return{[t]:o,[n]:r}}getAnchor(t,e,n,i,o){const r=e.isEdgeElement(n),a=this.graph.options.connecting;let l=typeof t=="string"?{name:t}:t;if(!l){const u=r?(o==="source"?a.sourceEdgeAnchor:a.targetEdgeAnchor)||a.edgeAnchor:(o==="source"?a.sourceAnchor:a.targetAnchor)||a.anchor;l=typeof u=="string"?{name:u}:u}if(!l)throw new Error("Anchor should be specified.");let c;const h=l.name;if(r){const u=ni.get(h);if(typeof u!="function")return ni.onNotFound(h);c=D(u,this,e,n,i,l.args||{},o)}else{const u=ri.get(h);if(typeof u!="function")return ri.onNotFound(h);c=D(u,this,e,n,i,l.args||{},o)}return c?c.round(this.POINT_ROUNDING):new A}findRoutePoints(t=[]){const e=this.graph.options.connecting.router||$o.normal,n=this.cell.getRouter()||e;let i;if(typeof n=="function")i=D(n,this,t,{},this);else{const o=typeof n=="string"?n:n.name,r=typeof n=="string"?{}:n.args||{},a=o?ui.get(o):$o.normal;if(typeof a!="function")return ui.onNotFound(o);i=D(a,this,t,r,this)}return i==null?t.map(o=>A.create(o)):i.map(o=>A.create(o))}findConnectionPoints(t,e,n){const i=this.cell,o=this.graph.options.connecting,r=i.getSource(),a=i.getTarget(),l=this.sourceView,c=this.targetView,h=t[0],u=t[t.length-1];let d;if(l&&!l.isEdgeElement(this.sourceMagnet)){const p=this.sourceMagnet||l.container,m=h||n,b=new N(m,e),y=r.connectionPoint||o.sourceConnectionPoint||o.connectionPoint;d=this.getConnectionPoint(y,l,p,b,"source")}else d=e;let g;if(c&&!c.isEdgeElement(this.targetMagnet)){const p=this.targetMagnet||c.container,m=a.connectionPoint||o.targetConnectionPoint||o.connectionPoint,b=u||e,y=new N(b,n);g=this.getConnectionPoint(m,c,p,y,"target")}else g=n;return{source:d,target:g}}getConnectionPoint(t,e,n,i,o){const r=i.end;if(t==null)return r;const a=typeof t=="string"?t:t.name,l=typeof t=="string"?{}:t.args,c=Zn.get(a);if(typeof c!="function")return Zn.onNotFound(a);const h=D(c,this,i,e,n,l||{},o);return h?h.round(this.POINT_ROUNDING):r}findMarkerPoints(t,e,n){const i=u=>{const d=this.cell.getAttrs(),g=Object.keys(d);for(let p=0,m=g.length;p<m;p+=1){const b=d[g[p]];if(b[`${u}Marker`]||b[`${u}-marker`]){const y=b.strokeWidth||b["stroke-width"];if(y)return parseFloat(y);break}}return null},o=t[0],r=t[t.length-1];let a,l;const c=i("source");c&&(a=e.clone().move(o||n,-c));const h=i("target");return h&&(l=n.clone().move(r||e,-h)),this.sourceMarkerPoint=a||e.clone(),this.targetMarkerPoint=l||n.clone(),{source:a,target:l}}findPath(t,e,n){const i=this.cell.getConnector()||this.graph.options.connecting.connector;let o,r,a;if(typeof i=="string"?o=i:(o=i.name,r=i.args),o){const c=ei.get(o);if(typeof c!="function")return ei.onNotFound(o);a=c}else a=eh.normal;const l=D(a,this,e,n,t,Object.assign(Object.assign({},r),{raw:!0}),this);return typeof l=="string"?F.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(this.labelContainer==null)return this;if(!this.path)return this;const e=this.cell,n=e.getLabels();if(n.length===0)return this;const i=e.getDefaultLabel(),o=this.normalizeLabelPosition(i.position);for(let r=0,a=n.length;r<a;r+=1){const l=n[r],c=this.labelCache[r];if(!c)continue;const h=this.normalizeLabelPosition(l.position),u=ct({},o,h),d=this.getLabelTransformationMatrix(u);c.setAttribute("transform",Yn(d))}return this}updateTerminalProperties(t){const e=this.cell,n=this.graph,i=e[t],o=i&&i.cell,r=`${t}View`;if(!o)return this[r]=null,this.updateTerminalMagnet(t),!0;const a=n.getCellById(o);if(!a)throw new Error(`Edge's ${t} node with id "${o}" not exists`);const l=a.findView(n);return l?(this[r]=l,this.updateTerminalMagnet(t),!0):!1}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&&typeof e.position=="object"&&e.position.angle||0}getLabelPositionArgs(t){const e=this.cell.getLabelAt(t);if(e&&e.position&&typeof e.position=="object")return e.position.options}getDefaultLabelPositionArgs(){const t=this.cell.getDefaultLabel();if(t&&t.position&&typeof t.position=="object")return t.position.options}mergeLabelPositionArgs(t,e){return t===null?null:t===void 0?e===null?null:e:ct({},e,t)}getConnection(){return this.path!=null?this.path.clone():null}getConnectionPathData(){if(this.path==null)return"";const t=this.cache.pathCache;return Yi(t,"data")||(t.data=this.path.serialize()),t.data||""}getConnectionSubdivisions(){if(this.path==null)return null;const t=this.cache.pathCache;return Yi(t,"segmentSubdivisions")||(t.segmentSubdivisions=this.path.getSegmentSubdivisions()),t.segmentSubdivisions}getConnectionLength(){if(this.path==null)return 0;const t=this.cache.pathCache;return Yi(t,"length")||(t.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),t.length}getPointAtLength(t){return this.path==null?null:this.path.pointAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(t){return this.path==null?null:(ye(t)&&(t=parseFloat(t)/100),this.path.pointAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(t){return this.path==null?null:this.path.tangentAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(t){return this.path==null?null:this.path.tangentAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(t){return this.path==null?null:this.path.closestPoint(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(t){return this.path==null?null:this.path.closestPointLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(t){return this.path==null?null:this.path.closestPointNormalizedLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(t,e,n,i){const o={distance:0};let r=0,a;typeof n=="number"?(r=n,a=i):a=n,a!=null&&(o.options=a);const l=a&&a.absoluteOffset,c=!(a&&a.absoluteDistance),h=a&&a.absoluteDistance&&a.reverseDistance,u=this.path,d={segmentSubdivisions:this.getConnectionSubdivisions()},g=new A(t,e),p=u.closestPointT(g,d),m=this.getConnectionLength()||0;let b=u.lengthAtT(p,d);c&&(b=m>0?b/m:0),h&&(b=-1*(m-b)||1),o.distance=b;let y;l||(y=u.tangentAtT(p));let C;if(y)C=y.pointOffset(g);else{const w=u.pointAtT(p),x=g.diff(w);C={x:x.x,y:x.y}}return o.offset=C,o.angle=r,o}normalizeLabelPosition(t){return typeof t=="number"?{distance:t}:t}getLabelTransformationMatrix(t){const e=this.normalizeLabelPosition(t),n=e.options||{},i=e.angle||0,o=e.distance,r=o>0&&o<=1;let a=0;const l={x:0,y:0},c=e.offset;c&&(typeof c=="number"?a=c:(c.x!=null&&(l.x=c.x),c.y!=null&&(l.y=c.y)));const h=l.x!==0||l.y!==0||a===0,u=n.keepGradient,d=n.ensureLegibility,g=this.path,p={segmentSubdivisions:this.getConnectionSubdivisions()},m=r?o*this.getConnectionLength():o,b=g.tangentAtLength(m,p);let y,C=i;if(b){if(h)y=b.start,y.translate(l);else{const w=b.clone();w.rotate(-90,b.start),w.setLength(a),y=w.end}u&&(C=b.angle()+i,d&&(C=Tt((C+90)%180-90)))}else y=g.start,h&&y.translate(l);return At().translate(y.x,y.y).rotate(C)}getVertexIndex(t,e){const i=this.cell.getVertices(),o=this.getClosestPointLength(new A(t,e));let r=0;if(o!=null)for(const a=i.length;r<a;r+=1){const l=i[r],c=this.getClosestPointLength(l);if(c!=null&&o<c)break}return r}getEventArgs(t,e,n){const i=this,o=i.cell,r=o;return e==null||n==null?{e:t,view:i,edge:o,cell:r}:{e:t,x:e,y:n,view:i,edge:o,cell:r}}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}}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}}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){if(Jl(t.target,"edge-tool",this.container)){if(t.stopPropagation(),this.can("useEdgeTools")){if(e==="edge:remove"){this.cell.remove({ui:!0});return}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),this.getEventData(t).stopPropagation&&t.stopPropagation()}startEdgeDragging(t,e,n){if(!this.can("edgeMovable")){this.notifyUnhandledMouseDown(t,e,n);return}this.setEventData(t,{x:e,y:n,moving:!1,action:"drag-edge"})}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:e.isNewEdge===!0,terminalType:t,initialMagnet:n,initialTerminal:to(this.cell[t]),fallbackAction:e.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(t),options:e.options};return this.beforeArrowheadDragging(i),i}createValidateConnectionArgs(t){const e=[];e[4]=t,e[5]=this;let n,i=0,o=0;t==="source"?(i=2,n="target"):(o=2,n="source");const r=this.cell[n],a=r.cell;if(a){let l;const c=e[i]=this.graph.findViewByCell(a);c&&(l=c.getMagnetFromEdgeTerminal(r),l===c.container&&(l=void 0)),e[i+1]=l}return(l,c)=>(e[o]=l,e[o+1]=l.container===c?void 0:c,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){t.zIndex!=null&&(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,i,o,r,a){const l=this.graph.options.connecting,c=l.allowLoop,h=l.allowNode,u=l.allowEdge,d=l.allowPort,g=l.allowMulti,p=l.validateConnection,m=r?r.cell:null,b=o==="target"?n:t,y=o==="target"?i:e;let C=!0;const w=x=>{const E=o==="source"?a?a.port:null:m?m.getSourcePortId():null,B=o==="target"?a?a.port:null:m?m.getTargetPortId():null;return D(x,this.graph,{edge:m,edgeView:r,sourceView:t,targetView:n,sourcePort:E,targetPort:B,sourceMagnet:e,targetMagnet:i,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:o})};if(c!=null&&(typeof c=="boolean"?!c&&t===n&&(C=!1):C=w(c)),C&&d!=null&&(typeof d=="boolean"?!d&&y&&(C=!1):C=w(d)),C&&u!=null&&(typeof u=="boolean"?!u&&De.isEdgeView(b)&&(C=!1):C=w(u)),C&&h!=null&&y==null&&(typeof h=="boolean"?!h&&qt.isNodeView(b)&&(C=!1):C=w(h)),C&&g!=null&&r){const x=r.cell,E=o==="source"?a:x.getSource(),B=o==="target"?a:x.getTarget(),v=a?this.graph.getCellById(a.cell):null;if(E&&B&&E.cell&&B.cell&&v)if(typeof g=="function")C=w(g);else{const M=this.graph.model.getConnectedEdges(v,{outgoing:o==="source",incoming:o==="target"});M.length&&(g==="withPort"?M.some(T=>{const k=T.getSource(),R=T.getTarget();return k&&R&&k.cell===E.cell&&R.cell===B.cell&&k.port!=null&&k.port===E.port&&R.port!=null&&R.port===B.port})&&(C=!1):g||M.some(T=>{const k=T.getSource(),R=T.getTarget();return k&&R&&k.cell===E.cell&&R.cell===B.cell})&&(C=!1))}}return C&&p!=null&&(C=w(p)),C}allowConnectToBlank(t){const e=this.graph,i=e.options.connecting.allowBlank;if(typeof i!="function")return!!i;const o=e.findViewByCell(t),r=t.getSourceCell(),a=t.getTargetCell(),l=e.findViewByCell(r),c=e.findViewByCell(a);return D(i,e,{edge:t,edgeView:o,sourceCell:r,targetCell:a,sourceView:l,targetView:c,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:o.sourceMagnet,targetMagnet:o.targetMagnet})}validateEdge(t,e,n){const i=this.graph;if(!this.allowConnectToBlank(t)){const r=t.getSourceCellId(),a=t.getTargetCellId();if(!(r&&a))return!1}const o=i.options.connecting.validateEdge;return o?D(o,i,{edge:t,type:e,previous:n}):!0}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,o=t.currentMagnet;if(!o||!i)return;i.unhighlight(o,{type:"magnetAdsorbed"});const r=t.terminalType,a=i.getEdgeTerminal(o,e,n,this.cell,r);this.cell.setTerminal(r,a,{ui:!0})}snapArrowhead(t,e,n){const i=this.graph,{snap:o,allowEdge:r}=i.options.connecting,a=typeof o=="object"&&o.radius||50,l=typeof o=="object"&&o.anchor||"center",c=i.renderer.findViewsInArea({x:t-a,y:e-a,width:2*a,height:2*a},{nodeOnly:!0});if(r){const x=i.renderer.findEdgeViewsFromPoint({x:t,y:e},a).filter(E=>E!==this);c.push(...x)}const h=n.closestView||null,u=n.closestMagnet||null;n.closestView=null,n.closestMagnet=null;let d,g=Number.MAX_SAFE_INTEGER;const p=new A(t,e);c.forEach(x=>{if(x.container.getAttribute("magnet")!=="false"){if(x.isNodeView())d=l==="center"?x.cell.getBBox().getCenter().distance(p):x.cell.getBBox().getNearestPointToPoint(p).distance(p);else if(x.isEdgeView()){const E=x.getClosestPoint(p);E?d=E.distance(p):d=Number.MAX_SAFE_INTEGER}d<a&&d<g&&(u===x.container||this.validateConnection(...n.getValidateConnectionArgs(x,null),x.getEdgeTerminal(x.container,t,e,this.cell,n.terminalType)))&&(g=d,n.closestView=x,n.closestMagnet=x.container)}x.container.querySelectorAll("[magnet]").forEach(E=>{if(E.getAttribute("magnet")!=="false"){const B=x.getBBoxOfElement(E);d=p.distance(B.getCenter()),d<a&&d<g&&(u===E||this.validateConnection(...n.getValidateConnectionArgs(x,E),x.getEdgeTerminal(E,t,e,this.cell,n.terminalType)))&&(g=d,n.closestView=x,n.closestMagnet=E)}})});let m;const b=n.terminalType,y=n.closestView,C=n.closestMagnet,w=u!==C;if(h&&w&&h.unhighlight(u,{type:"magnetAdsorbed"}),y){if(!w)return;y.highlight(C,{type:"magnetAdsorbed"}),m=y.getEdgeTerminal(C,t,e,this.cell,b)}else m={x:t,y:e};this.cell.setTerminal(b,m,{},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,o=this.cell[n];if(o&&!ft.equalTerminals(i,o)){const a=this.graph,l=i,c=l.cell?a.getCellById(l.cell):null,h=l.port,u=c?a.findViewByCell(c):null,d=c||t.isNewEdge?null:A.create(i).toJSON(),g=o,p=g.cell?a.getCellById(g.cell):null,m=g.port,b=p?a.findViewByCell(p):null,y=p?null:A.create(o).toJSON();this.notify("edge:connected",{e,previousCell:c,previousPort:h,previousView:u,previousPoint:d,currentCell:p,currentView:b,currentPort:m,currentPoint:y,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,o=n.length;i<o;i+=1){const r=e.findViewByCell(n[i]);if(!r||r.cell.id===this.cell.id)continue;const a=Array.prototype.slice.call(r.container.querySelectorAll("[magnet]"));r.container.getAttribute("magnet")!=="false"&&a.push(r.container);const l=a.filter(c=>this.validateConnection(...t.getValidateConnectionArgs(r,c),r.getEdgeTerminal(c,t.x,t.y,this.cell,t.terminalType)));if(l.length>0){for(let c=0,h=l.length;c<h;c+=1)r.highlight(l[c],{type:"magnetAvailable"});r.highlight(null,{type:"nodeAvailable"}),t.marked[r.cell.id]=l}}}unhighlightAvailableMagnets(t){const e=t.marked||{};Object.keys(e).forEach(n=>{const i=this.graph.findViewByCell(n);i&&(e[n].forEach(r=>{i.unhighlight(r,{type:"magnetAvailable"})}),i.unhighlight(null,{type:"nodeAvailable"}))}),t.marked=null}startArrowheadDragging(t,e,n){if(!this.can("arrowheadMovable")){this.notifyUnhandledMouseDown(t,e,n);return}const o=t.target.getAttribute("data-terminal"),r=this.prepareArrowheadDragging(o,{x:e,y:n});this.setEventData(t,r)}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,o=this.getEventData(t);i.options.connecting.snap?this.snapArrowheadEnd(o):this.arrowheadDragged(o,e,n),this.validateEdge(this.cell,o.terminalType,o.initialTerminal)?(this.finishEmbedding(o),this.notifyConnectionEvent(o,t)):this.fallbackConnection(o),this.afterArrowheadDragging(o)}startLabelDragging(t,e,n){if(this.can("edgeLabelMovable")){const i=t.currentTarget,o=parseInt(i.getAttribute("data-index"),10),r=this.getLabelPositionAngle(o),a=this.getLabelPositionArgs(o),l=this.getDefaultLabelPositionArgs(),c=this.mergeLabelPositionArgs(a,l);this.setEventData(t,{index:o,positionAngle:r,positionArgs:c,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),o=this.cell.getLabelAt(i.index),r=ct({},o,{position:this.getLabelPosition(e,n,i.positionAngle,i.positionArgs)});this.cell.setLabelAt(i.index,r)}stopLabelDragging(t,e,n){}}const lu=`X6.${De.name}`;De.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"]}}),De.registry.register("edge",De,!0);const vn={idle:"idle",raf:"raf",timeout:"timeout"};class Bv{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=16,this.initialTime=Date.now(),this.pendingJobs=new Map,this.scheduleMode=null}queueJob(t){if(t.priority&xe.PRIOR)t.cb();else{const e=this.pendingJobs.get(t.id);if(e){if(e.cb=t.cb,t.priority!==e.priority){e.priority=t.priority;const n=this.queue.indexOf(e);if(n>=0){this.queue.splice(n,1);const i=this.findInsertionIndex(e);this.queue.splice(i,0,e)}}}else{const n=this.findInsertionIndex(t);this.queue.splice(n,0,t),this.pendingJobs.set(t.id,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.pendingJobs.clear(),this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(t){this.isFlushPending=!1,this.isFlushing=!0;const e=this.getCurrentTime();let n=this.frameInterval;if(t&&typeof t.timeRemaining=="function"){const i=t.timeRemaining();n=Math.max(0,Math.min(n,i))}for(;this.queue.length>0;){const i=this.queue.shift();if(i.cb(),this.pendingJobs.delete(i.id),this.getCurrentTime()-e>=n)break}this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){for(this.isFlushPending=!1,this.isFlushing=!0;this.queue.length>0;){const t=this.queue.shift();try{t.cb()}catch(e){console.error(e)}this.pendingJobs.delete(t.id)}this.isFlushing=!1}findInsertionIndex(t){let e=0,n=this.queue.length,i=n-1;const o=t.priority;for(;e<=i;){const r=(i-e>>1)+e;o<=this.queue[r].priority?e=r+1:(n=r,i=r-1)}return n}scheduleJob(){this.scheduleId&&this.cancelScheduleJob(),"requestAnimationFrame"in window?(this.scheduleMode=vn.raf,this.scheduleId=window.requestAnimationFrame(()=>this.flushJobs())):"requestIdleCallback"in window?(this.scheduleMode=vn.idle,this.scheduleId=window.requestIdleCallback(t=>this.flushJobs(t),{timeout:100})):(this.scheduleMode=vn.timeout,this.scheduleId=window.setTimeout(()=>this.flushJobs()))}cancelScheduleJob(){if(!this.scheduleId)return;const t={[vn.idle]:window==null?void 0:window.cancelIdleCallback,[vn.raf]:window==null?void 0:window.cancelAnimationFrame,[vn.timeout]:window==null?void 0:window.clearTimeout},e=this.scheduleMode,n=e?t[e]:void 0;typeof n=="function"&&n(this.scheduleId),this.scheduleId=0,this.scheduleMode=null}getCurrentTime(){return typeof performance=="object"&&typeof performance.now=="function"?performance.now():Date.now()-this.initialTime}}var xe;(function(s){s[s.Update=2]="Update",s[s.RenderEdge=4]="RenderEdge",s[s.RenderNode=8]="RenderNode",s[s.PRIOR=1048576]="PRIOR"})(xe||(xe={}));const Iv="#insert";var he;(function(s){s[s.CREATED=0]="CREATED",s[s.MOUNTED=1]="MOUNTED",s[s.WAITING=2]="WAITING"})(he||(he={}));class cu extends Cn{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(t){super(),this.views={},this.willRemoveViews={},this.queue=new Bv,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,previous:e}){let n=this.model.getCells();if(!(t!=null&&t.diff))this.queue.clearJobs(),this.removeZPivots(),this.resetViews();else{const i=new Set(e);n=n.filter(o=>!i.has(o))}this.renderViews(n,Object.assign(Object.assign({},t),{queue:n.map(i=>i.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,Re,e,xe.Update,!0)}onCellVisibleChanged({cell:t,current:e}){this.toggleVisible(t,!!e)}requestViewUpdate(t,e,n={},i=xe.Update,o=!0){const r=t.cell.id,a=this.views[r];if(!a)return;a.flag=e,a.options=n,(t.hasAction(e,["translate","resize","rotate"])||n.async===!1)&&(i=xe.PRIOR,o=!1);const c=e&Re?`${r}${Iv}`:r;this.queue.queueJob({id:c,priority:i,cb:()=>{this.renderViewInArea(t,e,n);const u=n.queue;if(u){const d=u.indexOf(t.cell.id);d>=0&&u.splice(d,1),u.length===0&&this.graph.trigger("render:done")}}}),this.getEffectedEdges(t).forEach(u=>{this.requestViewUpdate(u.view,u.flag,n,i,!1)}),o&&this.flush()}setRenderArea(t){this.renderArea=t,Object.values(this.views).forEach(e=>{if(!e)return;const{view:n}=e;e.state===he.MOUNTED&&(this.isUpdatable(n)||(n.remove(),this.graph.trigger("view:unmounted",{view:n}),e.state=he.WAITING,e.flag|=Re|n.getBootstrapFlag()))}),this.flushWaitingViews()}isViewMounted(t){if(t==null)return!1;const e=this.views[t.cell.id];return e?e.state===he.MOUNTED:!1}renderViews(t,e={}){t.sort((n,i)=>n.isNode()&&i.isEdge()?-1:0),t.forEach(n=>{const i=n.id,o=this.views;let r=0,a=o[i];if(a)r=Re;else{const l=this.createCellView(n);l&&(l.graph=this.graph,r=Re|l.getBootstrapFlag(),a={view:l,flag:r,options:e,state:he.CREATED},this.views[i]=a)}a&&this.requestViewUpdate(a.view,r,e,this.getRenderPriority(a.view),!1)}),this.flush()}renderViewInArea(t,e,n={}){const i=t.cell,o=i.id,r=this.views[o];if(!r)return;let a=0;this.isUpdatable(t)?(a=this.updateView(t,e,n),r.flag=a):(r.state===he.MOUNTED&&(t.remove(),this.graph.trigger("view:unmounted",{view:t}),a=0),r.state=he.WAITING,r.flag=e|Re|t.getBootstrapFlag()),a&&i.isEdge()&&!(a&t.getFlag(["source","target"]))&&this.queue.queueJob({id:o,priority:xe.RenderEdge,cb:()=>{this.updateView(t,e,n)}})}removeViews(t){t.forEach(e=>{const n=e.id,i=this.views[n];i&&(this.willRemoveViews[n]=i,delete this.views[n],this.queue.queueJob({id:n,priority:this.getRenderPriority(i.view),cb:()=>{this.removeView(i.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===he.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(t==null)return 0;if(xt.isCellView(t)){if(e&Mv)return this.removeView(t.cell),0;e&Re&&(this.insertView(t),e^=Re)}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=he.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 o=0,r=n.length;o<r;o+=1){const a=n[o];if(e){const l=a.getSourceCell(),c=a.getTargetCell();if(l&&!l.isVisible()||c&&!c.isVisible())continue;this.toggleVisible(a,!0)}else this.toggleVisible(a,!1)}const i=this.views[t.id];i&&$(i.view.container,{display:e?"unset":"none"})}addZPivot(t=0){this.zPivots==null&&(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 r in e){const a=+r;a<t&&a>i&&(i=a)}const o=this.container;if(i!==-1/0){const r=e[i];o.insertBefore(n,r.nextSibling)}else o.insertBefore(n,o.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 o=D(n,this.graph,t);if(o)return new o(t,e);if(o===null)return null}const i=t.view;if(i!=null&&typeof i=="string"){const o=xt.registry.get(i);return o?new o(t,e):xt.registry.onNotFound(i)}return t.isNode()?new qt(t,e):t.isEdge()?new De(t,e):null}getEffectedEdges(t){const e=[],n=t.cell,i=this.model.getConnectedEdges(n);for(let o=0,r=i.length;o<r;o+=1){const a=i[o],l=this.views[a.id];if(!l)continue;const c=l.view;if(!this.isViewMounted(c))continue;const h=["update"];a.getTargetCell()===n&&h.push("target"),a.getSourceCell()===n&&h.push("source"),e.push({id:a.id,view:c,flag:c.getFlag(h)})}return e}isUpdatable(t){if(t.isNodeView())return this.renderArea?this.renderArea.isIntersectWithRect(t.cell.getBBox()):!0;if(t.isEdgeView()){const e=t.cell,n=this.renderArea?this.renderArea.isIntersectWithRect(e.getBBox()):!0;if(this.graph.virtualRender.isVirtualEnabled())return n;const i=e.getSourceCell(),o=e.getTargetCell();if(this.renderArea&&i&&o)return this.renderArea.isIntersectWithRect(i.getBBox())||this.renderArea.isIntersectWithRect(o.getBBox())}return!0}getRenderPriority(t){return t.cell.isNode()?xe.RenderNode:xe.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(t=>{this.views[t].view.dispose()}),this.views={}}}H([q()],cu.prototype,"dispose",null);class hu extends Ht{constructor(){super(...arguments),this.schedule=new cu(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(t==null)return null;const e=this.options.container,n=typeof t=="string"?e.querySelector(t):t instanceof Element?t:t[0];if(n){const i=this.graph.view.findAttr("data-cell-id",n);if(i){const o=this.schedule.views;if(o[i])return o[i].view}}return null}findViewByCell(t){if(t==null)return null;const e=G.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(n=>this.findViewByCell(n)).filter(n=>n!=null?ce(n.container,{target:this.view.stage}).containsPoint(e):!1)}findEdgeViewsFromPoint(t,e=5){return this.model.getEdges().map(n=>this.findViewByCell(n)).filter(n=>{if(n!=null){const i=n.getClosestPoint(t);if(i)return i.distance(t)<=e}return!1})}findViewsInArea(t,e={}){const n=P.create(t);return this.model.getCells().map(i=>this.findViewByCell(i)).filter(i=>{if(i){if(e.nodeOnly&&!i.isNodeView())return!1;const o=ce(i.container,{target:this.view.stage});return o.width===0?o.inflate(1,0):o.height===0&&o.inflate(0,1),e.strict?n.containsRect(o):n.isIntersectWithRect(o)}return!1})}dispose(){this.schedule.dispose()}}H([q()],hu.prototype,"dispose",null);class lr extends Ht{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(),o=this.graph.translate();if(typeof n=="object"){const r=o.tx+i.sx*(n.x||0),a=o.ty+i.sy*(n.y||0);n=`${r}px ${a}px`}typeof e=="object"&&(e=P.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)){this.elem.style.backgroundImage="";return}const n=this.optionsCache;if(n&&n.image!==e.image)return;let i;const o=e.opacity,r=e.size;let a=e.repeat||"no-repeat";const l=ls.get(a);if(typeof l=="function"){const h=e.quality||1;t.width*=h,t.height*=h;const u=l(t,e);if(!(u instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");i=u.toDataURL("image/png"),e.repeat&&a!==e.repeat?a=e.repeat:a="repeat",typeof r=="object"?(r.width*=u.width/t.width,r.height*=u.height/t.height):r===void 0&&(e.size={width:u.width/h,height:u.height/h})}else i=t.src,r===void 0&&(e.size={width:t.width,height:t.height});n!=null&&typeof e.size=="object"&&e.image===n.image&&e.repeat===n.repeat&&e.quality===n.quality&&(n.size=to(e.size));const c=this.elem.style;c.backgroundImage=`url(${i})`,c.backgroundRepeat=a,c.opacity=o==null||o>=1?"":`${o}`,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=to(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()}}H([q()],lr.prototype,"dispose",null);class Pv extends Ht{getClientMatrix(){return At(this.view.stage.getScreenCTM())}getClientOffset(){const t=this.view.svg.getBoundingClientRect();return new A(t.left,t.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(t,e){return(typeof t=="number"?this.clientToLocalPoint(t,e):this.clientToLocalPoint(t.x,t.y)).snapToGrid(this.graph.getGridSize())}localToGraphPoint(t,e){const n=A.create(t,e);return Ae(n,this.graph.matrix())}localToClientPoint(t,e){const n=A.create(t,e);return Ae(n,this.getClientMatrix())}localToPagePoint(t,e){return(typeof t=="number"?this.localToGraphPoint(t,e):this.localToGraphPoint(t)).translate(this.getPageOffset())}localToGraphRect(t,e,n,i){const o=P.create(t,e,n,i);return Yt(o,this.graph.matrix())}localToClientRect(t,e,n,i){const o=P.create(t,e,n,i);return Yt(o,this.getClientMatrix())}localToPageRect(t,e,n,i){return(typeof t=="number"?this.localToGraphRect(t,e,n,i):this.localToGraphRect(t)).translate(this.getPageOffset())}graphToLocalPoint(t,e){const n=A.create(t,e);return Ae(n,this.graph.matrix().inverse())}clientToLocalPoint(t,e){const n=A.create(t,e);return Ae(n,this.getClientMatrix().inverse())}clientToGraphPoint(t,e){const n=A.create(t,e);return Ae(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){const i=A.create(t,e).diff(this.getPageOffset());return this.graphToLocalPoint(i)}graphToLocalRect(t,e,n,i){const o=P.create(t,e,n,i);return Yt(o,this.graph.matrix().inverse())}clientToLocalRect(t,e,n,i){const o=P.create(t,e,n,i);return Yt(o,this.getClientMatrix().inverse())}clientToGraphRect(t,e,n,i){const o=P.create(t,e,n,i);return Yt(o,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,i){const o=P.create(t,e,n,i),r=this.getPageOffset();return o.x-=r.x,o.y-=r.y,this.graphToLocalRect(o)}}const Tv=`.x6-graph {
87
+ position: relative;
88
+ overflow: hidden;
89
+ outline: none;
90
+ touch-action: none;
91
+ }
92
+ .x6-graph-background,
93
+ .x6-graph-grid,
94
+ .x6-graph-svg {
95
+ position: absolute;
96
+ top: 0;
97
+ right: 0;
98
+ bottom: 0;
99
+ left: 0;
100
+ }
101
+ .x6-graph-background-stage,
102
+ .x6-graph-grid-stage,
103
+ .x6-graph-svg-stage {
104
+ user-select: none;
105
+ }
106
+ .x6-graph.x6-graph-pannable {
107
+ cursor: grab;
108
+ cursor: -moz-grab;
109
+ cursor: -webkit-grab;
110
+ }
111
+ .x6-graph.x6-graph-panning {
112
+ cursor: grabbing;
113
+ cursor: -moz-grabbing;
114
+ cursor: -webkit-grabbing;
115
+ user-select: none;
116
+ }
117
+ .x6-node {
118
+ cursor: move;
119
+ /* stylelint-disable-next-line */
120
+ }
121
+ .x6-node.x6-node-immovable {
122
+ cursor: default;
123
+ }
124
+ .x6-node * {
125
+ -webkit-user-drag: none;
126
+ }
127
+ .x6-node .scalable * {
128
+ vector-effect: non-scaling-stroke;
129
+ }
130
+ .x6-node [magnet='true'] {
131
+ cursor: crosshair;
132
+ transition: opacity 0.3s;
133
+ }
134
+ .x6-node [magnet='true']:hover {
135
+ opacity: 0.7;
136
+ }
137
+ .x6-node foreignObject {
138
+ display: block;
139
+ overflow: visible;
140
+ background-color: transparent;
141
+ }
142
+ .x6-node foreignObject > body {
143
+ position: static;
144
+ width: 100%;
145
+ height: 100%;
146
+ margin: 0;
147
+ padding: 0;
148
+ overflow: visible;
149
+ background-color: transparent;
150
+ }
151
+ .x6-edge .source-marker,
152
+ .x6-edge .target-marker {
153
+ vector-effect: non-scaling-stroke;
154
+ }
155
+ .x6-edge .connection {
156
+ stroke-linejoin: round;
157
+ fill: none;
158
+ }
159
+ .x6-edge .connection-wrap {
160
+ cursor: move;
161
+ opacity: 0;
162
+ fill: none;
163
+ stroke: #000;
164
+ stroke-width: 15;
165
+ stroke-linecap: round;
166
+ stroke-linejoin: round;
167
+ }
168
+ .x6-edge .connection-wrap:hover {
169
+ opacity: 0.4;
170
+ stroke-opacity: 0.4;
171
+ }
172
+ .x6-edge .vertices {
173
+ cursor: move;
174
+ opacity: 0;
175
+ }
176
+ .x6-edge .vertices .vertex {
177
+ fill: #1abc9c;
178
+ }
179
+ .x6-edge .vertices .vertex :hover {
180
+ fill: #34495e;
181
+ stroke: none;
182
+ }
183
+ .x6-edge .vertices .vertex-remove {
184
+ cursor: pointer;
185
+ fill: #fff;
186
+ }
187
+ .x6-edge .vertices .vertex-remove-area {
188
+ cursor: pointer;
189
+ opacity: 0.1;
190
+ }
191
+ .x6-edge .vertices .vertex-group:hover .vertex-remove-area {
192
+ opacity: 1;
193
+ }
194
+ .x6-edge .arrowheads {
195
+ cursor: move;
196
+ opacity: 0;
197
+ }
198
+ .x6-edge .arrowheads .arrowhead {
199
+ fill: #1abc9c;
200
+ }
201
+ .x6-edge .arrowheads .arrowhead :hover {
202
+ fill: #f39c12;
203
+ stroke: none;
204
+ }
205
+ .x6-edge .tools {
206
+ cursor: pointer;
207
+ opacity: 0;
208
+ }
209
+ .x6-edge .tools .tool-options {
210
+ display: none;
211
+ }
212
+ .x6-edge .tools .tool-remove circle {
213
+ fill: #f00;
214
+ }
215
+ .x6-edge .tools .tool-remove path {
216
+ fill: #fff;
217
+ }
218
+ .x6-edge:hover .vertices,
219
+ .x6-edge:hover .arrowheads,
220
+ .x6-edge:hover .tools {
221
+ opacity: 1;
222
+ }
223
+ .x6-highlight-opacity {
224
+ opacity: 0.3;
225
+ }
226
+ .x6-cell-tool-editor {
227
+ position: relative;
228
+ display: inline-block;
229
+ min-height: 1em;
230
+ margin: 0;
231
+ padding: 0;
232
+ line-height: 1;
233
+ white-space: normal;
234
+ text-align: center;
235
+ vertical-align: top;
236
+ overflow-wrap: normal;
237
+ outline: none;
238
+ transform-origin: 0 0;
239
+ -webkit-user-drag: none;
240
+ cursor: text;
241
+ }
242
+ .x6-edge-tool-editor {
243
+ border: 1px solid #275fc5;
244
+ border-radius: 2px;
245
+ }
246
+ `;class uu extends Ht{init(){Me("core",Tv)}dispose(){Be("core")}}H([q()],uu.prototype,"dispose",null);class kv extends Ht{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(t){return this.svg.getElementById(t)!=null}filter(t){let e=t.id;const n=t.name;if(e||(e=`filter-${n}-${this.cid}-${Mo(JSON.stringify(t))}`),!this.isDefined(e)){const i=ii.get(n);if(i==null)return ii.onNotFound(n);const o=i(t.args||{}),r=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},t.attrs),{id:e});L.create(Pt.sanitize(o),r).appendTo(this.defs)}return e}gradient(t){let e=t.id;const n=t.type;if(e||(e=`gradient-${n}-${this.cid}-${Mo(JSON.stringify(t))}`),!this.isDefined(e)){const o=t.stops.map(l=>{const c=l.opacity!=null&&Number.isFinite(l.opacity)?l.opacity:1;return`<stop offset="${l.offset}" stop-color="${l.color}" stop-opacity="${c}"/>`}),r=`<${n}>${o.join("")}</${n}>`,a=Object.assign({id:e},t.attrs);L.create(r,a).appendTo(this.defs)}return e}marker(t){const{id:e,refX:n,refY:i,markerUnits:o,markerOrient:r,tagName:a,children:l}=t,c=K(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let h=e;if(h||(h=`marker-${this.cid}-${Mo(JSON.stringify(t))}`),!this.isDefined(h)){a!=="path"&&delete c.d;const u=L.create("marker",{refX:n,refY:i,id:h,overflow:"visible",orient:r??"auto",markerUnits:o||"userSpaceOnUse"},l?l.map(d=>{var{tagName:g}=d,p=K(d,["tagName"]);return L.create(`${g}`||"path",jn(Object.assign(Object.assign({},c),p)))}):[L.create(a||"path",jn(c))]);this.defs.appendChild(u.node)}return h}remove(t){const e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}}class du extends Ht{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(),o=Array.isArray(t)?t:[t];this.patterns.forEach((l,c)=>{const h=`pattern_${c}`,u=n.a||1,d=n.d||1,{update:g,markup:p}=l,m=K(l,["update","markup"]),b=Object.assign(Object.assign(Object.assign({},m),o[c]),{sx:u,sy:d,ox:n.e||0,oy:n.f||0,width:e*u,height:e*d});i.has(h)||i.add(h,L.create("pattern",{id:h,patternUnits:"userSpaceOnUse"},L.createVectors(p)).node);const y=i.get(h);typeof g=="function"&&g(y.childNodes[0],b);let C=b.ox%b.width;C<0&&(C+=b.width);let w=b.oy%b.height;w<0&&(w+=b.height),V(y,{x:C,y:w,width:b.width,height:b.height})});const r=new XMLSerializer().serializeToString(i.root),a=`url(data:image/svg+xml;base64,${btoa(r)})`;this.elem.style.backgroundImage=a}getInstance(){return this.instance||(this.instance=new Tx),this.instance}resolveGrid(t){if(!t)return[];const e=t.type;if(e==null)return[Object.assign(Object.assign({},sh.dot),t.args)];const n=si.get(e);if(n){let i=t.args||[];return Array.isArray(i)||(i=[i]),Array.isArray(n)?n.map((o,r)=>Object.assign(Object.assign({},o),i[r])):[Object.assign(Object.assign({},n),i[0])]}return si.onNotFound(e)}dispose(){this.stopListening(),this.clear()}}H([q()],du.prototype,"dispose",null);class gu extends Ht{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 o=this.getHighlighterId(e,i);if(!this.highlights[o]){const r=i.highlighter;r.highlight(t,e,Object.assign({},i.args)),this.highlights[o]={cellView:t,magnet:e,highlighter:r,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(n==null){const a=t.type;n=a&&e.highlighting[a]||e.highlighting.default}if(n==null)return null;const i=typeof n=="string"?{name:n}:n,o=i.name,r=oi.get(o);return r==null?oi.onNotFound(o):(Fx(o,r),{name:o,highlighter:r,args:i.args||{}})}getHighlighterId(t,e){return bo(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()}}H([q()],gu.prototype,"dispose",null);class fu extends Ht{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 vc(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return this.widgetOptions.enabled!==!0}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(e==null||e(t))&&Te(t,this.widgetOptions.modifiers)}onMouseWheel(t){const e=this.widgetOptions.guard;if((e==null||e(t))&&Te(t,this.widgetOptions.modifiers)){const n=this.widgetOptions.factor||1.2;this.currentScale==null&&(this.startPos={x:t.clientX,y:t.clientY},this.currentScale=this.graph.transform.getScale().sx),t.deltaY<0?(this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*n*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/n)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const o=this.currentScale;let r=this.graph.transform.clampScale(o*this.cumulatedFactor);const a=this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,l=this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER;if(r=Je(r,a,l),r!==o)if(this.widgetOptions.zoomAtMousePosition){const h=!!this.graph.getPlugin("scroller")?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(r,{absolute:!0,center:h.clone()})}else this.graph.zoom(r,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}H([q()],fu.prototype,"dispose",null);function Ov(s){const{grid:t,panning:e,mousewheel:n,embedding:i}=s,o=K(s,["grid","panning","mousewheel","embedding"]),r=s.container;if(r!=null)o.width==null&&(o.width=r.clientWidth),o.height==null&&(o.height=r.clientHeight);else throw new Error("Ensure the container of the graph is specified and valid");const a=ct({},Nv,o),l={size:10,visible:!1};return typeof t=="number"?a.grid={size:t,visible:!1}:typeof t=="boolean"?a.grid=Object.assign(Object.assign({},l),{visible:t}):a.grid=Object.assign(Object.assign({},l),t),["panning","mousewheel","embedding"].forEach(h=>{const u=s[h];typeof u=="boolean"?a[h].enabled=u:u!=null&&(a[h]=Object.assign(Object.assign({},a[h]),u))}),a}const Nv={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!0,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:_.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:_.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:s,sourceView:t,targetView:e}){return(s==="target"?e:t)!=null},createEdge(){return new ou}},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};class pu extends Ht{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&this.widgetOptions.enabled===!0}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on("blank:mousedown",this.onMouseDown,this),this.graph.on("node:unhandled:mousedown",this.onMouseDown,this),this.graph.on("edge:unhandled:mousedown",this.onMouseDown,this),nt.on(this.graph.container,"mousedown",this.onRightMouseDown),nt.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new vc(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),nt.off(this.graph.container,"mousedown",this.onRightMouseDown),nt.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(t,e){return t.spaceKey=this.isSpaceKeyPressed,this.pannable&&Te(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(t),nt.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)}),nt.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(t),nt.off(document.body,".panning"),nt.off(window,".panning")}updateClassName(t){const e=this.widgetOptions.eventTypes;if((e==null?void 0:e.length)===1&&e.includes("mouseWheel"))return;const n=this.view.container,i=this.view.prefixClassName("graph-panning"),o=this.view.prefixClassName("graph-pannable"),r=this.graph.getPlugin("selection"),a=r&&r.allowRubberband(t,!0),l=(e==null?void 0:e.includes("leftMouseDown"))&&!a;this.allowPanning(t??{},!0)||this.allowPanning(t??{})&&l?this.panning?(O(n,i),st(n,o)):(st(n,i),O(n,o)):this.panning||(st(n,i),st(n,o))}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;e!=null&&e.includes("rightMouseDown")&&t.button===2&&this.allowPanning(t,!0)&&this.startPanning(t)}onMouseWheel(t,e,n){this.graph.translateBy(-e,-n)}onKeyDown(t){t.which===32&&(this.isSpaceKeyPressed=!0),this.updateClassName(t)}onKeyUp(t){t.which===32&&(this.isSpaceKeyPressed=!1),this.updateClassName(t)}allowBlankMouseDown(t){const e=this.widgetOptions.eventTypes;return typeof t.type=="string"&&t.type.startsWith("touch")||t.pointerType==="touch"?e==null?void 0:e.includes("leftMouseDown"):(e==null?void 0:e.includes("leftMouseDown"))&&t.button===0||(e==null?void 0:e.includes("mouseWheelDown"))&&t.button===1}allowMouseWheel(t){var e;return this.pannable&&!t.ctrlKey&&((e=this.widgetOptions.eventTypes)===null||e===void 0?void 0:e.includes("mouseWheel"))}autoPanning(t,e){const i=this.graph.getGraphArea();let o=0,r=0;t<=i.left+10&&(o=-10),e<=i.top+10&&(r=-10),t>=i.right-10&&(o=10),e>=i.bottom-10&&(r=10),(o!==0||r!==0)&&this.graph.translateBy(-o,-r)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}H([q()],pu.prototype,"dispose",null);class mu extends Ht{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 typeof t=="boolean"?this.getContainer()||void 0:t}init(){if(this.options.autoResize){const e=this.getSensorTarget();if(e){if(typeof ResizeObserver>"u")return;this.ro=new ResizeObserver(o=>{if(!o||o.length===0)return;const{width:r,height:a}=o[0].contentRect;this.resize(Math.round(r),Math.round(a))}),this.ro.observe(e);const n=e.offsetWidth,i=e.offsetHeight;this.resize(n,i)}}}resize(t,e){const n=this.getScroller();n?n.resize(t,e):this.graph.transform.resize(t,e)}dispose(){this.ro&&(this.ro.disconnect(),this.ro=void 0)}}H([q()],mu.prototype,"dispose",null);class Rv extends Ht{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),At(this.viewportMatrix)}setMatrix(t){const e=At(t),n=Yn(e);this.viewport.setAttribute("transform",n),this.viewportMatrix=e,this.viewportTransformString=n}resize(t,e){let n=t===void 0?this.options.width:t,i=e===void 0?this.options.height:e;this.options.width=n,this.options.height=i,typeof n=="number"&&(n=Math.round(n)),typeof i=="number"&&(i=Math.round(i)),this.container.style.width=n==null?"":`${n}px`,this.container.style.height=i==null?"":`${i}px`;const o=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},o)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return be(t)||(t=this.container.clientWidth),be(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return qC(this.getMatrix())}scale(t,e=t,n=0,i=0,o=!0){if(t=this.clampScale(t),e=this.clampScale(e),o&&(n||i)){const a=this.getTranslation(),l=this.getScale(),c=n-(n-a.tx)*(t/l.sx),h=i-(i-a.ty)*(e/l.sy);(c!==a.tx||h!==a.ty)&&this.translate(c,h)}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 Je(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,i=t;const o=this.getScale(),r=this.getComputedSize();let a=r.width/2,l=r.height/2;return e.absolute||(n+=o.sx,i+=o.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&&(a=e.center.x,l=e.center.y),n=this.clampScale(n),i=this.clampScale(i),this.scale(n,i,a,l),this}getRotation(){return WC(this.getMatrix())}rotate(t,e,n){if(e==null||n==null){const o=ce(this.stage);e=o.width/2,n=o.height/2}const i=this.getMatrix().translate(e,n).rotate(t).translate(-e,-n);return this.setMatrix(i),this}getTranslation(){return XC(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(typeof t=="object"){const w=t;t=w.gridWidth||1,e=w.gridHeight||1,n=w.padding||0,i=w}else t=t||1,e=e||1,n=n||0,i==null&&(i={});const o=ee(n),r=i.border||0,a=i.contentArea?P.create(i.contentArea):this.getContentArea(i);r>0&&a.inflate(r);const l=this.getScale(),c=this.getTranslation(),h=l.sx,u=l.sy;a.x*=h,a.y*=u,a.width*=h,a.height*=u;let d=Math.max(Math.ceil((a.width+a.x)/t),1)*t,g=Math.max(Math.ceil((a.height+a.y)/e),1)*e,p=0,m=0;(i.allowNewOrigin==="negative"&&a.x<0||i.allowNewOrigin==="positive"&&a.x>=0||i.allowNewOrigin==="any")&&(p=Math.ceil(-a.x/t)*t,p+=o.left,d+=p),(i.allowNewOrigin==="negative"&&a.y<0||i.allowNewOrigin==="positive"&&a.y>=0||i.allowNewOrigin==="any")&&(m=Math.ceil(-a.y/e)*e,m+=o.top,g+=m),d+=o.right,g+=o.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 b=this.getComputedSize(),y=d!==b.width||g!==b.height;return(p!==c.tx||m!==c.ty)&&this.translate(p,m),y&&this.resize(d,g),new P(-p/h,-m/u,d/h,g/u)}scaleContentToFit(t={}){this.scaleContentToFitImpl(t)}scaleContentToFitImpl(t={},e=!0){let n,i;if(t.contentArea){const y=t.contentArea;n=this.graph.localToGraph(y),i=A.create(y)}else n=this.getContentBBox(t),i=this.graph.graphToLocal(n);if(!n.width||!n.height)return;const o=ee(t.padding),r=t.minScale||0,a=t.maxScale||Number.MAX_SAFE_INTEGER,l=t.minScaleX||r,c=t.maxScaleX||a,h=t.minScaleY||r,u=t.maxScaleY||a;let d;if(t.viewportArea)d=t.viewportArea;else{const y=this.getComputedSize(),C=this.getTranslation();d={x:C.tx,y:C.ty,width:y.width,height:y.height}}d=P.create(d).moveAndExpand({x:o.left,y:o.top,width:-o.left-o.right,height:-o.top-o.bottom});const g=this.getScale();let p=d.width/n.width*g.sx,m=d.height/n.height*g.sy;t.preserveAspectRatio!==!1&&(p=m=Math.min(p,m));const b=t.scaleGrid;if(b&&(p=b*Math.floor(p/b),m=b*Math.floor(m/b)),p=Je(p,l,c),m=Je(m,h,u),this.scale(p,m),e){const y=this.options,C=d.x-i.x*p-y.x,w=d.y-i.y*m-y.y;this.translate(C,w)}}getContentArea(t={}){return t.useCellGeometry!==!1?this.model.getAllCellsBBox()||new P:ce(this.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){const t=P.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){const n=P.create(t),i=this.graph;e.contentArea=n,e.viewportArea==null&&(e.viewportArea={x:i.options.x,y:i.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(e,!1);const o=n.getCenter();return this.centerPoint(o.x,o.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){const n=this.getComputedSize(),i=this.getScale(),o=this.getTranslation(),r=n.width/2,a=n.height/2;t=typeof t=="number"?t:r,e=typeof e=="number"?e:a,t=r-t*i.sx,e=a-e*i.sy,(o.tx!==t||o.ty!==e)&&this.translate(t,e)}centerContent(t){const n=this.graph.getContentArea(t).getCenter();this.centerPoint(n.x,n.y)}centerCell(t){return this.positionCell(t,"center")}positionPoint(t,e,n){const i=this.getComputedSize();e=zt(e,Math.max(0,i.width)),e<0&&(e=i.width+e),n=zt(n,Math.max(0,i.height)),n<0&&(n=i.height+n);const o=this.getTranslation(),r=this.getScale(),a=e-t.x*r.sx,l=n-t.y*r.sy;(o.tx!==a||o.ty!==l)&&this.translate(a,l)}positionRect(t,e){const n=P.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)}}const Qe=`${_.prefixCls}-graph`;class ve extends Ft{static snapshoot(t){const e=t.cloneNode();return t.childNodes.forEach(n=>{e.appendChild(n)}),()=>{for(Kn(t);t.attributes.length>0;)t.removeAttribute(t.attributes[0].name);for(let n=0,i=e.attributes.length;n<i;n+=1){const o=e.attributes[n];t.setAttribute(o.name,o.value)}e.childNodes.forEach(n=>{t.appendChild(n)})}}get disposeContainer(){return!1}get options(){return this.graph.options}constructor(t){super(),this.graph=t;const{selectors:e,fragment:n}=Pt.parseJSONMarkup(ve.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=ve.snapshoot(this.container),O(this.container,this.prefixClassName("graph")),Mt(this.container,n),this.delegateEvents()}delegateEvents(){const t=this.constructor;return super.delegateEvents(t.events),this}guard(t,e){return t.type==="mousedown"&&t.button===2||this.options.guard&&this.options.guard(t,e)?!0:t.data&&t.data.guarded!==void 0?t.data.guarded:!(e&&e.cell&&G.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,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,x:i.x,y:i.y})}}isPreventDefaultContextMenu(t){let e=this.options.preventDefaultContextMenu;return typeof e=="function"&&(e=D(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,x:i.x,y:i.y})}delegateDragEvents(t,e){t.data==null&&(t.data={}),this.setEventData(t,{currentView:e||null,mouseMovedCount:0,startPosition:{x:t.clientX,y:t.clientY}});const n=this.constructor;this.delegateDocumentEvents(n.documentEvents,t.data),this.undelegateEvents()}getMouseMovedCount(t){return this.getEventData(t).mouseMovedCount||0}onMouseDown(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;this.options.preventDefaultMouseDown&&t.preventDefault();const 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,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||(e.mouseMovedCount==null&&(e.mouseMovedCount=0),e.mouseMovedCount+=1,e.mouseMovedCount<=this.options.moveThreshold))return;const o=this.normalizeEvent(t),r=this.graph.snapToGrid(o.clientX,o.clientY),a=e.currentView;a?a.onMouseMove(o,r.x,r.y):this.graph.trigger("blank:mousemove",{e:o,x:r.x,y:r.y}),this.setEventData(o,e)}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY),o=this.getEventData(t).currentView;if(o?o.onMouseUp(e,n.x,n.y):this.graph.trigger("blank:mouseup",{e,x:n.x,y:n.y}),!t.isPropagationStopped()){const r=new Ce(t,{type:"click",data:t.data});this.onClick(r)}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})}}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})}}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})}}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})}}onMouseWheel(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=e.originalEvent,o=this.graph.snapToGrid(i.clientX,i.clientY),r=Math.max(-1,Math.min(1,i.wheelDelta||-i.detail));n?n.onMouseWheel(e,o.x,o.y,r):this.graph.trigger("blank:mousewheel",{e,delta:r,x:o.x,y:o.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 o=this.normalizeEvent(t);if(this.guard(o,i))return;const r=this.graph.snapToGrid(o.clientX,o.clientY);i.onCustomEvent(o,n,r.x,r.y)}}}handleMagnetEvent(t,e){const n=t.currentTarget,i=n.getAttribute("magnet");if(i&&i.toLowerCase()!=="false"){const o=this.findView(n);if(o){const r=this.normalizeEvent(t);if(this.guard(r,o))return;const a=this.graph.snapToGrid(r.clientX,r.clientY);D(e,this.graph,o,r,n,a.x,a.y)}}}onMagnetMouseDown(t){this.handleMagnetEvent(t,(e,n,i,o,r)=>{e.onMagnetMouseDown(n,i,o,r)})}onMagnetDblClick(t){this.handleMagnetEvent(t,(e,n,i,o,r)=>{e.onMagnetDblClick(n,i,o,r)})}onMagnetContextMenu(t){const e=this.findView(t.target);this.isPreventDefaultContextMenu(e)&&t.preventDefault(),this.handleMagnetEvent(t,(n,i,o,r,a)=>{n.onMagnetContextMenu(i,o,r,a)})}onLabelMouseDown(t){const e=t.currentTarget,n=this.findView(e);if(n){const i=this.normalizeEvent(t);if(this.guard(i,n))return;const o=this.graph.snapToGrid(i.clientX,i.clientY);n.onLabelMouseDown(i,o.x,o.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}ve.markup=[{ns:Ct.xhtml,tagName:"div",selector:"background",className:`${Qe}-background`},{ns:Ct.xhtml,tagName:"div",selector:"grid",className:`${Qe}-grid`},{ns:Ct.svg,tagName:"svg",selector:"svg",className:`${Qe}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":Ct.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${Qe}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${Qe}-svg-primer`},{tagName:"g",selector:"stage",className:`${Qe}-svg-stage`},{tagName:"g",selector:"decorator",className:`${Qe}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${Qe}-svg-overlay`}]}]}],ve.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${_.prefixCls}-cell`]:"onMouseEnter",[`mouseleave .${_.prefixCls}-cell`]:"onMouseLeave",[`mouseenter .${_.prefixCls}-cell-tools`]:"onMouseEnter",[`mouseleave .${_.prefixCls}-cell-tools`]:"onMouseLeave",[`mousedown .${_.prefixCls}-cell [event]`]:"onCustomEvent",[`touchstart .${_.prefixCls}-cell [event]`]:"onCustomEvent",[`mousedown .${_.prefixCls}-cell [data-event]`]:"onCustomEvent",[`touchstart .${_.prefixCls}-cell [data-event]`]:"onCustomEvent",[`dblclick .${_.prefixCls}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${_.prefixCls}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${_.prefixCls}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${_.prefixCls}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${_.prefixCls}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${_.prefixCls}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${_.prefixCls}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${_.prefixCls}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${_.prefixCls}-cell image`]:"onImageDragStart",[`mousedown .${_.prefixCls}-edge .${_.prefixCls}-edge-label`]:"onLabelMouseDown",[`touchstart .${_.prefixCls}-edge .${_.prefixCls}-edge-label`]:"onLabelMouseDown"},ve.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},H([q()],ve.prototype,"dispose",null);const bu=120;class yu extends Ht{init(){this.resetRenderArea=Ty(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}bindScrollerEvents(t){this.scrollerRef=t,typeof t.on=="function"&&(t.on("pan:start",this.resetRenderArea,this),t.on("panning",this.resetRenderArea,this),t.on("pan:stop",this.resetRenderArea,this));const e=t.container;e&&(this.scrollerScrollHandler=n=>{this.resetRenderArea()},nt.on(e,"scroll",this.scrollerScrollHandler))}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this);const t=this.graph.getPlugin("scroller");t&&this.bindScrollerEvents(t)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this),this.unbindScroller()}onScrollerReady(t){this.scrollerRef!==t&&(this.unbindScroller(),this.bindScrollerEvents(t),this.resetRenderArea())}unbindScroller(){if(this.scrollerRef){typeof this.scrollerRef.off=="function"&&(this.scrollerRef.off("pan:start",this.resetRenderArea,this),this.scrollerRef.off("panning",this.resetRenderArea,this),this.scrollerRef.off("pan:stop",this.resetRenderArea,this));const t=this.scrollerRef.container;t&&this.scrollerScrollHandler&&nt.off(t,"scroll",this.scrollerScrollHandler),this.scrollerRef=void 0,this.scrollerScrollHandler=void 0}}setVirtualEnabled(t){const e=this.options.virtual;if(typeof e=="object"){const n=e;this.options.virtual=Object.assign(Object.assign({},n),{enabled:t})}else this.options.virtual=t}enableVirtualRender(){this.setVirtualEnabled(!0),this.resetRenderArea()}disableVirtualRender(){this.setVirtualEnabled(!1),this.graph.renderer.setRenderArea(void 0)}isVirtualEnabled(){const t=this.options.virtual;return t!=null&&typeof t=="object"?t.enabled!==!1:!!t}getVirtualMargin(){const t=this.options.virtual;if(typeof t=="object"){const e=t.margin;return typeof e=="number"?e:bu}return bu}resetRenderArea(){if(this.isVirtualEnabled()){const e=this.graph.getGraphArea();if(e){const n=this.getVirtualMargin(),i=e.clone();i.inflate(n,n),this.graph.renderer.setRenderArea(i);return}}}dispose(){this.stopListening()}}H([q()],yu.prototype,"dispose",null);class S extends Ot{static isGraph(t){if(t==null)return!1;if(t instanceof S)return!0;const e=t[Symbol.toStringTag];return e==null||e===S.toStringTag}static render(t,e){const n=t instanceof HTMLElement?new S({container:t}):new S(t);return e!=null&&n.fromJSON(e),n}get container(){return this.options.container}get[Symbol.toStringTag](){return S.toStringTag}constructor(t){super(),this.installedPlugins=new Set,this.options=Ov(t),this.css=new uu(this),this.view=new ve(this),this.defs=new kv(this),this.coord=new Pv(this),this.transform=new Rv(this),this.highlight=new gu(this),this.grid=new du(this),this.background=new lr(this),this.options.model?this.model=this.options.model:(this.model=new Ut,this.model.graph=this),this.renderer=new hu(this),this.panning=new pu(this),this.mousewheel=new fu(this),this.virtualRender=new yu(this),this.size=new mu(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(n=>vt.isNode(n)?n:this.createNode(n)),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(n=>ft.isEdge(n)?n:this.createEdge(n)),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,o){return this.model.getNodesInArea(t,e,n,i,o)}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=typeof t=="string"?t:"update",o=typeof t=="string"?e:t,r=typeof e=="function"?n:e;this.startBatch(i,r);const a=o();return this.stopBatch(i,r),a}updateCellId(t,e){return this.model.updateCellId(t,e)}findView(t){return G.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return P.isRectangleLike(t)?this.findViewsInArea(t):A.isPointLike(t)?this.findViewsFromPoint(t):[]}findViewByCell(t){return this.renderer.findViewByCell(t)}findViewByElem(t){return this.renderer.findViewByElem(t)}findViewsFromPoint(t,e){const n=typeof t=="number"?{x:t,y:e}:t;return this.renderer.findViewsFromPoint(n)}findViewsInArea(t,e,n,i,o){const r=typeof t=="number"?{x:t,y:e,width:n,height:i}:t,a=typeof t=="number"?o:e;return this.renderer.findViewsInArea(r,a)}matrix(t){return typeof t>"u"?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 typeof t>"u"?this.transform.getScale():(this.transform.scale(t,e,n,i),this)}zoom(t,e){const n=this.getPlugin("scroller");if(n){if(typeof t>"u")return n.zoom();n.zoom(t,e)}else{if(typeof t>"u")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 typeof t>"u"?this.transform.getRotation():(this.transform.rotate(t,e,n),this)}translate(t,e){return typeof t>"u"?this.transform.getTranslation():(this.transform.translate(t,e),this)}translateBy(t,e){const n=this.translate(),i=n.tx+t,o=n.ty+e;return this.translate(i,o)}getGraphArea(){var t;const e=this.getPlugin("scroller");if(e){const n=(t=e.getVisibleArea)===null||t===void 0?void 0:t.call(e);if(n)return n}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 o=this.getPlugin("scroller");return o?o.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 P.isRectangleLike(t)?this.coord.pageToLocalRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof i=="number"?this.coord.pageToLocalRect(t,e,n,i):this.coord.pageToLocalPoint(t,e)}localToPage(t,e,n,i){return P.isRectangleLike(t)?this.coord.localToPageRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof i=="number"?this.coord.localToPageRect(t,e,n,i):this.coord.localToPagePoint(t,e)}clientToLocal(t,e,n,i){return P.isRectangleLike(t)?this.coord.clientToLocalRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof i=="number"?this.coord.clientToLocalRect(t,e,n,i):this.coord.clientToLocalPoint(t,e)}localToClient(t,e,n,i){return P.isRectangleLike(t)?this.coord.localToClientRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof i=="number"?this.coord.localToClientRect(t,e,n,i):this.coord.localToClientPoint(t,e)}localToGraph(t,e,n,i){return P.isRectangleLike(t)?this.coord.localToGraphRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof i=="number"?this.coord.localToGraphRect(t,e,n,i):this.coord.localToGraphPoint(t,e)}graphToLocal(t,e,n,i){return P.isRectangleLike(t)?this.coord.graphToLocalRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof i=="number"?this.coord.graphToLocalRect(t,e,n,i):this.coord.graphToLocalPoint(t,e)}clientToGraph(t,e,n,i){return P.isRectangleLike(t)?this.coord.clientToGraphRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof i=="number"?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 n!=null&&(this.options.background==null||!e)?n.drawBackground(t,e):this.background.draw(t),this}clearBackground(t){const e=this.getPlugin("scroller");return e!=null&&(this.options.background==null||!t)?e.clearBackground(t):this.background.clear(),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 t==null?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 t==null?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}handleScrollerPluginStateChange(t,e){t.name==="scroller"&&(e?this.virtualRender.onScrollerReady(t):this.virtualRender.unbindScroller())}use(t,...e){return this.installedPlugins.has(t)||(this.installedPlugins.add(t),t.init(this,...e),this.handleScrollerPluginStateChange(t,!0)),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 n==null||n.forEach(i=>{var o;(o=i==null?void 0:i.enable)===null||o===void 0||o.call(i),this.handleScrollerPluginStateChange(i,!0)}),this}disablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return n==null||n.forEach(i=>{var o;(o=i==null?void 0:i.disable)===null||o===void 0||o.call(i),this.handleScrollerPluginStateChange(i,!1)}),this}isPluginEnabled(t){var e;const n=this.getPlugin(t);return(e=n==null?void 0:n.isEnabled)===null||e===void 0?void 0:e.call(n)}disposePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return n==null||n.forEach(i=>{i.dispose(),this.handleScrollerPluginStateChange(i,!1),this.installedPlugins.delete(i)}),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(e=>{e.dispose()})}}S.toStringTag=`X6.${S.name}`,S.registerNode=vt.registry.register,S.registerEdge=ft.registry.register,S.registerView=xt.registry.register,S.registerAttr=$n.register,S.registerGrid=si.register,S.registerFilter=ii.register,S.registerNodeTool=mi.register,S.registerEdgeTool=bi.register,S.registerBackground=ls.register,S.registerHighlighter=oi.register,S.registerPortLayout=li.register,S.registerPortLabelLayout=ms.register,S.registerMarker=Xn.register,S.registerRouter=ui.register,S.registerConnector=ei.register,S.registerAnchor=ri.register,S.registerEdgeAnchor=ni.register,S.registerConnectionPoint=Zn.register,S.unregisterNode=vt.registry.unregister,S.unregisterEdge=ft.registry.unregister,S.unregisterView=xt.registry.unregister,S.unregisterAttr=$n.unregister,S.unregisterGrid=si.unregister,S.unregisterFilter=ii.unregister,S.unregisterNodeTool=mi.unregister,S.unregisterEdgeTool=bi.unregister,S.unregisterBackground=ls.unregister,S.unregisterHighlighter=oi.unregister,S.unregisterPortLayout=li.unregister,S.unregisterPortLabelLayout=ms.unregister,S.unregisterMarker=Xn.unregister,S.unregisterRouter=ui.unregister,S.unregisterConnector=ei.unregister,S.unregisterAnchor=ri.unregister,S.unregisterEdgeAnchor=ni.unregister,S.unregisterConnectionPoint=Zn.unregister,H([q()],S.prototype,"dispose",null);const cr="html",hr={};class Cu extends vt{static register(t){const{shape:e,html:n,effect:i,inherit:o}=t,r=K(t,["shape","html","effect","inherit"]);if(!e)throw new Error("HTML.register should specify `shape` in config.");hr[e]={html:n,effect:i},S.registerNode(e,Object.assign({inherit:o||"html"},r),!0)}}Cu.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},Pt.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),vt.registry.register("html",Cu,!0);class ur extends qt{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:t}){const e=hr[this.cell.shape];if(e){const{effect:n}=e;(!n||n.includes(t))&&this.renderHTMLComponent()}}confirmUpdate(t){const e=super.confirmUpdate(t);return this.handleAction(e,cr,()=>this.renderHTMLComponent())}renderHTMLComponent(){const t=this.selectors&&this.selectors.foContent;if(t){Kn(t);const e=hr[this.cell.shape];if(!e)return;let{html:n}=e;typeof n=="function"&&(n=n(this.cell)),n&&(typeof n=="string"?t.innerHTML=n:Mt(t,n))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}H([q()],ur.prototype,"dispose",null),ur.config({bootstrap:[cr],actions:{html:cr}}),qt.registry.register("html-view",ur,!0),xn("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:Sv()},{selector:"image"}),yi.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(s){const{path:t}=s,e=K(s,["path"]);return t&&gn(e,"attrs/body/refD",t),e}});class dr extends yi{get points(){return this.getPoints()}set points(t){this.setPoints(t)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(t,e){return t==null?this.removePoints():this.setAttrByPath("body/refPoints",su(t),e),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}dr.config({propHooks(s){const{points:t}=s,e=K(s,["points"]);if(t){const n=su(t);n&&gn(e,"attrs/body/refPoints",n)}return e}}),xn("polygon",{},{parent:dr}),xn("polyline",{},{parent:dr}),xn("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}});function Dv(s){return s?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:Ct.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"}}}const Qv={shape:"text-block",markup:[{tagName:"rect",selector:"body"},Dv(Fy)],attrs:{body:Object.assign(Object.assign({},iu),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(s){const{text:t}=s,e=K(s,["text"]);return t&&gn(e,"attrs/label/text",t),e},attrHooks:{text:{set(s,{cell:t,view:e,refBBox:n,elem:i,attrs:o}){if(i instanceof HTMLElement)i.textContent=s;else{const r=o.style||{},a={text:s,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},r),c=Hc.textWrap;return D(c.set,this,a,{cell:t,view:e,elem:i,refBBox:n,attrs:l}),{fill:r.color||null}}},position(s,{refBBox:t,elem:e}){if(e instanceof SVGElement)return t.getCenter()}}}};yi.define(Qv);const gr=`${_.prefixCls}.clipboard.cells`;function Lv(s){if(window.localStorage){const t=s.map(e=>e.toJSON());localStorage.setItem(gr,JSON.stringify(t))}}function Fv(){if(window.localStorage){const s=localStorage.getItem(gr),t=s?JSON.parse(s):[];if(t)return Ut.fromJSON(t)}}function zv(){window.localStorage&&localStorage.removeItem(gr)}class Uv{constructor(){this.cells=[]}copy(t,e,n={}){this.options=Object.assign({},n);const o=(Ut.isModel(e)?e:e.model).cloneSubGraph(t,n);this.cells=co(Object.keys(o).map(r=>o[r]),r=>r.isEdge()?2:1),this.serialize(n)}cut(t,e,n={}){this.copy(t,e,n),(S.isGraph(e)?e.model:e).batchUpdate("cut",()=>{t.forEach(o=>o.remove())})}paste(t,e={}){const n=Object.assign(Object.assign({},this.options),e),{offset:i,edgeProps:o,nodeProps:r}=n;let a=20,l=20;i&&(a=typeof i=="number"?i:i.dx,l=typeof i=="number"?i:i.dy),this.deserialize(n);const c=this.cells;c.forEach(u=>{u.model=null,u.removeProp("zIndex"),(a||l)&&u.translate(a,l),r&&u.isNode()&&u.prop(r),o&&u.isEdge()&&u.prop(o)});const h=S.isGraph(t)?t.model:t;return h.batchUpdate("paste",()=>{h.addCells(this.cells)}),this.copy(c,t,e),c}serialize(t){t.useLocalStorage!==!1&&Lv(this.cells)}deserialize(t){if(t.useLocalStorage){const e=Fv();e&&(this.cells=e)}}isEmpty(t={}){return t.useLocalStorage&&this.deserialize(t),this.cells.length<=0}clean(){this.options={},this.cells=[],zv()}}S.prototype.isClipboardEnabled=function(){const s=this.getPlugin("clipboard");return s?s.isEnabled():!1},S.prototype.enableClipboard=function(){const s=this.getPlugin("clipboard");return s&&s.enable(),this},S.prototype.disableClipboard=function(){const s=this.getPlugin("clipboard");return s&&s.disable(),this},S.prototype.toggleClipboard=function(s){const t=this.getPlugin("clipboard");return t&&t.toggleEnabled(s),this},S.prototype.isClipboardEmpty=function(s){const t=this.getPlugin("clipboard");return t?t.isEmpty(s):!0},S.prototype.getCellsInClipboard=function(){const s=this.getPlugin("clipboard");return s?s.getCellsInClipboard():[]},S.prototype.cleanClipboard=function(){const s=this.getPlugin("clipboard");return s&&s.clean(),this},S.prototype.copy=function(s,t){const e=this.getPlugin("clipboard");return e&&e.copy(s,t),this},S.prototype.cut=function(s,t){const e=this.getPlugin("clipboard");return e&&e.cut(s,t),this},S.prototype.paste=function(s,t){const e=this.getPlugin("clipboard");return e?e.paste(s,t):[]};class Au extends Ot{get disabled(){return this.options.enabled!==!0}get cells(){return this.clipboardImpl.cells}constructor(t={}){super(),this.name="clipboard",this.options=Object.assign({enabled:!0},t)}init(t){this.graph=t,this.clipboardImpl=new Uv,this.clipboardImpl.deserialize(this.options)}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t===void 0&&(t=!this.isEnabled()),t?this.enable():this.disable(),this}isEmpty(t={}){return this.clipboardImpl.isEmpty(t)}getCellsInClipboard(){return this.cells}clean(t){return(!this.disabled||t)&&(this.clipboardImpl.clean(),this.notify("clipboard:changed",{cells:[]})),this}copy(t,e={}){return this.disabled||(this.clipboardImpl.copy(t,this.graph,Object.assign(Object.assign({},this.commonOptions),e)),this.notify("clipboard:changed",{cells:t})),this}cut(t,e={}){return this.disabled||(this.clipboardImpl.cut(t,this.graph,Object.assign(Object.assign({},this.commonOptions),e)),this.notify("clipboard:changed",{cells:t})),this}paste(t={},e=this.graph){return this.disabled?[]:this.clipboardImpl.paste(e,Object.assign(Object.assign({},this.commonOptions),t))}get commonOptions(){const t=this.options,{enabled:e}=t;return K(t,["enabled"])}notify(t,e){this.trigger(t,e),this.graph.trigger(t,e)}dispose(){this.clean(!0),this.off()}}H([q()],Au.prototype,"dispose",null);function wu(s,t){var e=Object.keys(s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(s);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),e.push.apply(e,n)}return e}function xu(s){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(e),!0).forEach(function(n){Kv(s,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(e)):wu(Object(e)).forEach(function(n){Object.defineProperty(s,n,Object.getOwnPropertyDescriptor(e,n))})}return s}function fr(s){"@babel/helpers - typeof";return fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fr(s)}function Kv(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}var Ci,Jv={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function Es(){if(Ci!==void 0)return Ci;Ci="";var s=document.createElement("p").style,t="Transform";for(var e in Jv)e+t in s&&(Ci=e);return Ci}function vu(){return Es()?"".concat(Es(),"TransitionProperty"):"transitionProperty"}function Ss(){return Es()?"".concat(Es(),"Transform"):"transform"}function Eu(s,t){var e=vu();e&&(s.style[e]=t,e!=="transitionProperty"&&(s.style.transitionProperty=t))}function pr(s,t){var e=Ss();e&&(s.style[e]=t,e!=="transform"&&(s.style.transform=t))}function jv(s){return s.style.transitionProperty||s.style[vu()]}function Vv(s){var t=window.getComputedStyle(s,null),e=t.getPropertyValue("transform")||t.getPropertyValue(Ss());if(e&&e!=="none"){var n=e.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(n[12]||n[4],0),y:parseFloat(n[13]||n[5],0)}}return{x:0,y:0}}var Gv=/matrix\((.*)\)/,Yv=/matrix3d\((.*)\)/;function Hv(s,t){var e=window.getComputedStyle(s,null),n=e.getPropertyValue("transform")||e.getPropertyValue(Ss());if(n&&n!=="none"){var i,o=n.match(Gv);if(o)o=o[1],i=o.split(",").map(function(a){return parseFloat(a,10)}),i[4]=t.x,i[5]=t.y,pr(s,"matrix(".concat(i.join(","),")"));else{var r=n.match(Yv)[1];i=r.split(",").map(function(a){return parseFloat(a,10)}),i[12]=t.x,i[13]=t.y,pr(s,"matrix3d(".concat(i.join(","),")"))}}else pr(s,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}var qv=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,Ai;function Su(s){var t=s.style.display;s.style.display="none",s.offsetHeight,s.style.display=t}function En(s,t,e){var n=e;if(fr(t)==="object"){for(var i in t)t.hasOwnProperty(i)&&En(s,i,t[i]);return}if(typeof n<"u"){typeof n=="number"&&(n="".concat(n,"px")),s.style[t]=n;return}return Ai(s,t)}function Wv(s){var t,e,n,i=s.ownerDocument,o=i.body,r=i&&i.documentElement;return t=s.getBoundingClientRect(),e=Math.floor(t.left),n=Math.floor(t.top),e-=r.clientLeft||o.clientLeft||0,n-=r.clientTop||o.clientTop||0,{left:e,top:n}}function Mu(s,t){var e=s["page".concat(t?"Y":"X","Offset")],n="scroll".concat(t?"Top":"Left");if(typeof e!="number"){var i=s.document;e=i.documentElement[n],typeof e!="number"&&(e=i.body[n])}return e}function Bu(s){return Mu(s)}function Iu(s){return Mu(s,!0)}function wi(s){var t=Wv(s),e=s.ownerDocument,n=e.defaultView||e.parentWindow;return t.left+=Bu(n),t.top+=Iu(n),t}function mr(s){return s!=null&&s==s.window}function Pu(s){return mr(s)?s.document:s.nodeType===9?s:s.ownerDocument}function Xv(s,t,e){var n=e,i="",o=Pu(s);return n=n||o.defaultView.getComputedStyle(s,null),n&&(i=n.getPropertyValue(t)||n[t]),i}var _v=new RegExp("^(".concat(qv,")(?!px)[a-z%]+$"),"i"),$v=/^(top|right|bottom|left)$/,br="currentStyle",yr="runtimeStyle",He="left",Zv="px";function tE(s,t){var e=s[br]&&s[br][t];if(_v.test(e)&&!$v.test(t)){var n=s.style,i=n[He],o=s[yr][He];s[yr][He]=s[br][He],n[He]=t==="fontSize"?"1em":e||0,e=n.pixelLeft+Zv,n[He]=i,s[yr][He]=o}return e===""?"auto":e}typeof window<"u"&&(Ai=window.getComputedStyle?Xv:tE);function Ms(s,t){return s==="left"?t.useCssRight?"right":s:t.useCssBottom?"bottom":s}function Tu(s){if(s==="left")return"right";if(s==="right")return"left";if(s==="top")return"bottom";if(s==="bottom")return"top"}function ku(s,t,e){En(s,"position")==="static"&&(s.style.position="relative");var n=-999,i=-999,o=Ms("left",e),r=Ms("top",e),a=Tu(o),l=Tu(r);o!=="left"&&(n=999),r!=="top"&&(i=999);var c="",h=wi(s);("left"in t||"top"in t)&&(c=jv(s)||"",Eu(s,"none")),"left"in t&&(s.style[a]="",s.style[o]="".concat(n,"px")),"top"in t&&(s.style[l]="",s.style[r]="".concat(i,"px")),Su(s);var u=wi(s),d={};for(var g in t)if(t.hasOwnProperty(g)){var p=Ms(g,e),m=g==="left"?n:i,b=h[g]-u[g];p===g?d[p]=m+b:d[p]=m-b}En(s,d),Su(s),("left"in t||"top"in t)&&Eu(s,c);var y={};for(var C in t)if(t.hasOwnProperty(C)){var w=Ms(C,e),x=t[C]-h[C];C===w?y[w]=d[w]+x:y[w]=d[w]-x}En(s,y)}function eE(s,t){var e=wi(s),n=Vv(s),i={x:n.x,y:n.y};"left"in t&&(i.x=n.x+t.left-e.left),"top"in t&&(i.y=n.y+t.top-e.top),Hv(s,i)}function nE(s,t,e){if(e.ignoreShake){var n=wi(s),i=n.left.toFixed(0),o=n.top.toFixed(0),r=t.left.toFixed(0),a=t.top.toFixed(0);if(i===r&&o===a)return}e.useCssRight||e.useCssBottom?ku(s,t,e):e.useCssTransform&&Ss()in document.body.style?eE(s,t):ku(s,t,e)}function Cr(s,t){for(var e=0;e<s.length;e++)t(s[e])}function Ou(s){return Ai(s,"boxSizing")==="border-box"}var iE=["margin","border","padding"],Ar=-1,sE=2,wr=1,oE=0;function rE(s,t,e){var n={},i=s.style,o;for(o in t)t.hasOwnProperty(o)&&(n[o]=i[o],i[o]=t[o]);e.call(s);for(o in t)t.hasOwnProperty(o)&&(i[o]=n[o])}function xi(s,t,e){var n=0,i,o,r;for(o=0;o<t.length;o++)if(i=t[o],i)for(r=0;r<e.length;r++){var a=void 0;i==="border"?a="".concat(i).concat(e[r],"Width"):a=i+e[r],n+=parseFloat(Ai(s,a))||0}return n}var ue={getParent:function(t){var e=t;do e.nodeType===11&&e.host?e=e.host:e=e.parentNode;while(e&&e.nodeType!==1&&e.nodeType!==9);return e}};Cr(["Width","Height"],function(s){ue["doc".concat(s)]=function(t){var e=t.document;return Math.max(e.documentElement["scroll".concat(s)],e.body["scroll".concat(s)],ue["viewport".concat(s)](e))},ue["viewport".concat(s)]=function(t){var e="client".concat(s),n=t.document,i=n.body,o=n.documentElement,r=o[e];return n.compatMode==="CSS1Compat"&&r||i&&i[e]||r}});function Nu(s,t,e){var n=e;if(mr(s))return t==="width"?ue.viewportWidth(s):ue.viewportHeight(s);if(s.nodeType===9)return t==="width"?ue.docWidth(s):ue.docHeight(s);var i=t==="width"?["Left","Right"]:["Top","Bottom"],o=Math.floor(t==="width"?s.getBoundingClientRect().width:s.getBoundingClientRect().height),r=Ou(s),a=0;(o==null||o<=0)&&(o=void 0,a=Ai(s,t),(a==null||Number(a)<0)&&(a=s.style[t]||0),a=Math.floor(parseFloat(a))||0),n===void 0&&(n=r?wr:Ar);var l=o!==void 0||r,c=o||a;return n===Ar?l?c-xi(s,["border","padding"],i):a:l?n===wr?c:c+(n===sE?-xi(s,["border"],i):xi(s,["margin"],i)):a+xi(s,iE.slice(n),i)}var aE={position:"absolute",visibility:"hidden",display:"block"};function Ru(){for(var s=arguments.length,t=new Array(s),e=0;e<s;e++)t[e]=arguments[e];var n,i=t[0];return i.offsetWidth!==0?n=Nu.apply(void 0,t):rE(i,aE,function(){n=Nu.apply(void 0,t)}),n}Cr(["width","height"],function(s){var t=s.charAt(0).toUpperCase()+s.slice(1);ue["outer".concat(t)]=function(n,i){return n&&Ru(n,s,i?oE:wr)};var e=s==="width"?["Left","Right"]:["Top","Bottom"];ue[s]=function(n,i){var o=i;if(o!==void 0){if(n){var r=Ou(n);return r&&(o+=xi(n,["padding","border"],e)),En(n,s,o)}return}return n&&Ru(n,s,Ar)}});function Du(s,t){for(var e in t)t.hasOwnProperty(e)&&(s[e]=t[e]);return s}var U={getWindow:function(t){if(t&&t.document&&t.setTimeout)return t;var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},getDocument:Pu,offset:function(t,e,n){if(typeof e<"u")nE(t,e,n||{});else return wi(t)},isWindow:mr,each:Cr,css:En,clone:function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);var i=t.overflow;if(i)for(e in t)t.hasOwnProperty(e)&&(n.overflow[e]=t.overflow[e]);return n},mix:Du,getWindowScrollLeft:function(t){return Bu(t)},getWindowScrollTop:function(t){return Iu(t)},merge:function(){for(var t={},e=0;e<arguments.length;e++)U.mix(t,e<0||arguments.length<=e?void 0:arguments[e]);return t},viewportWidth:0,viewportHeight:0};Du(U,ue);var xr=U.getParent;function Qu(s){if(U.isWindow(s)||s.nodeType===9)return null;var t=U.getDocument(s),e=t.body,n,i=U.css(s,"position"),o=i==="fixed"||i==="absolute";if(!o)return s.nodeName.toLowerCase()==="html"?null:xr(s);for(n=xr(s);n&&n!==e&&n.nodeType!==9;n=xr(n))if(i=U.css(n,"position"),i!=="static")return n;return null}var Lu=U.getParent;function lE(s){if(U.isWindow(s)||s.nodeType===9)return!1;var t=U.getDocument(s),e=t.body,n=null;for(n=Lu(s);n&&n!==e&&n!==t;n=Lu(n)){var i=U.css(n,"position");if(i==="fixed")return!0}return!1}function cE(s,t){for(var e={left:0,right:1/0,top:0,bottom:1/0},n=Qu(s),i=U.getDocument(s),o=i.defaultView||i.parentWindow,r=i.body,a=i.documentElement;n;){if((navigator.userAgent.indexOf("MSIE")===-1||n.clientWidth!==0)&&n!==r&&n!==a&&U.css(n,"overflow")!=="visible"){var l=U.offset(n);l.left+=n.clientLeft,l.top+=n.clientTop,e.top=Math.max(e.top,l.top),e.right=Math.min(e.right,l.left+n.clientWidth),e.bottom=Math.min(e.bottom,l.top+n.clientHeight),e.left=Math.max(e.left,l.left)}else if(n===r||n===a)break;n=Qu(n)}var c=null;if(!U.isWindow(s)&&s.nodeType!==9){c=s.style.position;var h=U.css(s,"position");h==="absolute"&&(s.style.position="fixed")}var u=U.getWindowScrollLeft(o),d=U.getWindowScrollTop(o),g=U.viewportWidth(o),p=U.viewportHeight(o),m=a.scrollWidth,b=a.scrollHeight,y=window.getComputedStyle(r);if(y.overflowX==="hidden"&&(m=o.innerWidth),y.overflowY==="hidden"&&(b=o.innerHeight),s.style&&(s.style.position=c),t||lE(s))e.left=Math.max(e.left,u),e.top=Math.max(e.top,d),e.right=Math.min(e.right,u+g),e.bottom=Math.min(e.bottom,d+p);else{var C=Math.max(m,u+g);e.right=Math.min(e.right,C);var w=Math.max(b,d+p);e.bottom=Math.min(e.bottom,w)}return e.top>=0&&e.left>=0&&e.bottom>e.top&&e.right>e.left?e:null}function hE(s,t,e,n){var i=U.clone(s),o={width:t.width,height:t.height};return n.adjustX&&i.left<e.left&&(i.left=e.left),n.resizeWidth&&i.left>=e.left&&i.left+o.width>e.right&&(o.width-=i.left+o.width-e.right),n.adjustX&&i.left+o.width>e.right&&(i.left=Math.max(e.right-o.width,e.left)),n.adjustY&&i.top<e.top&&(i.top=e.top),n.resizeHeight&&i.top>=e.top&&i.top+o.height>e.bottom&&(o.height-=i.top+o.height-e.bottom),n.adjustY&&i.top+o.height>e.bottom&&(i.top=Math.max(e.bottom-o.height,e.top)),U.mix(i,o)}function uE(s){var t,e,n;if(!U.isWindow(s)&&s.nodeType!==9)t=U.offset(s),e=U.outerWidth(s),n=U.outerHeight(s);else{var i=U.getWindow(s);t={left:U.getWindowScrollLeft(i),top:U.getWindowScrollTop(i)},e=U.viewportWidth(i),n=U.viewportHeight(i)}return t.width=e,t.height=n,t}function Fu(s,t){var e=t.charAt(0),n=t.charAt(1),i=s.width,o=s.height,r=s.left,a=s.top;return e==="c"?a+=o/2:e==="b"&&(a+=o),n==="c"?r+=i/2:n==="r"&&(r+=i),{left:r,top:a}}function Bs(s,t,e,n,i){var o=Fu(t,e[1]),r=Fu(s,e[0]),a=[r.left-o.left,r.top-o.top];return{left:Math.round(s.left-a[0]+n[0]-i[0]),top:Math.round(s.top-a[1]+n[1]-i[1])}}function zu(s,t,e){return s.left<e.left||s.left+t.width>e.right}function Uu(s,t,e){return s.top<e.top||s.top+t.height>e.bottom}function dE(s,t,e){return s.left>e.right||s.left+t.width<e.left}function gE(s,t,e){return s.top>e.bottom||s.top+t.height<e.top}function Is(s,t,e){var n=[];return U.each(s,function(i){n.push(i.replace(t,function(o){return e[o]}))}),n}function Ps(s,t){return s[t]=-s[t],s}function Ku(s,t){var e;return/%$/.test(s)?e=parseInt(s.substring(0,s.length-1),10)/100*t:e=parseInt(s,10),e||0}function Ju(s,t){s[0]=Ku(s[0],t.width),s[1]=Ku(s[1],t.height)}function fE(s,t,e,n){var i=e.points,o=e.offset||[0,0],r=e.targetOffset||[0,0],a=e.overflow,l=e.source||s;o=[].concat(o),r=[].concat(r),a=a||{};var c={},h=0,u=!!(a&&a.alwaysByViewport),d=cE(l,u),g=uE(l);Ju(o,g),Ju(r,t);var p=Bs(g,t,i,o,r),m=U.merge(g,p);if(d&&(a.adjustX||a.adjustY)&&n){if(a.adjustX&&zu(p,g,d)){var b=Is(i,/[lr]/gi,{l:"r",r:"l"}),y=Ps(o,0),C=Ps(r,0),w=Bs(g,t,b,y,C);dE(w,g,d)||(h=1,i=b,o=y,r=C)}if(a.adjustY&&Uu(p,g,d)){var x=Is(i,/[tb]/gi,{t:"b",b:"t"}),E=Ps(o,1),B=Ps(r,1),v=Bs(g,t,x,E,B);gE(v,g,d)||(h=1,i=x,o=E,r=B)}h&&(p=Bs(g,t,i,o,r),U.mix(m,p));var M=zu(p,g,d),I=Uu(p,g,d);if(M||I){var T=i;M&&(T=Is(i,/[lr]/gi,{l:"r",r:"l"})),I&&(T=Is(i,/[tb]/gi,{t:"b",b:"t"})),i=T,o=e.offset||[0,0],r=e.targetOffset||[0,0]}c.adjustX=a.adjustX&&M,c.adjustY=a.adjustY&&I,(c.adjustX||c.adjustY)&&(m=hE(p,g,d,c))}return m.width!==g.width&&U.css(l,"width",U.width(l)+m.width-g.width),m.height!==g.height&&U.css(l,"height",U.height(l)+m.height-g.height),U.offset(l,{left:m.left,top:m.top},{useCssRight:e.useCssRight,useCssBottom:e.useCssBottom,useCssTransform:e.useCssTransform,ignoreShake:e.ignoreShake}),{points:i,offset:o,targetOffset:r,overflow:c}}function pE(s,t,e){var n,i,o=U.getDocument(s),r=o.defaultView||o.parentWindow,a=U.getWindowScrollLeft(r),l=U.getWindowScrollTop(r),c=U.viewportWidth(r),h=U.viewportHeight(r);"pageX"in t?n=t.pageX:n=a+t.clientX,"pageY"in t?i=t.pageY:i=l+t.clientY;var u={left:n,top:i,width:0,height:0},d=n>=0&&n<=a+c&&i>=0&&i<=l+h,g=[e.points[0],"cc"];return fE(s,u,xu(xu({},e),{},{points:g}),d)}const mE=`.x6-widget-dnd {
247
+ position: absolute;
248
+ top: -10000px;
249
+ left: -10000px;
250
+ z-index: 999999;
251
+ display: none;
252
+ cursor: move;
253
+ opacity: 0.7;
254
+ }
255
+ .x6-widget-dnd.dragging {
256
+ display: inline-block;
257
+ }
258
+ .x6-widget-dnd.dragging * {
259
+ pointer-events: none !important;
260
+ }
261
+ .x6-widget-dnd .x6-graph {
262
+ background: transparent;
263
+ box-shadow: none;
264
+ }
265
+ `,ju={getDragNode:s=>s.clone(),getDropNode:s=>s.clone()};class vr extends Ft{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}get snapline(){return this.options.target.getPlugin("snapline")}constructor(t){super(),this.name="dnd",this.options=Object.assign(Object.assign({},ju),t),this.init()}init(){Me(this.name,mE),this.container=document.createElement("div"),O(this.container,this.prefixClassName("widget-dnd")),this.draggingGraph=new S(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1,async:!1})),Mt(this.container,this.draggingGraph.container)}start(t,e){var n;const i=e;i.preventDefault(),this.targetModel.startBatch("dnd"),O(this.container,"dragging"),Gt(this.container,this.options.draggingContainer||document.body),this.sourceNode=t,this.prepareDragging(t,i.clientX,i.clientY);const o=this.updateNodePosition(i.clientX,i.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:i,node:t,cell:t,view:this.draggingView,x:o.x,y:o.y}),(n=this.draggingNode)===null||n===void 0||n.on("change:position",this.snap,this)),this.delegateDocumentEvents(ru,i.data)}isSnaplineEnabled(){var t;return(t=this.snapline)===null||t===void 0?void 0:t.isEnabled()}prepareDragging(t,e,n){const i=this.draggingGraph,o=i.model,r=this.options.getDragNode(t,{sourceNode:t,draggingGraph:i,targetGraph:this.targetGraph});r.position(0,0);let a=5;if(this.isSnaplineEnabled()&&(a+=this.snapline.options.tolerance||0),this.isSnaplineEnabled()||this.options.scaled){const h=this.targetGraph.transform.getScale();i.scale(h.sx,h.sy),a*=Math.max(h.sx,h.sy)}else i.scale(1,1);this.clearDragging(),o.resetCells([r]);const l=i.findViewByCell(r);l.undelegateEvents(),l.cell.off("changed"),i.fitToContent({padding:a,allowNewOrigin:"any",useCellGeometry:!1});const c=l.getBBox();this.geometryBBox=l.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(c.getTopLeft()),this.draggingNode=r,this.draggingView=l,this.draggingBBox=r.getBBox(),this.padding=a,this.updateGraphPosition(e,n)}updateGraphPosition(t,e){const n=this.delta,i=this.geometryBBox,o=this.padding||5,r={left:t-n.x-i.width/2-o,top:e-n.y-i.height/2-o};this.draggingGraph&&pE(this.container,{clientX:r.left,clientY:r.top},{points:["tl"]})}updateNodePosition(t,e){const n=this.targetGraph.clientToLocal(t,e),i=this.draggingBBox;return i&&(n.x-=i.width/2,n.y-=i.height/2,this.draggingNode.position(n.x,n.y)),n}snap({cell:t,current:e,options:n}){const i=t;if(n.snapped){const o=this.draggingBBox;i.position(o.x+n.tx,o.y+n.ty,{silent:!0}),this.draggingView.translate(),i.position(e.x,e.y,{silent:!0}),this.snapOffset={x:n.tx,y:n.ty}}else this.snapOffset=null}onMouseMove(t){this.onDragging(t)}onMouseUp(t){this.onDragEnd(t)}onDragging(t){const e=this.draggingView;if(e){t.preventDefault();const n=this.normalizeEvent(t),i=n.clientX,o=n.clientY;this.updateGraphPosition(i,o);const r=this.updateNodePosition(i,o),a=this.targetGraph.options.embedding.enabled,l=(a||this.isSnaplineEnabled())&&this.isInsideValidArea({x:i,y:o});if(a){e.setEventData(n,{graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView});const c=e.getEventData(n);l?e.processEmbedding(n,c):e.clearEmbedding(c),this.candidateEmbedView=c.candidateEmbedView}this.isSnaplineEnabled()&&(l?this.snapline.snapOnMoving({e:n,view:e,x:r.x,y:r.y}):this.snapline.hide())}}onDragEnd(t){const e=this.draggingNode;if(e){const n=this.normalizeEvent(t),i=this.draggingView,o=this.draggingBBox,r=this.snapOffset;let a=o.x,l=o.y;r&&(a+=r.x,l+=r.y),e.position(a,l,{silent:!0});const c=this.drop(e,{x:n.clientX,y:n.clientY}),h=u=>{u?(this.onDropped(e),this.targetGraph.options.embedding.enabled&&i&&(i.setEventData(n,{cell:u,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),i.finalizeEmbedding(n,i.getEventData(n)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};uo(c)?(this.undelegateDocumentEvents(),c.then(h)):h(c)}}clearDragging(){this.draggingNode&&(this.sourceNode=null,this.draggingNode.remove(),this.draggingNode=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.undelegateDocumentEvents())}onDropped(t){this.draggingNode===t&&(this.clearDragging(),st(this.container,"dragging"),Vt(this.container))}onDropInvalid(){const t=this.draggingNode;t&&this.onDropped(t)}isInsideValidArea(t){let e,n=null;const i=this.targetGraph,o=this.targetScroller;this.options.dndContainer&&(n=this.getDropArea(this.options.dndContainer));const r=n==null?void 0:n.containsPoint(t);if(o)if(o.options.autoResize)e=this.getDropArea(o.container);else{const a=this.getDropArea(o.container);e=this.getDropArea(i.container).intersectsWithRect(a)}else e=this.getDropArea(i.container);return!r&&e&&e.containsPoint(t)}getDropArea(t){const e=yn(t),n=document.body.scrollTop||document.documentElement.scrollTop,i=document.body.scrollLeft||document.documentElement.scrollLeft;return P.create({x:e.left+parseInt($(t,"border-left-width"),10)-i,y:e.top+parseInt($(t,"border-top-width"),10)-n,width:t.clientWidth,height:t.clientHeight})}drop(t,e){if(this.isInsideValidArea(e)){const n=this.targetGraph,i=n.model,o=n.clientToLocal(e),r=this.sourceNode,a=this.options.getDropNode(t,{sourceNode:r,draggingNode:t,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),l=a.getBBox();o.x+=l.x-l.width/2,o.y+=l.y-l.height/2;const c=this.snapOffset?1:n.getGridSize();a.position(ne(o.x,c),ne(o.y,c)),a.removeZIndex();const h=this.options.validateNode,u=h?h(a,{sourceNode:r,draggingNode:t,droppingNode:a,targetGraph:n,draggingGraph:this.draggingGraph}):!0;return typeof u=="boolean"?u?(i.addCell(a,{stencil:this.cid}),a):null:Wy(u).then(d=>d?(i.addCell(a,{stencil:this.cid}),a):null)}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),Be(this.name)}}H([q()],vr.prototype,"dispose",null),S.prototype.toSVG=function(s,t){const e=this.getPlugin("export");e&&e.toSVG(s,t)},S.prototype.toSVGAsync=function(s){return Qs(this,void 0,void 0,function*(){return new Promise(t=>{this.toSVG(t,s)})})},S.prototype.toPNG=function(s,t){const e=this.getPlugin("export");e&&e.toPNG(s,t)},S.prototype.toPNGAsync=function(s){return Qs(this,void 0,void 0,function*(){return new Promise(t=>{this.toPNG(t,s)})})},S.prototype.toJPEG=function(s,t){const e=this.getPlugin("export");e&&e.toJPEG(s,t)},S.prototype.toJPEGAsync=function(s){return Qs(this,void 0,void 0,function*(){return new Promise(t=>{this.toJPEG(t,s)})})},S.prototype.exportPNG=function(s,t){const e=this.getPlugin("export");e&&e.exportPNG(s,t)},S.prototype.exportJPEG=function(s,t){const e=this.getPlugin("export");e&&e.exportJPEG(s,t)},S.prototype.exportSVG=function(s,t){const e=this.getPlugin("export");e&&e.exportSVG(s,t)};class bE extends Ot{constructor(){super(...arguments),this.name="export"}get view(){return this.graph.view}init(t){this.graph=t}exportPNG(t="chart",e={}){this.toPNG(n=>{ho(n,t)},e)}exportJPEG(t="chart",e={}){this.toJPEG(n=>{ho(n,t)},e)}exportSVG(t="chart",e={}){this.toSVG(n=>{ho(Hy(n),t)},e)}toSVG(t,e={}){this.notify("before:export",e),Object.hasOwn(e,"copyStyles")||(e.copyStyles=!0),Object.hasOwn(e,"serializeImages")||(e.serializeImages=!0);const n=this.view.svg,i=L.create(n).clone();let o=i.node;const r=i.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=e.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),l=e.preserveDimensions;if(l){const u=typeof l=="boolean"?a:l;i.attr({width:u.width,height:u.height})}if(i.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),r.removeAttribute("transform"),e.copyStyles){const u=n.ownerDocument,d=Array.from(n.querySelectorAll("*")),g=Array.from(o.querySelectorAll("*")),p=u.implementation.createHTMLDocument("x6-export-defaults"),m=p.importNode(n,!0);p.body.appendChild(m);const b=Array.from(m.querySelectorAll("*")),y={};b.forEach((w,x)=>{const E=window.getComputedStyle(w,null),B={};for(let v=0;v<E.length;v+=1){const M=E[v],I=E.getPropertyValue(M);B[M]=I}y[x]=B});const C={};d.forEach((w,x)=>{const E=window.getComputedStyle(w,null),B=y[x]||{},v={};for(let M=0;M<E.length;M+=1){const I=E[M],T=E.getPropertyValue(I);T!==B[I]&&(v[I]=T)}C[x]=v}),g.forEach((w,x)=>{$(w,C[x])})}const c=e.stylesheet;if(typeof c=="string"){const u=n.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(c);i.prepend(L.create("style",{type:"text/css"},[u]))}const h=()=>{const u=e.beforeSerialize;if(typeof u=="function"){const g=D(u,this.graph,o);g instanceof SVGSVGElement&&(o=g)}const d=new XMLSerializer().serializeToString(o).replace(/&nbsp;/g," ");this.notify("after:export",e),t(d)};if(e.serializeImages){const u=i.find("image").map(d=>new Promise(g=>{const p=d.attr("xlink:href")||d.attr("href");Vy(p,(m,b)=>{!m&&b&&(d.attr("xlink:href",b),d.attr("href",b)),g()})}));Promise.all(u).then(h)}else h()}toDataURL(t,e){let n=e.viewBox||this.graph.getContentBBox();const i=ee(e.padding);e.width&&e.height&&(i.left+i.right>=e.width&&(i.left=i.right=0),i.top+i.bottom>=e.height&&(i.top=i.bottom=0));const o=new P(-i.left,-i.top,i.left+i.right,i.top+i.bottom);if(e.width&&e.height){const h=n.width+i.left+i.right,u=n.height+i.top+i.bottom;o.scale(h/e.width,u/e.height)}n=P.create(n).moveAndExpand(o);const r=typeof e.width=="number"&&typeof e.height=="number"?{width:e.width,height:e.height}:n;let a=e.ratio?e.ratio:1;(!Number.isFinite(a)||a===0)&&(a=1);const l={width:Math.max(Math.round(r.width*a),1),height:Math.max(Math.round(r.height*a),1)};{const h=document.createElement("canvas"),u=h.getContext("2d");h.width=l.width,h.height=l.height;const d=l.width-1,g=l.height-1;u.fillStyle="rgb(1,1,1)",u.fillRect(d,g,1,1);const p=u.getImageData(d,g,1,1).data;if(p[0]!==1||p[1]!==1||p[2]!==1)throw new Error("size exceeded")}const c=new Image;c.onload=()=>{const h=document.createElement("canvas");h.width=l.width,h.height=l.height;const u=h.getContext("2d");u.fillStyle=e.backgroundColor||"white",u.fillRect(0,0,l.width,l.height);try{u.drawImage(c,0,0,l.width,l.height);const d=h.toDataURL(e.type,e.quality);t(d)}catch{}},this.toSVG(h=>{c.src=`data:image/svg+xml,${encodeURIComponent(h)}`},Object.assign(Object.assign({},e),{viewBox:n,serializeImages:!0,preserveDimensions:Object.assign({},l)}))}toPNG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/png"}))}toJPEG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/jpeg"}))}notify(t,e){this.trigger(t,e),this.graph.trigger(t,e)}dispose(){this.off()}}H([q()],bE.prototype,"dispose",null);function Le(s){return s==="cell:added"}function qe(s){return s==="cell:removed"}function vi(s){return s!=null&&s.startsWith("cell:change:")}function yE(s){const t=["cell:added","cell:removed","cell:change:*"],e=["batch:start","batch:stop"],n=s.eventNames?s.eventNames.filter(i=>!(vi(i)||t.includes(i)||e.includes(i))):t;return Object.assign(Object.assign({enabled:!0},s),{eventNames:n,applyOptionsList:s.applyOptionsList||["propertyPath"],revertOptionsList:s.revertOptionsList||["propertyPath"]})}function Vu(s){const t=[];for(let e=0,n=s.length;e<n;e+=1){const i=s[e];let o=null;if(Le(i.event)){const r=i.data.id;for(let a=0;a<e;a+=1)if(s[a].data.id===r){o=a;break}}o!==null?t.splice(o,0,i):t.push(i)}return t}class Gu extends Ot{constructor(t){super(),this.map={},this.command=t.history,this.cancelInvalid=t.cancelInvalid!==!1,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:t}){return Array.isArray(t)?t.every(e=>this.isValidCommand(e)):this.isValidCommand(t)}isValidCommand(t){if(t.options&&t.options.validation===!1)return!0;const e=t.event&&this.map[t.event]||[];let n=null;return e.forEach(i=>{let o=0;const r=a=>{const l=i[o];o+=1;try{l?l(a,t,r):n=a}catch(c){r(c)}};r(n)}),n?(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:n}),!1):!0}validate(t,...e){const n=Array.isArray(t)?t:t.split(/\s+/);return e.forEach(i=>{if(typeof i!="function")throw new Error(`${n.join(" ")} requires callback functions.`)}),n.forEach(i=>{this.map[i]==null&&(this.map[i]=[]),this.map[i].push(e)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}H([q()],Gu.prototype,"dispose",null),S.prototype.isHistoryEnabled=function(){const s=this.getPlugin("history");return s?s.isEnabled():!1},S.prototype.enableHistory=function(){const s=this.getPlugin("history");return s&&s.enable(),this},S.prototype.disableHistory=function(){const s=this.getPlugin("history");return s&&s.disable(),this},S.prototype.toggleHistory=function(s){const t=this.getPlugin("history");return t&&t.toggleEnabled(s),this},S.prototype.undo=function(s){const t=this.getPlugin("history");return t&&t.undo(s),this},S.prototype.redo=function(s){const t=this.getPlugin("history");return t&&t.redo(s),this},S.prototype.undoAndCancel=function(s){const t=this.getPlugin("history");return t&&t.cancel(s),this},S.prototype.canUndo=function(){const s=this.getPlugin("history");return s?s.canUndo():!1},S.prototype.canRedo=function(){const s=this.getPlugin("history");return s?s.canRedo():!1},S.prototype.cleanHistory=function(s){const t=this.getPlugin("history");return t&&t.clean(s),this},S.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()},S.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()},S.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()},S.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};class Yu extends Ot{constructor(t={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:e=0}=t;this.stackSize=e,this.options=yE(t),this.validator=new Gu({history:this,cancelInvalid:this.options.cancelInvalid})}init(t){this.graph=t,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack.push(e),this.notify("undo",e,t))}return this}redo(t={}){if(!this.disabled){const e=this.redoStack.pop();e&&(this.applyCommand(e,t),this.undoStackPush(e),this.notify("redo",e,t))}return this}cancel(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack=[],this.notify("cancel",e,t))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const t=this.undoStack.length;return this.stackSize-t}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(t={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,t),this}get disabled(){return this.options.enabled!==!0}validate(t,...e){return this.validator.validate(t,...e),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((t,e)=>{this.handlers[e]=this.addCommand.bind(this,t),this.model.on(t,this.handlers[e])}),this.validator.on("invalid",t=>this.trigger("invalid",t))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((t,e)=>{this.model.off(t,this.handlers[e])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(t){return{batch:t?t.batch:!1,data:{}}}revertCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?Vu(t):[t];for(let i=n.length-1;i>=0;i-=1){const o=n[i],r=Object.assign(Object.assign({},e),ml(o.options,this.options.revertOptionsList||[]));this.executeCommand(o,!0,r)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?Vu(t):[t];for(let i=0;i<n.length;i+=1){const o=n[i],r=Object.assign(Object.assign({},e),ml(o.options,this.options.applyOptionsList||[]));this.executeCommand(o,!1,r)}this.freezed=!1}executeCommand(t,e,n){const i=this.model,o=i.getCell(t.data.id),r=t.event;if(Le(r)&&e||qe(r)&&!e)o&&o.remove(n);else if(Le(r)&&!e||qe(r)&&e){const a=t.data;a.node?i.addNode(a.props,n):a.edge&&i.addEdge(a.props,n)}else if(vi(r)){const a=t.data,l=a.key;if(l&&o){const c=e?a.prev[l]:a.next[l];a.key==="attrs"&&this.ensureUndefinedAttrs(c,e?a.next[l]:a.prev[l])&&(n.dirty=!0),o.prop(l,c,n)}}else{const a=this.options.executeCommand;a&&D(a,this,t,e,n)}}addCommand(t,e){if(this.freezed||this.disabled)return;const n=e,i=n.options||{};if(i.dryrun||Le(t)&&this.options.ignoreAdd||qe(t)&&this.options.ignoreRemove||vi(t)&&this.options.ignoreChange)return;const o=this.options.beforeAddCommand;if(o!=null&&D(o,this,t,e)===!1)return;t==="cell:change:*"&&(t=`cell:change:${n.key}`);const r=n.cell,a=Ut.isModel(r);let l;if(this.batchCommands){l=this.batchCommands[Math.max(this.lastBatchIndex,0)];const h=a&&!l.modelChange||l.data.id!==r.id,u=l.event!==t;if(this.lastBatchIndex>=0&&(h||u)){const d=this.batchCommands.findIndex(g=>(a&&g.modelChange||g.data.id===r.id)&&g.event===t);d<0||Le(t)||qe(t)?l=this.createCommand({batch:!0}):(l=this.batchCommands[d],this.batchCommands.splice(d,1)),this.batchCommands.push(l),this.lastBatchIndex=this.batchCommands.length-1}}else l=this.createCommand({batch:!1});if(Le(t)||qe(t)){const h=l.data;return l.event=t,l.options=i,h.id=r.id,h.props=rt(r.toJSON()),r.isEdge()?h.edge=!0:r.isNode()&&(h.node=!0),this.push(l,i)}if(vi(t)){const h=e.key,u=l.data;return(!l.batch||!l.event)&&(l.event=t,l.options=i,u.key=h,u.prev==null&&(u.prev={}),u.prev[h]=rt(r.previous(h)),a?l.modelChange=!0:u.id=r.id),u.next==null&&(u.next={}),u.next[h]=rt(r.prop(h)),this.push(l,i)}const c=this.options.afterAddCommand;c&&D(c,this,t,e,l),this.push(l,i)}initBatchCommand(t){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(t){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const e=this.filterBatchCommand(this.batchCommands);e.length>0&&(this.redoStack=[],this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(t){let e=t.slice();const n=[];for(;e.length>0;){const i=e.shift(),o=i.event,r=i.data.id;if(o!=null&&(r!=null||i.modelChange)){if(Le(o)){const a=e.findIndex(l=>qe(l.event)&&l.data.id===r);if(a>=0){e=e.filter((l,c)=>a<c||l.data.id!==r);continue}}else if(qe(o)){const a=e.findIndex(l=>Le(l.event)&&l.data.id===r);if(a>=0){e.splice(a,1);continue}}else if(vi(o)){const a=i.data;if(me(a.prev,a.next))continue}n.push(i)}}return n}notify(t,e,n){const i=e==null?null:Array.isArray(e)?e:[e];this.emit(t,{cmds:i,options:n}),this.graph.trigger(`history:${t}`,{cmds:i,options:n}),this.emit("change",{cmds:i,options:n}),this.graph.trigger("history:change",{cmds:i,options:n})}push(t,e){this.redoStack=[],t.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:t,options:e})):(this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e))}consolidateCommands(){var t;const e=this.undoStack[this.undoStack.length-1],n=this.undoStack[this.undoStack.length-2];if(!Array.isArray(e))return;const i=new Set(e.map(r=>r.event));if(i.size!==2||!i.has("cell:change:parent")||!i.has("cell:change:children")||!e.every(r=>{var a;return r.batch&&((a=r.options)===null||a===void 0?void 0:a.ui)})||!Array.isArray(n)||n.length!==1)return;const o=n[0];o.event!=="cell:change:position"||!(!((t=o.options)===null||t===void 0)&&t.ui)||(n.push(...e),this.undoStack.pop())}undoStackPush(t){if(this.stackSize===0){this.undoStack.push(t);return}this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(t)}ensureUndefinedAttrs(t,e){let n=!1;return t!==null&&e!==null&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(i=>{t[i]===void 0&&e[i]!==void 0?(t[i]=void 0,n=!0):typeof t[i]=="object"&&typeof e[i]=="object"&&(n=this.ensureUndefinedAttrs(t[i],e[i]))}),n}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}H([q()],Yu.prototype,"dispose",null);function CE(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Hu={exports:{}};(function(s){(function(t,e,n){if(!t)return;for(var i={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},o={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},r={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},a={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l,c=1;c<20;++c)i[111+c]="f"+c;for(c=0;c<=9;++c)i[c+96]=c.toString();function h(v,M,I){if(v.addEventListener){v.addEventListener(M,I,!1);return}v.attachEvent("on"+M,I)}function u(v){if(v.type=="keypress"){var M=String.fromCharCode(v.which);return v.shiftKey||(M=M.toLowerCase()),M}return i[v.which]?i[v.which]:o[v.which]?o[v.which]:String.fromCharCode(v.which).toLowerCase()}function d(v,M){return v.sort().join(",")===M.sort().join(",")}function g(v){var M=[];return v.shiftKey&&M.push("shift"),v.altKey&&M.push("alt"),v.ctrlKey&&M.push("ctrl"),v.metaKey&&M.push("meta"),M}function p(v){if(v.preventDefault){v.preventDefault();return}v.returnValue=!1}function m(v){if(v.stopPropagation){v.stopPropagation();return}v.cancelBubble=!0}function b(v){return v=="shift"||v=="ctrl"||v=="alt"||v=="meta"}function y(){if(!l){l={};for(var v in i)v>95&&v<112||i.hasOwnProperty(v)&&(l[i[v]]=v)}return l}function C(v,M,I){return I||(I=y()[v]?"keydown":"keypress"),I=="keypress"&&M.length&&(I="keydown"),I}function w(v){return v==="+"?["+"]:(v=v.replace(/\+{2}/g,"+plus"),v.split("+"))}function x(v,M){var I,T,k,R=[];for(I=w(v),k=0;k<I.length;++k)T=I[k],a[T]&&(T=a[T]),M&&M!="keypress"&&r[T]&&(T=r[T],R.push("shift")),b(T)&&R.push(T);return M=C(T,R,M),{key:T,modifiers:R,action:M}}function E(v,M){return v===null||v===e?!1:v===M?!0:E(v.parentNode,M)}function B(v){var M=this;if(v=v||e,!(M instanceof B))return new B(v);M.target=v,M._callbacks={},M._directMap={};var I={},T,k=!1,R=!1,z=!1;function J(Q){Q=Q||{};var X=!1,tt;for(tt in I){if(Q[tt]){X=!0;continue}I[tt]=0}X||(z=!1)}function Z(Q,X,tt,j,et,mt){var W,bt,Ee=[],Qt=tt.type;if(!M._callbacks[Q])return[];for(Qt=="keyup"&&b(Q)&&(X=[Q]),W=0;W<M._callbacks[Q].length;++W)if(bt=M._callbacks[Q][W],!(!j&&bt.seq&&I[bt.seq]!=bt.level)&&Qt==bt.action&&(Qt=="keypress"&&!tt.metaKey&&!tt.ctrlKey||d(X,bt.modifiers))){var nM=!j&&bt.combo==et,iM=j&&bt.seq==j&&bt.level==mt;(nM||iM)&&M._callbacks[Q].splice(W,1),Ee.push(bt)}return Ee}function Y(Q,X,tt,j){M.stopCallback(X,X.target||X.srcElement,tt,j)||Q(X,tt)===!1&&(p(X),m(X))}M._handleKey=function(Q,X,tt){var j=Z(Q,X,tt),et,mt={},W=0,bt=!1;for(et=0;et<j.length;++et)j[et].seq&&(W=Math.max(W,j[et].level));for(et=0;et<j.length;++et){if(j[et].seq){if(j[et].level!=W)continue;bt=!0,mt[j[et].seq]=1,Y(j[et].callback,tt,j[et].combo,j[et].seq);continue}bt||Y(j[et].callback,tt,j[et].combo)}var Ee=tt.type=="keypress"&&R;tt.type==z&&!b(Q)&&!Ee&&J(mt),R=bt&&tt.type=="keydown"};function Et(Q){typeof Q.which!="number"&&(Q.which=Q.keyCode);var X=u(Q);if(X){if(Q.type=="keyup"&&k===X){k=!1;return}M.handleKey(X,g(Q),Q)}}function Rt(){clearTimeout(T),T=setTimeout(J,1e3)}function Dt(Q,X,tt,j){I[Q]=0;function et(Qt){return function(){z=Qt,++I[Q],Rt()}}function mt(Qt){Y(tt,Qt,Q),j!=="keyup"&&(k=u(Qt)),setTimeout(J,10)}for(var W=0;W<X.length;++W){var bt=W+1===X.length,Ee=bt?mt:et(j||x(X[W+1]).action);pt(X[W],Ee,j,Q,W)}}function pt(Q,X,tt,j,et){M._directMap[Q+":"+tt]=X,Q=Q.replace(/\s+/g," ");var mt=Q.split(" "),W;if(mt.length>1){Dt(Q,mt,X,tt);return}W=x(Q,tt),M._callbacks[W.key]=M._callbacks[W.key]||[],Z(W.key,W.modifiers,{type:W.action},j,Q,et),M._callbacks[W.key][j?"unshift":"push"]({callback:X,modifiers:W.modifiers,action:W.action,seq:j,level:et,combo:Q})}M._bindMultiple=function(Q,X,tt){for(var j=0;j<Q.length;++j)pt(Q[j],X,tt)},h(v,"keypress",Et),h(v,"keydown",Et),h(v,"keyup",Et)}B.prototype.bind=function(v,M,I){var T=this;return v=v instanceof Array?v:[v],T._bindMultiple.call(T,v,M,I),T},B.prototype.unbind=function(v,M){var I=this;return I.bind.call(I,v,function(){},M)},B.prototype.trigger=function(v,M){var I=this;return I._directMap[v+":"+M]&&I._directMap[v+":"+M]({},v),I},B.prototype.reset=function(){var v=this;return v._callbacks={},v._directMap={},v},B.prototype.stopCallback=function(v,M){var I=this;if((" "+M.className+" ").indexOf(" mousetrap ")>-1||E(M,I.target))return!1;if("composedPath"in v&&typeof v.composedPath=="function"){var T=v.composedPath()[0];T!==v.target&&(M=T)}return M.tagName=="INPUT"||M.tagName=="SELECT"||M.tagName=="TEXTAREA"||M.isContentEditable},B.prototype.handleKey=function(){var v=this;return v._handleKey.apply(v,arguments)},B.addKeycodes=function(v){for(var M in v)v.hasOwnProperty(M)&&(i[M]=v[M]);l=null},B.init=function(){var v=B(e);for(var M in v)M.charAt(0)!=="_"&&(B[M]=function(I){return function(){return v[I].apply(v,arguments)}}(M))},B.init(),t.Mousetrap=B,s.exports&&(s.exports=B)})(typeof window<"u"?window:null,typeof window<"u"?document:null)})(Hu);var AE=Hu.exports;const wE=CE(AE);function qu(s,t,e){const n=s.toLocaleLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command").replace("arrowup","up").replace("arrowright","right").replace("arrowdown","down").replace("arrowleft","left");return t?D(t,e,n):n}function Wu(s){var t;const e=s.target,n=(t=e==null?void 0:e.tagName)===null||t===void 0?void 0:t.toLowerCase();let i=["input","textarea"].includes(n);return V(e,"contenteditable")==="true"&&(i=!0),i}function xE(s,t,e){const n=s.target,i=s.currentTarget;return n?n===t||i===t||n===document.body?!0:Ao(e,n):!1}function vE(s){const t=new wE(s.target),e=t.stopCallback;return t.stopCallback=(n,i,o)=>s.isEnabledForEvent(n)?e?e.call(t,n,i,o):!1:!0,t}class Xu extends Cn{get graph(){return this.options.graph}constructor(t){super(),this.options=t;const e=this.graph.getPlugin("scroller");this.container=e?e.container:this.graph.container,t.global?this.target=document:(this.target=this.container,this.disabled||this.target.setAttribute("tabindex","-1"),this.graph.on("cell:mouseup",this.focus.bind(this),this),this.graph.on("blank:mouseup",this.focus.bind(this),this)),this.mousetrap=vE(this)}get disabled(){return this.options.enabled!==!0}enable(){this.disabled&&(this.options.enabled=!0,this.target instanceof HTMLElement&&this.target.setAttribute("tabindex","-1"))}disable(){this.disabled||(this.options.enabled=!1,this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))}on(t,e,n){this.mousetrap.bind(this.getKeys(t),e,n)}off(t,e){this.mousetrap.unbind(this.getKeys(t),e)}clear(){this.mousetrap.reset()}trigger(t,e){this.mousetrap.trigger(qu(t,this.options.format,this.graph),e)}focus(t){if(Wu(t.e))return;this.target.focus({preventScroll:!0})}getKeys(t){return(Array.isArray(t)?t:[t]).map(e=>qu(e,this.options.format,this.graph))}isEnabledForEvent(t){const e=!this.disabled&&xE(t,this.target,this.container),n=Wu(t);if(e){if(n&&(t.key==="Backspace"||t.key==="Delete"))return!1;if(this.options.guard)return D(this.options.guard,this.graph,t)}return e}dispose(){this.mousetrap.reset()}}H([q()],Xu.prototype,"dispose",null),S.prototype.isKeyboardEnabled=function(){const s=this.getPlugin("keyboard");return s?s.isEnabled():!1},S.prototype.enableKeyboard=function(){const s=this.getPlugin("keyboard");return s&&s.enable(),this},S.prototype.disableKeyboard=function(){const s=this.getPlugin("keyboard");return s&&s.disable(),this},S.prototype.toggleKeyboard=function(s){const t=this.getPlugin("keyboard");return t&&t.toggleEnabled(s),this},S.prototype.bindKey=function(s,t,e){const n=this.getPlugin("keyboard");return n&&n.bindKey(s,t,e),this},S.prototype.unbindKey=function(s,t){const e=this.getPlugin("keyboard");return e&&e.unbindKey(s,t),this},S.prototype.clearKeys=function(){const s=this.getPlugin("keyboard");return s&&s.clear(),this},S.prototype.triggerKey=function(s,t){const e=this.getPlugin("keyboard");return e&&e.trigger(s,t),this};class _u extends Cn{constructor(t={}){super(),this.name="keyboard",this.options=Object.assign({enabled:!0},t)}init(t){this.keyboardImpl=new Xu(Object.assign(Object.assign({},this.options),{graph:t}))}isEnabled(){return!this.keyboardImpl.disabled}enable(){this.keyboardImpl.enable()}disable(){this.keyboardImpl.disable()}toggleEnabled(t){return t===void 0&&(t=!this.isEnabled()),t?this.enable():this.disable(),this}bindKey(t,e,n){return this.keyboardImpl.on(t,e,n),this}trigger(t,e){return this.keyboardImpl.trigger(t,e),this}clear(){return this.keyboardImpl.clear(),this}unbindKey(t,e){return this.keyboardImpl.off(t,e),this}dispose(){this.keyboardImpl.dispose()}}H([q()],_u.prototype,"dispose",null);class $u extends Ft{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(oe.box)}get $boxes(){return uC(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(t){super(),this.updateThrottleTimer=null,this.isDragging=!1,this.batchUpdating=!1,this.dragRafId=null,this.transformRafId=null,this.dragPendingOffset=null,this.containerOffsetX=0,this.containerOffsetY=0,this.translatingCache=null,this.options=t,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new ar([],{comparator:EE}),this.options.collection=this.collection),this.boxCount=0,this.boxesUpdated=!1,this.createContainer(),this.startListening()}startListening(){const t=this.graph,e=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`mousedown .${this.prefixClassName(oe.inner)}`]:"onSelectionContainerMouseDown",[`touchstart .${this.prefixClassName(oe.inner)}`]:"onSelectionContainerMouseDown"},!0),t.on("scale",this.onGraphTransformed,this),t.on("translate",this.onGraphTransformed,this),t.model.on("updated",this.onModelUpdated,this),e.on("added",this.onCellAdded,this),e.on("removed",this.onCellRemoved,this),e.on("reseted",this.onReseted,this),e.on("updated",this.onCollectionUpdated,this),e.on("node:change:position",this.onNodePositionChanged,this),e.on("cell:changed",this.onCellChanged,this)}stopListening(){const t=this.graph,e=this.collection;this.undelegateEvents(),t.off("scale",this.onGraphTransformed,this),t.off("translate",this.onGraphTransformed,this),this.transformRafId!=null&&(cancelAnimationFrame(this.transformRafId),this.transformRafId=null),this.updateThrottleTimer&&(clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=null),t.model.off("updated",this.onModelUpdated,this),e.off("added",this.onCellAdded,this),e.off("removed",this.onCellRemoved,this),e.off("reseted",this.onReseted,this),e.off("updated",this.onCollectionUpdated,this),e.off("node:change:position",this.onNodePositionChanged,this),e.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateThrottleTimer&&(clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=null),this.transformRafId==null&&(this.transformRafId=window.requestAnimationFrame(()=>{this.transformRafId=null,!this.isDragging&&this.collection.length>0&&this.refreshSelectionBoxes()}))}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:t,options:e}){const{showNodeSelectionBox:n,pointerEvents:i}=this.options,{ui:o,selection:r,translateBy:a,snapped:l}=e,c=(n!==!0||i&&this.getPointerEventsValue(i)==="none")&&!this.translating&&!r,h=o&&a&&t.id===a;if(c&&(h||l)){this.translating=!0;const u=t.position(),d=t.previous("position");if(d){const g=u.x-d.x,p=u.y-d.y;(g!==0||p!==0)&&this.translateSelectedNodes(g,p,t,e)}this.translating=!1}}onModelUpdated({removed:t}){t!=null&&t.length&&this.unselect(t)}isEmpty(){return this.length<=0}isSelected(t){return this.collection.has(t)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(t,e={}){e.dryrun=!0;const n=this.filter(Array.isArray(t)?t:[t]);return this.collection.add(n,e),this}unselect(t,e={}){return e.dryrun=!0,this.collection.remove(Array.isArray(t)?t:[t],e),this}reset(t,e={}){if(t){this.batchUpdating=!!e.batch;const n=this.cells,i=this.filter(Array.isArray(t)?t:[t]),o={},r={};for(const c of n)o[c.id]=c;for(const c of i)r[c.id]=c;const a=[],l=[];return i.forEach(c=>{o[c.id]||a.push(c)}),n.forEach(c=>{r[c.id]||l.push(c)}),l.length&&this.unselect(l,Object.assign(Object.assign({},e),{ui:!0})),a.length&&this.select(a,Object.assign(Object.assign({},e),{ui:!0})),this.updateContainer(),this.batchUpdating=!1,this}return this.clean(e)}clean(t={}){return this.length&&this.unselect(this.cells,t),this.containerOffsetX=0,this.containerOffsetY=0,$(this.container,"transform",""),this}setFilter(t){this.options.filter=t}setContent(t){this.options.content=t}startSelecting(t){t=this.normalizeEvent(t),this.clean();let e,n;const i=this.graph.container;if(t.offsetX!=null&&t.offsetY!=null&&i.contains(t.target))e=t.offsetX,n=t.offsetY;else{const o=yn(i),r=i.scrollLeft,a=i.scrollTop;e=t.clientX-o.left+window.pageXOffset+r,n=t.clientY-o.top+window.pageYOffset+a}$(this.container,{top:n,left:e,width:1,height:1}),this.setEventData(t,{action:"selecting",clientX:t.clientX,clientY:t.clientY,offsetX:e,offsetY:n,scrollerX:0,scrollerY:0,moving:!1}),this.delegateDocumentEvents(Zu,t.data)}filter(t){const e=this.options.filter;return t.filter(n=>Array.isArray(e)?e.some(i=>typeof i=="string"?n.shape===i:n.id===i.id):typeof e=="function"?D(e,this.graph,n):!0)}stopSelecting(t){this.isDragging=!1,this.boxesUpdated=!1,this.updateThrottleTimer&&(clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=null);const e=this.graph;switch(this.getEventData(t).action){case"selecting":{let o=uA(this.container),r=dA(this.container);const a=yn(this.container),l=e.pageToLocal(a.left,a.top),c=e.transform.getScale();o/=c.sx,r/=c.sy;const h=new P(l.x,l.y,o,r),u=this.getCellViewsInArea(h).map(d=>d.cell);this.reset(u,{batch:!0}),this.hideRubberband();break}case"translating":{const o=e.snapToGrid(t.clientX,t.clientY);if(this.dragPendingOffset){const r=this.dragPendingOffset;this.dragPendingOffset=null,this.translateSelectedNodes(r.dx,r.dy),this.updateContainerPosition(r)}this.dragRafId!=null&&(cancelAnimationFrame(this.dragRafId),this.dragRafId=null),this.containerOffsetX=0,this.containerOffsetY=0,$(this.container,"transform",""),this.graph.model.stopBatch("move-selection"),this.translatingCache=null,this.notifyBoxEvent("box:mouseup",t,o.x,o.y),this.repositionSelectionBoxesInPlace();break}default:{this.clean();break}}this.undelegateDocumentEvents()}onMouseUp(t){const e=this.normalizeEvent(t);this.getEventData(e)&&this.stopSelecting(t)}onSelectionBoxMouseDown(t){this.handleSelectionMouseDown(t,!0)}onSelectionContainerMouseDown(t){this.handleSelectionMouseDown(t,!1)}handleSelectionMouseDown(t,e){var n;t.stopPropagation(),(n=t.preventDefault)===null||n===void 0||n.call(t);const i=this.normalizeEvent(t),o=this.graph.snapToGrid(i.clientX,i.clientY);if(!e&&Te(i,this.options.multipleSelectionModifiers)){const l=this.graph.findViewsFromPoint(o.x,o.y).find(c=>c.isNodeView());if(l){const c=l.cell;this.isSelected(c)?this.unselect(c,{ui:!0}):this.options.multiple===!1?this.reset(c,{ui:!0}):this.select(c,{ui:!0})}return}this.options.movable&&this.startTranslating(i);let r=e?this.getCellViewFromElem(i.target):null;if(!r&&(r=this.graph.findViewsFromPoint(o.x,o.y).filter(l=>this.isSelected(l.cell))[0]||null,!r)){const l=this.collection.first();l&&(r=this.graph.renderer.findViewByCell(l))}r&&(this.setEventData(i,{activeView:r}),e&&this.notifyBoxEvent("box:mousedown",i,o.x,o.y),this.delegateDocumentEvents(Zu,i.data))}startTranslating(t){this.graph.model.startBatch("move-selection");const e=this.graph.snapToGrid(t.clientX,t.clientY);this.setEventData(t,{action:"translating",clientX:e.x,clientY:e.y,originX:e.x,originY:e.y}),this.prepareTranslatingCache()}getRestrictArea(){const t=this.graph.options.translating.restrict,e=typeof t=="function"?D(t,this.graph,null):t;return typeof e=="number"?this.graph.transform.getGraphArea().inflate(e):e===!0?this.graph.transform.getGraphArea():e||null}prepareTranslatingCache(){const t=this.collection.toArray().filter(r=>r.isNode()),e=new Set(t.map(r=>r.id)),n=this.collection.toArray().filter(r=>r.isEdge()),i=new Set,o=r=>r.getVertices().length>0||!r.getSourceCellId()||!r.getTargetCellId();this.graph.model.getEdges().forEach(r=>{const a=r.getSourceCellId(),l=r.getTargetCellId();(a!=null&&e.has(a)||l!=null&&e.has(l))&&o(r)&&i.add(r)}),n.forEach(r=>{o(r)&&i.add(r)}),this.translatingCache={selectedNodes:t,nodeIdSet:e,edgesToTranslate:Array.from(i)}}getSelectionOffset(t,e){let n=t.x-e.clientX,i=t.y-e.clientY;const o=this.getRestrictArea();if(o){const r=this.collection.toArray(),a=G.getCellsBBox(r,{deep:!0})||P.create(),l=o.x-a.x,c=o.y-a.y,h=o.x+o.width-(a.x+a.width),u=o.y+o.height-(a.y+a.height);if(n<l&&(n=l),i<c&&(i=c),h<n&&(n=h),u<i&&(i=u),!this.options.following){const d=t.x-e.originX,g=t.y-e.originY;n=d<=l||d>=h?0:n,i=g<=c||g>=u?0:i}}return{dx:n,dy:i}}updateSelectedNodesPosition(t){t.dx===0&&t.dy===0||(this.dragPendingOffset?(this.dragPendingOffset.dx+=t.dx,this.dragPendingOffset.dy+=t.dy):this.dragPendingOffset={dx:t.dx,dy:t.dy},this.dragRafId==null&&(this.dragRafId=requestAnimationFrame(()=>{const e=this.dragPendingOffset||{dx:0,dy:0};this.dragPendingOffset=null,this.dragRafId=null,this.translateSelectedNodes(e.dx,e.dy),this.updateContainerPosition(e),this.boxesUpdated=!0,this.isDragging=!0})))}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");return n!=null&&n.autoScroll?n.autoScroll(t,e):{scrollerX:0,scrollerY:0}}adjustSelection(t){const e=this.normalizeEvent(t),n=this.getEventData(e);switch(n.action){case"selecting":{const o=n;o.moving!==!0&&(Gt(this.container,this.graph.container),this.showRubberband(),o.moving=!0);const{scrollerX:r,scrollerY:a}=this.autoScrollGraph(e.clientX,e.clientY);o.scrollerX+=r,o.scrollerY+=a;const l=e.clientX-o.clientX+o.scrollerX,c=e.clientY-o.clientY+o.scrollerY;$(this.container,{left:l<0?o.offsetX+l:o.offsetX,top:c<0?o.offsetY+c:o.offsetY,width:Math.abs(l),height:Math.abs(c)});break}case"translating":{this.isDragging=!0;const o=this.graph.snapToGrid(e.clientX,e.clientY),r=n,a=this.getSelectionOffset(o,r);this.options.following?this.updateSelectedNodesPosition(a):this.updateContainerPosition(a),a.dx&&(r.clientX=o.x),a.dy&&(r.clientY=o.y),this.notifyBoxEvent("box:mousemove",t,o.x,o.y);break}}this.boxesUpdated=!1}translateSelectedNodes(t,e,n,i){var o,r;const a={},l=[];if(n&&(a[n.id]=!0),this.collection.toArray().forEach(m=>{m.getDescendants({deep:!0}).forEach(b=>{a[b.id]=!0})}),i!=null&&i.translateBy){const m=this.graph.getCellById(i.translateBy);m&&(a[m.id]=!0,m.getDescendants({deep:!0}).forEach(b=>{a[b.id]=!0}),l.push(m))}const c=Object.assign(Object.assign({},i),{selection:this.cid,exclude:l}),h=(o=this.translatingCache)===null||o===void 0?void 0:o.selectedNodes,u=(h??this.collection.toArray().filter(m=>m.isNode())).filter(m=>!a[m.id]);u.forEach(m=>{m.translate(t,e,c)});const d=(r=this.translatingCache)===null||r===void 0?void 0:r.edgesToTranslate,g=new Set;if(d)d.forEach(m=>{g.add(m)});else{const m=new Set(u.map(b=>b.id));this.graph.model.getEdges().forEach(b=>{const y=b.getSourceCellId(),C=b.getTargetCellId(),w=y?m.has(y):!1,x=C?m.has(C):!1;(w||x)&&(b.getVertices().length>0||(!y||!C))&&g.add(b)})}this.collection.toArray().filter(m=>m.isEdge()&&!a[m.id]).forEach(m=>{const b=m.getVertices().length>0,y=!m.getSourceCellId()||!m.getTargetCellId();(b||y)&&g.add(m)}),g.forEach(m=>{m.translate(t,e,c)})}getCellViewsInArea(t){const e=this.graph,n={strict:this.options.strict};let i=[];return this.options.rubberNode&&(i=i.concat(e.model.getNodesInArea(t,n).map(o=>e.renderer.findViewByCell(o)).filter(o=>o!=null))),this.options.rubberEdge&&(i=i.concat(e.model.getEdgesInArea(t,n).map(o=>e.renderer.findViewByCell(o)).filter(o=>o!=null))),i}notifyBoxEvent(t,e,n,i){const r=this.getEventData(e).activeView;this.trigger(t,{e,view:r,x:n,y:i,cell:r.cell})}getSelectedClassName(t){return this.prefixClassName(`${t.isNode()?"node":"edge"}-selected`)}addCellSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.addClass(this.getSelectedClassName(t))}removeCellUnSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.removeClass(this.getSelectedClassName(t))}destroySelectionBox(t){this.removeCellUnSelectedClassName(t),this.canShowSelectionBox(t)&&(Vt(this.container.querySelector(`[data-cell-id="${t.id}"]`)),this.$boxes.length===0&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(t){t.forEach(e=>{this.removeCellUnSelectedClassName(e)}),this.hide(),Vt(this.$boxes),this.boxCount=0}hide(){st(this.container,this.prefixClassName(oe.rubberband)),st(this.container,this.prefixClassName(oe.selected))}showRubberband(){O(this.container,this.prefixClassName(oe.rubberband))}hideRubberband(){st(this.container,this.prefixClassName(oe.rubberband))}showSelected(){xo(this.container,"style"),O(this.container,this.prefixClassName(oe.selected))}createContainer(){this.container=document.createElement("div"),O(this.container,this.prefixClassName(oe.root)),this.options.className&&O(this.container,this.options.className),$(this.container,{willChange:"transform"}),this.selectionContainer=document.createElement("div"),O(this.selectionContainer,this.prefixClassName(oe.inner)),this.selectionContent=document.createElement("div"),O(this.selectionContent,this.prefixClassName(oe.content)),Mt(this.selectionContainer,this.selectionContent),V(this.selectionContainer,"data-selection-length",this.collection.length),jl(this.container,this.selectionContainer)}updateContainerPosition(t){if(t.dx||t.dy){const e=this.graph.transform.getScale();this.containerOffsetX+=t.dx*e.sx,this.containerOffsetY+=t.dy*e.sy,$(this.container,"transform",`translate3d(${this.containerOffsetX}px, ${this.containerOffsetY}px, 0)`)}}updateContainer(){const t={x:1/0,y:1/0},e={x:0,y:0};this.collection.toArray().filter(o=>this.canShowSelectionBox(o)).forEach(o=>{const r=this.graph.renderer.findViewByCell(o);if(r){const a=r.getBBox({useCellGeometry:!0});t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),e.x=Math.max(e.x,a.x+a.width),e.y=Math.max(e.y,a.y+a.height)}}),$(this.selectionContainer,{position:"absolute",pointerEvents:this.options.movable?"auto":"none",cursor:this.options.movable?"move":"default",left:t.x,top:t.y,width:e.x-t.x,height:e.y-t.y}),V(this.selectionContainer,"data-selection-length",this.collection.length);const i=this.options.content;if(i)if(typeof i=="function"){const o=D(i,this.graph,this,this.selectionContent);o&&(this.selectionContent.innerHTML=o)}else this.selectionContent.innerHTML=i;this.collection.length>0&&!this.container.parentNode?Gt(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(t){return t.isNode()&&this.options.showNodeSelectionBox===!0||t.isEdge()&&this.options.showEdgeSelectionBox===!0}getPointerEventsValue(t){return typeof t=="string"?t:t(this.cells)}createSelectionBox(t){if(this.addCellSelectedClassName(t),this.canShowSelectionBox(t)){const e=this.graph.renderer.findViewByCell(t);if(e){const n=e.getBBox({useCellGeometry:!0}),i=this.boxClassName,o=document.createElement("div"),r=this.options.pointerEvents;O(o,i),O(o,`${i}-${t.isNode()?"node":"edge"}`),V(o,"data-cell-id",t.id),$(o,{position:"absolute",left:n.x,top:n.y,width:n.width,height:n.height,pointerEvents:r?this.getPointerEventsValue(r):"auto"}),Gt(o,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){if(this.collection.length>0){if(this.isDragging)return;this.updateThrottleTimer&&clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=setTimeout(()=>{this.refreshSelectionBoxes(),this.updateThrottleTimer=null},16)}}refreshSelectionBoxes(){Vt(this.$boxes),this.boxCount=0,this.collection.toArray().forEach(t=>{this.createSelectionBox(t)}),this.updateContainer(),this.boxesUpdated=!0}repositionSelectionBoxesInPlace(){const t=this.$boxes;if(t.length===0){this.refreshSelectionBoxes();return}for(const e of t){const n=e.getAttribute("data-cell-id");if(!n)continue;const i=this.collection.get(n);if(!i)continue;const o=this.graph.renderer.findViewByCell(i);if(!o)continue;const r=o.getBBox({useCellGeometry:!0});$(e,{left:r.x,top:r.y,width:r.width,height:r.height})}this.updateContainer(),this.boxesUpdated=!0}getCellViewFromElem(t){const e=t.getAttribute("data-cell-id");if(e){const n=this.collection.get(e);if(n)return this.graph.renderer.findViewByCell(n)}return null}onCellRemoved({cell:t}){this.destroySelectionBox(t),this.batchUpdating||this.updateContainer()}onReseted({previous:t,current:e}){this.destroyAllSelectionBoxes(t),e.forEach(n=>{this.listenCellRemoveEvent(n),this.createSelectionBox(n)}),this.updateContainer()}onCellAdded({cell:t}){this.listenCellRemoveEvent(t),this.createSelectionBox(t),this.batchUpdating||this.updateContainer()}listenCellRemoveEvent(t){t.off("removed",this.onCellRemoved,this),t.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:t,removed:e,options:n}){t.forEach(o=>{this.trigger("cell:selected",{cell:o,options:n}),o.isNode()?this.trigger("node:selected",{cell:o,options:n,node:o}):o.isEdge()&&this.trigger("edge:selected",{cell:o,options:n,edge:o})}),e.forEach(o=>{this.trigger("cell:unselected",{cell:o,options:n}),o.isNode()?this.trigger("node:unselected",{cell:o,options:n,node:o}):o.isEdge()&&this.trigger("edge:unselected",{cell:o,options:n,edge:o})});const i={added:t,removed:e,options:n,selected:this.cells.filter(o=>!!this.graph.getCellById(o.id))};this.trigger("selection:changed",i)}dispose(){this.clean(),this.remove(),this.off()}}H([q()],$u.prototype,"dispose",null);const Sn="widget-selection",oe={root:Sn,inner:`${Sn}-inner`,box:`${Sn}-box`,content:`${Sn}-content`,rubberband:`${Sn}-rubberband`,selected:`${Sn}-selected`},Zu={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"};function EE(s){return s.getAncestors().length}const SE=`.x6-widget-selection {
266
+ position: absolute;
267
+ top: 0;
268
+ left: 0;
269
+ display: none;
270
+ width: 0;
271
+ height: 0;
272
+ touch-action: none;
273
+ }
274
+ .x6-widget-selection-rubberband {
275
+ display: block;
276
+ overflow: visible;
277
+ opacity: 0.3;
278
+ }
279
+ .x6-widget-selection-selected {
280
+ display: block;
281
+ }
282
+ .x6-widget-selection-box {
283
+ cursor: move;
284
+ }
285
+ .x6-widget-selection-inner[data-selection-length='0'],
286
+ .x6-widget-selection-inner[data-selection-length='1'] {
287
+ display: none;
288
+ }
289
+ .x6-widget-selection-content {
290
+ position: absolute;
291
+ top: 100%;
292
+ right: -20px;
293
+ left: -20px;
294
+ margin-top: 30px;
295
+ padding: 6px;
296
+ line-height: 14px;
297
+ text-align: center;
298
+ border-radius: 6px;
299
+ }
300
+ .x6-widget-selection-content:empty {
301
+ display: none;
302
+ }
303
+ .x6-widget-selection-rubberband {
304
+ background-color: #3498db;
305
+ border: 2px solid #2980b9;
306
+ }
307
+ .x6-widget-selection-box {
308
+ box-sizing: content-box !important;
309
+ margin-top: -4px;
310
+ margin-left: -4px;
311
+ padding-right: 4px;
312
+ padding-bottom: 4px;
313
+ border: 2px dashed #feb663;
314
+ box-shadow: 2px 2px 5px #d3d3d3;
315
+ }
316
+ .x6-widget-selection-inner {
317
+ box-sizing: content-box !important;
318
+ margin-top: -8px;
319
+ margin-left: -8px;
320
+ padding-right: 12px;
321
+ padding-bottom: 12px;
322
+ border: 2px solid #feb663;
323
+ box-shadow: 2px 2px 5px #d3d3d3;
324
+ }
325
+ .x6-widget-selection-content {
326
+ color: #fff;
327
+ font-size: 10px;
328
+ background-color: #6a6b8a;
329
+ }
330
+ `;S.prototype.isSelectionEnabled=function(){const s=this.getPlugin("selection");return s?s.isEnabled():!1},S.prototype.enableSelection=function(){const s=this.getPlugin("selection");return s&&s.enable(),this},S.prototype.disableSelection=function(){const s=this.getPlugin("selection");return s&&s.disable(),this},S.prototype.toggleSelection=function(s){const t=this.getPlugin("selection");return t&&t.toggleEnabled(s),this},S.prototype.isMultipleSelection=function(){const s=this.getPlugin("selection");return s?s.isMultipleSelection():!1},S.prototype.enableMultipleSelection=function(){const s=this.getPlugin("selection");return s&&s.enableMultipleSelection(),this},S.prototype.disableMultipleSelection=function(){const s=this.getPlugin("selection");return s&&s.disableMultipleSelection(),this},S.prototype.toggleMultipleSelection=function(s){const t=this.getPlugin("selection");return t&&t.toggleMultipleSelection(s),this},S.prototype.isSelectionMovable=function(){const s=this.getPlugin("selection");return s?s.isSelectionMovable():!1},S.prototype.enableSelectionMovable=function(){const s=this.getPlugin("selection");return s&&s.enableSelectionMovable(),this},S.prototype.disableSelectionMovable=function(){const s=this.getPlugin("selection");return s&&s.disableSelectionMovable(),this},S.prototype.toggleSelectionMovable=function(s){const t=this.getPlugin("selection");return t&&t.toggleSelectionMovable(s),this},S.prototype.isRubberbandEnabled=function(){const s=this.getPlugin("selection");return s?s.isRubberbandEnabled():!1},S.prototype.enableRubberband=function(){const s=this.getPlugin("selection");return s&&s.enableRubberband(),this},S.prototype.disableRubberband=function(){const s=this.getPlugin("selection");return s&&s.disableRubberband(),this},S.prototype.toggleRubberband=function(s){const t=this.getPlugin("selection");return t&&t.toggleRubberband(s),this},S.prototype.isStrictRubberband=function(){const s=this.getPlugin("selection");return s?s.isStrictRubberband():!1},S.prototype.enableStrictRubberband=function(){const s=this.getPlugin("selection");return s&&s.enableStrictRubberband(),this},S.prototype.disableStrictRubberband=function(){const s=this.getPlugin("selection");return s&&s.disableStrictRubberband(),this},S.prototype.toggleStrictRubberband=function(s){const t=this.getPlugin("selection");return t&&t.toggleStrictRubberband(s),this},S.prototype.setRubberbandModifiers=function(s){const t=this.getPlugin("selection");return t&&t.setRubberbandModifiers(s),this},S.prototype.setSelectionFilter=function(s){const t=this.getPlugin("selection");return t&&t.setSelectionFilter(s),this},S.prototype.setSelectionDisplayContent=function(s){const t=this.getPlugin("selection");return t&&t.setSelectionDisplayContent(s),this},S.prototype.isSelectionEmpty=function(){const s=this.getPlugin("selection");return s?s.isEmpty():!0},S.prototype.cleanSelection=function(s){const t=this.getPlugin("selection");return t&&t.clean(s),this},S.prototype.resetSelection=function(s,t){const e=this.getPlugin("selection");return e&&e.reset(s,t),this},S.prototype.getSelectedCells=function(){const s=this.getPlugin("selection");return s?s.getSelectedCells():[]},S.prototype.getSelectedCellCount=function(){const s=this.getPlugin("selection");return s?s.getSelectedCellCount():0},S.prototype.isSelected=function(s){const t=this.getPlugin("selection");return t?t.isSelected(s):!1},S.prototype.select=function(s,t){const e=this.getPlugin("selection");return e&&e.select(s,t),this},S.prototype.unselect=function(s,t){const e=this.getPlugin("selection");return e&&e.unselect(s,t),this};const ME={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]};class td extends Ot{get rubberbandDisabled(){return this.options.enabled!==!0||this.options.rubberband!==!0}get disabled(){return this.options.enabled!==!0}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(t={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},ME),t),Me(this.name,SE)}init(t){this.graph=t,this.selectionImpl=new $u(Object.assign(Object.assign({},this.options),{graph:t})),this.resolvePanningSelectionConflict(),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(t){return t!=null?t!==this.isMultipleSelection()&&(t?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return this.options.movable!==!1}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(t){return t!=null?t!==this.isSelectionMovable()&&(t?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(t){return t!=null?t!==this.isRubberbandEnabled()&&(t?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return this.selectionImpl.options.strict===!0}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(t){return t!=null?t!==this.isStrictRubberband()&&(t?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(t){this.setModifiers(t)}setSelectionFilter(t){return this.setFilter(t),this}setSelectionDisplayContent(t){return this.setContent(t),this}isEmpty(){return this.length<=0}clean(t={}){return this.selectionImpl.clean(t),this}reset(t,e={}){return this.selectionImpl.reset(t?this.getCells(t):[],e),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(t){return this.selectionImpl.isSelected(t)}select(t,e={}){const n=this.getCells(t);return n.length&&(this.isMultiple()?this.selectionImpl.select(n,e):this.reset(n.slice(0,1),e)),this}unselect(t,e={}){return this.selectionImpl.unselect(this.getCells(t),e),this}setup(){this.selectionImpl.on("*",(t,e)=>{this.trigger(t,e),this.graph.trigger(t,e)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.panning.allowPanning(t,!0),n=this.graph.getPlugin("scroller"),i=n&&n.allowPanning(t,!0);(this.allowRubberband(t,!0)||this.allowRubberband(t)&&!i&&!e)&&this.startRubberband(t)}allowBlankMouseDown(t){const e=this.options.eventTypes;return typeof t.type=="string"&&t.type.startsWith("touch")||t.pointerType==="touch"?e==null?void 0:e.includes("leftMouseDown"):(e==null?void 0:e.includes("leftMouseDown"))&&t.button===0||(e==null?void 0:e.includes("mouseWheelDown"))&&t.button===1}onBlankClick(){this.clean()}allowRubberband(t,e){const n=t??{altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1};return!this.rubberbandDisabled&&Te(n,this.options.modifiers,e)}resolvePanningSelectionConflict(){if(this.options.enabled!==!0||this.options.rubberband!==!0)return;const t=this.graph.options.panning;if(!t||t.enabled===!1)return;(()=>{var n,i;const o=(n=this.options.eventTypes)!==null&&n!==void 0?n:[],r=(i=t.eventTypes)!==null&&i!==void 0?i:[],a=new Set(r),l=o.some(h=>a.has(h)),c=sw(t.modifiers,this.options.modifiers);return l&&c})()&&this.graph.panning.disablePanning()}allowMultipleSelection(t){return this.isMultiple()&&Te(t,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:t}){this.movedMap.set(t,!0)}onCellMouseUp({e:t,cell:e}){const n=this.options;let i=this.disabled;!i&&this.movedMap.has(e)&&(i=n.selectCellOnMoved===!1,i||(i=n.selectNodeOnMoved===!1&&e.isNode()),i||(i=n.selectEdgeOnMoved===!1&&e.isEdge())),i||(this.allowMultipleSelection(t)?this.unselectMap.has(e)?this.unselectMap.delete(e):this.isSelected(e)?this.unselect(e):this.select(e):this.reset(e)),this.movedMap.delete(e)}onBoxMouseDown({e:t,cell:e}){this.disabled||this.allowMultipleSelection(t)&&(this.unselect(e),this.unselectMap.set(e,!0))}getCells(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?this.graph.getCellById(e):e).filter(e=>e!=null)}startRubberband(t){return this.rubberbandDisabled||this.selectionImpl.startSelecting(t),this}isMultiple(){return this.options.multiple!==!1}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(t){return this.options.modifiers=t,this}setContent(t){return this.selectionImpl.setContent(t),this}setFilter(t){return this.selectionImpl.setFilter(t),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),Be(this.name)}}H([q()],td.prototype,"dispose",null);const BE=`.x6-widget-minimap {
331
+ position: relative;
332
+ display: table-cell;
333
+ box-sizing: border-box;
334
+ overflow: hidden;
335
+ text-align: center;
336
+ vertical-align: middle;
337
+ background-color: #fff;
338
+ user-select: none;
339
+ }
340
+ .x6-widget-minimap .x6-graph {
341
+ display: inline-block;
342
+ box-shadow: 0 0 4px 0 #eee;
343
+ cursor: pointer;
344
+ }
345
+ .x6-widget-minimap .x6-graph > svg {
346
+ pointer-events: none;
347
+ shape-rendering: optimizespeed;
348
+ }
349
+ .x6-widget-minimap .x6-graph .x6-node * {
350
+ /* stylelint-disable-next-line */
351
+ vector-effect: initial;
352
+ }
353
+ .x6-widget-minimap-viewport {
354
+ position: absolute;
355
+ box-sizing: content-box !important;
356
+ margin: -2px 0 0 -2px;
357
+ border: 2px solid #31d0c6;
358
+ cursor: move;
359
+ }
360
+ .x6-widget-minimap-viewport-zoom {
361
+ position: absolute;
362
+ right: 0;
363
+ bottom: 0;
364
+ box-sizing: border-box;
365
+ width: 12px;
366
+ height: 12px;
367
+ margin: 0 -6px -6px 0;
368
+ background-color: #fff;
369
+ border: 2px solid #31d0c6;
370
+ border-radius: 50%;
371
+ cursor: nwse-resize;
372
+ }
373
+ `,IE={width:300,height:200,padding:10,scalable:!0,minScale:.01,maxScale:16,graphOptions:{},createGraph:s=>new S(s)},PE={mousemove:"doAction",touchmove:"doAction",mouseup:"stopAction",touchend:"stopAction"},ed="widget-minimap",nd=`${ed}-viewport`,TE=`${nd}-zoom`;class kE extends Ft{get scroller(){return this.graph.getPlugin("scroller")}get graphContainer(){return this.scroller?this.scroller.container:this.graph.container}constructor(t){super(),this.name="minimap",this.options=Object.assign(Object.assign({},IE),t),Me(this.name,BE)}init(t){this.graph=t,this.updateViewport=ji(this.updateViewport.bind(this),0),this.container=document.createElement("div"),O(this.container,this.prefixClassName(ed));const e=document.createElement("div");this.container.appendChild(e),this.viewport=document.createElement("div"),O(this.viewport,this.prefixClassName(nd)),this.options.scalable&&(this.zoomHandle=document.createElement("div"),O(this.zoomHandle,this.prefixClassName(TE)),Gt(this.zoomHandle,this.viewport)),Mt(this.container,this.viewport),$(this.container,{width:this.options.width,height:this.options.height,padding:this.options.padding}),this.options.container&&this.options.container.appendChild(this.container),this.sourceGraph=this.graph;const n=Object.assign(Object.assign({},this.options.graphOptions),{container:e,model:this.sourceGraph.model,interacting:!1,grid:!1,background:!1,embedding:!1,panning:!1});this.targetGraph=this.options.createGraph?this.options.createGraph(n):new S(n),this.updatePaper(this.sourceGraph.options.width,this.sourceGraph.options.height),this.startListening()}startListening(){this.scroller?nt.on(this.graphContainer,`scroll${this.getEventNamespace()}`,this.updateViewport):(this.sourceGraph.on("translate",this.onTransform,this),this.sourceGraph.on("scale",this.onTransform,this),this.sourceGraph.on("model:updated",this.onModelUpdated,this)),this.sourceGraph.on("resize",this.updatePaper,this),this.delegateEvents({mousedown:"startAction",touchstart:"startAction",[`mousedown .${this.prefixClassName("graph")}`]:"scrollTo",[`touchstart .${this.prefixClassName("graph")}`]:"scrollTo"})}stopListening(){this.scroller?nt.off(this.graphContainer,this.getEventNamespace()):(this.sourceGraph.off("translate",this.onTransform,this),this.sourceGraph.off("scale",this.onTransform,this),this.sourceGraph.off("model:updated",this.onModelUpdated,this)),this.sourceGraph.off("resize",this.updatePaper,this),this.undelegateEvents()}onRemove(){this.stopListening(),this.targetGraph.dispose(!1)}onTransform(t){(t.ui||this.targetGraphTransforming||!this.scroller)&&this.updateViewport()}onModelUpdated(){this.targetGraph.zoomToFit()}updatePaper(t,e){let n,i;typeof t=="object"?(n=t.width,i=t.height):(n=t,i=e);const o=this.sourceGraph.options,r=this.sourceGraph.transform.getScale(),a=this.options.width-2*this.options.padding,l=this.options.height-2*this.options.padding;n/=r.sx,i/=r.sy,this.ratio=Math.min(a/n,l/i);const c=this.ratio,h=o.x*c/r.sx,u=o.y*c/r.sy;return n*=c,i*=c,this.targetGraph.resize(n,i),this.targetGraph.translate(h,u),this.scroller?this.targetGraph.scale(c,c):this.targetGraph.zoomToFit(),this.updateViewport(),this}updateViewport(){const t=this.sourceGraph.transform.getScale(),e=this.targetGraph.transform.getScale(),n=this.scroller?this.scroller.clientToLocalPoint(0,0):this.graph.graphToLocal(0,0),i=gA(this.targetGraph.container),o=this.targetGraph.translate();o.ty=o.ty||0,this.geometry={top:i.top+n.y*e.sy+o.ty,left:i.left+n.x*e.sx+o.tx,width:this.graphContainer.clientWidth*e.sx/t.sx,height:this.graphContainer.clientHeight*e.sy/t.sy},$(this.viewport,this.geometry)}startAction(t){const e=this.normalizeEvent(t),n=e.target===this.zoomHandle?"zooming":"panning",{tx:i,ty:o}=this.sourceGraph.translate(),r={action:n,clientX:e.clientX,clientY:e.clientY,scrollLeft:this.graphContainer.scrollLeft,scrollTop:this.graphContainer.scrollTop,zoom:this.sourceGraph.zoom(),scale:this.sourceGraph.transform.getScale(),geometry:this.geometry,translateX:i,translateY:o};this.targetGraphTransforming=!0,this.delegateDocumentEvents(PE,r)}doAction(t){const e=this.normalizeEvent(t),n=e.clientX,i=e.clientY,o=e.data;switch(o.action){case"panning":{const r=this.sourceGraph.transform.getScale(),a=(n-o.clientX)*r.sx,l=(i-o.clientY)*r.sy;this.scroller?(this.graphContainer.scrollLeft=o.scrollLeft+a/this.ratio,this.graphContainer.scrollTop=o.scrollTop+l/this.ratio):this.sourceGraph.translate(o.translateX-a/this.ratio,o.translateY-l/this.ratio);break}case"zooming":{const r=o.scale,a=o.geometry,l=1+(o.clientX-n)/a.width/r.sx;o.frameId&&cancelAnimationFrame(o.frameId),o.frameId=requestAnimationFrame(()=>{this.sourceGraph.zoom(l*o.zoom,{absolute:!0,minScale:this.options.minScale,maxScale:this.options.maxScale})});break}}}stopAction(){this.undelegateDocumentEvents(),this.targetGraphTransforming=!1}scrollTo(t){const e=this.normalizeEvent(t);let n,i;const o=this.targetGraph.translate();if(o.ty=o.ty||0,e.offsetX==null){const l=yn(this.targetGraph.container);n=e.pageX-l.left,i=e.pageY-l.top}else n=e.offsetX,i=e.offsetY;const r=(n-o.tx)/this.ratio,a=(i-o.ty)/this.ratio;this.sourceGraph.centerPoint(r,a)}dispose(){this.remove(),Be(this.name)}}H([q()],kE.prototype,"dispose",null);const Ts="graph-scroller",OE=`${Ts}-paged`,NE=`${Ts}-content`,RE=`${Ts}-background`,id="transition-in-progress",Er="transitionend.graph-scroller-transition",DE={padding(){const s=this.getClientSize(),t=Math.max(this.options.minVisibleWidth||0,1)||1,e=Math.max(this.options.minVisibleHeight||0,1)||1,n=Math.max(s.width-t,0),i=Math.max(s.height-e,0);return{left:n,top:i,right:n,bottom:i}},minVisibleWidth:50,minVisibleHeight:50,pageVisible:!1,pageBreak:!1,autoResize:!0};function sd(s){const t=ct({},DE,s);t.pageWidth==null&&(t.pageWidth=s.graph.options.width),t.pageHeight==null&&(t.pageHeight=s.graph.options.height);const e=s.graph.options;return e.background&&t.enabled&&t.background==null&&(t.background=e.background,s.graph.background.clear()),t}class od extends Ft{get graph(){return this.options.graph}get model(){return this.graph.model}constructor(t){super(),this.padding={left:0,top:0,right:0,bottom:0},this.options=sd(t),this.onUpdate=ji(this.onUpdate,200);const e=this.graph.transform.getScale();this.sx=e.sx,this.sy=e.sy;const n=this.options.width||this.graph.options.width,i=this.options.height||this.graph.options.height;this.container=document.createElement("div"),O(this.container,this.prefixClassName(Ts)),$(this.container,{width:n,height:i}),this.options.pageVisible&&O(this.container,this.prefixClassName(OE)),this.options.className&&O(this.container,this.options.className);const o=this.graph.container;o.parentNode&&Jn(o,this.container),this.content=document.createElement("div"),O(this.content,this.prefixClassName(NE)),$(this.content,{width:this.graph.options.width,height:this.graph.options.height}),this.background=document.createElement("div"),O(this.background,this.prefixClassName(RE)),Mt(this.content,this.background),this.options.pageVisible||Mt(this.content,this.graph.view.grid),Mt(this.content,o),Gt(this.content,this.container),this.startListening(),this.options.pageVisible||this.graph.grid.update(),this.backgroundManager=new QE(this),this.options.autoResize||this.update()}startListening(){const t=this.graph,e=this.model;t.on("scale",this.onScale,this),t.on("resize",this.onResize,this),t.on("before:print",this.storeScrollPosition,this),t.on("before:export",this.storeScrollPosition,this),t.on("after:print",this.restoreScrollPosition,this),t.on("after:export",this.restoreScrollPosition,this),e.on("reseted",this.onUpdate,this),e.on("cell:added",this.onUpdate,this),e.on("cell:removed",this.onUpdate,this),e.on("cell:changed",this.onUpdate,this),this.delegateBackgroundEvents()}stopListening(){const t=this.graph,e=this.model;t.off("scale",this.onScale,this),t.off("resize",this.onResize,this),t.off("beforeprint",this.storeScrollPosition,this),t.off("beforeexport",this.storeScrollPosition,this),t.off("afterprint",this.restoreScrollPosition,this),t.off("afterexport",this.restoreScrollPosition,this),e.off("reseted",this.onUpdate,this),e.off("cell:added",this.onUpdate,this),e.off("cell:removed",this.onUpdate,this),e.off("cell:changed",this.onUpdate,this),this.undelegateBackgroundEvents()}enableAutoResize(){this.options.autoResize=!0}disableAutoResize(){this.options.autoResize=!1}onUpdate(){this.options.autoResize&&this.update()}delegateBackgroundEvents(t){const e=t||ve.events;this.delegatedHandlers=Object.keys(e).reduce((n,i)=>{const o=e[i];if(i.indexOf(" ")===-1)if(typeof o=="function")n[i]=o;else{let r=this.graph.view[o];typeof r=="function"&&(r=r.bind(this.graph.view),n[i]=r)}return n},{}),this.onBackgroundEvent=this.onBackgroundEvent.bind(this),Object.keys(this.delegatedHandlers).forEach(n=>{this.delegateEvent(n,{guarded:!1},this.onBackgroundEvent)})}undelegateBackgroundEvents(){Object.keys(this.delegatedHandlers).forEach(t=>{this.undelegateEvent(t,this.onBackgroundEvent)})}onBackgroundEvent(t){let e=!1;const n=t.target;if(this.options.pageVisible)this.options.background?e=this.background===n:e=this.content===n;else{const i=this.graph.view;e=i.background===n||i.grid===n}if(e){const i=this.delegatedHandlers[t.type];typeof i=="function"&&i.apply(this.graph,arguments)}}onResize(){this.cachedCenterPoint&&(this.centerPoint(this.cachedCenterPoint.x,this.cachedCenterPoint.y),this.updatePageBreak())}onScale({sx:t,sy:e,ox:n,oy:i}){this.updateScale(t,e),(n||i)&&(this.centerPoint(n,i),this.updatePageBreak()),typeof this.options.autoResizeOptions=="function"&&this.update()}storeScrollPosition(){this.cachedScrollLeft=this.container.scrollLeft,this.cachedScrollTop=this.container.scrollTop}restoreScrollPosition(){this.container.scrollLeft=this.cachedScrollLeft,this.container.scrollTop=this.cachedScrollTop,this.cachedScrollLeft=null,this.cachedScrollTop=null}storeClientSize(){this.cachedClientSize={width:this.container.clientWidth,height:this.container.clientHeight}}restoreClientSize(){this.cachedClientSize=null}beforeManipulation(){(Sl||Ml)&&$(this.container,{visibility:"hidden"})}afterManipulation(){(Sl||Ml)&&$(this.container,{visibility:"visible"})}updatePageSize(t,e){t!=null&&(this.options.pageWidth=t),e!=null&&(this.options.pageHeight=e),this.updatePageBreak()}updatePageBreak(){if(this.pageBreak&&this.pageBreak.parentNode&&this.pageBreak.parentNode.removeChild(this.pageBreak),this.pageBreak=null,this.options.pageVisible&&this.options.pageBreak){const t=this.graph.options.width,e=this.graph.options.height,n=this.options.pageWidth*this.sx,i=this.options.pageHeight*this.sy;if(n===0||i===0)return;if(t>n||e>i){let o=!1;const r=document.createElement("div");for(let a=1,l=Math.floor(t/n);a<l;a+=1){const c=document.createElement("div");O(c,this.prefixClassName("graph-pagebreak-vertical")),$(c,{left:a*n}),Gt(c,r),o=!0}for(let a=1,l=Math.floor(e/i);a<l;a+=1){const c=document.createElement("div");O(c,this.prefixClassName("graph-pagebreak-horizontal")),$(c,{top:a*i}),Gt(c,r),o=!0}o&&(O(r,this.prefixClassName("graph-pagebreak")),cC(this.graph.view.grid,r),this.pageBreak=r)}}}update(){const t=this.getClientSize();this.cachedCenterPoint=this.clientToLocalPoint(t.width/2,t.height/2);let e=this.options.autoResizeOptions;typeof e=="function"&&(e=D(e,this,this));const n=Object.assign({gridWidth:this.options.pageWidth,gridHeight:this.options.pageHeight,allowNewOrigin:"negative"},e);this.graph.fitToContent(this.getFitToContentOptions(n))}getFitToContentOptions(t){const e=this.sx,n=this.sy;return t.gridWidth&&(t.gridWidth*=e),t.gridHeight&&(t.gridHeight*=n),t.minWidth&&(t.minWidth*=e),t.minHeight&&(t.minHeight*=n),typeof t.padding=="object"?t.padding={left:(t.padding.left||0)*e,right:(t.padding.right||0)*e,top:(t.padding.top||0)*n,bottom:(t.padding.bottom||0)*n}:typeof t.padding=="number"&&(t.padding*=e),this.options.autoResize||(t.contentArea=P.create()),t}updateScale(t,e){const n=this.graph.options,i=t/this.sx,o=e/this.sy;this.sx=t,this.sy=e,this.graph.translate(n.x*i,n.y*o),this.graph.transform.resize(n.width*i,n.height*o)}scrollbarPosition(t,e){if(t==null&&e==null)return{left:this.container.scrollLeft,top:this.container.scrollTop};const n={};return typeof t=="number"&&(n.scrollLeft=t),typeof e=="number"&&(n.scrollTop=e),Io(this.container,n),this}scrollToPoint(t,e){const n=this.getClientSize(),i=this.graph.matrix(),o={};return typeof t=="number"&&(o.scrollLeft=t-n.width/2+i.e+(this.padding.left||0)),typeof e=="number"&&(o.scrollTop=e-n.height/2+i.f+(this.padding.top||0)),Io(this.container,o),this}scrollToContent(){const t=this.sx,e=this.sy,n=this.graph.getContentArea().getCenter();return this.scrollToPoint(n.x*t,n.y*e)}scrollToCell(t){const e=this.sx,n=this.sy,i=t.getBBox().getCenter();return this.scrollToPoint(i.x*e,i.y*n)}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const i=this.graph.matrix(),o=i.a,r=i.d,a=-i.e,l=-i.f,c=a+this.graph.options.width,h=l+this.graph.options.height;let u;if(this.storeClientSize(),typeof t=="number"||typeof e=="number"){u=n;const E=this.getVisibleArea().getCenter();typeof t=="number"?t*=o:t=E.x,typeof e=="number"?e*=r:e=E.y}else u=t,t=(a+c)/2,e=(l+h)/2;if(u&&u.padding)return this.positionPoint({x:t,y:e},"50%","50%",u);const d=this.getPadding(),g=this.getClientSize(),p=g.width/2,m=g.height/2,b=p-d.left-t+a,y=p-d.right+t-c,C=m-d.top-e+l,w=m-d.bottom+e-h;this.addPadding(Math.max(b,0),Math.max(y,0),Math.max(C,0),Math.max(w,0));const x=this.scrollToPoint(t,e);return this.restoreClientSize(),x}centerContent(t){return this.positionContent("center",t)}centerCell(t,e){return this.positionCell(t,"center",e)}positionContent(t,e){const n=this.graph.getContentArea(e);return this.positionRect(n,t,e)}positionCell(t,e,n){const i=t.getBBox();return this.positionRect(i,e,n)}positionRect(t,e,n){const i=P.create(t);switch(e){case"center":return this.positionPoint(i.getCenter(),"50%","50%",n);case"top":return this.positionPoint(i.getTopCenter(),"50%",0,n);case"top-right":return this.positionPoint(i.getTopRight(),"100%",0,n);case"right":return this.positionPoint(i.getRightMiddle(),"100%","50%",n);case"bottom-right":return this.positionPoint(i.getBottomRight(),"100%","100%",n);case"bottom":return this.positionPoint(i.getBottomCenter(),"50%","100%",n);case"bottom-left":return this.positionPoint(i.getBottomLeft(),0,"100%",n);case"left":return this.positionPoint(i.getLeftMiddle(),0,"50%",n);case"top-left":return this.positionPoint(i.getTopLeft(),0,0,n);default:return this}}positionPoint(t,e,n,i={}){const{padding:o}=i,r=K(i,["padding"]),a=ee(o),l=P.fromSize(this.getClientSize()),c=l.clone().moveAndExpand({x:a.left,y:a.top,width:-a.right-a.left,height:-a.top-a.bottom});e=zt(e,Math.max(0,c.width)),e<0&&(e=c.width+e),n=zt(n,Math.max(0,c.height)),n<0&&(n=c.height+n);const h=c.getTopLeft().translate(e,n),u=l.getCenter().diff(h),d=this.zoom(),g=u.scale(1/d,1/d),p=A.create(t).translate(g);return this.centerPoint(p.x,p.y,r)}zoom(t,e){if(t==null)return this.sx;e=e||{};let n,i;const o=this.getClientSize(),r=this.clientToLocalPoint(o.width/2,o.height/2);let a=t,l=t;if(e.absolute||(a+=this.sx,l+=this.sy),e.scaleGrid&&(a=Math.round(a/e.scaleGrid)*e.scaleGrid,l=Math.round(l/e.scaleGrid)*e.scaleGrid),e.maxScale&&(a=Math.min(e.maxScale,a),l=Math.min(e.maxScale,l)),e.minScale&&(a=Math.max(e.minScale,a),l=Math.max(e.minScale,l)),a=this.graph.transform.clampScale(a),l=this.graph.transform.clampScale(l),e.center){const c=a/this.sx,h=l/this.sy;n=e.center.x-(e.center.x-r.x)/c,i=e.center.y-(e.center.y-r.y)/h}else n=r.x,i=r.y;return this.beforeManipulation(),this.graph.transform.scale(a,l,n,i,!1),this.centerPoint(n,i),this.afterManipulation(),this}zoomToRect(t,e={}){const n=P.create(t),i=this.graph;if(e.contentArea=n,e.viewportArea==null){const r=this.container.getBoundingClientRect();e.viewportArea={x:i.options.x,y:i.options.y,width:r.width,height:r.height}}this.beforeManipulation(),i.transform.scaleContentToFitImpl(e,!1);const o=n.getCenter();return this.centerPoint(o.x,o.y),this.afterManipulation(),this}zoomToFit(t={}){return this.zoomToRect(this.graph.getContentArea(t),t)}transitionToPoint(t,e,n){typeof t=="object"?(n=e,e=t.y,t=t.x):e=e,n==null&&(n={});let i,o;const r=this.sx,a=Math.max(n.scale||r,1e-6),l=this.getClientSize(),c=new A(t,e),h=this.clientToLocalPoint(l.width/2,l.height/2);if(r===a){const d=h.diff(c).scale(r,r).round();i=`translate(${d.x}px,${d.y}px)`}else{const d=a/(r-a)*c.distance(h),g=h.clone().move(c,d),p=this.localToBackgroundPoint(g).round();i=`scale(${a/r})`,o=`${p.x}px ${p.y}px`}const u=n.onTransitionEnd;return O(this.container,id),nt.off(this.content,Er),nt.on(this.content,Er,d=>{this.syncTransition(a,{x:t,y:e}),typeof u=="function"&&D(u,this,d.originalEvent)}),$(this.content,{transform:i,transformOrigin:o,transition:"transform",transitionDuration:n.duration||"1s",transitionDelay:n.delay,transitionTimingFunction:n.timing}),this}syncTransition(t,e){return this.beforeManipulation(),this.graph.scale(t),this.removeTransition(),this.centerPoint(e.x,e.y),this.afterManipulation(),this}removeTransition(){return st(this.container,id),nt.off(this.content,Er),$(this.content,{transform:"",transformOrigin:"",transition:"",transitionDuration:"",transitionDelay:"",transitionTimingFunction:""}),this}transitionToRect(t,e={}){const n=P.create(t),i=e.maxScale||1/0,o=e.minScale||Number.MIN_VALUE,r=e.scaleGrid||null,a=e.visibility||1,l=e.center?A.create(e.center):n.getCenter(),c=this.getClientSize(),h=c.width*a,u=c.height*a;let d=new P(l.x-h/2,l.y-u/2,h,u).getMaxUniformScaleToFit(n,l);return d=Math.min(d,i),r&&(d=Math.floor(d/r)*r),d=Math.max(o,d),this.transitionToPoint(l,Object.assign({scale:d},e))}startPanning(t){const e=this.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.trigger("pan:start",{e}),nt.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)}),nt.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(t){const e=this.normalizeEvent(t),n=e.clientX-this.clientX,i=e.clientY-this.clientY;this.container.scrollTop-=i,this.container.scrollLeft-=n,this.clientX=e.clientX,this.clientY=e.clientY,this.trigger("panning",{e})}stopPanning(t){nt.off(document.body,".panning"),nt.off(window,".panning"),this.trigger("pan:stop",{e:t})}clientToLocalPoint(t,e){let n=typeof t=="object"?t.x:t,i=typeof t=="object"?t.y:e;const o=this.graph.matrix();return n+=this.container.scrollLeft-this.padding.left-o.e,i+=this.container.scrollTop-this.padding.top-o.f,new A(n/o.a,i/o.d)}localToBackgroundPoint(t,e){const n=typeof t=="object"?A.create(t):new A(t,e),i=this.graph.matrix(),o=this.padding;return Ae(n,i).translate(o.left,o.top)}resize(t,e){let n=t??this.container.offsetWidth,i=e??this.container.offsetHeight;typeof n=="number"&&(n=Math.round(n)),typeof i=="number"&&(i=Math.round(i)),this.options.width=n,this.options.height=i,$(this.container,{width:n,height:i}),this.update()}getClientSize(){return this.cachedClientSize?this.cachedClientSize:{width:this.container.clientWidth,height:this.container.clientHeight}}autoScroll(t,e){const i=this.container,o=i.getBoundingClientRect();let r=0,a=0;return t<=o.left+10&&(r=-10),e<=o.top+10&&(a=-10),t>=o.right-10&&(r=10),e>=o.bottom-10&&(a=10),r!==0&&(i.scrollLeft+=r),a!==0&&(i.scrollTop+=a),{scrollerX:r,scrollerY:a}}addPadding(t,e,n,i){let o=this.getPadding();this.padding={left:Math.round(o.left+(t||0)),top:Math.round(o.top+(n||0)),bottom:Math.round(o.bottom+(i||0)),right:Math.round(o.right+(e||0))},o=this.padding,$(this.content,{width:o.left+this.graph.options.width+o.right,height:o.top+this.graph.options.height+o.bottom});const r=this.graph.container;return r.style.left=`${this.padding.left}px`,r.style.top=`${this.padding.top}px`,this}getPadding(){const t=this.options.padding;return ee(typeof t=="function"?D(t,this,this):t)}getVisibleArea(){const t=this.graph.matrix(),e=this.getClientSize(),n={x:this.container.scrollLeft||0,y:this.container.scrollTop||0,width:e.width,height:e.height},i=Yt(n,t.inverse());return i.x-=(this.padding.left||0)/this.sx,i.y-=(this.padding.top||0)/this.sy,i}isCellVisible(t,e={}){const n=t.getBBox(),i=this.getVisibleArea();return e.strict?i.containsRect(n):i.isIntersectWithRect(n)}isPointVisible(t){return this.getVisibleArea().containsPoint(t)}lock(){return $(this.container,{overflow:"hidden"}),this}unlock(){return $(this.container,{overflow:"scroll"}),this}onRemove(){this.stopListening()}dispose(){Jn(this.container,this.graph.container),this.remove()}}H([q()],od.prototype,"dispose",null);class QE extends lr{get elem(){return this.scroller.background}constructor(t){super(t.graph),this.scroller=t,t.options.background&&this.draw(t.options.background)}init(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}updateBackgroundOptions(t){this.scroller.options.background=t}}const LE=`.x6-graph-scroller {
374
+ position: relative;
375
+ box-sizing: border-box;
376
+ overflow: scroll;
377
+ outline: none;
378
+ }
379
+ .x6-graph-scroller-content {
380
+ position: relative;
381
+ }
382
+ .x6-graph-scroller-background {
383
+ position: absolute;
384
+ top: 0;
385
+ right: 0;
386
+ bottom: 0;
387
+ left: 0;
388
+ }
389
+ .x6-graph-scroller .x6-graph {
390
+ position: absolute;
391
+ display: inline-block;
392
+ margin: 0;
393
+ box-shadow: none;
394
+ }
395
+ .x6-graph-scroller .x6-graph > svg {
396
+ display: block;
397
+ }
398
+ .x6-graph-scroller.x6-graph-scroller-paged .x6-graph {
399
+ box-shadow: 0 0 4px 0 #eee;
400
+ }
401
+ .x6-graph-scroller.x6-graph-scroller-pannable[data-panning='false'] {
402
+ cursor: grab;
403
+ }
404
+ .x6-graph-scroller.x6-graph-scroller-pannable[data-panning='true'] {
405
+ cursor: grabbing;
406
+ user-select: none;
407
+ }
408
+ .x6-graph-pagebreak {
409
+ position: absolute;
410
+ top: 0;
411
+ right: 0;
412
+ bottom: 0;
413
+ left: 0;
414
+ }
415
+ .x6-graph-pagebreak-vertical {
416
+ position: absolute;
417
+ top: 0;
418
+ bottom: 0;
419
+ box-sizing: border-box;
420
+ width: 1px;
421
+ border-left: 1px dashed #bdbdbd;
422
+ }
423
+ .x6-graph-pagebreak-horizontal {
424
+ position: absolute;
425
+ right: 0;
426
+ left: 0;
427
+ box-sizing: border-box;
428
+ height: 1px;
429
+ border-top: 1px dashed #bdbdbd;
430
+ }
431
+ `;S.prototype.lockScroller=function(){const s=this.getPlugin("scroller");return s&&s.lockScroller(),this},S.prototype.unlockScroller=function(){const s=this.getPlugin("scroller");return s&&s.unlockScroller(),this},S.prototype.updateScroller=function(){const s=this.getPlugin("scroller");return s&&s.updateScroller(),this},S.prototype.getScrollbarPosition=function(){const s=this.getPlugin("scroller");return s?s.getScrollbarPosition():{left:0,top:0}},S.prototype.setScrollbarPosition=function(s,t){const e=this.getPlugin("scroller");return e&&e.setScrollbarPosition(s,t),this};class rd extends Ot{get pannable(){return this.options?typeof this.options.pannable=="object"?this.options.pannable.enabled:!!this.options.pannable:!1}get container(){return this.scrollerImpl.container}constructor(t={}){super(),this.name="scroller",this.options=t,Me(this.name,LE)}init(t){this.graph=t;const e=sd(Object.assign(Object.assign({enabled:!0},this.options),{graph:t}));this.options=e,this.scrollerImpl=new od(e),this.setup(),this.autoDisableGraphPanning(),this.startListening(),this.updateClassName(),this.scrollerImpl.center()}resize(t,e){this.scrollerImpl.resize(t,e)}resizePage(t,e){this.scrollerImpl.updatePageSize(t,e)}zoom(t,e){return typeof t>"u"?this.scrollerImpl.zoom():(this.scrollerImpl.zoom(t,e),this)}zoomTo(t,e={}){return this.scrollerImpl.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})),this}zoomToRect(t,e={}){return this.scrollerImpl.zoomToRect(t,e),this}zoomToFit(t={}){return this.scrollerImpl.zoomToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){return this.scrollerImpl.centerPoint(t,e,n),this}centerContent(t){return this.scrollerImpl.centerContent(t),this}centerCell(t,e){return this.scrollerImpl.centerCell(t,e),this}positionPoint(t,e,n,i={}){return this.scrollerImpl.positionPoint(t,e,n,i),this}positionRect(t,e,n){return this.scrollerImpl.positionRect(t,e,n),this}positionCell(t,e,n){return this.scrollerImpl.positionCell(t,e,n),this}positionContent(t,e){return this.scrollerImpl.positionContent(t,e),this}drawBackground(t,e){return(this.graph.options.background==null||!e)&&this.scrollerImpl.backgroundManager.draw(t),this}clearBackground(t){return(this.graph.options.background==null||!t)&&this.scrollerImpl.backgroundManager.clear(),this}isPannable(){return this.pannable}enablePanning(){this.pannable||(this.options.pannable=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.options.pannable=!1,this.updateClassName())}togglePanning(t){return t==null?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}lockScroller(){return this.scrollerImpl.lock(),this}unlockScroller(){return this.scrollerImpl.unlock(),this}updateScroller(){return this.scrollerImpl.update(),this}getScrollbarPosition(){return this.scrollerImpl.scrollbarPosition()}setScrollbarPosition(t,e){return this.scrollerImpl.scrollbarPosition(t,e),this}scrollToPoint(t,e){return this.scrollerImpl.scrollToPoint(t,e),this}scrollToContent(){return this.scrollerImpl.scrollToContent(),this}scrollToCell(t){return this.scrollerImpl.scrollToCell(t),this}transitionToPoint(t,e,n){return this.scrollerImpl.transitionToPoint(t,e,n),this}transitionToRect(t,e={}){return this.scrollerImpl.transitionToRect(t,e),this}enableAutoResize(){this.scrollerImpl.enableAutoResize()}disableAutoResize(){this.scrollerImpl.disableAutoResize()}autoScroll(t,e){return this.scrollerImpl.autoScroll(t,e)}clientToLocalPoint(t,e){return this.scrollerImpl.clientToLocalPoint(t,e)}getVisibleArea(){return this.scrollerImpl.getVisibleArea()}isCellVisible(t,e={}){return this.scrollerImpl.isCellVisible(t,e)}isPointVisible(t){return this.scrollerImpl.isPointVisible(t)}setup(){this.scrollerImpl.on("*",(t,e)=>{this.trigger(t,e)})}startListening(){let t=[];const e=this.options.pannable;typeof e=="object"?t=e.eventTypes||[]:t=["leftMouseDown"],t.includes("leftMouseDown")&&(this.graph.on("blank:mousedown",this.preparePanning,this),this.graph.on("node:unhandled:mousedown",this.preparePanning,this),this.graph.on("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&(this.onRightMouseDown=this.onRightMouseDown.bind(this),nt.on(this.scrollerImpl.container,"mousedown",this.onRightMouseDown))}stopListening(){let t=[];const e=this.options.pannable;typeof e=="object"?t=e.eventTypes||[]:t=["leftMouseDown"],t.includes("leftMouseDown")&&(this.graph.off("blank:mousedown",this.preparePanning,this),this.graph.off("node:unhandled:mousedown",this.preparePanning,this),this.graph.off("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&nt.off(this.scrollerImpl.container,"mousedown",this.onRightMouseDown)}onRightMouseDown(t){t.button===2&&this.allowPanning(t,!0)&&(this.updateClassName(!0),this.scrollerImpl.startPanning(t),this.scrollerImpl.once("pan:stop",()=>this.updateClassName(!1)))}preparePanning({e:t}){const e=this.allowPanning(t,!0),n=this.graph.getPlugin("selection"),i=n&&n.allowRubberband(t,!0);(e||this.allowPanning(t)&&!i)&&(this.updateClassName(!0),this.scrollerImpl.startPanning(t),this.scrollerImpl.once("pan:stop",()=>this.updateClassName(!1)))}allowPanning(t,e){return this.pannable&&Te(t,this.options.modifiers,e)}updateClassName(t){const e=this.scrollerImpl.container,n=_.prefix("graph-scroller-pannable");this.pannable?(O(e,n),e.dataset.panning=(!!t).toString()):st(e,n)}autoDisableGraphPanning(){var t;const e=(t=this.graph)===null||t===void 0?void 0:t.panning;e!=null&&e.pannable&&(e.disablePanning(),console.warn("Detected Scroller plugin; Graph panning has been disabled by default to avoid conflicts."))}dispose(){this.scrollerImpl.dispose(),this.stopListening(),this.off(),Be(this.name)}}H([q()],rd.prototype,"dispose",null);function ks(s,t){return s.reduce((e,n)=>Math.max(n==null?void 0:n.getSize()[t],e),0)}function FE(s,t,e){const n=[];for(let i=e*t,o=i+e;i<o;i+=1)s[i]&&n.push(s[i]);return n}function zE(s,t,e){const n=[];for(let i=t,o=s.length;i<o;i+=e)s[i]&&n.push(s[i]);return n}function ad(s,t){return s.reduce((e,n,i)=>(e.push(e[i]+n),e),[t||0])}function UE(s,t={}){const e=Ut.isModel(s)?s:new Ut().resetCells(s,{sort:!1,dryrun:!0}),n=e.getNodes(),i=t.columns||1,o=Math.ceil(n.length/i),r=t.dx||0,a=t.dy||0,l=t.center!==!1,c=t.resizeToFit===!0,h=t.marginX||0,u=t.marginY||0,d=[];let g=t.columnWidth;if(g==="compact")for(let C=0;C<i;C+=1){const w=zE(n,C,i);d.push(ks(w,"width")+r)}else{(g==null||g==="auto")&&(g=ks(n,"width")+r);for(let C=0;C<i;C+=1)d.push(g)}const p=ad(d,h),m=[];let b=t.rowHeight;if(b==="compact")for(let C=0;C<o;C+=1){const w=FE(n,C,i);m.push(ks(w,"height")+a)}else{(b==null||b==="auto")&&(b=ks(n,"height")+a);for(let C=0;C<o;C+=1)m.push(b)}const y=ad(m,u);e.startBatch("layout"),n.forEach((C,w)=>{const x=w%i,E=Math.floor(w/i),B=d[x],v=m[E];let M=0,I=0,T=C.getSize();if(c){let k=B-2*r,R=v-2*a;const z=T.height*(T.width?k/T.width:1),J=T.width*(T.height?R/T.height:1);v<z?k=J:R=z,T={width:k,height:R},C.setSize(T,t)}l&&(M=(B-T.width)/2,I=(v-T.height)/2),C.position(p[x]+r+M,y[E]+a+I,t)}),e.stopBatch("layout")}const KE=`.x6-widget-dnd {
432
+ position: absolute;
433
+ top: -10000px;
434
+ left: -10000px;
435
+ z-index: 999999;
436
+ display: none;
437
+ cursor: move;
438
+ opacity: 0.7;
439
+ pointer-events: 'cursor';
440
+ }
441
+ .x6-widget-dnd.dragging {
442
+ display: inline-block;
443
+ }
444
+ .x6-widget-dnd.dragging * {
445
+ pointer-events: none !important;
446
+ }
447
+ .x6-widget-dnd .x6-graph {
448
+ background: transparent;
449
+ box-shadow: none;
450
+ }
451
+ .x6-widget-stencil {
452
+ position: absolute;
453
+ top: 0;
454
+ right: 0;
455
+ bottom: 0;
456
+ left: 0;
457
+ }
458
+ .x6-widget-stencil::after {
459
+ position: absolute;
460
+ top: 0;
461
+ display: block;
462
+ width: 100%;
463
+ height: 20px;
464
+ padding: 8px 0;
465
+ line-height: 20px;
466
+ text-align: center;
467
+ opacity: 0;
468
+ transition: top 0.1s linear, opacity 0.1s linear;
469
+ content: ' ';
470
+ pointer-events: none;
471
+ }
472
+ .x6-widget-stencil-content {
473
+ position: absolute;
474
+ top: 0;
475
+ right: 0;
476
+ bottom: 0;
477
+ left: 0;
478
+ height: auto;
479
+ overflow-x: hidden;
480
+ overflow-y: auto;
481
+ }
482
+ .x6-widget-stencil .x6-node [magnet]:not([magnet='passive']) {
483
+ pointer-events: none;
484
+ }
485
+ .x6-widget-stencil-group {
486
+ padding: 0;
487
+ padding-bottom: 8px;
488
+ overflow: hidden;
489
+ user-select: none;
490
+ }
491
+ .x6-widget-stencil-group.collapsed {
492
+ height: auto;
493
+ padding-bottom: 0;
494
+ }
495
+ .x6-widget-stencil-group-title {
496
+ position: relative;
497
+ margin-top: 0;
498
+ margin-bottom: 0;
499
+ padding: 4px;
500
+ cursor: pointer;
501
+ }
502
+ .x6-widget-stencil-title,
503
+ .x6-widget-stencil-group > .x6-widget-stencil-group-title {
504
+ overflow: hidden;
505
+ white-space: nowrap;
506
+ text-overflow: ellipsis;
507
+ user-select: none;
508
+ }
509
+ .x6-widget-stencil .unmatched {
510
+ opacity: 0.3;
511
+ }
512
+ .x6-widget-stencil .x6-node.unmatched {
513
+ display: none;
514
+ }
515
+ .x6-widget-stencil-group.unmatched {
516
+ display: none;
517
+ }
518
+ .x6-widget-stencil-search-text {
519
+ position: relative;
520
+ z-index: 1;
521
+ box-sizing: border-box;
522
+ width: 100%;
523
+ height: 30px;
524
+ max-height: 30px;
525
+ line-height: 30px;
526
+ outline: 0;
527
+ }
528
+ .x6-widget-stencil.not-found::after {
529
+ opacity: 1;
530
+ content: attr(data-not-found-text);
531
+ }
532
+ .x6-widget-stencil.not-found.searchable::after {
533
+ top: 30px;
534
+ }
535
+ .x6-widget-stencil.not-found.searchable.collapsable::after {
536
+ top: 50px;
537
+ }
538
+ .x6-widget-stencil {
539
+ color: #333;
540
+ background: #f5f5f5;
541
+ }
542
+ .x6-widget-stencil-content {
543
+ position: absolute;
544
+ top: 32px;
545
+ }
546
+ .x6-widget-stencil.searchable > .x6-widget-stencil-content {
547
+ top: 80px;
548
+ }
549
+ .x6-widget-stencil.not-found::after {
550
+ position: absolute;
551
+ }
552
+ .x6-widget-stencil.not-found.searchable.collapsable::after {
553
+ top: 80px;
554
+ }
555
+ .x6-widget-stencil.not-found.searchable::after {
556
+ top: 60px;
557
+ }
558
+ .x6-widget-stencil-group {
559
+ height: auto;
560
+ margin-bottom: 1px;
561
+ padding: 0;
562
+ transition: none;
563
+ }
564
+ .x6-widget-stencil-group .x6-graph {
565
+ background: transparent;
566
+ box-shadow: none;
567
+ }
568
+
569
+ .x6-widget-stencil .x6-node.x6-node-immovable {
570
+ cursor: move;
571
+ }
572
+ .x6-widget-stencil-group.collapsed {
573
+ height: auto;
574
+ max-height: 31px;
575
+ }
576
+ .x6-widget-stencil-title,
577
+ .x6-widget-stencil-group > .x6-widget-stencil-group-title {
578
+ position: relative;
579
+ left: 0;
580
+ box-sizing: border-box;
581
+ width: 100%;
582
+ height: 32px;
583
+ padding: 0 5px 0 8px;
584
+ color: #666;
585
+ font-weight: 700;
586
+ font-size: 12px;
587
+ line-height: 32px;
588
+ cursor: default;
589
+ transition: all 0.3;
590
+ }
591
+ .x6-widget-stencil-title:hover,
592
+ .x6-widget-stencil-group > .x6-widget-stencil-group-title:hover {
593
+ color: #444;
594
+ }
595
+ .x6-widget-stencil-title {
596
+ background: #e9e9e9;
597
+ }
598
+ .x6-widget-stencil-group > .x6-widget-stencil-group-title {
599
+ background: #ededed;
600
+ }
601
+ .x6-widget-stencil.collapsable > .x6-widget-stencil-title,
602
+ .x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title {
603
+ padding-left: 32px;
604
+ cursor: pointer;
605
+ }
606
+ .x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,
607
+ .x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {
608
+ position: absolute;
609
+ top: 6px;
610
+ left: 8px;
611
+ display: block;
612
+ width: 18px;
613
+ height: 18px;
614
+ margin: 0;
615
+ padding: 0;
616
+ background-color: transparent;
617
+ background-repeat: no-repeat;
618
+ background-position: 0 0;
619
+ border: none;
620
+ content: ' ';
621
+ }
622
+ .x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,
623
+ .x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {
624
+ background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48L2c+PC9zdmc+');
625
+ opacity: 0.4;
626
+ transition: all 0.3s;
627
+ }
628
+ .x6-widget-stencil.collapsable > .x6-widget-stencil-title:hover::before,
629
+ .x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title:hover::before {
630
+ opacity: 0.6;
631
+ }
632
+ .x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title::before,
633
+ .x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title::before {
634
+ background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48cGF0aCBkPSJNOC44MTcgNS42MjN2Ni43NTZhLjU1OC41NTggMCAwMDEuMTE2IDBWNS42MjNhLjU1OC41NTggMCAxMC0xLjExNiAweiIvPjwvZz48L3N2Zz4=');
635
+ opacity: 0.4;
636
+ }
637
+ .x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title:hover::before,
638
+ .x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title:hover::before {
639
+ opacity: 0.6;
640
+ }
641
+ .x6-widget-stencil input[type='search'] {
642
+ appearance: textfield;
643
+ }
644
+ .x6-widget-stencil input[type='search']::-webkit-search-cancel-button,
645
+ .x6-widget-stencil input[type='search']::-webkit-search-decoration {
646
+ appearance: none;
647
+ }
648
+ .x6-widget-stencil-search-text {
649
+ display: block;
650
+ width: 90%;
651
+ margin: 8px 5%;
652
+ padding-left: 8px;
653
+ color: #333;
654
+ background: #fff;
655
+ border: 1px solid #e9e9e9;
656
+ border-radius: 12px;
657
+ outline: 0;
658
+ }
659
+ .x6-widget-stencil-search-text:focus {
660
+ outline: 0;
661
+ }
662
+ .x6-widget-stencil::after {
663
+ color: #808080;
664
+ font-weight: 600;
665
+ font-size: 12px;
666
+ background: 0 0;
667
+ }
668
+ `,Wt={base:"widget-stencil",title:"widget-stencil-title",search:"widget-stencil-search",searchText:"widget-stencil-search-text",content:"widget-stencil-content",group:"widget-stencil-group",groupTitle:"widget-stencil-group-title",groupContent:"widget-stencil-group-content"},Sr="__default__",JE=Object.assign({stencilGraphWidth:200,stencilGraphHeight:800,title:"Stencil",collapsable:!1,placeholder:"Search",notFoundText:"No matches found",layout(s,t){const e={columnWidth:this.options.stencilGraphWidth/2-10,columns:2,rowHeight:80,resizeToFit:!1,dx:10,dy:10};UE(s,Object.assign(Object.assign(Object.assign({},e),this.options.layoutOptions),t?t.layoutOptions:{}))}},ju);class jE extends Ft{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}constructor(t={}){super(),this.name="stencil",Me(this.name,KE),this.graphs={},this.groups={},this.options=Object.assign(Object.assign({},JE),t),this.init()}init(){this.dnd=new vr(this.options),this.onSearch=ji(this.onSearch,200),this.initContainer(),this.initSearch(),this.initContent(),this.initGroups(),this.setTitle(),this.startListening()}load(t,e){return Array.isArray(t)?this.loadGroup(t,e):this.options.groups&&Object.keys(this.options.groups).forEach(n=>{t[n]&&this.loadGroup(t[n],n)}),this}unload(t,e){return Array.isArray(t)?this.loadGroup(t,e,!0):this.options.groups&&Object.keys(this.options.groups).forEach(n=>{t[n]&&this.loadGroup(t[n],n,!0)}),this}toggleGroup(t){return this.isGroupCollapsed(t)?this.expandGroup(t):this.collapseGroup(t),this}collapseGroup(t){if(this.isGroupCollapsable(t)){const e=this.groups[t];e&&!this.isGroupCollapsed(t)&&(this.trigger("group:collapse",{name:t}),O(e,"collapsed"))}return this}expandGroup(t){if(this.isGroupCollapsable(t)){const e=this.groups[t];e&&this.isGroupCollapsed(t)&&(this.trigger("group:expand",{name:t}),st(e,"collapsed"))}return this}isGroupCollapsable(t){const e=this.groups[t];return le(e,"collapsable")}isGroupCollapsed(t){const e=this.groups[t];return e&&le(e,"collapsed")}collapseGroups(){return Object.keys(this.groups).forEach(t=>{this.collapseGroup(t)}),this}expandGroups(){return Object.keys(this.groups).forEach(t=>{this.expandGroup(t)}),this}resizeGroup(t,e){const n=this.graphs[t];return n&&n.resize(e.width,e.height),this}addGroup(t){const e=Array.isArray(t)?t:[t];this.options.groups?this.options.groups.push(...e):this.options.groups=e,e.forEach(n=>{this.initGroup(n)})}removeGroup(t){const e=Array.isArray(t)?t:[t];this.options.groups&&(this.options.groups=this.options.groups.filter(n=>!e.includes(n.name)),e.forEach(n=>{const i=this.graphs[n];this.unregisterGraphEvents(i),i.dispose(),delete this.graphs[n];const o=this.groups[n];Vt(o),delete this.groups[n]}))}initContainer(){this.container=document.createElement("div"),O(this.container,this.prefixClassName(Wt.base)),V(this.container,"data-not-found-text",this.options.notFoundText||"No matches found")}initContent(){this.content=document.createElement("div"),O(this.content,this.prefixClassName(Wt.content)),Gt(this.content,this.container)}buildGraphConfig(t){const e=this.options.stencilGraphOptions||{},n=t==null?void 0:t.graphOptions,i=Object.assign(Object.assign({},e),n);i.panning==null&&(i.panning=!1);const o=t&&t.graphWidth||this.options.stencilGraphWidth,r=t&&t.graphHeight||this.options.stencilGraphHeight,a=i.model||new Ut;return{mergedGraphOptions:i,width:o,height:r,model:a}}createStencilGraph(t,e,n,i){const o=new S(Object.assign(Object.assign({},t),{container:document.createElement("div"),model:i,width:e,height:n,interacting:!1,preventDefaultBlankAction:!1}));return this.registerGraphEvents(o),o}initSearch(){this.options.search&&(O(this.container,"searchable"),Mt(this.container,this.renderSearch()))}initGroup(t){const e=document.createElement("div");O(e,this.prefixClassName(Wt.group)),V(e,"data-name",t.name),(t.collapsable==null&&this.options.collapsable||t.collapsable!==!1)&&O(e,"collapsable"),ie(e,"collapsed",t.collapsed===!0);const n=document.createElement("h3");O(n,this.prefixClassName(Wt.groupTitle)),n.innerHTML=t.title||t.name;const i=document.createElement("div");O(i,this.prefixClassName(Wt.groupContent));const{mergedGraphOptions:o,width:r,height:a,model:l}=this.buildGraphConfig(t),c=this.createStencilGraph(o,r,a,l);Mt(i,c.container),Mt(e,[n,i]),Gt(e,this.content),this.groups[t.name]=e,this.graphs[t.name]=c}initGroups(){if(this.clearGroups(),this.setCollapsableState(),this.options.groups&&this.options.groups.length)this.options.groups.forEach(t=>{this.initGroup(t)});else{const{mergedGraphOptions:t,width:e,height:n,model:i}=this.buildGraphConfig(),o=this.createStencilGraph(t,e,n,i);Mt(this.content,o.container),this.graphs[Sr]=o}}setCollapsableState(){this.options.collapsable=this.options.collapsable&&this.options.groups&&this.options.groups.some(t=>t.collapsable!==!1),this.options.collapsable?(O(this.container,"collapsable"),this.options.groups&&this.options.groups.every(e=>e.collapsed||e.collapsable===!1)?O(this.container,"collapsed"):st(this.container,"collapsed")):st(this.container,"collapsable")}setTitle(){const t=document.createElement("div");O(t,this.prefixClassName(Wt.title)),t.innerHTML=this.options.title,Gt(t,this.container)}renderSearch(){const t=document.createElement("div");O(t,this.prefixClassName(Wt.search));const e=document.createElement("input");return V(e,{type:"search",placeholder:this.options.placeholder||"Search"}),O(e,this.prefixClassName(Wt.searchText)),Mt(t,e),t}startListening(){const t=this.prefixClassName(Wt.title),e=this.prefixClassName(Wt.searchText),n=this.prefixClassName(Wt.groupTitle);this.delegateEvents({[`click .${t}`]:"onTitleClick",[`touchstart .${t}`]:"onTitleClick",[`click .${n}`]:"onGroupTitleClick",[`touchstart .${n}`]:"onGroupTitleClick",[`input .${e}`]:"onSearch",[`focusin .${e}`]:"onSearchFocusIn",[`focusout .${e}`]:"onSearchFocusOut"})}stopListening(){this.undelegateEvents()}registerGraphEvents(t){t.on("cell:mousedown",this.onDragStart,this)}unregisterGraphEvents(t){t.off("cell:mousedown",this.onDragStart,this)}loadGroup(t,e,n){const i=this.getModel(e);if(i){const l=t.map(c=>vt.isNode(c)?c:vt.create(c));n===!0?i.removeCells(l):i.resetCells(l)}const o=this.getGroup(e);let r=this.options.stencilGraphHeight;o&&o.graphHeight!=null&&(r=o.graphHeight);const a=o&&o.layout||this.options.layout;if(a&&i&&D(a,this,i,o),!r){const l=this.getGraph(e);l.fitToContent({minWidth:l.options.width,gridHeight:1,padding:o&&o.graphPadding||this.options.stencilGraphPadding||10})}return this}onDragStart(t){const{e,node:n}=t,i=this.getGroupByNode(n);if(i&&i.nodeMovable===!1)return;const o=this.getGraph(i?i.name:void 0),r=o&&typeof o.isPannable=="function"?o.isPannable():!1;r&&o.disablePanning();const a=()=>{r&&o.enablePanning(),this.undelegateDocumentEvents()};this.delegateDocumentEvents({mouseup:a,touchend:a,touchcancel:a}),this.dnd.start(n,e)}filter(t,e){const n=Object.keys(this.graphs).reduce((i,o)=>{const r=this.graphs[o],a=o===Sr?null:o,l=r.model.getNodes().filter(d=>{let g=!1;typeof e=="function"?g=D(e,this,d,t,a,this):typeof e=="boolean"?g=e:g=this.isCellMatched(d,t,e,t.toLowerCase()!==t);const p=r.renderer.findViewByCell(d);return p&&ie(p.container,"unmatched",!g),g}),c=l.length>0,h=this.options,u=new Ut;return u.resetCells(l),h.layout&&D(h.layout,this,u,this.getGroup(o)),this.groups[o]&&ie(this.groups[o],"unmatched",!c),r.fitToContent({gridWidth:1,gridHeight:1,padding:h.stencilGraphPadding||10}),i||c},!1);ie(this.container,"not-found",!n)}isCellMatched(t,e,n,i){return e&&n?Object.keys(n).some(o=>{if(o==="*"||t.shape===o){const r=n[o];return typeof r=="boolean"?r:(Array.isArray(r)?r:[r]).some(l=>{let c=t.getPropByPath(l);return c!=null?(c=`${c}`,i||(c=c.toLowerCase()),c.indexOf(e)>=0):!1})}return!1}):!0}onSearch(t){this.filter(t.target.value,this.options.search)}onSearchFocusIn(){O(this.container,"is-focused")}onSearchFocusOut(){st(this.container,"is-focused")}onTitleClick(){this.options.collapsable&&(ie(this.container,"collapsed"),le(this.container,"collapsed")?this.collapseGroups():this.expandGroups())}onGroupTitleClick(t){const e=t.target.closest(`.${this.prefixClassName(Wt.group)}`);e&&this.toggleGroup(V(e,"data-name")||"");const n=Object.keys(this.groups).every(i=>{const o=this.getGroup(i),r=this.groups[i];return o&&o.collapsable===!1||le(r,"collapsed")});ie(this.container,"collapsed",n)}getModel(t){const e=this.getGraph(t);return e?e.model:null}getGraph(t){return this.graphs[t||Sr]}getGroup(t){const e=this.options.groups;return t!=null&&e&&e.length?e.find(n=>n.name===t):null}getGroupByNode(t){const e=this.options.groups;return e?e.find(n=>{const i=this.getModel(n.name);return i?i.has(t.id):!1}):null}clearGroups(){Object.keys(this.graphs).forEach(t=>{const e=this.graphs[t];this.unregisterGraphEvents(e),e.dispose()}),Object.keys(this.groups).forEach(t=>{const e=this.groups[t];Vt(e)}),this.graphs={},this.groups={}}onRemove(){this.clearGroups(),this.dnd.remove(),this.stopListening(),this.undelegateDocumentEvents()}dispose(){this.remove(),Be(this.name)}}H([q()],jE.prototype,"dispose",null);class ld extends Ft{get model(){return this.graph.model}get containerClassName(){return this.prefixClassName("widget-snapline")}get verticalClassName(){return`${this.containerClassName}-vertical`}get horizontalClassName(){return`${this.containerClassName}-horizontal`}constructor(t){super();const{graph:e}=t,n=K(t,["graph"]);this.graph=e,this.options=Object.assign({},n),this.offset={x:0,y:0},this.render(),this.disabled||this.startListening()}get disabled(){return this.options.enabled!==!0}enable(){this.disabled&&(this.options.enabled=!0,this.startListening())}disable(){this.disabled||(this.options.enabled=!1,this.stopListening())}setFilter(t){this.options.filter=t}render(){const t=this.containerWrapper=new L("svg"),e=this.horizontal=new L("line"),n=this.vertical=new L("line");t.addClass(this.containerClassName),e.addClass(this.horizontalClassName),n.addClass(this.verticalClassName),t.setAttribute("width","100%"),t.setAttribute("height","100%"),e.setAttribute("display","none"),n.setAttribute("display","none"),t.append([e,n]),this.options.className&&t.addClass(this.options.className),this.container=this.containerWrapper.node}startListening(){this.stopListening(),this.graph.on("node:mousedown",this.captureCursorOffset,this),this.graph.on("node:mousemove",this.snapOnMoving,this),this.model.on("batch:stop",this.onBatchStop,this),this.delegateDocumentEvents({mouseup:"hide",touchend:"hide"})}stopListening(){this.graph.off("node:mousedown",this.captureCursorOffset,this),this.graph.off("node:mousemove",this.snapOnMoving,this),this.model.off("batch:stop",this.onBatchStop,this),this.undelegateDocumentEvents()}onBatchStop({name:t,data:e}){t==="resize"&&this.snapOnResizing(e.cell,e)}captureCursorOffset({view:t,x:e,y:n}){const i=t.getDelegatedView();if(i&&this.isNodeMovable(i)){const o=t.cell.getPosition();this.offset={x:e-o.x,y:n-o.y}}}isNodeMovable(t){return t&&t.cell.isNode()&&t.can("nodeMovable")}getRestrictArea(t){const e=this.graph.options.translating.restrict,n=typeof e=="function"?D(e,this.graph,t):e;return typeof n=="number"?this.graph.transform.getGraphArea().inflate(n):n===!0?this.graph.transform.getGraphArea():n||null}snapOnResizing(t,e){if(this.options.resizing&&!e.snapped&&e.ui&&e.direction&&e.trueDirection){const n=this.graph.renderer.findViewByCell(t);if(n&&n.cell.isNode()){const i=t.getBBox(),o=i.bbox(t.getAngle()),r=o.getTopLeft(),a=o.getBottomRight(),l=Tt(t.getAngle()),c=this.options.tolerance||0;let h,u,d,g,p,m;const b={vertical:0,horizontal:0},y=e.direction,C=e.trueDirection,w=e.relativeDirection;C.indexOf("right")!==-1?b.vertical=a.x:b.vertical=r.x,C.indexOf("bottom")!==-1?b.horizontal=a.y:b.horizontal=r.y,this.model.getNodes().some(R=>{if(this.isIgnored(t,R))return!1;const z=R.getBBox().bbox(R.getAngle()),J=z.getTopLeft(),Z=z.getBottomRight(),Y={vertical:[J.x,Z.x],horizontal:[J.y,Z.y]},Et={};return Object.keys(Y).forEach(Rt=>{const Dt=Rt,pt=Y[Dt].map(Q=>({position:Q,distance:Math.abs(Q-b[Dt])})).filter(Q=>Q.distance<=c);Et[Dt]=co(pt,Q=>Q.distance)}),h==null&&Et.vertical.length>0&&(h=Et.vertical[0].position,u=Math.min(o.y,z.y),d=Math.max(a.y,Z.y)-u),g==null&&Et.horizontal.length>0&&(g=Et.horizontal[0].position,p=Math.min(o.x,z.x),m=Math.max(a.x,Z.x)-p),h!=null&&g!=null}),this.hide();let x=0,E=0;(g!=null||h!=null)&&(h!=null&&(x=C.indexOf("right")!==-1?h-a.x:r.x-h),g!=null&&(E=C.indexOf("bottom")!==-1?g-a.y:r.y-g));let B=0,v=0;if(l%90===0)l===90||l===270?(B=E,v=x):(B=x,v=E);else{const R=l>=0&&l<90?1:l>=90&&l<180?4:l>=180&&l<270?3:2;g!=null&&h!=null&&(x<E?(E=0,g=void 0):(x=0,h=void 0));const z=It(l%90);x&&(B=R===3?x/Math.cos(z):x/Math.sin(z)),E&&(v=R===3?E/Math.cos(z):E/Math.sin(z));const J=R===1||R===3;switch(w){case"top":case"bottom":v=E?E/(J?Math.cos(z):Math.sin(z)):x/(J?Math.sin(z):Math.cos(z));break;case"left":case"right":B=x?x/(J?Math.cos(z):Math.sin(z)):E/(J?Math.sin(z):Math.cos(z));break}}switch(w){case"top":case"bottom":B=0;break;case"left":case"right":v=0;break}const M=this.graph.getGridSize();let I=Math.max(i.width+B,M),T=Math.max(i.height+v,M);e.minWidth&&e.minWidth>M&&(I=Math.max(I,e.minWidth)),e.minHeight&&e.minHeight>M&&(T=Math.max(T,e.minHeight)),e.maxWidth&&(I=Math.min(I,e.maxWidth)),e.maxHeight&&(T=Math.min(T,e.maxHeight)),e.preserveAspectRatio&&(v<B?T=I*(i.height/i.width):I=T*(i.width/i.height)),(I!==i.width||T!==i.height)&&(t.resize(I,T,{direction:y,relativeDirection:w,trueDirection:C,snapped:!0,snaplines:this.cid,restrict:this.getRestrictArea(n)}),d&&(d+=T-i.height),m&&(m+=I-i.width));const k=t.getBBox().bbox(l);h&&Math.abs(k.x-h)>1&&Math.abs(k.width+k.x-h)>1&&(h=void 0),g&&Math.abs(k.y-g)>1&&Math.abs(k.height+k.y-g)>1&&(g=void 0),this.update({verticalLeft:h,verticalTop:u,verticalHeight:d,horizontalTop:g,horizontalLeft:p,horizontalWidth:m})}}}snapOnMoving({view:t,e,x:n,y:i}){const o=t.getEventData(e).delegatedView||t;if(!this.isNodeMovable(o))return;const r=o.cell,a=r.getSize(),l=r.getPosition(),c=new P(n-this.offset.x,i-this.offset.y,a.width,a.height),h=r.getAngle(),u=c.getCenter(),d=c.bbox(h),g=d.getTopLeft(),p=d.getBottomRight(),m=this.options.tolerance||0;let b,y,C,w,x,E,B=0,v=0;if(this.model.getNodes().some(M=>{if(this.isIgnored(r,M))return!1;const I=M.getBBox().bbox(M.getAngle()),T=I.getCenter(),k=I.getTopLeft(),R=I.getBottomRight();return b==null&&(Math.abs(T.x-u.x)<m?(b=T.x,B=.5):Math.abs(k.x-g.x)<m?(b=k.x,B=0):Math.abs(k.x-p.x)<m?(b=k.x,B=1):Math.abs(R.x-p.x)<m?(b=R.x,B=1):Math.abs(R.x-g.x)<m&&(b=R.x),b!=null&&(y=Math.min(d.y,I.y),C=Math.max(p.y,R.y)-y)),w==null&&(Math.abs(T.y-u.y)<m?(w=T.y,v=.5):Math.abs(k.y-g.y)<m?w=k.y:Math.abs(k.y-p.y)<m?(w=k.y,v=1):Math.abs(R.y-p.y)<m?(w=R.y,v=1):Math.abs(R.y-g.y)<m&&(w=R.y),w!=null&&(x=Math.min(d.x,I.x),E=Math.max(p.x,R.x)-x)),b!=null&&w!=null}),this.hide(),w!=null||b!=null){w!=null&&(d.y=w-v*d.height),b!=null&&(d.x=b-B*d.width);const M=d.getCenter(),I=M.x-c.width/2,T=M.y-c.height/2,k=I-l.x,R=T-l.y;(k!==0||R!==0)&&(r.translate(k,R,{snapped:!0,restrict:this.getRestrictArea(o)}),E&&(E+=k),C&&(C+=R)),this.update({verticalLeft:b,verticalTop:y,verticalHeight:C,horizontalTop:w,horizontalLeft:x,horizontalWidth:E})}}isIgnored(t,e){return e.id===t.id||e.isDescendantOf(t)||!this.filter(e)}filter(t){const e=this.options.filter;return Array.isArray(e)?e.some(n=>typeof n=="string"?t.shape===n:t.id===n.id):typeof e=="function"?D(e,this.graph,t):!0}update(t){if(t.horizontalTop){const e=this.graph.localToGraph(new A(t.horizontalLeft,t.horizontalTop)),n=this.graph.localToGraph(new A(t.horizontalLeft+t.horizontalWidth,t.horizontalTop));this.horizontal.setAttributes({x1:this.options.sharp?`${e.x}`:"0",y1:`${e.y}`,x2:this.options.sharp?`${n.x}`:"100%",y2:`${n.y}`,display:"inherit"})}else this.horizontal.setAttribute("display","none");if(t.verticalLeft){const e=this.graph.localToGraph(new A(t.verticalLeft,t.verticalTop)),n=this.graph.localToGraph(new A(t.verticalLeft,t.verticalTop+t.verticalHeight));this.vertical.setAttributes({x1:`${e.x}`,y1:this.options.sharp?`${e.y}`:"0",x2:`${n.x}`,y2:this.options.sharp?`${n.y}`:"100%",display:"inherit"})}else this.vertical.setAttribute("display","none");this.show()}resetTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}show(){return this.resetTimer(),this.container.parentNode==null&&this.graph.container.appendChild(this.container),this}hide(){this.resetTimer(),this.vertical.setAttribute("display","none"),this.horizontal.setAttribute("display","none");const t=this.options.clean,e=typeof t=="number"?t:t!==!1?3e3:0;return e>0&&(this.timer=window.setTimeout(()=>{this.container.parentNode!==null&&this.unmount()},e)),this}onRemove(){this.stopListening(),this.hide()}dispose(){this.remove()}}H([q()],ld.prototype,"dispose",null);const VE=`.x6-widget-snapline {
669
+ position: absolute;
670
+ top: 0;
671
+ right: 0;
672
+ bottom: 0;
673
+ left: 0;
674
+ pointer-events: none;
675
+ }
676
+ .x6-widget-snapline-vertical,
677
+ .x6-widget-snapline-horizontal {
678
+ stroke: #2ecc71;
679
+ stroke-width: 1px;
680
+ }
681
+ `;S.prototype.isSnaplineEnabled=function(){const s=this.getPlugin("snapline");return s?s.isEnabled():!1},S.prototype.enableSnapline=function(){const s=this.getPlugin("snapline");return s&&s.enable(),this},S.prototype.disableSnapline=function(){const s=this.getPlugin("snapline");return s&&s.disable(),this},S.prototype.toggleSnapline=function(){const s=this.getPlugin("snapline");return s&&s.toggleEnabled(),this},S.prototype.hideSnapline=function(){const s=this.getPlugin("snapline");return s&&s.hide(),this},S.prototype.setSnaplineFilter=function(s){const t=this.getPlugin("snapline");return t&&t.setFilter(s),this},S.prototype.isSnaplineOnResizingEnabled=function(){const s=this.getPlugin("snapline");return s?s.isOnResizingEnabled():!1},S.prototype.enableSnaplineOnResizing=function(){const s=this.getPlugin("snapline");return s&&s.enableOnResizing(),this},S.prototype.disableSnaplineOnResizing=function(){const s=this.getPlugin("snapline");return s&&s.disableOnResizing(),this},S.prototype.toggleSnaplineOnResizing=function(s){const t=this.getPlugin("snapline");return t&&t.toggleOnResizing(s),this},S.prototype.isSharpSnapline=function(){const s=this.getPlugin("snapline");return s?s.isSharp():!1},S.prototype.enableSharpSnapline=function(){const s=this.getPlugin("snapline");return s&&s.enableSharp(),this},S.prototype.disableSharpSnapline=function(){const s=this.getPlugin("snapline");return s&&s.disableSharp(),this},S.prototype.toggleSharpSnapline=function(s){const t=this.getPlugin("snapline");return t&&t.toggleSharp(s),this},S.prototype.getSnaplineTolerance=function(){const s=this.getPlugin("snapline");if(s)return s.getTolerance()},S.prototype.setSnaplineTolerance=function(s){const t=this.getPlugin("snapline");return t&&t.setTolerance(s),this};class cd extends Cn{constructor(t={}){super(),this.name="snapline",this.options=Object.assign({enabled:!0,tolerance:10},t),Me(this.name,VE)}init(t){this.snaplineImpl=new ld(Object.assign(Object.assign({},this.options),{graph:t}))}isEnabled(){return!this.snaplineImpl.disabled}enable(){this.snaplineImpl.enable()}disable(){this.snaplineImpl.disable()}toggleEnabled(t){if(t!=null)t!==this.isEnabled()&&(t?this.enable():this.disable());else return this.isEnabled()?this.disable():this.enable(),this}hide(){return this.snaplineImpl.hide(),this}setFilter(t){return this.snaplineImpl.setFilter(t),this}isOnResizingEnabled(){return this.snaplineImpl.options.resizing===!0}enableOnResizing(){return this.snaplineImpl.options.resizing=!0,this}disableOnResizing(){return this.snaplineImpl.options.resizing=!1,this}toggleOnResizing(t){return t!=null?t!==this.isOnResizingEnabled()&&(t?this.enableOnResizing():this.disableOnResizing()):this.isOnResizingEnabled()?this.disableOnResizing():this.enableOnResizing(),this}isSharp(){return this.snaplineImpl.options.sharp===!0}enableSharp(){return this.snaplineImpl.options.sharp=!0,this}disableSharp(){return this.snaplineImpl.options.sharp=!1,this}toggleSharp(t){return t!=null?t!==this.isSharp()&&(t?this.enableSharp():this.disableSharp()):this.isSharp()?this.disableSharp():this.enableSharp(),this}getTolerance(){return this.snaplineImpl.options.tolerance}setTolerance(t){return this.snaplineImpl.options.tolerance=t,this}captureCursorOffset(t){this.snaplineImpl.captureCursorOffset(t)}snapOnMoving(t){this.snaplineImpl.snapOnMoving(t)}dispose(){this.snaplineImpl.dispose(),Be(this.name)}}H([q()],cd.prototype,"dispose",null);const GE=`.x6-widget-transform {
682
+ position: absolute;
683
+ box-sizing: content-box !important;
684
+ margin: -5px 0 0 -5px;
685
+ padding: 4px;
686
+ border: 1px dashed #000;
687
+ border-radius: 5px;
688
+ user-select: none;
689
+ pointer-events: none;
690
+ }
691
+ .x6-widget-transform > div {
692
+ position: absolute;
693
+ box-sizing: border-box;
694
+ background-color: #fff;
695
+ border: 1px solid #000;
696
+ transition: background-color 0.2s;
697
+ pointer-events: auto;
698
+ -webkit-user-drag: none;
699
+ user-drag: none;
700
+ /* stylelint-disable-line */
701
+ }
702
+ .x6-widget-transform > div:hover {
703
+ background-color: #d3d3d3;
704
+ }
705
+ .x6-widget-transform-cursor-n {
706
+ cursor: n-resize;
707
+ }
708
+ .x6-widget-transform-cursor-s {
709
+ cursor: s-resize;
710
+ }
711
+ .x6-widget-transform-cursor-e {
712
+ cursor: e-resize;
713
+ }
714
+ .x6-widget-transform-cursor-w {
715
+ cursor: w-resize;
716
+ }
717
+ .x6-widget-transform-cursor-ne {
718
+ cursor: ne-resize;
719
+ }
720
+ .x6-widget-transform-cursor-nw {
721
+ cursor: nw-resize;
722
+ }
723
+ .x6-widget-transform-cursor-se {
724
+ cursor: se-resize;
725
+ }
726
+ .x6-widget-transform-cursor-sw {
727
+ cursor: sw-resize;
728
+ }
729
+ .x6-widget-transform-resize {
730
+ width: 10px;
731
+ height: 10px;
732
+ border-radius: 6px;
733
+ }
734
+ .x6-widget-transform-resize[data-position='top-left'] {
735
+ top: -5px;
736
+ left: -5px;
737
+ }
738
+ .x6-widget-transform-resize[data-position='top-right'] {
739
+ top: -5px;
740
+ right: -5px;
741
+ }
742
+ .x6-widget-transform-resize[data-position='bottom-left'] {
743
+ bottom: -5px;
744
+ left: -5px;
745
+ }
746
+ .x6-widget-transform-resize[data-position='bottom-right'] {
747
+ right: -5px;
748
+ bottom: -5px;
749
+ }
750
+ .x6-widget-transform-resize[data-position='top'] {
751
+ top: -5px;
752
+ left: 50%;
753
+ margin-left: -5px;
754
+ }
755
+ .x6-widget-transform-resize[data-position='bottom'] {
756
+ bottom: -5px;
757
+ left: 50%;
758
+ margin-left: -5px;
759
+ }
760
+ .x6-widget-transform-resize[data-position='left'] {
761
+ top: 50%;
762
+ left: -5px;
763
+ margin-top: -5px;
764
+ }
765
+ .x6-widget-transform-resize[data-position='right'] {
766
+ top: 50%;
767
+ right: -5px;
768
+ margin-top: -5px;
769
+ }
770
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='top'],
771
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='bottom'],
772
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='left'],
773
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='right'] {
774
+ display: none;
775
+ }
776
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='bottom'],
777
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='left'],
778
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='right'],
779
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='top'] {
780
+ display: none;
781
+ }
782
+ .x6-widget-transform.no-resize .x6-widget-transform-resize {
783
+ display: none;
784
+ }
785
+ .x6-widget-transform-rotate {
786
+ top: -20px;
787
+ left: -20px;
788
+ width: 12px;
789
+ height: 12px;
790
+ border-radius: 6px;
791
+ cursor: crosshair;
792
+ }
793
+ .x6-widget-transform.no-rotate .x6-widget-transform-rotate {
794
+ display: none;
795
+ }
796
+ .x6-widget-transform-active {
797
+ border-color: transparent;
798
+ pointer-events: all;
799
+ }
800
+ .x6-widget-transform-active > div {
801
+ display: none;
802
+ }
803
+ .x6-widget-transform-active > .x6-widget-transform-active-handle {
804
+ display: block;
805
+ background-color: #808080;
806
+ }
807
+ `,hd="has-widget-transform",Mn=["nw","n","ne","e","se","s","sw","w"],We=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],YE={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,rotateGrid:15,rotatable:!0,preserveAspectRatio:!1,orthogonalResizing:!0,restrictedResizing:!1,autoScrollOnResizing:!0,allowReverse:!0};class ud extends Ft{get model(){return this.graph.model}get view(){return this.graph.renderer.findViewByCell(this.node)}get containerClassName(){return this.prefixClassName("widget-transform")}get resizeClassName(){return`${this.containerClassName}-resize`}get rotateClassName(){return`${this.containerClassName}-rotate`}constructor(t,e,n){super(),this.node=e,this.graph=n,this.options=Object.assign(Object.assign({},YE),t),this.render(),this.startListening()}startListening(){this.delegateEvents({[`mousedown .${this.resizeClassName}`]:"startResizing",[`touchstart .${this.resizeClassName}`]:"startResizing",[`mousedown .${this.rotateClassName}`]:"startRotating",[`touchstart .${this.rotateClassName}`]:"startRotating"}),this.model.on("*",this.update,this),this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this),this.node.on("removed",this.remove,this),this.model.on("reseted",this.remove,this),this.view.on("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.on("cell:knob:mouseup",this.onKnobMouseUp,this)}stopListening(){this.undelegateEvents(),this.model.off("*",this.update,this),this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this),this.node.off("removed",this.remove,this),this.model.off("reseted",this.remove,this),this.view.off("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.off("cell:knob:mouseup",this.onKnobMouseUp,this)}renderHandles(){this.container=document.createElement("div");const t=document.createElement("div");V(t,"draggable","false");const e=t.cloneNode(!0);O(e,this.rotateClassName);const n=We.map(i=>{const o=t.cloneNode(!0);return O(o,this.resizeClassName),V(o,"data-position",i),o});this.empty(),Mt(this.container,[...n,e])}render(){return this.renderHandles(),this.view&&this.view.addClass(hd),O(this.container,this.containerClassName),ie(this.container,"no-orth-resize",this.options.preserveAspectRatio||!this.options.orthogonalResizing),ie(this.container,"no-resize",!this.options.resizable),ie(this.container,"no-rotate",!this.options.rotatable),this.options.className&&O(this.container,this.options.className),this.graph.container.appendChild(this.container),this.update()}update(){const t=this.graph.matrix(),e=this.node.getBBox();e.x*=t.a,e.x+=t.e,e.y*=t.d,e.y+=t.f,e.width*=t.a,e.height*=t.d;const n=Tt(this.node.getAngle()),i=n!==0?`rotate(${n}deg)`:"";return $(this.container,{transform:i,width:e.width,height:e.height,left:e.x,top:e.y}),this.updateResizerDirections(),this}remove(){return this.view&&this.view.removeClass(hd),super.remove()}onKnobMouseDown(){this.startHandle()}onKnobMouseUp(){this.stopHandle()}updateResizerDirections(){const t=Tt(this.node.getAngle()),e=Math.floor(t*(Mn.length/360));if(e!==this.prevShift){const n=Mn.slice(e).concat(Mn.slice(0,e)),i=r=>`${this.containerClassName}-cursor-${r}`;this.container.querySelectorAll(`.${this.resizeClassName}`).forEach((r,a)=>{st(r,Mn.map(l=>i(l)).join(" ")),O(r,i(n[a]))}),this.prevShift=e}}getTrueDirection(t){const e=Tt(this.node.getAngle());let n=We.indexOf(t);return n+=Math.floor(e*(We.length/360)),n%=We.length,We[n]}toValidResizeDirection(t){return{top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[t]||t}startResizing(t){t.stopPropagation(),this.model.startBatch("resize",{cid:this.cid});const e=V(t.target,"data-position");this.prepareResizing(t,e),this.startAction(t)}prepareResizing(t,e){const n=this.getTrueDirection(e);let i=0,o=0;e.split("-").forEach(c=>{i={left:-1,right:1}[c]||i,o={top:-1,bottom:1}[c]||o});const r=this.toValidResizeDirection(e),a={"top-right":"bottomLeft","top-left":"bottomRight","bottom-left":"topRight","bottom-right":"topLeft"}[r],l=Tt(this.node.getAngle());this.setEventData(t,{selector:a,direction:r,trueDirection:n,relativeDirection:e,angle:l,resizeX:i,resizeY:o,action:"resizing"})}startRotating(t){t.stopPropagation(),this.model.startBatch("rotate",{cid:this.cid});const e=this.node.getBBox().getCenter(),n=this.normalizeEvent(t),i=this.graph.snapToGrid(n.clientX,n.clientY);this.setEventData(t,{center:e,action:"rotating",angle:Tt(this.node.getAngle()),start:A.create(i).theta(e)}),this.startAction(t)}onMouseMove(t){const e=this.graph.findViewByCell(this.node);let n=this.getEventData(t);if(n.action){const i=this.normalizeEvent(t);let o=i.clientX,r=i.clientY;const a=this.graph.getPlugin("scroller"),l=this.options.restrictedResizing;if(l===!0||typeof l=="number"){const g=l===!0?0:l,p=a?Math.max(g,8):g,m=this.graph.container.getBoundingClientRect();o=Je(o,m.left+p,m.right-p),r=Je(r,m.top+p,m.bottom-p)}else this.options.autoScrollOnResizing&&a&&a.autoScroll(o,r);const c=this.graph.snapToGrid(o,r),h=this.graph.getGridSize(),u=this.node,d=this.options;if(n.action==="resizing"){n=n,n.resized||(e&&(e.addClass("node-resizing"),this.notify("node:resize",t,e)),n.resized=!0);const g=u.getBBox(),p=A.create(c).rotate(n.angle,g.getCenter()).diff(g[n.selector]);let m=n.resizeX?p.x*n.resizeX:g.width,b=n.resizeY?p.y*n.resizeY:g.height;const y=m,C=b;if(m=ne(m,h),b=ne(b,h),m=Math.max(m,d.minWidth||h),b=Math.max(b,d.minHeight||h),m=Math.min(m,d.maxWidth||1/0),b=Math.min(b,d.maxHeight||1/0),d.preserveAspectRatio){const x=g.width*b/g.height,E=g.height*m/g.width;m<x?b=E:m=x}const w=n.relativeDirection;if(d.allowReverse&&(y<=-m||C<=-b)){let x;w==="left"?y<=-m&&(x="right"):w==="right"?y<=-m&&(x="left"):w==="top"?C<=-b&&(x="bottom"):w==="bottom"?C<=-b&&(x="top"):w==="top-left"?y<=-m&&C<=-b?x="bottom-right":y<=-m?x="top-right":C<=-b&&(x="bottom-left"):w==="top-right"?y<=-m&&C<=-b?x="bottom-left":y<=-m?x="top-left":C<=-b&&(x="bottom-right"):w==="bottom-left"?y<=-m&&C<=-b?x="top-right":y<=-m?x="bottom-right":C<=-b&&(x="top-left"):w==="bottom-right"&&(y<=-m&&C<=-b?x="top-left":y<=-m?x="bottom-left":C<=-b&&(x="top-right"));const E=x;this.stopHandle();const B=this.container.querySelector(`.${this.resizeClassName}[data-position="${E}"]`);this.startHandle(B),this.prepareResizing(t,E),this.onMouseMove(t)}if(g.width!==m||g.height!==b){const x={ui:!0,direction:n.direction,relativeDirection:n.relativeDirection,trueDirection:n.trueDirection,minWidth:d.minWidth,minHeight:d.minHeight,maxWidth:d.maxWidth,maxHeight:d.maxHeight,preserveAspectRatio:d.preserveAspectRatio===!0};u.resize(m,b,x),this.notify("node:resizing",t,e)}}else if(n.action==="rotating"){n=n,n.rotated||(e&&(e.addClass("node-rotating"),this.notify("node:rotate",t,e)),n.rotated=!0);const g=u.getAngle(),p=n.start-A.create(c).theta(n.center);let m=n.angle+p;d.rotateGrid&&(m=ne(m,d.rotateGrid)),m=Tt(m),g!==m&&(u.rotate(m,{absolute:!0}),this.notify("node:rotating",t,e))}}}onMouseUp(t){const e=this.getEventData(t);e.action&&(this.stopAction(t),this.model.stopBatch(e.action==="resizing"?"resize":"rotate",{cid:this.cid}))}startHandle(t){if(this.handle=t||null,O(this.container,`${this.containerClassName}-active`),t){O(t,`${this.containerClassName}-active-handle`);const e=t.getAttribute("data-position");if(e){const n=Mn[We.indexOf(e)];O(this.container,`${this.containerClassName}-cursor-${n}`)}}}stopHandle(){if(st(this.container,`${this.containerClassName}-active`),this.handle){st(this.handle,`${this.containerClassName}-active-handle`);const t=this.handle.getAttribute("data-position");if(t){const e=Mn[We.indexOf(t)];st(this.container,`${this.containerClassName}-cursor-${e}`)}this.handle=null}}startAction(t){this.startHandle(t.target),this.graph.view.undelegateEvents(),this.delegateDocumentEvents(ru,t.data)}stopAction(t){this.stopHandle(),this.undelegateDocumentEvents(),this.graph.view.delegateEvents();const e=this.graph.findViewByCell(this.node),n=this.getEventData(t);e&&(e.removeClass(`node-${n.action}`),n.action==="resizing"&&n.resized?this.notify("node:resized",t,e):n.action==="rotating"&&n.rotated&&this.notify("node:rotated",t,e))}notify(t,e,n,i={}){if(n){const o=n.graph,r=o.view.normalizeEvent(e),a=o.snapToGrid(r.clientX,r.clientY);this.trigger(t,Object.assign({e:r,view:n,node:n.cell,cell:n.cell,x:a.x,y:a.y},i))}}dispose(){this.stopListening(),this.remove(),this.off()}}H([q()],ud.prototype,"dispose",null),S.prototype.createTransformWidget=function(s){const t=this.getPlugin("transform");return t&&t.createWidget(s),this},S.prototype.clearTransformWidgets=function(){const s=this.getPlugin("transform");return s&&s.clearWidgets(),this};class dd extends Ot{constructor(t={}){super(),this.name="transform",this.widgets=new Map,this.disabled=!1,this.options=t,Me(this.name,GE)}init(t){this.graph=t,!this.disabled&&this.startListening()}startListening(){this.graph.on("node:click",this.onNodeClick,this),this.graph.on("blank:mousedown",this.onBlankMouseDown,this)}stopListening(){this.graph.off("node:click",this.onNodeClick,this),this.graph.off("blank:mousedown",this.onBlankMouseDown,this)}enable(){this.disabled&&(this.disabled=!1,this.startListening())}disable(){this.disabled||(this.disabled=!0,this.stopListening())}isEnabled(){return!this.disabled}createWidget(t){this.clearWidgets();const e=this.createTransform(t);e&&(this.widgets.set(t,e),e.on("*",(n,i)=>{this.trigger(n,i),this.graph.trigger(n,i)}))}onNodeClick({node:t}){this.createWidget(t)}onBlankMouseDown(){this.clearWidgets()}createTransform(t){const e=this.getTransformOptions(t);return e.resizable||e.rotatable?new ud(e,t,this.graph):null}parseOptionGroup(t,e,n){const i={};return Object.keys(n||{}).forEach(o=>{const r=n[o];i[o]=typeof r=="function"?r.call(t,e):r}),i}getTransformOptions(t){this.options.resizing||(this.options.resizing={enabled:!1}),this.options.rotating||(this.options.rotating={enabled:!1}),typeof this.options.resizing=="boolean"&&(this.options.resizing={enabled:this.options.resizing}),typeof this.options.rotating=="boolean"&&(this.options.rotating={enabled:this.options.rotating});const e=this.parseOptionGroup(this.graph,t,this.options.resizing),n=this.parseOptionGroup(this.graph,t,this.options.rotating);return{resizable:!!e.enabled,minWidth:e.minWidth||0,maxWidth:e.maxWidth||Number.MAX_SAFE_INTEGER,minHeight:e.minHeight||0,maxHeight:e.maxHeight||Number.MAX_SAFE_INTEGER,orthogonalResizing:typeof e.orthogonal=="boolean"?e.orthogonal:!0,restrictedResizing:!!e.restrict,autoScrollOnResizing:typeof e.autoScroll=="boolean"?e.autoScroll:!0,preserveAspectRatio:!!e.preserveAspectRatio,allowReverse:typeof e.allowReverse=="boolean"?e.allowReverse:!0,rotatable:!!n.enabled,rotateGrid:n.grid||15}}clearWidgets(){this.widgets.forEach((t,e)=>{this.graph.getCellById(e.id)&&t.dispose()}),this.widgets.clear()}dispose(){this.clearWidgets(),this.stopListening(),this.off(),Be(this.name)}}H([q()],dd.prototype,"dispose",null);function gd(s){const t=Pt.getForeignObjectMarkup();return s?[{tagName:s,selector:"body"},t]:[t]}S.registerNode("vue-shape",{view:"vue-shape-view",markup:gd(),attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}},propHooks(s){if(s.markup==null){const t=s.primer;if(t){s.markup=gd(t);let e={};switch(t){case"circle":e={refCx:"50%",refCy:"50%",refR:"50%"};break;case"ellipse":e={refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"};break}s.attrs=ct({},{body:Object.assign({refWidth:null,refHeight:null},e)},s.attrs||{})}}return s}},!0);var HE=function(s,t){var e={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&t.indexOf(n)<0&&(e[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(e[n[i]]=s[n[i]]);return e};const fd={};function Mr(s){const{shape:t,component:e,inherit:n}=s,i=HE(s,["shape","component","inherit"]);if(!t)throw new Error("should specify shape in config");fd[t]={component:e},S.registerNode(t,Object.assign({inherit:n||"vue-shape"},i),!0)}let Ei=!1;const Os=f.reactive({});function qE(s,t,e,n,i){Ei&&(Os[s]=f.markRaw(f.defineComponent({render:()=>f.h(f.Teleport,{to:e},[f.h(t,{node:n,graph:i})]),provide:()=>({getNode:()=>n,getGraph:()=>i})})))}function WE(s){Ei&&delete Os[s]}function pd(){return Ei}let Ns=null;function md(){return Ns&&Ei?null:(Ei=!0,Ns=f.defineComponent({setup(){return f.onBeforeUnmount(()=>{Ns=null}),()=>f.h(f.Fragment,{},Object.keys(Os).map(s=>f.h(Os[s])))}}),Ns)}class Xe extends qt{getComponentContainer(){return this.selectors&&this.selectors.foContent}confirmUpdate(t){const e=super.confirmUpdate(t);return this.handleAction(e,Xe.action,()=>{this.renderVueComponent()})}targetId(){return`${this.graph.view.cid}:${this.cell.id}`}renderVueComponent(){this.unmountVueComponent();const t=this.getComponentContainer(),e=this.cell,n=this.graph;if(t){const{component:i}=fd[e.shape];i&&(pd()?qE(this.targetId(),i,t,e,n):(this.vm=f.createApp({render(){return f.h(i,{node:e,graph:n})},provide(){return{getNode:()=>e,getGraph:()=>n}}}),this.vm.mount(t)))}}unmountVueComponent(){const t=this.getComponentContainer();return this.vm&&(this.vm.unmount(),this.vm=null),t&&(t.innerHTML=""),t}onMouseDown(t,e,n){const i=t.target;if(i.tagName.toLowerCase()==="input"){const r=i.getAttribute("type");if(r==null||["text","password","number","email","search","tel","url"].includes(r))return}super.onMouseDown(t,e,n)}unmount(){return pd()&&WE(this.targetId()),this.unmountVueComponent(),super.unmount(),this}}Xe.action="vue",Xe.config({bootstrap:[Xe.action],actions:{component:Xe.action}}),qt.registry.register("vue-shape-view",Xe,!0);const Kt=(s,t)=>{const e=s.__vccOpts||s;for(const[n,i]of t)e[n]=i;return e},XE=Kt({__name:"vueNode",setup(s){f.useCssVars(h=>({v237d1efc:e.value.opacity,v0a584c48:e.value.borderStyle,v570a5d7c:e.value.borderWidth+"px",v0c2028e4:e.value.borderColor,v26d534e6:e.value.borderRadius+"px",a54def68:e.value.backgroundColor,a4a6fb78:e.value.backgroundImage}));const t=f.inject("getNode"),e=f.ref({}),n=f.ref(128),i=f.ref(128),o=f.computed(()=>Math.min(n.value,i.value)),r=({current:h})=>{n.value=h.width,i.value=h.height},a=({current:h})=>{console.log(h),e.value={...e.value,...h}};let l=null,c=null;return f.onMounted(()=>{l=t(),n.value=l.size().width,i.value=l.size().height,e.value=l.getData(),l.on("change:data",a),l.on("change:size",r),c=setInterval(()=>{const{progress:h}=l.getData();l.setData({progress:(h+10)%100})},500)}),f.onBeforeUnmount(()=>{l.off("change:data",a),l.off("change:size",r),c&&clearInterval(c)}),(h,u)=>{const d=f.resolveComponent("el-progress");return f.openBlock(),f.createElementBlock("div",{style:f.normalizeStyle({width:n.value+"px",height:i.value+"px"}),class:"vueNode"},[f.createVNode(d,{type:"circle",percentage:e.value.progress,width:o.value},null,8,["percentage","width"])],4)}}},[["__scopeId","data-v-664fcc5f"]]),_E=["innerHTML"],$E=Kt({__name:"svgNode",setup(s){const t=f.inject("getNode"),e=f.ref(50),n=f.ref(50),i=f.ref(""),o=f.ref("#ffffff"),r=f.computed(()=>Math.min(e.value,n.value)),a=({current:c})=>{e.value=c.width,n.value=c.height};let l=null;return f.onMounted(()=>{l=t(),e.value=l.size().width,n.value=l.size().height,i.value=l.getData().icon,o.value=l.getData().value,l.on("change:size",a)}),f.onBeforeUnmount(()=>{l.off("change:size",a)}),(c,h)=>(f.openBlock(),f.createElementBlock("div",{style:f.normalizeStyle({width:e.value+"px",height:n.value+"px"}),class:"svgNode"},[f.createElementVNode("div",{class:"svg-icon",innerHTML:i.value,style:f.normalizeStyle({color:o.value,width:r.value+"px",height:r.value+"px"})},null,12,_E)],4))}},[["__scopeId","data-v-a6ab1817"]]),ZE=Kt({__name:"iconfontNode",setup(s){const t=f.inject("getNode"),e=f.ref(50),n=f.ref(50),i=f.ref(""),o=f.ref("#ffffff"),r=f.computed(()=>Math.min(e.value,n.value)),a=({current:c})=>{e.value=c.width,n.value=c.height};let l=null;return f.onMounted(()=>{l=t(),e.value=l.size().width,n.value=l.size().height,i.value=l.getData().icon,o.value=l.getData().color,l.on("change:size",a)}),f.onBeforeUnmount(()=>{l.off("change:size",a)}),(c,h)=>(f.openBlock(),f.createElementBlock("div",{style:f.normalizeStyle({width:e.value+"px",height:n.value+"px"}),class:"iconfontNode"},[f.createElementVNode("div",{style:f.normalizeStyle({width:r.value+"px",height:r.value+"px",lineHeight:r.value+"px"})},[f.createElementVNode("i",{class:f.normalizeClass(["iconfont",i.value]),style:f.normalizeStyle({color:o.value,fontSize:r.value+"px"})},null,6)],4)],4))}},[["__scopeId","data-v-777768b5"]]),Br={borderStyle:"none",borderRadius:0,borderWidth:0,borderColor:"#5F95FF",opacity:1,backgroundImage:"none",backgroundColor:"transparent"},Ir=()=>{Mr({shape:"icon-node",width:50,height:50,data:{...Br,icon:null},component:ZE}),Mr({shape:"vue-node",width:50,height:50,data:{...Br,progress:70},component:XE}),Mr({shape:"svg-node",width:50,height:50,data:{...Br,svg:null},component:$E})},bd={Blank:"blank"},Rs=ge.defineStore("property",{state:()=>({targetType:bd.Blank,cellId:null,tabs:["画布"],activeTab:0}),getters:{},actions:{setTarget(s,t){this.targetType=s,s===bd.Blank?this.tabs=["画布"]:this.tabs=["外观","数据","动画","状态","交互"],this.activeTab=0,this.cellId=t}}}),Pr={backgroundColor:"#1e1e1e",backgroundImage:null},Xt=ge.defineStore("editor-graph",{state:()=>({el:null,graph:null,dnd:null,style:{...Pr,width:1920,height:1080},name:"",id:"",zoom:100}),getters:{hasGraph:s=>!!s.graph},actions:{init(){if(this.el===null)return;this.graph&&this.graph.dispose(),this.graph=new S({container:this.el,autoResize:!0,mousewheel:{enabled:!0,factor:.1},panning:!1,scaling:{min:.5,max:2},background:{color:"#000000"},grid:{size:5,visible:!0,type:"mesh",args:{color:"rgba(100, 100, 100, 0.6)",thickness:1}},translating:{restrict:!0},connecting:{router:"orth",connector:{name:"normal"},args:{padding:0,direction:"H"},anchor:"center",connectionPoint:"anchor",allowBlank:!0,allowLoop:!1,allowMulti:!1,snap:{radius:20},createEdge(){return new ou({attrs:{line:{stroke:"#03e6f7ff",strokeWidth:2,targetMarker:null}},zIndex:0})},validateConnection({targetMagnet:t}){return!!t}},highlighting:{magnetAdsorbed:{name:"stroke",args:{attrs:{fill:"#5F95FF",stroke:"#5F95FF"}}}}}),this.graph.use(new cd({enabled:!0}));const s=new rd({pageWidth:this.style.width,pageHeight:this.style.height,enabled:!0,pannable:!0,autoResize:!1});this.graph.use(s),this.dnd=new vr({target:this.graph,validateNode(){return!0}}),this.graph.use(new dd({resizing:!0,rotating:!0})),this.graph.use(new Au({enabled:!0})),this.graph.use(new _u({enabled:!0,global:!0})).use(new td({rubberband:!0,showNodeSelectionBox:!0,showEdgeSelectionBox:!1,modifiers:["meta","shift","ctrl"]})).use(new Yu),Ir(),this.initEvent()},loadMenu({name:s,id:t,value:e,style:n}){this.graph&&(this.name=s,this.id=t,this.graph.fromJSON(e||{}),n?this.style={...this.style,...Pr,...n}:this.style={...this.style,...Pr},setTimeout(()=>{const i=Math.min(1280/this.style.width,840/this.style.height);console.log(i,this.style.width,this.style.height),this.graph.zoomTo(i),this.graph.center(),console.log(this.graph.getScrollbarPosition()),Rs().setTarget("blank",null)},100))},setZoom(s){this.zoom=Number(s),this.graph.zoomTo(s)},updateSize(s,t,e){this.style.width=s,this.style.height=t,this.init(),setTimeout(()=>{e&&e()},100)},initEvent(){this.graph.on("node:moving",e=>{}),this.graph.on("scale",({sx:e,sy:n})=>{console.log(e,n),this.zoom=Number((e*100).toFixed(0))});const s=Rs();this.graph.on("blank:click",({e,x:n,y:i})=>{console.log("Blank click at:",n,i,e),s.setTarget("blank",null)}),this.graph.on("edge:click",({e,x:n,y:i,edge:o})=>{console.log("edge:click",n,i,o.id),s.setTarget("edge",o.id)}),this.graph.on("node:click",({e,x:n,y:i,node:o})=>{console.log("node:click",n,i,o.id),s.setTarget("node",o.id)}),this.graph.on("edge:mouseenter",({cell:e})=>{e.addTools([{name:"vertices",args:{attrs:{fill:"#666"},modifiers:["meta","shift","ctrl"]}}])}),this.graph.on("edge:mouseleave",({cell:e})=>{e.hasTool("vertices")&&e.removeTool("vertices"),e.hasTool("source-arrowhead")&&e.removeTool("source-arrowhead"),e.hasTool("target-arrowhead")&&e.removeTool("target-arrowhead")}),this.graph.bindKey(["meta+c","ctrl+c"],()=>{const e=this.graph.getSelectedCells();return e.length&&this.graph.copy(e),!1}),this.graph.bindKey(["meta+x","ctrl+x"],()=>{const e=this.graph.getSelectedCells();return e.length&&this.graph.cut(e),!1}),this.graph.bindKey(["meta+v","ctrl+v"],()=>{if(!this.graph.isClipboardEmpty()){const e=this.graph.paste({offset:32});this.graph.cleanSelection(),this.graph.select(e)}return!1}),this.graph.bindKey(["meta+z","ctrl+z"],()=>(this.graph.canUndo()&&this.graph.undo(),!1)),this.graph.bindKey(["meta+shift+z","ctrl+shift+z"],()=>(this.graph.canRedo()&&this.graph.redo(),!1)),this.graph.bindKey(["meta+a","ctrl+a"],()=>{const e=this.graph.getNodes();e&&this.graph.select(e)}),this.graph.bindKey("backspace",()=>{const e=this.graph.getSelectedCells();e.length&&this.graph.removeCells(e)});const t=(e,n)=>{for(let i=0,o=e.length;i<o;i+=1)e[i].style.visibility=n?"visible":"hidden"};this.graph.on("node:mouseenter",()=>{const e=this.el.querySelectorAll(".x6-port-body");t(e,!0)}),this.graph.on("node:mouseleave",()=>{const e=this.el.querySelectorAll(".x6-port-body");t(e,!1)})}}}),Si=ge.defineStore("menus",{state:()=>({menus:[],current:[],services:{}}),getters:{currentMenu:s=>{var t;return(t=s.menus.find(e=>e.id===s.current[0]))==null?void 0:t.children.find(e=>e.id===s.current[1])}},actions:{async setCurrentMenu(s,t=!1){const e=Xt();if(JSON.stringify(s)===JSON.stringify(this.current)&&t===!1)return!1;this.current=s,e.loadMenu(await this.services.getMenu(s[1]))},async loadAllMenus(s=!1){var t;this.menus=await((t=this.services)==null?void 0:t.getAllMenus()),s&&this.menus[0]&&this.menus[0].children[0]&&this.setCurrentMenu([this.menus[0].id,this.menus[0].children[0].id])},async addMenu(s,t){var n;const e=await((n=this.services)==null?void 0:n.addMenu(s));this.loadAllMenus(),this.setCurrentMenu([e.parentId,e.id]),t&&t()},async saveMenu(s){const t=Xt(),e={name:t.name,id:this.current[1],parentId:this.current[0],style:t.style,value:t.graph.toJSON()};await this.services.saveMenus(e),s&&s()},clearMenu(s){const t=Xt(),e={name:t.name,id:this.current[1],parentId:this.current[0],style:t.style,value:{}};this.services.saveMenus(e),t.graph.clearCells(),s&&s()},async removeMenu(s){if(await this.services.removeMenu(this.current[1]),await this.loadAllMenus(),this.menus[0]&&this.menus[0].children[0])this.setCurrentMenu([this.menus[0].id,this.menus[0].children[0].id]);else{const t=Xt();t.graph.clearCells(),t.name="",t.id=""}s&&s()}}}),tS={class:"dialog-footer"},eS={__name:"addMenu",emits:["close"],setup(s,{emit:t}){const e=Si(),{menus:n}=ge.storeToRefs(e),i=t,o=f.ref(!1);function r(){o.value=!1,i("close")}const a=f.ref(null),l=f.ref({parent:null,parentNameNew:"",name:""}),c=f.ref({parent:[{required:!0,message:"请选择上级目录",trigger:"change"}],parentNameNew:{required:!0,message:"请输入一级目录名称",trigger:"blur"},name:[{required:!0,message:"请输入二级目录名称",trigger:"blur"}]}),h=f.ref(!1),u=async()=>{if(a.value){h.value=!0;try{await a.value.validate((d,g)=>{d?(console.log("submit!"),e.addMenu(l.value,()=>{r()})):console.log("error submit!",g)})}catch(d){console.log("表单验证失败:",d)}finally{h.value=!1}}};return f.onMounted(()=>{o.value=!0}),(d,g)=>{const p=f.resolveComponent("el-option"),m=f.resolveComponent("el-select"),b=f.resolveComponent("el-form-item"),y=f.resolveComponent("el-input"),C=f.resolveComponent("el-form"),w=f.resolveComponent("el-button"),x=f.resolveComponent("el-dialog");return f.openBlock(),f.createBlock(x,{modelValue:o.value,"onUpdate:modelValue":g[3]||(g[3]=E=>o.value=E),title:"新增目录",width:"500"},{footer:f.withCtx(()=>[f.createElementVNode("div",tS,[f.createVNode(w,{onClick:r},{default:f.withCtx(()=>[...g[4]||(g[4]=[f.createTextVNode("取消",-1)])]),_:1}),f.createVNode(w,{type:"primary",onClick:u},{default:f.withCtx(()=>[...g[5]||(g[5]=[f.createTextVNode("确定",-1)])]),_:1})])]),default:f.withCtx(()=>[f.createVNode(C,{ref_key:"formRef",ref:a,model:l.value,"label-width":"auto",style:{padding:"10px 20px"},rules:c.value},{default:f.withCtx(()=>[f.createVNode(b,{label:"上级目录",prop:"parent"},{default:f.withCtx(()=>[f.createVNode(m,{modelValue:l.value.parent,"onUpdate:modelValue":g[0]||(g[0]=E=>l.value.parent=E),placeholder:"请选择上级目录"},{default:f.withCtx(()=>[f.createVNode(p,{value:"0",label:"根目录"}),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(f.unref(n),E=>(f.openBlock(),f.createBlock(p,{key:E.id,label:E.name,value:E.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l.value.parent=="0"?(f.openBlock(),f.createBlock(b,{key:0,label:"一级目录名称",prop:"parentNameNew"},{default:f.withCtx(()=>[f.createVNode(y,{modelValue:l.value.parentNameNew,"onUpdate:modelValue":g[1]||(g[1]=E=>l.value.parentNameNew=E)},null,8,["modelValue"])]),_:1})):f.createCommentVNode("",!0),f.createVNode(b,{label:"二级目录名称",prop:"name"},{default:f.withCtx(()=>[f.createVNode(y,{modelValue:l.value.name,"onUpdate:modelValue":g[2]||(g[2]=E=>l.value.name=E)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}},nS=Kt({__name:"previewBox",emits:["close"],setup(s,{emit:t}){const e=Xt(),n=f.ref(null),i=md(),o=t;function r(){o("close")}let a=null;return f.onMounted(()=>{const{width:l,height:c}=e.style;a=new S({container:n.value,width:l,height:c,interacting:!1,selecting:!1,keyboard:!1,mousewheel:!1,panning:!1}),Ir(),a.fromJSON(e.graph.toJSON()),a.drawBackground({color:e.style.backgroundColor,image:e.style.backgroundImage,size:"cover"})}),f.onBeforeUnmount(()=>{a&&a.dispose()}),(l,c)=>(f.openBlock(),f.createElementBlock("div",{class:"previewBox",onClick:r},[f.createElementVNode("div",{ref_key:"container",ref:n,class:"ems-preview"},null,512),f.createVNode(f.unref(i))]))}},[["__scopeId","data-v-2764911c"]]),iS={class:"toolBox"},sS={class:"left"},oS={style:{"line-height":"40px"}},rS={class:"right"},aS=Kt({__name:"index",setup(s){const t=Si(),e=Xt(),{zoom:n}=ge.storeToRefs(e),i=f.ref(!1),o=()=>{i.value=!0},r=()=>{t.saveMenu(()=>{de.ElMessage.success("保存成功!")})};function a(p){const m=/Mac|iPod|iPhone|iPad/.test(navigator.platform);(m&&p.metaKey&&p.key==="s"||!m&&p.ctrlKey&&p.key==="s")&&(p.preventDefault(),r())}const l=()=>{de.ElMessageBox.confirm("确认清空画布吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{t.clearMenu(()=>{de.ElMessage.success("清空成功!")})})},c=()=>{de.ElMessageBox.confirm("确认删除画布吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{t.removeMenu(()=>{de.ElMessage.success("删除成功!")})})},h=f.ref(!1),u=()=>{h.value=!0},d=p=>{e.setZoom(+p*.1)},g=e.graph;return g.on("blank:click",({x:p,y:m})=>{}),g.on("mousemove",({x:p,y:m})=>{}),g.on("blank:contextmenu",({e:p})=>{}),f.onMounted(()=>{window.addEventListener("keydown",a)}),f.onBeforeUnmount(()=>{window.removeEventListener("keydown",a)}),(p,m)=>{const b=f.resolveComponent("el-tooltip"),y=f.resolveComponent("el-dropdown-item"),C=f.resolveComponent("el-dropdown-menu"),w=f.resolveComponent("el-dropdown");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",iS,[f.createElementVNode("div",sS,[f.createElementVNode("a",{onClick:o},[f.createVNode(b,{effect:"light",content:"新增",placement:"bottom","popper-class":"tooltipcolor"},{default:f.withCtx(()=>[...m[2]||(m[2]=[f.createElementVNode("i",{class:"iconfont icon-xinjian"},null,-1)])]),_:1})]),f.createElementVNode("a",{onClick:r},[f.createVNode(b,{effect:"light",content:"保存",placement:"bottom","popper-class":"tooltipcolor"},{default:f.withCtx(()=>[...m[3]||(m[3]=[f.createElementVNode("i",{class:"iconfont icon-baocun"},null,-1)])]),_:1})]),f.createElementVNode("a",{onClick:l},[f.createVNode(b,{effect:"light",content:"清空",placement:"bottom","popper-class":"tooltipcolor"},{default:f.withCtx(()=>[...m[4]||(m[4]=[f.createElementVNode("i",{class:"iconfont icon-qingkong"},null,-1)])]),_:1})]),f.createElementVNode("a",{onClick:c},[f.createVNode(b,{effect:"light",content:"删除",placement:"bottom","popper-class":"tooltipcolor"},{default:f.withCtx(()=>[...m[5]||(m[5]=[f.createElementVNode("i",{class:"iconfont icon-shanchu"},null,-1)])]),_:1})])]),m[9]||(m[9]=f.createElementVNode("div",{style:{flex:"1"}},null,-1)),f.createElementVNode("div",oS,[f.createVNode(w,{onCommand:d,"split-button":"",type:"primary",plain:"",size:"small",style:{"margin-top":"8px"}},{dropdown:f.withCtx(()=>[f.createVNode(C,null,{default:f.withCtx(()=>[(f.openBlock(),f.createElementBlock(f.Fragment,null,f.renderList(20,x=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[x>=5&&x<=20?(f.openBlock(),f.createBlock(y,{key:0,command:x},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(x)+"0%",1)]),_:2},1032,["command"])):f.createCommentVNode("",!0)],64))),64))]),_:1})]),default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(n))+"% ",1)]),_:1})]),m[10]||(m[10]=f.createElementVNode("div",{style:{flex:"1"}},null,-1)),f.createElementVNode("div",rS,[f.createElementVNode("a",{onClick:u},[f.createVNode(b,{effect:"light",content:"预览",placement:"bottom","popper-class":"tooltipcolor"},{default:f.withCtx(()=>[...m[6]||(m[6]=[f.createElementVNode("i",{class:"iconfont icon-yulan"},null,-1)])]),_:1})]),f.createElementVNode("a",null,[f.createVNode(b,{effect:"light",content:"导出",placement:"bottom","popper-class":"tooltipcolor"},{default:f.withCtx(()=>[...m[7]||(m[7]=[f.createElementVNode("i",{class:"iconfont icon-daochu"},null,-1)])]),_:1})]),f.createElementVNode("a",null,[f.createVNode(b,{effect:"light",content:"导入",placement:"bottom","popper-class":"tooltipcolor"},{default:f.withCtx(()=>[...m[8]||(m[8]=[f.createElementVNode("i",{class:"iconfont icon-daoru"},null,-1)])]),_:1})])])]),i.value?(f.openBlock(),f.createBlock(eS,{key:0,onClose:m[0]||(m[0]=x=>i.value=!1)})):f.createCommentVNode("",!0),h.value?(f.openBlock(),f.createBlock(nS,{key:1,onClose:m[1]||(m[1]=x=>h.value=!1)})):f.createCommentVNode("",!0)],64)}}},[["__scopeId","data-v-502eacd5"]]),lS={class:"editorArea"},cS={class:"drawBox"},hS={style:{width:"100%",height:"100%"}},uS=Kt({__name:"editorArea",props:["width","height"],setup(s){const t=Si(),e=Xt(),{style:n}=ge.storeToRefs(e),i=s,o=f.ref(null),r=md(),a=f.inject("topoApi");return f.onMounted(()=>{e.el=o.value,e.style.height=i.height||1080,e.style.width=i.width||1920,e.init(),t.services=a,t.loadAllMenus(!0)}),f.onBeforeUnmount(()=>{e.graph&&e.graph.dispose()}),(l,c)=>(f.openBlock(),f.createElementBlock("div",lS,[f.unref(e).graph?(f.openBlock(),f.createBlock(aS,{key:0})):f.createCommentVNode("",!0),f.createElementVNode("div",cS,[f.createElementVNode("div",hS,[f.createElementVNode("div",{ref_key:"container",ref:o,class:"editor-container",style:f.normalizeStyle({backgroundColor:f.unref(n).backgroundColor,backgroundImage:f.unref(n).backgroundImage?`url(${f.unref(n).backgroundImage})`:"none"})},null,4),f.createVNode(f.unref(r))])])]))}},[["__scopeId","data-v-0d80170d"]]),dS={class:"groups-menus"},gS=Kt({__name:"menus",setup(s){const t=Si(),{menus:e,current:n}=ge.storeToRefs(t),i=(o,r)=>{t.setCurrentMenu(r)};return f.onMounted(()=>{console.log(e,n)}),(o,r)=>{const a=f.resolveComponent("el-icon"),l=f.resolveComponent("el-menu-item"),c=f.resolveComponent("el-sub-menu"),h=f.resolveComponent("el-menu");return f.openBlock(),f.createElementBlock("div",dS,[f.createVNode(h,{"default-active":f.unref(n)[1],onSelect:i,"background-color":"transparent"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(f.unref(e),u=>(f.openBlock(),f.createBlock(c,{key:u.id,index:u.id,"popper-offset":100},{title:f.withCtx(()=>[f.createVNode(a,null,{default:f.withCtx(()=>[f.createVNode(f.unref(xd))]),_:1}),f.createElementVNode("span",null,f.toDisplayString(u.name),1)]),default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(u.children,d=>(f.openBlock(),f.createBlock(l,{key:d.id,index:d.id},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(d.name),1)]),default:f.withCtx(()=>[f.createVNode(a,null,{default:f.withCtx(()=>[f.createVNode(f.unref(Ad))]),_:1})]),_:2},1032,["index"]))),128))]),_:2},1032,["index"]))),128))]),_:1},8,["default-active"])])}}},[["__scopeId","data-v-4ccd6e37"]]),fS="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZQAAADsCAYAAABTw1C4AAAAAXNSR0IArs4c6QAAEo1JREFUeF7t3E3I5mUVBvD/DGPISBnF5Ec5FkxFG1FykYQLK7BFi2rppo1tgkBqVeJKrFURBG1q48ZluHAjVC4MbKEEbsRamFl+NEz0QcOgw0y8Ay7H68Ccns5zP7+29/F+7ud33t6La/HOsdNn7ry8+R8BAgQIELhGgWMC5RoF/ecECBAgcEVAoPhBIECAAIEWAYHSwugSAgQIEBAofgYIECBAoEVAoLQwuoQAAQIEBIqfAQIECBBoERAoLYwuIUCAAAGB4meAAAECBFoEBEoLo0sIECBAoBwot93/8+3kzXcTI0CAAIEDEzj/5vPba09/M37rcqB8+hu/315+/K54oQECBAgQWEug+vtfoKy1d9+GAAEC7QICpZ3UhQQIEDhMAYFymHv3rQkQINAuIFDaSV1IgACBwxQQKIe5d9+aAAEC7QICpZ3UhQQIEDhMgZ0Hir9TyT9ob//z1e2NZ7+3XTj3Uh42QYDANQtc/+HPbLfc+8PtfTfefs13rXxB+juTnQdK9QNXXkr6brd/5YntreceFSgJyjmBJoGjQLnpnke2V596oOnGNa9Jv7/T+bsqbX+HUv3ANddR+1YCpeZkikCXgECpSabf3+lcoNScW6cESiunywhEAYESia4MpMBI5wKl5tw6JVBaOV1GIAoIlEgkUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YEyrydeNHaAgKltt/UQNK5hlJzbp0SKK2cLiMQBQRKJNJQakTzpgTKvJ140doCAqW239RA0rmGUnNunRIorZwuIxAFBEok0lBqRPOmBMq8nXjR2gICpbbf1EDSuYZSc26dEiitnC4jEAUESiTSUGpE86YE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TICUUCgRCINpUY0b0qgzNuJF60tIFBq+00NJJ1rKDXn1imB0srpMgJRQKBEIg2lRjRvSqDM24kXrS0gUGr7TQ0knWsoNefWKYHSyukyAlFAoEQiDaVGNG9KoMzbiRetLSBQavtNDSSdayg159YpgdLK6TICUUCgRCINpUY0b0qgzNuJF60tIFBq+00NJJ1rKDXn1imB0srpMgJRQKBEIg2lRjRvSqDM24kXrS0gUGr7TQ0knWsoNefWKYHSyukyAlFAoEQiDaVGNG9KoMzbiRetLSBQavtNDSSdayg159YpgdLK6TICUUCgRCINpUY0b0qgzNuJF60tIFBq+00NJJ1rKDXn1imB0srpMgJRQKBEIg2lRjRvSqDM24kXrS0gUGr7TQ0knWsoNefWKYHSyukyAlFAoEQiDaVGNG9KoMzbiRetLSBQavtNDSSdayg159YpgdLK6TICUUCgRCINpUY0b0qgzNuJF60tIFBq+00NJJ1rKDXn1imB0srpMgJRQKBEIg2lRjRvSqDM24kXrS0gUGr7TQ0knf9PGspbzz1ae/2BTn3ojge315/57nbh3EsHKuBrE9itwFGg3Hrfj7a/v/iL3X7wnn3aTfc8sr38+F1XffXOA+XU3d/Zjl93w54x7va5x09cv5194SfbxfNnd/vBPo3AgQqcOHlqO/XZh7ZLFy8cqEDta1965z/b2ed/PCdQas82RYAAAQL7JrDzhrJvQN5LgAABAjUBgVJzMkWAAAECQUCg+BEhQIAAgRYBgdLC6BICBAgQECh+BggQIECgRUCgtDC6hAABAgTaA+W2+3++nbz5brIECBAgcGAC5998fnvt6W/Gb33s9Jk7L8cpAwQIECBAIAgIFD8iBAgQINAiIFBaGF1CgAABAgLFzwABAgQItAgIlBZGlxAgQICAQPEzQIAAAQItAgKlhdElBAgQICBQ/AwQIECAQIuAQGlhdAkBAgQI/BceBmwYFkhKEgAAAABJRU5ErkJggg==",pS="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZQAAADsCAYAAABTw1C4AAAAAXNSR0IArs4c6QAAFO1JREFUeF7tnD3I32f1h78JUUpEK0qsr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pae2F3/z3eu+4bnzF7YL7/us71LY/+X//GO7/PRXD0coi35fvRYCCCBw6gns/U8op544AAgggMCiBAhl0WG9FgIIILBvAoSyb+LuQwABBBYlQCiLDuu1EEAAgX0TIJR9E3cfAgggsCgBQll0WK+FAAII7JtAXShve+Sb2/k3PbDv93AfAggggMBkAlf++PT2hx98Jj7Fmbvvve9a/JQPIIAAAgggEAgQiq8IAggggECFAKFUMCpBAAEEECAU3wEEEEAAgQoBQqlgVIIAAgggQCi+AwgggAACFQKEUsGoBAEEEECAUHwHEEAAAQQqBAilglEJAggggMB/ARktVif0N2BWAAAAAElFTkSuQmCC",CS="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZQAAADsCAYAAABTw1C4AAAAAXNSR0IArs4c6QAAESxJREFUeF7t3E/I51UVB+A7w0yK/0pikKkwDKl0EUoJRbiIAoMiolUE0sb20TJxJdKqCIJWbtxEKwmsRZs2Lgq0AiFCC/u3MBsMrRy1GZx4C6HFvHMOeLi/e+c8bs/x3nOf82U+vjIzJ269/a5Lwz8ECBAgQOBtCpwQKG9T0L9OgAABAv8VECg+BAIECBAoERAoJYwOIUCAAAGB4hsgQIAAgRIBgVLC6BACBAgQECi+AQIECBAoERAoJYwOIUCAAAGB4hsgQIAAgRIBgVLC6BACBAgQSAfKqY98eZy45gZiBAgQINBM4NIb/xoXn/lh+Op0oJy+54Fx4alHwwM1ECBAgMDVJZD99V+gXF179xoCBAiUCwiUclIHEiBAoKeAQOm5d68mQIBAuYBAKSd1IAECBHoKCJSee/dqAgQIlAsIlHJSBxIgQKCngEDpuXevJkDg/wSuffcd4+y93xrveOf7uVxB4Pxfnx5/+enXju0QKD4fAgTaCxwFyi2feGj86cdfaW9xJYAPffXX49nH7hYovhICBAgcJyBQct+GQMk56SJAoLGAQMktX6DknHQRINBYQKDkli9Qck66CBBoLCBQcssXKDknXQQINBYQKLnlC5Scky4CBBoLCJTc8gVKzkkXAQKNBQRKbvkCJeekiwCBxgICJbd8gZJz0kWA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RgpDna2wLpN5A09xuKL4kAgfECKRhpPh5gpRdIwUhzQVlpES5DgMD5BFIw0vx8T35Zd07BSHNBuax9ehoCBI4QSMFI8yNuuckfScFIc0HZ5GfhpQjsSyAFI833pXX4bVMw0lxQfEkECIwXSMFI8/EAK71ACkaaC8pKi3AZAgTOJ5CCkebne/LLunMKRpoLymXt09MQIHCEQApGmh9xy03+SApGmgvKJj8LL0VgXwIpGGm+Ly1/h2LfBAgQOCiQgpHmaG8LpN9A0txvKL4kAgTGC6RgpPl4gJVeIAUjzQVlpUW4DAEC5xNIwUjz8z35Zd05BSPNBeWy9ulpCBA4QiAFI82PuOUmfyQFI80FZZOfhZcisC+BFIw035fW4bdNwUhzQfElESAwXiAFI83HA6z0AikYaS4oKy3CZQgQOJ9ACkaan+/JL+vOKRhpLiiXtU9PQ4DAEQIpGGl+xC03+SMpGGkuKJv8LLwUgX0JpGCk+b60hv0dyu9/8AX7IUCAwMkErt33wPL6h55Yfvn0x171nreC8tYPfnn584+/cbJnmnij+x9/cnn2qUcPPvrJf0O58dhnl6v33DfR0jMTIDBU4Oq1e5ebz/1wef7n337VN7h2/cZy472fWV568YWhb3iax37pH39b/vjMVy4nKKd5bXchQIAAgVMLnPw3lFO/oPsRIECAwGkEBOU0zu5CgACBzQsIyuZX7AUJECBwGgFBOY2zuxAgQGDzAoKy+RV7QQIECJxGQFBO4+wuBAgQ2LzA6kF5xxNfX66/5bHNw3lBAgQIEPhvgZu/e2b57Xc/HVmuPPjwIy/HUw4QIECAAIEgICg+EQIECBBYRUBQVmF0EQIECBAQFN8AAQIECKwiICirMLoIAQIECAiKb4AAAQIEVhEQlFUYXYQAAQIEBMU3QIAAAQKrCAjKKowuQoAAAQL/BNGmU82l5+MXAAAAAElFTkSuQmCC",xS=Object.assign({"../../../assets/iconfont/svg/A相手车刀闸合.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M511.9872 921.5232l-0.0896 0.0768-31.6736-31.68 0.0768-0.0768-76.864-76.864 31.6736-31.68 76.8768 76.864 76.864-76.864 31.6736 31.68-76.864 76.864 0.0768 0.0768L512.064 921.6z m0-102.4l-0.0896 0.0768-31.6736-31.68 0.0768-0.0768-76.864-76.864 31.6736-31.68 54.4896 54.4832V290.6176l-54.4896 54.464-31.6736-31.68 76.864-76.8384-0.0768-0.0704 31.6736-31.68 0.0896 0.0768 0.0768-0.0768 31.6736 31.68-0.0768 0.0704 76.864 76.8384-31.6736 31.68-54.4512-54.432v442.7008l54.4512-54.4512 31.6736 31.68-76.864 76.864 0.0768 0.0768L512.064 819.2z m0-653.2864L435.1104 242.6816l-31.6736-31.68 76.864-76.8384-0.0768-0.0704 31.6736-31.68 0.0896 0.0768 0.0768-0.0768 31.6736 31.68-0.0768 0.0704 76.864 76.8384-31.6736 31.68z" fill="#EF5317" /></svg>',"../../../assets/iconfont/svg/三绕组变压器.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M544 64v268.256a192.064 192.064 0 0 1 147.84 256.704A192 192 0 1 1 512 904.608a192 192 0 1 1-179.84-315.68A192.064 192.064 0 0 1 480 332.256V64h64z m-197.44 555.072l-5.856 0.832A160.032 160.032 0 0 0 368 937.6a159.68 159.68 0 0 0 124.48-59.456 190.72 190.72 0 0 1-28.48-100.544c0-23.68 4.288-46.4 12.16-67.36a192 192 0 0 1-125.12-83.904l-4.48-7.264z m330.88-0.064l-0.8 1.44a192.192 192.192 0 0 1-128.832 89.824A190.72 190.72 0 0 1 560 777.6a191.104 191.104 0 0 1-28.384 100.544 160 160 0 1 0 145.824-259.104zM509.344 713.6l-2.016 4.8A159.584 159.584 0 0 0 496 777.6c0 25.024 5.76 48.672 16 69.76a158.72 158.72 0 0 0 16-69.76c0-22.784-4.768-44.448-13.344-64.064l-5.312 0.032z m-124.608-95.104l1.28 1.76a159.84 159.84 0 0 0 104.544 59.968l1.824-3.136a159.456 159.456 0 0 0-107.648-58.592z m254.56 0.064l-3.872 0.384a159.808 159.808 0 0 0-103.872 58.144l1.92 3.072a159.488 159.488 0 0 0 100.96-55.52l4.864-6.08zM512 361.6a160 160 0 0 0-146.656 224.064l2.656-0.064c57.344 0 108.8 25.152 144 64.992a191.552 191.552 0 0 1 144-64.992h2.688a160 160 0 0 0-146.688-224z" /></svg>',"../../../assets/iconfont/svg/变压器_1.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M533.0944 534.3232c-82.1248 0-148.8896-66.7648-148.8896-148.8896s66.7648-148.8896 148.8896-148.8896 148.8896 66.7648 148.8896 148.8896-66.7648 148.8896-148.8896 148.8896z m0-277.504c-70.8608 0-128.4096 57.5488-128.4096 128.4096s57.5488 128.4096 128.4096 128.4096c70.8608 0 128.4096-57.5488 128.4096-128.4096s-57.5488-128.4096-128.4096-128.4096z" fill="#E60012" /><path d="M633.6512 459.9808h-200.704l98.7136-158.1056 101.9904 158.1056z m-163.84-20.48h126.1568l-64.1024-99.5328-62.0544 99.5328z" fill="#E60012" /><path d="M533.0944 694.272c-82.1248 0-148.8896-66.7648-148.8896-148.8896s66.7648-148.8896 148.8896-148.8896 148.8896 66.7648 148.8896 148.8896c0 81.92-66.7648 148.8896-148.8896 148.8896z m0-277.504c-70.8608 0-128.4096 57.5488-128.4096 128.4096s57.5488 128.4096 128.4096 128.4096c70.8608 0 128.4096-57.5488 128.4096-128.4096s-57.5488-128.4096-128.4096-128.4096z" fill="#EF7C1B" /><path d="M522.8544 611.9424h20.48v317.0304h-20.48z" fill="#EF7C1B" /><path d="M522.8544 57.9584h20.48v192.512h-20.48z" fill="#E60012" /><path d="M534.7328 632.832l-90.9312-101.9904 15.1552-13.5168 75.3664 84.3776 72.704-84.3776 15.5648 13.5168z" fill="#EF7C1B" /></svg>',"../../../assets/iconfont/svg/变压器_2.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M512 170.666667c-117.824 0-213.333333 95.509333-213.333333 213.333333s95.509333 213.333333 213.333333 213.333333 213.333333-95.509333 213.333333-213.333333S629.824 170.666667 512 170.666667zM256 384c0-141.376 114.624-256 256-256s256 114.624 256 256-114.624 256-256 256-256-114.624-256-256z" fill="#000000" /><path d="M512 426.666667c-117.824 0-213.333333 95.509333-213.333333 213.333333s95.509333 213.333333 213.333333 213.333333 213.333333-95.509333 213.333333-213.333333-95.509333-213.333333-213.333333-213.333333zM256 640c0-141.376 114.624-256 256-256s256 114.624 256 256-114.624 256-256 256-256-114.624-256-256z" fill="#000000" /><path d="M490.666667 981.333333v-106.666666h42.666666v106.666666h-42.666666zM490.666667 149.333333V42.666667h42.666666v106.666666h-42.666666z" fill="#000000" /></svg>',"../../../assets/iconfont/svg/手持开关盒.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M431.431671 299.041479h159.572225v426.308151H431.431671z" fill="#d81e06" /><path d="M609.777099 744.122832H412.658468v-463.854556h197.118631v463.854556z m-159.572225-37.546405h122.025819v-388.761745H450.204874v388.761745z" fill="#d81e06" /><path d="M492.44458 131.568864h37.546406v186.167596h-37.546406zM492.44458 707.280422h37.546406v186.167596h-37.546406z" fill="#d81e06" /><path d="M594.993201 252.656023L511.06134 145.414101 427.129478 252.656023l-29.567794-23.153617L511.06134 84.479413l113.499656 145.022993z" fill="#d81e06" /><path d="M594.993201 168.17661L511.06134 60.934688 427.129478 168.17661l-29.567794-23.153617 113.499656-145.022993L624.560996 145.022993z" fill="#d81e06" /><path d="M511.06134 939.520587L397.561684 794.497594l29.567794-23.075396 83.931862 107.241922L594.993201 771.422198l29.567795 23.075396z" fill="#d81e06" /><path d="M511.06134 1024L397.561684 878.977007l29.567794-23.075395 83.931862 107.241922L594.993201 855.901612l29.567795 23.075395z" fill="#d81e06" /></svg>',"../../../assets/iconfont/svg/手持断路器.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M494.481834 206.967196l-8.668783-7.223986 71.51746-87.410229c1.083598-1.444797 2.889594-2.167196 4.695591-2.167196s3.611993 0.722399 4.695591 2.167196l71.51746 87.410229-8.668783 7.223986-67.544268-82.714639-67.544268 82.714639zM566.360494 119.195767c0 0.361199 0 0.361199 0 0z" fill="#FF0000" /><path d="M494.481834 148.091711l-8.668783-7.223986 71.51746-87.410229c1.083598-1.444797 2.889594-2.167196 4.695591-2.167196s3.611993 0.722399 4.695591 2.167196L638.600353 140.867725l-8.668783 7.223986-67.544268-82.714639L494.481834 148.091711z m71.87866-87.771429c0 0.361199 0 0.361199 0 0zM562.026102 913.834215c-1.805996 0-3.250794-0.722399-4.334391-2.167196l-71.87866-87.771428 8.668783-7.223986 67.544268 82.714638 67.544268-82.714638 8.668783 7.223986-71.878659 87.771428c-1.083598 1.444797-2.528395 2.167196-4.334392 2.167196z" fill="#FF0000" /><path d="M562.026102 972.7097c-1.805996 0-3.250794-0.722399-4.334391-2.167196l-71.87866-87.771428 8.668783-7.223986 67.544268 82.714638 67.544268-82.714638 8.668783 7.223986-71.878659 87.771428c-1.083598 1.444797-2.528395 2.167196-4.334392 2.167196zM567.805291 849.179541h-11.197178V617.650794l-171.208466-252.839507 9.391182-6.140388 171.930864 254.284304c0.722399 1.083598 1.083598 2.167196 1.083598 3.250793v232.973545zM556.608113 178.071252h11.197178v183.489242h-11.197178z" fill="#FF0000" /><path d="M510.898342 402.654138l94.446392-90.429856 7.740501 8.087252-94.44278 90.429856z" fill="#FF0000" /><path d="M511.158406 320.35849l7.744113-8.087252 94.457227 90.415408-7.744113 8.090864zM556.608113 849.179541h11.197178v58.875485h-11.197178zM556.608113 119.195767h11.197178v58.875485h-11.197178z" fill="#FF0000" /></svg>',"../../../assets/iconfont/svg/抽屉式断路器断开.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M85.18656007 375.38588444l-13.9264 0 0-387.28817777 13.9264 0z" fill="#EF1616" /><path d="M12.7726934 188.10538666l-9.84746666-9.84746666 72.41500444-72.41500444 9.84746666 9.84746666z" fill="#EF1616" /><path d="M71.25674674 115.69038222l9.84746666-9.84746665 72.41500443 72.41500443-9.84746665 9.84746667zM12.77496896 261.79811556l-9.84746667-9.84746667 72.41500445-72.41500445 9.84746666 9.84746667z" fill="#EF1616" /><path d="M71.25447117 189.38311111l9.84746667-9.84746667 72.41500445 72.41500445-9.84746667 9.84746667zM85.1797334 1037.94346667l-13.9264 0 0-387.28817778 13.9264 0z" fill="#EF1616" /><path d="M85.18769784 910.336l-9.84746665 9.84746667-72.41500445-72.41500445 9.84746666-9.84746666z" fill="#EF1616" /><path d="M143.67175118 837.92099556l9.84746666 9.84746665-72.41500444 72.41500446-9.84746666-9.84746667z" fill="#EF1616" /><path d="M85.18542229 836.64668444l-9.84746667 9.84746667-72.41500444-72.41500444 9.84746666-9.84746667z" fill="#EF1616" /><path d="M143.67402674 764.23168l9.84746666 9.84746667-72.41614222 72.41500444-9.84632889-9.84746667z" fill="#EF1616" /><path d="M19.62666674 375.38702222l118.32888888 0L137.95555561 650.33102222l-118.32888886 0-1e-8-274.944z m104.41386666 13.91502222l-90.48746666 0L33.55306674 636.40462222l90.48746666 0 0-247.10257778z" fill="#EF1616" /></svg>',"../../../assets/iconfont/svg/接地_1.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M531.791456 701.961295a17.407498 17.407498 0 0 1-15.824998-16.616247v-316.499956a15.824998 15.824998 0 0 1 15.824998-15.824998 17.407498 17.407498 0 0 1 15.824998 16.616248v320.456205a15.824998 15.824998 0 0 1-15.824998 11.868748zM533.373956 377.548841a18.989997 18.989997 0 0 1-11.077499 0L172.564006 27.02514a15.033748 15.033748 0 0 1 0-22.154997 15.033748 15.033748 0 0 1 22.154997 0l349.732451 345.776202a15.033748 15.033748 0 0 1 0 22.154996 14.242498 14.242498 0 0 1-11.077498 4.7475zM609.333945 1024H455.040217a15.824998 15.824998 0 0 1 0-31.649996h158.249977a15.824998 15.824998 0 0 1 0 31.649996zM762.836423 870.497522H300.746488a15.824998 15.824998 0 0 1 0-31.649996h462.089935a15.824998 15.824998 0 1 1 0 31.649996zM840.378913 716.203793H223.995249a15.824998 15.824998 0 0 1-15.824998-15.824998 15.824998 15.824998 0 0 1 15.824998-16.616247H840.378913a15.824998 15.824998 0 0 1 15.824997 16.616247 15.824998 15.824998 0 0 1-15.824997 15.824998z" /></svg>',"../../../assets/iconfont/svg/接地_2.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M810.666667 704H213.333333v-42.666667h597.333334v42.666667zM725.333333 810.666667H298.666667v-42.666667h426.666666v42.666667zM640 917.333333H384v-42.666666h256v42.666666z" fill="#000000" /><path d="M490.666667 704V106.666667h42.666666v597.333333h-42.666666z" fill="#000000" /></svg>',"../../../assets/iconfont/svg/断路器-he.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M640 176H528V0h-32v176H384v672h112v176h32V848h112z" fill="#D81E06" /></svg>',"../../../assets/iconfont/svg/断路器.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M700.16 341.333333l55.04-55.04a42.666667 42.666667 0 0 0-60.16-60.16l-12.373333 12.373334V42.666667a42.666667 42.666667 0 0 0-85.333334 0v195.84l-12.373333-12.373334a42.666667 42.666667 0 0 0-60.16 60.16L579.84 341.333333l-55.466667 55.04a42.666667 42.666667 0 1 0 60.16 60.16L640 401.493333l55.04 55.04a42.666667 42.666667 0 1 0 60.16-60.16zM333.226667 230.826667a42.666667 42.666667 0 0 0-69.12 50.346666L597.333333 739.413333V981.333333a42.666667 42.666667 0 0 0 85.333334 0v-256a42.666667 42.666667 0 0 0-8.106667-25.173333z" /></svg>',"../../../assets/iconfont/svg/母线.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="98.08px" viewBox="0 0 2088 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M2088.44 442.576H5.726v138.848H2088.44V442.576z" fill="#FF0000" /></svg>',"../../../assets/iconfont/svg/电池.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="100.64px" viewBox="0 0 2035 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M2538.89999992 217.3c2.9-0.1 5.7-0.1 8.6-0.1" /><path d="M1344.19999992 960.2H703.99999992V130.3h640.1v829.9z m-567.5-70.1h494.8V200.4H776.69999992v689.7z" fill="#03E086" /><path d="M896.09999992 61h254.4v70H896.09999992zM1064.99999992 755.9l-80.7-39.7 63.6-129.1H855.49999992l128.3-255.3 80.4 40.5-62.7 124.8h191z" fill="#03E086" /></svg>',"../../../assets/iconfont/svg/直流逆变器.svg":'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M207.36 359.936l58.624-58.624c9.216-9.216 21.418667-14.250667 34.389333-14.250667s25.173333 5.034667 34.389334 14.250667l41.557333 41.557333c17.749333 17.749333 40.96 26.88 64.341333 26.88 18.773333 0 37.632-5.802667 53.930667-17.749333l45.909333-33.621333c9.472-6.912 11.52-20.224 4.608-29.696a21.265067 21.265067 0 0 0-29.696-4.608l-45.909333 33.621333a48.452267 48.452267 0 0 1-63.146667-4.864l-41.557333-41.557333c-17.237333-17.237333-40.106667-26.709333-64.426667-26.709334-24.32 0-47.274667 9.472-64.426666 26.709334l-58.624 58.624c-8.277333 8.277333-8.277333 21.76 0 30.037333 8.277333 8.277333 21.76 8.277333 30.037333 0zM119.466667 119.466667v785.066666h785.066666V119.466667H119.466667z m706.645333 42.496L161.962667 826.112V161.962667h664.149333z m-640 700.074666l675.925333-675.925333v675.925333H186.112zM490.837333 685.568h339.882667v42.496H490.837333zM736.682667 790.101333h94.122666v42.496H736.682667zM613.717333 790.101333h94.122667v42.496H613.717333zM490.837333 790.101333h94.122667v42.496H490.837333z" /></svg>'});function vS(s){return s?(s=s.replace(/fill="(?!none)[^"]*"/gi,'fill="currentColor"').replace(/stroke="(?!none)[^"]*"/gi,'stroke="currentColor"'),s=s.replace(/<([a-z]+)([^>]*?)\/?>/gi,(t,e,n)=>{const i=t.endsWith("/>")?"/>":">";return!/(fill=)/i.test(n)&&/^(path|circle|rect|polygon|polyline)$/i.test(e)?`<${e}${n} fill="currentColor"${i}`:t}),s):""}const ES=Object.entries(xS).map(([s,t])=>({name:s.split("/").pop().replace(".svg",""),svg:vS(t)})),SS={class:"nodes"},MS={class:"groups"},BS=["onClick"],IS={class:"list"},PS={style:{width:"100%",display:"flex","justify-content":"space-between","align-items":"center",padding:"20px 10px 10px 10px"}},TS={style:{padding:"10px"}},kS=["onMousedown","title"],OS=["innerHTML"],NS=Kt({__name:"nodes",setup(s){const t=Xt(),e={IMG:"img",ICON:"icon",SVG:"svg",OTHER:"other"},n=f.ref(0),i=f.ref([{name:"控件",icon:"iconfont icon-icon-relativity",active:[],children:[{name:"基础",layout:"1fr 1fr 1fr",list:[{name:"线段",renderType:"icon",icon:"iconfont icon-xianduan",data:{type:"line"}},{name:"基础文字",renderType:"icon",icon:"iconfont icon-wenzi",data:{type:"text"}},{name:"数值",renderType:"icon",icon:"iconfont icon-shuzhi",data:{type:"data"}},{name:"图标",renderType:"icon",icon:"iconfont icon-tubiao",data:{type:"icon"}},{name:"图片",renderType:"icon",icon:"iconfont icon-tupian",data:{type:"img"}},{name:"自定义",renderType:"other",icon:"iconfont icon-tupian",data:{type:"other"}}]},{name:"图形",list:[]},{name:"表格",list:[]},{name:"图表",list:[]},{name:"表单",list:[]}]},{name:"模板",icon:"iconfont icon-root-list",active:[],children:[{name:"布局",layout:"1fr 1fr",list:[{name:"布局1",renderType:"img",icon:fS,data:{type:"layout"}},{name:"布局2",renderType:"img",icon:pS,data:{type:"layout"}},{name:"布局3",renderType:"img",icon:mS,data:{type:"layout"}},{name:"布局4",renderType:"img",icon:bS,data:{type:"layout"}},{name:"布局5",renderType:"img",icon:yS,data:{type:"layout"}},{name:"布局6",renderType:"img",icon:CS,data:{type:"layout"}},{name:"布局7",renderType:"img",icon:AS,data:{type:"layout"}},{name:"布局8",renderType:"img",icon:wS,data:{type:"layout"}}]}]},{name:"设备",icon:"iconfont icon-control-platform",children:[],active:[]},{name:"图表",icon:"iconfont icon-icon_chart",children:[],active:[]},{name:"素材",icon:"iconfont icon-icon_image",children:[{name:"电器svg",layout:"1fr 1fr 1fr",list:ES.map(h=>({name:h.name,renderType:"svg",icon:h.svg,data:{type:"svg"}}))}],active:[]}]),o=f.ref(""),r=h=>{n.value=h},a=()=>{if(i.value[n.value].active.length>0)i.value[n.value].active=[];else{const h=[];i.value[n.value].children.forEach((u,d)=>{h.push(d)}),i.value[n.value].active=h}},l=(h,u)=>{if(console.log(u),u.renderType==="other"){const d=t.graph.createNode({shape:"vue-node"});d.setData({icon:u.icon,name:u.name,...u.data}),t.dnd.start(d,h)}else{const d=t.graph.createNode({shape:u.renderType+"-node"});d.setData({icon:u.icon,name:u.name,...u.data}),t.dnd.start(d,h)}},c=({node:h})=>{var u;if(((u=h.data)==null?void 0:u.type)==="line"){const d=h.position();console.log(h,h.position()),h.remove();const g=t.graph.addNode({x:d.x-50,y:d.y,width:5,height:5,attrs:{body:{fill:"transparent",stroke:"transparent"}},zIndex:1}),p=t.graph.addNode({x:d.x+50,y:d.y,width:5,height:5,attrs:{body:{fill:"transparent",stroke:"transparent"}},zIndex:1}),m=t.graph.addEdge({source:g,target:p,router:"normal",attrs:{line:{stroke:"#1890ff",strokeWidth:2,sourceMarker:null,targetMarker:null}},zIndex:0});t.graph.select(m)}};return f.onMounted(()=>{t.graph.on("node:added",c)}),f.onBeforeUnmount(()=>{t.graph.off("node:added",c)}),(h,u)=>{const d=f.resolveComponent("el-input"),g=f.resolveComponent("el-tooltip"),p=f.resolveComponent("el-image"),m=f.resolveComponent("el-collapse-item"),b=f.resolveComponent("el-collapse");return f.openBlock(),f.createElementBlock("div",SS,[f.createElementVNode("div",MS,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(i.value,(y,C)=>(f.openBlock(),f.createElementBlock("div",{key:y.index,class:f.normalizeClass(["group",{active:n.value===C}]),onClick:w=>r(C)},[f.createElementVNode("i",{class:f.normalizeClass(y.icon)},null,2),f.createElementVNode("span",null,f.toDisplayString(y.name),1)],10,BS))),128))]),f.createElementVNode("div",IS,[f.createElementVNode("div",PS,[f.createVNode(d,{modelValue:o.value,"onUpdate:modelValue":u[0]||(u[0]=y=>o.value=y),style:{width:"180px"},placeholder:"请输入过滤","prefix-icon":f.unref(Md),clearable:""},null,8,["modelValue","prefix-icon"]),f.createVNode(g,{effect:"light",content:"展开/折叠",placement:"top"},{default:f.withCtx(()=>[f.createElementVNode("div",{style:{cursor:"pointer","font-size":"20px"},onClick:a},[...u[2]||(u[2]=[f.createElementVNode("i",{class:"iconfont icon-menu-fold"},null,-1)])])]),_:1})]),f.createElementVNode("div",TS,[f.createVNode(b,{modelValue:i.value[n.value].active,"onUpdate:modelValue":u[1]||(u[1]=y=>i.value[n.value].active=y),"expand-icon-position":"left",style:{border:"none","background-color":"transparent"}},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(i.value[n.value].children,(y,C)=>(f.openBlock(),f.createBlock(m,{key:C,title:y.name,name:C},{default:f.withCtx(()=>[f.createElementVNode("div",{class:"expand-content",style:f.normalizeStyle({gridTemplateColumns:y.layout?y.layout:"1fr 1fr 1fr"})},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(y.list.filter(w=>w.name.includes(o.value)),(w,x)=>(f.openBlock(),f.createElementBlock("div",{key:x,class:"graphic",onMousedown:E=>l(E,w),title:w.name},[w.renderType===e.IMG?(f.openBlock(),f.createBlock(p,{key:0,src:w.icon,style:{width:"100px",height:"60px",margin:"auto"}},null,8,["src"])):f.createCommentVNode("",!0),w.renderType===e.ICON?(f.openBlock(),f.createElementBlock("i",{key:1,class:f.normalizeClass(w.icon),style:{"font-size":"24px"}},null,2)):f.createCommentVNode("",!0),w.renderType===e.SVG?(f.openBlock(),f.createElementBlock("div",{key:2,class:"svg-icon",innerHTML:w.icon},null,8,OS)):f.createCommentVNode("",!0),w.renderType===e.OTHER?(f.openBlock(),f.createElementBlock("i",{key:3,class:f.normalizeClass(w.icon),style:{"font-size":"24px"}},null,2)):f.createCommentVNode("",!0),f.createElementVNode("p",null,f.toDisplayString(w.name),1)],40,kS))),128))],4)]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])])])}}},[["__scopeId","data-v-eeff84fb"]]),RS={class:"graphics"},DS={class:"menus"},QS=Kt({__name:"index",setup(s){const t=f.ref(0);return(e,n)=>(f.openBlock(),f.createElementBlock("div",RS,[f.createElementVNode("div",DS,[f.createElementVNode("div",{class:f.normalizeClass(["menu",{active:t.value===0}]),onClick:n[0]||(n[0]=i=>t.value=0)},"菜单目录",2),f.createElementVNode("div",{class:f.normalizeClass(["menu",{active:t.value===1}]),onClick:n[1]||(n[1]=i=>t.value=1)},"系统资源",2),f.createElementVNode("div",{class:f.normalizeClass(["menu",{active:t.value===2}]),onClick:n[2]||(n[2]=i=>t.value=2)},"我的资源",2),f.createElementVNode("div",{class:f.normalizeClass(["menu",{active:t.value===3}]),onClick:n[3]||(n[3]=i=>t.value=3)},"数据模拟",2)]),t.value===0?(f.openBlock(),f.createBlock(gS,{key:0})):f.createCommentVNode("",!0),t.value===1?(f.openBlock(),f.createBlock(NS,{key:1})):f.createCommentVNode("",!0)]))}},[["__scopeId","data-v-e999f41f"]]),LS=["src"],FS=Kt({__name:"graphProperty",setup(s){Si();const t=Xt(),{style:e,name:n}=ge.storeToRefs(t),i=f.ref(["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]);function o(a){return new Promise((l,c)=>{const h=new FileReader;h.onload=()=>l(h.result),h.onerror=c,h.readAsDataURL(a)})}const r=async a=>{if(!a.type.startsWith("image/"))return de.ElMessage.error("只能上传图片文件"),!1;if(!(a.size/1024/1024<2))return de.ElMessage.error("图片大小不能超过 2MB"),!1;try{const c=await o(a);e.value.backgroundImage=c}catch{return de.ElMessage.error("图片读取失败"),!1}return!1};return f.ref(1920),f.ref(1080),(a,l)=>{const c=f.resolveComponent("el-input"),h=f.resolveComponent("el-form-item");f.resolveComponent("el-input-number"),f.resolveComponent("el-button");const u=f.resolveComponent("el-color-picker"),d=f.resolveComponent("el-icon"),g=f.resolveComponent("el-upload"),p=f.resolveComponent("el-form");return f.openBlock(),f.createBlock(p,{class:"graphProperty",size:"small","label-width":"auto",onSubmit:l[4]||(l[4]=f.withModifiers(()=>{},["prevent"]))},{default:f.withCtx(()=>[f.createVNode(h,{label:"目录名称"},{default:f.withCtx(()=>[f.createVNode(c,{modelValue:f.unref(n),"onUpdate:modelValue":l[0]||(l[0]=m=>f.isRef(n)?n.value=m:null)},null,8,["modelValue"])]),_:1}),f.createCommentVNode("",!0),f.createVNode(h,{label:"背景颜色"},{default:f.withCtx(()=>[f.createVNode(u,{modelValue:f.unref(e).backgroundColor,"onUpdate:modelValue":l[3]||(l[3]=m=>f.unref(e).backgroundColor=m),"show-alpha":"",predefine:i.value,style:{width:"100%",height:"30px"}},null,8,["modelValue","predefine"])]),_:1}),f.createVNode(h,{label:"背景图片"},{default:f.withCtx(()=>[f.createVNode(g,{accept:"image/*","show-file-list":!1,"before-upload":r},{default:f.withCtx(()=>[f.unref(e).backgroundImage?(f.openBlock(),f.createElementBlock("img",{key:0,src:f.unref(e).backgroundImage,style:{width:"100%",height:"100%"}},null,8,LS)):(f.openBlock(),f.createBlock(d,{key:1,class:"avatar-uploader-icon"},{default:f.withCtx(()=>[f.createVNode(f.unref(Ed))]),_:1}))]),_:1})]),_:1})]),_:1})}}},[["__scopeId","data-v-3a1238a6"]]),zS={__name:"nodePanel",setup(s){var r;const t=Xt(),e=f.inject("cellId"),n=f.inject("getCurCell")(),i=n.getData(),o=f.ref({name:((r=n.getData())==null?void 0:r.name)||"",x:n.position().x,y:n.position().y,width:n.size().width,height:n.size().height,zIndex:n.prop("zIndex"),opacity:n.prop("opacity")||1,borderStyle:i.borderStyle,borderRadius:i.borderRadius,borderWidth:i.borderWidth,borderColor:i.borderColor,backgroundColor:i.backgroundColor});return f.watch(o.value,()=>{n.prop("position",{x:o.value.x,y:o.value.y}),n.prop("size",{width:o.value.width,height:o.value.height}),n.prop("zIndex",o.value.zIndex);const{opacity:a,borderStyle:l,borderRadius:c,borderWidth:h,borderColor:u,backgroundColor:d}=o.value;n.setData({opacity:a,borderStyle:l,borderRadius:c,borderWidth:h,borderColor:u,backgroundColor:d})}),f.onMounted(()=>{t.graph.on("node:resized",({node:a})=>{a.id===e.value&&(o.value.width=a.size().width,o.value.height=a.size().height)}),t.graph.on("node:change:position",({node:a})=>{console.log(a.position()),a.id===e.value&&(o.value.x=+a.position().x.toFixed(0),o.value.y=+a.position().y.toFixed(0))})}),f.onBeforeUnmount(()=>{t.graph.off("node:resized"),t.graph.off("node:change:position")}),(a,l)=>{const c=f.resolveComponent("el-input"),h=f.resolveComponent("el-form-item"),u=f.resolveComponent("el-input-number"),d=f.resolveComponent("el-slider"),g=f.resolveComponent("el-option"),p=f.resolveComponent("el-select"),m=f.resolveComponent("el-color-picker"),b=f.resolveComponent("el-form");return f.openBlock(),f.createBlock(b,{size:"small","label-width":"80px","label-position":"left"},{default:f.withCtx(()=>[f.createVNode(h,{label:"元素名称"},{default:f.withCtx(()=>[f.createVNode(c,{modelValue:o.value.name,"onUpdate:modelValue":l[0]||(l[0]=y=>o.value.name=y)},null,8,["modelValue"])]),_:1}),f.createVNode(h,{label:"位置"},{default:f.withCtx(()=>[f.createVNode(u,{modelValue:o.value.x,"onUpdate:modelValue":l[1]||(l[1]=y=>o.value.x=y),"controls-position":"right",min:0,step:5,style:{width:"80px","margin-right":"10px"}},null,8,["modelValue"]),f.createVNode(u,{modelValue:o.value.y,"onUpdate:modelValue":l[2]||(l[2]=y=>o.value.y=y),"controls-position":"right",min:0,step:5,style:{width:"80px"}},null,8,["modelValue"])]),_:1}),f.createVNode(h,{label:"长宽"},{default:f.withCtx(()=>[f.createVNode(u,{modelValue:o.value.width,"onUpdate:modelValue":l[3]||(l[3]=y=>o.value.width=y),"controls-position":"right",min:0,step:5,style:{width:"80px","margin-right":"10px"}},null,8,["modelValue"]),f.createVNode(u,{modelValue:o.value.height,"onUpdate:modelValue":l[4]||(l[4]=y=>o.value.height=y),"controls-position":"right",min:0,step:5,style:{width:"80px"}},null,8,["modelValue"])]),_:1}),f.createVNode(h,{label:"层级"},{default:f.withCtx(()=>[f.createVNode(u,{modelValue:o.value.zIndex,"onUpdate:modelValue":l[5]||(l[5]=y=>o.value.zIndex=y),min:0,max:1e4,step:1,style:{width:"160px"}},null,8,["modelValue"])]),_:1}),f.createVNode(h,{label:"透明度"},{default:f.withCtx(()=>[f.createVNode(d,{modelValue:o.value.opacity,"onUpdate:modelValue":l[6]||(l[6]=y=>o.value.opacity=y),min:0,max:1,step:.01,style:{width:"160px"}},null,8,["modelValue"])]),_:1}),f.createVNode(h,{label:"边框"},{default:f.withCtx(()=>[f.createVNode(p,{modelValue:o.value.borderStyle,"onUpdate:modelValue":l[7]||(l[7]=y=>o.value.borderStyle=y),style:{width:"60px","margin-right":"10px"},placeholder:"样式"},{default:f.withCtx(()=>[f.createVNode(g,{label:"无",value:"none"}),f.createVNode(g,{label:"实线",value:"solid"}),f.createVNode(g,{label:"虚线",value:"dashed"}),f.createVNode(g,{label:"点线",value:"dotted"}),f.createVNode(g,{label:"双实线",value:"double"})]),_:1},8,["modelValue"]),f.createVNode(u,{modelValue:o.value.borderWidth,"onUpdate:modelValue":l[8]||(l[8]=y=>o.value.borderWidth=y),"controls-position":"right",min:0,step:1,style:{width:"60px","margin-right":"10px"},placeholder:"宽度"},null,8,["modelValue"]),f.createVNode(m,{modelValue:o.value.borderColor,"onUpdate:modelValue":l[9]||(l[9]=y=>o.value.borderColor=y),"show-alpha":"",placeholder:"颜色"},null,8,["modelValue"])]),_:1}),f.createVNode(h,{label:"背景颜色"},{default:f.withCtx(()=>[f.createVNode(m,{modelValue:o.value.backgroundColor,"onUpdate:modelValue":l[10]||(l[10]=y=>o.value.backgroundColor=y),"show-alpha":"",placeholder:"颜色",style:{width:"100%",height:"30px"}},null,8,["modelValue"])]),_:1}),f.createElementVNode("div",null,f.toDisplayString(JSON.stringify(f.unref(n).getData(),null,2)),1)]),_:1})}}},US={__name:"linePanel",setup(s){const t=f.ref({name:"line"});return(e,n)=>{const i=f.resolveComponent("el-input"),o=f.resolveComponent("el-form-item"),r=f.resolveComponent("el-slider"),a=f.resolveComponent("el-form");return f.openBlock(),f.createBlock(a,{size:"small","label-width":"80px","label-position":"left"},{default:f.withCtx(()=>[f.createVNode(o,{label:"元素名称"},{default:f.withCtx(()=>[f.createVNode(i,{modelValue:t.value.name,"onUpdate:modelValue":n[0]||(n[0]=l=>t.value.name=l)},null,8,["modelValue"])]),_:1}),f.createVNode(o,{label:"透明度"},{default:f.withCtx(()=>[f.createVNode(r,{modelValue:t.value.opacity,"onUpdate:modelValue":n[1]||(n[1]=l=>t.value.opacity=l),min:0,max:1,step:.01,style:{width:"160px"}},null,8,["modelValue"])]),_:1})]),_:1})}}},KS={class:"propertyForm"},JS={__name:"base",setup(s){Rs(),Xt();const t=f.inject("getCurCell")(),e=f.ref(t==null?void 0:t.isNode());return console.log(f.inject("cellId").value,e.value,t),(n,i)=>(f.openBlock(),f.createElementBlock("div",KS,[e.value?(f.openBlock(),f.createBlock(zS,{key:0})):(f.openBlock(),f.createBlock(US,{key:1}))]))}},jS={};function VS(s,t){const e=f.resolveComponent("el-form");return f.openBlock(),f.createBlock(e,null,{default:f.withCtx(()=>[...t[0]||(t[0]=[f.createTextVNode(" 数据配置面板 ",-1)])]),_:1})}const GS=Kt(jS,[["render",VS]]),YS={class:"prop"},HS={class:"tabContainer"},qS=["onClick"],WS={class:"activeLine"},XS={key:0,class:"main"},_S=Kt({__name:"index",setup(s){const t=Xt(),e=Rs(),{targetType:n,tabs:i,activeTab:o,cellId:r}=ge.storeToRefs(e),a=h=>{o.value=h};let l=r.value?t.graph.getCellById(r.value):null;f.provide("getCurCell",()=>l),f.provide("cellId",r);const c=f.ref(!0);return f.watch(r,()=>{console.log("cellId",r.value),l=t.graph.getCellById(r.value),c.value=!1,f.nextTick(()=>{c.value=!0})}),(h,u)=>(f.openBlock(),f.createElementBlock("div",YS,[f.createElementVNode("div",HS,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(f.unref(i),(d,g)=>(f.openBlock(),f.createElementBlock("div",{key:g,class:f.normalizeClass(["tabItem",{active:f.unref(o)===g}]),onClick:p=>a(g)},[f.createTextVNode(f.toDisplayString(d)+" ",1),f.withDirectives(f.createElementVNode("div",WS,null,512),[[f.vShow,f.unref(o)===g]])],10,qS))),128))]),c.value?(f.openBlock(),f.createElementBlock("div",XS,[f.unref(n)==="blank"?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.unref(o)===0?(f.openBlock(),f.createBlock(FS,{key:0})):f.createCommentVNode("",!0)],64)):(f.openBlock(),f.createElementBlock(f.Fragment,{key:1},[f.unref(o)===0?(f.openBlock(),f.createBlock(JS,{key:0})):f.unref(o)===1?(f.openBlock(),f.createBlock(GS,{key:1})):f.createCommentVNode("",!0)],64))])):f.createCommentVNode("",!0)]))}},[["__scopeId","data-v-9ea41e56"]]),$S={class:"ems-editor"},ZS={class:"ems-editor__workspace"},Tr=Object.assign({name:"EmsEditor"},{__name:"index",props:{services:{type:Object,default:()=>({})},width:{type:Number,default:1920},height:{type:Number,default:1080}},emits:["ready","exit"],setup(s,{emit:t}){const e=s,n={setItem(o,r){r!==void 0&&window.localStorage.setItem(o,JSON.stringify(r))},getItem(o){let r=window.localStorage.getItem(o);return JSON.parse(r)},removeItem(o){window.localStorage.removeItem(o)},clear(){window.localStorage.clear()}},i={async getAllMenus(){var r;let o=[];return(r=e.services)!=null&&r.getAllMenus?o=await e.services.getAllMenus()||[]:o=n.getItem("menus")||[{id:"1",parentId:"0",name:"首页",children:[{id:crypto.randomUUID(),parentId:"1",name:"首页概览",style:{},value:{}}]}],n.setItem("menus",o),o},async getMenu(o){var r;if((r=e.services)!=null&&r.getMenu)return await e.services.getMenu(o)||{};{let a=n.getItem("menus")||[];for(let l of a)if(l.children){for(let c of l.children)if(c.id===o)return c}return{}}},async addMenu({parent:o,parentNameNew:r,name:a}){var l;if((l=e.services)!=null&&l.addMenu)return await e.services.addMenu({parent:o,parentNameNew:r,name:a});{let c=n.getItem("menus")||[],h=null,u=crypto.randomUUID(),d="";if(o==="0")d=crypto.randomUUID(),h={name:a,id:u,parentId:d,style:{},value:{}},c.push({name:r,id:d,parentId:"0",children:[h]});else{const g=c.find(p=>p.id===o);g&&(d=g.id,g.children.push({name:a,id:u,parentId:d,style:{},value:{}}),h={name:a,id:u,parentId:d,style:{},value:{}})}return n.setItem(u,h),n.setItem("menus",c),h}},async saveMenus(o){var a;const r=await this.getMenu(o.id);if(r&&(r.name=o.name,r.style=o.style,r.value=o.value),(a=e.services)!=null&&a.saveMenus)await e.services.saveMenus(o);else{let l=n.getItem("menus")||[];for(let c of l){const h=c.children.findIndex(u=>u.id===o.id);h>-1&&(c.children[h]=o)}n.setItem("menus",l),n.setItem(o.id,o)}},async removeMenu(o){var r;if((r=e.services)!=null&&r.removeMenus)await e.services.removeMenu(o);else{let a=n.getItem("menus")||[];if(this.getMenu(o)){const c=a.find(h=>{var u;return(u=h.children)==null?void 0:u.some(d=>d.id===o)});c&&(c.children=c.children.filter(h=>h.id!==o),c.children.length===0&&(a=a.filter(h=>h.id!==c.id))),n.setItem("menus",a)}n.removeItem(o)}}};return f.provide("topoApi",i),f.onMounted(()=>{}),f.onBeforeUnmount(()=>{}),(o,r)=>(f.openBlock(),f.createElementBlock("div",$S,[f.createElementVNode("div",ZS,[f.createVNode(QS),f.createVNode(uS,{width:e.width,height:e.height},null,8,["width","height"]),f.createVNode(_S)])]))}}),yd=Kt({__name:"preview",props:{menu:{type:Object,required:!0}},setup(s){const t=s,e=f.ref(null);let n=null;return f.onMounted(()=>{const{width:i,height:o}=t.menu.style;n=new S({container:e.value,width:i,height:o,interacting:!1,selecting:!1,keyboard:!1,mousewheel:!1,panning:!1}),Ir(),n.fromJSON(t.json)}),f.watch(()=>t.json,i=>{n&&(n.clearCells(),n.resize(i.width,i.height),n.fromJSON(i))},{deep:!0}),(i,o)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"container",ref:e,class:"ems-preview"},null,512))}},[["__scopeId","data-v-0f1512aa"]]),tM=[Tr],Ds=s=>{!s||Ds.installed||(s.use(de),tM.forEach(t=>{const e=t.name||t.__name;e&&s.component(e,t)}),Ds.installed=!0)},eM={install:Ds,EmsEditor:Tr,EmsPreview:yd};lt.EmsEditor=Tr,lt.EmsPreview=yd,lt.default=eM,lt.install=Ds,Object.defineProperties(lt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});