@cge-app/topo-core 0.0.1

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.
package/dist/index.cjs ADDED
@@ -0,0 +1,570 @@
1
+ "use strict";var zc=Object.defineProperty;var Vc=(s,t,e)=>t in s?zc(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var fi=(s,t,e)=>Vc(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});typeof window=="object"&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);typeof window<"u"&&function(s){s.forEach(t=>{Object.prototype.hasOwnProperty.call(t,"append")||Object.defineProperty(t,"append",{configurable:!0,enumerable:!0,writable:!0,value(...e){const n=document.createDocumentFragment();e.forEach(i=>{const r=i instanceof Node;n.appendChild(r?i:document.createTextNode(String(i)))}),this.appendChild(n)}})})}([Element.prototype,Document.prototype,DocumentFragment.prototype]);class Dt{get disposed(){return this._disposed===!0}dispose(){this._disposed=!0}}(function(s){function t(){return(e,n,i)=>{const r=i.value,o=e.__proto__;i.value=function(...a){this.disposed||(r.call(this,...a),o.dispose.call(this))}}}s.dispose=t})(Dt||(Dt={}));class Mr{constructor(){this.isDisposed=!1,this.items=new Set}get disposed(){return this.isDisposed}dispose(){this.isDisposed||(this.isDisposed=!0,this.items.forEach(t=>{t.dispose()}),this.items.clear())}contains(t){return this.items.has(t)}add(t){this.items.add(t)}remove(t){this.items.delete(t)}clear(){this.items.clear()}}(function(s){function t(e){const n=new s;return e.forEach(i=>{n.add(i)}),n}s.from=t})(Mr||(Mr={}));var $o=typeof global=="object"&&global&&global.Object===Object&&global,_c=typeof self=="object"&&self&&self.Object===Object&&self,te=$o||_c||Function("return this")(),Wt=te.Symbol,zo=Object.prototype,Fc=zo.hasOwnProperty,Gc=zo.toString,Ln=Wt?Wt.toStringTag:void 0;function Hc(s){var t=Fc.call(s,Ln),e=s[Ln];try{s[Ln]=void 0;var n=!0}catch{}var i=Gc.call(s);return n&&(t?s[Ln]=e:delete s[Ln]),i}var qc=Object.prototype,Uc=qc.toString;function Wc(s){return Uc.call(s)}var Xc="[object Null]",Yc="[object Undefined]",Tr=Wt?Wt.toStringTag:void 0;function Me(s){return s==null?s===void 0?Yc:Xc:Tr&&Tr in Object(s)?Hc(s):Wc(s)}function Jt(s){return s!=null&&typeof s=="object"}var Jc="[object Symbol]";function re(s){return typeof s=="symbol"||Jt(s)&&Me(s)==Jc}function Ci(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 It=Array.isArray,Nr=Wt?Wt.prototype:void 0,Rr=Nr?Nr.toString:void 0;function Vo(s){if(typeof s=="string")return s;if(It(s))return Ci(s,Vo)+"";if(re(s))return Rr?Rr.call(s):"";var t=s+"";return t=="0"&&1/s==-1/0?"-0":t}var Kc=/\s/;function Zc(s){for(var t=s.length;t--&&Kc.test(s.charAt(t)););return t}var Qc=/^\s+/;function th(s){return s&&s.slice(0,Zc(s)+1).replace(Qc,"")}function gt(s){var t=typeof s;return s!=null&&(t=="object"||t=="function")}var Lr=NaN,eh=/^[-+]0x[0-9a-f]+$/i,nh=/^0b[01]+$/i,ih=/^0o[0-7]+$/i,sh=parseInt;function Dn(s){if(typeof s=="number")return s;if(re(s))return Lr;if(gt(s)){var t=typeof s.valueOf=="function"?s.valueOf():s;s=gt(t)?t+"":t}if(typeof s!="string")return s===0?s:+s;s=th(s);var e=nh.test(s);return e||ih.test(s)?sh(s.slice(2),e?2:8):eh.test(s)?Lr:+s}function Pn(s){return s}var rh="[object AsyncFunction]",oh="[object Function]",ah="[object GeneratorFunction]",lh="[object Proxy]";function Ws(s){if(!gt(s))return!1;var t=Me(s);return t==oh||t==ah||t==rh||t==lh}var ds=te["__core-js_shared__"],Ir=function(){var s=/[^.]+$/.exec(ds&&ds.keys&&ds.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}();function ch(s){return!!Ir&&Ir in s}var hh=Function.prototype,uh=hh.toString;function Ge(s){if(s!=null){try{return uh.call(s)}catch{}try{return s+""}catch{}}return""}var fh=/[\\^$.*+?()[\]{}|]/g,dh=/^\[object .+?Constructor\]$/,gh=Function.prototype,ph=Object.prototype,mh=gh.toString,bh=ph.hasOwnProperty,yh=RegExp("^"+mh.call(bh).replace(fh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xh(s){if(!gt(s)||ch(s))return!1;var t=Ws(s)?yh:dh;return t.test(Ge(s))}function vh(s,t){return s?.[t]}function He(s,t){var e=vh(s,t);return xh(e)?e:void 0}var Ss=He(te,"WeakMap"),jr=Object.create,wh=function(){function s(){}return function(t){if(!gt(t))return{};if(jr)return jr(t);s.prototype=t;var e=new s;return s.prototype=void 0,e}}();function _o(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 Ch(){}function Fo(s,t){var e=-1,n=s.length;for(t||(t=Array(n));++e<n;)t[e]=s[e];return t}var Ph=800,Sh=16,Oh=Date.now;function Eh(s){var t=0,e=0;return function(){var n=Oh(),i=Sh-(n-e);if(e=n,i>0){if(++t>=Ph)return arguments[0]}else t=0;return s.apply(void 0,arguments)}}function Ah(s){return function(){return s}}var Si=function(){try{var s=He(Object,"defineProperty");return s({},"",{}),s}catch{}}(),Mh=Si?function(s,t){return Si(s,"toString",{configurable:!0,enumerable:!1,value:Ah(t),writable:!0})}:Pn,Go=Eh(Mh);function Th(s,t){for(var e=-1,n=s==null?0:s.length;++e<n&&t(s[e],e,s)!==!1;);return s}function Nh(s,t,e,n){for(var i=s.length,r=e+-1;++r<i;)if(t(s[r],r,s))return r;return-1}function Rh(s){return s!==s}function Lh(s,t,e){for(var n=e-1,i=s.length;++n<i;)if(s[n]===t)return n;return-1}function Ih(s,t,e){return t===t?Lh(s,t,e):Nh(s,Rh,e)}function Ho(s,t){var e=s==null?0:s.length;return!!e&&Ih(s,t,0)>-1}var jh=9007199254740991,Dh=/^(?:0|[1-9]\d*)$/;function qi(s,t){var e=typeof s;return t=t??jh,!!t&&(e=="number"||e!="symbol"&&Dh.test(s))&&s>-1&&s%1==0&&s<t}function Ui(s,t,e){t=="__proto__"&&Si?Si(s,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):s[t]=e}function Sn(s,t){return s===t||s!==s&&t!==t}var Bh=Object.prototype,kh=Bh.hasOwnProperty;function Xs(s,t,e){var n=s[t];(!(kh.call(s,t)&&Sn(n,e))||e===void 0&&!(t in s))&&Ui(s,t,e)}function ri(s,t,e,n){var i=!e;e||(e={});for(var r=-1,o=t.length;++r<o;){var a=t[r],l=void 0;l===void 0&&(l=s[a]),i?Ui(e,a,l):Xs(e,a,l)}return e}var Dr=Math.max;function qo(s,t,e){return t=Dr(t===void 0?s.length-1:t,0),function(){for(var n=arguments,i=-1,r=Dr(n.length-t,0),o=Array(r);++i<r;)o[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=e(o),_o(s,this,a)}}function On(s,t){return Go(qo(s,t,Pn),s+"")}var $h=9007199254740991;function Ys(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=$h}function qe(s){return s!=null&&Ys(s.length)&&!Ws(s)}function Oi(s,t,e){if(!gt(e))return!1;var n=typeof t;return(n=="number"?qe(e)&&qi(t,e.length):n=="string"&&t in e)?Sn(e[t],s):!1}function Uo(s){return On(function(t,e){var n=-1,i=e.length,r=i>1?e[i-1]:void 0,o=i>2?e[2]:void 0;for(r=s.length>3&&typeof r=="function"?(i--,r):void 0,o&&Oi(e[0],e[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++n<i;){var a=e[n];a&&s(t,a,n,r)}return t})}var zh=Object.prototype;function Wi(s){var t=s&&s.constructor,e=typeof t=="function"&&t.prototype||zh;return s===e}function Vh(s,t){for(var e=-1,n=Array(s);++e<s;)n[e]=t(e);return n}var _h="[object Arguments]";function Br(s){return Jt(s)&&Me(s)==_h}var Wo=Object.prototype,Fh=Wo.hasOwnProperty,Gh=Wo.propertyIsEnumerable,Ze=Br(function(){return arguments}())?Br:function(s){return Jt(s)&&Fh.call(s,"callee")&&!Gh.call(s,"callee")};function Hh(){return!1}var Xo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,kr=Xo&&typeof module=="object"&&module&&!module.nodeType&&module,qh=kr&&kr.exports===Xo,$r=qh?te.Buffer:void 0,Uh=$r?$r.isBuffer:void 0,Qe=Uh||Hh,Wh="[object Arguments]",Xh="[object Array]",Yh="[object Boolean]",Jh="[object Date]",Kh="[object Error]",Zh="[object Function]",Qh="[object Map]",tu="[object Number]",eu="[object Object]",nu="[object RegExp]",iu="[object Set]",su="[object String]",ru="[object WeakMap]",ou="[object ArrayBuffer]",au="[object DataView]",lu="[object Float32Array]",cu="[object Float64Array]",hu="[object Int8Array]",uu="[object Int16Array]",fu="[object Int32Array]",du="[object Uint8Array]",gu="[object Uint8ClampedArray]",pu="[object Uint16Array]",mu="[object Uint32Array]",at={};at[lu]=at[cu]=at[hu]=at[uu]=at[fu]=at[du]=at[gu]=at[pu]=at[mu]=!0;at[Wh]=at[Xh]=at[ou]=at[Yh]=at[au]=at[Jh]=at[Kh]=at[Zh]=at[Qh]=at[tu]=at[eu]=at[nu]=at[iu]=at[su]=at[ru]=!1;function bu(s){return Jt(s)&&Ys(s.length)&&!!at[Me(s)]}function Xi(s){return function(t){return s(t)}}var Yo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Bn=Yo&&typeof module=="object"&&module&&!module.nodeType&&module,yu=Bn&&Bn.exports===Yo,gs=yu&&$o.process,tn=function(){try{var s=Bn&&Bn.require&&Bn.require("util").types;return s||gs&&gs.binding&&gs.binding("util")}catch{}}(),zr=tn&&tn.isTypedArray,Yi=zr?Xi(zr):bu,xu=Object.prototype,vu=xu.hasOwnProperty;function Jo(s,t){var e=It(s),n=!e&&Ze(s),i=!e&&!n&&Qe(s),r=!e&&!n&&!i&&Yi(s),o=e||n||i||r,a=o?Vh(s.length,String):[],l=a.length;for(var c in s)(t||vu.call(s,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||r&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||qi(c,l)))&&a.push(c);return a}function Ko(s,t){return function(e){return s(t(e))}}var wu=Ko(Object.keys,Object),Cu=Object.prototype,Pu=Cu.hasOwnProperty;function Zo(s){if(!Wi(s))return wu(s);var t=[];for(var e in Object(s))Pu.call(s,e)&&e!="constructor"&&t.push(e);return t}function oi(s){return qe(s)?Jo(s):Zo(s)}function Su(s){var t=[];if(s!=null)for(var e in Object(s))t.push(e);return t}var Ou=Object.prototype,Eu=Ou.hasOwnProperty;function Au(s){if(!gt(s))return Su(s);var t=Wi(s),e=[];for(var n in s)n=="constructor"&&(t||!Eu.call(s,n))||e.push(n);return e}function En(s){return qe(s)?Jo(s,!0):Au(s)}var Mu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tu=/^\w*$/;function Js(s,t){if(It(s))return!1;var e=typeof s;return e=="number"||e=="symbol"||e=="boolean"||s==null||re(s)?!0:Tu.test(s)||!Mu.test(s)||t!=null&&s in Object(t)}var Un=He(Object,"create");function Nu(){this.__data__=Un?Un(null):{},this.size=0}function Ru(s){var t=this.has(s)&&delete this.__data__[s];return this.size-=t?1:0,t}var Lu="__lodash_hash_undefined__",Iu=Object.prototype,ju=Iu.hasOwnProperty;function Du(s){var t=this.__data__;if(Un){var e=t[s];return e===Lu?void 0:e}return ju.call(t,s)?t[s]:void 0}var Bu=Object.prototype,ku=Bu.hasOwnProperty;function $u(s){var t=this.__data__;return Un?t[s]!==void 0:ku.call(t,s)}var zu="__lodash_hash_undefined__";function Vu(s,t){var e=this.__data__;return this.size+=this.has(s)?0:1,e[s]=Un&&t===void 0?zu:t,this}function $e(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])}}$e.prototype.clear=Nu;$e.prototype.delete=Ru;$e.prototype.get=Du;$e.prototype.has=$u;$e.prototype.set=Vu;function _u(){this.__data__=[],this.size=0}function Ji(s,t){for(var e=s.length;e--;)if(Sn(s[e][0],t))return e;return-1}var Fu=Array.prototype,Gu=Fu.splice;function Hu(s){var t=this.__data__,e=Ji(t,s);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():Gu.call(t,e,1),--this.size,!0}function qu(s){var t=this.__data__,e=Ji(t,s);return e<0?void 0:t[e][1]}function Uu(s){return Ji(this.__data__,s)>-1}function Wu(s,t){var e=this.__data__,n=Ji(e,s);return n<0?(++this.size,e.push([s,t])):e[n][1]=t,this}function me(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])}}me.prototype.clear=_u;me.prototype.delete=Hu;me.prototype.get=qu;me.prototype.has=Uu;me.prototype.set=Wu;var Wn=He(te,"Map");function Xu(){this.size=0,this.__data__={hash:new $e,map:new(Wn||me),string:new $e}}function Yu(s){var t=typeof s;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?s!=="__proto__":s===null}function Ki(s,t){var e=s.__data__;return Yu(t)?e[typeof t=="string"?"string":"hash"]:e.map}function Ju(s){var t=Ki(this,s).delete(s);return this.size-=t?1:0,t}function Ku(s){return Ki(this,s).get(s)}function Zu(s){return Ki(this,s).has(s)}function Qu(s,t){var e=Ki(this,s),n=e.size;return e.set(s,t),this.size+=e.size==n?0:1,this}function be(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])}}be.prototype.clear=Xu;be.prototype.delete=Ju;be.prototype.get=Ku;be.prototype.has=Zu;be.prototype.set=Qu;var tf="Expected a function";function Ks(s,t){if(typeof s!="function"||t!=null&&typeof t!="function")throw new TypeError(tf);var e=function(){var n=arguments,i=t?t.apply(this,n):n[0],r=e.cache;if(r.has(i))return r.get(i);var o=s.apply(this,n);return e.cache=r.set(i,o)||r,o};return e.cache=new(Ks.Cache||be),e}Ks.Cache=be;var ef=500;function nf(s){var t=Ks(s,function(n){return e.size===ef&&e.clear(),n}),e=t.cache;return t}var sf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rf=/\\(\\)?/g,of=nf(function(s){var t=[];return s.charCodeAt(0)===46&&t.push(""),s.replace(sf,function(e,n,i,r){t.push(i?r.replace(rf,"$1"):n||e)}),t});function ai(s){return s==null?"":Vo(s)}function Zi(s,t){return It(s)?s:Js(s,t)?[s]:of(ai(s))}function li(s){if(typeof s=="string"||re(s))return s;var t=s+"";return t=="0"&&1/s==-1/0?"-0":t}function Qi(s,t){t=Zi(t,s);for(var e=0,n=t.length;s!=null&&e<n;)s=s[li(t[e++])];return e&&e==n?s:void 0}function af(s,t,e){var n=s==null?void 0:Qi(s,t);return n===void 0?e:n}function Zs(s,t){for(var e=-1,n=t.length,i=s.length;++e<n;)s[i+e]=t[e];return s}var Vr=Wt?Wt.isConcatSpreadable:void 0;function lf(s){return It(s)||Ze(s)||!!(Vr&&s&&s[Vr])}function ts(s,t,e,n,i){var r=-1,o=s.length;for(e||(e=lf),i||(i=[]);++r<o;){var a=s[r];e(a)?Zs(i,a):n||(i[i.length]=a)}return i}function cf(s){var t=s==null?0:s.length;return t?ts(s):[]}function hf(s){return Go(qo(s,void 0,cf),s+"")}var Qs=Ko(Object.getPrototypeOf,Object),uf="[object Object]",ff=Function.prototype,df=Object.prototype,Qo=ff.toString,gf=df.hasOwnProperty,pf=Qo.call(Object);function ae(s){if(!Jt(s)||Me(s)!=uf)return!1;var t=Qs(s);if(t===null)return!0;var e=gf.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&Qo.call(e)==pf}function mf(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 r=Array(i);++n<i;)r[n]=s[n+t];return r}function bf(s,t,e){var n=s.length;return e=e===void 0?n:e,!t&&e>=n?s:mf(s,t,e)}var yf="\\ud800-\\udfff",xf="\\u0300-\\u036f",vf="\\ufe20-\\ufe2f",wf="\\u20d0-\\u20ff",Cf=xf+vf+wf,Pf="\\ufe0e\\ufe0f",Sf="\\u200d",Of=RegExp("["+Sf+yf+Cf+Pf+"]");function ta(s){return Of.test(s)}function Ef(s){return s.split("")}var ea="\\ud800-\\udfff",Af="\\u0300-\\u036f",Mf="\\ufe20-\\ufe2f",Tf="\\u20d0-\\u20ff",Nf=Af+Mf+Tf,Rf="\\ufe0e\\ufe0f",Lf="["+ea+"]",Os="["+Nf+"]",Es="\\ud83c[\\udffb-\\udfff]",If="(?:"+Os+"|"+Es+")",na="[^"+ea+"]",ia="(?:\\ud83c[\\udde6-\\uddff]){2}",sa="[\\ud800-\\udbff][\\udc00-\\udfff]",jf="\\u200d",ra=If+"?",oa="["+Rf+"]?",Df="(?:"+jf+"(?:"+[na,ia,sa].join("|")+")"+oa+ra+")*",Bf=oa+ra+Df,kf="(?:"+[na+Os+"?",Os,ia,sa,Lf].join("|")+")",$f=RegExp(Es+"(?="+Es+")|"+kf+Bf,"g");function zf(s){return s.match($f)||[]}function Vf(s){return ta(s)?zf(s):Ef(s)}function aa(s){return function(t){t=ai(t);var e=ta(t)?Vf(t):void 0,n=e?e[0]:t.charAt(0),i=e?bf(e,1).join(""):t.slice(1);return n[s]()+i}}var Ei=aa("toUpperCase");function _f(s){return Ei(ai(s).toLowerCase())}function Ff(s,t,e,n){for(var i=-1,r=s==null?0:s.length;++i<r;)e=t(e,s[i],i,s);return e}function Gf(s){return function(t){return s?.[t]}}var Hf={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},qf=Gf(Hf),Uf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wf="\\u0300-\\u036f",Xf="\\ufe20-\\ufe2f",Yf="\\u20d0-\\u20ff",Jf=Wf+Xf+Yf,Kf="["+Jf+"]",Zf=RegExp(Kf,"g");function Qf(s){return s=ai(s),s&&s.replace(Uf,qf).replace(Zf,"")}var td=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ed(s){return s.match(td)||[]}var nd=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function id(s){return nd.test(s)}var la="\\ud800-\\udfff",sd="\\u0300-\\u036f",rd="\\ufe20-\\ufe2f",od="\\u20d0-\\u20ff",ad=sd+rd+od,ca="\\u2700-\\u27bf",ha="a-z\\xdf-\\xf6\\xf8-\\xff",ld="\\xac\\xb1\\xd7\\xf7",cd="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",hd="\\u2000-\\u206f",ud=" \\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",ua="A-Z\\xc0-\\xd6\\xd8-\\xde",fd="\\ufe0e\\ufe0f",fa=ld+cd+hd+ud,da="['’]",_r="["+fa+"]",dd="["+ad+"]",ga="\\d+",gd="["+ca+"]",pa="["+ha+"]",ma="[^"+la+fa+ga+ca+ha+ua+"]",pd="\\ud83c[\\udffb-\\udfff]",md="(?:"+dd+"|"+pd+")",bd="[^"+la+"]",ba="(?:\\ud83c[\\udde6-\\uddff]){2}",ya="[\\ud800-\\udbff][\\udc00-\\udfff]",Ye="["+ua+"]",yd="\\u200d",Fr="(?:"+pa+"|"+ma+")",xd="(?:"+Ye+"|"+ma+")",Gr="(?:"+da+"(?:d|ll|m|re|s|t|ve))?",Hr="(?:"+da+"(?:D|LL|M|RE|S|T|VE))?",xa=md+"?",va="["+fd+"]?",vd="(?:"+yd+"(?:"+[bd,ba,ya].join("|")+")"+va+xa+")*",wd="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Pd=va+xa+vd,Sd="(?:"+[gd,ba,ya].join("|")+")"+Pd,Od=RegExp([Ye+"?"+pa+"+"+Gr+"(?="+[_r,Ye,"$"].join("|")+")",xd+"+"+Hr+"(?="+[_r,Ye+Fr,"$"].join("|")+")",Ye+"?"+Fr+"+"+Gr,Ye+"+"+Hr,Cd,wd,ga,Sd].join("|"),"g");function Ed(s){return s.match(Od)||[]}function Ad(s,t,e){return s=ai(s),t=t,t===void 0?id(s)?Ed(s):ed(s):s.match(t)||[]}var Md="['’]",Td=RegExp(Md,"g");function wa(s){return function(t){return Ff(Ad(Qf(t).replace(Td,"")),s,"")}}var es=wa(function(s,t,e){return t=t.toLowerCase(),s+(e?_f(t):t)});function Nd(s,t,e){return s===s&&(e!==void 0&&(s=s<=e?s:e),t!==void 0&&(s=s>=t?s:t)),s}function kt(s,t,e){return e===void 0&&(e=t,t=void 0),e!==void 0&&(e=Dn(e),e=e===e?e:0),t!==void 0&&(t=Dn(t),t=t===t?t:0),Nd(Dn(s),t,e)}function Rd(){this.__data__=new me,this.size=0}function Ld(s){var t=this.__data__,e=t.delete(s);return this.size=t.size,e}function Id(s){return this.__data__.get(s)}function jd(s){return this.__data__.has(s)}var Dd=200;function Bd(s,t){var e=this.__data__;if(e instanceof me){var n=e.__data__;if(!Wn||n.length<Dd-1)return n.push([s,t]),this.size=++e.size,this;e=this.__data__=new be(n)}return e.set(s,t),this.size=e.size,this}function Xt(s){var t=this.__data__=new me(s);this.size=t.size}Xt.prototype.clear=Rd;Xt.prototype.delete=Ld;Xt.prototype.get=Id;Xt.prototype.has=jd;Xt.prototype.set=Bd;function kd(s,t){return s&&ri(t,oi(t),s)}function $d(s,t){return s&&ri(t,En(t),s)}var Ca=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qr=Ca&&typeof module=="object"&&module&&!module.nodeType&&module,zd=qr&&qr.exports===Ca,Ur=zd?te.Buffer:void 0,Wr=Ur?Ur.allocUnsafe:void 0;function Pa(s,t){if(t)return s.slice();var e=s.length,n=Wr?Wr(e):new s.constructor(e);return s.copy(n),n}function Vd(s,t){for(var e=-1,n=s==null?0:s.length,i=0,r=[];++e<n;){var o=s[e];t(o,e,s)&&(r[i++]=o)}return r}function Sa(){return[]}var _d=Object.prototype,Fd=_d.propertyIsEnumerable,Xr=Object.getOwnPropertySymbols,tr=Xr?function(s){return s==null?[]:(s=Object(s),Vd(Xr(s),function(t){return Fd.call(s,t)}))}:Sa;function Gd(s,t){return ri(s,tr(s),t)}var Hd=Object.getOwnPropertySymbols,Oa=Hd?function(s){for(var t=[];s;)Zs(t,tr(s)),s=Qs(s);return t}:Sa;function qd(s,t){return ri(s,Oa(s),t)}function Ea(s,t,e){var n=t(s);return It(s)?n:Zs(n,e(s))}function As(s){return Ea(s,oi,tr)}function Ud(s){return Ea(s,En,Oa)}var Ms=He(te,"DataView"),Ts=He(te,"Promise"),Ke=He(te,"Set"),Yr="[object Map]",Wd="[object Object]",Jr="[object Promise]",Kr="[object Set]",Zr="[object WeakMap]",Qr="[object DataView]",Xd=Ge(Ms),Yd=Ge(Wn),Jd=Ge(Ts),Kd=Ge(Ke),Zd=Ge(Ss),Gt=Me;(Ms&&Gt(new Ms(new ArrayBuffer(1)))!=Qr||Wn&&Gt(new Wn)!=Yr||Ts&&Gt(Ts.resolve())!=Jr||Ke&&Gt(new Ke)!=Kr||Ss&&Gt(new Ss)!=Zr)&&(Gt=function(s){var t=Me(s),e=t==Wd?s.constructor:void 0,n=e?Ge(e):"";if(n)switch(n){case Xd:return Qr;case Yd:return Yr;case Jd:return Jr;case Kd:return Kr;case Zd:return Zr}return t});var Qd=Object.prototype,tg=Qd.hasOwnProperty;function eg(s){var t=s.length,e=new s.constructor(t);return t&&typeof s[0]=="string"&&tg.call(s,"index")&&(e.index=s.index,e.input=s.input),e}var Ai=te.Uint8Array;function er(s){var t=new s.constructor(s.byteLength);return new Ai(t).set(new Ai(s)),t}function ng(s,t){var e=t?er(s.buffer):s.buffer;return new s.constructor(e,s.byteOffset,s.byteLength)}var ig=/\w*$/;function sg(s){var t=new s.constructor(s.source,ig.exec(s));return t.lastIndex=s.lastIndex,t}var to=Wt?Wt.prototype:void 0,eo=to?to.valueOf:void 0;function rg(s){return eo?Object(eo.call(s)):{}}function Aa(s,t){var e=t?er(s.buffer):s.buffer;return new s.constructor(e,s.byteOffset,s.length)}var og="[object Boolean]",ag="[object Date]",lg="[object Map]",cg="[object Number]",hg="[object RegExp]",ug="[object Set]",fg="[object String]",dg="[object Symbol]",gg="[object ArrayBuffer]",pg="[object DataView]",mg="[object Float32Array]",bg="[object Float64Array]",yg="[object Int8Array]",xg="[object Int16Array]",vg="[object Int32Array]",wg="[object Uint8Array]",Cg="[object Uint8ClampedArray]",Pg="[object Uint16Array]",Sg="[object Uint32Array]";function Og(s,t,e){var n=s.constructor;switch(t){case gg:return er(s);case og:case ag:return new n(+s);case pg:return ng(s,e);case mg:case bg:case yg:case xg:case vg:case wg:case Cg:case Pg:case Sg:return Aa(s,e);case lg:return new n;case cg:case fg:return new n(s);case hg:return sg(s);case ug:return new n;case dg:return rg(s)}}function Ma(s){return typeof s.constructor=="function"&&!Wi(s)?wh(Qs(s)):{}}var Eg="[object Map]";function Ag(s){return Jt(s)&&Gt(s)==Eg}var no=tn&&tn.isMap,Mg=no?Xi(no):Ag,Tg="[object Set]";function Ng(s){return Jt(s)&&Gt(s)==Tg}var io=tn&&tn.isSet,Rg=io?Xi(io):Ng,Lg=1,Ig=2,jg=4,Ta="[object Arguments]",Dg="[object Array]",Bg="[object Boolean]",kg="[object Date]",$g="[object Error]",Na="[object Function]",zg="[object GeneratorFunction]",Vg="[object Map]",_g="[object Number]",Ra="[object Object]",Fg="[object RegExp]",Gg="[object Set]",Hg="[object String]",qg="[object Symbol]",Ug="[object WeakMap]",Wg="[object ArrayBuffer]",Xg="[object DataView]",Yg="[object Float32Array]",Jg="[object Float64Array]",Kg="[object Int8Array]",Zg="[object Int16Array]",Qg="[object Int32Array]",tp="[object Uint8Array]",ep="[object Uint8ClampedArray]",np="[object Uint16Array]",ip="[object Uint32Array]",ot={};ot[Ta]=ot[Dg]=ot[Wg]=ot[Xg]=ot[Bg]=ot[kg]=ot[Yg]=ot[Jg]=ot[Kg]=ot[Zg]=ot[Qg]=ot[Vg]=ot[_g]=ot[Ra]=ot[Fg]=ot[Gg]=ot[Hg]=ot[qg]=ot[tp]=ot[ep]=ot[np]=ot[ip]=!0;ot[$g]=ot[Na]=ot[Ug]=!1;function kn(s,t,e,n,i,r){var o,a=t&Lg,l=t&Ig,c=t&jg;if(o!==void 0)return o;if(!gt(s))return s;var h=It(s);if(h){if(o=eg(s),!a)return Fo(s,o)}else{var f=Gt(s),u=f==Na||f==zg;if(Qe(s))return Pa(s,a);if(f==Ra||f==Ta||u&&!i){if(o=l||u?{}:Ma(s),!a)return l?qd(s,$d(o,s)):Gd(s,kd(o,s))}else{if(!ot[f])return i?s:{};o=Og(s,f,a)}}r||(r=new Xt);var d=r.get(s);if(d)return d;r.set(s,o),Rg(s)?s.forEach(function(m){o.add(kn(m,t,e,m,s,r))}):Mg(s)&&s.forEach(function(m,y){o.set(y,kn(m,t,e,y,s,r))});var g=c?l?Ud:As:l?En:oi,p=h?void 0:g(s);return Th(p||s,function(m,y){p&&(y=m,m=s[y]),Xs(o,y,kn(m,t,e,y,s,r))}),o}var sp=4;function Ns(s){return kn(s,sp)}var rp=1,op=4;function lt(s){return kn(s,rp|op)}var ap="__lodash_hash_undefined__";function lp(s){return this.__data__.set(s,ap),this}function cp(s){return this.__data__.has(s)}function en(s){var t=-1,e=s==null?0:s.length;for(this.__data__=new be;++t<e;)this.add(s[t])}en.prototype.add=en.prototype.push=lp;en.prototype.has=cp;function hp(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 nr(s,t){return s.has(t)}var up=1,fp=2;function La(s,t,e,n,i,r){var o=e&up,a=s.length,l=t.length;if(a!=l&&!(o&&l>a))return!1;var c=r.get(s),h=r.get(t);if(c&&h)return c==t&&h==s;var f=-1,u=!0,d=e&fp?new en:void 0;for(r.set(s,t),r.set(t,s);++f<a;){var g=s[f],p=t[f];if(n)var m=o?n(p,g,f,t,s,r):n(g,p,f,s,t,r);if(m!==void 0){if(m)continue;u=!1;break}if(d){if(!hp(t,function(y,x){if(!nr(d,x)&&(g===y||i(g,y,e,n,r)))return d.push(x)})){u=!1;break}}else if(!(g===p||i(g,p,e,n,r))){u=!1;break}}return r.delete(s),r.delete(t),u}function dp(s){var t=-1,e=Array(s.size);return s.forEach(function(n,i){e[++t]=[i,n]}),e}function ir(s){var t=-1,e=Array(s.size);return s.forEach(function(n){e[++t]=n}),e}var gp=1,pp=2,mp="[object Boolean]",bp="[object Date]",yp="[object Error]",xp="[object Map]",vp="[object Number]",wp="[object RegExp]",Cp="[object Set]",Pp="[object String]",Sp="[object Symbol]",Op="[object ArrayBuffer]",Ep="[object DataView]",so=Wt?Wt.prototype:void 0,ps=so?so.valueOf:void 0;function Ap(s,t,e,n,i,r,o){switch(e){case Ep:if(s.byteLength!=t.byteLength||s.byteOffset!=t.byteOffset)return!1;s=s.buffer,t=t.buffer;case Op:return!(s.byteLength!=t.byteLength||!r(new Ai(s),new Ai(t)));case mp:case bp:case vp:return Sn(+s,+t);case yp:return s.name==t.name&&s.message==t.message;case wp:case Pp:return s==t+"";case xp:var a=dp;case Cp:var l=n&gp;if(a||(a=ir),s.size!=t.size&&!l)return!1;var c=o.get(s);if(c)return c==t;n|=pp,o.set(s,t);var h=La(a(s),a(t),n,i,r,o);return o.delete(s),h;case Sp:if(ps)return ps.call(s)==ps.call(t)}return!1}var Mp=1,Tp=Object.prototype,Np=Tp.hasOwnProperty;function Rp(s,t,e,n,i,r){var o=e&Mp,a=As(s),l=a.length,c=As(t),h=c.length;if(l!=h&&!o)return!1;for(var f=l;f--;){var u=a[f];if(!(o?u in t:Np.call(t,u)))return!1}var d=r.get(s),g=r.get(t);if(d&&g)return d==t&&g==s;var p=!0;r.set(s,t),r.set(t,s);for(var m=o;++f<l;){u=a[f];var y=s[u],x=t[u];if(n)var b=o?n(x,y,u,t,s,r):n(y,x,u,s,t,r);if(!(b===void 0?y===x||i(y,x,e,n,r):b)){p=!1;break}m||(m=u=="constructor")}if(p&&!m){var v=s.constructor,C=t.constructor;v!=C&&"constructor"in s&&"constructor"in t&&!(typeof v=="function"&&v instanceof v&&typeof C=="function"&&C instanceof C)&&(p=!1)}return r.delete(s),r.delete(t),p}var Lp=1,ro="[object Arguments]",oo="[object Array]",di="[object Object]",Ip=Object.prototype,ao=Ip.hasOwnProperty;function jp(s,t,e,n,i,r){var o=It(s),a=It(t),l=o?oo:Gt(s),c=a?oo:Gt(t);l=l==ro?di:l,c=c==ro?di:c;var h=l==di,f=c==di,u=l==c;if(u&&Qe(s)){if(!Qe(t))return!1;o=!0,h=!1}if(u&&!h)return r||(r=new Xt),o||Yi(s)?La(s,t,e,n,i,r):Ap(s,t,l,e,n,i,r);if(!(e&Lp)){var d=h&&ao.call(s,"__wrapped__"),g=f&&ao.call(t,"__wrapped__");if(d||g){var p=d?s.value():s,m=g?t.value():t;return r||(r=new Xt),i(p,m,e,n,r)}}return u?(r||(r=new Xt),Rp(s,t,e,n,i,r)):!1}function ns(s,t,e,n,i){return s===t?!0:s==null||t==null||!Jt(s)&&!Jt(t)?s!==s&&t!==t:jp(s,t,e,n,ns,i)}var Dp=1,Bp=2;function kp(s,t,e,n){var i=e.length,r=i;if(s==null)return!r;for(s=Object(s);i--;){var o=e[i];if(o[2]?o[1]!==s[o[0]]:!(o[0]in s))return!1}for(;++i<r;){o=e[i];var a=o[0],l=s[a],c=o[1];if(o[2]){if(l===void 0&&!(a in s))return!1}else{var h=new Xt,f;if(!(f===void 0?ns(c,l,Dp|Bp,n,h):f))return!1}}return!0}function Ia(s){return s===s&&!gt(s)}function $p(s){for(var t=oi(s),e=t.length;e--;){var n=t[e],i=s[n];t[e]=[n,i,Ia(i)]}return t}function ja(s,t){return function(e){return e==null?!1:e[s]===t&&(t!==void 0||s in Object(e))}}function zp(s){var t=$p(s);return t.length==1&&t[0][2]?ja(t[0][0],t[0][1]):function(e){return e===s||kp(e,s,t)}}function Vp(s,t){return s!=null&&t in Object(s)}function Da(s,t,e){t=Zi(t,s);for(var n=-1,i=t.length,r=!1;++n<i;){var o=li(t[n]);if(!(r=s!=null&&e(s,o)))break;s=s[o]}return r||++n!=i?r:(i=s==null?0:s.length,!!i&&Ys(i)&&qi(o,i)&&(It(s)||Ze(s)))}function Ba(s,t){return s!=null&&Da(s,t,Vp)}var _p=1,Fp=2;function Gp(s,t){return Js(s)&&Ia(t)?ja(li(s),t):function(e){var n=af(e,s);return n===void 0&&n===t?Ba(e,s):ns(t,n,_p|Fp)}}function Hp(s){return function(t){return t?.[s]}}function qp(s){return function(t){return Qi(t,s)}}function Up(s){return Js(s)?Hp(li(s)):qp(s)}function sr(s){return typeof s=="function"?s:s==null?Pn:typeof s=="object"?It(s)?Gp(s[0],s[1]):zp(s):Up(s)}function Wp(s,t,e,n){for(var i=-1,r=s==null?0:s.length;++i<r;){var o=s[i];t(n,o,e(o),s)}return n}function Xp(s){return function(t,e,n){for(var i=-1,r=Object(t),o=n(t),a=o.length;a--;){var l=o[++i];if(e(r[l],l,r)===!1)break}return t}}var ka=Xp();function Yp(s,t){return s&&ka(s,t,oi)}function Jp(s,t){return function(e,n){if(e==null)return e;if(!qe(e))return s(e,n);for(var i=e.length,r=-1,o=Object(e);++r<i&&n(o[r],r,o)!==!1;);return e}}var $a=Jp(Yp);function Kp(s,t,e,n){return $a(s,function(i,r,o){t(n,i,e(i),o)}),n}function Zp(s,t){return function(e,n){var i=It(e)?Wp:Kp,r=t?t():{};return i(e,s,sr(n),r)}}var ms=function(){return te.Date.now()},Qp="Expected a function",tm=Math.max,em=Math.min;function rr(s,t,e){var n,i,r,o,a,l,c=0,h=!1,f=!1,u=!0;if(typeof s!="function")throw new TypeError(Qp);t=Dn(t)||0,gt(e)&&(h=!!e.leading,f="maxWait"in e,r=f?tm(Dn(e.maxWait)||0,t):r,u="trailing"in e?!!e.trailing:u);function d(S){var P=n,O=i;return n=i=void 0,c=S,o=s.apply(O,P),o}function g(S){return c=S,a=setTimeout(y,t),h?d(S):o}function p(S){var P=S-l,O=S-c,E=t-P;return f?em(E,r-O):E}function m(S){var P=S-l,O=S-c;return l===void 0||P>=t||P<0||f&&O>=r}function y(){var S=ms();if(m(S))return x(S);a=setTimeout(y,p(S))}function x(S){return a=void 0,u&&n?d(S):(n=i=void 0,o)}function b(){a!==void 0&&clearTimeout(a),c=0,n=l=i=a=void 0}function v(){return a===void 0?o:x(ms())}function C(){var S=ms(),P=m(S);if(n=arguments,i=this,l=S,P){if(a===void 0)return g(l);if(f)return clearTimeout(a),a=setTimeout(y,t),d(l)}return a===void 0&&(a=setTimeout(y,t)),o}return C.cancel=b,C.flush=v,C}var za=Object.prototype,nm=za.hasOwnProperty,im=On(function(s,t){s=Object(s);var e=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&Oi(t[0],t[1],i)&&(n=1);++e<n;)for(var r=t[e],o=En(r),a=-1,l=o.length;++a<l;){var c=o[a],h=s[c];(h===void 0||Sn(h,za[c])&&!nm.call(s,c))&&(s[c]=r[c])}return s});function Rs(s,t,e){(e!==void 0&&!Sn(s[t],e)||e===void 0&&!(t in s))&&Ui(s,t,e)}function Mi(s){return Jt(s)&&qe(s)}function Ls(s,t){if(!(t==="constructor"&&typeof s[t]=="function")&&t!="__proto__")return s[t]}function sm(s){return ri(s,En(s))}function rm(s,t,e,n,i,r,o){var a=Ls(s,e),l=Ls(t,e),c=o.get(l);if(c){Rs(s,e,c);return}var h=r?r(a,l,e+"",s,t,o):void 0,f=h===void 0;if(f){var u=It(l),d=!u&&Qe(l),g=!u&&!d&&Yi(l);h=l,u||d||g?It(a)?h=a:Mi(a)?h=Fo(a):d?(f=!1,h=Pa(l,!0)):g?(f=!1,h=Aa(l,!0)):h=[]:ae(l)||Ze(l)?(h=a,Ze(a)?h=sm(a):(!gt(a)||Ws(a))&&(h=Ma(l))):f=!1}f&&(o.set(l,h),i(h,l,n,r,o),o.delete(l)),Rs(s,e,h)}function is(s,t,e,n,i){s!==t&&ka(t,function(r,o){if(i||(i=new Xt),gt(r))rm(s,t,o,e,is,n,i);else{var a=n?n(Ls(s,o),r,o+"",s,t,i):void 0;a===void 0&&(a=r),Rs(s,o,a)}},En)}function Va(s,t,e,n,i,r){return gt(s)&&gt(t)&&(r.set(t,s),is(s,t,void 0,Va,r),r.delete(t)),s}var om=Uo(function(s,t,e,n){is(s,t,e,n)}),_a=On(function(s){return s.push(void 0,Va),_o(om,void 0,s)}),am=200;function lm(s,t,e,n){var i=-1,r=Ho,o=!0,a=s.length,l=[],c=t.length;if(!a)return l;t.length>=am&&(r=nr,o=!1,t=new en(t));t:for(;++i<a;){var h=s[i],f=h;if(h=h!==0?h:0,o&&f===f){for(var u=c;u--;)if(t[u]===f)continue t;l.push(h)}else r(t,f,n)||l.push(h)}return l}var cm=On(function(s,t){return Mi(s)?lm(s,ts(t,1,Mi,!0)):[]});function hm(s,t){var e=-1,n=qe(s)?Array(s.length):[];return $a(s,function(i,r,o){n[++e]=t(i,r,o)}),n}var um=Object.prototype,fm=um.hasOwnProperty,lo=Zp(function(s,t,e){fm.call(s,e)?s[e].push(t):Ui(s,e,[t])});function dm(s,t){return s>t}var gm=Object.prototype,pm=gm.hasOwnProperty;function mm(s,t){return s!=null&&pm.call(s,t)}function gi(s,t){return s!=null&&Da(s,t,mm)}var bm="[object Map]",ym="[object Set]",xm=Object.prototype,vm=xm.hasOwnProperty;function Fa(s){if(s==null)return!0;if(qe(s)&&(It(s)||typeof s=="string"||typeof s.splice=="function"||Qe(s)||Yi(s)||Ze(s)))return!s.length;var t=Gt(s);if(t==bm||t==ym)return!s.size;if(Wi(s))return!Zo(s).length;for(var e in s)if(vm.call(s,e))return!1;return!0}function ne(s,t){return ns(s,t)}var wm="[object Number]";function Is(s){return typeof s=="number"||Jt(s)&&Me(s)==wm}var Cm=aa("toLowerCase");function Pm(s,t,e){for(var n=-1,i=s.length;++n<i;){var r=s[n],o=t(r);if(o!=null&&(a===void 0?o===o&&!re(o):e(o,a)))var a=o,l=r}return l}function Sm(s){return s&&s.length?Pm(s,Pn,dm):void 0}var mt=Uo(function(s,t,e){is(s,t,e)});function Om(s,t,e,n){if(!gt(s))return s;t=Zi(t,s);for(var i=-1,r=t.length,o=r-1,a=s;a!=null&&++i<r;){var l=li(t[i]),c=e;if(l==="__proto__"||l==="constructor"||l==="prototype")return s;if(i!=o){var h=a[l];c=void 0,c===void 0&&(c=gt(h)?h:qi(t[i+1])?[]:{})}Xs(a,l,c),a=a[l]}return s}function Em(s,t,e){for(var n=-1,i=t.length,r={};++n<i;){var o=t[n],a=Qi(s,o);e(a,o)&&Om(r,Zi(o,s),a)}return r}function Am(s,t){var e=s.length;for(s.sort(t);e--;)s[e]=s[e].value;return s}function Mm(s,t){if(s!==t){var e=s!==void 0,n=s===null,i=s===s,r=re(s),o=t!==void 0,a=t===null,l=t===t,c=re(t);if(!a&&!c&&!r&&s>t||r&&o&&l&&!a&&!c||n&&o&&l||!e&&l||!i)return 1;if(!n&&!r&&!c&&s<t||c&&e&&i&&!n&&!r||a&&e&&i||!o&&i||!l)return-1}return 0}function Tm(s,t,e){for(var n=-1,i=s.criteria,r=t.criteria,o=i.length,a=e.length;++n<o;){var l=Mm(i[n],r[n]);if(l){if(n>=a)return l;var c=e[n];return l*(c=="desc"?-1:1)}}return s.index-t.index}function Nm(s,t,e){t.length?t=Ci(t,function(r){return It(r)?function(o){return Qi(o,r.length===1?r[0]:r)}:r}):t=[Pn];var n=-1;t=Ci(t,Xi(sr));var i=hm(s,function(r,o,a){var l=Ci(t,function(c){return c(r)});return{criteria:l,index:++n,value:r}});return Am(i,function(r,o){return Tm(r,o,e)})}function Rm(s,t){return Em(s,t,function(e,n){return Ba(s,n)})}var co=hf(function(s,t){return s==null?{}:Rm(s,t)}),or=On(function(s,t){if(s==null)return[];var e=t.length;return e>1&&Oi(s,t[0],t[1])?t=[]:e>2&&Oi(t[0],t[1],t[2])&&(t=[t[0]]),Nm(s,ts(t),[])}),Lm=4294967295,Im=Lm-1,jm=Math.floor,Dm=Math.min;function Ga(s,t,e,n){var i=0,r=s==null?0:s.length;if(r===0)return 0;t=e(t);for(var o=t!==t,a=t===null,l=re(t),c=t===void 0;i<r;){var h=jm((i+r)/2),f=e(s[h]),u=f!==void 0,d=f===null,g=f===f,p=re(f);if(o)var m=g;else c?m=g&&u:a?m=g&&u&&!d:l?m=g&&u&&!d&&!p:d||p?m=!1:m=f<t;m?i=h+1:r=h}return Dm(r,Im)}var Bm=4294967295,km=Bm>>>1;function $m(s,t,e){var n=0,i=s==null?n:s.length;if(typeof t=="number"&&t===t&&i<=km){for(;n<i;){var r=n+i>>>1,o=s[r];o!==null&&!re(o)&&o<t?n=r+1:i=r}return i}return Ga(s,t,Pn)}function zm(s,t){return $m(s,t)}function Vm(s,t,e){return Ga(s,t,sr(e))}var _m=wa(function(s,t,e){return s+(e?" ":"")+Ei(t)}),Fm="Expected a function";function Gm(s,t,e){var n=!0,i=!0;if(typeof s!="function")throw new TypeError(Fm);return gt(e)&&(n="leading"in e?!0:n,i="trailing"in e?!!e.trailing:i),rr(s,t,{leading:n,maxWait:t,trailing:i})}var Hm=1/0,qm=Ke&&1/ir(new Ke([,-0]))[1]==Hm?function(s){return new Ke(s)}:Ch,Um=200;function Ha(s,t,e){var n=-1,i=Ho,r=s.length,o=!0,a=[],l=a;if(r>=Um){var c=qm(s);if(c)return ir(c);o=!1,i=nr,l=new en}else l=a;t:for(;++n<r;){var h=s[n],f=h;if(h=h!==0?h:0,o&&f===f){for(var u=l.length;u--;)if(l[u]===f)continue t;a.push(h)}else i(l,f,e)||(l!==a&&l.push(f),a.push(h))}return a}var ho=On(function(s){return Ha(ts(s,1,Mi,!0))});function qa(s){return s&&s.length?Ha(s):[]}function Ua(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 k(s,t,...e){return Ua(s,t,e)}function Wm(s){return typeof s=="object"&&s.then&&typeof s.then=="function"}function js(s){return s!=null&&(s instanceof Promise||Wm(s))}function ar(...s){const t=[];if(s.forEach(n=>{Array.isArray(n)?t.push(...n):t.push(n)}),t.some(n=>js(n))){const n=t.map(i=>js(i)?i:Promise.resolve(i!==!1));return Promise.all(n).then(i=>i.reduce((r,o)=>o!==!1&&r,!0))}return t.every(n=>n!==!1)}function Xm(...s){const t=ar(s);return typeof t=="boolean"?Promise.resolve(t):t}function bs(s,t){const e=[];for(let n=0;n<s.length;n+=2){const i=s[n],r=s[n+1],o=Array.isArray(t)?t:[t],a=Ua(i,r,o);e.push(a)}return ar(e)}class Ym{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=(...r)=>(this.off(t,i),bs([e,n],r));return this.on(t,i,this)}off(t,e,n){if(!(t||e||n))return this.listeners={},this;const i=this.listeners;return(t?[t]:Object.keys(i)).forEach(o=>{const a=i[o];if(a){if(!(e||n)){delete i[o];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 r=this.listeners[t];r!=null&&(n=bs([...r],e))}const i=this.listeners["*"];return i!=null?ar([n,bs([...i],[t,...e])]):n}emit(t,...e){return this.trigger(t,...e)}}function Jm(s,...t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(s.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}const Km=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 Zm(s,t){Km(s,t);function e(){this.constructor=s}s.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}class Qm{}const tb=/^\s*class\s+/.test(`${Qm}`)||/^\s*class\s*\{/.test(`${class{}}`);function lr(s,t){let e;return tb?e=class extends t{}:(e=function(){return t.apply(this,arguments)},Zm(e,t)),Object.defineProperty(e,"name",{value:s}),e}function uo(s){return s==="__proto__"}function cr(s,t,e="/"){let n;const i=Array.isArray(t)?t:t.split(e);if(i.length)for(n=s;i.length;){const r=i.shift();if(Object(n)===n&&r&&r in n)n=n[r];else return}return n}function An(s,t,e,n="/"){const i=Array.isArray(t)?t:t.split(n),r=i.pop();if(r&&!uo(r)){let o=s;i.forEach(a=>{uo(a)||(o[a]==null&&(o[a]={}),o=o[a])}),o[r]=e}return s}function fo(s,t,e="/"){const n=Array.isArray(t)?t.slice():t.split(e),i=n.pop();if(i)if(n.length>0){const r=cr(s,n);r&&delete r[i]}else delete s[i];return s}var eb=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class rt extends Ym{dispose(){this.off()}}eb([Dt.dispose()],rt.prototype,"dispose",null);(function(s){s.dispose=Dt.dispose})(rt||(rt={}));Jm(rt,Dt);const Wa=s=>{const t=Object.create(null);return e=>t[e]||(t[e]=s(e))},Xa=Wa(s=>s.replace(/\B([A-Z])/g,"-$1").toLowerCase()),hr=Wa(s=>_m(es(s)).replace(/ /g,""));function ys(s){let t=2166136261,e=!1,n=s;for(let i=0,r=n.length;i<r;i+=1){let o=n.charCodeAt(i);o>127&&!e&&(n=unescape(encodeURIComponent(n)),o=n.charCodeAt(i),e=!0),t^=o,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function Ti(){let s="";const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let e=0,n=t.length;e<n;e+=1){const i=t[e],r=Math.random()*16|0,o=i==="x"?r:i==="y"?r&3|8:i;s+=o.toString(16)}return s}function nb(s,t,e){const n=Math.min(2,Math.floor(s.length*.34));let i=Math.floor(s.length*.4)+1,r,o=!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(o||c.length<3)continue;const f=ib(a,h,i-1);if(f===void 0)continue;f<3?(o=!0,r=l):(i=f,r=l)}}return r}function ib(s,t,e){let n=new Array(t.length+1),i=new Array(t.length+1);const r=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 f=a;for(let d=1;d<c;d+=1)i[d]=r;for(let d=c;d<=h;d+=1){const g=l===t.charCodeAt(d-1)?n[d-1]:Math.min(n[d]+1,i[d-1]+1,n[d-1]+2);i[d]=g,f=Math.min(f,g)}for(let d=h+1;d<=t.length;d+=1)i[d]=r;if(f>e)return;const u=n;n=i,i=u}const o=n[t.length];return o>e?void 0:o}function de(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),de(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 Yt(s){if(typeof s=="object"){let e=0,n=0,i=0,r=0;return s.vertical!=null&&Number.isFinite(s.vertical)&&(n=r=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)&&(r=s.bottom),{top:n,right:i,bottom:r,left:e}}let t=0;return s!=null&&Number.isFinite(s)&&(t=s),{top:t,right:t,bottom:t,left:t}}let ur=!1,Ya=!1,Ja=!1,Ka=!1,Za=!1,Qa=!1,tl=!1,el=!1,nl=!1,il=!1,sl=!1,rl=!1,ol=!1,al=!1,ll=!1,cl=!1;if(typeof navigator=="object"){const s=navigator.userAgent;ur=s.indexOf("Macintosh")>=0,Ya=!!s.match(/(iPad|iPhone|iPod)/g),Ja=s.indexOf("Windows")>=0,Ka=s.indexOf("MSIE")>=0,Za=!!s.match(/Trident\/7\./),Qa=!!s.match(/Edge\//),tl=s.indexOf("Mozilla/")>=0&&s.indexOf("MSIE")<0&&s.indexOf("Edge/")<0,nl=s.indexOf("Chrome/")>=0&&s.indexOf("Edge/")<0,il=s.indexOf("Opera/")>=0||s.indexOf("OPR/")>=0,sl=s.indexOf("Firefox/")>=0,rl=s.indexOf("AppleWebKit/")>=0&&s.indexOf("Chrome/")<0&&s.indexOf("Edge/")<0,typeof document=="object"&&(cl=!document.createElementNS||`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`!="[object SVGForeignObjectElement]"||s.indexOf("Opera/")>=0)}typeof window=="object"&&(el=window.chrome!=null&&window.chrome.app!=null&&window.chrome.app.runtime!=null,al=window.PointerEvent!=null&&!ur);if(typeof document=="object"){ol="ontouchstart"in document.documentElement;try{const s=Object.defineProperty({},"passive",{get(){ll=!0}}),t=document.createElement("div");t.addEventListener&&t.addEventListener("click",()=>{},s)}catch{}}var qt;(function(s){s.IS_MAC=ur,s.IS_IOS=Ya,s.IS_WINDOWS=Ja,s.IS_IE=Ka,s.IS_IE11=Za,s.IS_EDGE=Qa,s.IS_NETSCAPE=tl,s.IS_CHROME_APP=el,s.IS_CHROME=nl,s.IS_OPERA=il,s.IS_FIREFOX=sl,s.IS_SAFARI=rl,s.SUPPORT_TOUCH=ol,s.SUPPORT_POINTER=al,s.SUPPORT_PASSIVE=ll,s.NO_FOREIGNOBJECT=cl,s.SUPPORT_FOREIGNOBJECT=!s.NO_FOREIGNOBJECT})(qt||(qt={}));(function(s){function t(){const r=window.module;return r!=null&&r.hot!=null&&r.hot.status!=null?r.hot.status():"unkonwn"}s.getHMRStatus=t;function e(){return t()==="apply"}s.isApplyingHMR=e;const n={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};function i(r){const o=document.createElement(n[r]||"div"),a=`on${r}`;let l=a in o;return l||(o.setAttribute(a,"return;"),l=typeof o[a]=="function"),l}s.isEventSupported=i})(qt||(qt={}));const fr=/[\t\r\n\f]/g,dr=/\S+/g,nn=s=>` ${s} `;function sn(s){return s&&s.getAttribute&&s.getAttribute("class")||""}function Mn(s,t){if(s==null||t==null)return!1;const e=nn(sn(s)),n=nn(t);return s.nodeType===1?e.replace(fr," ").includes(n):!1}function B(s,t){if(!(s==null||t==null)){if(typeof t=="function")return B(s,t(sn(s)));if(typeof t=="string"&&s.nodeType===1){const e=t.match(dr)||[],n=nn(sn(s)).replace(fr," ");let i=e.reduce((r,o)=>r.indexOf(nn(o))<0?`${r}${o} `:r,n);i=i.trim(),n!==i&&s.setAttribute("class",i)}}}function pt(s,t){if(s!=null){if(typeof t=="function")return pt(s,t(sn(s)));if((!t||typeof t=="string")&&s.nodeType===1){const e=(t||"").match(dr)||[],n=nn(sn(s)).replace(fr," ");let i=e.reduce((r,o)=>{const a=nn(o);return r.indexOf(a)>-1?r.replace(a," "):r},n);i=t?i.trim():"",n!==i&&s.setAttribute("class",i)}}}function $n(s,t,e){if(!(s==null||t==null)){if(e!=null&&typeof t=="string"){e?B(s,t):pt(s,t);return}if(typeof t=="function")return $n(s,t(sn(s),e),e);typeof t=="string"&&(t.match(dr)||[]).forEach(i=>{Mn(s,i)?pt(s,i):B(s,i)})}}let go=0;function sb(){return go+=1,`v${go}`}function gr(s){return(s.id==null||s.id==="")&&(s.id=sb()),s.id}function Pe(s){return s==null?!1:typeof s.getScreenCTM=="function"&&s instanceof SVGElement}const At={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"},po="1.1";function mo(s,t=document){return t.createElement(s)}function pr(s,t=At.xhtml,e=document){return e.createElementNS(t,s)}function ee(s,t=document){return pr(s,At.svg,t)}function Ni(s){if(s){const e=`<svg xmlns="${At.svg}" xmlns:xlink="${At.xlink}" version="${po}">${s}</svg>`,{documentElement:n}=rb(e,{async:!1});return n}const t=document.createElementNS(At.svg,"svg");return t.setAttributeNS(At.xmlns,"xmlns:xlink",At.xlink),t.setAttribute("version",po),t}function rb(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 ob(s,t=!0){const e=s.nodeName;return t?e.toLowerCase():e.toUpperCase()}function mr(s){let t=0,e=s.previousSibling;for(;e;)e.nodeType===1&&(t+=1),e=e.previousSibling;return t}function ab(s,t){return s.querySelectorAll(t)}function lb(s,t){return s.querySelector(t)}function hl(s,t,e){const n=s.ownerSVGElement;let i=s.parentNode;for(;i&&i!==e&&i!==n;){if(Mn(i,t))return i;i=i.parentNode}return null}function br(s,t){const e=t&&t.parentNode;return s===e||!!(e&&e.nodeType===1&&s.compareDocumentPosition(e)&16)}function ie(s){s&&(Array.isArray(s)?s:[s]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}function ci(s){for(;s.firstChild;)s.removeChild(s.firstChild)}function Ut(s,t){(Array.isArray(t)?t:[t]).forEach(n=>{n!=null&&s.appendChild(n)})}function ul(s,t){const e=s.firstChild;return e?Xn(e,t):Ut(s,t)}function Xn(s,t){const e=s.parentNode;e&&(Array.isArray(t)?t:[t]).forEach(i=>{i!=null&&e.insertBefore(i,s)})}function cb(s,t){const e=s.parentNode;e&&(Array.isArray(t)?t:[t]).forEach(i=>{i!=null&&e.insertBefore(i,s.nextSibling)})}function ue(s,t){t?.appendChild(s)}function hb(s){return!!s&&s.nodeType===1}function bo(s){try{return s instanceof HTMLElement}catch{return typeof s=="object"&&s.nodeType===1&&typeof s.style=="object"&&typeof s.ownerDocument=="object"}}function ub(s,t){const e=[];let n=s.firstChild;for(;n;n=n.nextSibling)n.nodeType===1&&(!t||Mn(n,t))&&e.push(n);return e}const fl=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function fb(s,t){return s.getAttribute(t)}function yr(s,t){const e=gl(t);e.ns?s.hasAttributeNS(e.ns,e.local)&&s.removeAttributeNS(e.ns,e.local):s.hasAttribute(t)&&s.removeAttribute(t)}function xr(s,t,e){if(e==null)return yr(s,t);const n=gl(t);n.ns&&typeof e=="string"?s.setAttributeNS(n.ns,t,e):t==="id"?s.id=`${e}`:s.setAttribute(t,`${e}`)}function dl(s,t){Object.keys(t).forEach(e=>{xr(s,e,t[e])})}function X(s,t,e){if(t==null){const n=s.attributes,i={};for(let r=0;r<n.length;r+=1)i[n[r].name]=n[r].value;return i}if(typeof t=="string"&&e===void 0)return s.getAttribute(t);typeof t=="object"?dl(s,t):xr(s,t,e)}function gl(s){if(s.indexOf(":")!==-1){const t=s.split(":");return{ns:At[t[0]],local:t[1]}}return{ns:null,local:s}}function Yn(s){const t={};return Object.keys(s).forEach(e=>{const n=fl.includes(e)?e:Xa(e);t[n]=s[e]}),t}function pi(s){const t={};return s.split(";").forEach(n=>{const i=n.trim();if(i){const r=i.split("=");r.length&&(t[r[0].trim()]=r[1]?r[1].trim():"")}}),t}function Ds(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 r,o;n&&i?(r=s[e],o=t[e]):n?(r=s[e],o=pi(t[e])):i?(r=pi(s[e]),o=t[e]):(r=pi(s[e]),o=pi(t[e])),s[e]=Ds(r,o)}else s[e]=t[e]}),s}function db(s,t,e={}){const n=e.offset||0,i=[],r=[];let o,a,l=null;for(let c=0;c<s.length;c+=1){o=r[c]=s[c];for(let h=0,f=t.length;h<f;h+=1){const u=t[h],d=u.start+n,g=u.end+n;c>=d&&c<g&&(typeof o=="string"?o=r[c]={t:s[c],attrs:u.attrs}:o.attrs=Ds(Ds({},o.attrs),u.attrs),e.includeAnnotationIndices&&(o.annotations==null&&(o.annotations=[]),o.annotations.push(h)))}a=r[c-1],a?gt(o)&&gt(a)?(l=l,JSON.stringify(o.attrs)===JSON.stringify(a.attrs)?l.t+=o.t:(i.push(l),l=o)):gt(o)||gt(a)?(l=l,i.push(l),l=o):l=(l||"")+o:l=o}return l!=null&&i.push(l),i}function gb(s){return s.replace(/ /g," ")}var Le;(function(s){function t(c){const h="data:";return c.substr(0,h.length)===h}s.isDataUrl=t;function e(c,h){if(!c||t(c)){setTimeout(()=>h(null,c));return}const f=()=>{h(new Error(`Failed to load image: ${c}`))},u=window.FileReader?g=>{if(g.status===200){const p=new FileReader;p.onload=m=>{const y=m.target.result;h(null,y)},p.onerror=f,p.readAsDataURL(g.response)}else f()}:g=>{const p=m=>{const x=[];for(let b=0;b<m.length;b+=32768)x.push(String.fromCharCode.apply(null,m.subarray(b,b+32768)));return x.join("")};if(g.status===200){let m=c.split(".").pop()||"png";m==="svg"&&(m="svg+xml");const y=`data:image/${m};base64,`,x=new Uint8Array(g.response),b=y+btoa(p(x));h(null,b)}else f()},d=new XMLHttpRequest;d.responseType=window.FileReader?"blob":"arraybuffer",d.open("GET",c,!0),d.addEventListener("error",f),d.addEventListener("load",()=>u(d)),d.send()}s.imageToDataUri=e;function n(c){let h=c.replace(/\s/g,"");h=decodeURIComponent(h);const f=h.indexOf(","),u=h.slice(0,f),d=u.split(":")[1].split(";")[0],g=h.slice(f+1);let p;u.indexOf("base64")>=0?p=atob(g):p=unescape(encodeURIComponent(g));const m=new Uint8Array(p.length);for(let y=0;y<p.length;y+=1)m[y]=p.charCodeAt(y);return new Blob([m],{type:d})}s.dataUriToBlob=n;function i(c,h){const f=window.navigator.msSaveBlob;if(f)f(c,h);else{const u=window.URL.createObjectURL(c),d=document.createElement("a");d.href=u,d.download=h,document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(u)}}s.downloadBlob=i;function r(c,h){const f=n(c);i(f,h)}s.downloadDataUri=r;function o(c){const h=c.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return h&&h[2]?h[2].replace(/\s+/," ").split(" "):null}function a(c){const h=parseFloat(c);return Number.isNaN(h)?null:h}function l(c,h={}){let f=null;const u=b=>(f==null&&(f=o(c)),f!=null?a(f[b]):null),d=b=>{const v=c.match(b);return v&&v[2]?a(v[2]):null};let g=h.width;if(g==null&&(g=d(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),g==null&&(g=u(2)),g==null)throw new Error("Can not parse width from svg string");let p=h.height;if(p==null&&(p=d(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),p==null&&(p=u(3)),p==null)throw new Error("Can not parse height from svg string");return`data:image/svg+xml,${encodeURIComponent(c).replace(/'/g,"%27").replace(/"/g,"%22")}`}s.svgToDataUrl=l})(Le||(Le={}));let Ie;const pb={px(s){return s},mm(s){return Ie*s},cm(s){return Ie*s*10},in(s){return Ie*s*25.4},pt(s){return Ie*(25.4*s/72)},pc(s){return Ie*(25.4*s/6)}};var yo;(function(s){function t(n,i,r){const o=document.createElement("div"),a=o.style;a.display="inline-block",a.position="absolute",a.left="-15000px",a.top="-15000px",a.width=n+(r||"px"),a.height=i+(r||"px"),document.body.appendChild(o);const l=o.getBoundingClientRect(),c={width:l.width||0,height:l.height||0};return document.body.removeChild(o),c}s.measure=t;function e(n,i){Ie==null&&(Ie=t("1","1","mm").width);const r=i?pb[i]:null;return r?r(n):n}s.toPx=e})(yo||(yo={}));const mb=/-(.)/g;function bb(s){return s.replace(mb,(t,e)=>e.toUpperCase())}const xs={},xo=["webkit","ms","moz","o"],pl=typeof document<"u"?document.createElement("div").style:{};function yb(s){for(let t=0;t<xo.length;t+=1){const e=xo[t]+s;if(e in pl)return e}return null}function xb(s){const t=bb(s);if(xs[t]==null){const e=t.charAt(0).toUpperCase()+t.slice(1);xs[t]=t in pl?t:yb(e)}return xs[t]}function vo(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 vb={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 wb(s){return/^--/.test(s)}function Ri(s,t,e){const n=window.getComputedStyle(s,null);return e?n.getPropertyValue(t)||void 0:n[t]||s.style[t]}function mi(s,t){return parseInt(Ri(s,t),10)||0}function Cb(s,t){return!vb[s]&&typeof t=="number"?`${t}px`:t}function J(s,t,e){if(typeof t=="string"){const n=wb(t);if(n||(t=xb(t)),e===void 0)return Ri(s,t,n);n||(e=Cb(t,e));const i=s.style;n?i.setProperty(t,e):i[t]=e;return}for(const n in t)J(s,n,t[n])}const Li=new WeakMap;function wo(s,t){const e=es(t),n=Li.get(s);if(n)return n[e]}function Pb(s,t,e){const n=es(t),i=Li.get(s);i?i[n]=e:Li.set(s,{[n]:e})}function ze(s,t,e){if(!t){const n={};return Object.keys(Li).forEach(i=>{n[i]=wo(s,i)}),n}if(typeof t=="string"){if(e===void 0)return wo(s,t);Pb(s,t,e);return}for(const n in t)ze(s,n,t[n])}const Sb={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function Bs(s,t,e){if(t){if(typeof t=="string"){if(t=Sb[t]||t,arguments.length<3)return s[t];s[t]=e;return}for(const n in t)Bs(s,n,t[n])}}class z{get[Symbol.toStringTag](){return z.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(t){this.node.id=t}constructor(t,e,n){if(!t)throw new TypeError("Invalid element to create vector");let i;if(z.isVector(t))i=t.node;else if(typeof t=="string")if(t.toLowerCase()==="svg")i=Ni();else if(t[0]==="<"){const r=Ni(t);i=document.importNode(r.firstChild,!0)}else i=document.createElementNS(At.svg,t);else i=t;this.node=i,e&&this.setAttributes(e),n&&this.append(n)}transform(t,e){return t==null?rn(this.node):(rn(this.node,t,e),this)}translate(t,e=0,n={}){return t==null?Po(this.node):(Po(this.node,t,e,n),this)}rotate(t,e,n,i={}){return t==null?zs(this.node):(zs(this.node,t,e,n,i),this)}scale(t,e){return t==null?Vs(this.node):(Vs(this.node,t,e),this)}getTransformToElement(t){const e=z.toNode(t);return Vn(this.node,e)}removeAttribute(t){return yr(this.node,t),this}getAttribute(t){return fb(this.node,t)}setAttribute(t,e){return xr(this.node,t,e),this}setAttributes(t){return dl(this.node,t),this}attr(t,e){return t==null?X(this.node):typeof t=="string"&&e===void 0?X(this.node,t):(typeof t=="object"?X(this.node,t):X(this.node,t,e),this)}svg(){return this.node instanceof SVGSVGElement?this:z.create(this.node.ownerSVGElement)}defs(){const t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?z.create(e):z.create("defs").appendTo(t)}text(t,e={}){return bl(this.node,t,e),this}tagName(){return ob(this.node)}clone(){return z.create(this.node.cloneNode(!0))}remove(){return ie(this.node),this}empty(){return ci(this.node),this}append(t){return Ut(this.node,z.toNodes(t)),this}appendTo(t){return ue(this.node,z.isVector(t)?t.node:t),this}prepend(t){return ul(this.node,z.toNodes(t)),this}before(t){return Xn(this.node,z.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(z.toNode(t),this.node),z.create(t)}first(){return this.node.firstChild?z.create(this.node.firstChild):null}last(){return this.node.lastChild?z.create(this.node.lastChild):null}get(t){const e=this.node.childNodes[t];return e?z.create(e):null}indexOf(t){return Array.prototype.slice.call(this.node.childNodes).indexOf(z.toNode(t))}find(t){const e=[],n=ab(this.node,t);if(n)for(let i=0,r=n.length;i<r;i+=1)e.push(z.create(n[i]));return e}findOne(t){const e=lb(this.node,t);return e?z.create(e):null}findParentByClass(t,e){const n=hl(this.node,t,e);return n?z.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 br(this.node,z.isVector(t)?t.node:t)}wrap(t){const e=z.create(t),n=this.node.parentNode;return n?.insertBefore(e.node,this.node),e.append(this)}parent(t){let e=this;if(e.node.parentNode==null)return null;if(e=z.create(e.node.parentNode),t==null)return e;do if(typeof t=="string"?e.matches(t):e instanceof t)return e;while(e=z.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(z.create(t[n]));return e}eachChild(t,e){const n=this.children();for(let i=0,r=n.length;i<r;i+=1)t.call(n[i],n[i],i,n),e&&n[i].eachChild(t,e);return this}index(){return mr(this.node)}hasClass(t){return Mn(this.node,t)}addClass(t){return B(this.node,t),this}removeClass(t){return pt(this.node,t),this}toggleClass(t,e){return $n(this.node,t,e),this}toLocalPoint(t,e){return Hb(this.node,t,e)}sample(t=1){return this.node instanceof SVGPathElement?Mb(this.node,t):[]}toPath(){return z.create(Db(this.node))}toPathData(){return wl(this.node)}}(function(s){s.toStringTag=`X6.${s.name}`;function t(o){if(o==null)return!1;if(o instanceof s)return!0;const a=o[Symbol.toStringTag],l=o;return(a==null||a===s.toStringTag)&&l.node instanceof SVGElement&&typeof l.sample=="function"&&typeof l.toPath=="function"}s.isVector=t;function e(o,a,l){return new s(o,a,l)}s.create=e;function n(o){if(o[0]==="<"){const a=Ni(o),l=[];for(let c=0,h=a.childNodes.length;c<h;c+=1){const f=a.childNodes[c];l.push(e(document.importNode(f,!0)))}return l}return[e(o)]}s.createVectors=n;function i(o){return t(o)?o.node:o}s.toNode=i;function r(o){return Array.isArray(o)?o.map(a=>i(a)):[i(o)]}s.toNodes=r})(z||(z={}));function Ob(s,t){const e=z.create(t),n=z.create("textPath"),i=s.d;if(i&&s["xlink:href"]===void 0){const r=z.create("path").attr("d",i).appendTo(e.defs());n.attr("xlink:href",`#${r.id}`)}return typeof s=="object"&&n.attr(s),n.node}function Eb(s,t,e){const n=e.eol,i=e.baseSize,r=e.lineHeight;let o=0,a;const l={},c=t.length-1;for(let h=0;h<=c;h+=1){let f=t[h],u=null;if(typeof f=="object"){const d=f.attrs,g=z.create("tspan",d);a=g.node;let p=f.t;n&&h===c&&(p+=n),a.textContent=p;const m=d.class;m&&g.addClass(m),e.includeAnnotationIndices&&g.attr("annotations",f.annotations.join(",")),u=parseFloat(d["font-size"]),u===void 0&&(u=i),u&&u>o&&(o=u)}else n&&h===c&&(f+=n),a=document.createTextNode(f||" "),i&&i>o&&(o=i);s.appendChild(a)}return o&&(l.maxFontSize=o),r?l.lineHeight=r:o&&(l.lineHeight=o*1.2),l}const ml=/em$/;function bi(s,t){const e=parseFloat(s);return ml.test(s)?e*t:e}function Ab(s,t,e,n){if(!Array.isArray(t))return 0;const i=t.length;if(!i)return 0;let r=t[0];const o=bi(r.maxFontSize,e)||e;let a=0;const l=bi(n,e);for(let f=1;f<i;f+=1){r=t[f];const u=bi(r.lineHeight,e)||l;a+=u}const c=bi(r.maxFontSize,e)||e;let h;switch(s){case"middle":h=o/2-.15*c-a/2;break;case"bottom":h=-(.25*c)-a;break;case"top":default:h=.8*o;break}return h}function bl(s,t,e={}){t=gb(t);const n=e.eol;let i=e.textPath;const r=e.textVerticalAnchor,o=r==="middle"||r==="bottom"||r==="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,f=h==="auto",u=f?"1.5em":h||"1em";let d=!0;const g=s.childNodes;if(g.length===1){const E=g[0];E&&E.tagName.toUpperCase()==="TITLE"&&(d=!1)}d&&ci(s),X(s,{"xml:space":"preserve",display:t||e.displayEmpty?null:"none"});const p=X(s,"font-size");let m=parseFloat(p);m||(m=16,(o||c)&&!p&&X(s,"font-size",`${m}`));let y;i?(typeof i=="string"&&(i={d:i}),y=Ob(i,s)):y=document.createDocumentFragment();let x,b=0,v;const C=t.split(`
2
+ `),S=[],P=C.length-1;for(let E=0;E<=P;E+=1){x=u;let R="v-line";const T=ee("tspan");let I,_=C[E];if(_)if(c){const F=db(_,c,{offset:-b,includeAnnotationIndices:l});I=Eb(T,F,{eol:E!==P&&n,baseSize:m,lineHeight:f?null:u,includeAnnotationIndices:l});const A=I.lineHeight;A&&f&&E!==0&&(x=A),E===0&&(v=I.maxFontSize*.8)}else n&&E!==P&&(_+=n),T.textContent=_;else{T.textContent="-",R+=" v-empty-line";const F=T.style;F.fillOpacity=0,F.strokeOpacity=0,c&&(I={})}I&&S.push(I),E>0&&T.setAttribute("dy",x),(E>0||i)&&T.setAttribute("x",a),T.className.baseVal=R,y.appendChild(T),b+=_.length+1}if(o)if(c)x=Ab(r,S,m,u);else if(r==="top")x="0.8em";else{let E;switch(P>0?(E=parseFloat(u)||1,E*=P,ml.test(u)||(E/=m)):E=0,r){case"middle":x=`${.3-E/2}em`;break;case"bottom":x=`${-E-.3}em`;break}}else r===0?x="0em":r?x=r:(x=0,s.getAttribute("y")==null&&s.setAttribute("y",`${v||"0.8em"}`));y.firstChild.setAttribute("dy",x),s.appendChild(y)}function zn(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 Co(s,t,e,n={}){if(t>=e)return[s,""];const i=s.length,r={};let o=Math.round(t/e*i-1);for(o<0&&(o=0);o>=0&&o<i;){const a=s.slice(0,o),l=r[a]||zn(a,n).width,c=s.slice(0,o+1),h=r[c]||zn(c,n).width;if(r[a]=l,r[c]=h,l>t)o-=1;else if(h<=t)o+=1;else break}return[s.slice(0,o),s.slice(o)]}function yl(s,t,e={},n={}){const i=t.width,r=t.height,o=n.eol||`
3
+ `,a=e.fontSize||14,l=e.lineHeight?parseFloat(e.lineHeight):Math.ceil(a*1.4),c=Math.floor(r/l);if(s.indexOf(o)>-1){const m=Ti(),y=[];return s.split(o).map(x=>{const b=yl(x,Object.assign(Object.assign({},t),{height:Number.MAX_SAFE_INTEGER}),e,Object.assign(Object.assign({},n),{eol:m}));b&&y.push(...b.split(m))}),y.slice(0,c).join(o)}const{width:h}=zn(s,e);if(h<i)return s;const f=[];let u=s,d=h,g=n.ellipsis,p=0;g&&(typeof g!="string"&&(g="…"),p=zn(g,e).width);for(let m=0;m<c;m+=1)if(d>i)if(m===c-1){const[x]=Co(u,i-p,d,e);f.push(g?`${x}${g}`:x)}else{const[x,b]=Co(u,i,d,e);f.push(x),u=b,d=zn(u,e).width}else{f.push(u);break}return f.join(o)}const ks=.551784;function Rt(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 Mb(s,t=1){const e=s.getTotalLength(),n=[];let i=0,r;for(;i<e;)r=s.getPointAtLength(i),n.push({distance:i,x:r.x,y:r.y}),i+=t;return n}function Tb(s){return["M",Rt(s,"x1"),Rt(s,"y1"),"L",Rt(s,"x2"),Rt(s,"y2")].join(" ")}function Nb(s){const t=Ii(s);return t.length===0?null:`${xl(t)} Z`}function Rb(s){const t=Ii(s);return t.length===0?null:xl(t)}function xl(s){return`M ${s.map(e=>`${e.x} ${e.y}`).join(" L")}`}function Ii(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 Lb(s){const t=Rt(s,"cx",0),e=Rt(s,"cy",0),n=Rt(s,"r"),i=n*ks;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 Ib(s){const t=Rt(s,"cx",0),e=Rt(s,"cy",0),n=Rt(s,"rx"),i=Rt(s,"ry")||n,r=n*ks,o=i*ks;return["M",t,e-i,"C",t+r,e-i,t+n,e-o,t+n,e,"C",t+n,e+o,t+r,e+i,t,e+i,"C",t-r,e+i,t-n,e+o,t-n,e,"C",t-n,e-o,t-r,e-i,t,e-i,"Z"].join(" ")}function jb(s){return vl({x:Rt(s,"x",0),y:Rt(s,"y",0),width:Rt(s,"width",0),height:Rt(s,"height",0),rx:Rt(s,"rx",0),ry:Rt(s,"ry",0)})}function vl(s){let t;const e=s.x,n=s.y,i=s.width,r=s.height,o=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,r/2),c=Math.min(s.ry||s["bottom-ry"]||0,r/2);return o||a||l||c?t=["M",e,n+l,"v",r-l-c,"a",a,c,0,0,0,a,c,"h",i-2*a,"a",a,c,0,0,0,a,-c,"v",-(r-c-l),"a",o,l,0,0,0,-o,-l,"h",-(i-2*o),"a",o,l,0,0,0,-o,l,"Z"]:t=["M",e,n,"H",e+i,"V",n+r,"H",e,"V",n,"Z"],t.join(" ")}function Db(s){const t=ee("path");X(t,X(s));const e=wl(s);return e&&t.setAttribute("d",e),t}function wl(s){const t=s.tagName.toLowerCase();switch(t){case"path":return s.getAttribute("d");case"line":return Tb(s);case"polygon":return Nb(s);case"polyline":return Rb(s);case"ellipse":return Ib(s);case"circle":return Lb(s);case"rect":return jb(s)}throw new Error(`"${t}" cannot be converted to svg path element.`)}const Bb=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,Cl=/[ ,]+/,kb=/^(\w+)\((.*)\)/;function $b(s,t){const n=ee("svg").createSVGPoint();return n.x=s,n.y=t,n}function Tt(s){const e=ee("svg").createSVGMatrix();if(s!=null){const n=s,i=e;for(const r in n)i[r]=n[r]}return e}function In(s){const t=ee("svg");return s!=null?(s instanceof DOMMatrix||(s=Tt(s)),t.createSVGTransformFromMatrix(s)):t.createSVGTransform()}function Jn(s){let t=Tt();const e=s!=null&&s.match(Bb);if(!e)return t;for(let n=0,i=e.length;n<i;n+=1){const o=e[n].match(kb);if(o){let a,l,c,h,f,u=Tt();const d=o[2].split(Cl);switch(o[1].toLowerCase()){case"scale":a=parseFloat(d[0]),l=d[1]===void 0?a:parseFloat(d[1]),u=u.scaleNonUniform(a,l);break;case"translate":c=parseFloat(d[0]),h=parseFloat(d[1]),u=u.translate(c,h);break;case"rotate":f=parseFloat(d[0]),c=parseFloat(d[1])||0,h=parseFloat(d[2])||0,c!==0||h!==0?u=u.translate(c,h).rotate(f).translate(-c,-h):u=u.rotate(f);break;case"skewx":f=parseFloat(d[0]),u=u.skewX(f);break;case"skewy":f=parseFloat(d[0]),u=u.skewY(f);break;case"matrix":u.a=parseFloat(d[0]),u.b=parseFloat(d[1]),u.c=parseFloat(d[2]),u.d=parseFloat(d[3]),u.e=parseFloat(d[4]),u.f=parseFloat(d[5]);break;default:continue}t=t.multiply(u)}}return t}function Tn(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,r=t.d!=null?t.d:1,o=t.e!=null?t.e:0,a=t.f!=null?t.f:0;return`matrix(${e},${n},${i},${r},${o},${a})`}function ss(s){let t,e,n;if(s){const r=Cl;if(s.trim().indexOf("matrix")>=0){const o=Jn(s),a=zb(o);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 o=s.match(/translate\((.*?)\)/);o&&(t=o[1].split(r));const a=s.match(/rotate\((.*?)\)/);a&&(e=a[1].split(r));const l=s.match(/scale\((.*?)\)/);l&&(n=l[1].split(r))}}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 $s(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 zb(s){const t=$s(s,{x:0,y:1}),e=$s(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 Vb(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 _b(s){let t={x:0,y:1};s&&(t=$s(s,t));const e=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:e%360+(e<0?360:0)}}function Fb(s){return{tx:s&&s.e||0,ty:s&&s.f||0}}function rn(s,t,e={}){if(t==null)return Jn(X(s,"transform"));if(e.absolute){s.setAttribute("transform",Tn(t));return}const n=s.transform,i=In(t);n.baseVal.appendItem(i)}function Po(s,t,e=0,n={}){let i=X(s,"transform");const r=ss(i);if(t==null)return r.translation;i=r.raw,i=i.replace(/translate\([^)]*\)/g,"").trim();const o=n.absolute?t:r.translation.tx+t,a=n.absolute?e:r.translation.ty+e,l=`translate(${o},${a})`;s.setAttribute("transform",`${l} ${i}`.trim())}function zs(s,t,e,n,i={}){let r=X(s,"transform");const o=ss(r);if(t==null)return o.rotation;r=o.raw,r=r.replace(/rotate\([^)]*\)/g,"").trim(),t%=360;const a=i.absolute?t:o.rotation.angle+t,l=e!=null&&n!=null?`,${e},${n}`:"",c=`rotate(${a}${l})`;s.setAttribute("transform",`${r} ${c}`.trim())}function Vs(s,t,e){let n=X(s,"transform");const i=ss(n);if(t==null)return i.scale;e=e??t,n=i.raw,n=n.replace(/scale\([^)]*\)/g,"").trim();const r=`scale(${t},${e})`;s.setAttribute("transform",`${n} ${r}`.trim())}function Vn(s,t){if(Pe(t)&&Pe(s)){const e=t.getScreenCTM(),n=s.getScreenCTM();if(e&&n)return e.inverse().multiply(n)}return Tt()}function Gb(s,t){let e=Tt();if(Pe(t)&&Pe(s)){let n=s;const i=[];for(;n&&n!==t;){const r=n.getAttribute("transform")||null,o=Jn(r);i.push(o),n=n.parentNode}i.reverse().forEach(r=>{e=e.multiply(r)})}return e}function Hb(s,t,e){const n=s instanceof SVGSVGElement?s:s.ownerSVGElement,i=n.createSVGPoint();i.x=t,i.y=e;try{const r=n.getScreenCTM(),o=i.matrixTransform(r.inverse()),a=Vn(s,n).inverse();return o.matrixTransform(a)}catch{return i}}var Ht;(function(s){const t={};function e(r){return t[r]||{}}s.get=e;function n(r,o){t[r]=o}s.register=n;function i(r){delete t[r]}s.unregister=i})(Ht||(Ht={}));var je;(function(s){const t=new WeakMap;function e(r){return t.has(r)||t.set(r,{events:Object.create(null)}),t.get(r)}s.ensure=e;function n(r){return t.get(r)}s.get=n;function i(r){return t.delete(r)}s.remove=i})(je||(je={}));var G;(function(s){s.returnTrue=()=>!0,s.returnFalse=()=>!1;function t(i){i.stopPropagation()}s.stopPropagationCallback=t;function e(i,r,o){i.addEventListener!=null&&i.addEventListener(r,o)}s.addEventListener=e;function n(i,r,o){i.removeEventListener!=null&&i.removeEventListener(r,o)}s.removeEventListener=n})(G||(G={}));(function(s){const t=/[^\x20\t\r\n\f]+/g,e=/^([^.]*)(?:\.(.+)|)/;function n(a){return(a||"").match(t)||[""]}s.splitType=n;function i(a){const l=e.exec(a)||[];return{originType:l[1]?l[1].trim():l[1],namespaces:l[2]?l[2].split(".").map(c=>c.trim()).sort():[]}}s.normalizeType=i;function r(a){return a.nodeType===1||a.nodeType===9||!+a.nodeType}s.isValidTarget=r;function o(a,l){if(l){const c=a;return c.querySelector!=null&&c.querySelector(l)!=null}return!0}s.isValidSelector=o})(G||(G={}));(function(s){let t=0;const e=new WeakMap;function n(a){return e.has(a)||(e.set(a,t),t+=1),e.get(a)}s.ensureHandlerId=n;function i(a){return e.get(a)}s.getHandlerId=i;function r(a){return e.delete(a)}s.removeHandlerId=r;function o(a,l){return e.set(a,l)}s.setHandlerId=o})(G||(G={}));(function(s){function t(e,n){const i=[],r=je.get(e),o=r&&r.events&&r.events[n.type],a=o&&o.handlers||[],l=o?o.delegateCount:0;if(l>0&&!(n.type==="click"&&typeof n.button=="number"&&n.button>=1)){for(let c=n.target;c!==e;c=c.parentNode||e)if(c.nodeType===1&&!(n.type==="click"&&c.disabled===!0)){const h=[],f={};for(let u=0;u<l;u+=1){const d=a[u],g=d.selector;if(g!=null&&f[g]==null){const p=e,m=[];p.querySelectorAll(g).forEach(y=>{m.push(y)}),f[g]=m.includes(c)}f[g]&&h.push(d)}h.length&&i.push({elem:c,handlers:h})}}return l<a.length&&i.push({elem:e,handlers:a.slice(l)}),i}s.getHandlerQueue=t})(G||(G={}));(function(s){function t(e){return e!=null&&e===e.window}s.isWindow=t})(G||(G={}));(function(s){function t(e,n){const i=e.nodeType===9?e.documentElement:e,r=n&&n.parentNode;return e===r||!!(r&&r.nodeType===1&&(i.contains?i.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16))}s.contains=t})(G||(G={}));class se{constructor(t,e){this.isDefaultPrevented=G.returnFalse,this.isPropagationStopped=G.returnFalse,this.isImmediatePropagationStopped=G.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{const n=this.originalEvent;this.isDefaultPrevented=G.returnTrue,n&&!this.isSimulated&&n.preventDefault()},this.stopPropagation=()=>{const n=this.originalEvent;this.isPropagationStopped=G.returnTrue,n&&!this.isSimulated&&n.stopPropagation()},this.stopImmediatePropagation=()=>{const n=this.originalEvent;this.isImmediatePropagationStopped=G.returnTrue,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?G.returnTrue:G.returnFalse,this.target=t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget,this.timeStamp=t.timeStamp),e&&Object.assign(this,e),this.timeStamp||(this.timeStamp=Date.now())}}(function(s){function t(e){return e instanceof s?e:new s(e)}s.create=t})(se||(se={}));(function(s){function t(e,n){Object.defineProperty(s.prototype,e,{enumerable:!0,configurable:!0,get:typeof n=="function"?function(){if(this.originalEvent)return n(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set(i){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:i})}})}s.addProperty=t})(se||(se={}));(function(s){const t={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(t).forEach(e=>s.addProperty(e,t[e]))})(se||(se={}));(function(s){Ht.register("load",{noBubble:!0})})();(function(s){Ht.register("beforeunload",{postDispatch(t,e){e.result!==void 0&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}})})();(function(s){Ht.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(t,e){let n;const i=e.relatedTarget,r=e.handleObj;return(!i||i!==t&&!G.contains(t,i))&&(e.type=r.originType,n=r.handler.call(t,e),e.type="mouseover"),n}}),Ht.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(t,e){let n;const i=e.relatedTarget,r=e.handleObj;return(!i||i!==t&&!G.contains(t,i))&&(e.type=r.originType,n=r.handler.call(t,e),e.type="mouseout"),n}})})();var qb=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},Kn;(function(s){let t;function e(o,a,l,c,h){if(!G.isValidTarget(o))return;let f;if(typeof l!="function"){const{handler:p,selector:m}=l,y=qb(l,["handler","selector"]);l=p,h=m,f=y}const u=je.ensure(o);let d=u.handler;d==null&&(d=u.handler=function(p,...m){return t!==p.type?i(o,p,...m):void 0});const g=G.ensureHandlerId(l);G.splitType(a).forEach(p=>{const{originType:m,namespaces:y}=G.normalizeType(p);if(!m)return;let x=m,b=Ht.get(x);x=(h?b.delegateType:b.bindType)||x,b=Ht.get(x);const v=Object.assign({type:x,originType:m,data:c,selector:h,guid:g,handler:l,namespace:y.join(".")},f),C=u.events;let S=C[x];S||(S=C[x]={handlers:[],delegateCount:0},(!b.setup||b.setup(o,c,y,d)===!1)&&G.addEventListener(o,x,d)),b.add&&(G.removeHandlerId(v.handler),b.add(o,v),G.setHandlerId(v.handler,g)),h?(S.handlers.splice(S.delegateCount,0,v),S.delegateCount+=1):S.handlers.push(v)})}s.on=e;function n(o,a,l,c,h){const f=je.get(o);if(!f)return;const u=f.events;u&&(G.splitType(a).forEach(d=>{const{originType:g,namespaces:p}=G.normalizeType(d);if(!g){Object.keys(u).forEach(C=>{n(o,C+d,l,c,!0)});return}let m=g;const y=Ht.get(m);m=(c?y.delegateType:y.bindType)||m;const x=u[m];if(!x)return;const b=p.length>0?new RegExp(`(^|\\.)${p.join("\\.(?:.*\\.|)")}(\\.|$)`):null,v=x.handlers.length;for(let C=x.handlers.length-1;C>=0;C-=1){const S=x.handlers[C];(h||g===S.originType)&&(!l||G.getHandlerId(l)===S.guid)&&(b==null||S.namespace&&b.test(S.namespace))&&(c==null||c===S.selector||c==="**"&&S.selector)&&(x.handlers.splice(C,1),S.selector&&(x.delegateCount-=1),y.remove&&y.remove(o,S))}v&&x.handlers.length===0&&((!y.teardown||y.teardown(o,p,f.handler)===!1)&&G.removeEventListener(o,m,f.handler),delete u[m])}),Object.keys(u).length===0&&je.remove(o))}s.off=n;function i(o,a,...l){const c=se.create(a);c.delegateTarget=o;const h=Ht.get(c.type);if(h.preDispatch&&h.preDispatch(o,c)===!1)return;const f=G.getHandlerQueue(o,c);for(let u=0,d=f.length;u<d&&!c.isPropagationStopped();u+=1){const g=f[u];c.currentTarget=g.elem;for(let p=0,m=g.handlers.length;p<m&&!c.isImmediatePropagationStopped();p+=1){const y=g.handlers[p];if(c.rnamespace==null||y.namespace&&c.rnamespace.test(y.namespace)){c.handleObj=y,c.data=y.data;const x=Ht.get(y.originType).handle,b=x?x(g.elem,c,...l):y.handler.call(g.elem,c,...l);b!==void 0&&(c.result=b,b===!1&&(c.preventDefault(),c.stopPropagation()))}}}return h.postDispatch&&h.postDispatch(o,c),c.result}s.dispatch=i;function r(o,a,l,c){let h=o,f=typeof o=="string"?o:o.type,u=typeof o=="string"||h.namespace==null?[]:h.namespace.split(".");const d=l;if(d.nodeType===3||d.nodeType===8)return;f.indexOf(".")>-1&&(u=f.split("."),f=u.shift(),u.sort());const g=f.indexOf(":")<0&&`on${f}`;h=o instanceof se?o:new se(f,typeof o=="object"?o:null),h.namespace=u.join("."),h.rnamespace=h.namespace?new RegExp(`(^|\\.)${u.join("\\.(?:.*\\.|)")}(\\.|$)`):null,h.result=void 0,h.target||(h.target=d);const p=[h];Array.isArray(a)?p.push(...a):p.push(a);const m=Ht.get(f);if(!c&&m.trigger&&m.trigger(d,h,a)===!1)return;let y;const x=[d];if(!c&&!m.noBubble&&!G.isWindow(d)){y=m.delegateType||f;let v=d,C=d.parentNode;for(;C!=null;)x.push(C),v=C,C=C.parentNode;const S=d.ownerDocument||document;if(v===S){const P=v.defaultView||v.parentWindow||window;x.push(P)}}let b=d;for(let v=0,C=x.length;v<C&&!h.isPropagationStopped();v+=1){const S=x[v];b=S,h.type=v>1?y:m.bindType||f;const P=je.get(S);P&&P.events[h.type]&&P.handler&&P.handler.call(S,...p);const O=g&&S[g]||null;O&&G.isValidTarget(S)&&(h.result=O.call(S,...p),h.result===!1&&h.preventDefault())}if(h.type=f,!c&&!h.isDefaultPrevented()){const v=m.preventDefault;if((v==null||v(x.pop(),h,a)===!1)&&G.isValidTarget(d)&&g&&typeof d[f]=="function"&&!G.isWindow(d)){const C=d[g];C&&(d[g]=null),t=f,h.isPropagationStopped()&&b.addEventListener(f,G.stopPropagationCallback),d[f](),h.isPropagationStopped()&&b.removeEventListener(f,G.stopPropagationCallback),t=void 0,C&&(d[g]=C)}}return h.result}s.trigger=r})(Kn||(Kn={}));var st;(function(s){function t(r,o,a,l,c){return _n.on(r,o,a,l,c),r}s.on=t;function e(r,o,a,l,c){return _n.on(r,o,a,l,c,!0),r}s.once=e;function n(r,o,a,l){return _n.off(r,o,a,l),r}s.off=n;function i(r,o,a,l){return Kn.trigger(o,a,r,l),r}s.trigger=i})(st||(st={}));var _n;(function(s){function t(n,i,r,o,a,l){if(typeof i=="object"){typeof r!="string"&&(o=o||r,r=void 0),Object.keys(i).forEach(c=>t(n,c,r,o,i[c],l));return}if(o==null&&a==null?(a=r,o=r=void 0):a==null&&(typeof r=="string"?(a=o,o=void 0):(a=o,o=r,r=void 0)),a===!1)a=G.returnFalse;else if(!a)return;if(l){const c=a;a=function(h,...f){return s.off(n,h),c.call(this,h,...f)},G.setHandlerId(a,G.ensureHandlerId(c))}Kn.on(n,i,a,o,r)}s.on=t;function e(n,i,r,o){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,r,l[c]));return}(r===!1||typeof r=="function")&&(o=r,r=void 0),o===!1&&(o=G.returnFalse),Kn.off(n,i,o,r)}s.off=e})(_n||(_n={}));class Pl{constructor(t,e,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=qt.isEventSupported("wheel")?"wheel":"mousewheel",this.target=t,this.onWheelCallback=e,this.onWheelGuard=n,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(t){if(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 on(s){const t=s.getBoundingClientRect(),e=s.ownerDocument.defaultView;return{top:t.top+e.pageYOffset,left:t.left+e.pageXOffset}}function Ub(s){return s.getBoundingClientRect().width}function Wb(s){return s.getBoundingClientRect().height}function Xb(s){const t=Ri(s,"position")==="fixed";let e;if(t){const n=s.getBoundingClientRect();e={left:n.left,top:n.top}}else e=on(s);if(!t){const n=s.ownerDocument;let i=s.offsetParent||n.documentElement;for(;(i===n.body||i===n.documentElement)&&Ri(i,"position")==="static";)i=i.parentNode;if(i!==s&&hb(i)){const r=on(i);e.top-=r.top+mi(i,"borderTopWidth"),e.left-=r.left+mi(i,"borderLeftWidth")}}return{top:e.top-mi(s,"marginTop"),left:e.left-mi(s,"marginLeft")}}function Sl(s,t=60){let e=null;return(...n)=>{e&&clearTimeout(e),e=window.setTimeout(()=>{s.apply(this,n)},t)}}function Yb(s){let t=null,e=[];const n=()=>{if(getComputedStyle(s).position==="static"){const c=s.style;c.position="relative"}const l=document.createElement("object");return l.onload=()=>{l.contentDocument.defaultView.addEventListener("resize",i),i()},l.style.display="block",l.style.position="absolute",l.style.top="0",l.style.left="0",l.style.height="100%",l.style.width="100%",l.style.overflow="hidden",l.style.pointerEvents="none",l.style.zIndex="-1",l.style.opacity="0",l.setAttribute("tabindex","-1"),l.type="text/html",s.appendChild(l),l.data="about:blank",l},i=Sl(()=>{e.forEach(l=>l(s))}),r=l=>{t||(t=n()),e.indexOf(l)===-1&&e.push(l)},o=()=>{t&&t.parentNode&&(t.contentDocument&&t.contentDocument.defaultView.removeEventListener("resize",i),t.parentNode.removeChild(t),t=null,e=[])};return{element:s,bind:r,destroy:o,unbind:l=>{const c=e.indexOf(l);c!==-1&&e.splice(c,1),e.length===0&&t&&o()}}}function Jb(s){let t=null,e=[];const n=Sl(()=>{e.forEach(l=>{l(s)})}),i=()=>{const l=new ResizeObserver(n);return l.observe(s),n(),l},r=l=>{t||(t=i()),e.indexOf(l)===-1&&e.push(l)},o=()=>{t&&(t.disconnect(),e=[],t=null)};return{element:s,bind:r,destroy:o,unbind:l=>{const c=e.indexOf(l);c!==-1&&e.splice(c,1),e.length===0&&t&&o()}}}const Kb=typeof ResizeObserver<"u"?Jb:Yb;var ji;(function(s){const t=new WeakMap;function e(i){let r=t.get(i);return r||(r=Kb(i),t.set(i,r),r)}function n(i){i.destroy(),t.delete(i.element)}s.bind=(i,r)=>{const o=e(i);return o.bind(r),()=>o.unbind(r)},s.clear=i=>{const r=e(i);n(r)}})(ji||(ji={}));class Zn{constructor(t={}){this.comparator=t.comparator||Zn.defaultComparator,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return this.data.length===0}insert(t,e,n){const i={priority:t,value:e},r=this.data.length;return n&&(i.id=n,this.index[n]=r),this.data.push(i),this.bubbleUp(r),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(t,e){const n=this.index[t];if(typeof n>"u")throw new Error(`Node with id '${t}' was not found in the heap.`);const i=this.data,r=i[n].priority,o=this.comparator(e,r);o<0?(i[n].priority=e,this.bubbleUp(n)):o>0&&(i[n].priority=e,this.bubbleDown(n))}remove(){const t=this.data,e=t[0],n=t.pop();return e.id&&delete this.index[e.id],t.length>0&&(t[0]=n,n.id&&(this.index[n.id]=0),this.bubbleDown(0)),e?e.value:null}heapify(){for(let t=0;t<this.data.length;t+=1)this.bubbleUp(t)}bubbleUp(t){const e=this.data;let n,i,r=t;for(;r>0&&(i=r-1>>>1,this.comparator(e[r].priority,e[i].priority)<0);){n=e[i],e[i]=e[r];let o=e[r].id;o!=null&&(this.index[o]=i),e[r]=n,o=e[r].id,o!=null&&(this.index[o]=r),r=i}}bubbleDown(t){const e=this.data,n=e.length-1;let i=t;for(;;){const r=(i<<1)+1,o=r+1;let a=i;if(r<=n&&this.comparator(e[r].priority,e[a].priority)<0&&(a=r),o<=n&&this.comparator(e[o].priority,e[a].priority)<0&&(a=o),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(s){s.defaultComparator=(t,e)=>t-e})(Zn||(Zn={}));var _s;(function(s){function t(e,n,i=(r,o)=>1){const r={},o={},a={},l=new Zn;for(r[n]=0,Object.keys(e).forEach(c=>{c!==n&&(r[c]=1/0),l.insert(r[c],c,c)});!l.isEmpty();){const c=l.remove();a[c]=!0;const h=e[c]||[];for(let f=0;f<h.length;f+=1){const u=h[f];if(!a[u]){const d=r[c]+i(c,u);d<r[u]&&(r[u]=d,o[u]=c,l.updatePriority(u,d))}}}return o}s.run=t})(_s||(_s={}));class he{constructor(t,e,n,i){if(t==null)return this.set(255,255,255,1);if(typeof t=="number")return this.set(t,e,n,i);if(typeof t=="string")return he.fromString(t)||this;if(Array.isArray(t))return this.set(t);this.set(t.r,t.g,t.b,t.a==null?1:t.a)}blend(t,e,n){this.set(t.r+(e.r-t.r)*n,t.g+(e.g-t.g)*n,t.b+(e.b-t.b)*n,t.a+(e.a-t.a)*n)}lighten(t){const e=he.lighten(this.toArray(),t);this.r=e[0],this.g=e[1],this.b=e[2],this.a=e[3]}darken(t){this.lighten(-t)}set(t,e,n,i){const r=Array.isArray(t)?t[0]:t,o=Array.isArray(t)?t[1]:e,a=Array.isArray(t)?t[2]:n,l=Array.isArray(t)?t[3]:i;return this.r=Math.round(kt(r,0,255)),this.g=Math.round(kt(o,0,255)),this.b=Math.round(kt(a,0,255)),this.a=l==null?1:kt(l,0,1),this}toHex(){return`#${["r","g","b"].map(e=>{const n=this[e].toString(16);return n.length<2?`0${n}`:n}).join("")}`}toRGBA(){return this.toArray()}toHSLA(){return he.rgba2hsla(this.r,this.g,this.b,this.a)}toCSS(t){const e=`${this.r},${this.g},${this.b},`;return t?`rgb(${e})`:`rgba(${e},${this.a})`}toGrey(){return he.makeGrey(Math.round((this.r+this.g+this.b)/3),this.a)}toArray(){return[this.r,this.g,this.b,this.a]}toString(){return this.toCSS()}}(function(s){function t(b){return new s(b)}s.fromArray=t;function e(b){return new s([...g(b),1])}s.fromHex=e;function n(b){const v=b.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);if(v){const C=v[1].split(/\s*,\s*/).map(S=>parseInt(S,10));return new s(C)}return null}s.fromRGBA=n;function i(b,v,C){C<0&&++C,C>1&&--C;const S=6*C;return S<1?b+(v-b)*S:2*C<1?v:3*C<2?b+(v-b)*(2/3-C)*6:b}function r(b){const v=b.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(v){const C=v[2].split(/\s*,\s*/),S=(parseFloat(C[0])%360+360)%360/360,P=parseFloat(C[1])/100,O=parseFloat(C[2])/100,E=C[3]==null?1:parseInt(C[3],10);return new s(c(S,P,O,E))}return null}s.fromHSLA=r;function o(b){if(b.startsWith("#"))return e(b);if(b.startsWith("rgb"))return n(b);const v=s.named[b];return v?e(v):r(b)}s.fromString=o;function a(b,v){return s.fromArray([b,b,b,v])}s.makeGrey=a;function l(b,v,C,S){const P=Array.isArray(b)?b[0]:b,O=Array.isArray(b)?b[1]:v,E=Array.isArray(b)?b[2]:C,R=Array.isArray(b)?b[3]:S,T=Math.max(P,O,E),I=Math.min(P,O,E),_=(T+I)/2;let F=0,A=0;if(I!==T){const N=T-I;switch(A=_>.5?N/(2-T-I):N/(T+I),T){case P:F=(O-E)/N+(O<E?6:0);break;case O:F=(E-P)/N+2;break;case E:F=(P-O)/N+4;break}F/=6}return[F,A,_,R??1]}s.rgba2hsla=l;function c(b,v,C,S){const P=Array.isArray(b)?b[0]:b,O=Array.isArray(b)?b[1]:v,E=Array.isArray(b)?b[2]:C,R=Array.isArray(b)?b[3]:S,T=E<=.5?E*(O+1):E+O-E*O,I=2*E-T;return[i(I,T,P+1/3)*256,i(I,T,P)*256,i(I,T,P-1/3)*256,R??1]}s.hsla2rgba=c;function h(b){return new s(Math.round(Math.random()*256),Math.round(Math.random()*256),Math.round(Math.random()*256),b?void 0:parseFloat(Math.random().toFixed(2)))}s.random=h;function f(){const b="0123456789ABCDEF";let v="#";for(let C=0;C<6;C+=1)v+=b[Math.floor(Math.random()*16)];return v}s.randomHex=f;function u(b){return h(b).toString()}s.randomRGBA=u;function d(b,v){if(typeof b=="string"){const E=b[0]==="#",[R,T,I]=g(b);return v?R*.299+T*.587+I*.114>186?"#000000":"#ffffff":`${E?"#":""}${p(255-R,255-T,255-I)}`}const C=b[0],S=b[1],P=b[2],O=b[3];return v?C*.299+S*.587+P*.114>186?[0,0,0,O]:[255,255,255,O]:[255-C,255-S,255-P,O]}s.invert=d;function g(b){const v=b.indexOf("#")===0?b:`#${b}`;let C=+`0x${v.substr(1)}`;if(!(v.length===4||v.length===7)||Number.isNaN(C))throw new Error("Invalid hex color.");const S=v.length===4?4:8,P=(1<<S)-1,O=["b","g","r"].map(()=>{const E=C&P;return C>>=S,S===4?17*E:E});return[O[2],O[1],O[0]]}function p(b,v,C){const S=P=>P.length<2?`0${P}`:P;return`${S(b.toString(16))}${S(v.toString(16))}${S(C.toString(16))}`}function m(b,v){return x(b,v)}s.lighten=m;function y(b,v){return x(b,-v)}s.darken=y;function x(b,v){if(typeof b=="string"){const P=b[0]==="#",O=parseInt(P?b.substr(1):b,16),E=kt((O>>16)+v,0,255),R=kt((O>>8&255)+v,0,255),T=kt((O&255)+v,0,255);return`${P?"#":""}${(T|R<<8|E<<16).toString(16)}`}const C=p(b[0],b[1],b[2]),S=g(x(C,v));return[S[0],S[1],S[2],b[3]]}})(he||(he={}));(function(s){s.named={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",burntsienna:"#ea7e5d",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}})(he||(he={}));class Fs{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()}}var ge;(function(s){function t(i){const r=[],o=[];return Array.isArray(i)?r.push(...i):i.split("|").forEach(a=>{a.indexOf("&")===-1?r.push(a):o.push(...a.split("&"))}),{or:r,and:o}}s.parse=t;function e(i,r){if(i!=null&&r!=null){const o=t(i),a=t(r),l=o.or.sort(),c=a.or.sort(),h=o.and.sort(),f=a.and.sort(),u=(d,g)=>d.length===g.length&&(d.length===0||d.every((p,m)=>p===g[m]));return u(l,c)&&u(h,f)}return i==null&&r==null}s.equals=e;function n(i,r,o){if(r==null||Array.isArray(r)&&r.length===0)return o?i.altKey!==!0&&i.ctrlKey!==!0&&i.metaKey!==!0&&i.shiftKey!==!0:!0;const{or:a,and:l}=t(r),c=h=>{const f=`${h.toLowerCase()}Key`;return i[f]===!0};return a.some(h=>c(h))&&l.every(h=>c(h))}s.isMatch=n})(ge||(ge={}));var Ve;(function(s){s.linear=t=>t,s.quad=t=>t*t,s.cubic=t=>t*t*t,s.inout=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)},s.exponential=t=>Math.pow(2,10*(t-1)),s.bounce=t=>{for(let e=0,n=1;;e+=n,n/=2)if(t>=(7-4*e)/11){const i=(11-6*e-11*t)/4;return-i*i+n*n}}})(Ve||(Ve={}));(function(s){s.decorators={reverse(t){return e=>1-t(1-e)},reflect(t){return e=>.5*(e<.5?t(2*e):2-t(2-2*e))},clamp(t,e=0,n=1){return i=>{const r=t(i);return r<e?e:r>n?n:r}},back(t=1.70158){return e=>e*e*((t+1)*e-t)},elastic(t=1.5){return e=>Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*t/3*e)}}})(Ve||(Ve={}));(function(s){function t(A){return-1*Math.cos(A*(Math.PI/2))+1}s.easeInSine=t;function e(A){return Math.sin(A*(Math.PI/2))}s.easeOutSine=e;function n(A){return-.5*(Math.cos(Math.PI*A)-1)}s.easeInOutSine=n;function i(A){return A*A}s.easeInQuad=i;function r(A){return A*(2-A)}s.easeOutQuad=r;function o(A){return A<.5?2*A*A:-1+(4-2*A)*A}s.easeInOutQuad=o;function a(A){return A*A*A}s.easeInCubic=a;function l(A){const N=A-1;return N*N*N+1}s.easeOutCubic=l;function c(A){return A<.5?4*A*A*A:(A-1)*(2*A-2)*(2*A-2)+1}s.easeInOutCubic=c;function h(A){return A*A*A*A}s.easeInQuart=h;function f(A){const N=A-1;return 1-N*N*N*N}s.easeOutQuart=f;function u(A){const N=A-1;return A<.5?8*A*A*A*A:1-8*N*N*N*N}s.easeInOutQuart=u;function d(A){return A*A*A*A*A}s.easeInQuint=d;function g(A){const N=A-1;return 1+N*N*N*N*N}s.easeOutQuint=g;function p(A){const N=A-1;return A<.5?16*A*A*A*A*A:1+16*N*N*N*N*N}s.easeInOutQuint=p;function m(A){return A===0?0:Math.pow(2,10*(A-1))}s.easeInExpo=m;function y(A){return A===1?1:-Math.pow(2,-10*A)+1}s.easeOutExpo=y;function x(A){if(A===0||A===1)return A;const N=A*2,V=N-1;return N<1?.5*Math.pow(2,10*V):.5*(-Math.pow(2,-10*V)+2)}s.easeInOutExpo=x;function b(A){const N=A/1;return-1*(Math.sqrt(1-N*A)-1)}s.easeInCirc=b;function v(A){const N=A-1;return Math.sqrt(1-N*N)}s.easeOutCirc=v;function C(A){const N=A*2,V=N-2;return N<1?-.5*(Math.sqrt(1-N*N)-1):.5*(Math.sqrt(1-V*V)+1)}s.easeInOutCirc=C;function S(A,N=1.70158){return A*A*((N+1)*A-N)}s.easeInBack=S;function P(A,N=1.70158){const V=A/1-1;return V*V*((N+1)*V+N)+1}s.easeOutBack=P;function O(A,N=1.70158){const V=A*2,it=V-2,tt=N*1.525;return V<1?.5*V*V*((tt+1)*V-tt):.5*(it*it*((tt+1)*it+tt)+2)}s.easeInOutBack=O;function E(A,N=.7){if(A===0||A===1)return A;const it=A/1-1,tt=1-N,ht=tt/(2*Math.PI)*Math.asin(1);return-(Math.pow(2,10*it)*Math.sin((it-ht)*(2*Math.PI)/tt))}s.easeInElastic=E;function R(A,N=.7){const V=1-N,it=A*2;if(A===0||A===1)return A;const tt=V/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*it)*Math.sin((it-tt)*(2*Math.PI)/V)+1}s.easeOutElastic=R;function T(A,N=.65){const V=1-N;if(A===0||A===1)return A;const it=A*2,tt=it-1,ht=V/(2*Math.PI)*Math.asin(1);return it<1?-.5*(Math.pow(2,10*tt)*Math.sin((tt-ht)*(2*Math.PI)/V)):Math.pow(2,-10*tt)*Math.sin((tt-ht)*(2*Math.PI)/V)*.5+1}s.easeInOutElastic=T;function I(A){const N=A/1;if(N<1/2.75)return 7.5625*N*N;if(N<2/2.75){const V=N-.5454545454545454;return 7.5625*V*V+.75}if(N<2.5/2.75){const V=N-.8181818181818182;return 7.5625*V*V+.9375}{const V=N-.9545454545454546;return 7.5625*V*V+.984375}}s.easeOutBounce=I;function _(A){return 1-I(1-A)}s.easeInBounce=_;function F(A){return A<.5?_(A*2)*.5:I(A*2-1)*.5+.5}s.easeInOutBounce=F})(Ve||(Ve={}));var De;(function(s){s.number=(t,e)=>{const n=e-t;return i=>t+n*i},s.object=(t,e)=>{const n=Object.keys(t);return i=>{const r={};for(let o=n.length-1;o!==-1;o-=1){const a=n[o];r[a]=t[a]+(e[a]-t[a])*i}return r}},s.unit=(t,e)=>{const n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,i=n.exec(t),r=n.exec(e),o=r?r[1]:"",a=i?+i[1]:0,l=r?+r[1]:0,c=o.indexOf("."),h=c>0?o[1].length-c-1:0,f=l-a,u=i?i[2]:"";return d=>(a+f*d).toFixed(h)+u},s.color=(t,e)=>{const n=parseInt(t.slice(1),16),i=parseInt(e.slice(1),16),r=n&255,o=(i&255)-r,a=n&65280,l=(i&65280)-a,c=n&16711680,h=(i&16711680)-c;return f=>{const u=r+o*f&255,d=a+l*f&65280,g=c+h*f&16711680;return`#${(1<<24|u|d|g).toString(16).slice(1)}`}}})(De||(De={}));const Fn=[];function Ue(s,t){const e=Fn.find(n=>n.name===s);if(!(e&&(e.loadTimes+=1,e.loadTimes>1))&&!qt.isApplyingHMR()){const n=document.createElement("style");n.setAttribute("type","text/css"),n.textContent=t;const i=document.querySelector("head");i&&i.insertBefore(n,i.firstChild),Fn.push({name:s,loadTimes:1,styleElement:n})}}function We(s){const t=Fn.findIndex(e=>e.name===s);if(t>-1){const e=Fn[t];if(e.loadTimes-=1,e.loadTimes>0)return;let n=e.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,Fn.splice(t,1)}}var W;(function(s){function t(n){return 180*n/Math.PI%360}s.toDeg=t,s.toRad=function(n,i=!1){return(i?n:n%360)*Math.PI/180};function e(n){return n%360+(n<0?360:0)}s.normalize=e})(W||(W={}));var Z;(function(s){function t(a,l=0){return Number.isInteger(a)?a:+a.toFixed(l)}s.round=t;function e(a,l){let c,h;if(l==null?(h=a??1,c=0):(h=l,c=a??0),h<c){const f=c;c=h,h=f}return Math.floor(Math.random()*(h-c+1)+c)}s.random=e;function n(a,l,c){return Number.isNaN(a)?NaN:Number.isNaN(l)||Number.isNaN(c)?0:l<c?a<l?l:a>c?c:a:a<c?c:a>l?l:a}s.clamp=n;function i(a,l){return l*Math.round(a/l)}s.snapToGrid=i;function r(a,l){return l!=null&&a!=null&&l.x>=a.x&&l.x<=a.x+a.width&&l.y>=a.y&&l.y<=a.y+a.height}s.containsPoint=r;function o(a,l){const c=a.x-l.x,h=a.y-l.y;return c*c+h*h}s.squaredLength=o})(Z||(Z={}));class Te{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class w extends Te{constructor(t,e){super(),this.x=t??0,this.y=e??0}round(t=0){return this.x=Z.round(this.x,t),this.y=Z.round(this.y,t),this}add(t,e){const n=w.create(t,e);return this.x+=n.x,this.y+=n.y,this}update(t,e){const n=w.create(t,e);return this.x=n.x,this.y=n.y,this}translate(t,e){const n=w.create(t,e);return this.x+=n.x,this.y+=n.y,this}rotate(t,e){const n=w.rotate(this,t,e);return this.x=n.x,this.y=n.y,this}scale(t,e,n=new w){const i=w.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 w.create(t[0]);let e=null,n=1/0;return t.forEach(i=>{const r=this.squaredDistance(i);r<n&&(e=i,n=r)}),e?w.create(e):null}distance(t){return Math.sqrt(this.squaredDistance(t))}squaredDistance(t){const e=w.create(t),n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistance(t){const e=w.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 w){const e=w.create(t),n=-(e.y-this.y),i=e.x-this.x;let r=Math.atan2(n,i);return r<0&&(r=2*Math.PI+r),180*r/Math.PI}angleBetween(t,e){if(this.equals(t)||this.equals(e))return NaN;let n=this.theta(e)-this.theta(t);return n<0&&(n+=360),n}vectorAngle(t){return new w(0,0).angleBetween(this,t)}toPolar(t){return this.update(w.toPolar(this,t)),this}changeInAngle(t,e,n=new w){return this.clone().translate(-t,-e).theta(n)-this.theta(n)}adhereToRect(t){return Z.containsPoint(t,this)||(this.x=Math.min(Math.max(this.x,t.x),t.x+t.width),this.y=Math.min(Math.max(this.y,t.y),t.y+t.height)),this}bearing(t){const e=w.create(t),n=W.toRad(this.y),i=W.toRad(e.y),r=this.x,o=e.x,a=W.toRad(o-r),l=Math.sin(a)*Math.cos(i),c=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(a),h=W.toDeg(Math.atan2(l,c)),f=["NE","E","SE","S","SW","W","NW","N"];let u=h-22.5;return u<0&&(u+=360),u=parseInt(u/45,10),f[u]}cross(t,e){if(t!=null&&e!=null){const n=w.create(t),i=w.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=w.create(t);return this.x*e.x+this.y*e.y}diff(t,e){if(typeof t=="number")return new w(this.x-t,this.y-e);const n=w.create(t);return new w(this.x-n.x,this.y-n.y)}lerp(t,e){const n=w.create(t);return new w((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=w.create(t),i=W.toRad(n.theta(this));return this.translate(Math.cos(i)*e,-Math.sin(i)*e)}reflection(t){return w.create(t).move(this,this.distance(t))}snapToGrid(t,e){return this.x=Z.snapToGrid(this.x,t),this.y=Z.snapToGrid(this.y,e??t),this}equals(t){const e=w.create(t);return e!=null&&e.x===this.x&&e.y===this.y}clone(){return w.clone(this)}toJSON(){return w.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}(function(s){function t(e){return e!=null&&e instanceof s}s.isPoint=t})(w||(w={}));(function(s){function t(n){return n!=null&&typeof n=="object"&&typeof n.x=="number"&&typeof n.y=="number"}s.isPointLike=t;function e(n){return n!=null&&Array.isArray(n)&&n.length===2&&typeof n[0]=="number"&&typeof n[1]=="number"}s.isPointData=e})(w||(w={}));(function(s){function t(f,u){return f==null||typeof f=="number"?new s(f,u):e(f)}s.create=t;function e(f){return s.isPoint(f)?new s(f.x,f.y):Array.isArray(f)?new s(f[0],f[1]):new s(f.x,f.y)}s.clone=e;function n(f){return s.isPoint(f)?{x:f.x,y:f.y}:Array.isArray(f)?{x:f[0],y:f[1]}:{x:f.x,y:f.y}}s.toJSON=n;function i(f,u,d=new s){let g=Math.abs(f*Math.cos(u)),p=Math.abs(f*Math.sin(u));const m=e(d),y=W.normalize(W.toDeg(u));return y<90?p=-p:y<180?(g=-g,p=-p):y<270&&(g=-g),new s(m.x+g,m.y+p)}s.fromPolar=i;function r(f,u=new s){const d=e(f),g=e(u),p=d.x-g.x,m=d.y-g.y;return new s(Math.sqrt(p*p+m*m),W.toRad(g.theta(d)))}s.toPolar=r;function o(f,u){return f===u?!0:f!=null&&u!=null?f.x===u.x&&f.y===u.y:!1}s.equals=o;function a(f,u){if(f==null&&u!=null||f!=null&&u==null||f!=null&&u!=null&&f.length!==u.length)return!1;if(f!=null&&u!=null){for(let d=0,g=f.length;d<g;d+=1)if(!o(f[d],u[d]))return!1}return!0}s.equalPoints=a;function l(f,u,d,g){return new s(Z.random(f,u),Z.random(d,g))}s.random=l;function c(f,u,d){const g=W.toRad(W.normalize(-u)),p=Math.sin(g),m=Math.cos(g);return h(f,m,p,d)}s.rotate=c;function h(f,u,d,g=new s){const p=e(f),m=e(g),y=p.x-m.x,x=p.y-m.y,b=y*u-x*d,v=x*u+y*d;return new s(b+m.x,v+m.y)}s.rotateEx=h})(w||(w={}));class L extends Te{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 w(this.x,this.y)}get topLeft(){return new w(this.x,this.y)}get topCenter(){return new w(this.x+this.width/2,this.y)}get topRight(){return new w(this.x+this.width,this.y)}get center(){return new w(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new w(this.x,this.y+this.height)}get bottomCenter(){return new w(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new w(this.x+this.width,this.y+this.height)}get corner(){return new w(this.x+this.width,this.y+this.height)}get rightMiddle(){return new w(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new w(this.x,this.y+this.height/2)}get topLine(){return new j(this.topLeft,this.topRight)}get rightLine(){return new j(this.topRight,this.bottomRight)}get bottomLine(){return new j(this.bottomLeft,this.bottomRight)}get leftLine(){return new j(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=W.toRad(t),n=Math.abs(Math.sin(e)),i=Math.abs(Math.cos(e)),r=this.width*i+this.height*n,o=this.width*n+this.height*i;return new L(this.x+(this.width-r)/2,this.y+(this.height-o)/2,r,o)}round(t=0){return this.x=Z.round(this.x,t),this.y=Z.round(this.y,t),this.width=Z.round(this.width,t),this.height=Z.round(this.height,t),this}add(t,e,n,i){const r=L.create(t,e,n,i),o=Math.min(this.x,r.x),a=Math.min(this.y,r.y),l=Math.max(this.x+this.width,r.x+r.width),c=Math.max(this.y+this.height,r.y+r.height);return this.x=o,this.y=a,this.width=l-o,this.height=c-a,this}update(t,e,n,i){const r=L.create(t,e,n,i);return this.x=r.x,this.y=r.y,this.width=r.width,this.height=r.height,this}inflate(t,e){const n=t,i=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=w.create(t,e);return this.x+=n.x,this.y+=n.y,this}scale(t,e,n=new w){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=W.toRad(t),i=Math.cos(n),r=Math.sin(n);let o=this.getOrigin(),a=this.getTopRight(),l=this.getBottomRight(),c=this.getBottomLeft();o=w.rotateEx(o,i,r,e),a=w.rotateEx(a,i,r,e),l=w.rotateEx(l,i,r,e),c=w.rotateEx(c,i,r,e);const h=new L(o.x,o.y,0,0);h.add(a.x,a.y,0,0),h.add(l.x,l.y,0,0),h.add(c.x,c.y,0,0),this.update(h)}return this}rotate90(){const t=(this.width-this.height)/2;this.x+=t,this.y-=t;const e=this.width;return this.width=this.height,this.height=e,this}moveAndExpand(t){const e=L.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=L.clone(t),i=e.x,r=e.y;let o=1/0,a=1/0,l=1/0,c=1/0,h=1/0,f=1/0,u=1/0,d=1/0;const g=n.topLeft;g.x<i&&(o=(this.x-i)/(g.x-i)),g.y<r&&(h=(this.y-r)/(g.y-r));const p=n.bottomRight;p.x>i&&(a=(this.x+this.width-i)/(p.x-i)),p.y>r&&(f=(this.y+this.height-r)/(p.y-r));const m=n.topRight;m.x>i&&(l=(this.x+this.width-i)/(m.x-i)),m.y<r&&(u=(this.y-r)/(m.y-r));const y=n.bottomLeft;return y.x<i&&(c=(this.x-i)/(y.x-i)),y.y>r&&(d=(this.y+this.height-r)/(y.y-r)),{sx:Math.min(o,a,l,c),sy:Math.min(h,f,u,d)}}getMaxUniformScaleToFit(t,e=this.center){const n=this.getMaxScaleToFit(t,e);return Math.min(n.sx,n.sy)}containsPoint(t,e){return Z.containsPoint(this,w.create(t,e))}containsRect(t,e,n,i){const r=L.create(t,e,n,i),o=this.x,a=this.y,l=this.width,c=this.height,h=r.x,f=r.y,u=r.width,d=r.height;return l===0||c===0||u===0||d===0?!1:h>=o&&f>=a&&h+u<=o+l&&f+d<=a+c}intersectsWithLine(t){const e=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],i=[];return e.forEach(r=>{const o=t.intersectsWithLine(r);o!==null&&i.indexOf(o.toString())<0&&(n.push(o),i.push(o.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(t,e){const n=w.clone(t),i=this.center;let r=null;e!=null&&e!==0&&n.rotate(e,i);const o=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],a=new j(i,n);for(let l=o.length-1;l>=0;l-=1){const c=o[l].intersectsWithLine(a);if(c!==null){r=c;break}}return r&&e!=null&&e!==0&&r.rotate(-e,i),r}intersectsWithRect(t,e,n,i){const r=L.create(t,e,n,i);if(!this.isIntersectWithRect(r))return null;const o=this.origin,a=this.corner,l=r.origin,c=r.corner,h=Math.max(o.x,l.x),f=Math.max(o.y,l.y);return new L(h,f,Math.min(a.x,c.x)-h,Math.min(a.y,c.y)-f)}isIntersectWithRect(t,e,n,i){const r=L.create(t,e,n,i),o=this.origin,a=this.corner,l=r.origin,c=r.corner;return!(c.x<=o.x||c.y<=o.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=L.clone(t),n=this.origin,i=this.corner,r=e.origin,o=e.corner,a=Math.min(n.x,r.x),l=Math.min(n.y,r.y),c=Math.max(i.x,o.x),h=Math.max(i.y,o.y);return new L(a,l,c-a,h-l)}getNearestSideToPoint(t){const e=w.clone(t),n=e.x-this.x,i=this.x+this.width-e.x,r=e.y-this.y,o=this.y+this.height-e.y;let a=n,l="left";return i<a&&(a=i,l="right"),r<a&&(a=r,l="top"),o<a&&(l="bottom"),l}getNearestPointToPoint(t){const e=w.clone(t);if(this.containsPoint(e)){const n=this.getNearestSideToPoint(e);if(n==="left")return new w(this.x,e.y);if(n==="top")return new w(e.x,this.y);if(n==="right")return new w(this.x+this.width,e.y);if(n==="bottom")return new w(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 L(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}}(function(s){function t(e){return e!=null&&e instanceof s}s.isRectangle=t})(L||(L={}));(function(s){function t(e){return e!=null&&typeof e=="object"&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.width=="number"&&typeof e.height=="number"}s.isRectangleLike=t})(L||(L={}));(function(s){function t(o,a,l,c){return o==null||typeof o=="number"?new s(o,a,l,c):e(o)}s.create=t;function e(o){return s.isRectangle(o)?o.clone():Array.isArray(o)?new s(o[0],o[1],o[2],o[3]):new s(o.x,o.y,o.width,o.height)}s.clone=e;function n(o){return new s(o.x-o.a,o.y-o.b,2*o.a,2*o.b)}s.fromEllipse=n;function i(o){return new s(0,0,o.width,o.height)}s.fromSize=i;function r(o,a){return new s(o.x,o.y,a.width,a.height)}s.fromPositionAndSize=r})(L||(L={}));class j extends Te{get center(){return new w((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 w(t,e),this.end=new w(n,i)):(this.start=w.create(t),this.end=w.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,r=n.clone().rotate(270,i),o=i.clone().rotate(90,n);return n.move(o,t),i.move(r,t),e}vector(){return new w(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const t=new w(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 L(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 j(this.start,t).vector()),n=Math.min(1,Math.max(0,e/this.squaredLength()));return Number.isNaN(n)?0:n}pointAt(t){const e=this.start,n=this.end;return t<=0?e.clone():t>=1?n.clone():e.lerp(n,t)}pointAtLength(t){const e=this.start,n=this.end;let i=!0;t<0&&(i=!1,t=-t);const r=this.length();if(t>=r)return i?n.clone():e.clone();const o=(i?t:r-t)/r;return this.pointAt(o)}divideAt(t){const e=this.pointAt(t);return[new j(this.start,e),new j(e,this.end)]}divideAtLength(t){const e=this.pointAtLength(t);return[new j(this.start,e),new j(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 j(e,t).length()>i||new j(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 w(this.end.x-this.start.x,this.end.y-this.start.y),n=new w(t.end.x-t.start.x,t.end.y-t.start.y),i=e.x*n.y-e.y*n.x,r=new w(t.start.x-this.start.x,t.start.y-this.start.y),o=r.x*n.y-r.y*n.x,a=r.x*e.y-r.y*e.x;if(i===0||o*i<0||a*i<0)return null;if(i>0){if(o>i||a>i)return null}else if(o<i||a<i)return null;return new w(this.start.x+o*e.x/i,this.start.y+o*e.y/i)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(t){const e=w.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=w.create(t,e);return this.closestPoint(n).squaredDistance(n)}pointDistance(t,e){const n=w.create(t,e);return this.closestPoint(n).distance(n)}tangentAt(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAt(t),r=new j(e,n);return r.translate(i.x-e.x,i.y-e.y),r}tangentAtLength(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAtLength(t),r=new j(e,n);return r.translate(i.x-e.x,i.y-e.y),r}relativeCcw(t,e){const n=w.create(t,e);let i=n.x-this.start.x,r=n.y-this.start.y;const o=this.end.x-this.start.x,a=this.end.y-this.start.y;let l=i*a-r*o;return l===0&&(l=i*o+r*a,l>0&&(i-=o,r-=a,l=i*o+r*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 j(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}(function(s){function t(e){return e!=null&&e instanceof s}s.isLine=t})(j||(j={}));class Kt extends Te{get center(){return new w(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 L.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=w.create(t,e),i=n.x-this.x,r=n.y-this.y,o=this.a,a=this.b;return i*i/(o*o)+r*r/(a*a)}containsPoint(t,e){return this.normalizedDistance(t,e)<=1}intersectsWithLine(t){const e=[],n=this.a,i=this.b,r=t.start,o=t.end,a=t.vector(),l=r.diff(new w(this.x,this.y)),c=new w(a.x/(n*n),a.y/(i*i)),h=new w(l.x/(n*n),l.y/(i*i)),f=a.dot(c),u=a.dot(h),d=l.dot(h)-1,g=u*u-f*d;if(g<0)return null;if(g>0){const p=Math.sqrt(g),m=(-u-p)/f,y=(-u+p)/f;if((m<0||m>1)&&(y<0||y>1))return null;m>=0&&m<=1&&e.push(r.lerp(o,m)),y>=0&&y<=1&&e.push(r.lerp(o,y))}else{const p=-u/f;if(p>=0&&p<=1)e.push(r.lerp(o,p));else return null}return e}intersectsWithLineFromCenterToPoint(t,e=0){const n=w.clone(t);e&&n.rotate(e,this.getCenter());const i=n.x-this.x,r=n.y-this.y;let o;if(i===0)return o=this.bbox().getNearestPointToPoint(n),e?o.rotate(-e,this.getCenter()):o;const a=r/i,l=a*a,c=this.a*this.a,h=this.b*this.b;let f=Math.sqrt(1/(1/c+l/h));f=i<0?-f:f;const u=a*f;return o=new w(this.x+f,this.y+u),e?o.rotate(-e,this.getCenter()):o}tangentTheta(t){const e=w.clone(t),n=e.x,i=e.y,r=this.a,o=this.b,a=this.bbox().center,l=a.x,c=a.y,h=30,f=n>a.x+r/2,u=n<a.x-r/2;let d,g;return f||u?(g=n>a.x?i-h:i+h,d=r*r/(n-l)-r*r*(i-c)*(g-c)/(o*o*(n-l))+l):(d=i>a.y?n+h:n-h,g=o*o/(i-c)-o*o*(n-l)*(d-l)/(r*r*(i-c))+c),new w(d,g).theta(e)}scale(t,e){return this.a*=t,this.b*=e,this}rotate(t,e){const n=L.fromEllipse(this);n.rotate(t,e);const i=Kt.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=w.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 Kt(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}}(function(s){function t(e){return e!=null&&e instanceof s}s.isEllipse=t})(Kt||(Kt={}));(function(s){function t(i,r,o,a){return i==null||typeof i=="number"?new s(i,r,o,a):e(i)}s.create=t;function e(i){return s.isEllipse(i)?i.clone():Array.isArray(i)?new s(i[0],i[1],i[2],i[3]):new s(i.x,i.y,i.a,i.b)}s.parse=e;function n(i){const r=i.center;return new s(r.x,r.y,i.width/2,i.height/2)}s.fromRect=n})(Kt||(Kt={}));const Zb=new RegExp("^[\\s\\dLMCZz,.]*$");function Qb(s){return typeof s!="string"?!1:Zb.test(s)}function vs(s,t){return(s%t+t)%t}function ty(s,t,e,n,i){const r=[],o=s[s.length-1],a=t!=null&&t>0,l=t||0;if(n&&a){s=s.slice();const f=s[0],u=new w(o.x+(f.x-o.x)/2,o.y+(f.y-o.y)/2);s.splice(0,0,u)}let c=s[0],h=1;for(e?r.push("M",c.x,c.y):r.push("L",c.x,c.y);h<(n?s.length:s.length-1);){let f=s[vs(h,s.length)],u=c.x-f.x,d=c.y-f.y;if(a&&(u!==0||d!==0)&&(i==null||i.indexOf(h-1)<0)){let g=Math.sqrt(u*u+d*d);const p=u*Math.min(l,g/2)/g,m=d*Math.min(l,g/2)/g,y=f.x+p,x=f.y+m;r.push("L",y,x);let b=s[vs(h+1,s.length)];for(;h<s.length-2&&Math.round(b.x-f.x)===0&&Math.round(b.y-f.y)===0;)b=s[vs(h+2,s.length)],h+=1;u=b.x-f.x,d=b.y-f.y,g=Math.max(1,Math.sqrt(u*u+d*d));const v=u*Math.min(l,g/2)/g,C=d*Math.min(l,g/2)/g,S=f.x+v,P=f.y+C;r.push("Q",f.x,f.y,S,P),f=new w(S,P)}else r.push("L",f.x,f.y);c=f,h+=1}return n?r.push("Z"):r.push("L",o.x,o.y),r.map(f=>typeof f=="string"?f:+f.toFixed(3)).join(" ")}function Ol(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})}),ty(e,t.round,t.initialMove==null||t.initialMove,t.close,t.exclude)}function Di(s,t,e,n,i=0,r=0,o=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,f=Math.cos(i*Math.PI/180),u=Math.sin(i*Math.PI/180),d=f*c+u*h,g=-1*u*c+f*h,p=d*d,m=g*g,y=e*e,x=n*n,b=p/y+m/x;let v;if(b>1)e=Math.sqrt(b)*e,n=Math.sqrt(b)*n,v=0;else{let U=1;r===o&&(U=-1),v=U*Math.sqrt((y*x-y*m-x*p)/(y*m+x*p))}const C=v*e*g/n,S=-1*v*n*d/e,P=f*C-u*S+a/2,O=u*C+f*S+l/2;let E=Math.atan2((g-S)/n,(d-C)/e)-Math.atan2(0,1),R=E>=0?E:2*Math.PI+E;E=Math.atan2((-g-S)/n,(-d-C)/e)-Math.atan2((g-S)/n,(d-C)/e);let T=E>=0?E:2*Math.PI+E;o===0&&T>0?T-=2*Math.PI:o!==0&&T<0&&(T+=2*Math.PI);const I=T*2/Math.PI,_=Math.ceil(I<0?-1*I:I),F=T/_,A=8/3*Math.sin(F/4)*Math.sin(F/4)/Math.sin(F/2),N=f*e,V=f*n,it=u*e,tt=u*n;let ht=Math.cos(R),D=Math.sin(R),Y=-A*(N*D+tt*ht),et=-A*(it*D-V*ht),H=0,nt=0;const Ct=[];for(let U=0;U<_;U+=1){R+=F,ht=Math.cos(R),D=Math.sin(R),H=N*ht-tt*D+P,nt=it*ht+V*D+O;const Pt=-A*(N*D+tt*ht),le=-A*(it*D-V*ht),jt=U*6;Ct[jt]=Number(Y+s),Ct[jt+1]=Number(et+t),Ct[jt+2]=Number(H-Pt+s),Ct[jt+3]=Number(nt-le+t),Ct[jt+4]=Number(H+s),Ct[jt+5]=Number(nt+t),Y=H+Pt,et=nt+le}return Ct.map(U=>+U.toFixed(2))}function ey(s,t,e,n,i=0,r=0,o=0,a,l){const c=[],h=Di(s,t,e,n,i,r,o,a,l);if(h!=null)for(let f=0,u=h.length;f<u;f+=6)c.push("C",h[f],h[f+1],h[f+2],h[f+3],h[f+4],h[f+5]);return c.join(" ")}class bt extends Te{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 bt.parse(t);this.points=t.map(e=>w.create(e))}else this.points=[]}scale(t,e,n=new w){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=w.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 L;let t=1/0,e=-1/0,n=1/0,i=-1/0;const r=this.points;for(let o=0,a=r.length;o<a;o+=1){const l=r[o],c=l.x,h=l.y;c<t&&(t=c),c>e&&(e=c),h<n&&(n=h),h>i&&(i=h)}return new L(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,r=0,o=1/0;for(let a=0,l=n-1;a<l;a+=1){const c=new j(e[a],e[a+1]),h=c.length(),f=c.closestPointNormalizedLength(t),d=c.pointAt(f).squaredDistance(t);d<o&&(o=d,r=i+f*h),i+=h}return r}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=w.clone(t),n=e.x,i=e.y,r=this.points,o=r.length;let a=o-1,l=0;for(let c=0;c<o;c+=1){const h=r[a],f=r[c];if(e.equals(h))return!0;const u=new j(h,f);if(u.containsPoint(t))return!0;if(i<=h.y&&i>f.y||i>h.y&&i<=f.y){const d=h.x-n>f.x-n?h.x-n:f.x-n;if(d>=0){const g=new w(n+d,i),p=new j(t,g);u.intersectsWithLine(p)&&(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 r=this.points[n],o=this.points[n+1],a=t.intersectsWithLine(new j(r,o));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 j(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],r=this.points[e+1];t+=i.distance(r)}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 r=this.length()*t;return this.pointAtLength(r)}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 r=0;for(let a=0,l=n-1;a<l;a+=1){const c=i?a:l-1-a,h=e[c],f=e[c+1],u=new j(h,f),d=h.distance(f);if(t<=r+d)return u.pointAtLength((i?1:-1)*(t-r));r+=d}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 r=this.length()*t;return this.tangentAtLength(r)}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 r,o=0;for(let a=0,l=n-1;a<l;a+=1){const c=i?a:l-1-a,h=e[c],f=e[c+1],u=new j(h,f),d=h.distance(f);if(u.isDifferentiable()){if(t<=o+d)return u.tangentAtLength((i?1:-1)*(t-o));r=u}o+=d}if(r){const a=i?1:0;return r.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 r=i,o=i+1,a=i+2,l=e[r],c=e[o],h=e[a];new j(l,h).closestPoint(c).distance(c)<=n?e.splice(o,1):i+=1}return this}toHull(){const t=this.points,e=t.length;if(e===0)return new bt;let n=t[0];for(let u=1;u<e;u+=1)(t[u].y<n.y||t[u].y===n.y&&t[u].x>n.x)&&(n=t[u]);const i=[];for(let u=0;u<e;u+=1){let d=n.theta(t[u]);d===0&&(d=360),i.push([t[u],u,d])}if(i.sort((u,d)=>{let g=u[2]-d[2];return g===0&&(g=d[1]-u[1]),g}),i.length>2){const u=i[i.length-1];i.unshift(u)}const r={},o=[],a=u=>`${u[0].toString()}@${u[1]}`;for(;i.length!==0;){const u=i.pop(),d=u[0];if(r[a(u)])continue;let g=!1;for(;!g;)if(o.length<2)o.push(u),g=!0;else{const p=o.pop(),m=p[0],y=o.pop(),x=y[0],b=x.cross(m,d);if(b<0)o.push(y),o.push(p),o.push(u),g=!0;else if(b===0){const C=m.angleBetween(x,d);Math.abs(C-180)<1e-10||m.equals(d)||x.equals(m)?(r[a(p)]=m,o.push(y)):Math.abs((C+1)%360-1)<1e-10&&(o.push(y),i.push(p))}else r[a(p)]=m,o.push(y)}}o.length>2&&o.pop();let l,c=-1;for(let u=0,d=o.length;u<d;u+=1){const g=o[u][1];(l===void 0||g<l)&&(l=g,c=u)}let h=[];if(c>0){const u=o.slice(c),d=o.slice(0,c);h=u.concat(d)}else h=o;const f=[];for(let u=0,d=h.length;u<d;u+=1)f.push(h[u][0]);return new bt(f)}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 bt(this.points.map(t=>t.clone()))}toJSON(){return this.points.map(t=>t.toJSON())}serialize(){return this.points.map(t=>`${t.serialize()}`).join(" ")}}(function(s){function t(e){return e!=null&&e instanceof s}s.isPolyline=t})(bt||(bt={}));(function(s){function t(e){const n=e.trim();if(n==="")return new s;const i=[],r=n.split(/\s*,\s*|\s+/);for(let o=0,a=r.length;o<a;o+=2)i.push({x:+r[o],y:+r[o+1]});return new s(i)}s.parse=t})(bt||(bt={}));class dt extends Te{constructor(t,e,n,i){super(),this.PRECISION=3,this.start=w.create(t),this.controlPoint1=w.create(e),this.controlPoint2=w.create(n),this.end=w.create(i)}bbox(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end,r=t.x,o=t.y,a=e.x,l=e.y,c=n.x,h=n.y,f=i.x,u=i.y,d=[],g=[[],[]];let p,m,y,x,b,v,C,S;for(let N=0;N<2;N+=1){if(N===0?(m=6*r-12*a+6*c,p=-3*r+9*a-9*c+3*f,y=3*a-3*r):(m=6*o-12*l+6*h,p=-3*o+9*l-9*h+3*u,y=3*l-3*o),Math.abs(p)<1e-12){if(Math.abs(m)<1e-12)continue;x=-y/m,x>0&&x<1&&d.push(x);continue}C=m*m-4*y*p,S=Math.sqrt(C),!(C<0)&&(b=(-m+S)/(2*p),b>0&&b<1&&d.push(b),v=(-m-S)/(2*p),v>0&&v<1&&d.push(v))}let P,O,E,R=d.length;const T=R;for(;R;)R-=1,x=d[R],E=1-x,P=E*E*E*r+3*E*E*x*a+3*E*x*x*c+x*x*x*f,g[0][R]=P,O=E*E*E*o+3*E*E*x*l+3*E*x*x*h+x*x*x*u,g[1][R]=O;d[T]=0,d[T+1]=1,g[0][T]=r,g[1][T]=o,g[0][T+1]=f,g[1][T+1]=u,d.length=T+2,g[0].length=T+2,g[1].length=T+2;const I=Math.min.apply(null,g[0]),_=Math.min.apply(null,g[1]),F=Math.max.apply(null,g[0]),A=Math.max.apply(null,g[1]);return new L(I,_,F-I,A-_)}closestPoint(t,e={}){return this.pointAtT(this.closestPointT(t,e))}closestPointLength(t,e={}){const n=this.getOptions(e);return this.lengthAtT(this.closestPointT(t,n),n)}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),i=this.closestPointLength(t,n);if(!i)return 0;const r=this.length(n);return r===0?0:i/r}closestPointT(t,e={}){const n=this.getPrecision(e),i=this.getDivisions(e),r=Math.pow(10,-n);let o=null,a=0,l=0,c=0,h=0,f=0,u=null;const d=i.length;let g=d>0?1/d:0;for(i.forEach((p,m)=>{const y=p.start.distance(t),x=p.end.distance(t),b=y+x;(u==null||b<u)&&(o=p,a=m*g,l=(m+1)*g,c=y,h=x,u=b,f=p.endpointDistance())});;){const p=c?Math.abs(c-h)/c:0,m=h!=null?Math.abs(c-h)/h:0,y=p<r||m<r,x=c?c<f*r:!0,b=h?h<f*r:!0;if(y||(x||b))return c<=h?a:l;const C=o.divide(.5);g/=2;const S=C[0].start.distance(t),P=C[0].end.distance(t),O=S+P,E=C[1].start.distance(t),R=C[1].end.distance(t),T=E+R;O<=T?(o=C[0],l-=g,c=S,h=P):(o=C[1],a+=g,c=E,h=R)}}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,r=this.end;if(t<=0)return[new dt(e,e,e,e),new dt(e,n,i,r)];if(t>=1)return[new dt(e,n,i,r),new dt(r,r,r,r)];const o=this.getSkeletonPoints(t),a=o.startControlPoint1,l=o.startControlPoint2,c=o.divider,h=o.dividerControlPoint1,f=o.dividerControlPoint2;return[new dt(e,a,l,c),new dt(c,h,f,r)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,r=this.end;if(t<=0)return{startControlPoint1:e.clone(),startControlPoint2:e.clone(),divider:e.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:i.clone()};if(t>=1)return{startControlPoint1:n.clone(),startControlPoint2:i.clone(),divider:r.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:r.clone()};const o=new j(e,n).pointAt(t),a=new j(n,i).pointAt(t),l=new j(i,r).pointAt(t),c=new j(o,a).pointAt(t),h=new j(a,l).pointAt(t),f=new j(c,h).pointAt(t);return{startControlPoint1:o,startControlPoint2:c,divider:f,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 r=Math.pow(10,-e);let o=0;for(;;){o+=1;const a=[];n.forEach(h=>{const f=h.divide(.5);a.push(f[0],f[1])});const l=a.reduce((h,f)=>h+f.endpointDistance(),0),c=l!==0?(l-i)/l:0;if(o>1&&c<r)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,r=e.divider,o=new j(n,i);return o.translate(r.x-n.x,r.y-n.y),o}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),r=this.length(n)*t;return this.tAtLength(r,n)}tAtLength(t,e={}){let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),r=this.getDivisions(e),o={precision:i,subdivisions:r};let a=null,l,c,h=0,f=0,u=0;const d=r.length;let g=d>0?1/d:0;for(let y=0;y<d;y+=1){const x=n?y:d-1-y,b=r[y],v=b.endpointDistance();if(t<=u+v){a=b,l=x*g,c=(x+1)*g,h=n?t-u:v+u-t,f=n?v+u-t:t-u;break}u+=v}if(a==null)return n?1:0;const p=this.length(o),m=Math.pow(10,-i);for(;;){let y;if(y=p!==0?h/p:0,y<m)return l;if(y=p!==0?f/p:0,y<m)return c;let x,b;const v=a.divide(.5);g/=2;const C=v[0].endpointDistance(),S=v[1].endpointDistance();h<=C?(a=v[0],c-=g,x=h,b=C-x):(a=v[1],l+=g,x=h-C,b=S-x),h=x,f=b}}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 bt(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(s){function t(e){return e!=null&&e instanceof s}s.isCurve=t})(dt||(dt={}));(function(s){function t(i){const r=i.length,o=[],a=[];let l=2;o[0]=i[0]/l;for(let c=1;c<r;c+=1)a[c]=1/l,l=(c<r-1?4:3.5)-a[c],o[c]=(i[c]-o[c-1])/l;for(let c=1;c<r;c+=1)o[r-c-1]-=a[r-c]*o[r-c];return o}function e(i){const r=i.map(u=>w.clone(u)),o=[],a=[],l=r.length-1;if(l===1)return o[0]=new w((2*r[0].x+r[1].x)/3,(2*r[0].y+r[1].y)/3),a[0]=new w(2*o[0].x-r[0].x,2*o[0].y-r[0].y),[o,a];const c=[];for(let u=1;u<l-1;u+=1)c[u]=4*r[u].x+2*r[u+1].x;c[0]=r[0].x+2*r[1].x,c[l-1]=(8*r[l-1].x+r[l].x)/2;const h=t(c);for(let u=1;u<l-1;u+=1)c[u]=4*r[u].y+2*r[u+1].y;c[0]=r[0].y+2*r[1].y,c[l-1]=(8*r[l-1].y+r[l].y)/2;const f=t(c);for(let u=0;u<l;u+=1)o.push(new w(h[u],f[u])),u<l-1?a.push(new w(2*r[u+1].x-h[u+1],2*r[u+1].y-f[u+1])):a.push(new w((r[l].x+h[l-1])/2,(r[l].y+f[l-1])/2));return[o,a]}function n(i){if(i==null||Array.isArray(i)&&i.length<2)throw new Error("At least 2 points are required");const r=e(i),o=[];for(let a=0,l=r[0].length;a<l;a+=1){const c=new w(r[0][a].x,r[0][a].y),h=new w(r[1][a].x,r[1][a].y);o.push(new s(i[a],c,h,i[a+1]))}return o}s.throughPoints=n})(dt||(dt={}));class rs extends Te{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 Lt extends rs{constructor(t,e){super(),j.isLine(t)?this.endPoint=t.end.clone().round(2):this.endPoint=w.create(t,e).round(2)}get type(){return"L"}get line(){return new j(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 Lt(e[0]),new Lt(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[new Lt(e[0]),new Lt(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 Lt(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}`}}(function(s){function t(...e){const n=e.length,i=e[0];if(j.isLine(i))return new s(i);if(w.isPointLike(i))return n===1?new s(i):e.map(o=>new s(o));if(n===2)return new s(+e[0],+e[1]);const r=[];for(let o=0;o<n;o+=2){const a=+e[o],l=+e[o+1];r.push(new s(a,l))}return r}s.create=t})(Lt||(Lt={}));class an extends rs{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 j(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 Lt(e[0]):this.clone(),new Lt(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[e[1].isDifferentiable()?new Lt(e[0]):this.clone(),new Lt(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 an}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}(function(s){function t(){return new s}s.create=t})(an||(an={}));class ln extends rs{constructor(t,e){super(),this.isVisible=!1,this.isSubpathStart=!0,j.isLine(t)||dt.isCurve(t)?this.endPoint=t.end.clone().round(2):this.endPoint=w.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 ln(this.end)}equals(t){return this.type===t.type&&this.end.equals(t.end)}toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){const t=this.end;return`${this.type} ${t.x} ${t.y}`}}(function(s){function t(...e){const n=e.length,i=e[0];if(j.isLine(i))return new s(i);if(dt.isCurve(i))return new s(i);if(w.isPointLike(i)){if(n===1)return new s(i);const o=[];for(let a=0;a<n;a+=1)a===0?o.push(new s(e[a])):o.push(new Lt(e[a]));return o}if(n===2)return new s(+e[0],+e[1]);const r=[];for(let o=0;o<n;o+=2){const a=+e[o],l=+e[o+1];o===0?r.push(new s(a,l)):r.push(new Lt(a,l))}return r}s.create=t})(ln||(ln={}));class Ft extends rs{constructor(t,e,n,i,r,o){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 w(t,e).round(2),this.controlPoint2=new w(n,i).round(2),this.endPoint=new w(r,o).round(2)):(this.controlPoint1=w.create(t).round(2),this.controlPoint2=w.create(e).round(2),this.endPoint=w.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 Ft(n[0]),new Ft(n[1])]}divideAtLength(t,e={}){const n=this.curve.divideAtLength(t,e);return[new Ft(n[0]),new Ft(n[1])]}divideAtT(t){const e=this.curve.divideAtT(t);return[new Ft(e[0]),new Ft(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 Ft(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(s){function t(...e){const n=e.length,i=e[0];if(dt.isCurve(i))return new s(i);if(w.isPointLike(i)){if(n===3)return new s(e[0],e[1],e[2]);const o=[];for(let a=0;a<n;a+=3)o.push(new s(e[a],e[a+1],e[a+2]));return o}if(n===6)return new s(e[0],e[1],e[2],e[3],e[4],e[5]);const r=[];for(let o=0;o<n;o+=6)r.push(new s(e[o],e[o+1],e[o+2],e[o+3],e[o+4],e[o+5]));return r}s.create=t})(Ft||(Ft={}));function yi(s,t,e){return{x:s*Math.cos(e)-t*Math.sin(e),y:s*Math.sin(e)+t*Math.cos(e)}}function So(s,t,e,n,i,r){const o=.3333333333333333,a=2/3;return[o*s+a*e,o*t+a*n,o*i+a*e,o*r+a*n,i,r]}function El(s,t,e,n,i,r,o,a,l,c){const h=Math.PI*120/180,f=Math.PI/180*(+i||0);let u=[],d,g,p,m,y;if(c)g=c[0],p=c[1],m=c[2],y=c[3];else{d=yi(s,t,-f),s=d.x,t=d.y,d=yi(a,l,-f),a=d.x,l=d.y;const F=(s-a)/2,A=(t-l)/2;let N=F*F/(e*e)+A*A/(n*n);N>1&&(N=Math.sqrt(N),e=N*e,n=N*n);const V=e*e,it=n*n,tt=(r===o?-1:1)*Math.sqrt(Math.abs((V*it-V*A*A-it*F*F)/(V*A*A+it*F*F)));m=tt*e*A/n+(s+a)/2,y=tt*-n*F/e+(t+l)/2,g=Math.asin((t-y)/n),p=Math.asin((l-y)/n),g=s<m?Math.PI-g:g,p=a<m?Math.PI-p:p,g<0&&(g=Math.PI*2+g),p<0&&(p=Math.PI*2+p),o&&g>p&&(g-=Math.PI*2),!o&&p>g&&(p-=Math.PI*2)}let x=p-g;if(Math.abs(x)>h){const F=p,A=a,N=l;p=g+h*(o&&p>g?1:-1),a=m+e*Math.cos(p),l=y+n*Math.sin(p),u=El(a,l,e,n,i,0,o,A,N,[p,F,m,y])}x=p-g;const b=Math.cos(g),v=Math.sin(g),C=Math.cos(p),S=Math.sin(p),P=Math.tan(x/4),O=4/3*(e*P),E=4/3*(n*P),R=[s,t],T=[s+O*v,t-E*b],I=[a+O*S,l-E*C],_=[a,l];if(T[0]=2*R[0]-T[0],T[1]=2*R[1]-T[1],c)return[T,I,_].concat(u);{u=[T,I,_].concat(u).join().split(",");const F=[],A=u.length;for(let N=0;N<A;N+=1)F[N]=N%2?yi(+u[N-1],+u[N],f).y:yi(+u[N],+u[N+1],f).x;return F}}function ny(s){if(!s)return null;const t=`
4
+ \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},r=[];return s.replace(e,(o,a,l)=>{const c=[];let h=a.toLowerCase();l.replace(n,(u,d)=>(d&&c.push(+d),u)),h==="m"&&c.length>2&&(r.push([a,...c.splice(0,2)]),h="l",a=a==="m"?"l":"L");const f=i[h];for(;c.length>=f&&(r.push([a,...c.splice(0,f)]),!!f););return o}),r}function iy(s){const t=ny(s);if(!t||!t.length)return[["M",0,0]];let e=0,n=0,i=0,r=0;const o=[];for(let a=0,l=t.length;a<l;a+=1){const c=[];o.push(c);const h=t[a],f=h[0];if(f!==f.toUpperCase())switch(c[0]=f.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,r=+h[2]+n;for(let u=1,d=h.length;u<d;u+=1)c[u]=+h[u]+(u%2?e:n);break;default:for(let u=1,d=h.length;u<d;u+=1)c[u]=+h[u]+(u%2?e:n);break}else for(let u=0,d=h.length;u<d;u+=1)c[u]=h[u];switch(c[0]){case"Z":e=+i,n=+r;break;case"H":e=c[1];break;case"V":n=c[1];break;case"M":i=c[c.length-2],r=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 o}function sy(s){const t=iy(s),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function n(l,c,h){let f,u;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(El.apply(0,[c.x,c.y].concat(l.slice(1))));case"S":return h==="C"||h==="S"?(f=c.x*2-c.bx,u=c.y*2-c.by):(f=c.x,u=c.y),["C",f,u].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(So(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(So(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;)r[c]="A",c+=1,l.splice(c,0,["C"].concat(h.splice(0,6)));l.splice(c,1),a=t.length}}const r=[];let o="",a=t.length;for(let l=0;l<a;l+=1){let c="";t[l]&&(c=t[l][0]),c!=="C"&&(r[l]=c,l>0&&(o=r[l-1])),t[l]=n(t[l],e,o),r[l]!=="A"&&c==="C"&&(r[l]="C"),i(t,l);const h=t[l],f=h.length;e.x=h[f-2],e.y=h[f-1],e.bx=parseFloat(h[f-4])||e.x,e.by=parseFloat(h[f-3])||e.y}return(!t[0][0]||t[0][0]!=="M")&&t.unshift(["M",0,0]),t}function ry(s){return sy(s).map(t=>t.map(e=>typeof e=="string"?e:Z.round(e,2))).join(",").split(",").join(" ")}class $ extends Te{constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t))if(j.isLine(t[0])||dt.isCurve(t[0])){let e=null;t.forEach((i,r)=>{r===0&&this.appendSegment($.createSegment("M",i.start)),e!=null&&!e.end.equals(i.start)&&this.appendSegment($.createSegment("M",i.start)),j.isLine(i)?this.appendSegment($.createSegment("L",i.end)):dt.isCurve(i)&&this.appendSegment($.createSegment("C",i.controlPoint1,i.controlPoint2,i.end)),e=i})}else t.forEach(n=>{n.isSegment&&this.appendSegment(n)});else t!=null&&(j.isLine(t)?(this.appendSegment($.createSegment("M",t.start)),this.appendSegment($.createSegment("L",t.end))):dt.isCurve(t)?(this.appendSegment($.createSegment("M",t.start)),this.appendSegment($.createSegment("C",t.controlPoint1,t.controlPoint2,t.end))):bt.isPolyline(t)?t.points&&t.points.length&&t.points.forEach((e,n)=>{const i=n===0?$.createSegment("M",e):$.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(ln.create.call(null,...t))}lineTo(...t){return this.appendSegment(Lt.create.call(null,...t))}curveTo(...t){return this.appendSegment(Ft.create.call(null,...t))}arcTo(t,e,n,i,r,o,a){const l=this.end||new w,c=typeof o=="number"?Di(l.x,l.y,t,e,n,i,r,o,a):Di(l.x,l.y,t,e,n,i,r,o.x,o.y);if(c!=null)for(let h=0,f=c.length;h<f;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 r=this.end||new w,o=["M",r.x,r.y];if(typeof t=="number")o.push("Q",t,e,n,i);else{const l=e;o.push("Q",t.x,t.y,l.x,l.y)}const a=$.parse(o.join(" "));return this.appendSegment(a.segments.slice(1)),this}close(){return this.appendSegment(an.create())}drawPoints(t,e={}){const n=Ol(t,e),i=$.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 r=0;r<e;r+=1){const o=t[r];if(o.isVisible){const a=o.bbox();a!=null&&(n=n?n.union(a):a)}}if(n!=null)return n;const i=t[e-1];return new L(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 r=null;if(Array.isArray(t))for(let o=0,a=t.length;o<a;o+=1){const l=t[o];i=this.prepareSegment(l,n,r),this.segments.push(i),n=i}else t!=null&&t.isSegment&&(i=this.prepareSegment(t,n,r),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,r=null,o=null;if(n!==0&&(t>=1?(r=this.segments[t-1],o=r.nextSegment):(r=null,o=this.segments[0])),!Array.isArray(e))i=this.prepareSegment(e,r,o),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,r,o),this.segments.splice(t+a,0,i),r=i}return this}removeSegment(t){const e=this.fixIndex(t),n=this.segments.splice(e,1)[0],i=n.previousSegment,r=n.nextSegment;return i&&(i.nextSegment=r),r&&(r.previousSegment=i),n.isSubpathStart&&r&&this.updateSubpathStartSegment(r),n}replaceSegment(t,e){const n=this.fixIndex(t);let i;const r=this.segments[n];let o=r.previousSegment;const a=r.nextSegment;let l=r.isSubpathStart;if(!Array.isArray(e))i=this.prepareSegment(e,o,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 f=e[c];i=this.prepareSegment(f,o,a),this.segments.splice(t+c,0,i),o=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=Z.clamp(t,0,1),i=this.getOptions(e),o=this.length(i)*n;return this.segmentIndexAtLength(o,i)}segmentIndexAtLength(t,e={}){const n=this.segments.length;if(n===0)return null;let i=!0;t<0&&(i=!1,t=-t);const r=this.getPrecision(e),o=this.getSubdivisions(e);let a=0,l=null;for(let c=0;c<n;c+=1){const h=i?c:n-1-c,f=this.segments[h],u=o[h],d=f.length({precision:r,subdivisions:u});if(f.isVisible){if(t<=a+d)return h;l=h}a+=d}return l}getSegmentSubdivisions(t={}){const e=this.getPrecision(t),n=[];for(let i=0,r=this.segments.length;i<r;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 r=this.length(n);return r===0?0:i/r}closestPointT(t,e={}){if(this.segments.length===0)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let r,o=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 f=c.closestPointT(t,{precision:n,subdivisions:h}),u=c.pointAtT(f),d=Z.squaredLength(u,t);d<o&&(r={segmentIndex:a,value:f},o=d)}}return r||{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 r,o=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 f=c.closestPointT(t,{precision:n,subdivisions:h}),u=c.pointAtT(f),d=Z.squaredLength(u,t);d<o&&(r=c.tangentAtT(f),o=d)}}return r||null}containsPoint(t,e={}){const n=this.toPolylines(e);if(!n)return!1;let i=0;for(let r=0,o=n.length;r<o;r+=1)n[r].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),r=this.length(n)*t;return this.pointAtLength(r,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),r=this.getSubdivisions(e);let o,a=0;for(let c=0,h=this.segments.length;c<h;c+=1){const f=n?c:h-1-c,u=this.segments[f],d=r[f],g=u.length({precision:i,subdivisions:d});if(u.isVisible){if(t<=a+g)return u.pointAtLength((n?1:-1)*(t-a),{precision:i,subdivisions:d});o=u}a+=g}return o?n?o.end:o.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 r=Z.clamp(t.value,0,1);return e[i].pointAtT(r)}divideAt(t,e={}){if(this.segments.length===0)return null;const n=Z.clamp(t,0,1),i=this.getOptions(e),o=this.length(i)*n;return this.divideAtLength(o,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),r=this.getSubdivisions(e);let o=0,a,l,c,h,f;for(let C=0,S=this.segments.length;C<S;C+=1){const P=n?C:S-1-C,O=this.getSegment(P),E=r[P],R={precision:i,subdivisions:E},T=O.length(R);if(O.isDifferentiable()&&(c=O,h=P,t<=o+T)){l=P,a=O.divideAtLength((n?1:-1)*(t-o),R);break}o+=T}if(!c)return null;a||(l=h,f=n?1:0,a=c.divideAtT(f));const u=this.clone(),d=l;u.replaceSegment(d,a);const g=d;let p=d+1,m=d+2;a[0].isDifferentiable()||(u.removeSegment(g),p-=1,m-=1);const y=u.getSegment(p).start;u.insertSegment(p,$.createSegment("M",y)),m+=1,a[1].isDifferentiable()||(u.removeSegment(m-1),m-=1);const x=m-g-1;for(let C=m,S=u.segments.length;C<S;C+=1){const P=this.getSegment(C-x),O=u.getSegment(C);if(O.type==="Z"&&!P.subpathStartSegment.end.equals(O.subpathStartSegment.end)){const E=$.createSegment("L",P.end);u.replaceSegment(C,E)}}const b=new $(u.segments.slice(0,p)),v=new $(u.segments.slice(p));return[b,v]}intersectsWithLine(t,e={}){const n=this.toPolylines(e);if(n==null)return null;let i=null;for(let r=0,o=n.length;r<o;r+=1){const a=n[r],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,r=this.segments.length;i<r;i+=1){const o=this.segments[i],a=e[i];n+=o.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 r=Z.clamp(t.value,0,1);i>=n&&(i=n-1,r=1);const o=this.getPrecision(e),a=this.getSubdivisions(e);let l=0;for(let f=0;f<i;f+=1){const u=this.segments[f],d=a[f];l+=u.length({precision:o,subdivisions:d})}const c=this.segments[i],h=a[i];return l+=c.lengthAtT(r,{precision:o,subdivisions:h}),l}tangentAt(t,e={}){if(this.segments.length===0)return null;const n=Z.clamp(t,0,1),i=this.getOptions(e),o=this.length(i)*n;return this.tangentAtLength(o,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),r=this.getSubdivisions(e);let o,a=0;for(let l=0,c=this.segments.length;l<c;l+=1){const h=n?l:c-1-l,f=this.segments[h],u=r[h],d=f.length({precision:i,subdivisions:u});if(f.isDifferentiable()){if(t<=a+d)return f.tangentAtLength((n?1:-1)*(t-a),{precision:i,subdivisions:u});o=f}a+=d}if(o){const l=n?1:0;return o.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=Z.clamp(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),r=[];let o=[];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=>o.push(h.start)):o.push(l.start)}else o.length>0&&(o.push(e[a-1].end),r.push(o),o=[])}return o.length>0&&(o.push(this.end),r.push(o)),r}toPolylines(t={}){const e=this.toPoints(t);return e?e.map(n=>new bt(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 $;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 r=0;r<i;r+=1){const o=e[r],a=n[r];if(o.type!==a.type||!o.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(s){function t(e){return e!=null&&e instanceof s}s.isPath=t})($||($={}));(function(s){function t(n){if(!n)return new s;const i=new s,r=/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g,o=s.normalize(n).match(r);if(o!=null)for(let a=0,l=o.length;a<l;a+=1){const c=o[a],h=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,f=c.match(h);if(f!=null){const u=f[0],d=f.slice(1).map(p=>+p),g=e.call(null,u,...d);i.appendSegment(g)}}return i}s.parse=t;function e(n,...i){if(n==="M")return ln.create.call(null,...i);if(n==="L")return Lt.create.call(null,...i);if(n==="C")return Ft.create.call(null,...i);if(n==="z"||n==="Z")return an.create();throw new Error(`Invalid path segment type "${n}"`)}s.createSegment=e})($||($={}));(function(s){s.normalize=ry,s.isValid=Qb,s.drawArc=ey,s.drawPoints=Ol,s.arcToCurves=Di})($||($={}));class xt{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(([o,a])=>{this.register(o,a,e)});return}this.exist(t)&&!n&&!qt.isApplyingHMR()&&this.onDuplicated(t);const i=this.options.process,r=i?k(i,this,t,e):e;return this.data[t]=r,r}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&&k(this.options.onConflict,this,t),new Error(`${Ei(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} ${Cm(this.options.type)}`:this.options.type;return`${Ei(i)} with name '${t}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(t){return nb(t,Object.keys(this.data),e=>e)}}(function(s){function t(e){return new s(e)}s.create=t})(xt||(xt={}));const oy={color:"#aaaaaa",thickness:1,markup:"rect",update(s,t){const e=t.thickness*t.sx,n=t.thickness*t.sy;X(s,{width:e,height:n,rx:e,ry:n,fill:t.color})}},ay={color:"#aaaaaa",thickness:1,markup:"rect",update(s,t){const e=t.sx<=1?t.thickness*t.sx:t.thickness;X(s,{width:e,height:e,rx:e,ry:e,fill:t.color})}},ly={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(s,t){let e;const n=t.width,i=t.height,r=t.thickness;n-r>=0&&i-r>=0?e=["M",n,0,"H0 M0 0 V0",i].join(" "):e="M 0 0 0 0",X(s,{d:e,stroke:t.color,"stroke-width":t.thickness})}},cy=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(s,t){let e;const n=t.width,i=t.height,r=t.thickness;n-r>=0&&i-r>=0?e=["M",n,0,"H0 M0 0 V0",i].join(" "):e="M 0 0 0 0",X(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,r=t.height*n,o=t.thickness;i-o>=0&&r-o>=0?e=["M",i,0,"H0 M0 0 V0",r].join(" "):e="M 0 0 0 0",t.width=i,t.height=r,X(s,{d:e,stroke:t.color,"stroke-width":t.thickness})}}],hy=Object.freeze(Object.defineProperty({__proto__:null,dot:oy,doubleMesh:cy,fixedDot:ay,mesh:ly},Symbol.toStringTag,{value:"Module"}));class we{constructor(){this.patterns={},this.root=z.create(Ni(),{width:"100%",height:"100%"},[ee("defs")]).node}add(t,e){const n=this.root.childNodes[0];n&&n.appendChild(e),this.patterns[t]=e,z.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}}(function(s){s.presets=hy,s.registry=xt.create({type:"grid"}),s.registry.register(s.presets,!0)})(we||(we={}));const Al=function(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},Ml=function(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},Tl=function(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},uy=function(s,t){const e=s.width,n=s.height,i=document.createElement("canvas");i.width=e*3,i.height=n*3;const r=i.getContext("2d"),o=t.angle!=null?-t.angle:-20,a=W.toRad(o),l=i.width/4,c=i.height/4;for(let h=0;h<4;h+=1)for(let f=0;f<4;f+=1)(h+f)%2>0&&(r.setTransform(1,0,0,1,(2*h-1)*l,(2*f-1)*c),r.rotate(a),r.drawImage(s,-e/2,-n/2,e,n));return i},fy=Object.freeze(Object.defineProperty({__proto__:null,flipX:Al,flipXY:Tl,flipY:Ml,watermark:uy},Symbol.toStringTag,{value:"Module"}));var Qn;(function(s){s.presets=Object.assign({},fy),s.presets["flip-x"]=Al,s.presets["flip-y"]=Ml,s.presets["flip-xy"]=Tl,s.registry=xt.create({type:"background pattern"}),s.registry.register(s.presets,!0)})(Qn||(Qn={}));function vr(s,t){return s??t}function Mt(s,t){return s!=null&&Number.isFinite(s)?s:t}function dy(s={}){const t=vr(s.color,"blue"),e=Mt(s.width,1),n=Mt(s.margin,2),i=Mt(s.opacity,1),r=n,o=n+e;return`
5
+ <filter>
6
+ <feFlood flood-color="${t}" flood-opacity="${i}" result="colored"/>
7
+ <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${o}" />
8
+ <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${r}" />
9
+ <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>
10
+ <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>
11
+ <feMerge>
12
+ <feMergeNode in="outline"/>
13
+ <feMergeNode in="SourceGraphic"/>
14
+ </feMerge>
15
+ </filter>
16
+ `.trim()}function gy(s={}){const t=vr(s.color,"red"),e=Mt(s.blur,0),n=Mt(s.width,1),i=Mt(s.opacity,1);return`
17
+ <filter>
18
+ <feFlood flood-color="${t}" flood-opacity="${i}" result="colored"/>
19
+ <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${n}"/>
20
+ <feComposite result="composed" in="colored" in2="morphed" operator="in"/>
21
+ <feGaussianBlur result="blured" in="composed" stdDeviation="${e}"/>
22
+ <feBlend in="SourceGraphic" in2="blured" mode="normal"/>
23
+ </filter>
24
+ `.trim()}function py(s={}){const t=Mt(s.x,2);return`
25
+ <filter>
26
+ <feGaussianBlur stdDeviation="${s.y!=null&&Number.isFinite(s.y)?[t,s.y]:t}"/>
27
+ </filter>
28
+ `.trim()}function my(s={}){const t=Mt(s.dx,0),e=Mt(s.dy,0),n=vr(s.color,"black"),i=Mt(s.blur,4),r=Mt(s.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>
29
+ <feDropShadow stdDeviation="${i}" dx="${t}" dy="${e}" flood-color="${n}" flood-opacity="${r}" />
30
+ </filter>`.trim():`<filter>
31
+ <feGaussianBlur in="SourceAlpha" stdDeviation="${i}" />
32
+ <feOffset dx="${t}" dy="${e}" result="offsetblur" />
33
+ <feFlood flood-color="${n}" />
34
+ <feComposite in2="offsetblur" operator="in" />
35
+ <feComponentTransfer>
36
+ <feFuncA type="linear" slope="${r}" />
37
+ </feComponentTransfer>
38
+ <feMerge>
39
+ <feMergeNode/>
40
+ <feMergeNode in="SourceGraphic"/>
41
+ </feMerge>
42
+ </filter>`.trim()}function by(s={}){const t=Mt(s.amount,1),e=.2126+.7874*(1-t),n=.7152-.7152*(1-t),i=.0722-.0722*(1-t),r=.2126-.2126*(1-t),o=.7152+.2848*(1-t),a=.0722-.0722*(1-t),l=.2126-.2126*(1-t),c=.0722+.9278*(1-t);return`
43
+ <filter>
44
+ <feColorMatrix type="matrix" values="${e} ${n} ${i} 0 0 ${r} ${o} ${a} 0 0 ${l} ${n} ${c} 0 0 0 0 0 1 0"/>
45
+ </filter>
46
+ `.trim()}function yy(s={}){const t=Mt(s.amount,1),e=.393+.607*(1-t),n=.769-.769*(1-t),i=.189-.189*(1-t),r=.349-.349*(1-t),o=.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`
47
+ <filter>
48
+ <feColorMatrix type="matrix" values="${e} ${n} ${i} 0 0 ${r} ${o} ${a} 0 0 ${l} ${c} ${h} 0 0 0 0 0 1 0"/>
49
+ </filter>
50
+ `.trim()}function xy(s={}){return`
51
+ <filter>
52
+ <feColorMatrix type="saturate" values="${1-Mt(s.amount,1)}"/>
53
+ </filter>
54
+ `.trim()}function vy(s={}){return`
55
+ <filter>
56
+ <feColorMatrix type="hueRotate" values="${Mt(s.angle,0)}"/>
57
+ </filter>
58
+ `.trim()}function wy(s={}){const t=Mt(s.amount,1),e=1-t;return`
59
+ <filter>
60
+ <feComponentTransfer>
61
+ <feFuncR type="table" tableValues="${t} ${e}"/>
62
+ <feFuncG type="table" tableValues="${t} ${e}"/>
63
+ <feFuncB type="table" tableValues="${t} ${e}"/>
64
+ </feComponentTransfer>
65
+ </filter>
66
+ `.trim()}function Cy(s={}){const t=Mt(s.amount,1);return`
67
+ <filter>
68
+ <feComponentTransfer>
69
+ <feFuncR type="linear" slope="${t}"/>
70
+ <feFuncG type="linear" slope="${t}"/>
71
+ <feFuncB type="linear" slope="${t}"/>
72
+ </feComponentTransfer>
73
+ </filter>
74
+ `.trim()}function Py(s={}){const t=Mt(s.amount,1),e=.5-t/2;return`
75
+ <filter>
76
+ <feComponentTransfer>
77
+ <feFuncR type="linear" slope="${t}" intercept="${e}"/>
78
+ <feFuncG type="linear" slope="${t}" intercept="${e}"/>
79
+ <feFuncB type="linear" slope="${t}" intercept="${e}"/>
80
+ </feComponentTransfer>
81
+ </filter>
82
+ `.trim()}const Sy=Object.freeze(Object.defineProperty({__proto__:null,blur:py,brightness:Cy,contrast:Py,dropShadow:my,grayScale:by,highlight:gy,hueRotate:vy,invert:wy,outline:dy,saturate:xy,sepia:yy},Symbol.toStringTag,{value:"Module"}));var cn;(function(s){s.presets=Sy,s.registry=xt.create({type:"filter"}),s.registry.register(s.presets,!0)})(cn||(cn={}));const Oy={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"},Ey={},Nl={position:os("x","width","origin")},Rl={position:os("y","height","origin")},Ay={position:os("x","width","corner")},My={position:os("y","height","corner")},Ll={set:Se("width","width")},Il={set:Se("height","height")},Ty={set:Se("rx","width")},Ny={set:Se("ry","height")},jl={set:(s=>{const t=Se(s,"width"),e=Se(s,"height");return function(n,i){const r=i.refBBox,o=r.height>r.width?t:e;return k(o,this,n,i)}})("r")},Ry={set(s,{refBBox:t}){let e=parseFloat(s);const n=de(s);n&&(e/=100);const i=Math.sqrt(t.height*t.height+t.width*t.width);let r;return Number.isFinite(e)&&(n||e>=0&&e<=1?r=e*i:r=Math.max(e+i,0)),{r}}},Ly={set:Se("cx","width")},Iy={set:Se("cy","height")},Dl={set:$l({resetOffset:!0})},jy={set:$l({resetOffset:!1})},Bl={set:zl({resetOffset:!0})},Dy={set:zl({resetOffset:!1})},By=jl,ky=Dl,$y=Bl,zy=Nl,Vy=Rl,_y=Ll,Fy=Il;function os(s,t,e){return(n,{refBBox:i})=>{if(n==null)return null;let r=parseFloat(n);const o=de(n);o&&(r/=100);let a;if(Number.isFinite(r)){const c=i[e];o||r>0&&r<1?a=c[s]+i[t]*r:a=c[s]+r}const l=new w;return l[s]=a||0,l}}function Se(s,t){return function(e,{refBBox:n}){let i=parseFloat(e);const r=de(e);r&&(i/=100);const o={};if(Number.isFinite(i)){const a=r||i>=0&&i<=1?i*n[t]:Math.max(i+n[t],0);o[s]=a}return o}}function kl(s,t){const e="x6-shape",n=t&&t.resetOffset;return function(i,{elem:r,refBBox:o}){let a=ze(r,e);if(!a||a.value!==i){const p=s(i);a={value:i,shape:p,shapeBBox:p.bbox()},ze(r,e,a)}const l=a.shape.clone(),c=a.shapeBBox.clone(),h=c.getOrigin(),f=o.getOrigin();c.x=f.x,c.y=f.y;const u=o.getMaxScaleToFit(c,f),d=c.width===0||o.width===0?1:u.sx,g=c.height===0||o.height===0?1:u.sy;return l.scale(d,g,h),n&&l.translate(-h.x,-h.y),l}}function $l(s){function t(n){return $.parse(n)}const e=kl(t,s);return(n,i)=>({d:e(n,i).serialize()})}function zl(s){const t=kl(e=>new bt(e),s);return(e,n)=>({points:t(e,n).serialize()})}const Gy={qualify:ae,set(s,{view:t}){return`url(#${t.graph.defineGradient(s)})`}},Hy={qualify:ae,set(s,{view:t}){const e=t.cell,n=Object.assign({},s);if(e.isEdge()&&n.type==="linearGradient"){const i=t,r=i.sourcePoint,o=i.targetPoint;n.id=`gradient-${n.type}-${e.id}`,n.attrs=Object.assign(Object.assign({},n.attrs),{x1:r.x,y1:r.y,x2:o.x,y2:o.y,gradientUnits:"userSpaceOnUse"}),t.graph.defs.remove(n.id)}return`url(#${t.graph.defineGradient(n)})`}},Vl={qualify(s,{attrs:t}){return t.textWrap==null||!ae(t.textWrap)},set(s,{view:t,elem:e,attrs:n}){const i="x6-text",r=ze(e,i),o=h=>{try{return JSON.parse(h)}catch{return h}},a={x:n.x,eol:n.eol,annotations:o(n.annotations),textPath:o(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),r==null||r!==c){const h=a.textPath;if(h!=null&&typeof h=="object"){const f=h.selector;if(typeof f=="string"){const u=t.find(f)[0];u instanceof SVGPathElement&&(gr(u),a.textPath=Object.assign({"xlink:href":`#${u.id}`},h))}}bl(e,`${s}`,a),ze(e,i,c)}}},qy={qualify:ae,set(s,{view:t,elem:e,attrs:n,refBBox:i}){const r=s,o=r.width||0;de(o)?i.width*=parseFloat(o)/100:o<=0?i.width+=o:i.width=o;const a=r.height||0;de(a)?i.height*=parseFloat(a)/100:a<=0?i.height+=a:i.height=a;let l,c=r.text;c==null&&(c=n.text||e?.textContent),c!=null?l=yl(`${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:r.ellipsis}):l="",k(Vl.set,this,l,{view:t,elem:e,attrs:n,refBBox:i,cell:t.cell})}},Nn=(s,{attrs:t})=>t.text!==void 0,Uy={qualify:Nn},Wy={qualify:Nn},Xy={qualify:Nn},Yy={qualify:Nn},Jy={qualify:Nn},Ky={qualify:Nn},Zy={qualify(s,{elem:t}){return t instanceof SVGElement},set(s,{elem:t}){const e="x6-title",n=`${s}`,i=ze(t,e);if(i==null||i!==n){ze(t,e,n);const r=t.firstChild;if(r&&r.tagName.toUpperCase()==="TITLE"){const o=r;o.textContent=n}else{const o=document.createElementNS(t.namespaceURI,"title");o.textContent=n,t.insertBefore(o,r)}}}},Qy={offset:_l("x","width","right")},t0={offset:_l("y","height","bottom")},e0={offset(s,{refBBox:t}){return s?{x:-t.x,y:-t.y}:{x:0,y:0}}};function _l(s,t,e){return(n,{refBBox:i})=>{const r=new w;let o;return n==="middle"?o=i[t]/2:n===e?o=i[t]:typeof n=="number"&&Number.isFinite(n)?o=n>-1&&n<1?-i[t]*n:-n:de(n)?o=i[t]*parseFloat(n)/100:o=0,r[s]=-(i[s]+o),r}}const n0={qualify:ae,set(s,{elem:t}){J(t,s)}},i0={set(s,{elem:t}){t.innerHTML=`${s}`}},s0={qualify:ae,set(s,{view:t}){return`url(#${t.graph.defineFilter(s)})`}},r0={set(s){return s!=null&&typeof s=="object"&&s.id?s.id:s}};function Ne(s,t,e){let n,i;typeof t=="object"?(n=t.x,i=t.y):(n=t,i=e);const r=$.parse(s),o=r.bbox();if(o){let a=-o.height/2-o.y,l=-o.width/2-o.x;typeof n=="number"&&(l-=n),typeof i=="number"&&(a-=i),r.translate(l,a)}return r.serialize()}var Fl=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 o0=s=>{var{size:t,width:e,height:n,offset:i,open:r}=s,o=Fl(s,["size","width","height","offset","open"]);return Gl({size:t,width:e,height:n,offset:i},r===!0,!0,void 0,o)},a0=s=>{var{size:t,width:e,height:n,offset:i,factor:r}=s,o=Fl(s,["size","width","height","offset","factor"]);return Gl({size:t,width:e,height:n,offset:i},!1,!1,r,o)};function Gl(s,t,e,n=3/4,i={}){const r=s.size||10,o=s.width||r,a=s.height||r,l=new $,c={};if(t)l.moveTo(o,0).lineTo(0,a/2).lineTo(o,a),c.fill="none";else{if(l.moveTo(0,a/2),l.lineTo(o,0),!e){const h=kt(n,0,1);l.lineTo(o*h,a/2)}l.lineTo(o,a),l.close()}return Object.assign(Object.assign(Object.assign({},c),i),{tagName:"path",d:Ne(l.serialize(),{x:s.offset!=null?s.offset:-o/2})})}var l0=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 c0=s=>{var{size:t,width:e,height:n,offset:i}=s,r=l0(s,["size","width","height","offset"]);const o=t||10,a=e||o,l=n||o,c=new $;return c.moveTo(0,l/2).lineTo(a/2,0).lineTo(a,l/2).lineTo(a/2,l).close(),Object.assign(Object.assign({},r),{tagName:"path",d:Ne(c.serialize(),i??-a/2)})};var h0=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 u0=s=>{var{d:t,offsetX:e,offsetY:n}=s,i=h0(s,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},i),{tagName:"path",d:Ne(t,e,n)})};var f0=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 d0=s=>{var{size:t,width:e,height:n,offset:i}=s,r=f0(s,["size","width","height","offset"]);const o=t||10,a=e||o,l=n||o,c=new $;return c.moveTo(0,0).lineTo(a,l).moveTo(0,l).lineTo(a,0),Object.assign(Object.assign({},r),{tagName:"path",fill:"none",d:Ne(c.serialize(),i||-a/2)})};var g0=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 p0=s=>{var{width:t,height:e,offset:n,open:i,flip:r}=s,o=g0(s,["width","height","offset","open","flip"]);let a=e||6;const l=t||10,c=i===!0,h=r===!0,f=Object.assign(Object.assign({},o),{tagName:"path"});h&&(a=-a);const u=new $;return u.moveTo(0,a).lineTo(l,0),c?f.fill="none":(u.lineTo(l,a),u.close()),f.d=Ne(u.serialize(),{x:n||-l/2,y:a/2}),f};var Hl=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 ql=s=>{var{r:t}=s,e=Hl(s,["r"]);const n=t||5;return Object.assign(Object.assign({cx:n},e),{tagName:"circle",r:n})},m0=s=>{var{r:t}=s,e=Hl(s,["r"]);const n=t||5,i=new $;return i.moveTo(n,0).lineTo(n,n*2),i.moveTo(0,n).lineTo(n*2,n),{children:[Object.assign(Object.assign({},ql({r:n})),{fill:"none"}),Object.assign(Object.assign({},e),{tagName:"path",d:Ne(i.serialize(),-n)})]}};var b0=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 y0=s=>{var{rx:t,ry:e}=s,n=b0(s,["rx","ry"]);const i=t||5,r=e||5;return Object.assign(Object.assign({cx:i},n),{tagName:"ellipse",rx:i,ry:r})},x0=Object.freeze(Object.defineProperty({__proto__:null,async:p0,block:o0,circle:ql,circlePlus:m0,classic:a0,cross:d0,diamond:c0,ellipse:y0,path:u0},Symbol.toStringTag,{value:"Module"}));var Oe;(function(s){s.presets=x0,s.registry=xt.create({type:"marker"}),s.registry.register(s.presets,!0)})(Oe||(Oe={}));(function(s){s.normalize=Ne})(Oe||(Oe={}));var v0=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};function wr(s){return typeof s=="string"||ae(s)}const w0={qualify:wr,set(s,{view:t,attrs:e}){return Cr("marker-start",s,t,e)}},C0={qualify:wr,set(s,{view:t,attrs:e}){return Cr("marker-end",s,t,e,{transform:"rotate(180)"})}},P0={qualify:wr,set(s,{view:t,attrs:e}){return Cr("marker-mid",s,t,e)}};function Cr(s,t,e,n,i={}){const r=typeof t=="string"?{name:t}:t,{name:o,args:a}=r,l=v0(r,["name","args"]);let c=l;if(o&&typeof o=="string"){const f=Oe.registry.get(o);if(f)c=f(Object.assign(Object.assign({},l),a));else return Oe.registry.onNotFound(o)}const h=Object.assign(Object.assign(Object.assign({},S0(n,s)),i),c);return{[s]:`url(#${e.graph.defineMarker(h)})`}}function S0(s,t){const e={},n=s.stroke;typeof n=="string"&&(e.stroke=n,e.fill=n);let i=s.strokeOpacity;if(i==null&&(i=s["stroke-opacity"]),i==null&&(i=s.opacity),i!=null&&(e["stroke-opacity"]=i,e["fill-opacity"]=i),t!=="marker-mid"){const r=parseFloat(s.strokeWidth||s["stroke-width"]);if(Number.isFinite(r)&&r>1){const o=Math.ceil(r/2);e.refX=t==="marker-start"?o:-o}}return e}const hi=(s,{view:t})=>t.cell.isEdge(),O0={qualify:hi,set(s,t){var e,n,i,r;const o=t.view,a=s.reverse||!1,l=s.stubs||0;let c;if(Number.isFinite(l)&&l!==0)if(a){let h,f;const u=o.getConnectionLength()||0;l<0?(h=(u+l)/2,f=-l):(h=l,f=u-l*2);const d=o.getConnection();c=(r=(i=(n=(e=d?.divideAtLength(h))===null||e===void 0?void 0:e[1])===null||n===void 0?void 0:n.divideAtLength(f))===null||i===void 0?void 0:i[0])===null||r===void 0?void 0:r.serialize()}else{let h;l<0?h=((o.getConnectionLength()||0)+l)/2:h=l;const f=o.getConnection();if(f){const u=f.divideAtLength(h),d=f.divideAtLength(-h);u&&d&&(c=`${u[0].serialize()} ${d[1].serialize()}`)}}return{d:c||o.getConnectionPathData()}}},Ul={qualify:hi,set:as("getTangentAtLength",{rotate:!0})},E0={qualify:hi,set:as("getTangentAtLength",{rotate:!1})},Wl={qualify:hi,set:as("getTangentAtRatio",{rotate:!0})},A0={qualify:hi,set:as("getTangentAtRatio",{rotate:!1})},M0=Ul,T0=Wl;function as(s,t){const e={x:1,y:0};return(n,i)=>{let r,o;const a=i.view,l=a[s](Number(n));return l?(o=t.rotate?l.vector().vectorAngle(e):0,r=l.start):(r=a.path.start,o=0),o===0?{transform:`translate(${r.x},${r.y}')`}:{transform:`translate(${r.x},${r.y}') rotate(${o})`}}}const N0=Object.freeze(Object.defineProperty({__proto__:null,annotations:Yy,atConnectionLength:M0,atConnectionLengthIgnoreGradient:E0,atConnectionLengthKeepGradient:Ul,atConnectionRatio:T0,atConnectionRatioIgnoreGradient:A0,atConnectionRatioKeepGradient:Wl,connection:O0,displayEmpty:Ky,eol:Jy,fill:Gy,filter:s0,html:i0,lineHeight:Uy,port:r0,ref:Ey,refCx:Ly,refCy:Iy,refD:ky,refDKeepOffset:jy,refDResetOffset:Dl,refDx:Ay,refDy:My,refHeight:Il,refHeight2:Fy,refPoints:$y,refPointsKeepOffset:Dy,refPointsResetOffset:Bl,refR:By,refRCircumscribed:Ry,refRInscribed:jl,refRx:Ty,refRy:Ny,refWidth:Ll,refWidth2:_y,refX:Nl,refX2:zy,refY:Rl,refY2:Vy,resetOffset:e0,sourceMarker:w0,stroke:Hy,style:n0,targetMarker:C0,text:Vl,textPath:Xy,textVerticalAnchor:Wy,textWrap:qy,title:Zy,vertexMarker:P0,xAlign:Qy,yAlign:t0},Symbol.toStringTag,{value:"Module"}));var oe;(function(s){function t(e,n,i){return!!(e!=null&&(typeof e=="string"||typeof e.qualify!="function"||k(e.qualify,this,n,i)))}s.isValidDefinition=t})(oe||(oe={}));(function(s){s.presets=Object.assign(Object.assign({},Oy),N0),s.registry=xt.create({type:"attribute definition"}),s.registry.register(s.presets,!0)})(oe||(oe={}));const Vt={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix(s){return`${Vt.prefixCls}-${s}`}},Oo=Vt.prefix("highlighted"),R0={highlight(s,t,e){const n=e&&e.className||Oo;B(t,n)},unhighlight(s,t,e){const n=e&&e.className||Oo;pt(t,n)}},Eo=Vt.prefix("highlight-opacity"),L0={highlight(s,t){B(t,Eo)},unhighlight(s,t){pt(t,Eo)}};var Q;(function(s){s.normalizeMarker=Ne;function t(u,d){const g=$b(u.x,u.y).matrixTransform(d);return new w(g.x,g.y)}s.transformPoint=t;function e(u,d){return new j(t(u.start,d),t(u.end,d))}s.transformLine=e;function n(u,d){let g=u instanceof bt?u.points:u;return Array.isArray(g)||(g=[]),new bt(g.map(p=>t(p,d)))}s.transformPolyline=n;function i(u,d){const p=ee("svg").createSVGPoint();p.x=u.x,p.y=u.y;const m=p.matrixTransform(d);p.x=u.x+u.width,p.y=u.y;const y=p.matrixTransform(d);p.x=u.x+u.width,p.y=u.y+u.height;const x=p.matrixTransform(d);p.x=u.x,p.y=u.y+u.height;const b=p.matrixTransform(d),v=Math.min(m.x,y.x,x.x,b.x),C=Math.max(m.x,y.x,x.x,b.x),S=Math.min(m.y,y.y,x.y,b.y),P=Math.max(m.y,y.y,x.y,b.y);return new L(v,S,C-v,P-S)}s.transformRectangle=i;function r(u,d,g){let p;const m=u.ownerSVGElement;if(!m)return new L(0,0,0,0);try{p=u.getBBox()}catch{p={x:u.clientLeft,y:u.clientTop,width:u.clientWidth,height:u.clientHeight}}if(d)return L.create(p);const y=Vn(u,g||m);return i(p,y)}s.bbox=r;function o(u,d={}){let g;if(!u.ownerSVGElement||!Pe(u)){if(bo(u)){const{left:x,top:b,width:v,height:C}=a(u);return new L(x,b,v,C)}return new L(0,0,0,0)}let m=d.target;if(!d.recursive){try{g=u.getBBox()}catch{g={x:u.clientLeft,y:u.clientTop,width:u.clientWidth,height:u.clientHeight}}if(!m)return L.create(g);const x=Vn(u,m);return i(g,x)}{const x=u.childNodes,b=x.length;if(b===0)return o(u,{target:m});m||(m=u);for(let v=0;v<b;v+=1){const C=x[v];let S;C.childNodes.length===0?S=o(C,{target:m}):S=o(C,{target:m,recursive:!0}),g?g=g.union(S):g=S}return g}}s.getBBox=o;function a(u){let d=0,g=0,p=0,m=0;if(u){let y=u;for(;y;)d+=y.offsetLeft,g+=y.offsetTop,y=y.offsetParent,y&&(d+=parseInt(vo(y,"borderLeft"),10),g+=parseInt(vo(y,"borderTop"),10));p=u.offsetWidth,m=u.offsetHeight}return{left:d,top:g,width:p,height:m}}s.getBoundingOffsetRect=a;function l(u){const d=g=>{const p=u.getAttribute(g),m=p?parseFloat(p):0;return Number.isNaN(m)?0:m};switch(u instanceof SVGElement&&u.nodeName.toLowerCase()){case"rect":return new L(d("x"),d("y"),d("width"),d("height"));case"circle":return new Kt(d("cx"),d("cy"),d("r"),d("r"));case"ellipse":return new Kt(d("cx"),d("cy"),d("rx"),d("ry"));case"polyline":{const g=Ii(u);return new bt(g)}case"polygon":{const g=Ii(u);return g.length>1&&g.push(g[0]),new bt(g)}case"path":{let g=u.getAttribute("d");return $.isValid(g)||(g=$.normalize(g)),$.parse(g)}case"line":return new j(d("x1"),d("y1"),d("x2"),d("y2"))}return o(u)}s.toGeometryShape=l;function c(u,d,g,p){const m=w.create(d),y=w.create(g);p||(p=u instanceof SVGSVGElement?u:u.ownerSVGElement);const x=Vs(u);u.setAttribute("transform","");const b=o(u,{target:p}).scale(x.sx,x.sy),v=In();v.setTranslate(-b.x-b.width/2,-b.y-b.height/2);const C=In(),S=m.angleBetween(y,m.clone().translate(1,0));S&&C.setRotate(S,0,0);const P=In(),O=m.clone().move(y,b.width/2);P.setTranslate(2*m.x-O.x,2*m.y-O.y);const E=Vn(u,p),R=In();R.setMatrix(P.matrix.multiply(C.matrix.multiply(v.matrix.multiply(E.scale(x.sx,x.sy))))),u.setAttribute("transform",Tn(R.matrix))}s.translateAndAutoOrient=c;function h(u){if(u==null)return null;let d=u;do{let g=d.tagName;if(typeof g!="string")return null;if(g=g.toUpperCase(),Mn(d,"x6-port"))d=d.nextElementSibling;else if(g==="G")d=d.firstElementChild;else if(g==="TITLE")d=d.nextElementSibling;else break}while(d);return d}s.findShapeNode=h;function f(u){const d=h(u);if(!Pe(d)){if(bo(u)){const{left:m,top:y,width:x,height:b}=a(u);return new L(m,y,x,b)}return new L(0,0,0,0)}return l(d).bbox()||L.create()}s.getBBoxV2=f})(Q||(Q={}));const I0={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},j0={highlight(s,t,e){const n=xe.getHighlighterId(t,e);if(xe.hasCache(n))return;e=_a({},e,I0);const i=z.create(t);let r,o;try{r=i.toPathData()}catch{o=Q.bbox(i.node,!0),r=vl(Object.assign(Object.assign({},e),o))}const a=ee("path");if(X(a,Object.assign({d:r,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},e.attrs?Yn(e.attrs):null)),s.isEdgeElement(t))X(a,"d",s.getConnectionPathData());else{let h=i.getTransformToElement(s.container);const f=e.padding;if(f){o==null&&(o=Q.bbox(i.node,!0));const u=o.x+o.width/2,d=o.y+o.height/2;o=Q.transformRectangle(o,h);const g=Math.max(o.width,1),p=Math.max(o.height,1),m=(g+f)/g,y=(p+f)/p,x=Tt({a:m,b:0,c:0,d:y,e:u-m*u,f:d-y*d});h=h.multiply(x)}rn(a,h)}B(a,Vt.prefix("highlight-stroke"));const l=s.cell,c=()=>xe.removeHighlighter(n);l.on("removed",c),l.model&&l.model.on("reseted",c),s.container.appendChild(a),xe.setCache(n,a)},unhighlight(s,t,e){xe.removeHighlighter(xe.getHighlighterId(t,e))}};var xe;(function(s){function t(o,a){return gr(o),o.id+JSON.stringify(a)}s.getHighlighterId=t;const e={};function n(o,a){e[o]=a}s.setCache=n;function i(o){return e[o]!=null}s.hasCache=i;function r(o){const a=e[o];a&&(ie(a),delete e[o])}s.removeHighlighter=r})(xe||(xe={}));const D0=Object.freeze(Object.defineProperty({__proto__:null,className:R0,opacity:L0,stroke:j0},Symbol.toStringTag,{value:"Module"}));var fe;(function(s){function t(e,n){if(typeof n.highlight!="function")throw new Error(`Highlighter '${e}' is missing required \`highlight()\` method`);if(typeof n.unhighlight!="function")throw new Error(`Highlighter '${e}' is missing required \`unhighlight()\` method`)}s.check=t})(fe||(fe={}));(function(s){s.presets=D0,s.registry=xt.create({type:"highlighter"}),s.registry.register(s.presets,!0)})(fe||(fe={}));function Gs(s,t={}){return new w(zt(t.x,s.width),zt(t.y,s.height))}function Pr(s,t,e){return Object.assign({angle:t,position:s.toJSON()},e)}const B0=(s,t)=>s.map(({x:e,y:n,angle:i})=>Pr(Gs(t,{x:e,y:n}),i||0)),k0=(s,t,e)=>{const n=e.start||0,i=e.step||20;return Xl(s,t,n,(r,o)=>(r+.5-o/2)*i)},$0=(s,t,e)=>{const n=e.start||0,i=e.step||360/s.length;return Xl(s,t,n,r=>r*i)};function Xl(s,t,e,n){const i=t.getCenter(),r=t.getTopCenter(),o=t.width/t.height,a=Kt.fromRect(t),l=s.length;return s.map((c,h)=>{const f=e+n(h,l),u=r.clone().rotate(-f,i).scale(o,1,i),d=c.compensateRotate?-a.tangentTheta(u):0;return(c.dx||c.dy)&&u.translate(c.dx||0,c.dy||0),c.dr&&u.move(i,c.dr),Pr(u.round(),d,c)})}var z0=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 V0=(s,t,e)=>{const n=Gs(t,e.start||t.getOrigin()),i=Gs(t,e.end||t.getCorner());return ui(s,n,i,e)},_0=(s,t,e)=>ui(s,t.getTopLeft(),t.getBottomLeft(),e),F0=(s,t,e)=>ui(s,t.getTopRight(),t.getBottomRight(),e),G0=(s,t,e)=>ui(s,t.getTopLeft(),t.getTopRight(),e),H0=(s,t,e)=>ui(s,t.getBottomLeft(),t.getBottomRight(),e);function ui(s,t,e,n){const i=new j(t,e),r=s.length;return s.map((o,a)=>{var{strict:l}=o,c=z0(o,["strict"]);const h=l||n.strict?(a+1)/(r+1):(a+.5)/r,f=i.pointAt(h);return(c.dx||c.dy)&&f.translate(c.dx||0,c.dy||0),Pr(f.round(),0,c)})}const q0=Object.freeze(Object.defineProperty({__proto__:null,absolute:B0,bottom:H0,ellipse:k0,ellipseSpread:$0,left:_0,line:V0,right:F0,top:G0},Symbol.toStringTag,{value:"Module"}));var Be;(function(s){s.presets=q0,s.registry=xt.create({type:"port layout"}),s.registry.register(s.presets,!0)})(Be||(Be={}));const U0={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function Re(s,t){const{x:e,y:n,angle:i,attrs:r}=t||{};return _a({},{angle:i,attrs:r,position:{x:e,y:n}},s,U0)}const W0=(s,t,e)=>Re({position:t.getTopLeft()},e),X0=(s,t,e)=>Re({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},e),Y0=(s,t,e)=>Re({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},e),J0=(s,t,e)=>Re({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},e),K0=(s,t,e)=>Re({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},e),Z0=(s,t,e)=>Yl(s,t,!1,e),Q0=(s,t,e)=>Yl(s,t,!0,e),tx=(s,t,e)=>Jl(s,t,!1,e),ex=(s,t,e)=>Jl(s,t,!0,e);function Yl(s,t,e,n){const i=n.offset!=null?n.offset:15,r=t.getCenter().theta(s),o=Kl(t);let a,l,c,h,f=0;return r<o[1]||r>o[2]?(a=".3em",l=i,c=0,h="start"):r<o[0]?(a="0",l=0,c=-i,e?(f=-90,h="start"):h="middle"):r<o[3]?(a=".3em",l=-i,c=0,h="end"):(a=".6em",l=0,c=i,e?(f=90,h="start"):h="middle"),Re({position:{x:Math.round(l),y:Math.round(c)},angle:f,attrs:{".":{y:a,"text-anchor":h}}},n)}function Jl(s,t,e,n){const i=n.offset!=null?n.offset:15,r=t.getCenter().theta(s),o=Kl(t);let a,l,c,h,f=0;return r<o[1]||r>o[2]?(a=".3em",l=-i,c=0,h="end"):r<o[0]?(a=".6em",l=0,c=i,e?(f=90,h="start"):h="middle"):r<o[3]?(a=".3em",l=i,c=0,h="start"):(a="0em",l=0,c=-i,e?(f=-90,h="start"):h="middle"),Re({position:{x:Math.round(l),y:Math.round(c)},angle:f,attrs:{".":{y:a,"text-anchor":h}}},n)}function Kl(s){const t=s.getCenter(),e=t.theta(s.getTopLeft()),n=t.theta(s.getBottomLeft()),i=t.theta(s.getBottomRight()),r=t.theta(s.getTopRight());return[e,r,i,n]}const nx=(s,t,e)=>Zl(s.diff(t.getCenter()),!1,e),ix=(s,t,e)=>Zl(s.diff(t.getCenter()),!0,e);function Zl(s,t,e){const n=e.offset!=null?e.offset:20,i=new w(0,0),r=-s.theta(i),o=s.clone().move(i,n).diff(s).round();let a=".3em",l,c=r;return(r+90)%180===0?(l=t?"end":"middle",!t&&r===-270&&(a="0em")):r>-270&&r<-90?(l="start",c=r-180):l="end",Re({position:o.round().toJSON(),angle:t?c:0,attrs:{".":{y:a,"text-anchor":l}}},e)}const sx=Object.freeze(Object.defineProperty({__proto__:null,bottom:K0,inside:tx,insideOriented:ex,left:X0,manual:W0,outside:Z0,outsideOriented:Q0,radial:nx,radialOriented:ix,right:Y0,top:J0},Symbol.toStringTag,{value:"Module"}));var hn;(function(s){s.presets=sx,s.registry=xt.create({type:"port label layout"}),s.registry.register(s.presets,!0)})(hn||(hn={}));var rx=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class q extends rt{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=Hs.uniqueId(),q.views[this.cid]=this}confirmUpdate(t,e){return 0}empty(t=this.container){return ci(t),this}unmount(t=this.container){return ie(t),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),delete q.views[this.cid],this.disposeContainer&&this.unmount(t)):this.unmount(t),this}onRemove(){}setClass(t,e=this.container){e.classList.value=Array.isArray(t)?t.join(" "):t}addClass(t,e=this.container){return B(e,Array.isArray(t)?t.join(" "):t),this}removeClass(t,e=this.container){return pt(e,Array.isArray(t)?t.join(" "):t),this}setStyle(t,e=this.container){return J(e,t),this}setAttrs(t,e=this.container){return t!=null&&e!=null&&X(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 q.find(t,e,n).elems}findOne(t,e=this.container,n=this.selectors){const i=this.find(t,e,n);return i.length>0?i[0]:null}findByAttr(t,e=this.container){let n=e;for(;n&&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=mr(t)+1;n=`${t.tagName.toLowerCase()}:nth-child(${i})`,e&&(n+=` > ${e}`),n=this.getSelector(t.parentNode,n)}return n}prefixClassName(t){return Vt.prefix(t)}delegateEvents(t,e){if(t==null)return this;e||this.undelegateEvents();const n=/^(\S+)\s*(.*)$/;return Object.keys(t).forEach(i=>{const r=i.match(n);if(r==null)return;const o=this.getEventHandler(t[i]);typeof o=="function"&&this.delegateEvent(r[1],r[2],o)}),this}undelegateEvents(){return st.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 st.on(this.container,t+this.getEventNamespace(),e,n),this}undelegateEvent(t,e,n){const i=t+this.getEventNamespace();return e==null?st.off(this.container,i):typeof e=="string"?st.off(this.container,i,e,n):st.off(this.container,i,e),this}addEventListeners(t,e,n){if(e==null)return this;const i=this.getEventNamespace();return Object.keys(e).forEach(r=>{const o=this.getEventHandler(e[r]);typeof o=="function"&&st.on(t,r+i,n,o)}),this}removeEventListeners(t){return t!=null&&st.off(t,this.getEventNamespace()),this}getEventNamespace(){return`.${Vt.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:r=0,clientY:o=0}=t;return e.fromPoint||i==="touchmove"||i==="touchend"?document.elementFromPoint(r,o):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 q.normalizeEvent(t)}dispose(){this.remove()}}rx([q.dispose()],q.prototype,"dispose",null);(function(s){function t(i,r){return r?ee(i||"g"):pr(i||"div")}s.createElement=t;function e(i,r,o){if(!i||i===".")return{elems:[r]};if(o){const a=o[i];if(a)return{elems:Array.isArray(a)?a:[a]}}{const a=i.includes(">")?`:scope ${i}`:i;return{isCSSSelector:!0,elems:Array.prototype.slice.call(r.querySelectorAll(a))}}}s.find=e;function n(i){let r=i;const o=i.originalEvent,a=o&&o.changedTouches&&o.changedTouches[0];if(a){for(const l in i)a[l]===void 0&&(a[l]=i[l]);r=a}return r}s.normalizeEvent=n})(q||(q={}));(function(s){s.views={};function t(e){return s.views[e]||null}s.getView=t})(q||(q={}));var Hs;(function(s){let t=0;function e(){const n=`v${t}`;return t+=1,n}s.uniqueId=e})(Hs||(Hs={}));class ox{constructor(t){this.view=t,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Fs,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=Gb(t,n)}return Tt(e.matrix)}getShape(t){const e=this.get(t);return e.shape==null&&(e.shape=Q.toGeometryShape(t)),e.shape.clone()}getBoundingRect(t){const e=this.get(t);return e.boundingRect==null&&(e.boundingRect=Q.getBBoxV2(t)),e.boundingRect.clone()}}var ct;(function(s){function t(c){return c!=null&&!e(c)}s.isJSONMarkup=t;function e(c){return c!=null&&typeof c=="string"}s.isStringMarkup=e;function n(c){return c==null||e(c)?c:lt(c)}s.clone=n;function i(c){return`${c}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")}s.sanitize=i;function r(c,h={ns:At.svg}){const f=document.createDocumentFragment(),u={},d={},g=[{markup:Array.isArray(c)?c:[c],parent:f,ns:h.ns}];for(;g.length>0;){const p=g.pop();let m=p.ns||At.svg;const y=p.markup,x=p.parent;y.forEach(b=>{const v=b.tagName;if(!v)throw new TypeError("Invalid tagName");b.ns&&(m=b.ns);const C=m?pr(v,m):mo(v),S=b.attrs;S&&X(C,Yn(S));const P=b.style;P&&J(C,P);const O=b.className;O!=null&&C.setAttribute("class",Array.isArray(O)?O.join(" "):O),b.textContent&&(C.textContent=b.textContent);const E=b.selector;if(E!=null){if(d[E])throw new TypeError("Selector must be unique");d[E]=C}if(b.groupSelector){let T=b.groupSelector;Array.isArray(T)||(T=[T]),T.forEach(I=>{u[I]||(u[I]=[]),u[I].push(C)})}x.appendChild(C);const R=b.children;Array.isArray(R)&&g.push({ns:m,markup:R,parent:C})})}return Object.keys(u).forEach(p=>{if(d[p])throw new Error("Ambiguous group selector");d[p]=u[p]}),{fragment:f,selectors:d,groups:u}}s.parseJSONMarkup=r;function o(c){return c instanceof SVGElement?ee("g"):mo("div")}function a(c){if(e(c)){const d=z.createVectors(c),g=d.length;if(g===1)return{elem:d[0].node};if(g>1){const p=o(d[0].node);return d.forEach(m=>{p.appendChild(m.node)}),{elem:p}}return{}}const h=r(c),f=h.fragment;let u=null;return f.childNodes.length>1?(u=o(f.firstChild),u.appendChild(f)):u=f.firstChild,{elem:u,selectors:h.selectors}}s.renderMarkup=a;function l(c){const h=z.createVectors(c),f=document.createDocumentFragment();for(let u=0,d=h.length;u<d;u+=1){const g=h[u].node;f.appendChild(g)}return{fragment:f,selectors:{}}}s.parseLabelStringMarkup=l})(ct||(ct={}));(function(s){function t(e,n,i){if(e!=null){let r;const o=e.tagName.toLowerCase();if(e===n)return typeof i=="string"?r=`> ${o} > ${i}`:r=`> ${o}`,r;const a=e.parentNode;if(a&&a.childNodes.length>1){const l=mr(e)+1;r=`${o}:nth-child(${l})`}else r=o;return i&&(r+=` > ${i}`),t(e.parentNode,n,r)}return i}s.getSelector=t})(ct||(ct={}));(function(s){function t(){return"g"}s.getPortContainerMarkup=t;function e(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}}s.getPortMarkup=e;function n(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}s.getPortLabelMarkup=n})(ct||(ct={}));(function(s){function t(){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"}}]}s.getEdgeMarkup=t})(ct||(ct={}));(function(s){function t(e=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:At.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:At.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:e?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}s.getForeignObjectMarkup=t})(ct||(ct={}));class Ql{constructor(t){this.view=t}get cell(){return this.view.cell}getDefinition(t){return this.cell.getAttrDefinition(t)}processAttrs(t,e){let n,i,r,o;const a=[];return Object.keys(e).forEach(l=>{const c=e[l],h=this.getDefinition(l),f=k(oe.isValidDefinition,this.view,h,c,{elem:t,attrs:e,cell:this.cell,view:this.view});if(h&&f)typeof h=="string"?(n==null&&(n={}),n[h]=c):c!==null&&a.push({name:l,definition:h});else{n==null&&(n={});const u=fl.includes(l)?l:Xa(l);n[u]=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"&&(r==null&&(r={}),r[l]=h),typeof c.position=="function"&&(o==null&&(o={}),o[l]=h)}),{raw:e,normal:n,set:i,offset:r,position:o}}mergeProcessedAttrs(t,e){t.set=Object.assign(Object.assign({},t.set),e.set),t.position=Object.assign(Object.assign({},t.position),e.position),t.offset=Object.assign(Object.assign({},t.offset),e.offset);const n=t.normal&&t.normal.transform;n!=null&&e.normal&&(e.normal.transform=n),t.normal=e.normal}findAttrs(t,e,n,i){const r=[],o=new Fs;return Object.keys(t).forEach(a=>{const l=t[a];if(!ae(l))return;const{isCSSSelector:c,elems:h}=q.find(a,e,i);n[a]=h;for(let f=0,u=h.length;f<u;f+=1){const d=h[f],g=i&&i[a]===d,p=o.get(d);if(p){p.array||(r.push(d),p.array=!0,p.attrs=[p.attrs],p.priority=[p.priority]);const m=p.attrs,y=p.priority;if(g)m.unshift(l),y.unshift(-1);else{const x=zm(y,c?-1:u);m.splice(x,0,l),y.splice(x,0,u)}}else o.set(d,{elem:d,attrs:l,priority:g?-1:u,array:!1})}}),r.forEach(a=>{const l=o.get(a),c=l.attrs;l.attrs=c.reduceRight((h,f)=>mt(h,f),{})}),o}updateRelativeAttrs(t,e,n){const i=e.raw||{};let r=e.normal||{};const o=e.set,a=e.position,l=e.offset,c=()=>({elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:n.clone()});if(o!=null&&Object.keys(o).forEach(m=>{const y=o[m],x=this.getDefinition(m);if(x!=null){const b=k(x.set,this.view,y,c());typeof b=="object"?r=Object.assign(Object.assign({},r),b):b!=null&&(r[m]=b)}}),t instanceof HTMLElement){this.view.setAttrs(r,t);return}const h=r.transform,f=h?`${h}`:null,u=Jn(f),d=new w(u.e,u.f);h&&(delete r.transform,u.e=0,u.f=0);let g=!1;a!=null&&Object.keys(a).forEach(m=>{const y=a[m],x=this.getDefinition(m);if(x!=null){const b=k(x.position,this.view,y,c());b!=null&&(g=!0,d.translate(w.create(b)))}}),this.view.setAttrs(r,t);let p=!1;if(l!=null){const m=this.view.getBoundingRectOfElement(t);if(m.width>0&&m.height>0){const y=Q.transformRectangle(m,u);Object.keys(l).forEach(x=>{const b=l[x],v=this.getDefinition(x);if(v!=null){const C=k(v.offset,this.view,b,{elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:y});C!=null&&(p=!0,d.translate(w.create(C)))}})}}(h!=null||g||p)&&(d.round(1),u.e=Number.isFinite(d.x)?d.x:0,u.f=Number.isFinite(d.y)?d.y:0,t.setAttribute("transform",Tn(u)))}update(t,e,n){const i={},r=this.findAttrs(n.attrs||e,t,i,n.selectors),o=n.attrs?this.findAttrs(e,t,i,n.selectors):r,a=[];r.each(h=>{const f=h.elem,u=h.attrs,d=this.processAttrs(f,u);if(d.set==null&&d.position==null&&d.offset==null)this.view.setAttrs(d.normal,f);else{const g=o.get(f),p=g?g.attrs:null,m=p&&u.ref==null?p.ref:u.ref;let y;if(m){if(y=(i[m]||this.view.find(m,t,n.selectors))[0],!y)throw new Error(`"${m}" reference does not exist.`)}else y=null;const x={node:f,refNode:y,attributes:p,processedAttributes:d},b=a.findIndex(v=>v.refNode===f);b>-1?a.splice(b,0,x):a.push(x)}});const l=new Fs;let c;a.forEach(h=>{const f=h.node,u=h.refNode;let d;const g=u!=null&&n.rotatableNode!=null&&br(n.rotatableNode,u);if(u&&(d=l.get(u)),!d){const y=g?n.rotatableNode:t;d=u?Q.getBBox(u,{target:y}):n.rootBBox,u&&l.set(u,d)}let p;n.attrs&&h.attributes?(p=this.processAttrs(f,h.attributes),this.mergeProcessedAttrs(p,h.processedAttributes)):p=h.processedAttributes;let m=d;g&&n.rotatableNode!=null&&!n.rotatableNode.contains(f)&&(c||(c=Jn(X(n.rotatableNode,"transform"))),m=Q.transformRectangle(d,c)),this.updateRelativeAttrs(f,p,m)})}}class tc{get cell(){return this.view.cell}constructor(t,e,n=[]){this.view=t;const i={},r={};let o=0;Object.keys(e).forEach(l=>{let c=e[l];Array.isArray(c)||(c=[c]),c.forEach(h=>{let f=i[h];f||(o+=1,f=i[h]=1<<o),r[l]|=f})});let a=n;if(Array.isArray(a)||(a=[a]),a.forEach(l=>{i[l]||(o+=1,i[l]=1<<o)}),o>25)throw new Error("Maximum number of flags exceeded.");this.flags=i,this.attrs=r,this.bootstrap=n}getFlag(t){const e=this.flags;return 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}}var ax=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},lx=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};class yt extends q{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){const e=(c,h)=>h!=null?qa([...Array.isArray(c)?c:[c],...Array.isArray(h)?h:[h]]):Array.isArray(c)?[...c]:[c],n=lt(this.getDefaults()),{bootstrap:i,actions:r,events:o,documentEvents:a}=t,l=lx(t,["bootstrap","actions","events","documentEvents"]);return i&&(n.bootstrap=e(n.bootstrap,i)),r&&Object.entries(r).forEach(([c,h])=>{const f=n.actions[c];h&&f?n.actions[c]=e(f,h):h&&(n.actions[c]=e(h))}),o&&(n.events=Object.assign(Object.assign({},n.events),o)),t.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),a)),mt(n,l)}get[Symbol.toStringTag](){return yt.toStringTag}constructor(t,e={}){super(),this.cell=t,this.options=this.ensureOptions(e),this.graph=this.options.graph,this.attr=new Ql(this),this.flag=new tc(this,this.options.actions,this.options.bootstrap),this.cache=new ox(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 q.createElement(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 r=[e];return i&&(typeof i=="string"?r.push(i):r.push(...i)),this.removeAction(t,r)}return t}setup(){this.cell.on("changed",this.onCellChanged,this)}onCellChanged({options:t}){this.onAttrsChange(t)}onAttrsChange(t){let e=this.flag.getChangedFlag();t.updated||!e||(t.dirty&&this.hasAction(e,"update")&&(e|=this.getFlag("render")),t.toolId&&(t.async=!1),this.graph!=null&&this.graph.renderer.requestViewUpdate(this,e,t))}parseJSONMarkup(t,e){const n=ct.parseJSONMarkup(t),i=n.selectors,r=this.rootSelector;if(e&&r){if(i[r])throw new Error("Invalid root selector");i[r]=e}return n}can(t){let e=this.graph.options.interacting;if(typeof e=="function"&&(e=k(e,this.graph,this)),typeof e=="object"){let n=e[t];return typeof n=="function"&&(n=k(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(),r=this.getRootTranslatedMatrix();return Q.transformRectangle(e,r.multiply(i).multiply(n))}getUnrotatedBBoxOfElement(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootTranslatedMatrix();return Q.transformRectangle(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 Tt().translate(e.x,e.y)}getRootRotatedMatrix(){let t=Tt();const e=this.cell,n=e.isNode()?e.getAngle():0;if(n){const i=e.getBBox(),r=i.width/2,o=i.height/2;t=t.translate(r,o).rotate(n).translate(-r,-o)}return t}findMagnet(t=this.container){return this.findByAttr("magnet",t)}updateAttrs(t,e,n={}){n.rootBBox==null&&(n.rootBBox=new L),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,r){const o=this.cell,a=this.findAttr("port",t),l=t.getAttribute("data-selector"),c={cell:o.id};return l!=null&&(c.magnet=l),a!=null?(c.port=a,o.isNode()&&!o.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 r=t.magnet,o;return i!=null&&e.isNode()&&e.hasPort(i)?o=this.findPortElem(i,r)||n:(r||(r=t.selector),!r&&i!=null&&(r=`[port="${i}"]`),o=this.findOne(r,n,this.selectors)),o}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=vt.isToolsView(t)?t:new vt(t);this.tools=e,e.config({view:this}),e.mount()}return this}updateTools(t={}){return this.tools&&this.tools.update(t),this}removeTools(){return this.tools&&(this.tools.remove(),this.tools=null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}notify(t,e){return this.trigger(t,e),this.graph.trigger(t,e),this}getEventArgs(t,e,n){const i=this,r=i.cell;return e==null||n==null?{e:t,view:i,cell:r}:{e:t,x:e,y:n,view:i,cell:r}}onClick(t,e,n){this.notify("cell:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){this.notify("cell:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){this.notify("cell:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch("mouse")),this.notify("cell:mousedown",this.getEventArgs(t,e,n))}onMouseUp(t,e,n){this.notify("cell:mouseup",this.getEventArgs(t,e,n)),this.cachedModelForMouseEvent&&(this.cachedModelForMouseEvent.stopBatch("mouse",{cell:this.cell}),this.cachedModelForMouseEvent=null)}onMouseMove(t,e,n){this.notify("cell:mousemove",this.getEventArgs(t,e,n))}onMouseOver(t){this.notify("cell:mouseover",this.getEventArgs(t))}onMouseOut(t){this.notify("cell:mouseout",this.getEventArgs(t))}onMouseEnter(t){this.notify("cell:mouseenter",this.getEventArgs(t))}onMouseLeave(t){this.notify("cell:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){this.notify("cell:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,i){this.notify("cell:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),this.notify(e,Object.assign({},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){}onMagnetDblClick(t,e,n,i){}onMagnetContextMenu(t,e,n,i){}onLabelMouseDown(t,e,n){}checkMouseleave(t){const e=this.getEventTarget(t,{fromPoint:!0}),n=this.graph.findViewByElem(e);n!==this&&(this.onMouseLeave(t),n&&n.onMouseEnter(t))}dispose(){this.cell.off("changed",this.onCellChanged,this)}}yt.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}};ax([yt.dispose()],yt.prototype,"dispose",null);(function(s){s.Flag=tc,s.Attr=Ql})(yt||(yt={}));(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&typeof i.isNodeView=="function"&&typeof i.isEdgeView=="function"&&typeof i.confirmUpdate=="function"}s.isCellView=t})(yt||(yt={}));(function(s){function t(n){return function(i){i.config({priority:n})}}s.priority=t;function e(n){return function(i){i.config({bootstrap:n})}}s.bootstrap=e})(yt||(yt={}));(function(s){s.registry=xt.create({type:"view"})})(yt||(yt={}));class vt extends q{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return vt.toStringTag}constructor(t={}){super(),this.svgContainer=this.createContainer(!0,t),this.htmlContainer=this.createContainer(!1,t),this.config(t)}createContainer(t,e){const n=t?q.createElement("g",!0):q.createElement("div",!1);return B(n,this.prefixClassName("cell-tools")),e.className&&B(n,e.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!yt.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(B(this.svgContainer,this.prefixClassName("edge-tools")),B(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(B(this.svgContainer,this.prefixClassName("node-tools")),B(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=>{vt.ToolItem.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 r=n[i];let o;if(vt.ToolItem.isToolItem(r))o=r;else{const a=typeof r=="object"?r.name:r,l=typeof r=="object"?r.args||{}:{};if(a){if(this.cell.isNode()){const c=fn.registry.get(a);if(c)o=new c(l);else return fn.registry.onNotFound(a)}else if(this.cell.isEdge()){const c=dn.registry.get(a);if(c)o=new c(l);else return dn.registry.onNotFound(a)}}}o&&(o.config(this.cellView,this),o.render(),(o.options.isSVGElement!==!1?this.svgContainer:this.htmlContainer).appendChild(o.container),this.tools.push(o))}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),ie(this.svgContainer),ie(this.htmlContainer),super.remove()}mount(){const t=this.tools,e=this.cellView;if(e&&t){const n=t.some(r=>r.options.isSVGElement!==!1),i=t.some(r=>r.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}}(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&i.graph!=null&&i.cell!=null&&typeof i.config=="function"&&typeof i.update=="function"&&typeof i.focus=="function"&&typeof i.blur=="function"&&typeof i.show=="function"&&typeof i.hide=="function"}s.isToolsView=t})(vt||(vt={}));(function(s){class t extends q{static getDefaults(){return this.defaults}static config(n){this.defaults=this.getOptions(n)}static getOptions(n){return mt(lt(this.getDefaults()),n)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return t.toStringTag}constructor(n={}){super(),this.visible=!0,this.options=this.getOptions(n),this.container=q.createElement(this.options.tagName||"g",this.options.isSVGElement!==!1),B(this.container,this.prefixClassName("cell-tool")),typeof this.options.className=="string"&&B(this.container,this.options.className),this.init()}init(){}getOptions(n){return this.constructor.getOptions(n)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(n,i){return this.cellView=n,this.parent=i,this.stamp(this.container),this.cell.isEdge()?B(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&B(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();const n=this.options.markup;if(n){const i=ct.parseJSONMarkup(n);this.container.appendChild(i.fragment),this.childNodes=i.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(n){n&&n.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 n=this.options.focusOpacity;return n!=null&&Number.isFinite(n)&&(this.container.style.opacity=`${n}`),this.parent.focus(this),this}blur(){return this.container.style.opacity="",this.parent.blur(this),this}guard(n){return this.graph==null||this.cellView==null?!0:this.graph.view.guard(n,this.cellView)}}t.defaults={isSVGElement:!0,tagName:"g"},s.ToolItem=t,function(e){let n=0;function i(o){return o?hr(o):(n+=1,`CustomTool${n}`)}function r(o){const a=lr(i(o.name),this);return a.config(o),a}e.define=r}(t=s.ToolItem||(s.ToolItem={})),function(e){e.toStringTag=`X6.${e.name}`;function n(i){if(i==null)return!1;if(i instanceof e)return!0;const r=i[Symbol.toStringTag],o=i;return(r==null||r===e.toStringTag)&&o.graph!=null&&o.cell!=null&&typeof o.config=="function"&&typeof o.update=="function"&&typeof o.focus=="function"&&typeof o.blur=="function"&&typeof o.show=="function"&&typeof o.hide=="function"&&typeof o.isVisible=="function"}e.isToolItem=n}(t=s.ToolItem||(s.ToolItem={}))})(vt||(vt={}));const cx=s=>s;function Ao(s,t){return t===0?"0%":`${Math.round(s/t*100)}%`}function ec(s){return(e,n,i,r)=>n.isEdgeElement(i)?ux(s,e,n,i,r):hx(s,e,n,i,r)}function hx(s,t,e,n,i){const r=e.cell,o=r.getAngle(),a=e.getUnrotatedBBoxOfElement(n),l=r.getBBox().getCenter(),c=w.create(i).rotate(o,l);let h=c.x-a.x,f=c.y-a.y;return s&&(h=Ao(h,a.width),f=Ao(f,a.height)),t.anchor={name:"topLeft",args:{dx:h,dy:f,rotate:!0}},t}function ux(s,t,e,n,i){const r=e.getConnection();if(!r)return t;const o=r.closestPointLength(i);if(s){const a=r.length();t.anchor={name:"ratio",args:{ratio:o/a}}}else t.anchor={name:"length",args:{length:o}};return t}const fx=ec(!0),dx=ec(!1),gx=Object.freeze(Object.defineProperty({__proto__:null,noop:cx,pinAbsolute:dx,pinRelative:fx},Symbol.toStringTag,{value:"Module"}));var qs;(function(s){s.presets=gx,s.registry=xt.create({type:"connection strategy"}),s.registry.register(s.presets,!0)})(qs||(qs={}));function nc(s,t,e,n){return k(qs.presets.pinRelative,this.graph,{},t,e,s,this.cell,n,{}).anchor}function ic(s,t){return t?s.cell.getBBox():s.cell.isEdge()?s.getConnection().bbox():s.getUnrotatedBBoxOfElement(s.container)}class Ee extends vt.ToolItem{onRender(){B(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();rn(this.container,e,{absolute:!0})}getNodeMatrix(){const t=this.cellView,e=this.options;let{x:n=0,y:i=0}=e;const{offset:r,useCellGeometry:o,rotate:a}=e;let l=ic(t,o);const c=t.cell.getAngle();a||(l=l.bbox(c));let h=0,f=0;typeof r=="number"?(h=r,f=r):typeof r=="object"&&(h=r.x,f=r.y),n=zt(n,l.width),i=zt(i,l.height);let u=Tt().translate(l.x+l.width/2,l.y+l.height/2);return a&&(u=u.rotate(c)),u=u.translate(n+h-l.width/2,i+f-l.height/2),u}getEdgeMatrix(){const t=this.cellView,e=this.options,{offset:n=0,distance:i=0,rotate:r}=e;let o,a,l;const c=zt(i,1);c>=0&&c<=1?o=t.getTangentAtRatio(c):o=t.getTangentAtLength(c),o?(a=o.start,l=o.vector().vectorAngle(new w(1,0))||0):(a=t.getConnection().start,l=0);let h=Tt().translate(a.x,a.y).rotate(l);return typeof n=="object"?h=h.translate(n.x||0,n.y||0):h=h.translate(0,n),r||(h=h.rotate(-l)),h}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.options.onClick;typeof e=="function"&&k(e,this.cellView,{e:t,view:this.cellView,cell:this.cellView.cell,btn:this})}}(function(s){s.config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}})})(Ee||(Ee={}));(function(s){s.Remove=s.define({name:"button-remove",markup:[{tagName:"circle",selector:"button",attrs:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:t,btn:e}){e.parent.remove(),t.cell.remove({ui:!0,toolId:e.cid})}})})(Ee||(Ee={}));var px=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};class Bi extends vt.ToolItem{onRender(){if(B(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const t=this.options.attrs,{class:e}=t,n=px(t,["class"]);X(this.container,Yn(n)),e&&B(this.container,e)}this.update()}update(){const t=this.cellView,e=this.options,{useCellGeometry:n,rotate:i}=e,r=Yt(e.padding);let o=ic(t,n).moveAndExpand({x:-r.left,y:-r.top,width:r.left+r.right,height:r.top+r.bottom});const a=t.cell;if(a.isNode()){const l=a.getAngle();if(l)if(i){const c=a.getBBox().getCenter();zs(this.container,l,c.x,c.y,{absolute:!0})}else o=o.bbox(l)}return X(this.container,o.toJSON()),this}}(function(s){s.config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}})})(Bi||(Bi={}));class ti extends vt.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){return this.vertices.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach(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],r=this.options.createHandle,o=this.options.processHandle,a=r({index:e,graph:this.graph,guard:l=>this.guard(l),attrs:this.options.attrs||{}});o&&o(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],r=this.handles[e];r&&r.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,r=t<n.length-1?n[t+1]:e.targetAnchor;return{prev:w.create(i),next:w.create(r)}}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:r}=this.getMouseEventArgs(t);this.eventData(n,{start:{x:i,y:r}}),e.notifyMouseDown(n,i,r)}}onHandleChanging({handle:t,e}){const n=this.cellView,i=t.options.index,{e:r,x:o,y:a}=this.getMouseEventArgs(e),l={x:o,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(r,o,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:r,x:o,y:a}=this.getMouseEventArgs(t);if(!this.options.stopPropagation){n.notifyMouseUp(r,o,a);const{start:l}=this.eventData(r);if(l){const{x:c,y:h}=l;c===o&&h===a&&n.onClick(r,o,a)}}n.checkMouseleave(r),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}snapVertex(t,e){const n=this.options.snapRadius||0;if(n>0){const i=this.getNeighborPoints(e),r=i.prev,o=i.next;Math.abs(t.x-r.x)<n?t.x=r.x:Math.abs(t.x-o.x)<n&&(t.x=o.x),Math.abs(t.y-r.y)<n?t.y=i.prev.y:Math.abs(t.y-o.y)<n&&(t.y=o.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?ge.isMatch(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 r=e.getVertexIndex(i.x,i.y);this.snapVertex(i,r),e.cell.insertVertex(i,r,{ui:!0,toolId:this.cid}),this.render();const o=this.handles[r];this.eventData(n,{vertexAdded:!0}),o.onMouseDown(n)}onRemove(){this.resetHandles()}}(function(s){class t extends q{get graph(){return this.options.graph}constructor(n){super(),this.options=n,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDoubleClick"})}render(){this.container=q.createElement("circle",!0);const n=this.options.attrs;if(typeof n=="function"){const i=s.getDefaults();this.setAttrs(Object.assign(Object.assign({},i.attrs),n(this)))}else this.setAttrs(n);this.addClass(this.prefixClassName("edge-tool-vertex"))}updatePosition(n,i){this.setAttrs({cx:n,cy:i})}onMouseDown(n){this.options.guard(n)||(n.stopPropagation(),n.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},n.data),this.emit("change",{e:n,handle:this}))}onMouseMove(n){this.emit("changing",{e:n,handle:this})}onMouseUp(n){this.emit("changed",{e:n,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(n){this.emit("remove",{e:n,handle:this})}}s.Handle=t})(ti||(ti={}));(function(s){const t=Vt.prefix("edge-tool-vertex-path");s.config({name:"vertices",snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:"#333",stroke:"#fff",cursor:"move","stroke-width":2},createHandle:e=>new s.Handle(e),markup:[{tagName:"path",selector:"connection",className:t,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${t}`]:"onPathMouseDown",[`touchstart .${t}`]:"onPathMouseDown"}})})(ti||(ti={}));class ei extends vt.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){B(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();const t=this.cellView,e=[...this.vertices];e.unshift(t.sourcePoint),e.push(t.targetPoint);for(let n=0,i=e.length;n<i-1;n+=1){const r=e[n],o=e[n+1],a=this.renderHandle(r,o,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:r=>this.guard(r),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,r=t.options.index,l=this.cellView.cell.getVertices(),c=l[r-2]||n.sourceAnchor,h=l[r+1]||n.targetAnchor,f=this.options.snapRadius;return Math.abs(e[i]-c[i])<f?e[i]=c[i]:Math.abs(e[i]-h[i])<f&&(e[i]=h[i]),e}onHandleChanging({handle:t,e}){const n=this.graph,i=this.options,r=this.cellView,o=i.anchor,a=t.options.axis,l=t.options.index-1,c=this.getEventData(e),h=this.normalizeEvent(e),f=n.snapToGrid(h.clientX,h.clientY),u=this.snapHandle(t,f.clone(),c),d=lt(this.vertices);let g=d[l],p=d[l+1];const m=r.sourceView,y=r.sourceBBox;let x=!1,b=!1;if(g?l===0?y.containsPoint(g)?(d.shift(),this.shiftHandleIndexes(-1),x=!0):(g[a]=u[a],b=!0):g[a]=u[a]:(g=r.sourceAnchor.toJSON(),g[a]=u[a],y.containsPoint(g)?x=!0:(d.unshift(g),this.shiftHandleIndexes(1),b=!0)),typeof o=="function"&&m){if(x){const O=c.sourceAnchor.clone();O[a]=u[a];const E=k(o,r,O,m,r.sourceMagnet||m.container,"source",r,this);this.resetAnchor("source",E)}b&&this.resetAnchor("source",c.sourceAnchorDef)}const v=r.targetView,C=r.targetBBox;let S=!1,P=!1;if(p?l===d.length-2?C.containsPoint(p)?(d.pop(),S=!0):(p[a]=u[a],P=!0):p[a]=u[a]:(p=r.targetAnchor.toJSON(),p[a]=u[a],C.containsPoint(p)?S=!0:(d.push(p),P=!0)),typeof o=="function"&&v){if(S){const O=c.targetAnchor.clone();O[a]=u[a];const E=k(o,r,O,v,r.targetMagnet||v.container,"target",r,this);this.resetAnchor("target",E)}P&&this.resetAnchor("target",c.targetAnchorDef)}w.equalPoints(d,this.vertices)||this.cellView.cell.setVertices(d,{ui:!0,toolId:this.cid}),this.updateHandle(t,g,p,0),i.stopPropagation||r.notifyMouseMove(h,f.x,f.y)}onHandleChange({handle:t,e}){const n=this.options,i=this.handles,r=this.cellView,o=t.options.index;if(Array.isArray(i)){for(let a=0,l=i.length;a<l;a+=1)a!==o&&i[a].hide();if(this.focus(),this.setEventData(e,{sourceAnchor:r.sourceAnchor.clone(),targetAnchor:r.targetAnchor.clone(),sourceAnchorDef:lt(this.cell.prop(["source","anchor"])),targetAnchorDef:lt(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);r.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),r=this.graph.snapToGrid(i.clientX,i.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),e.stopPropagation||n.notifyMouseUp(i,r.x,r.y),n.checkMouseleave(i),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}updateHandle(t,e,n,i=0){const r=this.options.precision||0,o=Math.abs(e.x-n.x)<r,a=Math.abs(e.y-n.y)<r;if(o||a){const l=new j(e,n);if(l.length()<this.options.threshold)t.hide();else{const h=l.getCenter(),f=o?"x":"y";h[f]+=i||0;const u=l.vector().vectorAngle(new w(1,0));t.updatePosition(h.x,h.y,u,this.cellView),t.show(),t.options.axis=f}}else t.hide()}onRemove(){this.resetHandles()}}(function(s){class t extends q{constructor(n){super(),this.options=n,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=q.createElement("rect",!0);const n=this.options.attrs;if(typeof n=="function"){const i=s.getDefaults();this.setAttrs(Object.assign(Object.assign({},i.attrs),n(this)))}else this.setAttrs(n);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(n,i,r,o){const a=o.getClosestPoint(new w(n,i))||new w(n,i);let l=Tt().translate(a.x,a.y);if(a.equals({x:n,y:i}))l=l.rotate(r);else{let h=new j(n,i,a.x,a.y).vector().vectorAngle(new w(1,0));h!==0&&(h+=90),l=l.rotate(h)}this.setAttrs({transform:Tn(l),cursor:r%180===0?"row-resize":"col-resize"})}onMouseDown(n){this.options.guard(n)||(this.trigger("change",{e:n,handle:this}),n.stopPropagation(),n.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},n.data))}onMouseMove(n){this.emit("changing",{e:n,handle:this})}onMouseUp(n){this.emit("changed",{e:n,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}}s.Handle=t})(ei||(ei={}));(function(s){s.config({name:"segments",precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#333",stroke:"#fff","stroke-width":2},createHandle:t=>new s.Handle(t),anchor:nc})})(ei||(ei={}));class ki extends vt.ToolItem{get type(){return this.options.type}onRender(){B(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,r=this.options,o=i.getTerminalAnchor(n),a=i.cell.prop([n,"anchor"]);e.setAttribute("transform",`translate(${o.x}, ${o.y})`);const l=a?r.customAnchorAttrs:r.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,r=i.getTerminalView(n);if(r){const o=r.cell,a=i.getTerminalMagnet(n);let l=this.options.areaPadding||0;Number.isFinite(l)||(l=0);let c,h,f;r.isEdgeElement(a)?(c=r.getBBox(),h=0,f=c.getCenter()):(c=r.getUnrotatedBBoxOfElement(a),h=o.getAngle(),f=c.getCenter(),h&&f.rotate(-h,o.getBBox().getCenter())),c.inflate(l),X(e,{x:-c.width/2,y:-c.height/2,width:c.width,height:c.height,transform:`translate(${f.x}, ${f.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 r=this.normalizeEvent(t),o=i.cell,a=n.getTerminalMagnet(e);let l=this.graph.coord.clientToLocalPoint(r.clientX,r.clientY);const c=this.options.snap;if(typeof c=="function"){const u=k(c,n,l,i,a,e,n,this);l=w.create(u)}if(this.options.restrictArea)if(i.isEdgeElement(a)){const u=i.getClosestPoint(l);u&&(l=u)}else{const u=i.getUnrotatedBBoxOfElement(a),d=o.getAngle(),g=o.getBBox().getCenter(),p=l.clone().rotate(d,g);u.containsPoint(p)||(l=u.getNearestPointToPoint(p).rotate(-d,g))}let h;const f=this.options.anchor;typeof f=="function"&&(h=k(f,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()}}(function(s){s.config({tagName:"g",markup:[{tagName:"circle",selector:"anchor",attrs:{cursor:"pointer"}},{tagName:"rect",selector:"area",attrs:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDblClick"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},customAnchorAttrs:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:nc,snap(t,e,n,i,r,o){const a=o.options.snapRadius||0,l=i==="source",c=l?0:-1,h=this.cell.getVertexAt(c)||this.getTerminalAnchor(l?"target":"source");return h&&(Math.abs(h.x-t.x)<a&&(t.x=h.x),Math.abs(h.y-t.y)<a&&(t.y=h.y)),t}})})(ki||(ki={}));const mx=ki.define({name:"source-anchor",type:"source"}),bx=ki.define({name:"target-anchor",type:"target"});var yx=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};class $i extends vt.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){const t=this.options.attrs,{class:e}=t,n=yx(t,["class"]);this.setAttrs(n,this.container),e&&B(this.container,e)}}onRender(){B(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){const t=this.ratio,e=this.cellView,n=e.getTangentAtRatio(t),i=n?n.start:e.getPointAtRatio(t),r=n&&n.vector().vectorAngle(new w(1,0))||0;if(!i)return this;const o=Tt().translate(i.x,i.y).rotate(r);return rn(this.container,o,{absolute:!0}),this}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.cellView;if(e.can("arrowheadMovable")){e.cell.startBatch("move-arrowhead",{ui:!0,toolId:this.cid});const n=this.graph.snapToGrid(t.clientX,t.clientY),i=e.prepareArrowheadDragging(this.type,{x:n.x,y:n.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(t,i),this.delegateDocumentEvents(this.options.documentEvents,t.data),e.graph.view.undelegateEvents(),this.container.style.pointerEvents="none"}this.focus()}onMouseMove(t){const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY);this.cellView.onMouseMove(e,n.x,n.y),this.update()}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.cellView,i=this.graph.snapToGrid(e.clientX,e.clientY);n.onMouseUp(e,i.x,i.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents="",n.cell.stopBatch("move-arrowhead",{ui:!0,toolId:this.cid})}}(function(s){s.config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}})})($i||($i={}));const xx=$i.define({name:"source-arrowhead",type:"source",ratio:0,attrs:{d:"M 10 -8 -10 0 10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}}),vx=$i.define({name:"target-arrowhead",type:"target",ratio:1,attrs:{d:"M -10 -8 10 0 -10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});class un extends vt.ToolItem{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){const t=this.cellView;t&&t.on("cell:dblclick",this.dblClick)}createElement(){const t=[this.prefixClassName(`${this.cell.isEdge()?"edge":"node"}-tool-editor`),this.prefixClassName("cell-tool-editor")];this.editor=vt.createElement("div",!1),this.addClass(t,this.editor),this.editor.contentEditable="true",this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&(this.container.removeChild(this.editor),this.editor=null)}updateEditor(){const{cell:t,editor:e}=this;if(!e)return;const{style:n}=e;t.isNode()?this.updateNodeEditorTransform():t.isEdge()&&this.updateEdgeEditorTransform();const{attrs:i}=this.options;n.fontSize=`${i.fontSize}px`,n.fontFamily=i.fontFamily,n.color=i.color,n.backgroundColor=i.backgroundColor;const r=this.getCellText()||"";return e.innerText=r,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:t,cell:e,editor:n}=this;if(!n)return;let i=w.create(),r=20,o="",{x:a,y:l}=this.options;const{width:c,height:h}=this.options;if(typeof a<"u"&&typeof l<"u"){const d=e.getBBox();a=zt(a,d.width),l=zt(l,d.height),i=d.topLeft.translate(a,l),r=d.width-a*2}else{const d=e.getBBox();i=d.center,r=d.width-4,o="translate(-50%, -50%)"}const f=t.scale(),{style:u}=n;i=t.localToGraph(i),u.left=`${i.x}px`,u.top=`${i.y}px`,u.transform=`scale(${f.sx}, ${f.sy}) ${o}`,u.minWidth=`${r}px`,typeof c=="number"&&(u.width=`${c}px`),typeof h=="number"&&(u.height=`${h}px`)}updateEdgeEditorTransform(){if(!this.event)return;const{graph:t,editor:e}=this;if(!e)return;let n=w.create(),i=20;const{style:r}=e,o=this.event.target,a=o.parentElement;if(a&&Mn(a,this.prefixClassName("edge-label"))){const h=a.getAttribute("data-index")||"0";this.labelIndex=parseInt(h,10);const f=a.getAttribute("transform"),{translation:u}=ss(f);n=new w(u.tx,u.ty),i=Q.getBBox(o).width}else{if(!this.options.labelAddable)return this;n=t.clientToLocal(w.create(this.event.clientX,this.event.clientY));const f=this.cellView.path.closestPointLength(n);this.distance=f,this.labelIndex=-1}n=t.localToGraph(n);const c=t.scale();r.left=`${n.x}px`,r.top=`${n.y}px`,r.minWidth=`${i}px`,r.transform=`scale(${c.sx}, ${c.sy}) translate(-50%, -50%)`}onDocumentMouseUp(t){if(this.editor&&t.target!==this.editor){const e=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(e!==""?e:null),this.removeElement()}}onCellDblClick({e:t}){this.editor||(t.stopPropagation(),this.removeElement(),this.event=t,this.createElement(),this.updateEditor(),this.autoFocus(),this.delegateDocumentEvents(this.options.documentEvents))}onMouseDown(t){t.stopPropagation()}autoFocus(){setTimeout(()=>{this.editor&&(this.editor.focus(),this.selectText())})}selectText(){if(window.getSelection&&this.editor){const t=document.createRange(),e=window.getSelection();t.selectNodeContents(this.editor),e.removeAllRanges(),e.addRange(t)}}getCellText(){const{getText:t}=this.options;if(typeof t=="function")return k(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"){k(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:{}};An(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()}}(function(s){s.config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}})})(un||(un={}));(function(s){s.NodeEditor=s.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),s.EdgeEditor=s.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"})})(un||(un={}));var sc=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},fn;(function(s){s.presets={boundary:Bi,button:Ee,"button-remove":Ee.Remove,"node-editor":un.NodeEditor},s.registry=xt.create({type:"node tool",process(t,e){if(typeof e=="function")return e;let n=vt.ToolItem;const{inherit:i}=e,r=sc(e,["inherit"]);if(i){const o=this.get(i);o==null?this.onNotFound(i,"inherited"):n=o}return r.name==null&&(r.name=t),n.define.call(n,r)}}),s.registry.register(s.presets,!0)})(fn||(fn={}));var dn;(function(s){s.presets={boundary:Bi,vertices:ti,segments:ei,button:Ee,"button-remove":Ee.Remove,"source-anchor":mx,"target-anchor":bx,"source-arrowhead":xx,"target-arrowhead":vx,"edge-editor":un.EdgeEditor},s.registry=xt.create({type:"edge tool",process(t,e){if(typeof e=="function")return e;let n=vt.ToolItem;const{inherit:i}=e,r=sc(e,["inherit"]);if(i){const o=this.get(i);o==null?this.onNotFound(i,"inherited"):n=o}return r.name==null&&(r.name=t),n.define.call(n,r)}}),s.registry.register(s.presets,!0)})(dn||(dn={}));const wx=ye("center"),Cx=ye("topCenter"),Px=ye("bottomCenter"),Sx=ye("leftMiddle"),Ox=ye("rightMiddle"),Ex=ye("topLeft"),Ax=ye("topRight"),Mx=ye("bottomLeft"),Tx=ye("bottomRight");function ye(s){return function(t,e,n,i={}){let r;t.cell.visible?r=i.rotate?t.getUnrotatedBBoxOfElement(e):t.getBBoxOfElement(e):r=t.cell.getBBox();const o=r[s];o.x+=zt(i.dx,r.width),o.y+=zt(i.dy,r.height);const a=t.cell;return i.rotate?o.rotate(-a.getAngle(),a.getBBox().getCenter()):o}}function ls(s){return function(t,e,n,i){if(n instanceof Element){const r=this.graph.findViewByElem(n);let o;if(r)if(r.isEdgeElement(n)){const a=i.fixedAt!=null?i.fixedAt:"50%";o=rc(r,a)}else o=r.getBBoxOfElement(n).getCenter();else o=new w;return s.call(this,t,e,o,i)}return s.apply(this,arguments)}}function rc(s,t){const e=de(t),n=typeof t=="string"?parseFloat(t):t;return e?s.getPointAtRatio(n/100):s.getPointAtLength(n)}const Nx=function(s,t,e,n){const i=W.normalize(s.cell.getAngle()),r=s.cell.visible?s.getBBoxOfElement(t):s.cell.getBBox(),o=r.getCenter(),a=r.getTopLeft(),l=r.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-o.y;o.x+=i===0||i===180?0:h*1/Math.tan(W.toRad(i)),o.y+=h}else if(a.x+c<=e.x&&e.x<=l.x-c){const h=e.x-o.x;o.y+=i===90||i===270?0:h*Math.tan(W.toRad(i)),o.x+=h}return o},Rx=ls(Nx),Lx=function(s,t,e,n,i){const r=s.cell.getConnectionPoint(this.cell,i);return(n.dx||n.dy)&&r.translate(n.dx||0,n.dy||0),r},Ix=function(s,t,e,n){let i,r=0,o;const a=s.cell;n.rotate?(i=s.getUnrotatedBBoxOfElement(t),o=a.getBBox().getCenter(),r=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(r,o);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 f=n.direction;return f==="H"?(c==="top"||c==="bottom")&&(e.x<=i.x+i.width?h=i.getLeftMiddle():h=i.getRightMiddle()):f==="V"&&(e.y<=i.y+i.height?h=i.getTopCenter():h=i.getBottomCenter()),n.rotate?h.rotate(-r,o):h},jx=ls(Ix),Dx=Object.freeze(Object.defineProperty({__proto__:null,bottom:Px,bottomLeft:Mx,bottomRight:Tx,center:wx,left:Sx,midSide:jx,nodeCenter:Lx,orth:Rx,right:Ox,top:Cx,topLeft:Ex,topRight:Ax},Symbol.toStringTag,{value:"Module"}));var gn;(function(s){s.presets=Dx,s.registry=xt.create({type:"node endpoint"}),s.registry.register(s.presets,!0)})(gn||(gn={}));const Bx=function(s,t,e,n){let i=n.ratio!=null?n.ratio:.5;return i>1&&(i/=100),s.getPointAtRatio(i)},kx=function(s,t,e,n){const i=n.length!=null?n.length:20;return s.getPointAtLength(i)},oc=function(s,t,e,n){const i=s.getClosestPoint(e);return i??new w},$x=ls(oc),zx=function(s,t,e,n){const r=s.getConnection(),o=s.getConnectionSubdivisions(),a=new j(e.clone().translate(0,1e6),e.clone().translate(0,-1e6)),l=new j(e.clone().translate(1e6,0),e.clone().translate(-1e6,0)),c=a.intersect(r,{segmentSubdivisions:o}),h=l.intersect(r,{segmentSubdivisions:o}),f=[];return c&&f.push(...c),h&&f.push(...h),f.length>0?e.closest(f):n.fallbackAt!=null?rc(s,n.fallbackAt):k(oc,this,s,t,e,n)},Vx=ls(zx),_x=Object.freeze(Object.defineProperty({__proto__:null,closest:$x,length:kx,orth:Vx,ratio:Bx},Symbol.toStringTag,{value:"Module"}));var pn;(function(s){s.presets=_x,s.registry=xt.create({type:"edge endpoint"}),s.registry.register(s.presets,!0)})(pn||(pn={}));function cs(s,t,e){let n;if(typeof e=="object"){if(Number.isFinite(e.y)){const r=new j(t,s),{start:o,end:a}=r.parallel(e.y);t=o,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 zi(s){const t=s.getAttribute("stroke-width");return t===null?0:parseFloat(t)||0}function Fx(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 ac=function(s,t,e,n){const i=t.getBBoxOfElement(e);n.stroked&&i.inflate(zi(e)/2);const r=s.intersect(i),o=r&&r.length?s.start.closest(r):s.end;return cs(o,s.start,n.offset)},Gx=function(s,t,e,n,i){const r=t.cell,o=r.isNode()?r.getAngle():0;if(o===0)return k(ac,this,s,t,e,n,i);const a=t.getUnrotatedBBoxOfElement(e);n.stroked&&a.inflate(zi(e)/2);const l=a.getCenter(),c=s.clone().rotate(o,l),h=c.setLength(1e6).intersect(a),f=h&&h.length?c.start.closest(h).rotate(-o,l):s.end;return cs(f,s.start,n.offset)},Hx=function(s,t,e,n){let i,r;const o=s.end,a=n.selector;if(typeof a=="string"?i=t.findOne(a):Array.isArray(a)?i=cr(e,a):i=Fx(e),!Pe(i)){if(i===e||!Pe(e))return o;i=e}const l=t.getShapeOfElement(i),c=t.getMatrixOfElement(i),h=t.getRootTranslatedMatrix(),f=t.getRootRotatedMatrix(),u=h.multiply(f).multiply(c),d=u.inverse(),g=Q.transformLine(s,d),p=g.start.clone(),m=t.getDataOfElement(i);if(n.insideout===!1){m.shapeBBox==null&&(m.shapeBBox=l.bbox());const v=m.shapeBBox;if(v!=null&&v.containsPoint(p))return o}n.extrapolate===!0&&g.setLength(1e6);let y;if($.isPath(l)){const v=n.precision||2;m.segmentSubdivisions==null&&(m.segmentSubdivisions=l.getSegmentSubdivisions({precision:v})),y={precision:v,segmentSubdivisions:m.segmentSubdivisions},r=g.intersect(l,y)}else r=g.intersect(l);r?Array.isArray(r)&&(r=p.closest(r)):n.sticky===!0&&(L.isRectangle(l)?r=l.getNearestPointToPoint(p):Kt.isEllipse(l)?r=l.intersectsWithLineFromCenterToPoint(p):r=l.closestPoint(p,y));const x=r?Q.transformPoint(r,u):o;let b=n.offset||0;return n.stroked!==!1&&(typeof b=="object"?(b=Object.assign({},b),b.x==null&&(b.x=0),b.x+=zi(i)/2):b+=zi(i)/2),cs(x,s.start,b)};function qx(s,t,e=0){const{start:n,end:i}=s;let r,o,a,l;switch(t){case"left":l="x",r=i,o=n,a=-1;break;case"right":l="x",r=n,o=i,a=1;break;case"top":l="y",r=i,o=n,a=-1;break;case"bottom":l="y",r=n,o=i,a=1;break;default:return}n[l]<i[l]?r[l]=o[l]:o[l]=r[l],Number.isFinite(e)&&(r[l]+=a*e,o[l]+=a*e)}const Ux=function(s,t,e,n){const{alignOffset:i,align:r}=n;return r&&qx(s,r,i),cs(s.end,s.start,n.offset)},Wx=Object.freeze(Object.defineProperty({__proto__:null,anchor:Ux,bbox:ac,boundary:Hx,rect:Gx},Symbol.toStringTag,{value:"Module"}));var mn;(function(s){s.presets=Wx,s.registry=xt.create({type:"connection point"}),s.registry.register(s.presets,!0)})(mn||(mn={}));const Xx=function(s){return[...s]},Yx=function(s,t,e){const n=t.side||"bottom",i=Yt(t.padding||40),r=e.sourceBBox,o=e.targetBBox,a=r.getCenter(),l=o.getCenter();let c,h,f;switch(n){case"top":f=-1,c="y",h="height";break;case"left":f=-1,c="x",h="width";break;case"right":f=1,c="x",h="width";break;case"bottom":default:f=1,c="y",h="height";break}return a[c]+=f*(r[h]/2+i[n]),l[c]+=f*(o[h]/2+i[n]),f*(a[c]-l[c])>0?l[c]=a[c]:a[c]=l[c],[a.toJSON(),...s,l.toJSON()]};function xi(s){return new L(s.x,s.y,0,0)}function Vi(s={}){const t=Yt(s.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function lc(s,t={}){return s.sourceBBox.clone().moveAndExpand(Vi(t))}function cc(s,t={}){return s.targetBBox.clone().moveAndExpand(Vi(t))}function Jx(s,t={}){return s.sourceAnchor?s.sourceAnchor:lc(s,t).getCenter()}function Kx(s,t={}){return s.targetAnchor?s.targetAnchor:cc(s,t).getCenter()}const hc=function(s,t,e){let n=lc(e,t),i=cc(e,t);const r=Jx(e,t),o=Kx(e,t);n=n.union(xi(r)),i=i.union(xi(o));const a=s.map(h=>w.create(h));a.unshift(r),a.push(o);let l=null;const c=[];for(let h=0,f=a.length-1;h<f;h+=1){let u=null;const d=a[h],g=a[h+1],p=_t.getBearing(d,g)!=null;if(h===0)h+1===f?n.intersectsWithRect(i.clone().inflate(1))?u=_t.insideNode(d,g,n,i):p||(u=_t.nodeToNode(d,g,n,i)):n.containsPoint(g)?u=_t.insideNode(d,g,n,xi(g).moveAndExpand(Vi(t))):p||(u=_t.nodeToVertex(d,g,n));else if(h+1===f){const m=p&&_t.getBearing(g,d)===l;i.containsPoint(d)||m?u=_t.insideNode(d,g,xi(d).moveAndExpand(Vi(t)),i,l):p||(u=_t.vertexToNode(d,g,i,l))}else p||(u=_t.vertexToVertex(d,g,l));u?(c.push(...u.points),l=u.direction):l=_t.getBearing(d,g),h+1<f&&c.push(g)}return c};var _t;(function(s){const t={N:"S",S:"N",E:"W",W:"E"},e={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function n(f,u,d){let g=new w(f.x,u.y);return d.containsPoint(g)&&(g=new w(u.x,f.y)),g}function i(f,u){return f[u==="W"||u==="E"?"width":"height"]}s.getBBoxSize=i;function r(f,u){return f.x===u.x?f.y>u.y?"N":"S":f.y===u.y?f.x>u.x?"W":"E":null}s.getBearing=r;function o(f,u,d){const g=new w(f.x,u.y),p=new w(u.x,f.y),m=r(f,g),y=r(f,p),x=d?t[d]:null,b=m===d||m!==x&&(y===x||y!==d)?g:p;return{points:[b],direction:r(b,u)}}s.vertexToVertex=o;function a(f,u,d){const g=n(f,u,d);return{points:[g],direction:r(g,u)}}s.nodeToVertex=a;function l(f,u,d,g){const p=[new w(f.x,u.y),new w(u.x,f.y)],m=p.filter(b=>!d.containsPoint(b)),y=m.filter(b=>r(b,f)!==g);let x;if(y.length>0)return x=y.filter(b=>r(f,b)===g).pop(),x=x||y[0],{points:[x],direction:r(x,u)};{x=cm(p,m)[0];const b=w.create(u).move(x,-i(d,g)/2);return{points:[n(b,f,d),b],direction:r(b,u)}}}s.vertexToNode=l;function c(f,u,d,g){let p=a(u,f,g);const m=p.points[0];if(d.containsPoint(m)){p=a(f,u,d);const y=p.points[0];if(g.containsPoint(y)){const x=w.create(f).move(y,-i(d,r(f,y))/2),b=w.create(u).move(m,-i(g,r(u,m))/2),v=new j(x,b).getCenter(),C=a(f,v,d),S=o(v,u,C.direction);p.points=[C.points[0],S.points[0]],p.direction=S.direction}}return p}s.nodeToNode=c;function h(f,u,d,g,p){const m=d.union(g).inflate(1),y=m.getCenter(),x=y.distance(u)>y.distance(f),b=x?u:f,v=x?f:u;let C,S,P;p?(C=w.fromPolar(m.width+m.height,e[p],b),C=m.getNearestPointToPoint(C).move(C,-1)):C=m.getNearestPointToPoint(b).move(b,1),S=n(C,v,m);let O;C.round().equals(S.round())?(S=w.fromPolar(m.width+m.height,W.toRad(C.theta(b))+Math.PI/2,v),S=m.getNearestPointToPoint(S).move(v,1).round(),P=n(C,S,m),O=x?[S,P,C]:[C,P,S]):O=x?[S,C]:[C,S];const E=r(x?C:S,u);return{points:O,direction:E}}s.insideNode=h})(_t||(_t={}));const Zx={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 ve(this.step,this)},directions(){const s=ve(this.step,this),t=ve(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=ve(this.step,this);return{0:0,45:s/2,90:s/2}},paddingBox(){const s=ve(this.step,this);return{x:-s,y:-s,width:2*s,height:2*s}},fallbackRouter:hc,draggingRouter:null,snapToGrid:!0};function ve(s,t){return typeof s=="function"?s.call(t):s}function Qx(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]=ve(s[n],s),e},{});if(t.padding){const e=Yt(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 w(0,0),i=new w(e.offsetX,e.offsetY);e.angle=W.normalize(n.theta(i))}),t}const Mo=1,To=2;class tv{constructor(){this.items=[],this.hash={},this.values={}}add(t,e){this.hash[t]?this.items.splice(this.items.indexOf(t),1):this.hash[t]=Mo,this.values[t]=e;const n=Vm(this.items,t,i=>this.values[i]);this.items.splice(n,0,t)}pop(){const t=this.items.shift();return t&&(this.hash[t]=To),t}isOpen(t){return this.hash[t]===Mo}isClose(t){return this.hash[t]===To}isEmpty(){return this.items.length===0}}class ev{constructor(t){this.options=t,this.mapGridSize=100,this.map={}}build(t,e){const n=this.options,i=n.excludeTerminals.reduce((c,h)=>{const f=e[h];if(f){const u=t.getCell(f.cell);u&&c.push(u)}return c},[]);let r=[];const o=t.getCell(e.getSourceCellId());o&&(r=ho(r,o.getAncestors().map(c=>c.id)));const a=t.getCell(e.getTargetCellId());a&&(r=ho(r,a.getAncestors().map(c=>c.id)));const l=this.mapGridSize;return t.getNodes().reduce((c,h)=>{const f=i.some(m=>m.id===h.id),u=h.shape?n.excludeShapes.includes(h.shape):!1,d=n.excludeNodes.some(m=>typeof m=="string"?h.id===m:m===h),g=r.includes(h.id),p=u||f||d||g;if(h.isVisible()&&!p){const m=h.getBBox().moveAndExpand(n.paddingBox),y=m.getOrigin().snapToGrid(l),x=m.getCorner().snapToGrid(l);for(let b=y.x;b<=x.x;b+=l)for(let v=y.y;v<=x.y;v+=l){const C=new w(b,v).toString();c[C]==null&&(c[C]=[]),c[C].push(m)}}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}}function uc(s,t){const e=s.sourceBBox.clone();return t&&t.paddingBox?e.moveAndExpand(t.paddingBox):e}function fc(s,t){const e=s.targetBBox.clone();return t&&t.paddingBox?e.moveAndExpand(t.paddingBox):e}function dc(s,t){return s.sourceAnchor?s.sourceAnchor:uc(s,t).getCenter()}function nv(s,t){return s.targetAnchor?s.targetAnchor:fc(s,t).getCenter()}function ws(s,t,e,n,i){const r=360/e,o=s.theta(iv(s,t,n,i)),a=W.normalize(o+r/2);return r*Math.floor(a/r)}function iv(s,t,e,n){const i=n.step,r=t.x-s.x,o=t.y-s.y,a=r/e.x,l=o/e.y,c=a*i,h=l*i;return new w(s.x+c,s.y+h)}function No(s,t){const e=Math.abs(s-t);return e>180?360-e:e}function sv(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 rv(s,t,e){return{source:t.clone(),x:Ro(e.x-t.x,s),y:Ro(e.y-t.y,s)}}function Ro(s,t){if(!s)return t;const e=Math.abs(s),n=Math.round(e/t);if(!n)return e;const i=n*t,o=(e-i)/n;return t+o}function ov(s,t){const e=t.source,n=Z.snapToGrid(s.x-e.x,t.x)+e.x,i=Z.snapToGrid(s.y-e.y,t.y)+e.y;return new w(n,i)}function jn(s,t){return s.round(t)}function Pi(s,t,e){return jn(ov(s.clone(),t),e)}function Gn(s){return s.toString()}function Cs(s){return new w(s.x===0?0:Math.abs(s.x)/s.x,s.y===0?0:Math.abs(s.y)/s.y)}function Lo(s,t){let e=1/0;for(let n=0,i=t.length;n<i;n+=1){const r=s.manhattanDistance(t[n]);r<e&&(e=r)}return e}function Io(s,t,e,n,i){const r=i.precision,o=i.directionMap,a=s.diff(t.getCenter()),l=Object.keys(o).reduce((c,h)=>{if(e.includes(h)){const f=o[h],u=new w(s.x+f.x*(Math.abs(a.x)+t.width),s.y+f.y*(Math.abs(a.y)+t.height)),g=new j(s,u).intersect(t)||[];let p,m=null;for(let y=0;y<g.length;y+=1){const x=g[y],b=s.squaredDistance(x);(p==null||b>p)&&(p=b,m=x)}if(m){let y=Pi(m,n,r);t.containsPoint(y)&&(y=Pi(y.translate(f.x*n.x,f.y*n.y),n,r)),c.push(y)}}return c},[]);return t.containsPoint(s)||l.push(Pi(s,n,r)),l}function av(s,t,e,n,i){const r=[];let o=Cs(i.diff(e)),a=Gn(e),l=s[a],c;for(;l;){c=t[a];const u=Cs(c.diff(l));u.equals(o)||(r.unshift(c),o=u),a=Gn(l),l=s[a]}const h=t[a];return Cs(h.diff(n)).equals(o)||r.unshift(h),r}function lv(s,t,e,n,i){const r=i.precision;let o,a;L.isRectangle(t)?o=jn(dc(s,i).clone(),r):o=jn(t.clone(),r),L.isRectangle(e)?a=jn(nv(s,i).clone(),r):a=jn(e.clone(),r);const l=rv(i.step,o,a),c=o,h=a;let f,u;if(L.isRectangle(t)?f=Io(c,t,i.startDirections,l,i):f=[c],L.isRectangle(e)?u=Io(a,e,i.endDirections,l,i):u=[h],f=f.filter(d=>n.isAccessible(d)),u=u.filter(d=>n.isAccessible(d)),f.length>0&&u.length>0){const d=new tv,g={},p={},m={};for(let R=0,T=f.length;R<T;R+=1){const I=f[R],_=Gn(I);d.add(_,Lo(I,u)),g[_]=I,m[_]=0}const y=i.previousDirectionAngle,x=y===void 0;let b,v;const C=sv(l,i),S=C.length,P=u.reduce((R,T)=>{const I=Gn(T);return R.push(I),R},[]),O=w.equalPoints(f,u);let E=i.maxLoopCount;for(;!d.isEmpty()&&E>0;){const R=d.pop(),T=g[R],I=p[R],_=m[R],F=T.equals(c),A=I==null;let N;if(A?x?F?N=null:N=ws(c,T,S,l,i):N=y:N=ws(I,T,S,l,i),!(A&&O)&&P.indexOf(R)>=0)return i.previousDirectionAngle=N,av(p,g,T,c,h);for(let it=0;it<S;it+=1){b=C[it];const tt=b.angle;if(v=No(N,tt),!(x&&F)&&v>i.maxDirectionChange)continue;const ht=Pi(T.clone().translate(b.gridOffsetX||0,b.gridOffsetY||0),l,r),D=Gn(ht);if(d.isClose(D)||!n.isAccessible(ht))continue;if(P.indexOf(D)>=0&&!ht.equals(h)){const Ct=ws(ht,h,S,l,i);if(No(tt,Ct)>i.maxDirectionChange)continue}const Y=b.cost,et=F?0:i.penalties[v],H=_+Y+et;(!d.isOpen(D)||H<m[D])&&(g[D]=ht,p[D]=T,m[D]=H,d.add(D,H+Lo(ht,u)))}E-=1}}return i.fallbackRoute?k(i.fallbackRoute,this,c,h,i):null}function cv(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],r=s[e+1];if(i.x===r.x){const o=t*Math.round(i.x/t);i.x!==o&&(i.x=o,r.x=o)}else if(i.y===r.y){const o=t*Math.round(i.y/t);i.y!==o&&(i.y=o,r.y=o)}}return s}const hv=function(s,t,e){const n=Qx(t),i=uc(e,n),r=fc(e,n),o=dc(e,n),a=new ev(n).build(e.graph.model,e.cell),l=s.map(d=>w.create(d)),c=[];let h=o,f,u;for(let d=0,g=l.length;d<=g;d+=1){let p=null;if(f=u||i,u=l[d],u==null){u=r;const y=e.cell;if((y.getSourceCellId()==null||y.getTargetCellId()==null)&&typeof n.draggingRouter=="function"){const b=f===i?o:f,v=u.getOrigin();p=k(n.draggingRouter,e,b,v,n)}}if(p==null&&(p=lv(e,f,u,a,n)),p===null)return console.warn("Unable to execute manhattan algorithm, use orth instead"),k(n.fallbackRouter,this,s,n,e);const m=p[0];m&&m.equals(h)&&p.shift(),h=p[p.length-1]||h,c.push(...p)}return n.snapToGrid?cv(c,e.graph.grid.getGridSize()):c},gc=function(s,t,e){return k(hv,this,s,Object.assign(Object.assign({},Zx),t),e)},uv={maxDirectionChange:45,directions(){const s=ve(this.step,this),t=ve(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 r={x:t.x,y:s.y},o={x:s.x,y:t.y};if(n%180>90){const b=r;r=o,o=b}const a=n%90<45?r:o,l=new j(s,a),c=90*Math.ceil(n/90),h=w.fromPolar(l.squaredLength(),W.toRad(c+135),a),f=new j(t,h),u=l.intersectsWithLine(f),d=u||t,g=u?d:s,p=360/e.directions.length,m=g.theta(t),y=W.normalize(m+p/2),x=p*Math.floor(y/p);return e.previousDirectionAngle=x,d&&i.push(d.round()),i.push(t),i}},fv=function(s,t,e){return k(gc,this,s,Object.assign(Object.assign({},uv),t),e)},dv=function(s,t,e){const n=t.offset||32,i=t.min==null?16:t.min;let r=0,o=t.direction;const a=e.sourceBBox,l=e.targetBBox,c=a.getCenter(),h=l.getCenter();if(typeof n=="number"&&(r=n),o==null){let y=l.left-a.right,x=l.top-a.bottom;y>=0&&x>=0?o=y>=x?"L":"T":y<=0&&x>=0?(y=a.left-l.right,y>=0?o=y>=x?"R":"T":o="T"):y>=0&&x<=0?(x=a.top-l.bottom,x>=0?o=y>=x?"L":"B":o="L"):(y=a.left-l.right,x=a.top-l.bottom,y>=0&&x>=0?o=y>=x?"R":"B":y<=0&&x>=0?o="B":y>=0&&x<=0?o="R":o=Math.abs(y)>Math.abs(x)?"R":"B")}o==="H"?o=h.x-c.x>=0?"L":"R":o==="V"&&(o=h.y-c.y>=0?"T":"B"),n==="center"&&(o==="L"?r=(l.left-a.right)/2:o==="R"?r=(a.left-l.right)/2:o==="T"?r=(l.top-a.bottom)/2:o==="B"&&(r=(a.top-l.bottom)/2));let f,u,d;const g=o==="L"||o==="R";if(g){if(h.y===c.y)return[...s];d=o==="L"?1:-1,f="x",u="width"}else{if(h.x===c.x)return[...s];d=o==="T"?1:-1,f="y",u="height"}const p=c.clone(),m=h.clone();if(p[f]+=d*(a[u]/2+r),m[f]-=d*(l[u]/2+r),g){const y=p.x,x=m.x,b=a.width/2+i,v=l.width/2+i;h.x>c.x?x<=y&&(p.x=Math.max(x,c.x+b),m.x=Math.min(y,h.x-v)):x>=y&&(p.x=Math.min(x,c.x-b),m.x=Math.max(y,h.x+v))}else{const y=p.y,x=m.y,b=a.height/2+i,v=l.height/2+i;h.y>c.y?x<=y&&(p.y=Math.max(x,c.y+b),m.y=Math.min(y,h.y-v)):x>=y&&(p.y=Math.min(x,c.y-b),m.y=Math.max(y,h.y+v))}return[p.toJSON(),...s,m.toJSON()]};function Xe(s,t){if(t!=null&&t!==!1){const e=typeof t=="boolean"?0:t;if(e>0){const n=w.create(s[1]).move(s[2],e),i=w.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 gv=function(s,t,e){const n=t.width||50,r=(t.height||80)/2,o=t.angle||"auto",a=e.sourceAnchor,l=e.targetAnchor,c=e.sourceBBox,h=e.targetBBox;if(a.equals(l)){const f=y=>{const x=W.toRad(y),b=Math.sin(x),v=Math.cos(x),C=new w(a.x+v*n,a.y+b*n),S=new w(C.x-v*r,C.y-b*r),P=S.clone().rotate(-90,C),O=S.clone().rotate(90,C);return[P.toJSON(),C.toJSON(),O.toJSON()]},u=y=>{const x=a.clone().move(y,-1),b=new j(x,y);return!c.containsPoint(y)&&!c.intersectsWithLine(b)},d=[0,90,180,270,45,135,225,315];if(typeof o=="number")return Xe(f(o),t.merge);const g=c.getCenter();if(g.equals(a))return Xe(f(0),t.merge);const p=g.angleBetween(a,g.clone().translate(1,0));let m=f(p);if(u(m[1]))return Xe(m,t.merge);for(let y=1,x=d.length;y<x;y+=1)if(m=f(p+d[y]),u(m[1]))return Xe(m,t.merge);return Xe(m,t.merge)}{const f=new j(a,l);let u=f.parallel(-n),d=u.getCenter(),g=u.start.clone().move(u.end,r),p=u.end.clone().move(u.start,r);const m=f.parallel(-1),y=new j(m.start,d),x=new j(m.end,d);if((c.containsPoint(d)||h.containsPoint(d)||c.intersectsWithLine(y)||c.intersectsWithLine(x)||h.intersectsWithLine(y)||h.intersectsWithLine(x))&&(u=f.parallel(n),d=u.getCenter(),g=u.start.clone().move(u.end,r),p=u.end.clone().move(u.start,r)),t.merge){const b=new j(a,l),v=new j(d,b.center).setLength(Number.MAX_SAFE_INTEGER),C=c.intersectsWithLine(v),S=h.intersectsWithLine(v),P=C?Array.isArray(C)?C:[C]:[];S&&(Array.isArray(S)?P.push(...S):P.push(S));const O=b.center.closest(P);O?(e.sourceAnchor=O.clone(),e.targetAnchor=O.clone()):(e.sourceAnchor=b.center.clone(),e.targetAnchor=b.center.clone())}return Xe([g.toJSON(),d.toJSON(),p.toJSON()],t.merge)}},pv=Object.freeze(Object.defineProperty({__proto__:null,er:dv,loop:gv,manhattan:gc,metro:fv,normal:Xx,oneSide:Yx,orth:hc},Symbol.toStringTag,{value:"Module"}));var Ce;(function(s){s.presets=pv,s.registry=xt.create({type:"router"}),s.registry.register(s.presets,!0)})(Ce||(Ce={}));const mv=function(s,t,e,n={}){const i=[s,...e,t],r=new bt(i),o=new $(r);return n.raw?o:o.serialize()},bv=function(s,t,e,n={}){const i=e.length===3?0:1,r=w.create(e[0+i]),o=w.create(e[2+i]),a=w.create(e[1+i]);if(!w.equals(s,t)){const c=new w((s.x+t.x)/2,(s.y+t.y)/2),h=c.angleBetween(w.create(s).rotate(90,c),a);h>1&&(r.rotate(180-h,c),o.rotate(180-h,c),a.rotate(180-h,c))}const l=`
83
+ M ${s.x} ${s.y}
84
+ Q ${r.x} ${r.y} ${a.x} ${a.y}
85
+ Q ${o.x} ${o.y} ${t.x} ${t.y}
86
+ `;return n.raw?$.parse(l):l},yv=function(s,t,e,n={}){const i=new $;i.appendSegment($.createSegment("M",s));const r=1/3,o=2/3,a=n.radius||10;let l,c;for(let h=0,f=e.length;h<f;h+=1){const u=w.create(e[h]),d=e[h-1]||s,g=e[h+1]||t;l=c||u.distance(d)/2,c=u.distance(g)/2;const p=-Math.min(a,l),m=-Math.min(a,c),y=u.clone().move(d,p).round(),x=u.clone().move(g,m).round(),b=new w(r*y.x+o*u.x,o*u.y+r*y.y),v=new w(r*x.x+o*u.x,o*u.y+r*x.y);i.appendSegment($.createSegment("L",y)),i.appendSegment($.createSegment("C",b,v,x))}return i.appendSegment($.createSegment("L",t)),n.raw?i:i.serialize()},xv=function(s,t,e,n={}){let i,r=n.direction;if(e&&e.length!==0){const o=[s,...e,t],a=dt.throughPoints(o);i=new $(a)}else if(i=new $,i.appendSegment($.createSegment("M",s)),r||(r=Math.abs(s.x-t.x)>=Math.abs(s.y-t.y)?"H":"V"),r==="H"){const o=(s.x+t.x)/2;i.appendSegment($.createSegment("C",o,s.y,o,t.y,t.x,t.y))}else{const o=(s.y+t.y)/2;i.appendSegment($.createSegment("C",s.x,o,t.x,o,t.x,t.y))}return n.raw?i:i.serialize()},jo=1,vi=1/3,wi=2/3;function vv(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 Ps(s,t,e=[]){const n=[s,...e,t],i=[];return n.forEach((r,o)=>{const a=n[o+1];a!=null&&i.push(new j(r,a))}),i}function wv(s,t){const e=[];return t.forEach(n=>{const i=s.intersectsWithLine(n);if(i){const{x:r,y:o}=i,{start:a,end:l}=n,c=Math.round(a.x)===Math.round(r)&&Math.round(a.y)===Math.round(o),h=Math.round(l.x)===Math.round(r)&&Math.round(l.y)===Math.round(o);if(c||h)return;e.push(i)}}),e}function Do(s,t){return new j(s,t).squaredLength()}function Cv(s,t,e){return t.reduce((n,i,r)=>{if(_i.includes(i))return n;const o=n.pop()||s,a=w.create(i).move(o.start,-e);let l=w.create(i).move(o.start,+e);const c=t[r+1];if(c!=null){const u=l.distance(c);u<=e&&(l=c.move(o.start,u),_i.push(c))}else if(a.distance(o.end)<e*2+jo)return n.push(o),n;if(l.distance(o.start)<e*2+jo)return n.push(o),n;const f=new j(a,l);return ni.push(f),n.push(new j(o.start,a),f,new j(l,o.end)),n},[])}function Bo(s,t,e,n){const i=new $;let r;return r=$.createSegment("M",s[0].start),i.appendSegment(r),s.forEach((o,a)=>{if(ni.includes(o)){let l,c,h,f;if(e==="arc"){l=-90,c=o.start.diff(o.end),(c.x<0||c.x===0&&c.y<0)&&(l+=180);const d=o.getCenter(),g=new j(d,o.end).rotate(l,d);let p;p=new j(o.start,d),h=p.pointAt(2/3).rotate(l,o.start),f=g.pointAt(1/3).rotate(-l,g.end),r=$.createSegment("C",h,f,g.end),i.appendSegment(r),p=new j(d,o.end),h=g.pointAt(1/3).rotate(l,g.end),f=p.pointAt(1/3).rotate(-l,o.end),r=$.createSegment("C",h,f,o.end),i.appendSegment(r)}else if(e==="gap")r=$.createSegment("M",o.end),i.appendSegment(r);else if(e==="cubic"){l=o.start.theta(o.end);const u=t*.6;let d=t*1.35;c=o.start.diff(o.end),(c.x<0||c.x===0&&c.y<0)&&(d*=-1),h=new w(o.start.x+u,o.start.y+d).rotate(l,o.start),f=new w(o.end.x-u,o.end.y+d).rotate(l,o.end),r=$.createSegment("C",h,f,o.end),i.appendSegment(r)}}else{const l=s[a+1];n===0||!l||ni.includes(l)?(r=$.createSegment("L",o.end),i.appendSegment(r)):Pv(n,i,o.end,o.start,l.end)}}),i}function Pv(s,t,e,n,i){const r=e.distance(n)/2,o=e.distance(i)/2,a=-Math.min(s,r),l=-Math.min(s,o),c=e.clone().move(n,a).round(),h=e.clone().move(i,l).round(),f=new w(vi*c.x+wi*e.x,wi*e.y+vi*c.y),u=new w(vi*h.x+wi*e.x,wi*e.y+vi*h.y);let d;d=$.createSegment("L",c),t.appendSegment(d),d=$.createSegment("C",f,u,h),t.appendSegment(d)}let ni,_i;const Sv=function(s,t,e,n={}){ni=[],_i=[],vv(this);const i=n.size||5,r=n.type||"arc",o=n.radius||0,a=n.ignoreConnectors||["smooth"],l=this.graph,h=l.model.getEdges();if(h.length===1)return Bo(Ps(s,t,e),i,r,o);const f=this.cell,u=h.indexOf(f),d=l.options.connecting.connector||{},g=h.filter((v,C)=>{const S=v.getConnector()||d;return a.includes(S.name)?!1:C>u?S.name!=="jumpover":!0}),p=g.map(v=>l.findViewByCell(v)),m=Ps(s,t,e),y=p.map(v=>v==null?[]:v===this?m:Ps(v.sourcePoint,v.targetPoint,v.routePoints)),x=[];m.forEach(v=>{const C=g.reduce((S,P,O)=>{if(P!==f){const E=wv(v,y[O]);S.push(...E)}return S},[]).sort((S,P)=>Do(v.start,S)-Do(v.start,P));C.length>0?x.push(...Cv(v,C,i)):x.push(v)});const b=Bo(x,i,r,o);return ni=[],_i=[],n.raw?b:b.serialize()},Ov=Object.freeze(Object.defineProperty({__proto__:null,jumpover:Sv,loop:bv,normal:mv,rounded:yv,smooth:xv},Symbol.toStringTag,{value:"Module"}));var ke;(function(s){s.presets=Ov,s.registry=xt.create({type:"connector"}),s.registry.register(s.presets,!0)})(ke||(ke={}));var Ev=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class pc extends rt{constructor(t={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(lt(t)),this.changed={}}mutate(t,e={}){const n=e.unset===!0,i=e.silent===!0,r=[],o=this.changing;this.changing=!0,o||(this.previous=lt(this.data),this.changed={});const a=this.data,l=this.previous,c=this.changed;if(Object.keys(t).forEach(h=>{const f=h,u=t[f];ne(a[f],u)||r.push(f),ne(l[f],u)?delete c[f]:c[f]=u,n?delete a[f]:a[f]=u}),!i&&r.length>0&&(this.pending=!0,this.pendingOptions=e,r.forEach(h=>{this.emit("change:*",{key:h,options:e,store:this,current:a[h],previous:l[h]})})),o)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 r;if(typeof t=="string")i[t]=void 0,r=e;else if(Array.isArray(t))t.forEach(o=>i[o]=void 0),r=e;else{for(const o in this.data)i[o]=void 0;r=t}return this.mutate(i,Object.assign(Object.assign({},r),{unset:!0})),this}getByPath(t){return cr(this.data,t,"/")}setByPath(t,e,n={}){const i="/",r=Array.isArray(t)?[...t]:t.split(i),o=Array.isArray(t)?t.join(i):t,a=r[0],l=r.length;if(n.propertyPath=o,n.propertyValue=e,n.propertyPathArray=r,l===1)this.set(a,e,n);else{const c={};let h=c,f=a;for(let g=1;g<l;g+=1){const p=r[g],m=Number.isFinite(Number(p));h=h[f]=m?[]:{},f=p}An(c,r,e,i);const u=lt(this.data);n.rewrite&&fo(u,t,i);const d=mt(u,c);this.set(a,d[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 r=n.slice(1),o=lt(this.get(i));o&&fo(o,r),this.set(i,o,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()?lt(this.changed):null;const e=this.changing?this.previous:this.data,n={};let i;for(const r in t){const o=t[r];ne(e[r],o)||(n[r]=o,i=!0)}return i?lt(n):null}toJSON(){return lt(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})}}Ev([rt.dispose()],pc.prototype,"dispose",null);class ii{constructor(t){this.cell=t,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(t,e,n={},i="/"){const r=this.cell.getPropByPath(t),o=im(n,ii.defaultOptions),a=this.getTiming(o.timing),l=this.getInterp(o.interp,r,e);let c=0;const h=Array.isArray(t)?t.join(i):t,f=Array.isArray(t)?t:t.split(i),u=()=>{const d=new Date().getTime();c===0&&(c=d);let p=(d-c)/o.duration;p<1?this.ids[h]=requestAnimationFrame(u):p=1;const m=l(a(p));this.cell.setPropByPath(f,m),n.progress&&n.progress(Object.assign({progress:p,currentValue:m},this.getArgs(h))),p===1&&(this.cell.notify("transition:complete",this.getArgs(h)),n.complete&&n.complete(this.getArgs(h)),this.cell.notify("transition:finish",this.getArgs(h)),n.finish&&n.finish(this.getArgs(h)),this.clean(h))};return setTimeout(()=>{this.stop(t,void 0,i),this.cache[h]={startValue:r,targetValue:e,options:o},this.ids[h]=requestAnimationFrame(u),this.cell.notify("transition:start",this.getArgs(h)),n.start&&n.start(this.getArgs(h))},n.delay),this.stop.bind(this,t,i,n)}stop(t,e={},n="/"){const i=Array.isArray(t)?t:t.split(n);return Object.keys(this.ids).filter(r=>ne(i,r.split(n).slice(0,i.length))).forEach(r=>{cancelAnimationFrame(this.ids[r]);const o=this.cache[r],a=this.getArgs(r),l=Object.assign(Object.assign({},o.options),e),c=l.jumpedToEnd;c&&o.targetValue!=null&&(this.cell.setPropByPath(r,o.targetValue),this.cell.notify("transition:end",Object.assign({},a)),this.cell.notify("transition:complete",Object.assign({},a)),l.complete&&l.complete(Object.assign({},a)));const h=Object.assign({jumpedToEnd:c},a);this.cell.notify("transition:stop",Object.assign({},h)),l.stop&&l.stop(Object.assign({},h)),this.cell.notify("transition:finish",Object.assign({},a)),l.finish&&l.finish(Object.assign({},a)),this.clean(r)}),this}clean(t){delete this.ids[t],delete this.cache[t]}getTiming(t){return typeof t=="string"?Ve[t]:t}getInterp(t,e,n){return t?t(e,n):typeof n=="number"?De.number(e,n):typeof n=="string"?n[0]==="#"?De.color(e,n):De.unit(e,n):De.object(e,n)}getArgs(t){const e=this.cache[t];return{path:t,startValue:e.startValue,targetValue:e.targetValue,cell:this.cell}}}(function(s){s.defaultOptions={delay:10,duration:100,timing:"linear"}})(ii||(ii={}));var Av=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},mc=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};let K=class Je extends rt{static config(t){const{markup:e,propHooks:n,attrHooks:i}=t,r=mc(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(o=>{typeof o=="function"&&this.propHooks.push(o)})),i&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),i)),this.defaults=mt({},this.defaults,r)}static getMarkup(){return this.markup}static getDefaults(t){return t?this.defaults:lt(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(t,e){return this.propHooks.reduce((n,i)=>i?k(i,t,n):n,e)}get[Symbol.toStringTag](){return Je.toStringTag}constructor(t={}){super();const n=this.constructor.getDefaults(!0),i=mt({},this.preprocess(n),this.preprocess(t));this.id=i.id||Ti(),this.store=new pc(i),this.animation=new ii(this),this.setup(),this.init(),this.postprocess(t)}init(){}get model(){return this._model}set model(t){this._model!==t&&(this._model=t)}preprocess(t,e){const n=t.id,r=this.constructor.applyPropHooks(this,t);return n==null&&e!==!0&&(r.id=Ti()),r}postprocess(t){}setup(){this.store.on("change:*",t=>{const{key:e,current:n,previous:i,options:r}=t;this.notify("change:*",{key:e,options:r,current:n,previous:i,cell:this}),this.notify(`change:${e}`,{options:r,current:n,previous:i,cell:this});const o=e;(o==="source"||o==="target")&&this.notify("change:terminal",{type:o,current:n,previous:i,options:r,cell:this})}),this.store.on("changed",({options:t})=>this.notify("changed",{options:t,cell:this}))}notify(t,e){this.trigger(t,e);const n=this.model;return n&&(n.notify(`cell:${t}`,e),this.isNode()?n.notify(`node:${t}`,Object.assign(Object.assign({},e),{node:this})):this.isEdge()&&n.notify(`edge:${t}`,Object.assign(Object.assign({},e),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(t){return this.store===t.store}get view(){return this.store.get("view")}get shape(){return this.store.get("shape","")}getProp(t,e){return 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(mt({},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 r=e.total();let o=e.indexOf(this)!==r-i.length;o||(o=i.some((a,l)=>a.getZIndex()!==n+l)),o&&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 r=e.indexOf(this)!==0;r||(r=i.some((o,a)=>o.getZIndex()!==n+a)),r&&this.batchUpdate("to-back",()=>{n-=i.length,i.forEach((o,a)=>{o.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(mt({},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]||oe.registry.get(t);if(!i){const r=es(t);i=n[r]||oe.registry.get(r)}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(mt({},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(),r=i.getChildren();e.push(i),r&&n.push(...r)}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 Je.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 Je.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(),r=this!==i;let o=e;if(o==null&&(o=this.getChildCount(),r||(o-=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(o,0,t),t.setParent(this,n),this.setChildren(a,n),r&&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}transition(t,e,n={},i="/"){return this.animation.start(t,e,n,i)}stopTransition(t,e,n="/"){return this.animation.stop(t,e,n),this}getTransitions(){return this.animation.get()}translate(t,e,n){return this}scale(t,e,n,i){return this}addTools(t,e,n){const i=Array.isArray(t)?t:[t],r=typeof e=="string"?e:null,o=typeof e=="object"?e:typeof n=="object"?n:{};if(o.reset)return this.setTools({name:r,items:i,local:o.local},o);let a=lt(this.getTools());if(a==null||r==null||a.name===r)return a==null&&(a={}),a.items||(a.items=[]),a.name=r,a.items=[...a.items,...i],this.setTools(Object.assign({},a),o)}setTools(t,e={}){return t==null?this.removeTools():this.store.set("tools",Je.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=lt(this.getTools());if(n){let i=!1;const r=n.items.slice(),o=a=>{r.splice(a,1),i=!0};if(typeof t=="number")o(t);else for(let a=r.length-1;a>=0;a-=1){const l=r[a];(typeof l=="string"?l===t:l.name===t)&&o(a)}i&&(n.items=r,this.setTools(n,e))}return this}getBBox(t){return new L}getConnectionPoint(t,e){return new w}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 g=this.constructor;throw new Error(`Unable to serialize ${i} missing "shape" prop, check the ${i} "${g.name||n.call(g)}"`)}const r=this.constructor,o=t.diff===!0,a=e.attrs||{},l=r.getDefaults(!0),c=o?this.preprocess(l,!0):l,h=c.attrs||{},f={};Object.entries(e).forEach(([g,p])=>{if(p!=null&&!Array.isArray(p)&&typeof p=="object"&&!ae(p))throw new Error(`Can only serialize ${i} with plain-object props, but got a "${n.call(p)}" type of key "${g}" on ${i} "${this.id}"`);if(g!=="attrs"&&g!=="shape"&&o){const m=c[g];ne(p,m)&&delete e[g]}}),Object.keys(a).forEach(g=>{const p=a[g],m=h[g];Object.keys(p).forEach(y=>{const x=p[y],b=m?m[y]:null;x!=null&&typeof x=="object"&&!Array.isArray(x)?Object.keys(x).forEach(v=>{const C=x[v];if(m==null||b==null||!gt(b)||!ne(b[v],C)){f[g]==null&&(f[g]={}),f[g][y]==null&&(f[g][y]={});const S=f[g][y];S[v]=C}}):(m==null||!ne(b,x))&&(f[g]==null&&(f[g]={}),f[g][y]=x)})});const u=Object.assign(Object.assign({},e),{attrs:Fa(f)?void 0:f});u.attrs==null&&delete u.attrs;const d=u;return d.angle===0&&delete d.angle,lt(d)}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 Je.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 r=e();return this.stopBatch(t,n,i),r}dispose(){this.removeFromParent(),this.store.dispose()}};K.defaults={};K.attrHooks={};K.propHooks=[];Av([rt.dispose()],K.prototype,"dispose",null);(function(s){function t(e){return typeof e=="string"?{items:[e]}:Array.isArray(e)?{items:e}:e.items?e:{items:[e]}}s.normalizeTools=t})(K||(K={}));(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&typeof i.isNode=="function"&&typeof i.isEdge=="function"&&typeof i.prop=="function"&&typeof i.attr=="function"}s.isCell=t})(K||(K={}));(function(s){function t(...r){const o=r.filter(l=>l!=null).map(l=>l.getAncestors()).sort((l,c)=>l.length-c.length);return o.shift().find(l=>o.every(c=>c.includes(l)))||null}s.getCommonAncestor=t;function e(r,o={}){let a=null;for(let l=0,c=r.length;l<c;l+=1){const h=r[l];let f=h.getBBox(o);if(f){if(h.isNode()){const u=h.getAngle();u!=null&&u!==0&&(f=f.bbox(u))}a=a==null?f:a.union(f)}}return a}s.getCellsBBox=e;function n(r){const o=[r,...r.getDescendants({deep:!0})];return s.cloneCells(o)}s.deepClone=n;function i(r){const o=qa(r),a=o.reduce((l,c)=>(l[c.id]=c.clone(),l),{});return o.forEach(l=>{const c=a[l.id];if(c.isEdge()){const u=c.getSourceCellId(),d=c.getTargetCellId();u&&a[u]&&c.setSource(Object.assign(Object.assign({},c.getSource()),{cell:a[u].id})),d&&a[d]&&c.setTarget(Object.assign(Object.assign({},c.getTarget()),{cell:a[d].id}))}const h=l.getParent();h&&a[h.id]&&c.setParent(a[h.id]);const f=l.getChildren();if(f&&f.length){const u=f.reduce((d,g)=>(a[g.id]&&d.push(a[g.id]),d),[]);u.length>0&&c.setChildren(u)}}),a}s.cloneCells=i})(K||(K={}));(function(s){s.config({propHooks(t){var{tools:e}=t,n=mc(t,["tools"]);return e&&(n.tools=s.normalizeTools(e)),n}})})(K||(K={}));var bn;(function(s){let t,e;function n(o,a){return a?t!=null&&t.exist(o):e!=null&&e.exist(o)}s.exist=n;function i(o){t=o}s.setEdgeRegistry=i;function r(o){e=o}s.setNodeRegistry=r})(bn||(bn={}));class Mv{constructor(t){this.ports=[],this.groups={},this.init(lt(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,r=i?i.position:null,o=r?r.name:null;let a;if(o!=null){const f=Be.registry.get(o);if(f==null)return Be.registry.onNotFound(o);a=f}else a=Be.presets.left;const l=n.map(f=>f&&f.position&&f.position.args||{}),c=r&&r.args||{};return a(l,e,c).map((f,u)=>{const d=n[u];return{portLayout:f,portId:d.id,portSize:d.size,portAttrs:d.attrs,labelSize:d.label.size,labelLayout:this.getPortLabelLayout(d,w.create(f.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=mt({},n.attrs,e.attrs),e.position=this.createPosition(n,e),e.label=mt({},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 mt({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",r=t.label.position.args||{},o=hn.registry.get(i)||hn.presets.left;return o?o(e,n,r):null}}var hs=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};let wt=class bc extends K{get[Symbol.toStringTag](){return bc.toStringTag}constructor(t={}){super(t),this.initPorts()}preprocess(t,e){const{x:n,y:i,width:r,height:o}=t,a=hs(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(r!=null||o!=null){const l=a.size;a.size=Object.assign(Object.assign({},l),{width:r??(l?l.width:0),height:o??(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 r=this.getSize();switch(i){case"left":case"right":e=r.height;break;case"top":case"bottom":t=r.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=W.normalize(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 f=h.clone().rotate(-l,c.getCenter()),u=Math.sqrt(t*t+e*e)/2;let d=a*Math.PI/2;d+=Math.atan(a%2===0?e/t:t/e),d-=W.toRad(l);const p=w.fromPolar(u,d,f).clone().translate(t/-2,e/-2);this.store.set("size",{width:t,height:e},n),this.setPosition(p.x,p.y,n)}else this.store.set("size",{width:t,height:e},n);return this.stopBatch("resize",n),this}scale(t,e,n,i={}){const r=this.getBBox().scale(t,e,n??void 0);return this.startBatch("scale",i),this.setPosition(r.x,r.y,i),this.resize(r.width,r.height,i),this.stopBatch("scale"),this}position(t,e,n){return 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(),r=n.getPosition();return{x:i.x-r.x,y:i.y-r.y}}}const e=this.store.get("position");return e?Object.assign({},e):{x:0,y:0}}setPosition(t,e,n={}){let i,r,o;if(typeof t=="object"?(i=t.x,r=t.y,o=e||{}):(i=t,r=e,o=n||{}),o.relative){const a=this.getParent();if(a!=null&&a.isNode()){const l=a.getPosition();i+=l.x,r+=l.y}}if(o.deep){const a=this.getPosition();this.translate(i-a.x,r-a.y,o)}else this.store.set("position",{x:i,y:r},o);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 o=this.getBBox({deep:!0}),a=n.restrict,l=i.x-o.x,c=i.y-o.y,h=Math.max(a.x+l,Math.min(a.x+a.width+l-o.width,i.x+t)),f=Math.max(a.y+c,Math.min(a.y+a.height+c-o.height,i.y+e));t=h-i.x,e=f-i.y}const r={x:i.x+t,y:i.y+e};return n.tx=t,n.ty=e,n.transition?(typeof n.transition!="object"&&(n.transition={}),this.transition("position",r,Object.assign(Object.assign({},n.transition),{interp:De.object})),this.eachChild(o=>{var a;((a=n.exclude)===null||a===void 0?void 0:a.includes(o))||o.translate(t,e,n)})):(this.startBatch("translate",n),this.store.set("position",r,n),this.eachChild(o=>{var a;((a=n.exclude)===null||a===void 0?void 0:a.includes(o))||o.translate(t,e,n)}),this.stopBatch("translate",n)),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(),r=this.getPosition(),o=this.getBBox().getCenter();o.rotate(n-t,e.center);const a=o.x-i.width/2-r.x,l=o.y-i.height/2-r.y;this.startBatch("rotate",{angle:t,options:e}),this.setPosition(r.x+a,r.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),K.getCellsBBox(e)}return L.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(t,e){const n=this.getBBox(),i=n.getCenter(),r=t.getTerminal(e);if(r==null)return i;const o=r.port;if(!o||!this.hasPort(o))return i;const a=this.getPort(o);if(!a||!a.group)return i;const c=this.getPortsPosition(a.group)[o].position,h=w.create(c).translate(n.getOrigin()),f=this.getAngle();return f&&h.rotate(-f,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:r,width:o,height:a}=K.getCellsBBox(n);const l=Yt(t.padding);return i-=l.left,r-=l.top,o+=l.left+l.right,a+=l.bottom+l.top,this.store.set({position:{x:i,y:r},size:{width:o,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")||ct.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(t,e={}){return this.store.set("portContainerMarkup",ct.clone(t),e),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(t){this.setPortMarkup(t)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||ct.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(t,e={}){return this.store.set("portMarkup",ct.clone(t),e),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(t){this.setPortLabelMarkup(t)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||ct.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(t,e={}){return this.store.set("portLabelMarkup",ct.clone(t),e),this}get ports(){const t=this.store.get("ports",{items:[]});return t.items==null&&(t.items=[]),t}getPorts(){return lt(this.ports.items)}getPortsByGroup(t){return this.getPorts().filter(e=>e.group===t)}getPort(t){return lt(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 L(0,0,e.width,e.height)).reduce((i,r)=>{const o=r.portLayout;return i[r.portId]={position:Object.assign({},o.position),angle:o.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 r=this.prefixPortPath(t),o=e;return this.setPropByPath(r,o,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 r=[...this.ports.items].filter(o=>!t.some(a=>{const l=typeof a=="string"?a:a.id;return o.id===l}));this.setPropByPath("ports/items",r,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(o=>{o.id&&(e[o.id]=!0)});const n={};(this.store.getPrevious("ports")||{items:[]}).items.forEach(o=>{o.id&&!e[o.id]&&(n[o.id]=!0)});const r=this.model;r&&!Fa(n)&&(r.getConnectedEdges(this,{incoming:!0}).forEach(l=>{const c=l.getTargetPortId();c&&n[c]&&l.remove()}),r.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 Ti()}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 Mv(this.ports);const n=this.port.getPorts(),i=e?n.filter(o=>e.find(a=>a.id===o.id)?null:o):[...n],r=e?e.filter(o=>n.find(a=>a.id===o.id)?null:o):[];i.length>0&&this.notify("ports:added",{added:i,cell:this,node:this}),r.length>0&&this.notify("ports:removed",{removed:r,cell:this,node:this})}};wt.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}};(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&typeof i.isNode=="function"&&typeof i.isEdge=="function"&&typeof i.prop=="function"&&typeof i.attr=="function"&&typeof i.size=="function"&&typeof i.position=="function"}s.isNode=t})(wt||(wt={}));(function(s){s.config({propHooks(t){var{ports:e}=t,n=hs(t,["ports"]);return e&&(n.ports=Array.isArray(e)?{items:e}:e),n}})})(wt||(wt={}));(function(s){s.registry=xt.create({type:"node",process(t,e){if(bn.exist(t,!0))throw new Error(`Node with name '${t}' was registered by anthor Edge`);if(typeof e=="function")return e.config({shape:t}),e;let n=s;const{inherit:i}=e,r=hs(e,["inherit"]);if(i)if(typeof i=="string"){const a=this.get(i);a==null?this.onNotFound(i,"inherited"):n=a}else n=i;r.constructorName==null&&(r.constructorName=t);const o=n.define.call(n,r);return o.config({shape:t}),o}}),bn.setNodeRegistry(s.registry)})(wt||(wt={}));(function(s){let t=0;function e(r){return r?hr(r):(t+=1,`CustomNode${t}`)}function n(r){const{constructorName:o,overwrite:a}=r,l=hs(r,["constructorName","overwrite"]),c=lr(e(o||l.shape),this);return c.config(l),l.shape&&s.registry.register(l.shape,c,a),c}s.define=n;function i(r){const o=r.shape||"rect",a=s.registry.get(o);return a?new a(r):s.registry.onNotFound(o)}s.create=i})(wt||(wt={}));var us=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};let ft=class yc extends K{get[Symbol.toStringTag](){return yc.toStringTag}constructor(t={}){super(t)}preprocess(t,e){const{source:n,sourceCell:i,sourcePort:r,sourcePoint:o,target:a,targetCell:l,targetPort:c,targetPoint:h}=t,u=us(t,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),d=g=>typeof g=="string"||typeof g=="number";if(n!=null)if(K.isCell(n))u.source={cell:n.id};else if(d(n))u.source={cell:n};else if(w.isPoint(n))u.source=n.toJSON();else if(Array.isArray(n))u.source={x:n[0],y:n[1]};else{const g=n.cell;K.isCell(g)?u.source=Object.assign(Object.assign({},n),{cell:g.id}):u.source=n}if(i!=null||r!=null){let g=u.source;if(i!=null){const p=d(i)?i:i.id;g?g.cell=p:g=u.source={cell:p}}r!=null&&g&&(g.port=r)}else o!=null&&(u.source=w.create(o).toJSON());if(a!=null)if(K.isCell(a))u.target={cell:a.id};else if(d(a))u.target={cell:a};else if(w.isPoint(a))u.target=a.toJSON();else if(Array.isArray(a))u.target={x:a[0],y:a[1]};else{const g=a.cell;K.isCell(g)?u.target=Object.assign(Object.assign({},a),{cell:g.id}):u.target=a}if(l!=null||c!=null){let g=u.target;if(l!=null){const p=d(l)?l:l.id;g?g.cell=p:g=u.target={cell:p}}c!=null&&g&&(g.port=c)}else h!=null&&(u.target=w.create(h).toJSON());return super.preprocess(u,e)}setup(){super.setup(),this.on("change:labels",t=>this.onLabelsChanged(t)),this.on("change:vertices",t=>this.onVertexsChanged(t))}isEdge(){return!0}disconnect(t={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},t),this}get source(){return this.getSource()}set source(t){this.setSource(t)}getSource(){return this.getTerminal("source")}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(t,e,n={}){return this.setTerminal("source",t,e,n)}get target(){return this.getTarget()}set target(t){this.setTarget(t)}getTarget(){return this.getTerminal("target")}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(t,e,n={}){return this.setTerminal("target",t,e,n)}getTerminal(t){return Object.assign({},this.store.get(t))}setTerminal(t,e,n,i={}){if(K.isCell(e))return this.store.set(t,mt({},n,{cell:e.id}),i),this;const r=e;return w.isPoint(e)||r.x!=null&&r.y!=null?(this.store.set(t,mt({},n,{x:r.x,y:r.y}),i),this):(this.store.set(t,lt(e),i),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(t){const e=this[t];if(w.isPointLike(e))return w.create(e);const n=this.getTerminalCell(t);return n?n.getConnectionPoint(this,t):new w}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 lt(e)}get labels(){return this.getLabels()}set labels(t){this.setLabels(t)}getLabels(){return[...this.store.get("labels",[])].map(t=>this.parseLabel(t))}setLabels(t,e={}){return this.store.set("labels",Array.isArray(t)?t:[t],e),this}insertLabel(t,e,n={}){const i=this.getLabels(),r=i.length;let o=e!=null&&Number.isFinite(e)?e:r;return o<0&&(o=r+o+1),i.splice(o,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,r=n.splice(i,1);return this.setLabels(n,e),r.length?r[0]:null}parseLabel(t){return typeof t=="string"?this.constructor.parseStringLabel(t):t}onLabelsChanged({previous:t,current:e}){const n=t&&e?e.filter(r=>t.find(o=>r===o||ne(r,o))?null:r):e?[...e]:[],i=t&&e?t.filter(r=>e.find(o=>r===o||ne(r,o))?null:r):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=>w.toJSON(i)),e),this}insertVertex(t,e,n={}){const i=this.getVertices(),r=i.length;let o=e!=null&&Number.isFinite(e)?e:r;return o<0&&(o=r+o+1),i.splice(o,0,w.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(r=>t.find(o=>w.equals(r,o))?null:r):e?[...e]:[],i=t&&e?t.filter(r=>e.find(o=>w.equals(r,o))?null:r):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")||ct.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(r=>w.create(r).scale(t,e,n).toJSON(),i)}applyToPoints(t,e={}){const n={},i=this.getSource(),r=this.getTarget();w.isPointLike(i)&&(n.source=t(i)),w.isPointLike(r)&&(n.target=t(r));const o=this.getVertices();return o.length>0&&(n.vertices=o.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=>w.create(e)),this.getTargetPoint()];return new bt(t)}updateParent(t){let e=null;const n=this.getSourceCell(),i=this.getTargetCell(),r=this.getParent();return n&&i&&(n===i||n.isDescendantOf(i)?e=i:i.isDescendantOf(n)?e=n:e=K.getCommonAncestor(n,i)),r&&e&&e.id!==r.id&&r.unembed(this,t),e&&(!r||r.id!==e.id)&&e.embed(this,t),e}hasLoop(t={}){const e=this.getSource(),n=this.getTarget(),i=e.cell,r=n.cell;if(!i||!r)return!1;let o=i===r;if(!o&&t.deep&&this._model){const a=this.getSourceCell(),l=this.getTargetCell();a&&l&&(o=a.isAncestorOf(l,t)||l.isAncestorOf(a,t))}return o}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.defaults={};(function(s){function t(e,n){const i=e,r=n;return i.cell===r.cell?i.port===r.port||i.port==null&&r.port==null:!1}s.equalTerminals=t})(ft||(ft={}));(function(s){s.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}};function t(e){return{attrs:{label:{text:e}}}}s.parseStringLabel=t})(ft||(ft={}));(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&typeof i.isNode=="function"&&typeof i.isEdge=="function"&&typeof i.prop=="function"&&typeof i.attr=="function"&&typeof i.disconnect=="function"&&typeof i.getSource=="function"&&typeof i.getTarget=="function"}s.isEdge=t})(ft||(ft={}));(function(s){s.registry=xt.create({type:"edge",process(t,e){if(bn.exist(t,!1))throw new Error(`Edge with name '${t}' was registered by anthor Node`);if(typeof e=="function")return e.config({shape:t}),e;let n=s;const{inherit:i="edge"}=e,r=us(e,["inherit"]);if(typeof i=="string"){const a=this.get(i||"edge");a==null&&i?this.onNotFound(i,"inherited"):n=a}else n=i;r.constructorName==null&&(r.constructorName=t);const o=n.define.call(n,r);return o.config({shape:t}),o}}),bn.setEdgeRegistry(s.registry)})(ft||(ft={}));(function(s){let t=0;function e(r){return r?hr(r):(t+=1,`CustomEdge${t}`)}function n(r){const{constructorName:o,overwrite:a}=r,l=us(r,["constructorName","overwrite"]),c=lr(e(o||l.shape),this);return c.config(l),l.shape&&s.registry.register(l.shape,c,a),c}s.define=n;function i(r){const o=r.shape||"edge",a=s.registry.get(o);return a?new a(r):s.registry.onNotFound(o)}s.create=i})(ft||(ft={}));(function(s){const t="basic.edge";s.config({shape:t,propHooks(e){const{label:n,vertices:i}=e,r=us(e,["label","vertices"]);if(n){r.labels==null&&(r.labels=[]);const o=typeof n=="string"?s.parseStringLabel(n):n;r.labels.push(o)}return i&&Array.isArray(i)&&(r.vertices=i.map(o=>w.create(o).toJSON())),r}}),s.registry.register(t,s)})(ft||(ft={}));var Tv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Fi extends rt{constructor(t,e={}){super(),this.length=0,this.comparator=e.comparator||"zIndex",this.clean(),t&&this.reset(t,{silent:!0})}toJSON(){return this.cells.map(t=>t.toJSON())}add(t,e,n){let i,r;typeof e=="number"?(i=e,r=Object.assign({merge:!1},n)):(i=this.length,r=Object.assign({merge:!1},e)),i>this.length&&(i=this.length),i<0&&(i+=this.length+1);const o=Array.isArray(t)?t:[t],a=this.comparator&&typeof e!="number"&&r.sort!==!1,l=this.comparator||null;let c=!1;const h=[],f=[];return o.forEach(u=>{const d=this.get(u);d?r.merge&&!u.isSameStore(d)&&(d.setProp(u.getProp(),n),f.push(d),a&&!c&&(l==null||typeof l=="function"?c=d.hasChanged():typeof l=="string"?c=d.hasChanged(l):c=l.some(g=>d.hasChanged(g)))):(h.push(u),this.reference(u))}),h.length&&(a&&(c=!0),this.cells.splice(i,0,...h),this.length=this.cells.length),c&&this.sort({silent:!0}),r.silent||(h.forEach((u,d)=>{const g={cell:u,index:i+d,options:r};this.trigger("added",g),r.dryrun||u.notify("added",Object.assign({},g))}),c&&this.trigger("sorted"),(h.length||f.length)&&this.trigger("updated",{added:h,merged:f,removed:[],options:r})),this}remove(t,e={}){const n=Array.isArray(t)?t:[t],i=this.removeCells(n,e);return!e.silent&&i.length>0&&this.trigger("updated",{options:e,removed:i,added:[],merged:[]}),Array.isArray(t)?i:i[0]}removeCells(t,e){const n=[];for(let i=0;i<t.length;i+=1){const r=this.get(t[i]);if(r==null)continue;const o=this.cells.indexOf(r);this.cells.splice(o,1),this.length-=1,delete this.map[r.id],n.push(r),this.unreference(r),e.dryrun||r.remove(),e.silent||(this.trigger("removed",{cell:r,index:o,options:e}),e.dryrun||r.notify("removed",{cell:r,index:o,options:e}))}return n}reset(t,e={}){const n=this.cells.slice();if(n.forEach(i=>this.unreference(i)),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 r=[],o=[];i.forEach(a=>{n.some(c=>c.id===a.id)||r.push(a)}),n.forEach(a=>{i.some(c=>c.id===a.id)||o.push(a)}),this.trigger("updated",{options:e,added:r,removed:o,merged:[]})}return this}push(t,e){return this.add(t,this.length,e)}pop(t){const e=this.at(this.length-1);return this.remove(e,t)}unshift(t,e){return this.add(t,0,e)}shift(t){const e=this.at(0);return this.remove(e,t)}get(t){if(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=or(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([])}}Tv([Fi.dispose()],Fi.prototype,"dispose",null);var Nv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class $t extends rt{get[Symbol.toStringTag](){return $t.toStringTag}constructor(t=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new Fi(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(),r=t.getTarget();if(i&&i.cell){const o=this.outgoings[i.cell],a=o?o.indexOf(n):-1;a>=0&&(o.splice(a,1),o.length===0&&delete this.outgoings[i.cell])}if(r&&r.cell){const o=this.incomings[r.cell],a=o?o.indexOf(n):-1;a>=0&&(o.splice(a,1),o.length===0&&delete this.incomings[r.cell])}}else delete this.nodes[n];e.clear||(e.disconnectEdges?this.disconnectConnectedEdges(t,e):this.removeConnectedEdges(t,e)),t.model===this&&(t.model=null)}onReset(t){this.nodes={},this.edges={},this.outgoings={},this.incomings={},t.forEach(e=>this.onCellAdded(e))}onEdgeTerminalChanged(t,e){const n=e==="source"?this.outgoings:this.incomings,i=t.previous(e);if(i&&i.cell){const o=K.isCell(i.cell)?i.cell.id:i.cell,a=n[o],l=a?a.indexOf(t.id):-1;l>=0&&(a.splice(l,1),a.length===0&&delete n[o])}const r=t.getTerminal(e);if(r&&r.cell){const o=K.isCell(r.cell)?r.cell.id:r.cell,a=n[o]||[];a.indexOf(t.id)===-1&&a.push(t.id),n[o]=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((r,o)=>{const a=r.isEdge()?1:2,l=o.isEdge()?1:2;return a-l});for(;i.length>0;){const r=i.shift();r&&r.remove(n)}},n),this}addNode(t,e={}){const n=wt.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 wt.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(r=>{this.addCell(r,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,r])=>n.setProp(i,r,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(r=>{const o=r.getSourceCell(),a=r.getTargetCell();o===t&&r.setSource(Object.assign(Object.assign({},r.getSource()),{cell:e})),a===t&&r.setTarget(Object.assign(Object.assign({},r.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 r=i.getSourceCellId(),o=i.getTargetCellId();r===n&&i.setSource({x:0,y:0},e),o===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&&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&&i.isEdge()):null}getConnectedEdges(t,e={}){const n=[],i=typeof t=="string"?this.getCell(t):t;if(i==null)return n;const r={},o=e.indirect;let a=e.incoming,l=e.outgoing;a==null&&l==null&&(a=l=!0);const c=(h,f)=>{const u=f?this.getOutgoingEdges(h):this.getIncomingEdges(h);if(u?.forEach(d=>{r[d.id]||(n.push(d),r[d.id]=!0,o&&(a&&c(d,!1),l&&c(d,!0)))}),o&&h.isEdge()){const d=f?h.getTargetCell():h.getSourceCell();d&&d.isEdge()&&(r[d.id]||(n.push(d),c(d,f)))}};if(l&&c(i,!0),a&&c(i,!1),e.deep){const h=i.getDescendants({deep:!0}),f={};h.forEach(d=>{d.isNode()&&(f[d.id]=!0)});const u=(d,g)=>{const p=g?this.getOutgoingEdges(d.id):this.getIncomingEdges(d.id);p?.forEach(m=>{if(!r[m.id]){const y=m.getSourceCell(),x=m.getTargetCell();if(!e.enclosed&&y&&f[y.id]&&x&&f[x.id])return;n.push(m),r[m.id]=!0}})};h.forEach(d=>{d.isEdge()||(l&&u(d,!0),a&&u(d,!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 o=this.getConnectedEdges(t,e).reduce((a,l)=>{const c=l.hasLoop(e),h=l.getSourceCell(),f=l.getTargetCell();return n&&h&&h.isNode()&&!a[h.id]&&(c||h!==t&&(!e.deep||!h.isDescendantOf(t)))&&(a[h.id]=h),i&&f&&f.isNode()&&!a[f.id]&&(c||f!==t&&(!e.deep||!f.isDescendantOf(t)))&&(a[f.id]=f),a},{});if(t.isEdge()){if(n){const a=t.getSourceCell();a&&a.isNode()&&!o[a.id]&&(o[a.id]=a)}if(i){const a=t.getTargetCell();a&&a.isNode()&&!o[a.id]&&(o[a.id]=a)}}return Object.keys(o).map(a=>o[a])}isNeighbor(t,e,n={}){let i=n.incoming,r=n.outgoing;return i==null&&r==null&&(i=r=!0),this.getConnectedEdges(t,n).some(o=>{const a=o.getSourceCell(),l=o.getTargetCell();return!!(i&&a&&a.id===e.id||r&&l&&l.id===e.id)})}getSuccessors(t,e={}){const n=[];return this.search(t,(i,r)=>{i!==t&&this.matchDistance(r,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{outgoing:!0})),n}isSuccessor(t,e,n={}){let i=!1;return this.search(t,(r,o)=>{if(r===e&&r!==t&&this.matchDistance(o,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{outgoing:!0})),i}getPredecessors(t,e={}){const n=[];return this.search(t,(i,r)=>{i!==t&&this.matchDistance(r,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{incoming:!0})),n}isPredecessor(t,e,n={}){let i=!1;return this.search(t,(r,o)=>{if(r===e&&r!==t&&this.matchDistance(o,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))}),K.getCommonAncestor(...e)}getSubGraph(t,e={}){const n=[],i={},r=[],o=[],a=l=>{i[l.id]||(n.push(l),i[l.id]=l,l.isEdge()&&o.push(l),l.isNode()&&r.push(l))};return t.forEach(l=>{a(l),e.deep&&l.getDescendants({deep:!0}).forEach(h=>a(h))}),o.forEach(l=>{const c=l.getSourceCell(),h=l.getTargetCell();c&&!i[c.id]&&(n.push(c),i[c.id]=c,c.isNode()&&r.push(c)),h&&!i[h.id]&&(n.push(h),i[h.id]=h,h.isNode()&&r.push(h))}),r.forEach(l=>{this.getConnectedEdges(l,e).forEach(h=>{const f=h.getSourceCell(),u=h.getTargetCell();!i[h.id]&&f&&i[f.id]&&u&&i[u.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 K.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,r){const o=typeof t=="number"?new L(t,e,n,i):L.create(t),a=typeof t=="number"?r:e,l=a&&a.strict;return this.getNodes().filter(c=>{const h=c.getBBox();return l?o.containsRect(h):o.isIntersectWithRect(h)})}getEdgesInArea(t,e,n,i,r){const o=typeof t=="number"?new L(t,e,n,i):L.create(t),a=typeof t=="number"?r:e,l=a&&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?o.containsRect(h):o.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(r=>t.id!==r.id&&!r.isDescendantOf(t))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(t,e={}){return K.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=[],r={},o={};for(i.push(t),o[t.id]=0;i.length>0;){const a=i.shift();if(a==null||r[a.id]||(r[a.id]=!0,k(e,this,a,o[a.id])===!1))continue;this.getNeighbors(a,n).forEach(c=>{o[c.id]=o[a.id]+1,i.push(c)})}}depthFirstSearch(t,e,n={}){const i=[],r={},o={};for(i.push(t),o[t.id]=0;i.length>0;){const a=i.pop();if(a==null||r[a.id]||(r[a.id]=!0,k(e,this,a,o[a.id])===!1))continue;const l=this.getNeighbors(a,n),c=i.length;l.forEach(h=>{o[h.id]=o[a.id]+1,i.splice(c,0,h)})}}getShortestPath(t,e,n={}){const i={};this.getEdges().forEach(c=>{const h=c.getSourceCellId(),f=c.getTargetCellId();h&&f&&(i[h]||(i[h]=[]),i[f]||(i[f]=[]),i[h].push(f),n.directed||i[f].push(h))});const r=typeof t=="string"?t:t.id,o=_s.run(i,r,n.weight),a=[];let l=typeof e=="string"?e:e.id;for(o[l]&&a.push(l);l=o[l];)a.unshift(l);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 r=this.getCellsBBox(n);if(r){const o=Math.max(t/r.width,0),a=Math.max(e/r.height,0),l=r.getOrigin();n.forEach(c=>c.scale(o,a,l,i))}return this}toJSON(t={}){return $t.toJSON(this.getCells(),t)}parseJSON(t){return $t.fromJSON(t)}fromJSON(t,e={}){const n=this.parseJSON(t);return this.resetCells(n,e),this}startBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)+1,this.notify("batch:start",{name:t,data:e}),this}stopBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)-1,this.notify("batch:stop",{name:t,data:e}),this}batchUpdate(t,e,n={}){this.startBatch(t,n);const i=e();return this.stopBatch(t,n),i}hasActiveBatch(t=Object.keys(this.batches)){return(Array.isArray(t)?t:[t]).some(n=>this.batches[n]>0)}dispose(){this.collection.dispose()}}Nv([$t.dispose()],$t.prototype,"dispose",null);(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&typeof i.addNode=="function"&&typeof i.addEdge=="function"&&i.collection!=null}s.isModel=t})($t||($t={}));(function(s){function t(n,i={}){return{cells:n.map(r=>r.toJSON(i))}}s.toJSON=t;function e(n){const i=[];return Array.isArray(n)?i.push(...n):(n.cells&&i.push(...n.cells),n.nodes&&n.nodes.forEach(r=>{r.shape==null&&(r.shape="rect"),i.push(r)}),n.edges&&n.edges.forEach(r=>{r.shape==null&&(r.shape="edge"),i.push(r)})),i.map(r=>{const o=r.shape;if(o){if(wt.registry.exist(o))return wt.create(r);if(ft.registry.exist(o))return ft.create(r)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}s.fromJSON=e})($t||($t={}));var Rv=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};let Ae=class extends wt{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}};(function(s){s.bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},s.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},s.config({attrs:{text:Object.assign({},s.labelAttr)},propHooks(t){const{label:e}=t,n=Rv(t,["label"]);return e&&An(n,"attrs/text/text",e),n},visible:!0})})(Ae||(Ae={}));var Lv=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};function Iv(s,t="body"){return[{tagName:s,selector:t},{tagName:"text",selector:"label"}]}function jv(s="xlink:href"){return e=>{const{imageUrl:n,imageWidth:i,imageHeight:r}=e,o=Lv(e,["imageUrl","imageWidth","imageHeight"]);if(n!=null||i!=null||r!=null){const a=()=>{if(o.attrs){const l=o.attrs.image;n!=null&&(l[s]=n),i!=null&&(l.width=i),r!=null&&(l.height=r),o.attrs.image=l}};o.attrs?(o.attrs.image==null&&(o.attrs.image={}),a()):(o.attrs={image:{}},a())}return o}}function Rn(s,t,e={}){const n={constructorName:s,markup:Iv(s,e.selector),attrs:{[s]:Object.assign({},Ae.bodyAttr)}};return(e.parent||Ae).define(mt(n,t,{shape:s}))}Rn("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}});const Dv=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"}}});Rn("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var Bv=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};class yn extends Ae{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",yn.pointsToString(t),e),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}(function(s){function t(e){return typeof e=="string"?e:e.map(n=>Array.isArray(n)?n.join(","):w.isPointLike(n)?`${n.x}, ${n.y}`:"").join(" ")}s.pointsToString=t,s.config({propHooks(e){const{points:n}=e,i=Bv(e,["points"]);if(n){const r=t(n);r&&An(i,"attrs/body/refPoints",r)}return i}})})(yn||(yn={}));Rn("polygon",{},{parent:yn});Rn("polyline",{},{parent:yn});var kv=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};Ae.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=kv(s,["path"]);return t&&An(e,"attrs/body/refD",t),e}});var $v=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};Ae.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},qt.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:At.xhtml,selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]}:{tagName:"text",selector:"label",attrs:{textAnchor:"middle"}}],attrs:{body:Object.assign(Object.assign({},Ae.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(s){const{text:t}=s,e=$v(s,["text"]);return t&&An(e,"attrs/label/text",t),e},attrHooks:{text:{set(s,{cell:t,view:e,refBBox:n,elem:i,attrs:r}){if(i instanceof HTMLElement)i.textContent=s;else{const o=r.style||{},a={text:s,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},o),c=oe.presets.textWrap;return k(c.set,this,a,{cell:t,view:e,elem:i,refBBox:n,attrs:l}),{fill:o.color||null}}},position(s,{refBBox:t,elem:e}){if(e instanceof SVGElement)return t.getCenter()}}}});Rn("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:jv()},{selector:"image"});Rn("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class Zt extends yt{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return Zt.toStringTag}getContainerClassName(){const t=[super.getContainerClassName(),this.prefixClassName("node")];return this.can("nodeMovable")||t.push(this.prefixClassName("node-immovable")),t.join(" ")}updateClassName(t){const e=t.target;if(e.hasAttribute("magnet")){const n=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?pt(e,n):B(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 L(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}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){const t=this.cell.getPosition();return`translate(${t.x},${t.y})`}getRotationString(){const t=this.cell.getAngle();if(t){const e=this.cell.getSize();return`rotate(${t},${e.width/2},${e.height/2})`}}updateTransform(){let t=this.getTranslationString();const e=this.getRotationString();e&&(t+=` ${e}`),this.container.setAttribute("transform",t)}findPortElem(t,e){const n=t?this.portsCache[t]:null;if(!n)return null;const i=n.portContentElement,r=n.portContentSelectors||{};return this.findOne(e,i,r)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(t=>{ie(t.portElement)})}renderPorts(){const t=this.container,e=[];t.childNodes.forEach(o=>{e.push(o)});const n=this.cell.getParsedPorts(),i=lo(n,"zIndex"),r="auto";i[r]&&i[r].forEach(o=>{const a=this.getPortElement(o);t.append(a),e.push(a)}),Object.keys(i).forEach(o=>{if(o!==r){const a=parseInt(o,10);this.appendPorts(i[o],a,e)}}),this.updatePorts()}appendPorts(t,e,n){const i=t.map(r=>this.getPortElement(r));n[e]||e<0?Xn(n[Math.max(e,0)],i):Ut(this.container,i)}getPortElement(t){const e=this.portsCache[t.id];return e?e.portElement:this.createPortElement(t)}createPortElement(t){let e=ct.renderMarkup(this.cell.getPortContainerMarkup());const n=e.elem;if(n==null)throw new Error("Invalid port container markup.");e=ct.renderMarkup(this.getPortMarkup(t));const i=e.elem,r=e.selectors;if(i==null)throw new Error("Invalid port markup.");this.setAttrs({port:t.id,"port-group":t.group},i);let o="x6-port";t.group&&(o+=` x6-port-${t.group}`),B(n,o),B(n,"x6-port"),B(i,"x6-port-body"),n.appendChild(i);let a=r,l,c;if(this.existPortLabel(t)){if(e=ct.renderMarkup(this.getPortLabelMarkup(t.label)),l=e.elem,c=e.selectors,l==null)throw new Error("Invalid port label markup.");if(r&&c){for(const f in c)if(r[f]&&f!==this.rootSelector)throw new Error("Selectors within port must be unique.");a=Object.assign(Object.assign({},r),c)}B(l,"x6-port-label"),n.appendChild(l)}return this.portsCache[t.id]={portElement:n,portSelectors:a,portLabelElement:l,portLabelSelectors:c,portContentElement:i,portContentSelectors:r},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:t,node:this.cell,container:n,selectors:a,labelContainer:l,labelSelectors:c,contentContainer:i,contentSelectors:r}),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=L.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(t,e);for(let i=0,r=n.length;i<r;i+=1){const o=n[i],a=o.portId,l=this.portsCache[a]||{},c=o.portLayout;if(this.applyPortTransform(l.portElement,c),o.portAttrs!=null){const f={selectors:l.portSelectors||{}};o.portSize&&(f.rootBBox=L.fromSize(o.portSize)),this.updateAttrs(l.portElement,o.portAttrs,f)}const h=o.labelLayout;if(h&&l.portLabelElement&&(this.applyPortTransform(l.portLabelElement,h,-(c.angle||0)),h.attrs)){const f={selectors:l.portLabelSelectors||{}};o.labelSize&&(f.rootBBox=L.fromSize(o.labelSize)),this.updateAttrs(l.portLabelElement,h.attrs,f)}}}applyPortTransform(t,e,n=0){const i=e.angle,r=e.position,o=Tt().rotate(n).translate(r.x||0,r.y||0).rotate(i||0);rn(t,o,{absolute:!0})}getPortMarkup(t){return t.markup||this.cell.portMarkup}getPortLabelMarkup(t){return t.markup||this.cell.portLabelMarkup}existPortLabel(t){return t.attrs&&t.attrs.text}getEventArgs(t,e,n){const i=this,r=i.cell,o=r;return e==null||n==null?{e:t,view:i,node:r,cell:o}:{e:t,x:e,y:n,view:i,node:r,cell:o}}getPortEventArgs(t,e,n){const i=this,r=i.cell,o=r;return n?{e:t,x:n.x,y:n.y,view:i,node:r,cell:o,port:e}:{e:t,view:i,node:r,cell:o,port:e}}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("node:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("node:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("node:mouseup",this.getEventArgs(t,e,n))}notifyPortEvent(t,e,n){const i=this.findAttr("port",e.target);if(i){const r=e.type;t==="node:port:mouseenter"?e.type="mouseenter":t==="node:port:mouseleave"&&(e.type="mouseleave"),this.notify(t,this.getPortEventArgs(e,i,n)),e.type=r}}onClick(t,e,n){super.onClick(t,e,n),this.notify("node:click",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:click",t,{x:e,y:n})}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("node:dblclick",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:dblclick",t,{x:e,y:n})}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("node:contextmenu",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:contextmenu",t,{x:e,y:n})}onMouseDown(t,e,n){this.isPropagationStopped(t)||(this.notifyMouseDown(t,e,n),this.notifyPortEvent("node:port:mousedown",t,{x:e,y:n}),this.startNodeDragging(t,e,n))}onMouseMove(t,e,n){const i=this.getEventData(t),r=i.action;if(r==="magnet")this.dragMagnet(t,e,n);else{if(r==="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),r=i.action;r==="magnet"?this.stopMagnetDragging(t,e,n):(this.notifyMouseUp(t,e,n),this.notifyPortEvent("node:port:mouseup",t,{x:e,y:n}),r==="move"&&(i.targetView||this).stopNodeDragging(t,e,n));const o=i.targetMagnet;o&&this.onMagnetClick(t,o,e,n),this.checkMouseleave(t)}onMouseOver(t){super.onMouseOver(t),this.notify("node:mouseover",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseenter",t),this.notifyPortEvent("node:port:mouseover",t)}onMouseOut(t){super.onMouseOut(t),this.notify("node:mouseout",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseleave",t),this.notifyPortEvent("node:port:mouseout",t)}onMouseEnter(t){this.updateClassName(t),super.onMouseEnter(t),this.notify("node:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("node:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){super.onMouseWheel(t,e,n,i),this.notify("node:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onMagnetClick(t,e,n,i){const r=this.graph;r.view.getMouseMovedCount(t)>r.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetDblClick(t,e,n,i){this.notify("node:magnet:dblclick",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetContextMenu(t,e,n,i){this.notify("node:magnet:contextmenu",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){this.startMagnetDragging(t,n,i)}onCustomEvent(t,e,n,i){this.notify("node:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),super.onCustomEvent(t,e,n,i)}prepareEmbedding(t){const e=this.graph,i=this.getEventData(t).cell||this.cell,r=e.findViewByCell(i),o=e.snapToGrid(t.clientX,t.clientY);this.notify("node:embed",{e:t,node:i,view:r,cell:i,x:o.x,y:o.y,currentParent:i.getParent()})}processEmbedding(t,e){const n=e.cell||this.cell,i=e.graph||this.graph,r=i.options.embedding,o=r.findParent;let a=typeof o=="function"?k(o,i,{view:this,node:this.cell}).filter(u=>K.isCell(u)&&this.cell.id!==u.id&&!u.isDescendantOf(this.cell)):i.model.getNodesUnderNode(n,{by:o});if(r.frontOnly&&a.length>0){const u=lo(a,"zIndex"),d=Sm(Object.keys(u).map(g=>parseInt(g,10)));d&&(a=u[d])}a=a.filter(u=>u.visible);let l=null;const c=e.candidateEmbedView,h=r.validate;for(let u=a.length-1;u>=0;u-=1){const d=a[u];if(c&&c.cell.id===d.id){l=c;break}else{const g=d.findView(i);if(h&&k(h,i,{child:this.cell,parent:g.cell,childView:this,parentView:g})){l=g;break}}}this.clearEmbedding(e),l&&l.highlight(null,{type:"embedding"}),e.candidateEmbedView=l;const f=i.snapToGrid(t.clientX,t.clientY);this.notify("node:embedding",{e:t,cell:n,node:n,view:i.findViewByCell(n),x:f.x,y:f.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,r=i.findViewByCell(n),o=n.getParent(),a=e.candidateEmbedView;if(a?(a.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null,(o==null||o.id!==a.cell.id)&&a.cell.insertChild(n,void 0,{ui:!0})):o&&o.unembed(n,{ui:!0}),i.model.getConnectedEdges(n,{deep:!0}).forEach(l=>{l.updateParent({ui:!0})}),r&&a){const l=i.snapToGrid(t.clientX,t.clientY);r.notify("node:embedded",{e:t,cell:n,x:l.x,y:l.y,node:n,view:i.findViewByCell(n),previousParent:o,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?k(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,r=this.graph;this.setEventData(t,{targetMagnet:i}),this.validateMagnet(this,i,t)?(r.options.magnetThreshold<=0&&this.startConnectting(t,i,e,n),this.setEventData(t,{action:"magnet"}),this.stopPropagation(t)):this.onMouseDown(t,e,n),r.view.delegateDragEvents(t,this)}startConnectting(t,e,n,i){this.graph.model.startBatch("add-edge");const r=this.createEdgeFromMagnet(e,n,i);r.setEventData(t,r.prepareArrowheadDragging("target",{x:n,y:i,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(t,{edgeView:r}),r.notifyMouseDown(t,n,i)}getDefaultEdge(t,e){let n;const i=this.graph.options.connecting.createEdge;return i&&(n=k(i,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),n}createEdgeFromMagnet(t,e,n){const i=this.graph,r=i.model,o=this.getDefaultEdge(this,t);return o.setSource(Object.assign(Object.assign({},o.getSource()),this.getEdgeTerminal(t,e,n,o,"source"))),o.setTarget(Object.assign(Object.assign({},o.getTarget()),{x:e,y:n})),o.addTo(r,{async:!1,ui:!0}),o.findView(i)}dragMagnet(t,e,n){const i=this.getEventData(t),r=i.edgeView;if(r)r.onMouseMove(t,e,n),this.autoScrollGraph(t.clientX,t.clientY);else{const o=this.graph,a=o.options.magnetThreshold,l=this.getEventTarget(t),c=i.targetMagnet;if(a==="onleave"){if(c===l||c.contains(l))return}else if(o.view.getMouseMovedCount(t)<=a)return;this.startConnectting(t,c,e,n)}}stopMagnetDragging(t,e,n){const r=this.eventData(t).edgeView;r&&(r.onMouseUp(t,e,n),this.graph.model.stopBatch("add-edge"))}notifyUnhandledMouseDown(t,e,n){this.notify("node:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(t,e,n,i,r){let o=[r];const a=this.graph.getPlugin("selection");if(a&&a.isSelectionMovable()){const l=a.getSelectedCells();l.includes(r)&&(o=l.filter(c=>c.isNode()))}o.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"?k(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 r=w.create(i.cell.getPosition());i.setEventData(t,{moving:!1,offset:r.diff(e,n),restrict:this.getRestrictArea(i)})}dragNode(t,e,n){const i=this.cell,r=this.graph,o=r.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=Z.snapToGrid(e+l.x,o),f=Z.snapToGrid(n+l.y,o);i.setPosition(h,f,{restrict:c,deep:!0,ui:!0}),r.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()),r=e.getNodes().map(c=>{const h=c.getPosition();return{id:c.id,x:h.x,y:h.y}}).filter(c=>c.id!==n.id),o=[[1,1],[1,-1],[-1,1],[-1,-1]];let a=e.getGridSize();const l=c=>r.some(h=>h.x===c.x&&h.y===c.y);for(;l(n);){let c=!1;for(let h=0;h<o.length;h+=1){const f=o[h],u={x:n.x+f[0]*a,y:n.y+f[1]*a};if(!l(u)){t.translate(f[0]*a,f[1]*a),c=!0;break}}if(c)break;a+=e.getGridSize()}}stopNodeDragging(t,e,n){const i=this.getEventData(t),r=this.graph;i.embedding&&this.finalizeEmbedding(t,i),i.moving&&(r.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)}}(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&typeof i.isNodeView=="function"&&typeof i.isEdgeView=="function"&&typeof i.confirmUpdate=="function"&&typeof i.update=="function"&&typeof i.findPortElem=="function"&&typeof i.resize=="function"&&typeof i.rotate=="function"&&typeof i.translate=="function"}s.isNodeView=t})(Zt||(Zt={}));Zt.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"]}});Zt.registry.register("node",Zt,!0);var zv=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};class pe extends yt{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return pe.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const t=this.sourceView;if(!t){const n=this.cell.getSource();return new L(n.x,n.y)}const e=this.sourceMagnet;return t.isEdgeElement(e)?new L(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 L(n.x,n.y)}const e=this.targetMagnet;return t.isEdgeElement(e)?new L(this.targetAnchor.x,this.targetAnchor.y):t.getBBoxOfElement(e||t.container)}isEdgeView(){return!0}confirmUpdate(t,e={}){let n=t;if(this.hasAction(n,"source")){if(!this.updateTerminalProperties("source"))return n;n=this.removeAction(n,"source")}if(this.hasAction(n,"target")){if(!this.updateTerminalProperties("target"))return n;n=this.removeAction(n,"target")}return this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","labels","tools"]),n):(n=this.handleAction(n,"update",()=>this.update(e)),n=this.handleAction(n,"labels",()=>this.onLabelsChange(e)),n=this.handleAction(n,"tools",()=>this.renderTools()),n)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this}renderMarkup(){const t=this.cell.markup;if(t){if(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 r=e[n],o=this.labelCache[n],a=this.labelSelectors[n],l=this.graph.options.onEdgeLabelRendered;if(l){const c=l({edge:t,label:r,container:o,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],r=this.labelCache[e],o=this.labelSelectors[e];i&&r&&o&&i({edge:this.cell,label:t[e],container:r,selectors:o})}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=ee("g"),this.addClass(this.prefixClassName("edge-labels"),i),this.labelContainer=i);for(let r=0,o=e.length;r<o;r+=1){const a=e[r],l=this.normalizeLabelMarkup(this.parseLabelMarkup(a.markup));let c,h;if(l)c=l.node,h=l.selectors;else{const u=t.getDefaultLabel(),d=this.normalizeLabelMarkup(this.parseLabelMarkup(u.markup));c=d.node,h=d.selectors}c.setAttribute("data-index",`${r}`),i.appendChild(c);const f=this.rootSelector;if(h[f])throw new Error("Ambiguous label root selector.");h[f]=c,this.labelCache[r]=c,this.labelSelectors[r]=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 r=n[1];if(e[r]){if(i===2)return typeof t.propertyValue=="object"&&gi(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=z.createVectors(t),n=document.createDocumentFragment();for(let i=0,r=e.length;i<r;i+=1){const o=e[i].node;n.appendChild(o)}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=z.create("g").append(e):n=z.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 r=0,o=e.length;r<o;r+=1){const a=this.labelCache[r],l=this.labelSelectors[r];a.setAttribute("cursor",n?"move":"default");const c=e[r],h=mt({},i.attrs,c.attrs);this.updateAttrs(a,h,{selectors:l,rootBBox:c.size?L.fromSize(c.size):void 0})}}}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}update(t={}){this.cleanCache(),this.updateConnection(t);const e=this.cell.getAttrs(),{text:n}=e,i=zv(e,["text"]);return i!=null&&this.updateAttrs(this.container,i,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(t),this}removeRedundantLinearVertices(t={}){const e=this.cell,n=e.getVertices(),i=[this.sourceAnchor,...n,this.targetAnchor],r=i.length,o=new bt(i);o.simplify({threshold:.01});const a=o.points.map(c=>c.toJSON()),l=a.length;return r===l?0:(e.setVertices(a.slice(1,l-1),t),r-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 w.create(this.sourceAnchor);case"target":return w.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalConnectionPoint(t){switch(t){case"source":return w.create(this.sourcePoint);case"target":return w.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 bt(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 r=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=r.source,this.targetPoint=r.target;const o=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,o.source||this.sourcePoint,o.target||this.targetPoint)}this.cleanCache()}findAnchors(t){const e=this.cell,n=e.source,i=e.target,r=t[0],o=t[t.length-1];return i.priority&&!n.priority?this.findAnchorsOrdered("target",o,"source",r):this.findAnchorsOrdered("source",r,"target",o)}findAnchorsOrdered(t,e,n,i){let r,o;const a=this.cell,l=a[t],c=a[n],h=this.getTerminalView(t),f=this.getTerminalView(n),u=this.getTerminalMagnet(t),d=this.getTerminalMagnet(n);if(h){let g;e?g=w.create(e):f?g=d:g=w.create(c),r=this.getAnchor(l.anchor,h,u,g,t)}else r=w.create(l);if(f){const g=w.create(i||r);o=this.getAnchor(c.anchor,f,d,g,n)}else o=w.isPointLike(c)?w.create(c):new w;return{[t]:r,[n]:o}}getAnchor(t,e,n,i,r){const o=e.isEdgeElement(n),a=this.graph.options.connecting;let l=typeof t=="string"?{name:t}:t;if(!l){const f=o?(r==="source"?a.sourceEdgeAnchor:a.targetEdgeAnchor)||a.edgeAnchor:(r==="source"?a.sourceAnchor:a.targetAnchor)||a.anchor;l=typeof f=="string"?{name:f}:f}if(!l)throw new Error("Anchor should be specified.");let c;const h=l.name;if(o){const f=pn.registry.get(h);if(typeof f!="function")return pn.registry.onNotFound(h);c=k(f,this,e,n,i,l.args||{},r)}else{const f=gn.registry.get(h);if(typeof f!="function")return gn.registry.onNotFound(h);c=k(f,this,e,n,i,l.args||{},r)}return c?c.round(this.POINT_ROUNDING):new w}findRoutePoints(t=[]){const e=this.graph.options.connecting.router||Ce.presets.normal,n=this.cell.getRouter()||e;let i;if(typeof n=="function")i=k(n,this,t,{},this);else{const r=typeof n=="string"?n:n.name,o=typeof n=="string"?{}:n.args||{},a=r?Ce.registry.get(r):Ce.presets.normal;if(typeof a!="function")return Ce.registry.onNotFound(r);i=k(a,this,t,o,this)}return i==null?t.map(r=>w.create(r)):i.map(r=>w.create(r))}findConnectionPoints(t,e,n){const i=this.cell,r=this.graph.options.connecting,o=i.getSource(),a=i.getTarget(),l=this.sourceView,c=this.targetView,h=t[0],f=t[t.length-1];let u;if(l&&!l.isEdgeElement(this.sourceMagnet)){const g=this.sourceMagnet||l.container,p=h||n,m=new j(p,e),y=o.connectionPoint||r.sourceConnectionPoint||r.connectionPoint;u=this.getConnectionPoint(y,l,g,m,"source")}else u=e;let d;if(c&&!c.isEdgeElement(this.targetMagnet)){const g=this.targetMagnet||c.container,p=a.connectionPoint||r.targetConnectionPoint||r.connectionPoint,m=f||e,y=new j(m,n);d=this.getConnectionPoint(p,c,g,y,"target")}else d=n;return{source:u,target:d}}getConnectionPoint(t,e,n,i,r){const o=i.end;if(t==null)return o;const a=typeof t=="string"?t:t.name,l=typeof t=="string"?{}:t.args,c=mn.registry.get(a);if(typeof c!="function")return mn.registry.onNotFound(a);const h=k(c,this,i,e,n,l||{},r);return h?h.round(this.POINT_ROUNDING):o}findMarkerPoints(t,e,n){const i=f=>{const u=this.cell.getAttrs(),d=Object.keys(u);for(let g=0,p=d.length;g<p;g+=1){const m=u[d[g]];if(m[`${f}Marker`]||m[`${f}-marker`]){const y=m.strokeWidth||m["stroke-width"];if(y)return parseFloat(y);break}}return null},r=t[0],o=t[t.length-1];let a,l;const c=i("source");c&&(a=e.clone().move(r||n,-c));const h=i("target");return h&&(l=n.clone().move(o||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 r,o,a;if(typeof i=="string"?r=i:(r=i.name,o=i.args),r){const c=ke.registry.get(r);if(typeof c!="function")return ke.registry.onNotFound(r);a=c}else a=ke.presets.normal;const l=k(a,this,e,n,t,Object.assign(Object.assign({},o),{raw:!0}),this);return typeof l=="string"?$.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(),r=this.normalizeLabelPosition(i.position);for(let o=0,a=n.length;o<a;o+=1){const l=n[o],c=this.labelCache[o];if(!c)continue;const h=this.normalizeLabelPosition(l.position),f=mt({},r,h),u=this.getLabelTransformationMatrix(f);c.setAttribute("transform",Tn(u))}return this}updateTerminalProperties(t){const e=this.cell,n=this.graph,i=e[t],r=i&&i.cell,o=`${t}View`;if(!r)return this[o]=null,this.updateTerminalMagnet(t),!0;const a=n.getCellById(r);if(!a)throw new Error(`Edge's ${t} node with id "${r}" not exists`);const l=a.findView(n);return l?(this[o]=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:mt({},e,t)}getConnection(){return this.path!=null?this.path.clone():null}getConnectionPathData(){if(this.path==null)return"";const t=this.cache.pathCache;return gi(t,"data")||(t.data=this.path.serialize()),t.data||""}getConnectionSubdivisions(){if(this.path==null)return null;const t=this.cache.pathCache;return gi(t,"segmentSubdivisions")||(t.segmentSubdivisions=this.path.getSegmentSubdivisions()),t.segmentSubdivisions}getConnectionLength(){if(this.path==null)return 0;const t=this.cache.pathCache;return gi(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:(de(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 r={distance:0};let o=0,a;typeof n=="number"?(o=n,a=i):a=n,a!=null&&(r.options=a);const l=a&&a.absoluteOffset,c=!(a&&a.absoluteDistance),h=a&&a.absoluteDistance&&a.reverseDistance,f=this.path,u={segmentSubdivisions:this.getConnectionSubdivisions()},d=new w(t,e),g=f.closestPointT(d,u),p=this.getConnectionLength()||0;let m=f.lengthAtT(g,u);c&&(m=p>0?m/p:0),h&&(m=-1*(p-m)||1),r.distance=m;let y;l||(y=f.tangentAtT(g));let x;if(y)x=y.pointOffset(d);else{const b=f.pointAtT(g),v=d.diff(b);x={x:v.x,y:v.y}}return r.offset=x,r.angle=o,r}normalizeLabelPosition(t){return typeof t=="number"?{distance:t}:t}getLabelTransformationMatrix(t){const e=this.normalizeLabelPosition(t),n=e.options||{},i=e.angle||0,r=e.distance,o=r>0&&r<=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,f=n.keepGradient,u=n.ensureLegibility,d=this.path,g={segmentSubdivisions:this.getConnectionSubdivisions()},p=o?r*this.getConnectionLength():r,m=d.tangentAtLength(p,g);let y,x=i;if(m){if(h)y=m.start,y.translate(l);else{const b=m.clone();b.rotate(-90,m.start),b.setLength(a),y=b.end}f&&(x=m.angle()+i,u&&(x=W.normalize((x+90)%180-90)))}else y=d.start,h&&y.translate(l);return Tt().translate(y.x,y.y).rotate(x)}getVertexIndex(t,e){const i=this.cell.getVertices(),r=this.getClosestPointLength(new w(t,e));let o=0;if(r!=null)for(const a=i.length;o<a;o+=1){const l=i[o],c=this.getClosestPointLength(l);if(c!=null&&r<c)break}return o}getEventArgs(t,e,n){const i=this,r=i.cell,o=r;return e==null||n==null?{e:t,view:i,edge:r,cell:o}:{e:t,x:e,y:n,view:i,edge:r,cell:o}}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(hl(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:Ns(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,r=0;t==="source"?(i=2,n="target"):(r=2,n="source");const o=this.cell[n],a=o.cell;if(a){let l;const c=e[i]=this.graph.findViewByCell(a);c&&(l=c.getMagnetFromEdgeTerminal(o),l===c.container&&(l=void 0)),e[i+1]=l}return(l,c)=>(e[r]=l,e[r+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,r,o,a){const l=this.graph.options.connecting,c=l.allowLoop,h=l.allowNode,f=l.allowEdge,u=l.allowPort,d=l.allowMulti,g=l.validateConnection,p=o?o.cell:null,m=r==="target"?n:t,y=r==="target"?i:e;let x=!0;const b=v=>{const C=r==="source"?a?a.port:null:p?p.getSourcePortId():null,S=r==="target"?a?a.port:null:p?p.getTargetPortId():null;return k(v,this.graph,{edge:p,edgeView:o,sourceView:t,targetView:n,sourcePort:C,targetPort:S,sourceMagnet:e,targetMagnet:i,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:r})};if(c!=null&&(typeof c=="boolean"?!c&&t===n&&(x=!1):x=b(c)),x&&u!=null&&(typeof u=="boolean"?!u&&y&&(x=!1):x=b(u)),x&&f!=null&&(typeof f=="boolean"?!f&&pe.isEdgeView(m)&&(x=!1):x=b(f)),x&&h!=null&&y==null&&(typeof h=="boolean"?!h&&Zt.isNodeView(m)&&(x=!1):x=b(h)),x&&d!=null&&o){const v=o.cell,C=r==="source"?a:v.getSource(),S=r==="target"?a:v.getTarget(),P=a?this.graph.getCellById(a.cell):null;if(C&&S&&C.cell&&S.cell&&P)if(typeof d=="function")x=b(d);else{const O=this.graph.model.getConnectedEdges(P,{outgoing:r==="source",incoming:r==="target"});O.length&&(d==="withPort"?O.some(R=>{const T=R.getSource(),I=R.getTarget();return T&&I&&T.cell===C.cell&&I.cell===S.cell&&T.port!=null&&T.port===C.port&&I.port!=null&&I.port===S.port})&&(x=!1):d||O.some(R=>{const T=R.getSource(),I=R.getTarget();return T&&I&&T.cell===C.cell&&I.cell===S.cell})&&(x=!1))}}return x&&g!=null&&(x=b(g)),x}allowConnectToBlank(t){const e=this.graph,i=e.options.connecting.allowBlank;if(typeof i!="function")return!!i;const r=e.findViewByCell(t),o=t.getSourceCell(),a=t.getTargetCell(),l=e.findViewByCell(o),c=e.findViewByCell(a);return k(i,e,{edge:t,edgeView:r,sourceCell:o,targetCell:a,sourceView:l,targetView:c,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:r.sourceMagnet,targetMagnet:r.targetMagnet})}validateEdge(t,e,n){const i=this.graph;if(!this.allowConnectToBlank(t)){const o=t.getSourceCellId(),a=t.getTargetCellId();if(!(o&&a))return!1}const r=i.options.connecting.validateEdge;return r?k(r,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,r=t.currentMagnet;if(!r||!i)return;i.unhighlight(r,{type:"magnetAdsorbed"});const o=t.terminalType,a=i.getEdgeTerminal(r,e,n,this.cell,o);this.cell.setTerminal(o,a,{ui:!0})}snapArrowhead(t,e,n){const i=this.graph,{snap:r,allowEdge:o}=i.options.connecting,a=typeof r=="object"&&r.radius||50,l=typeof r=="object"&&r.anchor||"center",c=i.renderer.findViewsInArea({x:t-a,y:e-a,width:2*a,height:2*a},{nodeOnly:!0});if(o){const v=i.renderer.findEdgeViewsFromPoint({x:t,y:e},a).filter(C=>C!==this);c.push(...v)}const h=n.closestView||null,f=n.closestMagnet||null;n.closestView=null,n.closestMagnet=null;let u,d=Number.MAX_SAFE_INTEGER;const g=new w(t,e);c.forEach(v=>{if(v.container.getAttribute("magnet")!=="false"){if(v.isNodeView())u=l==="center"?v.cell.getBBox().getCenter().distance(g):v.cell.getBBox().getNearestPointToPoint(g).distance(g);else if(v.isEdgeView()){const C=v.getClosestPoint(g);C?u=C.distance(g):u=Number.MAX_SAFE_INTEGER}u<a&&u<d&&(f===v.container||this.validateConnection(...n.getValidateConnectionArgs(v,null),v.getEdgeTerminal(v.container,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=v,n.closestMagnet=v.container)}v.container.querySelectorAll("[magnet]").forEach(C=>{if(C.getAttribute("magnet")!=="false"){const S=v.getBBoxOfElement(C);u=g.distance(S.getCenter()),u<a&&u<d&&(f===C||this.validateConnection(...n.getValidateConnectionArgs(v,C),v.getEdgeTerminal(C,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=v,n.closestMagnet=C)}})});let p;const m=n.terminalType,y=n.closestView,x=n.closestMagnet,b=f!==x;if(h&&b&&h.unhighlight(f,{type:"magnetAdsorbed"}),y){if(!b)return;y.highlight(x,{type:"magnetAdsorbed"}),p=y.getEdgeTerminal(x,t,e,this.cell,m)}else p={x:t,y:e};this.cell.setTerminal(m,p,{},Object.assign(Object.assign({},n.options),{ui:!0}))}snapArrowheadEnd(t){const e=t.closestView,n=t.closestMagnet;e&&n&&(e.unhighlight(n,{type:"magnetAdsorbed"}),t.currentMagnet=e.findMagnet(n)),t.closestView=null,t.closestMagnet=null}finishEmbedding(t){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(t.zIndex=null)}fallbackConnection(t){switch(t.fallbackAction){case"remove":this.cell.remove({ui:!0});break;case"revert":default:this.cell.prop(t.terminalType,t.initialTerminal,{ui:!0});break}}notifyConnectionEvent(t,e){const n=t.terminalType,i=t.initialTerminal,r=this.cell[n];if(r&&!ft.equalTerminals(i,r)){const a=this.graph,l=i,c=l.cell?a.getCellById(l.cell):null,h=l.port,f=c?a.findViewByCell(c):null,u=c||t.isNewEdge?null:w.create(i).toJSON(),d=r,g=d.cell?a.getCellById(d.cell):null,p=d.port,m=g?a.findViewByCell(g):null,y=g?null:w.create(r).toJSON();this.notify("edge:connected",{e,previousCell:c,previousPort:h,previousView:f,previousPoint:u,currentCell:g,currentView:m,currentPort:p,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,r=n.length;i<r;i+=1){const o=e.findViewByCell(n[i]);if(!o||o.cell.id===this.cell.id)continue;const a=Array.prototype.slice.call(o.container.querySelectorAll("[magnet]"));o.container.getAttribute("magnet")!=="false"&&a.push(o.container);const l=a.filter(c=>this.validateConnection(...t.getValidateConnectionArgs(o,c),o.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)o.highlight(l[c],{type:"magnetAvailable"});o.highlight(null,{type:"nodeAvailable"}),t.marked[o.cell.id]=l}}}unhighlightAvailableMagnets(t){const e=t.marked||{};Object.keys(e).forEach(n=>{const i=this.graph.findViewByCell(n);i&&(e[n].forEach(o=>{i.unhighlight(o,{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 r=t.target.getAttribute("data-terminal"),o=this.prepareArrowheadDragging(r,{x:e,y:n});this.setEventData(t,o)}dragArrowhead(t,e,n){const i=this.getEventData(t);this.graph.options.connecting.snap?this.snapArrowhead(e,n,i):this.arrowheadDragging(this.getEventTarget(t),e,n,i)}stopArrowheadDragging(t,e,n){const i=this.graph,r=this.getEventData(t);i.options.connecting.snap?this.snapArrowheadEnd(r):this.arrowheadDragged(r,e,n),this.validateEdge(this.cell,r.terminalType,r.initialTerminal)?(this.finishEmbedding(r),this.notifyConnectionEvent(r,t)):this.fallbackConnection(r),this.afterArrowheadDragging(r)}startLabelDragging(t,e,n){if(this.can("edgeLabelMovable")){const i=t.currentTarget,r=parseInt(i.getAttribute("data-index"),10),o=this.getLabelPositionAngle(r),a=this.getLabelPositionArgs(r),l=this.getDefaultLabelPositionArgs(),c=this.mergeLabelPositionArgs(a,l);this.setEventData(t,{index:r,positionAngle:o,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),r=this.cell.getLabelAt(i.index),o=mt({},r,{position:this.getLabelPosition(e,n,i.positionAngle,i.positionArgs)});this.cell.setLabelAt(i.index,o)}stopLabelDragging(t,e,n){}}(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag],i=e;return(n==null||n===s.toStringTag)&&typeof i.isNodeView=="function"&&typeof i.isEdgeView=="function"&&typeof i.confirmUpdate=="function"&&typeof i.update=="function"&&typeof i.getConnection=="function"}s.isEdgeView=t})(pe||(pe={}));pe.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"]}});pe.registry.register("edge",pe,!0);var Vv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Qt extends q{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(t){super(),this.graph=t;const{selectors:e,fragment:n}=ct.parseJSONMarkup(Qt.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=Qt.snapshoot(this.container),B(this.container,this.prefixClassName("graph")),Ut(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&&K.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=k(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 r=this.normalizeEvent(t),o=this.graph.snapToGrid(r.clientX,r.clientY),a=e.currentView;a?a.onMouseMove(r,o.x,o.y):this.graph.trigger("blank:mousemove",{e:r,x:o.x,y:o.y}),this.setEventData(r,e)}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY),r=this.getEventData(t).currentView;if(r?r.onMouseUp(e,n.x,n.y):this.graph.trigger("blank:mouseup",{e,x:n.x,y:n.y}),!t.isPropagationStopped()){const o=new se(t,{type:"click",data:t.data});this.onClick(o)}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,r=this.graph.snapToGrid(i.clientX,i.clientY),o=Math.max(-1,Math.min(1,i.wheelDelta||-i.detail));n?n.onMouseWheel(e,r.x,r.y,o):this.graph.trigger("blank:mousewheel",{e,delta:o,x:r.x,y:r.y})}onCustomEvent(t){const e=t.currentTarget,n=e.getAttribute("event")||e.getAttribute("data-event");if(n){const i=this.findView(e);if(i){const r=this.normalizeEvent(t);if(this.guard(r,i))return;const o=this.graph.snapToGrid(r.clientX,r.clientY);i.onCustomEvent(r,n,o.x,o.y)}}}handleMagnetEvent(t,e){const n=t.currentTarget,i=n.getAttribute("magnet");if(i&&i.toLowerCase()!=="false"){const r=this.findView(n);if(r){const o=this.normalizeEvent(t);if(this.guard(o,r))return;const a=this.graph.snapToGrid(o.clientX,o.clientY);k(e,this.graph,r,o,n,a.x,a.y)}}}onMagnetMouseDown(t){this.handleMagnetEvent(t,(e,n,i,r,o)=>{e.onMagnetMouseDown(n,i,r,o)})}onMagnetDblClick(t){this.handleMagnetEvent(t,(e,n,i,r,o)=>{e.onMagnetDblClick(n,i,r,o)})}onMagnetContextMenu(t){const e=this.findView(t.target);this.isPreventDefaultContextMenu(e)&&t.preventDefault(),this.handleMagnetEvent(t,(n,i,r,o,a)=>{n.onMagnetContextMenu(i,r,o,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 r=this.graph.snapToGrid(i.clientX,i.clientY);n.onLabelMouseDown(i,r.x,r.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}Vv([q.dispose()],Qt.prototype,"dispose",null);(function(s){const t=`${Vt.prefixCls}-graph`;s.markup=[{ns:At.xhtml,tagName:"div",selector:"background",className:`${t}-background`},{ns:At.xhtml,tagName:"div",selector:"grid",className:`${t}-grid`},{ns:At.svg,tagName:"svg",selector:"svg",className:`${t}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":At.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${t}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${t}-svg-primer`},{tagName:"g",selector:"stage",className:`${t}-svg-stage`},{tagName:"g",selector:"decorator",className:`${t}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${t}-svg-overlay`}]}]}];function e(n){const i=n.cloneNode();return n.childNodes.forEach(r=>i.appendChild(r)),()=>{for(ci(n);n.attributes.length>0;)n.removeAttribute(n.attributes[0].name);for(let r=0,o=i.attributes.length;r<o;r+=1){const a=i.attributes[r];n.setAttribute(a.name,a.value)}i.childNodes.forEach(r=>n.appendChild(r))}}s.snapshoot=e})(Qt||(Qt={}));(function(s){const t=Vt.prefixCls;s.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${t}-cell`]:"onMouseEnter",[`mouseleave .${t}-cell`]:"onMouseLeave",[`mouseenter .${t}-cell-tools`]:"onMouseEnter",[`mouseleave .${t}-cell-tools`]:"onMouseLeave",[`mousedown .${t}-cell [event]`]:"onCustomEvent",[`touchstart .${t}-cell [event]`]:"onCustomEvent",[`mousedown .${t}-cell [data-event]`]:"onCustomEvent",[`touchstart .${t}-cell [data-event]`]:"onCustomEvent",[`dblclick .${t}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${t}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${t}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${t}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${t}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${t}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${t}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${t}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${t}-cell image`]:"onImageDragStart",[`mousedown .${t}-edge .${t}-edge-label`]:"onLabelMouseDown",[`touchstart .${t}-edge .${t}-edge-label`]:"onLabelMouseDown"},s.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}})(Qt||(Qt={}));const _v=`.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
+ }
241
+ .x6-edge-tool-editor {
242
+ border: 1px solid #275fc5;
243
+ border-radius: 2px;
244
+ }
245
+ `;class Nt extends Dt{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(t){super(),this.graph=t,this.init()}init(){}}var Fv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Us extends Nt{init(){Ue("core",_v)}dispose(){We("core")}}Fv([Us.dispose()],Us.prototype,"dispose",null);var Gv=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},si;(function(s){function t(e){const{grid:n,panning:i,mousewheel:r,embedding:o}=e,a=Gv(e,["grid","panning","mousewheel","embedding"]),l=e.container;if(l!=null)a.width==null&&(a.width=l.clientWidth),a.height==null&&(a.height=l.clientHeight);else throw new Error("Ensure the container of the graph is specified and valid");const c=mt({},s.defaults,a),h={size:10,visible:!1};return typeof n=="number"?c.grid={size:n,visible:!1}:typeof n=="boolean"?c.grid=Object.assign(Object.assign({},h),{visible:n}):c.grid=Object.assign(Object.assign({},h),n),["panning","mousewheel","embedding"].forEach(u=>{const d=e[u];typeof d=="boolean"?c[u].enabled=d:c[u]=Object.assign(Object.assign({},c[u]),d)}),c}s.get=t})(si||(si={}));(function(s){s.defaults={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!1,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:Vt.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:Vt.prefix("available-magnet")}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",router:"normal",connector:"normal",validateConnection({type:t,sourceView:e,targetView:n}){return(t==="target"?n:e)!=null},createEdge(){return new Dv}},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}})(si||(si={}));var Hv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},qv=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};class Sr extends Nt{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}setVisible(t){this.grid.visible!==t&&(this.grid.visible=t,this.update())}getGridSize(){return this.grid.size}setGridSize(t){this.grid.size=Math.max(t,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=""}draw(t){this.clear(),this.instance=null,Object.assign(this.grid,t),this.patterns=this.resolveGrid(t),this.update()}update(t={}){const e=this.grid.size;if(e<=1||!this.grid.visible)return this.clear();const n=this.graph.matrix(),i=this.getInstance(),r=Array.isArray(t)?t:[t];this.patterns.forEach((l,c)=>{const h=`pattern_${c}`,f=n.a||1,u=n.d||1,{update:d,markup:g}=l,p=qv(l,["update","markup"]),m=Object.assign(Object.assign(Object.assign({},p),r[c]),{sx:f,sy:u,ox:n.e||0,oy:n.f||0,width:e*f,height:e*u});i.has(h)||i.add(h,z.create("pattern",{id:h,patternUnits:"userSpaceOnUse"},z.createVectors(g)).node);const y=i.get(h);typeof d=="function"&&d(y.childNodes[0],m);let x=m.ox%m.width;x<0&&(x+=m.width);let b=m.oy%m.height;b<0&&(b+=m.height),X(y,{x,y:b,width:m.width,height:m.height})});const o=new XMLSerializer().serializeToString(i.root),a=`url(data:image/svg+xml;base64,${btoa(o)})`;this.elem.style.backgroundImage=a}getInstance(){return this.instance||(this.instance=new we),this.instance}resolveGrid(t){if(!t)return[];const e=t.type;if(e==null)return[Object.assign(Object.assign({},we.presets.dot),t.args)];const n=we.registry.get(e);if(n){let i=t.args||[];return Array.isArray(i)||(i=[i]),Array.isArray(n)?n.map((r,o)=>Object.assign(Object.assign({},r),i[o])):[Object.assign(Object.assign({},n),i[0])]}return we.registry.onNotFound(e)}dispose(){this.stopListening(),this.clear()}}Hv([Nt.dispose()],Sr.prototype,"dispose",null);class xc extends Nt{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),Tt(this.viewportMatrix)}setMatrix(t){const e=Tt(t);e.a=Number.isFinite(e.a)?e.a:1,e.b=Number.isFinite(e.b)?e.b:0,e.c=Number.isFinite(e.c)?e.c:0,e.d=Number.isFinite(e.d)?e.d:1,e.e=Number.isFinite(e.e)?e.e:0,e.f=Number.isFinite(e.f)?e.f:0;const n=Tn(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 r=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},r)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return Is(t)||(t=this.container.clientWidth),Is(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return Vb(this.getMatrix())}scale(t,e=t,n=0,i=0){if(t=this.clampScale(t),e=this.clampScale(e),n||i){const l=this.getTranslation(),c=l.tx-n*(t-1),h=l.ty-i*(e-1);(c!==l.tx||h!==l.ty)&&this.translate(c,h)}const r=this.getMatrix(),o=Number.isFinite(t)?t:1,a=Number.isFinite(e)?e:1;return r.a=o,r.d=a,this.setMatrix(r),this.graph.trigger("scale",{sx:o,sy:a,ox:n,oy:i}),this}clampScale(t){const e=this.graph.options.scaling;return kt(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,i=t;const r=this.getScale(),o=this.getComputedSize();let a=o.width/2,l=o.height/2;if(e.absolute||(n+=r.sx,i+=r.sy),e.scaleGrid&&(n=Math.round(n/e.scaleGrid)*e.scaleGrid,i=Math.round(i/e.scaleGrid)*e.scaleGrid),e.maxScale&&(n=Math.min(e.maxScale,n),i=Math.min(e.maxScale,i)),e.minScale&&(n=Math.max(e.minScale,n),i=Math.max(e.minScale,i)),e.center&&(a=e.center.x,l=e.center.y),n=this.clampScale(n),i=this.clampScale(i),n=Number.isFinite(n)?n:r.sx,i=Number.isFinite(i)?i:r.sy,a||l){const c=this.getTranslation(),h=r.sx===0?1:r.sx,f=r.sy===0?1:r.sy,u=a-(a-c.tx)*(n/h),d=l-(l-c.ty)*(i/f);(u!==c.tx||d!==c.ty)&&this.translate(u,d)}return this.scale(n,i),this}getRotation(){return _b(this.getMatrix())}rotate(t,e,n){if(e==null||n==null){const r=Q.getBBox(this.stage);e=r.width/2,n=r.height/2}const i=this.getMatrix().translate(e,n).rotate(t).translate(-e,-n);return this.setMatrix(i),this}getTranslation(){return Fb(this.getMatrix())}translate(t,e){const n=this.getMatrix();n.e=Number.isFinite(t)?t:0,n.f=Number.isFinite(e)?e:0,this.setMatrix(n);const 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 b=t;t=b.gridWidth||1,e=b.gridHeight||1,n=b.padding||0,i=b}else t=t||1,e=e||1,n=n||0,i==null&&(i={});const r=Yt(n),o=i.border||0,a=i.contentArea?L.create(i.contentArea):this.getContentArea(i);o>0&&a.inflate(o);const l=this.getScale(),c=this.getTranslation(),h=l.sx,f=l.sy;a.x*=h,a.y*=f,a.width*=h,a.height*=f;let u=Math.max(Math.ceil((a.width+a.x)/t),1)*t,d=Math.max(Math.ceil((a.height+a.y)/e),1)*e,g=0,p=0;(i.allowNewOrigin==="negative"&&a.x<0||i.allowNewOrigin==="positive"&&a.x>=0||i.allowNewOrigin==="any")&&(g=Math.ceil(-a.x/t)*t,g+=r.left,u+=g),(i.allowNewOrigin==="negative"&&a.y<0||i.allowNewOrigin==="positive"&&a.y>=0||i.allowNewOrigin==="any")&&(p=Math.ceil(-a.y/e)*e,p+=r.top,d+=p),u+=r.right,d+=r.bottom,u=Math.max(u,i.minWidth||0),d=Math.max(d,i.minHeight||0),u=Math.min(u,i.maxWidth||Number.MAX_SAFE_INTEGER),d=Math.min(d,i.maxHeight||Number.MAX_SAFE_INTEGER);const m=this.getComputedSize(),y=u!==m.width||d!==m.height;return(g!==c.tx||p!==c.ty)&&this.translate(g,p),y&&this.resize(u,d),new L(-g/h,-p/f,u/h,d/f)}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=w.create(y)}else n=this.getContentBBox(t),i=this.graph.graphToLocal(n);if(!n.width||!n.height)return;const r=Yt(t.padding),o=t.minScale||0,a=t.maxScale||Number.MAX_SAFE_INTEGER,l=t.minScaleX||o,c=t.maxScaleX||a,h=t.minScaleY||o,f=t.maxScaleY||a;let u;if(t.viewportArea)u=t.viewportArea;else{const y=this.getComputedSize(),x=this.getTranslation();u={x:x.tx,y:x.ty,width:y.width,height:y.height}}u=L.create(u).moveAndExpand({x:r.left,y:r.top,width:-r.left-r.right,height:-r.top-r.bottom});const d=this.getScale();let g=u.width/n.width*d.sx,p=u.height/n.height*d.sy;t.preserveAspectRatio!==!1&&(g=p=Math.min(g,p));const m=t.scaleGrid;if(m&&(g=m*Math.floor(g/m),p=m*Math.floor(p/m)),g=kt(g,l,c),p=kt(p,h,f),this.scale(g,p),e){const y=this.options,x=u.x-i.x*g-y.x,b=u.y-i.y*p-y.y;this.translate(x,b)}}getContentArea(t={}){return t.useCellGeometry!==!1?this.model.getAllCellsBBox()||new L:Q.getBBox(this.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){const t=L.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){const n=L.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 r=n.getCenter();return this.centerPoint(r.x,r.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){const n=this.getComputedSize(),i=this.getScale(),r=this.getTranslation(),o=n.width/2,a=n.height/2;t=typeof t=="number"?t:o,e=typeof e=="number"?e:a,t=o-t*i.sx,e=a-e*i.sy,(r.tx!==t||r.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 r=this.getTranslation(),o=this.getScale(),a=e-t.x*o.sx,l=n-t.y*o.sy;(r.tx!==a||r.ty!==l)&&this.translate(a,l)}positionRect(t,e){const n=L.create(t);switch(e){case"center":return this.positionPoint(n.getCenter(),"50%","50%");case"top":return this.positionPoint(n.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(n.getTopRight(),"100%",0);case"right":return this.positionPoint(n.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(n.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(n.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(n.getBottomLeft(),0,"100%");case"left":return this.positionPoint(n.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(n.getTopLeft(),0,0);default:return this}}positionCell(t,e){const n=t.getBBox();return this.positionRect(n,e)}positionContent(t,e){const n=this.graph.getContentArea(e);return this.positionRect(n,t)}}var Uv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class fs extends Nt{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}updateBackgroundImage(t={}){let e=t.size||"auto auto",n=t.position||"center";const i=this.graph.transform.getScale(),r=this.graph.translate();if(typeof n=="object"){const o=r.tx+i.sx*(n.x||0),a=r.ty+i.sy*(n.y||0);n=`${o}px ${a}px`}typeof e=="object"&&(e=L.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 r=e.opacity,o=e.size;let a=e.repeat||"no-repeat";const l=Qn.registry.get(a);if(typeof l=="function"){const h=e.quality||1;t.width*=h,t.height*=h;const f=l(t,e);if(!(f instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");i=f.toDataURL("image/png"),e.repeat&&a!==e.repeat?a=e.repeat:a="repeat",typeof o=="object"?(o.width*=f.width/t.width,o.height*=f.height/t.height):o===void 0&&(e.size={width:f.width/h,height:f.height/h})}else i=t.src,o===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=Ns(e.size));const c=this.elem.style;c.backgroundImage=`url(${i})`,c.backgroundRepeat=a,c.opacity=r==null||r>=1?"":`${r}`,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=Ns(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()}}Uv([Nt.dispose()],fs.prototype,"dispose",null);var Wv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Or extends Nt{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),st.on(this.graph.container,"mousedown",this.onRightMouseDown),st.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new Pl(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),st.off(this.graph.container,"mousedown",this.onRightMouseDown),st.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(t,e){return t.spaceKey=this.isSpaceKeyPressed,this.pannable&&ge.isMatch(t,this.widgetOptions.modifiers,e)}startPanning(t){const e=this.view.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.panning=!0,this.updateClassName(t),st.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)}),st.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),st.off(document.body,".panning"),st.off(window,".panning")}updateClassName(t){const e=this.widgetOptions.eventTypes;if(e?.length===1&&e.includes("mouseWheel"))return;const n=this.view.container,i=this.view.prefixClassName("graph-panning"),r=this.view.prefixClassName("graph-pannable"),o=this.graph.getPlugin("selection"),a=o&&o.allowRubberband(t,!0),l=e?.includes("leftMouseDown")&&!a;this.allowPanning(t??{},!0)||this.allowPanning(t??{})&&l?this.panning?(B(n,i),pt(n,r)):(pt(n,i),B(n,r)):this.panning||(pt(n,i),pt(n,r))}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?.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 e?.includes("leftMouseDown")&&t.button===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 r=0,o=0;t<=i.left+10&&(r=-10),e<=i.top+10&&(o=-10),t>=i.right-10&&(r=10),e>=i.bottom-10&&(o=10),(r!==0||o!==0)&&this.graph.translateBy(-r,-o)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}Wv([Nt.dispose()],Or.prototype,"dispose",null);var Xv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Er extends Nt{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 Pl(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))&&ge.isMatch(t,this.widgetOptions.modifiers)}onMouseWheel(t){const e=this.widgetOptions.guard;if((e==null||e(t))&&ge.isMatch(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 r=this.currentScale;let o=this.graph.transform.clampScale(r*this.cumulatedFactor);const a=this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,l=this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER;if(o=kt(o,a,l),o!==r)if(this.widgetOptions.zoomAtMousePosition){const h=!!this.graph.getPlugin("scroller")?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(o,{absolute:!0,center:h.clone()})}else this.graph.zoom(o,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}Xv([Dt.dispose()],Er.prototype,"dispose",null);var Yv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class vc extends Nt{init(){this.resetRenderArea=Gm(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this)}enableVirtualRender(){this.options.virtual=!0,this.resetRenderArea()}disableVirtualRender(){this.options.virtual=!1,this.graph.renderer.setRenderArea(void 0)}resetRenderArea(){if(this.options.virtual){const t=this.graph.getGraphArea();this.graph.renderer.setRenderArea(t)}}dispose(){this.stopListening()}}Yv([Nt.dispose()],vc.prototype,"dispose",null);class Jv{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(t){if(t.priority&ce.PRIOR)t.cb();else{const e=this.findInsertionIndex(t);e>=0&&this.queue.splice(e,0,t)}}queueFlush(){!this.isFlushing&&!this.isFlushPending&&(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){!this.isFlushing&&!this.isFlushPending&&(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(){this.isFlushPending=!1,this.isFlushing=!0;const t=this.getCurrentTime();let e;for(;(e=this.queue.shift())&&(e.cb(),!(this.getCurrentTime()-t>=this.frameInterval)););this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){this.isFlushPending=!1,this.isFlushing=!0;let t;for(;t=this.queue.shift();)try{t.cb()}catch(e){console.log(e)}this.isFlushing=!1}findInsertionIndex(t){let e=0,n=this.queue.length,i=n-1;const r=t.priority;for(;e<=i;){const o=(i-e>>1)+e;r<=this.queue[o].priority?e=o+1:(n=o,i=o-1)}return n}scheduleJob(){"requestIdleCallback"in window?(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.requestIdleCallback(this.flushJobs.bind(this),{timeout:100})):(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.setTimeout(this.flushJobs.bind(this)))}cancelScheduleJob(){"cancelIdleCallback"in window?(this.scheduleId&&window.cancelIdleCallback(this.scheduleId),this.scheduleId=0):(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduleId=0)}getCurrentTime(){return typeof performance=="object"&&typeof performance.now=="function"?performance.now():Date.now()-this.initialTime}}var ce;(function(s){s[s.Update=2]="Update",s[s.RenderEdge=4]="RenderEdge",s[s.RenderNode=8]="RenderNode",s[s.PRIOR=1048576]="PRIOR"})(ce||(ce={}));var Kv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Ot extends Dt{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(t){super(),this.views={},this.willRemoveViews={},this.queue=new Jv,this.graph=t,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on("reseted",this.onModelReseted,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("reseted",this.onModelReseted,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}onModelReseted({options:t}){this.queue.clearJobs(),this.removeZPivots(),this.resetViews();const e=this.model.getCells();this.renderViews(e,Object.assign(Object.assign({},t),{queue:e.map(n=>n.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,Ot.FLAG_INSERT,e,ce.Update,!0)}onCellVisibleChanged({cell:t,current:e}){this.toggleVisible(t,!!e)}requestViewUpdate(t,e,n={},i=ce.Update,r=!0){const o=t.cell.id,a=this.views[o];if(!a)return;a.flag=e,a.options=n,(t.hasAction(e,["translate","resize","rotate"])||n.async===!1)&&(i=ce.PRIOR,r=!1),this.queue.queueJob({id:o,priority:i,cb:()=>{this.renderViewInArea(t,e,n);const h=n.queue;if(h){const f=h.indexOf(t.cell.id);f>=0&&h.splice(f,1),h.length===0&&this.graph.trigger("render:done")}}}),this.getEffectedEdges(t).forEach(h=>{this.requestViewUpdate(h.view,h.flag,n,i,!1)}),r&&this.flush()}setRenderArea(t){this.renderArea=t,this.flushWaitingViews()}isViewMounted(t){if(t==null)return!1;const e=this.views[t.cell.id];return e?e.state===Ot.ViewState.MOUNTED:!1}renderViews(t,e={}){t.sort((n,i)=>n.isNode()&&i.isEdge()?-1:0),t.forEach(n=>{const i=n.id,r=this.views;let o=0,a=r[i];if(a)o=Ot.FLAG_INSERT;else{const l=this.createCellView(n);l&&(l.graph=this.graph,o=Ot.FLAG_INSERT|l.getBootstrapFlag(),a={view:l,flag:o,options:e,state:Ot.ViewState.CREATED},this.views[i]=a)}a&&this.requestViewUpdate(a.view,o,e,this.getRenderPriority(a.view),!1)}),this.flush()}renderViewInArea(t,e,n={}){const i=t.cell,r=i.id,o=this.views[r];if(!o)return;let a=0;this.isUpdatable(t)?(a=this.updateView(t,e,n),o.flag=a):o.state===Ot.ViewState.MOUNTED?(a=this.updateView(t,e,n),o.flag=a):o.state=Ot.ViewState.WAITING,a&&i.isEdge()&&!(a&t.getFlag(["source","target"]))&&this.queue.queueJob({id:r,priority:ce.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===Ot.ViewState.WAITING){const{view:e,flag:n,options:i}=t;this.requestViewUpdate(e,n,i,this.getRenderPriority(e),!1)}}),this.flush()}updateView(t,e,n={}){if(t==null)return 0;if(yt.isCellView(t)){if(e&Ot.FLAG_REMOVE)return this.removeView(t.cell),0;e&Ot.FLAG_INSERT&&(this.insertView(t),e^=Ot.FLAG_INSERT)}return e?t.confirmUpdate(e,n):0}insertView(t){const e=this.views[t.cell.id];if(e){const n=t.cell.getZIndex(),i=this.addZPivot(n);this.container.insertBefore(t.container,i),t.cell.isVisible()||this.toggleVisible(t.cell,!1),e.state=Ot.ViewState.MOUNTED,this.graph.trigger("view:mounted",{view:t})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach(t=>{t&&this.removeView(t.view)}),this.views={},this.willRemoveViews={}}removeView(t){const e=t.cell,n=this.willRemoveViews[e.id];n&&t&&(n.view.remove(),delete this.willRemoveViews[e.id],this.graph.trigger("view:unmounted",{view:t}))}toggleVisible(t,e){const n=this.model.getConnectedEdges(t);for(let r=0,o=n.length;r<o;r+=1){const a=n[r];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&&J(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 o in e){const a=+o;a<t&&a>i&&(i=a,t-1)}const r=this.container;if(i!==-1/0){const o=e[i];r.insertBefore(n,o.nextSibling)}else r.insertBefore(n,r.firstChild);return n}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this.zPivots={}}createCellView(t){const e={graph:this.graph},n=this.graph.options.createCellView;if(n){const r=k(n,this.graph,t);if(r)return new r(t,e);if(r===null)return null}const i=t.view;if(i!=null&&typeof i=="string"){const r=yt.registry.get(i);return r?new r(t,e):yt.registry.onNotFound(i)}return t.isNode()?new Zt(t,e):t.isEdge()?new pe(t,e):null}getEffectedEdges(t){const e=[],n=t.cell,i=this.model.getConnectedEdges(n);for(let r=0,o=i.length;r<o;r+=1){const a=i[r],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=e.getSourceCell(),i=e.getTargetCell();if(this.renderArea&&n&&i)return this.renderArea.isIntersectWithRect(n.getBBox())||this.renderArea.isIntersectWithRect(i.getBBox())}return!0}getRenderPriority(t){return t.cell.isNode()?ce.RenderNode:ce.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(t=>{this.views[t].view.dispose()}),this.views={}}}Kv([Dt.dispose()],Ot.prototype,"dispose",null);(function(s){s.FLAG_INSERT=1<<30,s.FLAG_REMOVE=1<<29,s.FLAG_RENDER=(1<<26)-1})(Ot||(Ot={}));(function(s){(function(t){t[t.CREATED=0]="CREATED",t[t.MOUNTED=1]="MOUNTED",t[t.WAITING=2]="WAITING"})(s.ViewState||(s.ViewState={}))})(Ot||(Ot={}));var Zv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Ar extends Nt{constructor(){super(...arguments),this.schedule=new Ot(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 r=this.schedule.views;if(r[i])return r[i].view}}return null}findViewByCell(t){if(t==null)return null;const e=K.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?Q.getBBox(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=L.create(t);return this.model.getCells().map(i=>this.findViewByCell(i)).filter(i=>{if(i){if(e.nodeOnly&&!i.isNodeView())return!1;const r=Q.getBBox(i.container,{target:this.view.stage});return r.width===0?r.inflate(1,0):r.height===0&&r.inflate(0,1),e.strict?n.containsRect(r):n.isIntersectWithRect(r)}return!1})}dispose(){this.schedule.dispose()}}Zv([Nt.dispose()],Ar.prototype,"dispose",null);var ko=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};class wc extends Nt{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}-${ys(JSON.stringify(t))}`),!this.isDefined(e)){const i=cn.registry.get(n);if(i==null)return cn.registry.onNotFound(n);const r=i(t.args||{}),o=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},t.attrs),{id:e});z.create(ct.sanitize(r),o).appendTo(this.defs)}return e}gradient(t){let e=t.id;const n=t.type;if(e||(e=`gradient-${n}-${this.cid}-${ys(JSON.stringify(t))}`),!this.isDefined(e)){const r=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}"/>`}),o=`<${n}>${r.join("")}</${n}>`,a=Object.assign({id:e},t.attrs);z.create(o,a).appendTo(this.defs)}return e}marker(t){const{id:e,refX:n,refY:i,markerUnits:r,markerOrient:o,tagName:a,children:l}=t,c=ko(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let h=e;if(h||(h=`marker-${this.cid}-${ys(JSON.stringify(t))}`),!this.isDefined(h)){a!=="path"&&delete c.d;const f=z.create("marker",{refX:n,refY:i,id:h,overflow:"visible",orient:o??"auto",markerUnits:r||"userSpaceOnUse"},l?l.map(u=>{var{tagName:d}=u,g=ko(u,["tagName"]);return z.create(`${d}`||"path",Yn(Object.assign(Object.assign({},c),g)))}):[z.create(a||"path",Yn(c))]);this.defs.appendChild(f.node)}return h}remove(t){const e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}}class Cc extends Nt{getClientMatrix(){return Tt(this.view.stage.getScreenCTM())}getClientOffset(){const t=this.view.svg.getBoundingClientRect();return new w(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=w.create(t,e);return Q.transformPoint(n,this.graph.matrix())}localToClientPoint(t,e){const n=w.create(t,e);return Q.transformPoint(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 r=L.create(t,e,n,i);return Q.transformRectangle(r,this.graph.matrix())}localToClientRect(t,e,n,i){const r=L.create(t,e,n,i);return Q.transformRectangle(r,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=w.create(t,e);return Q.transformPoint(n,this.graph.matrix().inverse())}clientToLocalPoint(t,e){const n=w.create(t,e);return Q.transformPoint(n,this.getClientMatrix().inverse())}clientToGraphPoint(t,e){const n=w.create(t,e);return Q.transformPoint(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){const i=w.create(t,e).diff(this.getPageOffset());return this.graphToLocalPoint(i)}graphToLocalRect(t,e,n,i){const r=L.create(t,e,n,i);return Q.transformRectangle(r,this.graph.matrix().inverse())}clientToLocalRect(t,e,n,i){const r=L.create(t,e,n,i);return Q.transformRectangle(r,this.getClientMatrix().inverse())}clientToGraphRect(t,e,n,i){const r=L.create(t,e,n,i);return Q.transformRectangle(r,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,i){const r=L.create(t,e,n,i),o=this.getPageOffset();return r.x-=o.x,r.y-=o.y,this.graphToLocalRect(r)}}var Qv=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Gi extends Nt{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:t,magnet:e,options:n={}}){const i=this.resolveHighlighter(n);if(!i)return;const r=this.getHighlighterId(e,i);if(!this.highlights[r]){const o=i.highlighter;o.highlight(t,e,Object.assign({},i.args)),this.highlights[r]={cellView:t,magnet:e,highlighter:o,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,r=i.name,o=fe.registry.get(r);return o==null?fe.registry.onNotFound(r):(fe.check(r,o),{name:r,highlighter:o,args:i.args||{}})}getHighlighterId(t,e){return gr(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()}}Qv([Gi.dispose()],Gi.prototype,"dispose",null);var tw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Pc extends Nt{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():t}init(){if(this.options.autoResize){const e=this.getSensorTarget();e&&ji.bind(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(){ji.clear(this.graph.container)}}tw([Nt.dispose()],Pc.prototype,"dispose",null);var ew=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};let M=class Sc extends rt{get container(){return this.options.container}get[Symbol.toStringTag](){return Sc.toStringTag}constructor(t){super(),this.installedPlugins=new Set,this.options=si.get(t),this.css=new Us(this),this.view=new Qt(this),this.defs=new wc(this),this.coord=new Cc(this),this.transform=new xc(this),this.highlight=new Gi(this),this.grid=new Sr(this),this.background=new fs(this),this.options.model?this.model=this.options.model:(this.model=new $t,this.model.graph=this),this.renderer=new Ar(this),this.panning=new Or(this),this.mousewheel=new Er(this),this.virtualRender=new vc(this),this.size=new Pc(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=>wt.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,r){return this.model.getNodesInArea(t,e,n,i,r)}getNodesUnderNode(t,e={}){return this.model.getNodesUnderNode(t,e)}searchCell(t,e,n={}){return this.model.search(t,e,n),this}getShortestPath(t,e,n={}){return this.model.getShortestPath(t,e,n)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(t,e={}){return this.model.getCellsBBox(t,e)}startBatch(t,e={}){this.model.startBatch(t,e)}stopBatch(t,e={}){this.model.stopBatch(t,e)}batchUpdate(t,e,n){const i=typeof t=="string"?t:"update",r=typeof t=="string"?e:t,o=typeof e=="function"?n:e;this.startBatch(i,o);const a=r();return this.stopBatch(i,o),a}updateCellId(t,e){return this.model.updateCellId(t,e)}findView(t){return K.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return L.isRectangleLike(t)?this.findViewsInArea(t):w.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,r){const o=typeof t=="number"?{x:t,y:e,width:n,height:i}:t,a=typeof t=="number"?r:e;return this.renderer.findViewsInArea(o,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,r=n.ty+e;return this.translate(i,r)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(t={}){return this.transform.getContentArea(t)}getContentBBox(t={}){return this.transform.getContentBBox(t)}fitToContent(t,e,n,i){return this.transform.fitToContent(t,e,n,i)}scaleContentToFit(t={}){return this.transform.scaleContentToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const i=this.getPlugin("scroller");return i?i.centerPoint(t,e,n):this.transform.centerPoint(t,e),this}centerContent(t){const e=this.getPlugin("scroller");return e?e.centerContent(t):this.transform.centerContent(t),this}centerCell(t,e){const n=this.getPlugin("scroller");return n?n.centerCell(t,e):this.transform.centerCell(t),this}positionPoint(t,e,n,i={}){const r=this.getPlugin("scroller");return r?r.positionPoint(t,e,n,i):this.transform.positionPoint(t,e,n),this}positionRect(t,e,n){const i=this.getPlugin("scroller");return i?i.positionRect(t,e,n):this.transform.positionRect(t,e),this}positionCell(t,e,n){const i=this.getPlugin("scroller");return i?i.positionCell(t,e,n):this.transform.positionCell(t,e),this}positionContent(t,e){const n=this.getPlugin("scroller");return n?n.positionContent(t,e):this.transform.positionContent(t,e),this}snapToGrid(t,e){return this.coord.snapToGrid(t,e)}pageToLocal(t,e,n,i){return L.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 L.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 L.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 L.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 L.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 L.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 L.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}use(t,...e){return this.installedPlugins.has(t)||(this.installedPlugins.add(t),t.init(this,...e)),this}getPlugin(t){return Array.from(this.installedPlugins).find(e=>e.name===t)}getPlugins(t){return Array.from(this.installedPlugins).filter(e=>t.includes(e.name))}enablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return n?.forEach(i=>{var r;(r=i?.enable)===null||r===void 0||r.call(i)}),this}disablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return n?.forEach(i=>{var r;(r=i?.disable)===null||r===void 0||r.call(i)}),this}isPluginEnabled(t){var e;const n=this.getPlugin(t);return(e=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?.forEach(i=>{i.dispose(),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()})}};ew([rt.dispose()],M.prototype,"dispose",null);(function(s){s.View=Qt,s.Renderer=Ar,s.MouseWheel=Er,s.DefsManager=wc,s.GridManager=Sr,s.CoordManager=Cc,s.TransformManager=xc,s.HighlightManager=Gi,s.BackgroundManager=fs,s.PanningManager=Or})(M||(M={}));(function(s){s.toStringTag=`X6.${s.name}`;function t(e){if(e==null)return!1;if(e instanceof s)return!0;const n=e[Symbol.toStringTag];return n==null||n===s.toStringTag}s.isGraph=t})(M||(M={}));(function(s){function t(e,n){const i=e instanceof HTMLElement?new s({container:e}):new s(e);return n!=null&&i.fromJSON(n),i}s.render=t})(M||(M={}));(function(s){s.registerNode=wt.registry.register,s.registerEdge=ft.registry.register,s.registerView=yt.registry.register,s.registerAttr=oe.registry.register,s.registerGrid=we.registry.register,s.registerFilter=cn.registry.register,s.registerNodeTool=fn.registry.register,s.registerEdgeTool=dn.registry.register,s.registerBackground=Qn.registry.register,s.registerHighlighter=fe.registry.register,s.registerPortLayout=Be.registry.register,s.registerPortLabelLayout=hn.registry.register,s.registerMarker=Oe.registry.register,s.registerRouter=Ce.registry.register,s.registerConnector=ke.registry.register,s.registerAnchor=gn.registry.register,s.registerEdgeAnchor=pn.registry.register,s.registerConnectionPoint=mn.registry.register})(M||(M={}));(function(s){s.unregisterNode=wt.registry.unregister,s.unregisterEdge=ft.registry.unregister,s.unregisterView=yt.registry.unregister,s.unregisterAttr=oe.registry.unregister,s.unregisterGrid=we.registry.unregister,s.unregisterFilter=cn.registry.unregister,s.unregisterNodeTool=fn.registry.unregister,s.unregisterEdgeTool=dn.registry.unregister,s.unregisterBackground=Qn.registry.unregister,s.unregisterHighlighter=fe.registry.unregister,s.unregisterPortLayout=Be.registry.unregister,s.unregisterPortLabelLayout=hn.registry.unregister,s.unregisterMarker=Oe.registry.unregister,s.unregisterRouter=Ce.registry.unregister,s.unregisterConnector=ke.registry.unregister,s.unregisterAnchor=gn.registry.unregister,s.unregisterEdgeAnchor=pn.registry.unregister,s.unregisterConnectionPoint=mn.registry.unregister})(M||(M={}));var nw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},iw=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};class xn extends wt{}(function(s){class t extends Zt{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:n}){const i=s.shapeMaps[this.cell.shape];if(i){const{effect:r}=i;(!r||r.includes(n))&&this.renderHTMLComponent()}}confirmUpdate(n){const i=super.confirmUpdate(n);return this.handleAction(i,t.action,()=>this.renderHTMLComponent())}renderHTMLComponent(){const n=this.selectors&&this.selectors.foContent;if(n){ci(n);const i=s.shapeMaps[this.cell.shape];if(!i)return;let{html:r}=i;typeof r=="function"&&(r=r(this.cell)),r&&(typeof r=="string"?n.innerHTML=r:Ut(n,r))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}nw([t.dispose()],t.prototype,"dispose",null),s.View=t,function(e){e.action="html",e.config({bootstrap:[e.action],actions:{html:e.action}}),Zt.registry.register("html-view",e,!0)}(t=s.View||(s.View={}))})(xn||(xn={}));(function(s){s.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},ct.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),wt.registry.register("html",s,!0)})(xn||(xn={}));(function(s){s.shapeMaps={};function t(e){const{shape:n,html:i,effect:r,inherit:o}=e,a=iw(e,["shape","html","effect","inherit"]);if(!n)throw new Error("should specify shape in config");s.shapeMaps[n]={html:i,effect:r},M.registerNode(n,Object.assign({inherit:o||"html"},a),!0)}s.register=t})(xn||(xn={}));class sw extends K{constructor(t){super(t)}}class rw extends ft{constructor(t){super({...t})}}class ow{constructor(){this.cells=[]}copy(t,e,n={}){this.options=Object.assign({},n);const r=($t.isModel(e)?e:e.model).cloneSubGraph(t,n);this.cells=or(Object.keys(r).map(o=>r[o]),o=>o.isEdge()?2:1),this.serialize(n)}cut(t,e,n={}){this.copy(t,e,n),(M.isGraph(e)?e.model:e).batchUpdate("cut",()=>{t.forEach(r=>r.remove())})}paste(t,e={}){const n=Object.assign(Object.assign({},this.options),e),{offset:i,edgeProps:r,nodeProps:o}=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(f=>{f.model=null,f.removeProp("zIndex"),(a||l)&&f.translate(a,l),o&&f.isNode()&&f.prop(o),r&&f.isEdge()&&f.prop(r)});const h=M.isGraph(t)?t.model:t;return h.batchUpdate("paste",()=>{h.addCells(this.cells)}),this.copy(c,t,e),c}serialize(t){t.useLocalStorage!==!1&&Hn.save(this.cells)}deserialize(t){if(t.useLocalStorage){const e=Hn.fetch();e&&(this.cells=e)}}isEmpty(t={}){return t.useLocalStorage&&this.deserialize(t),this.cells.length<=0}clean(){this.options={},this.cells=[],Hn.clean()}}var Hn;(function(s){const t=`${Vt.prefixCls}.clipboard.cells`;function e(r){if(window.localStorage){const o=r.map(a=>a.toJSON());localStorage.setItem(t,JSON.stringify(o))}}s.save=e;function n(){if(window.localStorage){const r=localStorage.getItem(t),o=r?JSON.parse(r):[];if(o)return $t.fromJSON(o)}}s.fetch=n;function i(){window.localStorage&&localStorage.removeItem(t)}s.clean=i})(Hn||(Hn={}));M.prototype.isClipboardEnabled=function(){const s=this.getPlugin("clipboard");return s?s.isEnabled():!1};M.prototype.enableClipboard=function(){const s=this.getPlugin("clipboard");return s&&s.enable(),this};M.prototype.disableClipboard=function(){const s=this.getPlugin("clipboard");return s&&s.disable(),this};M.prototype.toggleClipboard=function(s){const t=this.getPlugin("clipboard");return t&&t.toggleEnabled(s),this};M.prototype.isClipboardEmpty=function(s){const t=this.getPlugin("clipboard");return t?t.isEmpty(s):!0};M.prototype.getCellsInClipboard=function(){const s=this.getPlugin("clipboard");return s?s.getCellsInClipboard():[]};M.prototype.cleanClipboard=function(){const s=this.getPlugin("clipboard");return s&&s.clean(),this};M.prototype.copy=function(s,t){const e=this.getPlugin("clipboard");return e&&e.copy(s,t),this};M.prototype.cut=function(s,t){const e=this.getPlugin("clipboard");return e&&e.cut(s,t),this};M.prototype.paste=function(s,t){const e=this.getPlugin("clipboard");return e?e.paste(s,t):[]};var aw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},lw=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};class Oc extends rt{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 ow,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!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),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 lw(t,["enabled"])}notify(t,e){this.trigger(t,e),this.graph.trigger(t,e)}dispose(){this.clean(!0),this.off()}}aw([rt.dispose()],Oc.prototype,"dispose",null);const cw=`.x6-widget-dnd {
246
+ position: absolute;
247
+ top: -10000px;
248
+ left: -10000px;
249
+ z-index: 999999;
250
+ display: none;
251
+ cursor: move;
252
+ opacity: 0.7;
253
+ pointer-events: 'cursor';
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
+ `;var hw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class _e extends q{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({},_e.defaults),t),this.init()}init(){Ue(this.name,cw),this.container=document.createElement("div"),B(this.container,this.prefixClassName("widget-dnd")),this.draggingGraph=new M(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1,async:!1})),Ut(this.container,this.draggingGraph.container)}start(t,e){const n=e;n.preventDefault(),this.targetModel.startBatch("dnd"),B(this.container,"dragging"),ue(this.container,this.options.draggingContainer||document.body),this.sourceNode=t,this.prepareDragging(t,n.clientX,n.clientY);const i=this.updateNodePosition(n.clientX,n.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:n,node:t,cell:t,view:this.draggingView,x:i.x,y:i.y}),this.draggingNode.on("change:position",this.snap,this)),this.delegateDocumentEvents(_e.documentEvents,n.data)}isSnaplineEnabled(){return this.snapline&&this.snapline.isEnabled()}prepareDragging(t,e,n){const i=this.draggingGraph,r=i.model,o=this.options.getDragNode(t,{sourceNode:t,draggingGraph:i,targetGraph:this.targetGraph});o.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(),r.resetCells([o]);const l=i.findViewByCell(o);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=o,this.draggingView=l,this.draggingBBox=o.getBBox(),this.padding=a,this.originOffset=this.updateGraphPosition(e,n)}updateGraphPosition(t,e){const n=document.body.scrollTop||document.documentElement.scrollTop,i=document.body.scrollLeft||document.documentElement.scrollLeft,r=this.delta,o=this.geometryBBox,a=this.padding||5,l={left:t-r.x-o.width/2-a+i,top:e-r.y-o.height/2-a+n};return this.draggingGraph&&J(this.container,{left:`${l.left}px`,top:`${l.top}px`}),l}updateNodePosition(t,e){const n=this.targetGraph.clientToLocal(t,e),i=this.draggingBBox;return 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 r=this.draggingBBox;i.position(r.x+n.tx,r.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}onDragging(t){const e=this.draggingView;if(e){t.preventDefault();const n=this.normalizeEvent(t),i=n.clientX,r=n.clientY;this.updateGraphPosition(i,r);const o=this.updateNodePosition(i,r),a=this.targetGraph.options.embedding.enabled,l=(a||this.isSnaplineEnabled())&&this.isInsideValidArea({x:i,y:r});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:o.x,y:o.y}):this.snapline.hide())}}onDragEnd(t){const e=this.draggingNode;if(e){const n=this.normalizeEvent(t),i=this.draggingView,r=this.draggingBBox,o=this.snapOffset;let a=r.x,l=r.y;o&&(a+=o.x,l+=o.y),e.position(a,l,{silent:!0});const c=this.drop(e,{x:n.clientX,y:n.clientY}),h=f=>{f?(this.onDropped(e),this.targetGraph.options.embedding.enabled&&i&&(i.setEventData(n,{cell:f,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),i.finalizeEmbedding(n,i.getEventData(n)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};js(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.originOffset=null,this.undelegateDocumentEvents())}onDropped(t){this.draggingNode===t&&(this.clearDragging(),pt(this.container,"dragging"),ie(this.container))}onDropInvalid(){const t=this.draggingNode;t&&this.onDropped(t)}isInsideValidArea(t){let e,n=null;const i=this.targetGraph,r=this.targetScroller;this.options.dndContainer&&(n=this.getDropArea(this.options.dndContainer));const o=n&&n.containsPoint(t);if(r)if(r.options.autoResize)e=this.getDropArea(r.container);else{const a=this.getDropArea(r.container);e=this.getDropArea(i.container).intersectsWithRect(a)}else e=this.getDropArea(i.container);return!o&&e&&e.containsPoint(t)}getDropArea(t){const e=on(t),n=document.body.scrollTop||document.documentElement.scrollTop,i=document.body.scrollLeft||document.documentElement.scrollLeft;return L.create({x:e.left+parseInt(J(t,"border-left-width"),10)-i,y:e.top+parseInt(J(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,r=n.clientToLocal(e),o=this.sourceNode,a=this.options.getDropNode(t,{sourceNode:o,draggingNode:t,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),l=a.getBBox();r.x+=l.x-l.width/2,r.y+=l.y-l.height/2;const c=this.snapOffset?1:n.getGridSize();a.position(Z.snapToGrid(r.x,c),Z.snapToGrid(r.y,c)),a.removeZIndex();const h=this.options.validateNode,f=h?h(a,{sourceNode:o,draggingNode:t,droppingNode:a,targetGraph:n,draggingGraph:this.draggingGraph}):!0;return typeof f=="boolean"?f?(i.addCell(a,{stencil:this.cid}),a):null:Xm(f).then(u=>u?(i.addCell(a,{stencil:this.cid}),a):null)}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),We(this.name)}}hw([q.dispose()],_e.prototype,"dispose",null);(function(s){s.defaults={getDragNode:t=>t.clone(),getDropNode:t=>t.clone()},s.documentEvents={mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"}})(_e||(_e={}));M.prototype.toSVG=function(s,t){const e=this.getPlugin("export");e&&e.toSVG(s,t)};M.prototype.toPNG=function(s,t){const e=this.getPlugin("export");e&&e.toPNG(s,t)};M.prototype.toJPEG=function(s,t){const e=this.getPlugin("export");e&&e.toJPEG(s,t)};M.prototype.exportPNG=function(s,t){const e=this.getPlugin("export");e&&e.exportPNG(s,t)};M.prototype.exportJPEG=function(s,t){const e=this.getPlugin("export");e&&e.exportJPEG(s,t)};M.prototype.exportSVG=function(s,t){const e=this.getPlugin("export");e&&e.exportSVG(s,t)};var uw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Ec extends rt{constructor(){super(),this.name="export"}get view(){return this.graph.view}init(t){this.graph=t}exportPNG(t="chart",e={}){this.toPNG(n=>{Le.downloadDataUri(n,t)},e)}exportJPEG(t="chart",e={}){this.toPNG(n=>{Le.downloadDataUri(n,t)},e)}exportSVG(t="chart",e={}){this.toSVG(n=>{Le.downloadDataUri(Le.svgToDataUrl(n),t)},e)}toSVG(t,e={}){this.notify("before:export",e);const n=this.view.svg,i=z.create(n).clone();let r=i.node;const o=i.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=e.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),l=e.preserveDimensions;if(l){const f=typeof l=="boolean"?a:l;i.attr({width:f.width,height:f.height})}if(i.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),e.copyStyles!==!1){const f=n.ownerDocument,u=Array.from(n.querySelectorAll("*")),d=Array.from(r.querySelectorAll("*")),g=f.styleSheets.length,p=[];for(let x=g-1;x>=0;x-=1)p[x]=f.styleSheets[x],f.styleSheets[x].disabled=!0;const m={};u.forEach((x,b)=>{const v=window.getComputedStyle(x,null),C={};Object.keys(v).forEach(S=>{C[S]=v.getPropertyValue(S)}),m[b]=C}),g!==f.styleSheets.length&&p.forEach((x,b)=>{f.styleSheets[b]=x});for(let x=0;x<g;x+=1)f.styleSheets[x].disabled=!1;const y={};u.forEach((x,b)=>{const v=window.getComputedStyle(x,null),C=m[b],S={};Object.keys(v).forEach(P=>{!Is(P)&&v.getPropertyValue(P)!==C[P]&&(S[P]=v.getPropertyValue(P))}),y[b]=S}),d.forEach((x,b)=>{J(x,y[b])})}const c=e.stylesheet;if(typeof c=="string"){const f=n.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(c);i.prepend(z.create("style",{type:"text/css"},[f]))}const h=()=>{const f=e.beforeSerialize;if(typeof f=="function"){const d=k(f,this.graph,r);d instanceof SVGSVGElement&&(r=d)}const u=new XMLSerializer().serializeToString(r).replace(/&nbsp;/g," ");this.notify("after:export",e),t(u)};if(e.serializeImages){const f=i.find("image").map(u=>new Promise(d=>{const g=u.attr("xlink:href")||u.attr("href");Le.imageToDataUri(g,(p,m)=>{!p&&m&&u.attr("xlink:href",m),d()})}));Promise.all(f).then(h)}else h()}toDataURL(t,e){let n=e.viewBox||this.graph.getContentBBox();const i=Yt(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 r=new L(-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,f=n.height+i.top+i.bottom;r.scale(h/e.width,f/e.height)}n=L.create(n).moveAndExpand(r);const o=typeof e.width=="number"&&typeof e.height=="number"?{width:e.width,height:e.height}:n;let a=e.ratio?parseFloat(e.ratio):1;(!Number.isFinite(a)||a===0)&&(a=1);const l={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{const h=document.createElement("canvas"),f=h.getContext("2d");h.width=l.width,h.height=l.height;const u=l.width-1,d=l.height-1;f.fillStyle="rgb(1,1,1)",f.fillRect(u,d,1,1);const g=f.getImageData(u,d,1,1).data;if(g[0]!==1||g[1]!==1||g[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 f=h.getContext("2d");f.fillStyle=e.backgroundColor||"white",f.fillRect(0,0,l.width,l.height);try{f.drawImage(c,0,0,l.width,l.height);const u=h.toDataURL(e.type,e.quality);t(u)}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()}}uw([rt.dispose()],Ec.prototype,"dispose",null);M.prototype.isHistoryEnabled=function(){const s=this.getPlugin("history");return s?s.isEnabled():!1};M.prototype.enableHistory=function(){const s=this.getPlugin("history");return s&&s.enable(),this};M.prototype.disableHistory=function(){const s=this.getPlugin("history");return s&&s.disable(),this};M.prototype.toggleHistory=function(s){const t=this.getPlugin("history");return t&&t.toggleEnabled(s),this};M.prototype.undo=function(s){const t=this.getPlugin("history");return t&&t.undo(s),this};M.prototype.redo=function(s){const t=this.getPlugin("history");return t&&t.redo(s),this};M.prototype.undoAndCancel=function(s){const t=this.getPlugin("history");return t&&t.cancel(s),this};M.prototype.canUndo=function(){const s=this.getPlugin("history");return s?s.canUndo():!1};M.prototype.canRedo=function(){const s=this.getPlugin("history");return s?s.canRedo():!1};M.prototype.cleanHistory=function(s){const t=this.getPlugin("history");return t&&t.clean(s),this};M.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()};M.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()};M.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()};M.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};var Ac=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class vn extends rt{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=ut.getOptions(t),this.validator=new vn.Validator({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)?ut.sortBatchCommands(t):[t];for(let i=n.length-1;i>=0;i-=1){const r=n[i],o=Object.assign(Object.assign({},e),co(r.options,this.options.revertOptionsList||[]));this.executeCommand(r,!0,o)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?ut.sortBatchCommands(t):[t];for(let i=0;i<n.length;i+=1){const r=n[i],o=Object.assign(Object.assign({},e),co(r.options,this.options.applyOptionsList||[]));this.executeCommand(r,!1,o)}this.freezed=!1}executeCommand(t,e,n){const i=this.model,r=i.getCell(t.data.id),o=t.event;if(ut.isAddEvent(o)&&e||ut.isRemoveEvent(o)&&!e)r&&r.remove(n);else if(ut.isAddEvent(o)&&!e||ut.isRemoveEvent(o)&&e){const a=t.data;a.node?i.addNode(a.props,n):a.edge&&i.addEdge(a.props,n)}else if(ut.isChangeEvent(o)){const a=t.data,l=a.key;if(l&&r){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),r.prop(l,c,n)}}else{const a=this.options.executeCommand;a&&k(a,this,t,e,n)}}addCommand(t,e){if(this.freezed||this.disabled)return;const n=e,i=n.options||{};if(i.dryrun||ut.isAddEvent(t)&&this.options.ignoreAdd||ut.isRemoveEvent(t)&&this.options.ignoreRemove||ut.isChangeEvent(t)&&this.options.ignoreChange)return;const r=this.options.beforeAddCommand;if(r!=null&&k(r,this,t,e)===!1)return;t==="cell:change:*"&&(t=`cell:change:${n.key}`);const o=n.cell,a=$t.isModel(o);let l;if(this.batchCommands){l=this.batchCommands[Math.max(this.lastBatchIndex,0)];const h=a&&!l.modelChange||l.data.id!==o.id,f=l.event!==t;if(this.lastBatchIndex>=0&&(h||f)){const u=this.batchCommands.findIndex(d=>(a&&d.modelChange||d.data.id===o.id)&&d.event===t);u<0||ut.isAddEvent(t)||ut.isRemoveEvent(t)?l=this.createCommand({batch:!0}):(l=this.batchCommands[u],this.batchCommands.splice(u,1)),this.batchCommands.push(l),this.lastBatchIndex=this.batchCommands.length-1}}else l=this.createCommand({batch:!1});if(ut.isAddEvent(t)||ut.isRemoveEvent(t)){const h=l.data;return l.event=t,l.options=i,h.id=o.id,h.props=lt(o.toJSON()),o.isEdge()?h.edge=!0:o.isNode()&&(h.node=!0),this.push(l,i)}if(ut.isChangeEvent(t)){const h=e.key,f=l.data;return(!l.batch||!l.event)&&(l.event=t,l.options=i,f.key=h,f.prev==null&&(f.prev={}),f.prev[h]=lt(o.previous(h)),a?l.modelChange=!0:f.id=o.id),f.next==null&&(f.next={}),f.next[h]=lt(o.prop(h)),this.push(l,i)}const c=this.options.afterAddCommand;c&&k(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(),r=i.event,o=i.data.id;if(r!=null&&(o!=null||i.modelChange)){if(ut.isAddEvent(r)){const a=e.findIndex(l=>ut.isRemoveEvent(l.event)&&l.data.id===o);if(a>=0){e=e.filter((l,c)=>a<c||l.data.id!==o);continue}}else if(ut.isRemoveEvent(r)){const a=e.findIndex(l=>ut.isAddEvent(l.event)&&l.data.id===o);if(a>=0){e.splice(a,1);continue}}else if(ut.isChangeEvent(r)){const a=i.data;if(ne(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(o=>o.event));if(i.size!==2||!i.has("cell:change:parent")||!i.has("cell:change:children")||!e.every(o=>{var a;return o.batch&&((a=o.options)===null||a===void 0?void 0:a.ui)})||!Array.isArray(n)||n.length!==1)return;const r=n[0];r.event!=="cell:change:position"||!(!((t=r.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()}}Ac([rt.dispose()],vn.prototype,"dispose",null);(function(s){class t extends rt{constructor(n){super(),this.map={},this.command=n.history,this.cancelInvalid=n.cancelInvalid!==!1,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:n}){return Array.isArray(n)?n.every(i=>this.isValidCommand(i)):this.isValidCommand(n)}isValidCommand(n){if(n.options&&n.options.validation===!1)return!0;const i=n.event&&this.map[n.event]||[];let r=null;return i.forEach(o=>{let a=0;const l=c=>{const h=o[a];a+=1;try{if(h)h(c,n,l);else{r=c;return}}catch(f){l(f)}};l(r)}),r?(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:r}),!1):!0}validate(n,...i){const r=Array.isArray(n)?n:n.split(/\s+/);return i.forEach(o=>{if(typeof o!="function")throw new Error(`${r.join(" ")} requires callback functions.`)}),r.forEach(o=>{this.map[o]==null&&(this.map[o]=[]),this.map[o].push(i)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}Ac([rt.dispose()],t.prototype,"dispose",null),s.Validator=t})(vn||(vn={}));var ut;(function(s){function t(o){return o==="cell:added"}s.isAddEvent=t;function e(o){return o==="cell:removed"}s.isRemoveEvent=e;function n(o){return o!=null&&o.startsWith("cell:change:")}s.isChangeEvent=n;function i(o){const a=["cell:added","cell:removed","cell:change:*"],l=["batch:start","batch:stop"],c=o.eventNames?o.eventNames.filter(h=>!(s.isChangeEvent(h)||a.includes(h)||l.includes(h))):a;return Object.assign(Object.assign({enabled:!0},o),{eventNames:c,applyOptionsList:o.applyOptionsList||["propertyPath"],revertOptionsList:o.revertOptionsList||["propertyPath"]})}s.getOptions=i;function r(o){const a=[];for(let l=0,c=o.length;l<c;l+=1){const h=o[l];let f=null;if(s.isAddEvent(h.event)){const u=h.data.id;for(let d=0;d<l;d+=1)if(o[d].data.id===u){f=d;break}}f!==null?a.splice(f,0,h):a.push(h)}return a}s.sortBatchCommands=r})(ut||(ut={}));function fw(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Mc={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"},r={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={"~":"`","!":"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(P,O,E){if(P.addEventListener){P.addEventListener(O,E,!1);return}P.attachEvent("on"+O,E)}function f(P){if(P.type=="keypress"){var O=String.fromCharCode(P.which);return P.shiftKey||(O=O.toLowerCase()),O}return i[P.which]?i[P.which]:r[P.which]?r[P.which]:String.fromCharCode(P.which).toLowerCase()}function u(P,O){return P.sort().join(",")===O.sort().join(",")}function d(P){var O=[];return P.shiftKey&&O.push("shift"),P.altKey&&O.push("alt"),P.ctrlKey&&O.push("ctrl"),P.metaKey&&O.push("meta"),O}function g(P){if(P.preventDefault){P.preventDefault();return}P.returnValue=!1}function p(P){if(P.stopPropagation){P.stopPropagation();return}P.cancelBubble=!0}function m(P){return P=="shift"||P=="ctrl"||P=="alt"||P=="meta"}function y(){if(!l){l={};for(var P in i)P>95&&P<112||i.hasOwnProperty(P)&&(l[i[P]]=P)}return l}function x(P,O,E){return E||(E=y()[P]?"keydown":"keypress"),E=="keypress"&&O.length&&(E="keydown"),E}function b(P){return P==="+"?["+"]:(P=P.replace(/\+{2}/g,"+plus"),P.split("+"))}function v(P,O){var E,R,T,I=[];for(E=b(P),T=0;T<E.length;++T)R=E[T],a[R]&&(R=a[R]),O&&O!="keypress"&&o[R]&&(R=o[R],I.push("shift")),m(R)&&I.push(R);return O=x(R,I,O),{key:R,modifiers:I,action:O}}function C(P,O){return P===null||P===e?!1:P===O?!0:C(P.parentNode,O)}function S(P){var O=this;if(P=P||e,!(O instanceof S))return new S(P);O.target=P,O._callbacks={},O._directMap={};var E={},R,T=!1,I=!1,_=!1;function F(D){D=D||{};var Y=!1,et;for(et in E){if(D[et]){Y=!0;continue}E[et]=0}Y||(_=!1)}function A(D,Y,et,H,nt,Ct){var U,Pt,le=[],jt=et.type;if(!O._callbacks[D])return[];for(jt=="keyup"&&m(D)&&(Y=[D]),U=0;U<O._callbacks[D].length;++U)if(Pt=O._callbacks[D][U],!(!H&&Pt.seq&&E[Pt.seq]!=Pt.level)&&jt==Pt.action&&(jt=="keypress"&&!et.metaKey&&!et.ctrlKey||u(Y,Pt.modifiers))){var kc=!H&&Pt.combo==nt,$c=H&&Pt.seq==H&&Pt.level==Ct;(kc||$c)&&O._callbacks[D].splice(U,1),le.push(Pt)}return le}function N(D,Y,et,H){O.stopCallback(Y,Y.target||Y.srcElement,et,H)||D(Y,et)===!1&&(g(Y),p(Y))}O._handleKey=function(D,Y,et){var H=A(D,Y,et),nt,Ct={},U=0,Pt=!1;for(nt=0;nt<H.length;++nt)H[nt].seq&&(U=Math.max(U,H[nt].level));for(nt=0;nt<H.length;++nt){if(H[nt].seq){if(H[nt].level!=U)continue;Pt=!0,Ct[H[nt].seq]=1,N(H[nt].callback,et,H[nt].combo,H[nt].seq);continue}Pt||N(H[nt].callback,et,H[nt].combo)}var le=et.type=="keypress"&&I;et.type==_&&!m(D)&&!le&&F(Ct),I=Pt&&et.type=="keydown"};function V(D){typeof D.which!="number"&&(D.which=D.keyCode);var Y=f(D);if(Y){if(D.type=="keyup"&&T===Y){T=!1;return}O.handleKey(Y,d(D),D)}}function it(){clearTimeout(R),R=setTimeout(F,1e3)}function tt(D,Y,et,H){E[D]=0;function nt(jt){return function(){_=jt,++E[D],it()}}function Ct(jt){N(et,jt,D),H!=="keyup"&&(T=f(jt)),setTimeout(F,10)}for(var U=0;U<Y.length;++U){var Pt=U+1===Y.length,le=Pt?Ct:nt(H||v(Y[U+1]).action);ht(Y[U],le,H,D,U)}}function ht(D,Y,et,H,nt){O._directMap[D+":"+et]=Y,D=D.replace(/\s+/g," ");var Ct=D.split(" "),U;if(Ct.length>1){tt(D,Ct,Y,et);return}U=v(D,et),O._callbacks[U.key]=O._callbacks[U.key]||[],A(U.key,U.modifiers,{type:U.action},H,D,nt),O._callbacks[U.key][H?"unshift":"push"]({callback:Y,modifiers:U.modifiers,action:U.action,seq:H,level:nt,combo:D})}O._bindMultiple=function(D,Y,et){for(var H=0;H<D.length;++H)ht(D[H],Y,et)},h(P,"keypress",V),h(P,"keydown",V),h(P,"keyup",V)}S.prototype.bind=function(P,O,E){var R=this;return P=P instanceof Array?P:[P],R._bindMultiple.call(R,P,O,E),R},S.prototype.unbind=function(P,O){var E=this;return E.bind.call(E,P,function(){},O)},S.prototype.trigger=function(P,O){var E=this;return E._directMap[P+":"+O]&&E._directMap[P+":"+O]({},P),E},S.prototype.reset=function(){var P=this;return P._callbacks={},P._directMap={},P},S.prototype.stopCallback=function(P,O){var E=this;if((" "+O.className+" ").indexOf(" mousetrap ")>-1||C(O,E.target))return!1;if("composedPath"in P&&typeof P.composedPath=="function"){var R=P.composedPath()[0];R!==P.target&&(O=R)}return O.tagName=="INPUT"||O.tagName=="SELECT"||O.tagName=="TEXTAREA"||O.isContentEditable},S.prototype.handleKey=function(){var P=this;return P._handleKey.apply(P,arguments)},S.addKeycodes=function(P){for(var O in P)P.hasOwnProperty(O)&&(i[O]=P[O]);l=null},S.init=function(){var P=S(e);for(var O in P)O.charAt(0)!=="_"&&(S[O]=function(E){return function(){return P[E].apply(P,arguments)}}(O))},S.init(),t.Mousetrap=S,s.exports&&(s.exports=S)})(typeof window<"u"?window:null,typeof window<"u"?document:null)})(Mc);var dw=Mc.exports;const gw=fw(dw);var pw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class wn extends Dt{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,this),this.graph.on("blank:mouseup",this.focus,this)),this.mousetrap=wn.createMousetrap(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(t,e)}focus(t){if(this.isInputEvent(t.e))return;this.target.focus({preventScroll:!0})}getKeys(t){return(Array.isArray(t)?t:[t]).map(e=>this.formatkey(e))}formatkey(t){const e=t.toLocaleLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command").replace("arrowup","up").replace("arrowright","right").replace("arrowdown","down").replace("arrowleft","left"),n=this.options.format;return n?k(n,this.graph,e):e}isGraphEvent(t){const e=t.target,n=t.currentTarget;return e?e===this.target||n===this.target||e===document.body?!0:br(this.container,e):!1}isInputEvent(t){var e;const n=t.target,i=(e=n?.tagName)===null||e===void 0?void 0:e.toLowerCase();let r=["input","textarea"].includes(i);return X(n,"contenteditable")==="true"&&(r=!0),r}isEnabledForEvent(t){const e=!this.disabled&&this.isGraphEvent(t),n=this.isInputEvent(t);if(e){if(n&&(t.key==="Backspace"||t.key==="Delete"))return!1;if(this.options.guard)return k(this.options.guard,this.graph,t)}return e}dispose(){this.mousetrap.reset()}}pw([Dt.dispose()],wn.prototype,"dispose",null);(function(s){function t(e){const n=new gw(e.target),i=n.stopCallback;return n.stopCallback=(r,o,a)=>e.isEnabledForEvent(r)?i?i.call(n,r,o,a):!1:!0,n}s.createMousetrap=t})(wn||(wn={}));M.prototype.isKeyboardEnabled=function(){const s=this.getPlugin("keyboard");return s?s.isEnabled():!1};M.prototype.enableKeyboard=function(){const s=this.getPlugin("keyboard");return s&&s.enable(),this};M.prototype.disableKeyboard=function(){const s=this.getPlugin("keyboard");return s&&s.disable(),this};M.prototype.toggleKeyboard=function(s){const t=this.getPlugin("keyboard");return t&&t.toggleEnabled(s),this};M.prototype.bindKey=function(s,t,e){const n=this.getPlugin("keyboard");return n&&n.bindKey(s,t,e),this};M.prototype.unbindKey=function(s,t){const e=this.getPlugin("keyboard");return e&&e.unbindKey(s,t),this};M.prototype.clearKeys=function(){const s=this.getPlugin("keyboard");return s&&s.clear(),this};M.prototype.triggerKey=function(s,t){const e=this.getPlugin("keyboard");return e&&e.trigger(s,t),this};var mw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Tc extends Dt{constructor(t={}){super(),this.name="keyboard",this.options=Object.assign({enabled:!0},t)}init(t){this.keyboardImpl=new wn(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!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),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()}}mw([Dt.dispose()],Tc.prototype,"dispose",null);const bw=`.x6-widget-minimap {
266
+ position: relative;
267
+ display: table-cell;
268
+ box-sizing: border-box;
269
+ overflow: hidden;
270
+ text-align: center;
271
+ vertical-align: middle;
272
+ background-color: #fff;
273
+ user-select: none;
274
+ }
275
+ .x6-widget-minimap .x6-graph {
276
+ display: inline-block;
277
+ box-shadow: 0 0 4px 0 #eee;
278
+ cursor: pointer;
279
+ }
280
+ .x6-widget-minimap .x6-graph > svg {
281
+ pointer-events: none;
282
+ shape-rendering: optimizespeed;
283
+ }
284
+ .x6-widget-minimap .x6-graph .x6-node * {
285
+ /* stylelint-disable-next-line */
286
+ vector-effect: initial;
287
+ }
288
+ .x6-widget-minimap-viewport {
289
+ position: absolute;
290
+ box-sizing: content-box !important;
291
+ margin: -2px 0 0 -2px;
292
+ border: 2px solid #31d0c6;
293
+ cursor: move;
294
+ }
295
+ .x6-widget-minimap-viewport-zoom {
296
+ position: absolute;
297
+ right: 0;
298
+ bottom: 0;
299
+ box-sizing: border-box;
300
+ width: 12px;
301
+ height: 12px;
302
+ margin: 0 -6px -6px 0;
303
+ background-color: #fff;
304
+ border: 2px solid #31d0c6;
305
+ border-radius: 50%;
306
+ cursor: nwse-resize;
307
+ }
308
+ `;var yw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Nc extends q{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({},Hi.defaultOptions),t),Ue(this.name,bw)}init(t){this.graph=t,this.updateViewport=rr(this.updateViewport.bind(this),0),this.container=document.createElement("div"),B(this.container,this.prefixClassName(qn.root));const e=document.createElement("div");this.container.appendChild(e),this.viewport=document.createElement("div"),B(this.viewport,this.prefixClassName(qn.viewport)),this.options.scalable&&(this.zoomHandle=document.createElement("div"),B(this.zoomHandle,this.prefixClassName(qn.zoom)),ue(this.zoomHandle,this.viewport)),Ut(this.container,this.viewport),J(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});this.targetGraph=this.options.createGraph?this.options.createGraph(n):new M(n),this.updatePaper(this.sourceGraph.options.width,this.sourceGraph.options.height),this.startListening()}startListening(){this.scroller?st.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?st.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 r=this.sourceGraph.options,o=this.sourceGraph.transform.getScale(),a=this.options.width-2*this.options.padding,l=this.options.height-2*this.options.padding;n/=o.sx,i/=o.sy,this.ratio=Math.min(a/n,l/i);const c=this.ratio,h=r.x*c/o.sx,f=r.y*c/o.sy;return n*=c,i*=c,this.targetGraph.resize(n,i),this.targetGraph.translate(h,f),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();let n=null;this.scroller?n=this.scroller.clientToLocalPoint(0,0):n=this.graph.graphToLocal(0,0);const i=Xb(this.targetGraph.container),r=this.targetGraph.translate();r.ty=r.ty||0,this.geometry={top:i.top+n.y*e.sy+r.ty,left:i.left+n.x*e.sx+r.tx,width:this.graphContainer.clientWidth*e.sx/t.sx,height:this.graphContainer.clientHeight*e.sy/t.sy},J(this.viewport,this.geometry)}startAction(t){const e=this.normalizeEvent(t),n=e.target===this.zoomHandle?"zooming":"panning",{tx:i,ty:r}=this.sourceGraph.translate(),o={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:r};this.targetGraphTransforming=!0,this.delegateDocumentEvents(Hi.documentEvents,o)}doAction(t){const e=this.normalizeEvent(t),n=e.clientX,i=e.clientY,r=e.data;switch(r.action){case"panning":{const o=this.sourceGraph.transform.getScale(),a=(n-r.clientX)*o.sx,l=(i-r.clientY)*o.sy;this.scroller?(this.graphContainer.scrollLeft=r.scrollLeft+a/this.ratio,this.graphContainer.scrollTop=r.scrollTop+l/this.ratio):this.sourceGraph.translate(r.translateX-a/this.ratio,r.translateY-l/this.ratio);break}case"zooming":{const o=r.scale,a=r.geometry,l=1+(r.clientX-n)/a.width/o.sx;r.frameId&&cancelAnimationFrame(r.frameId),r.frameId=requestAnimationFrame(()=>{this.sourceGraph.zoom(l*r.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 r=this.targetGraph.translate();if(r.ty=r.ty||0,e.offsetX==null){const l=on(this.targetGraph.container);n=e.pageX-l.left,i=e.pageY-l.top}else n=e.offsetX,i=e.offsetY;const o=(n-r.tx)/this.ratio,a=(i-r.ty)/this.ratio;this.sourceGraph.centerPoint(o,a)}dispose(){this.remove(),We(this.name)}}yw([q.dispose()],Nc.prototype,"dispose",null);var qn;(function(s){s.root="widget-minimap",s.viewport=`${s.root}-viewport`,s.zoom=`${s.viewport}-zoom`})(qn||(qn={}));var Hi;(function(s){s.defaultOptions={width:300,height:200,padding:10,scalable:!0,minScale:.01,maxScale:16,graphOptions:{},createGraph:t=>new M(t)},s.documentEvents={mousemove:"doAction",touchmove:"doAction",mouseup:"stopAction",touchend:"stopAction"}})(Hi||(Hi={}));var xw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},vw=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};class Et extends q{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=Et.getOptions(t),this.onUpdate=rr(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"),B(this.container,this.prefixClassName(Et.containerClass)),J(this.container,{width:n,height:i}),this.options.pageVisible&&B(this.container,this.prefixClassName(Et.pagedClass)),this.options.className&&B(this.container,this.options.className);const r=this.graph.container;r.parentNode&&Xn(r,this.container),this.content=document.createElement("div"),B(this.content,this.prefixClassName(Et.contentClass)),J(this.content,{width:this.graph.options.width,height:this.graph.options.height}),this.background=document.createElement("div"),B(this.background,this.prefixClassName(Et.backgroundClass)),Ut(this.content,this.background),this.options.pageVisible||Ut(this.content,this.graph.view.grid),Ut(this.content,r),ue(this.content,this.container),this.startListening(),this.options.pageVisible||this.graph.grid.update(),this.backgroundManager=new Et.Background(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||Qt.events;this.delegatedHandlers=Object.keys(e).reduce((n,i)=>{const r=e[i];if(i.indexOf(" ")===-1)if(typeof r=="function")n[i]=r;else{let o=this.graph.view[r];typeof o=="function"&&(o=o.bind(this.graph.view),n[i]=o)}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(){(qt.IS_IE||qt.IS_EDGE)&&J(this.container,{visibility:"hidden"})}afterManipulation(){(qt.IS_IE||qt.IS_EDGE)&&J(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 r=!1;const o=document.createElement("div");for(let a=1,l=Math.floor(t/n);a<l;a+=1){const c=document.createElement("div");B(c,this.prefixClassName("graph-pagebreak-vertical")),J(c,{left:a*n}),ue(c,o),r=!0}for(let a=1,l=Math.floor(e/i);a<l;a+=1){const c=document.createElement("div");B(c,this.prefixClassName("graph-pagebreak-horizontal")),J(c,{top:a*i}),ue(c,o),r=!0}r&&(B(o,this.prefixClassName("graph-pagebreak")),cb(this.graph.view.grid,o),this.pageBreak=o)}}}update(){const t=this.getClientSize();this.cachedCenterPoint=this.clientToLocalPoint(t.width/2,t.height/2);let e=this.options.autoResizeOptions;typeof e=="function"&&(e=k(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=L.create()),t}updateScale(t,e){const n=this.graph.options,i=t/this.sx,r=e/this.sy;this.sx=t,this.sy=e,this.graph.translate(n.x*i,n.y*r),this.graph.transform.resize(n.width*i,n.height*r)}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),Bs(this.container,n),this}scrollToPoint(t,e){const n=this.getClientSize(),i=this.graph.matrix(),r={};return typeof t=="number"&&(r.scrollLeft=t-n.width/2+i.e+(this.padding.left||0)),typeof e=="number"&&(r.scrollTop=e-n.height/2+i.f+(this.padding.top||0)),Bs(this.container,r),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(),r=i.a,o=i.d,a=-i.e,l=-i.f,c=a+this.graph.options.width,h=l+this.graph.options.height;let f;if(this.storeClientSize(),typeof t=="number"||typeof e=="number"){f=n;const C=this.getVisibleArea().getCenter();typeof t=="number"?t*=r:t=C.x,typeof e=="number"?e*=o:e=C.y}else f=t,t=(a+c)/2,e=(l+h)/2;if(f&&f.padding)return this.positionPoint({x:t,y:e},"50%","50%",f);const u=this.getPadding(),d=this.getClientSize(),g=d.width/2,p=d.height/2,m=g-u.left-t+a,y=g-u.right+t-c,x=p-u.top-e+l,b=p-u.bottom+e-h;this.addPadding(Math.max(m,0),Math.max(y,0),Math.max(x,0),Math.max(b,0));const v=this.scrollToPoint(t,e);return this.restoreClientSize(),v}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=L.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:r}=i,o=vw(i,["padding"]),a=Yt(r),l=L.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),f=l.getCenter().diff(h),u=this.zoom(),d=f.scale(1/u,1/u),g=w.create(t).translate(d);return this.centerPoint(g.x,g.y,o)}zoom(t,e){if(t==null)return this.sx;e=e||{};let n,i;const r=this.getClientSize(),o=this.clientToLocalPoint(r.width/2,r.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-o.x)/c,i=e.center.y-(e.center.y-o.y)/h}else n=o.x,i=o.y;return this.beforeManipulation(),this.graph.transform.scale(a,l),this.centerPoint(n,i),this.afterManipulation(),this}zoomToRect(t,e={}){const n=L.create(t),i=this.graph;if(e.contentArea=n,e.viewportArea==null){const o=this.container.getBoundingClientRect();e.viewportArea={x:i.options.x,y:i.options.y,width:o.width,height:o.height}}this.beforeManipulation(),i.transform.scaleContentToFitImpl(e,!1);const r=n.getCenter();return this.centerPoint(r.x,r.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,r;const o=this.sx,a=Math.max(n.scale||o,1e-6),l=this.getClientSize(),c=new w(t,e),h=this.clientToLocalPoint(l.width/2,l.height/2);if(o===a){const u=h.diff(c).scale(o,o).round();i=`translate(${u.x}px,${u.y}px)`}else{const u=a/(o-a)*c.distance(h),d=h.clone().move(c,u),g=this.localToBackgroundPoint(d).round();i=`scale(${a/o})`,r=`${g.x}px ${g.y}px`}const f=n.onTransitionEnd;return B(this.container,Et.transitionClassName),st.off(this.content,Et.transitionEventName),st.on(this.content,Et.transitionEventName,u=>{this.syncTransition(a,{x:t,y:e}),typeof f=="function"&&k(f,this,u.originalEvent)}),J(this.content,{transform:i,transformOrigin:r,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 pt(this.container,Et.transitionClassName),st.off(this.content,Et.transitionEventName),J(this.content,{transform:"",transformOrigin:"",transition:"",transitionDuration:"",transitionDelay:"",transitionTimingFunction:""}),this}transitionToRect(t,e={}){const n=L.create(t),i=e.maxScale||1/0,r=e.minScale||Number.MIN_VALUE,o=e.scaleGrid||null,a=e.visibility||1,l=e.center?w.create(e.center):n.getCenter(),c=this.getClientSize(),h=c.width*a,f=c.height*a;let u=new L(l.x-h/2,l.y-f/2,h,f).getMaxUniformScaleToFit(n,l);return u=Math.min(u,i),o&&(u=Math.floor(u/o)*o),u=Math.max(r,u),this.transitionToPoint(l,Object.assign({scale:u},e))}startPanning(t){const e=this.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.trigger("pan:start",{e}),st.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)}),st.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){st.off(document.body,".panning"),st.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 r=this.graph.matrix();return n+=this.container.scrollLeft-this.padding.left-r.e,i+=this.container.scrollTop-this.padding.top-r.f,new w(n/r.a,i/r.d)}localToBackgroundPoint(t,e){const n=typeof t=="object"?w.create(t):new w(t,e),i=this.graph.matrix(),r=this.padding;return Q.transformPoint(n,i).translate(r.left,r.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,J(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,r=i.getBoundingClientRect();let o=0,a=0;return t<=r.left+10&&(o=-10),e<=r.top+10&&(a=-10),t>=r.right-10&&(o=10),e>=r.bottom-10&&(a=10),o!==0&&(i.scrollLeft+=o),a!==0&&(i.scrollTop+=a),{scrollerX:o,scrollerY:a}}addPadding(t,e,n,i){let r=this.getPadding();this.padding={left:Math.round(r.left+(t||0)),top:Math.round(r.top+(n||0)),bottom:Math.round(r.bottom+(i||0)),right:Math.round(r.right+(e||0))},r=this.padding,J(this.content,{width:r.left+this.graph.options.width+r.right,height:r.top+this.graph.options.height+r.bottom});const o=this.graph.container;return o.style.left=`${this.padding.left}px`,o.style.top=`${this.padding.top}px`,this}getPadding(){const t=this.options.padding;return Yt(typeof t=="function"?k(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=Q.transformRectangle(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 J(this.container,{overflow:"hidden"}),this}unlock(){return J(this.container,{overflow:"scroll"}),this}onRemove(){this.stopListening()}dispose(){Xn(this.container,this.graph.container),this.remove()}}xw([q.dispose()],Et.prototype,"dispose",null);(function(s){class t extends fs{get elem(){return this.scroller.background}constructor(n){super(n.graph),this.scroller=n,n.options.background&&this.draw(n.options.background)}init(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}updateBackgroundOptions(n){this.scroller.options.background=n}}s.Background=t})(Et||(Et={}));(function(s){s.containerClass="graph-scroller",s.panningClass=`${s.containerClass}-panning`,s.pannableClass=`${s.containerClass}-pannable`,s.pagedClass=`${s.containerClass}-paged`,s.contentClass=`${s.containerClass}-content`,s.backgroundClass=`${s.containerClass}-background`,s.transitionClassName="transition-in-progress",s.transitionEventName="transitionend.graph-scroller-transition",s.defaultOptions={padding(){const e=this.getClientSize(),n=Math.max(this.options.minVisibleWidth||0,1)||1,i=Math.max(this.options.minVisibleHeight||0,1)||1,r=Math.max(e.width-n,0),o=Math.max(e.height-i,0);return{left:r,top:o,right:r,bottom:o}},minVisibleWidth:50,minVisibleHeight:50,pageVisible:!1,pageBreak:!1,autoResize:!0};function t(e){const n=mt({},s.defaultOptions,e);n.pageWidth==null&&(n.pageWidth=e.graph.options.width),n.pageHeight==null&&(n.pageHeight=e.graph.options.height);const i=e.graph.options;return i.background&&n.enabled&&n.background==null&&(n.background=i.background,e.graph.background.clear()),n}s.getOptions=t})(Et||(Et={}));const ww=`.x6-graph-scroller {
309
+ position: relative;
310
+ box-sizing: border-box;
311
+ overflow: scroll;
312
+ outline: none;
313
+ }
314
+ .x6-graph-scroller-content {
315
+ position: relative;
316
+ }
317
+ .x6-graph-scroller-background {
318
+ position: absolute;
319
+ top: 0;
320
+ right: 0;
321
+ bottom: 0;
322
+ left: 0;
323
+ }
324
+ .x6-graph-scroller .x6-graph {
325
+ position: absolute;
326
+ display: inline-block;
327
+ margin: 0;
328
+ box-shadow: none;
329
+ }
330
+ .x6-graph-scroller .x6-graph > svg {
331
+ display: block;
332
+ }
333
+ .x6-graph-scroller.x6-graph-scroller-paged .x6-graph {
334
+ box-shadow: 0 0 4px 0 #eee;
335
+ }
336
+ .x6-graph-scroller.x6-graph-scroller-pannable[data-panning='false'] {
337
+ cursor: grab;
338
+ }
339
+ .x6-graph-scroller.x6-graph-scroller-pannable[data-panning='true'] {
340
+ cursor: grabbing;
341
+ user-select: none;
342
+ }
343
+ .x6-graph-pagebreak {
344
+ position: absolute;
345
+ top: 0;
346
+ right: 0;
347
+ bottom: 0;
348
+ left: 0;
349
+ }
350
+ .x6-graph-pagebreak-vertical {
351
+ position: absolute;
352
+ top: 0;
353
+ bottom: 0;
354
+ box-sizing: border-box;
355
+ width: 1px;
356
+ border-left: 1px dashed #bdbdbd;
357
+ }
358
+ .x6-graph-pagebreak-horizontal {
359
+ position: absolute;
360
+ right: 0;
361
+ left: 0;
362
+ box-sizing: border-box;
363
+ height: 1px;
364
+ border-top: 1px dashed #bdbdbd;
365
+ }
366
+ `;M.prototype.lockScroller=function(){const s=this.getPlugin("scroller");return s&&s.lockScroller(),this};M.prototype.unlockScroller=function(){const s=this.getPlugin("scroller");return s&&s.unlockScroller(),this};M.prototype.updateScroller=function(){const s=this.getPlugin("scroller");return s&&s.updateScroller(),this};M.prototype.getScrollbarPosition=function(){const s=this.getPlugin("scroller");return s?s.getScrollbarPosition():{left:0,top:0}};M.prototype.setScrollbarPosition=function(s,t){const e=this.getPlugin("scroller");return e&&e.setScrollbarPosition(s,t),this};var Cw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Rc extends rt{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,Ue(this.name,ww)}init(t){this.graph=t;const e=Et.getOptions(Object.assign(Object.assign({enabled:!0},this.options),{graph:t}));this.options=e,this.scrollerImpl=new Et(e),this.setup(),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)}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),st.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")&&st.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&&ge.isMatch(t,this.options.modifiers,e)}updateClassName(t){const e=this.scrollerImpl.container,n=Vt.prefix("graph-scroller-pannable");this.pannable?(B(e,n),e.dataset.panning=(!!t).toString()):pt(e,n)}dispose(){this.scrollerImpl.dispose(),this.stopListening(),this.off(),We(this.name)}}Cw([rt.dispose()],Rc.prototype,"dispose",null);var Pw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Lc extends q{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(Bt.classNames.box)}get $boxes(){return ub(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(t){super(),this.options=t,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new Fi([],{comparator:Bt.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.startListening()}startListening(){const t=this.graph,e=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown"},!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),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.updateSelectionBoxes()}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:t,options:e}){const{showNodeSelectionBox:n,pointerEvents:i}=this.options,{ui:r,selection:o,translateBy:a,snapped:l}=e,c=(n!==!0||i&&this.getPointerEventsValue(i)==="none")&&!this.translating&&!o,h=r&&a&&t.id===a;if(c&&(h||l)){this.translating=!0;const f=t.position(),u=t.previous("position"),d=f.x-u.x,g=f.y-u.y;(d!==0||g!==0)&&this.translateSelectedNodes(d,g,t,e),this.translating=!1}}onModelUpdated({removed:t}){t&&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){if(e.batch){const c=this.filter(Array.isArray(t)?t:[t]);return this.collection.reset(c,Object.assign(Object.assign({},e),{ui:!0})),this}const n=this.cells,i=this.filter(Array.isArray(t)?t:[t]),r={},o={};n.forEach(c=>r[c.id]=c),i.forEach(c=>o[c.id]=c);const a=[],l=[];return i.forEach(c=>{r[c.id]||a.push(c)}),n.forEach(c=>{o[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})),l.length===0&&a.length===0&&this.updateContainer(),this}return this.clean(e)}clean(t={}){return this.length&&(t.batch===!1?this.unselect(this.cells,t):this.collection.reset([],Object.assign(Object.assign({},t),{ui:!0}))),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 r=on(i),o=i.scrollLeft,a=i.scrollTop;e=t.clientX-r.left+window.pageXOffset+o,n=t.clientY-r.top+window.pageYOffset+a}J(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(Bt.documentEvents,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"?k(e,this.graph,n):!0)}stopSelecting(t){const e=this.graph,n=this.getEventData(t);switch(n.action){case"selecting":{let r=Ub(this.container),o=Wb(this.container);const a=on(this.container),l=e.pageToLocal(a.left,a.top),c=e.transform.getScale();r/=c.sx,o/=c.sy;const h=new L(l.x,l.y,r,o),f=this.getCellViewsInArea(h).map(u=>u.cell);this.reset(f,{batch:!0}),this.hideRubberband();break}case"translating":{const r=e.snapToGrid(t.clientX,t.clientY);if(!this.options.following){const o=n;this.updateSelectedNodesPosition({dx:o.clientX-o.originX,dy:o.clientY-o.originY})}this.graph.model.stopBatch("move-selection"),this.notifyBoxEvent("box:mouseup",t,r.x,r.y);break}default:{this.clean();break}}}onMouseUp(t){this.getEventData(t).action&&(this.stopSelecting(t),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(t){this.options.following||t.stopPropagation();const e=this.normalizeEvent(t);this.options.movable&&this.startTranslating(e);const n=this.getCellViewFromElem(e.target);this.setEventData(e,{activeView:n});const i=this.graph.snapToGrid(e.clientX,e.clientY);this.notifyBoxEvent("box:mousedown",e,i.x,i.y),this.delegateDocumentEvents(Bt.documentEvents,e.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})}getRestrictArea(){const t=this.graph.options.translating.restrict,e=typeof t=="function"?k(t,this.graph,null):t;return typeof e=="number"?this.graph.transform.getGraphArea().inflate(e):e===!0?this.graph.transform.getGraphArea():e||null}getSelectionOffset(t,e){let n=t.x-e.clientX,i=t.y-e.clientY;const r=this.getRestrictArea();if(r){const o=this.collection.toArray(),a=K.getCellsBBox(o,{deep:!0})||L.create(),l=r.x-a.x,c=r.y-a.y,h=r.x+r.width-(a.x+a.width),f=r.y+r.height-(a.y+a.height);if(n<l&&(n=l),i<c&&(i=c),h<n&&(n=h),f<i&&(i=f),!this.options.following){const u=t.x-e.originX,d=t.y-e.originY;n=u<=l||u>=h?0:n,i=d<=c||d>=f?0:i}}return{dx:n,dy:i}}updateElementPosition(t,e,n){const i=J(t,"left"),r=J(t,"top"),o=i?parseFloat(i):0,a=r?parseFloat(r):0;J(t,"left",o+e),J(t,"top",a+n)}updateSelectedNodesPosition(t){const{dx:e,dy:n}=t;if(e||n)if(this.translateSelectedNodes(e,n),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{const i=this.graph.transform.getScale();for(let r=0,o=this.$boxes,a=o.length;r<a;r+=1)this.updateElementPosition(o[r],e*i.sx,n*i.sy);this.updateElementPosition(this.selectionContainer,e*i.sx,n*i.sy)}}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");return n?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 r=n;r.moving!==!0&&(ue(this.container,this.graph.container),this.showRubberband(),r.moving=!0);const{scrollerX:o,scrollerY:a}=this.autoScrollGraph(e.clientX,e.clientY);r.scrollerX+=o,r.scrollerY+=a;const l=e.clientX-r.clientX+r.scrollerX,c=e.clientY-r.clientY+r.scrollerY,h=parseInt(J(this.container,"left")||"0",10),f=parseInt(J(this.container,"top")||"0",10);J(this.container,{left:l<0?r.offsetX+l:h,top:c<0?r.offsetY+c:f,width:Math.abs(l),height:Math.abs(c)});break}case"translating":{const r=this.graph.snapToGrid(e.clientX,e.clientY),o=n,a=this.getSelectionOffset(r,o);this.options.following?this.updateSelectedNodesPosition(a):this.updateContainerPosition(a),a.dx&&(o.clientX=r.x),a.dy&&(o.clientY=r.y),this.notifyBoxEvent("box:mousemove",t,r.x,r.y);break}}this.boxesUpdated=!1}translateSelectedNodes(t,e,n,i){const r={},o=[];if(n&&(r[n.id]=!0),this.collection.toArray().forEach(a=>{a.getDescendants({deep:!0}).forEach(l=>{r[l.id]=!0})}),i&&i.translateBy){const a=this.graph.getCellById(i.translateBy);a&&(r[a.id]=!0,a.getDescendants({deep:!0}).forEach(l=>{r[l.id]=!0}),o.push(a))}this.collection.toArray().forEach(a=>{if(!r[a.id]){const l=Object.assign(Object.assign({},i),{selection:this.cid,exclude:o});a.translate(t,e,l),this.graph.model.getConnectedEdges(a).forEach(c=>{r[c.id]||(c.translate(t,e,l),r[c.id]=!0)})}})}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(r=>e.renderer.findViewByCell(r)).filter(r=>r!=null))),this.options.rubberEdge&&(i=i.concat(e.model.getEdgesInArea(t,n).map(r=>e.renderer.findViewByCell(r)).filter(r=>r!=null))),i}notifyBoxEvent(t,e,n,i){const o=this.getEventData(e).activeView;this.trigger(t,{e,view:o,x:n,y:i,cell:o.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)&&(ie(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(),ie(this.$boxes),this.boxCount=0}hide(){pt(this.container,this.prefixClassName(Bt.classNames.rubberband)),pt(this.container,this.prefixClassName(Bt.classNames.selected))}showRubberband(){B(this.container,this.prefixClassName(Bt.classNames.rubberband))}hideRubberband(){pt(this.container,this.prefixClassName(Bt.classNames.rubberband))}showSelected(){yr(this.container,"style"),B(this.container,this.prefixClassName(Bt.classNames.selected))}createContainer(){this.container=document.createElement("div"),B(this.container,this.prefixClassName(Bt.classNames.root)),this.options.className&&B(this.container,this.options.className),this.selectionContainer=document.createElement("div"),B(this.selectionContainer,this.prefixClassName(Bt.classNames.inner)),this.selectionContent=document.createElement("div"),B(this.selectionContent,this.prefixClassName(Bt.classNames.content)),Ut(this.selectionContainer,this.selectionContent),X(this.selectionContainer,"data-selection-length",this.collection.length),ul(this.container,this.selectionContainer)}updateContainerPosition(t){(t.dx||t.dy)&&this.updateElementPosition(this.selectionContainer,t.dx,t.dy)}updateContainer(){const t={x:1/0,y:1/0},e={x:0,y:0};this.collection.toArray().filter(r=>this.canShowSelectionBox(r)).forEach(r=>{const o=this.graph.renderer.findViewByCell(r);if(o){const a=o.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)}}),J(this.selectionContainer,{position:"absolute",pointerEvents:"none",left:t.x,top:t.y,width:e.x-t.x,height:e.y-t.y}),X(this.selectionContainer,"data-selection-length",this.collection.length);const i=this.options.content;if(i)if(typeof i=="function"){const r=k(i,this.graph,this,this.selectionContent);r&&(this.selectionContent.innerHTML=r)}else this.selectionContent.innerHTML=i;this.collection.length>0&&!this.container.parentNode?ue(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,r=document.createElement("div"),o=this.options.pointerEvents;B(r,i),B(r,`${i}-${t.isNode()?"node":"edge"}`),X(r,"data-cell-id",t.id),J(r,{position:"absolute",left:n.x,top:n.y,width:n.width,height:n.height,pointerEvents:o?this.getPointerEventsValue(o):"auto"}),ue(r,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){this.collection.length>0&&(this.boxesUpdated=!0,this.confirmUpdate())}confirmUpdate(){if(this.boxCount){this.hide();for(let t=0,e=this.$boxes,n=e.length;t<n;t+=1){const i=e[t],r=X(i,"data-cell-id");ie(i),this.boxCount-=1;const o=this.collection.get(r);o&&this.createSelectionBox(o)}this.updateContainer()}return 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.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.updateContainer()}listenCellRemoveEvent(t){t.off("removed",this.onCellRemoved,this),t.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:t,removed:e,options:n}){t.forEach(r=>{this.trigger("cell:selected",{cell:r,options:n}),r.isNode()?this.trigger("node:selected",{cell:r,options:n,node:r}):r.isEdge()&&this.trigger("edge:selected",{cell:r,options:n,edge:r})}),e.forEach(r=>{this.trigger("cell:unselected",{cell:r,options:n}),r.isNode()?this.trigger("node:unselected",{cell:r,options:n,node:r}):r.isEdge()&&this.trigger("edge:unselected",{cell:r,options:n,edge:r})});const i={added:t,removed:e,options:n,selected:this.cells.filter(r=>!!this.graph.getCellById(r.id))};this.trigger("selection:changed",i)}dispose(){this.clean(),this.remove(),this.off()}}Pw([q.dispose()],Lc.prototype,"dispose",null);var Bt;(function(s){const t="widget-selection";s.classNames={root:t,inner:`${t}-inner`,box:`${t}-box`,content:`${t}-content`,rubberband:`${t}-rubberband`,selected:`${t}-selected`},s.documentEvents={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"};function e(n){return n.getAncestors().length}s.depthComparator=e})(Bt||(Bt={}));const Sw=`.x6-widget-selection {
367
+ position: absolute;
368
+ top: 0;
369
+ left: 0;
370
+ display: none;
371
+ width: 0;
372
+ height: 0;
373
+ touch-action: none;
374
+ }
375
+ .x6-widget-selection-rubberband {
376
+ display: block;
377
+ overflow: visible;
378
+ opacity: 0.3;
379
+ }
380
+ .x6-widget-selection-selected {
381
+ display: block;
382
+ }
383
+ .x6-widget-selection-box {
384
+ cursor: move;
385
+ }
386
+ .x6-widget-selection-inner[data-selection-length='0'],
387
+ .x6-widget-selection-inner[data-selection-length='1'] {
388
+ display: none;
389
+ }
390
+ .x6-widget-selection-content {
391
+ position: absolute;
392
+ top: 100%;
393
+ right: -20px;
394
+ left: -20px;
395
+ margin-top: 30px;
396
+ padding: 6px;
397
+ line-height: 14px;
398
+ text-align: center;
399
+ border-radius: 6px;
400
+ }
401
+ .x6-widget-selection-content:empty {
402
+ display: none;
403
+ }
404
+ .x6-widget-selection-rubberband {
405
+ background-color: #3498db;
406
+ border: 2px solid #2980b9;
407
+ }
408
+ .x6-widget-selection-box {
409
+ box-sizing: content-box !important;
410
+ margin-top: -4px;
411
+ margin-left: -4px;
412
+ padding-right: 4px;
413
+ padding-bottom: 4px;
414
+ border: 2px dashed #feb663;
415
+ box-shadow: 2px 2px 5px #d3d3d3;
416
+ }
417
+ .x6-widget-selection-inner {
418
+ box-sizing: content-box !important;
419
+ margin-top: -8px;
420
+ margin-left: -8px;
421
+ padding-right: 12px;
422
+ padding-bottom: 12px;
423
+ border: 2px solid #feb663;
424
+ box-shadow: 2px 2px 5px #d3d3d3;
425
+ }
426
+ .x6-widget-selection-content {
427
+ color: #fff;
428
+ font-size: 10px;
429
+ background-color: #6a6b8a;
430
+ }
431
+ `;M.prototype.isSelectionEnabled=function(){const s=this.getPlugin("selection");return s?s.isEnabled():!1};M.prototype.enableSelection=function(){const s=this.getPlugin("selection");return s&&s.enable(),this};M.prototype.disableSelection=function(){const s=this.getPlugin("selection");return s&&s.disable(),this};M.prototype.toggleSelection=function(s){const t=this.getPlugin("selection");return t&&t.toggleEnabled(s),this};M.prototype.isMultipleSelection=function(){const s=this.getPlugin("selection");return s?s.isMultipleSelection():!1};M.prototype.enableMultipleSelection=function(){const s=this.getPlugin("selection");return s&&s.enableMultipleSelection(),this};M.prototype.disableMultipleSelection=function(){const s=this.getPlugin("selection");return s&&s.disableMultipleSelection(),this};M.prototype.toggleMultipleSelection=function(s){const t=this.getPlugin("selection");return t&&t.toggleMultipleSelection(s),this};M.prototype.isSelectionMovable=function(){const s=this.getPlugin("selection");return s?s.isSelectionMovable():!1};M.prototype.enableSelectionMovable=function(){const s=this.getPlugin("selection");return s&&s.enableSelectionMovable(),this};M.prototype.disableSelectionMovable=function(){const s=this.getPlugin("selection");return s&&s.disableSelectionMovable(),this};M.prototype.toggleSelectionMovable=function(s){const t=this.getPlugin("selection");return t&&t.toggleSelectionMovable(s),this};M.prototype.isRubberbandEnabled=function(){const s=this.getPlugin("selection");return s?s.isRubberbandEnabled():!1};M.prototype.enableRubberband=function(){const s=this.getPlugin("selection");return s&&s.enableRubberband(),this};M.prototype.disableRubberband=function(){const s=this.getPlugin("selection");return s&&s.disableRubberband(),this};M.prototype.toggleRubberband=function(s){const t=this.getPlugin("selection");return t&&t.toggleRubberband(s),this};M.prototype.isStrictRubberband=function(){const s=this.getPlugin("selection");return s?s.isStrictRubberband():!1};M.prototype.enableStrictRubberband=function(){const s=this.getPlugin("selection");return s&&s.enableStrictRubberband(),this};M.prototype.disableStrictRubberband=function(){const s=this.getPlugin("selection");return s&&s.disableStrictRubberband(),this};M.prototype.toggleStrictRubberband=function(s){const t=this.getPlugin("selection");return t&&t.toggleStrictRubberband(s),this};M.prototype.setRubberbandModifiers=function(s){const t=this.getPlugin("selection");return t&&t.setRubberbandModifiers(s),this};M.prototype.setSelectionFilter=function(s){const t=this.getPlugin("selection");return t&&t.setSelectionFilter(s),this};M.prototype.setSelectionDisplayContent=function(s){const t=this.getPlugin("selection");return t&&t.setSelectionDisplayContent(s),this};M.prototype.isSelectionEmpty=function(){const s=this.getPlugin("selection");return s?s.isEmpty():!0};M.prototype.cleanSelection=function(s){const t=this.getPlugin("selection");return t&&t.clean(s),this};M.prototype.resetSelection=function(s,t){const e=this.getPlugin("selection");return e&&e.reset(s,t),this};M.prototype.getSelectedCells=function(){const s=this.getPlugin("selection");return s?s.getSelectedCells():[]};M.prototype.getSelectedCellCount=function(){const s=this.getPlugin("selection");return s?s.getSelectedCellCount():0};M.prototype.isSelected=function(s){const t=this.getPlugin("selection");return t?t.isSelected(s):!1};M.prototype.select=function(s,t){const e=this.getPlugin("selection");return e&&e.select(s,t),this};M.prototype.unselect=function(s,t){const e=this.getPlugin("selection");return e&&e.unselect(s,t),this};var Ow=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Cn extends rt{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},Cn.defaultOptions),t),Ue(this.name,Sw)}init(t){this.graph=t,this.selectionImpl=new Lc(Object.assign(Object.assign({},this.options),{graph:t})),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 e?.includes("leftMouseDown")&&t.button===0||e?.includes("mouseWheelDown")&&t.button===1}onBlankClick(){this.clean()}allowRubberband(t,e){return!this.rubberbandDisabled&&ge.isMatch(t,this.options.modifiers,e)}allowMultipleSelection(t){return this.isMultiple()&&ge.isMatch(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(),We(this.name)}}Ow([rt.dispose()],Cn.prototype,"dispose",null);(function(s){s.defaultOptions={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"]}})(Cn||(Cn={}));var Ew=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Aw=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};class Ic extends q{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=Aw(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 z("svg"),e=this.horizontal=new z("line"),n=this.vertical=new z("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 r=t.cell.getPosition();this.offset={x:e-r.x,y:n-r.y}}}isNodeMovable(t){return t&&t.cell.isNode()&&t.can("nodeMovable")}getRestrictArea(t){const e=this.graph.options.translating.restrict,n=typeof e=="function"?k(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(),r=i.bbox(t.getAngle()),o=r.getTopLeft(),a=r.getBottomRight(),l=W.normalize(t.getAngle()),c=this.options.tolerance||0;let h,f,u,d,g,p;const m={vertical:0,horizontal:0},y=e.direction,x=e.trueDirection,b=e.relativeDirection;x.indexOf("right")!==-1?m.vertical=a.x:m.vertical=o.x,x.indexOf("bottom")!==-1?m.horizontal=a.y:m.horizontal=o.y,this.model.getNodes().some(I=>{if(this.isIgnored(t,I))return!1;const _=I.getBBox().bbox(I.getAngle()),F=_.getTopLeft(),A=_.getBottomRight(),N={vertical:[F.x,A.x],horizontal:[F.y,A.y]},V={};return Object.keys(N).forEach(it=>{const tt=it,ht=N[tt].map(D=>({position:D,distance:Math.abs(D-m[tt])})).filter(D=>D.distance<=c);V[tt]=or(ht,D=>D.distance)}),h==null&&V.vertical.length>0&&(h=V.vertical[0].position,f=Math.min(r.y,_.y),u=Math.max(a.y,A.y)-f),d==null&&V.horizontal.length>0&&(d=V.horizontal[0].position,g=Math.min(r.x,_.x),p=Math.max(a.x,A.x)-g),h!=null&&d!=null}),this.hide();let v=0,C=0;(d!=null||h!=null)&&(h!=null&&(v=x.indexOf("right")!==-1?h-a.x:o.x-h),d!=null&&(C=x.indexOf("bottom")!==-1?d-a.y:o.y-d));let S=0,P=0;if(l%90===0)l===90||l===270?(S=C,P=v):(S=v,P=C);else{const I=l>=0&&l<90?1:l>=90&&l<180?4:l>=180&&l<270?3:2;d!=null&&h!=null&&(v<C?(C=0,d=void 0):(v=0,h=void 0));const _=W.toRad(l%90);v&&(S=I===3?v/Math.cos(_):v/Math.sin(_)),C&&(P=I===3?C/Math.cos(_):C/Math.sin(_));const F=I===1||I===3;switch(b){case"top":case"bottom":P=C?C/(F?Math.cos(_):Math.sin(_)):v/(F?Math.sin(_):Math.cos(_));break;case"left":case"right":S=v?v/(F?Math.cos(_):Math.sin(_)):C/(F?Math.sin(_):Math.cos(_));break}}switch(b){case"top":case"bottom":S=0;break;case"left":case"right":P=0;break}const O=this.graph.getGridSize();let E=Math.max(i.width+S,O),R=Math.max(i.height+P,O);e.minWidth&&e.minWidth>O&&(E=Math.max(E,e.minWidth)),e.minHeight&&e.minHeight>O&&(R=Math.max(R,e.minHeight)),e.maxWidth&&(E=Math.min(E,e.maxWidth)),e.maxHeight&&(R=Math.min(R,e.maxHeight)),e.preserveAspectRatio&&(P<S?R=E*(i.height/i.width):E=R*(i.width/i.height)),(E!==i.width||R!==i.height)&&(t.resize(E,R,{direction:y,relativeDirection:b,trueDirection:x,snapped:!0,snaplines:this.cid,restrict:this.getRestrictArea(n)}),u&&(u+=R-i.height),p&&(p+=E-i.width));const T=t.getBBox().bbox(l);h&&Math.abs(T.x-h)>1&&Math.abs(T.width+T.x-h)>1&&(h=void 0),d&&Math.abs(T.y-d)>1&&Math.abs(T.height+T.y-d)>1&&(d=void 0),this.update({verticalLeft:h,verticalTop:f,verticalHeight:u,horizontalTop:d,horizontalLeft:g,horizontalWidth:p})}}}snapOnMoving({view:t,e,x:n,y:i}){const r=t.getEventData(e).delegatedView||t;if(!this.isNodeMovable(r))return;const o=r.cell,a=o.getSize(),l=o.getPosition(),c=new L(n-this.offset.x,i-this.offset.y,a.width,a.height),h=o.getAngle(),f=c.getCenter(),u=c.bbox(h),d=u.getTopLeft(),g=u.getBottomRight(),p=this.options.tolerance||0;let m,y,x,b,v,C,S=0,P=0;if(this.model.getNodes().some(O=>{if(this.isIgnored(o,O))return!1;const E=O.getBBox().bbox(O.getAngle()),R=E.getCenter(),T=E.getTopLeft(),I=E.getBottomRight();return m==null&&(Math.abs(R.x-f.x)<p?(m=R.x,S=.5):Math.abs(T.x-d.x)<p?(m=T.x,S=0):Math.abs(T.x-g.x)<p?(m=T.x,S=1):Math.abs(I.x-g.x)<p?(m=I.x,S=1):Math.abs(I.x-d.x)<p&&(m=I.x),m!=null&&(y=Math.min(u.y,E.y),x=Math.max(g.y,I.y)-y)),b==null&&(Math.abs(R.y-f.y)<p?(b=R.y,P=.5):Math.abs(T.y-d.y)<p?b=T.y:Math.abs(T.y-g.y)<p?(b=T.y,P=1):Math.abs(I.y-g.y)<p?(b=I.y,P=1):Math.abs(I.y-d.y)<p&&(b=I.y),b!=null&&(v=Math.min(u.x,E.x),C=Math.max(g.x,I.x)-v)),m!=null&&b!=null}),this.hide(),b!=null||m!=null){b!=null&&(u.y=b-P*u.height),m!=null&&(u.x=m-S*u.width);const O=u.getCenter(),E=O.x-c.width/2,R=O.y-c.height/2,T=E-l.x,I=R-l.y;(T!==0||I!==0)&&(o.translate(T,I,{snapped:!0,restrict:this.getRestrictArea(r)}),C&&(C+=T),x&&(x+=I)),this.update({verticalLeft:m,verticalTop:y,verticalHeight:x,horizontalTop:b,horizontalLeft:v,horizontalWidth:C})}}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"?k(e,this.graph,t):!0}update(t){if(t.horizontalTop){const e=this.graph.localToGraph(new w(t.horizontalLeft,t.horizontalTop)),n=this.graph.localToGraph(new w(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 w(t.verticalLeft,t.verticalTop)),n=this.graph.localToGraph(new w(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()}}Ew([q.dispose()],Ic.prototype,"dispose",null);const Mw=`.x6-widget-snapline {
432
+ position: absolute;
433
+ top: 0;
434
+ right: 0;
435
+ bottom: 0;
436
+ left: 0;
437
+ pointer-events: none;
438
+ }
439
+ .x6-widget-snapline-vertical,
440
+ .x6-widget-snapline-horizontal {
441
+ stroke: #2ecc71;
442
+ stroke-width: 1px;
443
+ }
444
+ `;M.prototype.isSnaplineEnabled=function(){const s=this.getPlugin("snapline");return s?s.isEnabled():!1};M.prototype.enableSnapline=function(){const s=this.getPlugin("snapline");return s&&s.enable(),this};M.prototype.disableSnapline=function(){const s=this.getPlugin("snapline");return s&&s.disable(),this};M.prototype.toggleSnapline=function(){const s=this.getPlugin("snapline");return s&&s.toggleEnabled(),this};M.prototype.hideSnapline=function(){const s=this.getPlugin("snapline");return s&&s.hide(),this};M.prototype.setSnaplineFilter=function(s){const t=this.getPlugin("snapline");return t&&t.setFilter(s),this};M.prototype.isSnaplineOnResizingEnabled=function(){const s=this.getPlugin("snapline");return s?s.isOnResizingEnabled():!1};M.prototype.enableSnaplineOnResizing=function(){const s=this.getPlugin("snapline");return s&&s.enableOnResizing(),this};M.prototype.disableSnaplineOnResizing=function(){const s=this.getPlugin("snapline");return s&&s.disableOnResizing(),this};M.prototype.toggleSnaplineOnResizing=function(s){const t=this.getPlugin("snapline");return t&&t.toggleOnResizing(s),this};M.prototype.isSharpSnapline=function(){const s=this.getPlugin("snapline");return s?s.isSharp():!1};M.prototype.enableSharpSnapline=function(){const s=this.getPlugin("snapline");return s&&s.enableSharp(),this};M.prototype.disableSharpSnapline=function(){const s=this.getPlugin("snapline");return s&&s.disableSharp(),this};M.prototype.toggleSharpSnapline=function(s){const t=this.getPlugin("snapline");return t&&t.toggleSharp(s),this};M.prototype.getSnaplineTolerance=function(){const s=this.getPlugin("snapline");if(s)return s.getTolerance()};M.prototype.setSnaplineTolerance=function(s){const t=this.getPlugin("snapline");return t&&t.setTolerance(s),this};var Tw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class jc extends Dt{constructor(t={}){super(),this.name="snapline",this.options=Object.assign({enabled:!0,tolerance:10},t),Ue(this.name,Mw)}init(t){this.snaplineImpl=new Ic(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(),We(this.name)}}Tw([Dt.dispose()],jc.prototype,"dispose",null);var Nw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Dc extends q{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({},St.defaultOptions),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");X(t,"draggable","false");const e=t.cloneNode(!0);B(e,this.rotateClassName);const n=St.POSITIONS.map(i=>{const r=t.cloneNode(!0);return B(r,this.resizeClassName),X(r,"data-position",i),r});this.empty(),Ut(this.container,[...n,e])}render(){return this.renderHandles(),this.view&&this.view.addClass(St.NODE_CLS),B(this.container,this.containerClassName),$n(this.container,"no-orth-resize",this.options.preserveAspectRatio||!this.options.orthogonalResizing),$n(this.container,"no-resize",!this.options.resizable),$n(this.container,"no-rotate",!this.options.rotatable),this.options.className&&B(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=W.normalize(this.node.getAngle()),i=n!==0?`rotate(${n}deg)`:"";return J(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(St.NODE_CLS),super.remove()}onKnobMouseDown(){this.startHandle()}onKnobMouseUp(){this.stopHandle()}updateResizerDirections(){const t=W.normalize(this.node.getAngle()),e=Math.floor(t*(St.DIRECTIONS.length/360));if(e!==this.prevShift){const n=St.DIRECTIONS.slice(e).concat(St.DIRECTIONS.slice(0,e)),i=o=>`${this.containerClassName}-cursor-${o}`;this.container.querySelectorAll(`.${this.resizeClassName}`).forEach((o,a)=>{pt(o,St.DIRECTIONS.map(l=>i(l)).join(" ")),B(o,i(n[a]))}),this.prevShift=e}}getTrueDirection(t){const e=W.normalize(this.node.getAngle());let n=St.POSITIONS.indexOf(t);return n+=Math.floor(e*(St.POSITIONS.length/360)),n%=St.POSITIONS.length,St.POSITIONS[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=X(t.target,"data-position");this.prepareResizing(t,e),this.startAction(t)}prepareResizing(t,e){const n=this.getTrueDirection(e);let i=0,r=0;e.split("-").forEach(c=>{i={left:-1,right:1}[c]||i,r={top:-1,bottom:1}[c]||r});const o=this.toValidResizeDirection(e),a={"top-right":"bottomLeft","top-left":"bottomRight","bottom-left":"topRight","bottom-right":"topLeft"}[o],l=W.normalize(this.node.getAngle());this.setEventData(t,{selector:a,direction:o,trueDirection:n,relativeDirection:e,angle:l,resizeX:i,resizeY:r,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:W.normalize(this.node.getAngle()),start:w.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 r=i.clientX,o=i.clientY;const a=this.graph.getPlugin("scroller"),l=this.options.restrictedResizing;if(l===!0||typeof l=="number"){const d=l===!0?0:l,g=a?Math.max(d,8):d,p=this.graph.container.getBoundingClientRect();r=kt(r,p.left+g,p.right-g),o=kt(o,p.top+g,p.bottom-g)}else this.options.autoScrollOnResizing&&a&&a.autoScroll(r,o);const c=this.graph.snapToGrid(r,o),h=this.graph.getGridSize(),f=this.node,u=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 d=f.getBBox(),g=w.create(c).rotate(n.angle,d.getCenter()).diff(d[n.selector]);let p=n.resizeX?g.x*n.resizeX:d.width,m=n.resizeY?g.y*n.resizeY:d.height;const y=p,x=m;if(p=Z.snapToGrid(p,h),m=Z.snapToGrid(m,h),p=Math.max(p,u.minWidth||h),m=Math.max(m,u.minHeight||h),p=Math.min(p,u.maxWidth||1/0),m=Math.min(m,u.maxHeight||1/0),u.preserveAspectRatio){const v=d.width*m/d.height,C=d.height*p/d.width;p<v?m=C:p=v}const b=n.relativeDirection;if(u.allowReverse&&(y<=-p||x<=-m)){let v;b==="left"?y<=-p&&(v="right"):b==="right"?y<=-p&&(v="left"):b==="top"?x<=-m&&(v="bottom"):b==="bottom"?x<=-m&&(v="top"):b==="top-left"?y<=-p&&x<=-m?v="bottom-right":y<=-p?v="top-right":x<=-m&&(v="bottom-left"):b==="top-right"?y<=-p&&x<=-m?v="bottom-left":y<=-p?v="top-left":x<=-m&&(v="bottom-right"):b==="bottom-left"?y<=-p&&x<=-m?v="top-right":y<=-p?v="bottom-right":x<=-m&&(v="top-left"):b==="bottom-right"&&(y<=-p&&x<=-m?v="top-left":y<=-p?v="bottom-left":x<=-m&&(v="top-right"));const C=v;this.stopHandle();const S=this.container.querySelector(`.${this.resizeClassName}[data-position="${C}"]`);this.startHandle(S),this.prepareResizing(t,C),this.onMouseMove(t)}if(d.width!==p||d.height!==m){const v={ui:!0,direction:n.direction,relativeDirection:n.relativeDirection,trueDirection:n.trueDirection,minWidth:u.minWidth,minHeight:u.minHeight,maxWidth:u.maxWidth,maxHeight:u.maxHeight,preserveAspectRatio:u.preserveAspectRatio===!0};f.resize(p,m,v),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 d=f.getAngle(),g=n.start-w.create(c).theta(n.center);let p=n.angle+g;u.rotateGrid&&(p=Z.snapToGrid(p,u.rotateGrid)),p=W.normalize(p),d!==p&&(f.rotate(p,{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,B(this.container,`${this.containerClassName}-active`),t){B(t,`${this.containerClassName}-active-handle`);const e=t.getAttribute("data-position");if(e){const n=St.DIRECTIONS[St.POSITIONS.indexOf(e)];B(this.container,`${this.containerClassName}-cursor-${n}`)}}}stopHandle(){if(pt(this.container,`${this.containerClassName}-active`),this.handle){pt(this.handle,`${this.containerClassName}-active-handle`);const t=this.handle.getAttribute("data-position");if(t){const e=St.DIRECTIONS[St.POSITIONS.indexOf(t)];pt(this.container,`${this.containerClassName}-cursor-${e}`)}this.handle=null}}startAction(t){this.startHandle(t.target),this.graph.view.undelegateEvents(),this.delegateDocumentEvents(St.documentEvents,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 r=n.graph,o=r.view.normalizeEvent(e),a=r.snapToGrid(o.clientX,o.clientY);this.trigger(t,Object.assign({e:o,view:n,node:n.cell,cell:n.cell,x:a.x,y:a.y},i))}}dispose(){this.stopListening(),this.remove(),this.off()}}Nw([q.dispose()],Dc.prototype,"dispose",null);var St;(function(s){s.NODE_CLS="has-widget-transform",s.DIRECTIONS=["nw","n","ne","e","se","s","sw","w"],s.POSITIONS=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],s.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp"},s.defaultOptions={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,rotateGrid:15,rotatable:!0,preserveAspectRatio:!1,orthogonalResizing:!0,restrictedResizing:!1,autoScrollOnResizing:!0,allowReverse:!0}})(St||(St={}));const Rw=`.x6-widget-transform {
445
+ position: absolute;
446
+ box-sizing: content-box !important;
447
+ margin: -5px 0 0 -5px;
448
+ padding: 4px;
449
+ border: 1px dashed #000;
450
+ border-radius: 5px;
451
+ user-select: none;
452
+ pointer-events: none;
453
+ }
454
+ .x6-widget-transform > div {
455
+ position: absolute;
456
+ box-sizing: border-box;
457
+ background-color: #fff;
458
+ border: 1px solid #000;
459
+ transition: background-color 0.2s;
460
+ pointer-events: auto;
461
+ -webkit-user-drag: none;
462
+ user-drag: none;
463
+ /* stylelint-disable-line */
464
+ }
465
+ .x6-widget-transform > div:hover {
466
+ background-color: #d3d3d3;
467
+ }
468
+ .x6-widget-transform-cursor-n {
469
+ cursor: n-resize;
470
+ }
471
+ .x6-widget-transform-cursor-s {
472
+ cursor: s-resize;
473
+ }
474
+ .x6-widget-transform-cursor-e {
475
+ cursor: e-resize;
476
+ }
477
+ .x6-widget-transform-cursor-w {
478
+ cursor: w-resize;
479
+ }
480
+ .x6-widget-transform-cursor-ne {
481
+ cursor: ne-resize;
482
+ }
483
+ .x6-widget-transform-cursor-nw {
484
+ cursor: nw-resize;
485
+ }
486
+ .x6-widget-transform-cursor-se {
487
+ cursor: se-resize;
488
+ }
489
+ .x6-widget-transform-cursor-sw {
490
+ cursor: sw-resize;
491
+ }
492
+ .x6-widget-transform-resize {
493
+ width: 10px;
494
+ height: 10px;
495
+ border-radius: 6px;
496
+ }
497
+ .x6-widget-transform-resize[data-position='top-left'] {
498
+ top: -5px;
499
+ left: -5px;
500
+ }
501
+ .x6-widget-transform-resize[data-position='top-right'] {
502
+ top: -5px;
503
+ right: -5px;
504
+ }
505
+ .x6-widget-transform-resize[data-position='bottom-left'] {
506
+ bottom: -5px;
507
+ left: -5px;
508
+ }
509
+ .x6-widget-transform-resize[data-position='bottom-right'] {
510
+ right: -5px;
511
+ bottom: -5px;
512
+ }
513
+ .x6-widget-transform-resize[data-position='top'] {
514
+ top: -5px;
515
+ left: 50%;
516
+ margin-left: -5px;
517
+ }
518
+ .x6-widget-transform-resize[data-position='bottom'] {
519
+ bottom: -5px;
520
+ left: 50%;
521
+ margin-left: -5px;
522
+ }
523
+ .x6-widget-transform-resize[data-position='left'] {
524
+ top: 50%;
525
+ left: -5px;
526
+ margin-top: -5px;
527
+ }
528
+ .x6-widget-transform-resize[data-position='right'] {
529
+ top: 50%;
530
+ right: -5px;
531
+ margin-top: -5px;
532
+ }
533
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='top'],
534
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='bottom'],
535
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='left'],
536
+ .x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='right'] {
537
+ display: none;
538
+ }
539
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='bottom'],
540
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='left'],
541
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='right'],
542
+ .x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='top'] {
543
+ display: none;
544
+ }
545
+ .x6-widget-transform.no-resize .x6-widget-transform-resize {
546
+ display: none;
547
+ }
548
+ .x6-widget-transform-rotate {
549
+ top: -20px;
550
+ left: -20px;
551
+ width: 12px;
552
+ height: 12px;
553
+ border-radius: 6px;
554
+ cursor: crosshair;
555
+ }
556
+ .x6-widget-transform.no-rotate .x6-widget-transform-rotate {
557
+ display: none;
558
+ }
559
+ .x6-widget-transform-active {
560
+ border-color: transparent;
561
+ pointer-events: all;
562
+ }
563
+ .x6-widget-transform-active > div {
564
+ display: none;
565
+ }
566
+ .x6-widget-transform-active > .x6-widget-transform-active-handle {
567
+ display: block;
568
+ background-color: #808080;
569
+ }
570
+ `;M.prototype.createTransformWidget=function(s){const t=this.getPlugin("transform");return t&&t.createWidget(s),this};M.prototype.clearTransformWidgets=function(){const s=this.getPlugin("transform");return s&&s.clearWidgets(),this};var Lw=function(s,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,t,e,n);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};class Fe extends rt{constructor(t={}){super(),this.name="transform",this.widgets=new Map,this.disabled=!1,this.options=t,Ue(this.name,Rw)}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 Dc(e,t,this.graph):null}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=Fe.parseOptionGroup(this.graph,t,this.options.resizing),n=Fe.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(),We(this.name)}}Lw([rt.dispose()],Fe.prototype,"dispose",null);(function(s){function t(e,n,i){const r={};return Object.keys(i||{}).forEach(o=>{const a=i[o];r[o]=typeof a=="function"?a.call(e,n):a}),r}s.parseOptionGroup=t})(Fe||(Fe={}));class Bc extends M{constructor(e){const{beforeInit:n=()=>{},afterInit:i=()=>{},beforeDestroy:r=()=>{},afterDestroy:o=()=>{},miniMap:a={show:!1,container:void 0},alignGrid:l={enabled:!1},scroller:c={enabled:!1},clipboard:h,keyboard:f,history:u,selection:d,exportImg:g,dnd:p={enabled:!0},...m}=e;n();super({...m});fi(this,"beforeDestroy");fi(this,"afterDestroy");fi(this,"dnd",null);if(this.beforeDestroy=r,this.afterDestroy=o,this.use(new Fe({resizing:!0,rotating:!0,restrict:!1})),a.show){const{container:b=void 0,scalable:v=!0,...C}=a;if(!b)throw new Error("the container fro miniMap is required");this.use(new Nc({container:b,scalable:v,...C}))}l.enabled&&this.use(new jc({...l})),h&&this.use(new Oc({enabled:!0,useLocalStorage:!0})),f&&(this.use(new Tc({enabled:!0})),this.bindKey("ctrl+c",()=>{const b=this.getSelectedCells();return b.length&&this.copy(b),!1}),this.bindKey("ctrl+v",()=>{if(!this.isClipboardEmpty()){const b=this.paste({offset:0});this.cleanSelection(),this.select(b)}return!1}),this.bindKey("ctrl+z",()=>{this.canUndo()&&this.undo()}),this.bindKey("ctrl+y",()=>{this.canRedo()&&this.redo()}),this.bindKey(["backspace","delete"],()=>{const b=this.getSelectedCells();b.length&&this.removeCells(b)})),u&&this.use(new vn({enabled:!0})),c.enabled&&this.use(new Rc({...c})),d?.enabled&&this.use(new Cn({enabled:!0,rubberband:!0,movable:!0,showNodeSelectionBox:!0,modifiers:["ctrl"]})),g&&this.use(new Ec);const{enabled:y,...x}=p;y&&(this.dnd=new _e({target:this,...x})),i(this)}init(e,n){if(e)return new M({container:e,...n});throw new Error("container is required")}destroy(){this.beforeDestroy(this),this.dispose(),this.afterDestroy()}loadData(e,n){return this.fromJSON(e,n),this}}let Iw=class extends wt{constructor(t){super(t)}};const jw={grid:{size:10,visible:!0},alignGrid:{enabled:!0},clipboard:!0,keyboard:!0,history:!1,panning:!0,mousewheel:!0,selection:{enabled:!1},dnd:{enabled:!0,getDragNode:s=>s.clone({keepId:!0}),getDropNode:s=>s.clone({keepId:!0})},connecting:{connector:{name:"rounded",args:{radius:8}},anchor:"center",connectionPoint:"anchor",allowBlank:!1,snap:{radius:20},allowLoop:!1,allowNode:!0,allowEdge:!1,allowPort:!0,allowMulti:!1,createEdge(){return this.createEdge({attrs:{line:{sourceMarker:{name:"circle",args:{r:1}},targetMarker:{name:"circle",args:{r:1}},strokeWidth:1}}})},validateMagnet(){return!0}},interacting:{nodeMovable:!0,magnetConnectable:!0,edgeMovable:!0,edgeLabelMovable:!1,arrowheadMovable:!0,vertexMovable:!0,vertexAddable:!0,vertexDeletable:!0},highlighting:{magnetAdsorbed:{name:"stroke",args:{attrs:{fill:"#5F95FF",stroke:"#5F95FF"}}}}};class Dw extends Bc{constructor(t){const{default:e=!0,...n}=t;super(e?{...jw,...n}:n)}}exports.Cell=sw;exports.Edge=rw;exports.ElectricTopoGraph=Dw;exports.Graph=Bc;exports.Node=Iw;