@squeed/flow-sdk 0.1.16 → 2.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/README.md +241 -127
- package/THIRD_PARTY_NOTICES.txt +120 -0
- package/dist/index.cjs +2 -357
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +551 -0
- package/dist/index.d.ts +77 -10
- package/dist/index.js +8911 -31371
- package/dist/index.js.map +1 -1
- package/package.json +28 -16
package/dist/index.cjs
CHANGED
|
@@ -1,358 +1,3 @@
|
|
|
1
|
-
"use strict";var Iq=Object.create;var J1=Object.defineProperty;var Dq=Object.getOwnPropertyDescriptor;var Bq=Object.getOwnPropertyNames;var Mq=Object.getPrototypeOf,Lq=Object.prototype.hasOwnProperty;var Oq=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Bq(e))!Lq.call(r,a)&&a!==t&&J1(r,a,{get:()=>e[a],enumerable:!(n=Dq(e,a))||n.enumerable});return r};var Ar=(r,e,t)=>(t=r!=null?Iq(Mq(r)):{},Oq(e||!r||!r.__esModule?J1(t,"default",{value:r,enumerable:!0}):t,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("react/jsx-runtime"),Re=require("@chakra-ui/react"),xe=require("react"),rr=require("react-icons/pi");var St=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gl(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ko={exports:{}};/**
|
|
2
|
-
* @license
|
|
3
|
-
* Lodash <https://lodash.com/>
|
|
4
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
5
|
-
* Released under MIT license <https://lodash.com/license>
|
|
6
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
7
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
8
|
-
*/var kq=Ko.exports,ew;function qq(){return ew||(ew=1,(function(r,e){(function(){var t,n="4.17.23",a=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,f="__lodash_placeholder__",d=1,h=2,g=4,p=1,x=2,b=1,w=2,y=4,E=8,C=16,S=32,R=64,_=128,A=256,P=512,I=30,D="...",L=800,M=16,q=1,N=2,W=3,V=1/0,$=9007199254740991,X=17976931348623157e292,ee=NaN,K=4294967295,j=K-1,fe=K>>>1,G=[["ary",_],["bind",b],["bindKey",w],["curry",E],["curryRight",C],["flip",P],["partial",S],["partialRight",R],["rearg",A]],z="[object Arguments]",Y="[object Array]",te="[object AsyncFunction]",ue="[object Boolean]",oe="[object Date]",Z="[object DOMException]",Q="[object Error]",ie="[object Function]",de="[object GeneratorFunction]",we="[object Map]",Ae="[object Number]",ve="[object Null]",le="[object Object]",Me="[object Promise]",Se="[object Proxy]",Ee="[object RegExp]",re="[object Set]",ce="[object String]",_e="[object Symbol]",me="[object Undefined]",Te="[object WeakMap]",De="[object WeakSet]",Ne="[object ArrayBuffer]",ze="[object DataView]",$e="[object Float32Array]",ke="[object Float64Array]",Oe="[object Int8Array]",ye="[object Int16Array]",O="[object Int32Array]",ne="[object Uint8Array]",he="[object Uint8ClampedArray]",ge="[object Uint16Array]",be="[object Uint32Array]",Ve=/\b__p \+= '';/g,Be=/\b(__p \+=) '' \+/g,He=/(__e\(.*?\)|\b__t\)) \+\n'';/g,We=/&(?:amp|lt|gt|quot|#39);/g,Xe=/[&<>"']/g,sr=RegExp(We.source),ar=RegExp(Xe.source),Ke=/<%-([\s\S]+?)%>/g,lr=/<%([\s\S]+?)%>/g,ir=/<%=([\s\S]+?)%>/g,Ur=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mr=/^\w*$/,ct=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lr=/[\\^$.*+?()[\]{}|]/g,jr=RegExp(Lr.source),Nr=/^\s+/,Qr=/\s/,Pn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Vr=/\{\n\/\* \[wrapped with (.+)\] \*/,pn=/,? & /,yn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ua=/[()=,{}\[\]\/\s]/,Ci=/\\(\\)?/g,Gn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ot=/^[-+]0x[0-9a-f]+$/i,Et=/^0b[01]+$/i,Ga=/^\[object .+?Constructor\]$/,kt=/^0o[0-7]+$/i,qs=/^(?:0|[1-9]\d*)$/,rf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_i=/($^)/,tf=/['\n\r\u2028\u2029\\]/g,Si="\\ud800-\\udfff",nf="\\u0300-\\u036f",af="\\ufe20-\\ufe2f",of="\\u20d0-\\u20ff",la=nf+af+of,Ti="\\u2700-\\u27bf",Wa="a-z\\xdf-\\xf6\\xf8-\\xff",Ns="\\xac\\xb1\\xd7\\xf7",Fs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",sf="\\u2000-\\u206f",Ut=" \\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",Ri="A-Z\\xc0-\\xd6\\xd8-\\xde",_o="\\ufe0e\\ufe0f",fa=Ns+Fs+sf+Ut,Pt="['’]",uf="["+Si+"]",lf="["+fa+"]",Ai="["+la+"]",O0="\\d+",DI="["+Ti+"]",k0="["+Wa+"]",q0="[^"+Si+fa+O0+Ti+Wa+Ri+"]",ff="\\ud83c[\\udffb-\\udfff]",BI="(?:"+Ai+"|"+ff+")",N0="[^"+Si+"]",cf="(?:\\ud83c[\\udde6-\\uddff]){2}",df="[\\ud800-\\udbff][\\udc00-\\udfff]",Pi="["+Ri+"]",F0="\\u200d",z0="(?:"+k0+"|"+q0+")",MI="(?:"+Pi+"|"+q0+")",$0="(?:"+Pt+"(?:d|ll|m|re|s|t|ve))?",V0="(?:"+Pt+"(?:D|LL|M|RE|S|T|VE))?",G0=BI+"?",W0="["+_o+"]?",LI="(?:"+F0+"(?:"+[N0,cf,df].join("|")+")"+W0+G0+")*",OI="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kI="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",U0=W0+G0+LI,qI="(?:"+[DI,cf,df].join("|")+")"+U0,NI="(?:"+[N0+Ai+"?",Ai,cf,df,uf].join("|")+")",FI=RegExp(Pt,"g"),zI=RegExp(Ai,"g"),vf=RegExp(ff+"(?="+ff+")|"+NI+U0,"g"),$I=RegExp([Pi+"?"+k0+"+"+$0+"(?="+[lf,Pi,"$"].join("|")+")",MI+"+"+V0+"(?="+[lf,Pi+z0,"$"].join("|")+")",Pi+"?"+z0+"+"+$0,Pi+"+"+V0,kI,OI,O0,qI].join("|"),"g"),VI=RegExp("["+F0+Si+la+_o+"]"),GI=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,WI=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],UI=-1,Dr={};Dr[$e]=Dr[ke]=Dr[Oe]=Dr[ye]=Dr[O]=Dr[ne]=Dr[he]=Dr[ge]=Dr[be]=!0,Dr[z]=Dr[Y]=Dr[Ne]=Dr[ue]=Dr[ze]=Dr[oe]=Dr[Q]=Dr[ie]=Dr[we]=Dr[Ae]=Dr[le]=Dr[Ee]=Dr[re]=Dr[ce]=Dr[Te]=!1;var Rr={};Rr[z]=Rr[Y]=Rr[Ne]=Rr[ze]=Rr[ue]=Rr[oe]=Rr[$e]=Rr[ke]=Rr[Oe]=Rr[ye]=Rr[O]=Rr[we]=Rr[Ae]=Rr[le]=Rr[Ee]=Rr[re]=Rr[ce]=Rr[_e]=Rr[ne]=Rr[he]=Rr[ge]=Rr[be]=!0,Rr[Q]=Rr[ie]=Rr[Te]=!1;var HI={À:"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"},KI={"&":"&","<":"<",">":">",'"':""","'":"'"},jI={"&":"&","<":"<",">":">",""":'"',"'":"'"},YI={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},XI=parseFloat,ZI=parseInt,H0=typeof St=="object"&&St&&St.Object===Object&&St,QI=typeof self=="object"&&self&&self.Object===Object&&self,vt=H0||QI||Function("return this")(),hf=e&&!e.nodeType&&e,Ua=hf&&!0&&r&&!r.nodeType&&r,K0=Ua&&Ua.exports===hf,gf=K0&&H0.process,tn=(function(){try{var ae=Ua&&Ua.require&&Ua.require("util").types;return ae||gf&&gf.binding&&gf.binding("util")}catch{}})(),j0=tn&&tn.isArrayBuffer,Y0=tn&&tn.isDate,X0=tn&&tn.isMap,Z0=tn&&tn.isRegExp,Q0=tn&&tn.isSet,J0=tn&&tn.isTypedArray;function Ht(ae,Ce,pe){switch(pe.length){case 0:return ae.call(Ce);case 1:return ae.call(Ce,pe[0]);case 2:return ae.call(Ce,pe[0],pe[1]);case 3:return ae.call(Ce,pe[0],pe[1],pe[2])}return ae.apply(Ce,pe)}function JI(ae,Ce,pe,Ge){for(var tr=-1,br=ae==null?0:ae.length;++tr<br;){var Jr=ae[tr];Ce(Ge,Jr,pe(Jr),ae)}return Ge}function nn(ae,Ce){for(var pe=-1,Ge=ae==null?0:ae.length;++pe<Ge&&Ce(ae[pe],pe,ae)!==!1;);return ae}function eD(ae,Ce){for(var pe=ae==null?0:ae.length;pe--&&Ce(ae[pe],pe,ae)!==!1;);return ae}function eb(ae,Ce){for(var pe=-1,Ge=ae==null?0:ae.length;++pe<Ge;)if(!Ce(ae[pe],pe,ae))return!1;return!0}function ca(ae,Ce){for(var pe=-1,Ge=ae==null?0:ae.length,tr=0,br=[];++pe<Ge;){var Jr=ae[pe];Ce(Jr,pe,ae)&&(br[tr++]=Jr)}return br}function zs(ae,Ce){var pe=ae==null?0:ae.length;return!!pe&&Ii(ae,Ce,0)>-1}function pf(ae,Ce,pe){for(var Ge=-1,tr=ae==null?0:ae.length;++Ge<tr;)if(pe(Ce,ae[Ge]))return!0;return!1}function Or(ae,Ce){for(var pe=-1,Ge=ae==null?0:ae.length,tr=Array(Ge);++pe<Ge;)tr[pe]=Ce(ae[pe],pe,ae);return tr}function da(ae,Ce){for(var pe=-1,Ge=Ce.length,tr=ae.length;++pe<Ge;)ae[tr+pe]=Ce[pe];return ae}function yf(ae,Ce,pe,Ge){var tr=-1,br=ae==null?0:ae.length;for(Ge&&br&&(pe=ae[++tr]);++tr<br;)pe=Ce(pe,ae[tr],tr,ae);return pe}function rD(ae,Ce,pe,Ge){var tr=ae==null?0:ae.length;for(Ge&&tr&&(pe=ae[--tr]);tr--;)pe=Ce(pe,ae[tr],tr,ae);return pe}function mf(ae,Ce){for(var pe=-1,Ge=ae==null?0:ae.length;++pe<Ge;)if(Ce(ae[pe],pe,ae))return!0;return!1}var tD=bf("length");function nD(ae){return ae.split("")}function aD(ae){return ae.match(yn)||[]}function rb(ae,Ce,pe){var Ge;return pe(ae,function(tr,br,Jr){if(Ce(tr,br,Jr))return Ge=br,!1}),Ge}function $s(ae,Ce,pe,Ge){for(var tr=ae.length,br=pe+(Ge?1:-1);Ge?br--:++br<tr;)if(Ce(ae[br],br,ae))return br;return-1}function Ii(ae,Ce,pe){return Ce===Ce?pD(ae,Ce,pe):$s(ae,tb,pe)}function iD(ae,Ce,pe,Ge){for(var tr=pe-1,br=ae.length;++tr<br;)if(Ge(ae[tr],Ce))return tr;return-1}function tb(ae){return ae!==ae}function nb(ae,Ce){var pe=ae==null?0:ae.length;return pe?xf(ae,Ce)/pe:ee}function bf(ae){return function(Ce){return Ce==null?t:Ce[ae]}}function wf(ae){return function(Ce){return ae==null?t:ae[Ce]}}function ab(ae,Ce,pe,Ge,tr){return tr(ae,function(br,Jr,Sr){pe=Ge?(Ge=!1,br):Ce(pe,br,Jr,Sr)}),pe}function oD(ae,Ce){var pe=ae.length;for(ae.sort(Ce);pe--;)ae[pe]=ae[pe].value;return ae}function xf(ae,Ce){for(var pe,Ge=-1,tr=ae.length;++Ge<tr;){var br=Ce(ae[Ge]);br!==t&&(pe=pe===t?br:pe+br)}return pe}function Ef(ae,Ce){for(var pe=-1,Ge=Array(ae);++pe<ae;)Ge[pe]=Ce(pe);return Ge}function sD(ae,Ce){return Or(Ce,function(pe){return[pe,ae[pe]]})}function ib(ae){return ae&&ae.slice(0,lb(ae)+1).replace(Nr,"")}function Kt(ae){return function(Ce){return ae(Ce)}}function Cf(ae,Ce){return Or(Ce,function(pe){return ae[pe]})}function So(ae,Ce){return ae.has(Ce)}function ob(ae,Ce){for(var pe=-1,Ge=ae.length;++pe<Ge&&Ii(Ce,ae[pe],0)>-1;);return pe}function sb(ae,Ce){for(var pe=ae.length;pe--&&Ii(Ce,ae[pe],0)>-1;);return pe}function uD(ae,Ce){for(var pe=ae.length,Ge=0;pe--;)ae[pe]===Ce&&++Ge;return Ge}var lD=wf(HI),fD=wf(KI);function cD(ae){return"\\"+YI[ae]}function dD(ae,Ce){return ae==null?t:ae[Ce]}function Di(ae){return VI.test(ae)}function vD(ae){return GI.test(ae)}function hD(ae){for(var Ce,pe=[];!(Ce=ae.next()).done;)pe.push(Ce.value);return pe}function _f(ae){var Ce=-1,pe=Array(ae.size);return ae.forEach(function(Ge,tr){pe[++Ce]=[tr,Ge]}),pe}function ub(ae,Ce){return function(pe){return ae(Ce(pe))}}function va(ae,Ce){for(var pe=-1,Ge=ae.length,tr=0,br=[];++pe<Ge;){var Jr=ae[pe];(Jr===Ce||Jr===f)&&(ae[pe]=f,br[tr++]=pe)}return br}function Vs(ae){var Ce=-1,pe=Array(ae.size);return ae.forEach(function(Ge){pe[++Ce]=Ge}),pe}function gD(ae){var Ce=-1,pe=Array(ae.size);return ae.forEach(function(Ge){pe[++Ce]=[Ge,Ge]}),pe}function pD(ae,Ce,pe){for(var Ge=pe-1,tr=ae.length;++Ge<tr;)if(ae[Ge]===Ce)return Ge;return-1}function yD(ae,Ce,pe){for(var Ge=pe+1;Ge--;)if(ae[Ge]===Ce)return Ge;return Ge}function Bi(ae){return Di(ae)?bD(ae):tD(ae)}function mn(ae){return Di(ae)?wD(ae):nD(ae)}function lb(ae){for(var Ce=ae.length;Ce--&&Qr.test(ae.charAt(Ce)););return Ce}var mD=wf(jI);function bD(ae){for(var Ce=vf.lastIndex=0;vf.test(ae);)++Ce;return Ce}function wD(ae){return ae.match(vf)||[]}function xD(ae){return ae.match($I)||[]}var ED=(function ae(Ce){Ce=Ce==null?vt:Mi.defaults(vt.Object(),Ce,Mi.pick(vt,WI));var pe=Ce.Array,Ge=Ce.Date,tr=Ce.Error,br=Ce.Function,Jr=Ce.Math,Sr=Ce.Object,Sf=Ce.RegExp,CD=Ce.String,an=Ce.TypeError,Gs=pe.prototype,_D=br.prototype,Li=Sr.prototype,Ws=Ce["__core-js_shared__"],Us=_D.toString,wr=Li.hasOwnProperty,SD=0,fb=(function(){var c=/[^.]+$/.exec(Ws&&Ws.keys&&Ws.keys.IE_PROTO||"");return c?"Symbol(src)_1."+c:""})(),Hs=Li.toString,TD=Us.call(Sr),RD=vt._,AD=Sf("^"+Us.call(wr).replace(Lr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ks=K0?Ce.Buffer:t,ha=Ce.Symbol,js=Ce.Uint8Array,cb=Ks?Ks.allocUnsafe:t,Ys=ub(Sr.getPrototypeOf,Sr),db=Sr.create,vb=Li.propertyIsEnumerable,Xs=Gs.splice,hb=ha?ha.isConcatSpreadable:t,To=ha?ha.iterator:t,Ha=ha?ha.toStringTag:t,Zs=(function(){try{var c=Za(Sr,"defineProperty");return c({},"",{}),c}catch{}})(),PD=Ce.clearTimeout!==vt.clearTimeout&&Ce.clearTimeout,ID=Ge&&Ge.now!==vt.Date.now&&Ge.now,DD=Ce.setTimeout!==vt.setTimeout&&Ce.setTimeout,Qs=Jr.ceil,Js=Jr.floor,Tf=Sr.getOwnPropertySymbols,BD=Ks?Ks.isBuffer:t,gb=Ce.isFinite,MD=Gs.join,LD=ub(Sr.keys,Sr),et=Jr.max,Ct=Jr.min,OD=Ge.now,kD=Ce.parseInt,pb=Jr.random,qD=Gs.reverse,Rf=Za(Ce,"DataView"),Ro=Za(Ce,"Map"),Af=Za(Ce,"Promise"),Oi=Za(Ce,"Set"),Ao=Za(Ce,"WeakMap"),Po=Za(Sr,"create"),eu=Ao&&new Ao,ki={},ND=Qa(Rf),FD=Qa(Ro),zD=Qa(Af),$D=Qa(Oi),VD=Qa(Ao),ru=ha?ha.prototype:t,Io=ru?ru.valueOf:t,yb=ru?ru.toString:t;function k(c){if(Gr(c)&&!nr(c)&&!(c instanceof vr)){if(c instanceof on)return c;if(wr.call(c,"__wrapped__"))return m1(c)}return new on(c)}var qi=(function(){function c(){}return function(v){if(!Fr(v))return{};if(db)return db(v);c.prototype=v;var m=new c;return c.prototype=t,m}})();function tu(){}function on(c,v){this.__wrapped__=c,this.__actions__=[],this.__chain__=!!v,this.__index__=0,this.__values__=t}k.templateSettings={escape:Ke,evaluate:lr,interpolate:ir,variable:"",imports:{_:k}},k.prototype=tu.prototype,k.prototype.constructor=k,on.prototype=qi(tu.prototype),on.prototype.constructor=on;function vr(c){this.__wrapped__=c,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=K,this.__views__=[]}function GD(){var c=new vr(this.__wrapped__);return c.__actions__=qt(this.__actions__),c.__dir__=this.__dir__,c.__filtered__=this.__filtered__,c.__iteratees__=qt(this.__iteratees__),c.__takeCount__=this.__takeCount__,c.__views__=qt(this.__views__),c}function WD(){if(this.__filtered__){var c=new vr(this);c.__dir__=-1,c.__filtered__=!0}else c=this.clone(),c.__dir__*=-1;return c}function UD(){var c=this.__wrapped__.value(),v=this.__dir__,m=nr(c),T=v<0,B=m?c.length:0,F=nM(0,B,this.__views__),U=F.start,J=F.end,se=J-U,Pe=T?J:U-1,Ie=this.__iteratees__,Le=Ie.length,Fe=0,je=Ct(se,this.__takeCount__);if(!m||!T&&B==se&&je==se)return $b(c,this.__actions__);var Je=[];e:for(;se--&&Fe<je;){Pe+=v;for(var ur=-1,er=c[Pe];++ur<Le;){var dr=Ie[ur],hr=dr.iteratee,Xt=dr.type,Bt=hr(er);if(Xt==N)er=Bt;else if(!Bt){if(Xt==q)continue e;break e}}Je[Fe++]=er}return Je}vr.prototype=qi(tu.prototype),vr.prototype.constructor=vr;function Ka(c){var v=-1,m=c==null?0:c.length;for(this.clear();++v<m;){var T=c[v];this.set(T[0],T[1])}}function HD(){this.__data__=Po?Po(null):{},this.size=0}function KD(c){var v=this.has(c)&&delete this.__data__[c];return this.size-=v?1:0,v}function jD(c){var v=this.__data__;if(Po){var m=v[c];return m===u?t:m}return wr.call(v,c)?v[c]:t}function YD(c){var v=this.__data__;return Po?v[c]!==t:wr.call(v,c)}function XD(c,v){var m=this.__data__;return this.size+=this.has(c)?0:1,m[c]=Po&&v===t?u:v,this}Ka.prototype.clear=HD,Ka.prototype.delete=KD,Ka.prototype.get=jD,Ka.prototype.has=YD,Ka.prototype.set=XD;function Wn(c){var v=-1,m=c==null?0:c.length;for(this.clear();++v<m;){var T=c[v];this.set(T[0],T[1])}}function ZD(){this.__data__=[],this.size=0}function QD(c){var v=this.__data__,m=nu(v,c);if(m<0)return!1;var T=v.length-1;return m==T?v.pop():Xs.call(v,m,1),--this.size,!0}function JD(c){var v=this.__data__,m=nu(v,c);return m<0?t:v[m][1]}function eB(c){return nu(this.__data__,c)>-1}function rB(c,v){var m=this.__data__,T=nu(m,c);return T<0?(++this.size,m.push([c,v])):m[T][1]=v,this}Wn.prototype.clear=ZD,Wn.prototype.delete=QD,Wn.prototype.get=JD,Wn.prototype.has=eB,Wn.prototype.set=rB;function Un(c){var v=-1,m=c==null?0:c.length;for(this.clear();++v<m;){var T=c[v];this.set(T[0],T[1])}}function tB(){this.size=0,this.__data__={hash:new Ka,map:new(Ro||Wn),string:new Ka}}function nB(c){var v=gu(this,c).delete(c);return this.size-=v?1:0,v}function aB(c){return gu(this,c).get(c)}function iB(c){return gu(this,c).has(c)}function oB(c,v){var m=gu(this,c),T=m.size;return m.set(c,v),this.size+=m.size==T?0:1,this}Un.prototype.clear=tB,Un.prototype.delete=nB,Un.prototype.get=aB,Un.prototype.has=iB,Un.prototype.set=oB;function ja(c){var v=-1,m=c==null?0:c.length;for(this.__data__=new Un;++v<m;)this.add(c[v])}function sB(c){return this.__data__.set(c,u),this}function uB(c){return this.__data__.has(c)}ja.prototype.add=ja.prototype.push=sB,ja.prototype.has=uB;function bn(c){var v=this.__data__=new Wn(c);this.size=v.size}function lB(){this.__data__=new Wn,this.size=0}function fB(c){var v=this.__data__,m=v.delete(c);return this.size=v.size,m}function cB(c){return this.__data__.get(c)}function dB(c){return this.__data__.has(c)}function vB(c,v){var m=this.__data__;if(m instanceof Wn){var T=m.__data__;if(!Ro||T.length<a-1)return T.push([c,v]),this.size=++m.size,this;m=this.__data__=new Un(T)}return m.set(c,v),this.size=m.size,this}bn.prototype.clear=lB,bn.prototype.delete=fB,bn.prototype.get=cB,bn.prototype.has=dB,bn.prototype.set=vB;function mb(c,v){var m=nr(c),T=!m&&Ja(c),B=!m&&!T&&ba(c),F=!m&&!T&&!B&&$i(c),U=m||T||B||F,J=U?Ef(c.length,CD):[],se=J.length;for(var Pe in c)(v||wr.call(c,Pe))&&!(U&&(Pe=="length"||B&&(Pe=="offset"||Pe=="parent")||F&&(Pe=="buffer"||Pe=="byteLength"||Pe=="byteOffset")||Yn(Pe,se)))&&J.push(Pe);return J}function bb(c){var v=c.length;return v?c[Ff(0,v-1)]:t}function hB(c,v){return pu(qt(c),Ya(v,0,c.length))}function gB(c){return pu(qt(c))}function Pf(c,v,m){(m!==t&&!wn(c[v],m)||m===t&&!(v in c))&&Hn(c,v,m)}function Do(c,v,m){var T=c[v];(!(wr.call(c,v)&&wn(T,m))||m===t&&!(v in c))&&Hn(c,v,m)}function nu(c,v){for(var m=c.length;m--;)if(wn(c[m][0],v))return m;return-1}function pB(c,v,m,T){return ga(c,function(B,F,U){v(T,B,m(B),U)}),T}function wb(c,v){return c&&Dn(v,st(v),c)}function yB(c,v){return c&&Dn(v,Ft(v),c)}function Hn(c,v,m){v=="__proto__"&&Zs?Zs(c,v,{configurable:!0,enumerable:!0,value:m,writable:!0}):c[v]=m}function If(c,v){for(var m=-1,T=v.length,B=pe(T),F=c==null;++m<T;)B[m]=F?t:fc(c,v[m]);return B}function Ya(c,v,m){return c===c&&(m!==t&&(c=c<=m?c:m),v!==t&&(c=c>=v?c:v)),c}function sn(c,v,m,T,B,F){var U,J=v&d,se=v&h,Pe=v&g;if(m&&(U=B?m(c,T,B,F):m(c)),U!==t)return U;if(!Fr(c))return c;var Ie=nr(c);if(Ie){if(U=iM(c),!J)return qt(c,U)}else{var Le=_t(c),Fe=Le==ie||Le==de;if(ba(c))return Wb(c,J);if(Le==le||Le==z||Fe&&!B){if(U=se||Fe?{}:l1(c),!J)return se?jB(c,yB(U,c)):KB(c,wb(U,c))}else{if(!Rr[Le])return B?c:{};U=oM(c,Le,J)}}F||(F=new bn);var je=F.get(c);if(je)return je;F.set(c,U),N1(c)?c.forEach(function(er){U.add(sn(er,v,m,er,c,F))}):k1(c)&&c.forEach(function(er,dr){U.set(dr,sn(er,v,m,dr,c,F))});var Je=Pe?se?Xf:Yf:se?Ft:st,ur=Ie?t:Je(c);return nn(ur||c,function(er,dr){ur&&(dr=er,er=c[dr]),Do(U,dr,sn(er,v,m,dr,c,F))}),U}function mB(c){var v=st(c);return function(m){return xb(m,c,v)}}function xb(c,v,m){var T=m.length;if(c==null)return!T;for(c=Sr(c);T--;){var B=m[T],F=v[B],U=c[B];if(U===t&&!(B in c)||!F(U))return!1}return!0}function Eb(c,v,m){if(typeof c!="function")throw new an(o);return No(function(){c.apply(t,m)},v)}function Bo(c,v,m,T){var B=-1,F=zs,U=!0,J=c.length,se=[],Pe=v.length;if(!J)return se;m&&(v=Or(v,Kt(m))),T?(F=pf,U=!1):v.length>=a&&(F=So,U=!1,v=new ja(v));e:for(;++B<J;){var Ie=c[B],Le=m==null?Ie:m(Ie);if(Ie=T||Ie!==0?Ie:0,U&&Le===Le){for(var Fe=Pe;Fe--;)if(v[Fe]===Le)continue e;se.push(Ie)}else F(v,Le,T)||se.push(Ie)}return se}var ga=Yb(In),Cb=Yb(Bf,!0);function bB(c,v){var m=!0;return ga(c,function(T,B,F){return m=!!v(T,B,F),m}),m}function au(c,v,m){for(var T=-1,B=c.length;++T<B;){var F=c[T],U=v(F);if(U!=null&&(J===t?U===U&&!Yt(U):m(U,J)))var J=U,se=F}return se}function wB(c,v,m,T){var B=c.length;for(m=or(m),m<0&&(m=-m>B?0:B+m),T=T===t||T>B?B:or(T),T<0&&(T+=B),T=m>T?0:z1(T);m<T;)c[m++]=v;return c}function _b(c,v){var m=[];return ga(c,function(T,B,F){v(T,B,F)&&m.push(T)}),m}function ht(c,v,m,T,B){var F=-1,U=c.length;for(m||(m=uM),B||(B=[]);++F<U;){var J=c[F];v>0&&m(J)?v>1?ht(J,v-1,m,T,B):da(B,J):T||(B[B.length]=J)}return B}var Df=Xb(),Sb=Xb(!0);function In(c,v){return c&&Df(c,v,st)}function Bf(c,v){return c&&Sb(c,v,st)}function iu(c,v){return ca(v,function(m){return Xn(c[m])})}function Xa(c,v){v=ya(v,c);for(var m=0,T=v.length;c!=null&&m<T;)c=c[Bn(v[m++])];return m&&m==T?c:t}function Tb(c,v,m){var T=v(c);return nr(c)?T:da(T,m(c))}function It(c){return c==null?c===t?me:ve:Ha&&Ha in Sr(c)?tM(c):gM(c)}function Mf(c,v){return c>v}function xB(c,v){return c!=null&&wr.call(c,v)}function EB(c,v){return c!=null&&v in Sr(c)}function CB(c,v,m){return c>=Ct(v,m)&&c<et(v,m)}function Lf(c,v,m){for(var T=m?pf:zs,B=c[0].length,F=c.length,U=F,J=pe(F),se=1/0,Pe=[];U--;){var Ie=c[U];U&&v&&(Ie=Or(Ie,Kt(v))),se=Ct(Ie.length,se),J[U]=!m&&(v||B>=120&&Ie.length>=120)?new ja(U&&Ie):t}Ie=c[0];var Le=-1,Fe=J[0];e:for(;++Le<B&&Pe.length<se;){var je=Ie[Le],Je=v?v(je):je;if(je=m||je!==0?je:0,!(Fe?So(Fe,Je):T(Pe,Je,m))){for(U=F;--U;){var ur=J[U];if(!(ur?So(ur,Je):T(c[U],Je,m)))continue e}Fe&&Fe.push(Je),Pe.push(je)}}return Pe}function _B(c,v,m,T){return In(c,function(B,F,U){v(T,m(B),F,U)}),T}function Mo(c,v,m){v=ya(v,c),c=v1(c,v);var T=c==null?c:c[Bn(ln(v))];return T==null?t:Ht(T,c,m)}function Rb(c){return Gr(c)&&It(c)==z}function SB(c){return Gr(c)&&It(c)==Ne}function TB(c){return Gr(c)&&It(c)==oe}function Lo(c,v,m,T,B){return c===v?!0:c==null||v==null||!Gr(c)&&!Gr(v)?c!==c&&v!==v:RB(c,v,m,T,Lo,B)}function RB(c,v,m,T,B,F){var U=nr(c),J=nr(v),se=U?Y:_t(c),Pe=J?Y:_t(v);se=se==z?le:se,Pe=Pe==z?le:Pe;var Ie=se==le,Le=Pe==le,Fe=se==Pe;if(Fe&&ba(c)){if(!ba(v))return!1;U=!0,Ie=!1}if(Fe&&!Ie)return F||(F=new bn),U||$i(c)?o1(c,v,m,T,B,F):eM(c,v,se,m,T,B,F);if(!(m&p)){var je=Ie&&wr.call(c,"__wrapped__"),Je=Le&&wr.call(v,"__wrapped__");if(je||Je){var ur=je?c.value():c,er=Je?v.value():v;return F||(F=new bn),B(ur,er,m,T,F)}}return Fe?(F||(F=new bn),rM(c,v,m,T,B,F)):!1}function AB(c){return Gr(c)&&_t(c)==we}function Of(c,v,m,T){var B=m.length,F=B,U=!T;if(c==null)return!F;for(c=Sr(c);B--;){var J=m[B];if(U&&J[2]?J[1]!==c[J[0]]:!(J[0]in c))return!1}for(;++B<F;){J=m[B];var se=J[0],Pe=c[se],Ie=J[1];if(U&&J[2]){if(Pe===t&&!(se in c))return!1}else{var Le=new bn;if(T)var Fe=T(Pe,Ie,se,c,v,Le);if(!(Fe===t?Lo(Ie,Pe,p|x,T,Le):Fe))return!1}}return!0}function Ab(c){if(!Fr(c)||fM(c))return!1;var v=Xn(c)?AD:Ga;return v.test(Qa(c))}function PB(c){return Gr(c)&&It(c)==Ee}function IB(c){return Gr(c)&&_t(c)==re}function DB(c){return Gr(c)&&Eu(c.length)&&!!Dr[It(c)]}function Pb(c){return typeof c=="function"?c:c==null?zt:typeof c=="object"?nr(c)?Bb(c[0],c[1]):Db(c):Z1(c)}function kf(c){if(!qo(c))return LD(c);var v=[];for(var m in Sr(c))wr.call(c,m)&&m!="constructor"&&v.push(m);return v}function BB(c){if(!Fr(c))return hM(c);var v=qo(c),m=[];for(var T in c)T=="constructor"&&(v||!wr.call(c,T))||m.push(T);return m}function qf(c,v){return c<v}function Ib(c,v){var m=-1,T=Nt(c)?pe(c.length):[];return ga(c,function(B,F,U){T[++m]=v(B,F,U)}),T}function Db(c){var v=Qf(c);return v.length==1&&v[0][2]?c1(v[0][0],v[0][1]):function(m){return m===c||Of(m,c,v)}}function Bb(c,v){return ec(c)&&f1(v)?c1(Bn(c),v):function(m){var T=fc(m,c);return T===t&&T===v?cc(m,c):Lo(v,T,p|x)}}function ou(c,v,m,T,B){c!==v&&Df(v,function(F,U){if(B||(B=new bn),Fr(F))MB(c,v,U,m,ou,T,B);else{var J=T?T(tc(c,U),F,U+"",c,v,B):t;J===t&&(J=F),Pf(c,U,J)}},Ft)}function MB(c,v,m,T,B,F,U){var J=tc(c,m),se=tc(v,m),Pe=U.get(se);if(Pe){Pf(c,m,Pe);return}var Ie=F?F(J,se,m+"",c,v,U):t,Le=Ie===t;if(Le){var Fe=nr(se),je=!Fe&&ba(se),Je=!Fe&&!je&&$i(se);Ie=se,Fe||je||Je?nr(J)?Ie=J:Hr(J)?Ie=qt(J):je?(Le=!1,Ie=Wb(se,!0)):Je?(Le=!1,Ie=Ub(se,!0)):Ie=[]:Fo(se)||Ja(se)?(Ie=J,Ja(J)?Ie=$1(J):(!Fr(J)||Xn(J))&&(Ie=l1(se))):Le=!1}Le&&(U.set(se,Ie),B(Ie,se,T,F,U),U.delete(se)),Pf(c,m,Ie)}function Mb(c,v){var m=c.length;if(m)return v+=v<0?m:0,Yn(v,m)?c[v]:t}function Lb(c,v,m){v.length?v=Or(v,function(F){return nr(F)?function(U){return Xa(U,F.length===1?F[0]:F)}:F}):v=[zt];var T=-1;v=Or(v,Kt(Qe()));var B=Ib(c,function(F,U,J){var se=Or(v,function(Pe){return Pe(F)});return{criteria:se,index:++T,value:F}});return oD(B,function(F,U){return HB(F,U,m)})}function LB(c,v){return Ob(c,v,function(m,T){return cc(c,T)})}function Ob(c,v,m){for(var T=-1,B=v.length,F={};++T<B;){var U=v[T],J=Xa(c,U);m(J,U)&&Oo(F,ya(U,c),J)}return F}function OB(c){return function(v){return Xa(v,c)}}function Nf(c,v,m,T){var B=T?iD:Ii,F=-1,U=v.length,J=c;for(c===v&&(v=qt(v)),m&&(J=Or(c,Kt(m)));++F<U;)for(var se=0,Pe=v[F],Ie=m?m(Pe):Pe;(se=B(J,Ie,se,T))>-1;)J!==c&&Xs.call(J,se,1),Xs.call(c,se,1);return c}function kb(c,v){for(var m=c?v.length:0,T=m-1;m--;){var B=v[m];if(m==T||B!==F){var F=B;Yn(B)?Xs.call(c,B,1):Vf(c,B)}}return c}function Ff(c,v){return c+Js(pb()*(v-c+1))}function kB(c,v,m,T){for(var B=-1,F=et(Qs((v-c)/(m||1)),0),U=pe(F);F--;)U[T?F:++B]=c,c+=m;return U}function zf(c,v){var m="";if(!c||v<1||v>$)return m;do v%2&&(m+=c),v=Js(v/2),v&&(c+=c);while(v);return m}function fr(c,v){return nc(d1(c,v,zt),c+"")}function qB(c){return bb(Vi(c))}function NB(c,v){var m=Vi(c);return pu(m,Ya(v,0,m.length))}function Oo(c,v,m,T){if(!Fr(c))return c;v=ya(v,c);for(var B=-1,F=v.length,U=F-1,J=c;J!=null&&++B<F;){var se=Bn(v[B]),Pe=m;if(se==="__proto__"||se==="constructor"||se==="prototype")return c;if(B!=U){var Ie=J[se];Pe=T?T(Ie,se,J):t,Pe===t&&(Pe=Fr(Ie)?Ie:Yn(v[B+1])?[]:{})}Do(J,se,Pe),J=J[se]}return c}var qb=eu?function(c,v){return eu.set(c,v),c}:zt,FB=Zs?function(c,v){return Zs(c,"toString",{configurable:!0,enumerable:!1,value:vc(v),writable:!0})}:zt;function zB(c){return pu(Vi(c))}function un(c,v,m){var T=-1,B=c.length;v<0&&(v=-v>B?0:B+v),m=m>B?B:m,m<0&&(m+=B),B=v>m?0:m-v>>>0,v>>>=0;for(var F=pe(B);++T<B;)F[T]=c[T+v];return F}function $B(c,v){var m;return ga(c,function(T,B,F){return m=v(T,B,F),!m}),!!m}function su(c,v,m){var T=0,B=c==null?T:c.length;if(typeof v=="number"&&v===v&&B<=fe){for(;T<B;){var F=T+B>>>1,U=c[F];U!==null&&!Yt(U)&&(m?U<=v:U<v)?T=F+1:B=F}return B}return $f(c,v,zt,m)}function $f(c,v,m,T){var B=0,F=c==null?0:c.length;if(F===0)return 0;v=m(v);for(var U=v!==v,J=v===null,se=Yt(v),Pe=v===t;B<F;){var Ie=Js((B+F)/2),Le=m(c[Ie]),Fe=Le!==t,je=Le===null,Je=Le===Le,ur=Yt(Le);if(U)var er=T||Je;else Pe?er=Je&&(T||Fe):J?er=Je&&Fe&&(T||!je):se?er=Je&&Fe&&!je&&(T||!ur):je||ur?er=!1:er=T?Le<=v:Le<v;er?B=Ie+1:F=Ie}return Ct(F,j)}function Nb(c,v){for(var m=-1,T=c.length,B=0,F=[];++m<T;){var U=c[m],J=v?v(U):U;if(!m||!wn(J,se)){var se=J;F[B++]=U===0?0:U}}return F}function Fb(c){return typeof c=="number"?c:Yt(c)?ee:+c}function jt(c){if(typeof c=="string")return c;if(nr(c))return Or(c,jt)+"";if(Yt(c))return yb?yb.call(c):"";var v=c+"";return v=="0"&&1/c==-V?"-0":v}function pa(c,v,m){var T=-1,B=zs,F=c.length,U=!0,J=[],se=J;if(m)U=!1,B=pf;else if(F>=a){var Pe=v?null:QB(c);if(Pe)return Vs(Pe);U=!1,B=So,se=new ja}else se=v?[]:J;e:for(;++T<F;){var Ie=c[T],Le=v?v(Ie):Ie;if(Ie=m||Ie!==0?Ie:0,U&&Le===Le){for(var Fe=se.length;Fe--;)if(se[Fe]===Le)continue e;v&&se.push(Le),J.push(Ie)}else B(se,Le,m)||(se!==J&&se.push(Le),J.push(Ie))}return J}function Vf(c,v){v=ya(v,c);var m=-1,T=v.length;if(!T)return!0;for(var B=c==null||typeof c!="object"&&typeof c!="function";++m<T;){var F=v[m];if(typeof F=="string"){if(F==="__proto__"&&!wr.call(c,"__proto__"))return!1;if(F==="constructor"&&m+1<T&&typeof v[m+1]=="string"&&v[m+1]==="prototype"){if(B&&m===0)continue;return!1}}}var U=v1(c,v);return U==null||delete U[Bn(ln(v))]}function zb(c,v,m,T){return Oo(c,v,m(Xa(c,v)),T)}function uu(c,v,m,T){for(var B=c.length,F=T?B:-1;(T?F--:++F<B)&&v(c[F],F,c););return m?un(c,T?0:F,T?F+1:B):un(c,T?F+1:0,T?B:F)}function $b(c,v){var m=c;return m instanceof vr&&(m=m.value()),yf(v,function(T,B){return B.func.apply(B.thisArg,da([T],B.args))},m)}function Gf(c,v,m){var T=c.length;if(T<2)return T?pa(c[0]):[];for(var B=-1,F=pe(T);++B<T;)for(var U=c[B],J=-1;++J<T;)J!=B&&(F[B]=Bo(F[B]||U,c[J],v,m));return pa(ht(F,1),v,m)}function Vb(c,v,m){for(var T=-1,B=c.length,F=v.length,U={};++T<B;){var J=T<F?v[T]:t;m(U,c[T],J)}return U}function Wf(c){return Hr(c)?c:[]}function Uf(c){return typeof c=="function"?c:zt}function ya(c,v){return nr(c)?c:ec(c,v)?[c]:y1(xr(c))}var VB=fr;function ma(c,v,m){var T=c.length;return m=m===t?T:m,!v&&m>=T?c:un(c,v,m)}var Gb=PD||function(c){return vt.clearTimeout(c)};function Wb(c,v){if(v)return c.slice();var m=c.length,T=cb?cb(m):new c.constructor(m);return c.copy(T),T}function Hf(c){var v=new c.constructor(c.byteLength);return new js(v).set(new js(c)),v}function GB(c,v){var m=v?Hf(c.buffer):c.buffer;return new c.constructor(m,c.byteOffset,c.byteLength)}function WB(c){var v=new c.constructor(c.source,dt.exec(c));return v.lastIndex=c.lastIndex,v}function UB(c){return Io?Sr(Io.call(c)):{}}function Ub(c,v){var m=v?Hf(c.buffer):c.buffer;return new c.constructor(m,c.byteOffset,c.length)}function Hb(c,v){if(c!==v){var m=c!==t,T=c===null,B=c===c,F=Yt(c),U=v!==t,J=v===null,se=v===v,Pe=Yt(v);if(!J&&!Pe&&!F&&c>v||F&&U&&se&&!J&&!Pe||T&&U&&se||!m&&se||!B)return 1;if(!T&&!F&&!Pe&&c<v||Pe&&m&&B&&!T&&!F||J&&m&&B||!U&&B||!se)return-1}return 0}function HB(c,v,m){for(var T=-1,B=c.criteria,F=v.criteria,U=B.length,J=m.length;++T<U;){var se=Hb(B[T],F[T]);if(se){if(T>=J)return se;var Pe=m[T];return se*(Pe=="desc"?-1:1)}}return c.index-v.index}function Kb(c,v,m,T){for(var B=-1,F=c.length,U=m.length,J=-1,se=v.length,Pe=et(F-U,0),Ie=pe(se+Pe),Le=!T;++J<se;)Ie[J]=v[J];for(;++B<U;)(Le||B<F)&&(Ie[m[B]]=c[B]);for(;Pe--;)Ie[J++]=c[B++];return Ie}function jb(c,v,m,T){for(var B=-1,F=c.length,U=-1,J=m.length,se=-1,Pe=v.length,Ie=et(F-J,0),Le=pe(Ie+Pe),Fe=!T;++B<Ie;)Le[B]=c[B];for(var je=B;++se<Pe;)Le[je+se]=v[se];for(;++U<J;)(Fe||B<F)&&(Le[je+m[U]]=c[B++]);return Le}function qt(c,v){var m=-1,T=c.length;for(v||(v=pe(T));++m<T;)v[m]=c[m];return v}function Dn(c,v,m,T){var B=!m;m||(m={});for(var F=-1,U=v.length;++F<U;){var J=v[F],se=T?T(m[J],c[J],J,m,c):t;se===t&&(se=c[J]),B?Hn(m,J,se):Do(m,J,se)}return m}function KB(c,v){return Dn(c,Jf(c),v)}function jB(c,v){return Dn(c,s1(c),v)}function lu(c,v){return function(m,T){var B=nr(m)?JI:pB,F=v?v():{};return B(m,c,Qe(T,2),F)}}function Ni(c){return fr(function(v,m){var T=-1,B=m.length,F=B>1?m[B-1]:t,U=B>2?m[2]:t;for(F=c.length>3&&typeof F=="function"?(B--,F):t,U&&Dt(m[0],m[1],U)&&(F=B<3?t:F,B=1),v=Sr(v);++T<B;){var J=m[T];J&&c(v,J,T,F)}return v})}function Yb(c,v){return function(m,T){if(m==null)return m;if(!Nt(m))return c(m,T);for(var B=m.length,F=v?B:-1,U=Sr(m);(v?F--:++F<B)&&T(U[F],F,U)!==!1;);return m}}function Xb(c){return function(v,m,T){for(var B=-1,F=Sr(v),U=T(v),J=U.length;J--;){var se=U[c?J:++B];if(m(F[se],se,F)===!1)break}return v}}function YB(c,v,m){var T=v&b,B=ko(c);function F(){var U=this&&this!==vt&&this instanceof F?B:c;return U.apply(T?m:this,arguments)}return F}function Zb(c){return function(v){v=xr(v);var m=Di(v)?mn(v):t,T=m?m[0]:v.charAt(0),B=m?ma(m,1).join(""):v.slice(1);return T[c]()+B}}function Fi(c){return function(v){return yf(Y1(j1(v).replace(FI,"")),c,"")}}function ko(c){return function(){var v=arguments;switch(v.length){case 0:return new c;case 1:return new c(v[0]);case 2:return new c(v[0],v[1]);case 3:return new c(v[0],v[1],v[2]);case 4:return new c(v[0],v[1],v[2],v[3]);case 5:return new c(v[0],v[1],v[2],v[3],v[4]);case 6:return new c(v[0],v[1],v[2],v[3],v[4],v[5]);case 7:return new c(v[0],v[1],v[2],v[3],v[4],v[5],v[6])}var m=qi(c.prototype),T=c.apply(m,v);return Fr(T)?T:m}}function XB(c,v,m){var T=ko(c);function B(){for(var F=arguments.length,U=pe(F),J=F,se=zi(B);J--;)U[J]=arguments[J];var Pe=F<3&&U[0]!==se&&U[F-1]!==se?[]:va(U,se);if(F-=Pe.length,F<m)return t1(c,v,fu,B.placeholder,t,U,Pe,t,t,m-F);var Ie=this&&this!==vt&&this instanceof B?T:c;return Ht(Ie,this,U)}return B}function Qb(c){return function(v,m,T){var B=Sr(v);if(!Nt(v)){var F=Qe(m,3);v=st(v),m=function(J){return F(B[J],J,B)}}var U=c(v,m,T);return U>-1?B[F?v[U]:U]:t}}function Jb(c){return jn(function(v){var m=v.length,T=m,B=on.prototype.thru;for(c&&v.reverse();T--;){var F=v[T];if(typeof F!="function")throw new an(o);if(B&&!U&&hu(F)=="wrapper")var U=new on([],!0)}for(T=U?T:m;++T<m;){F=v[T];var J=hu(F),se=J=="wrapper"?Zf(F):t;se&&rc(se[0])&&se[1]==(_|E|S|A)&&!se[4].length&&se[9]==1?U=U[hu(se[0])].apply(U,se[3]):U=F.length==1&&rc(F)?U[J]():U.thru(F)}return function(){var Pe=arguments,Ie=Pe[0];if(U&&Pe.length==1&&nr(Ie))return U.plant(Ie).value();for(var Le=0,Fe=m?v[Le].apply(this,Pe):Ie;++Le<m;)Fe=v[Le].call(this,Fe);return Fe}})}function fu(c,v,m,T,B,F,U,J,se,Pe){var Ie=v&_,Le=v&b,Fe=v&w,je=v&(E|C),Je=v&P,ur=Fe?t:ko(c);function er(){for(var dr=arguments.length,hr=pe(dr),Xt=dr;Xt--;)hr[Xt]=arguments[Xt];if(je)var Bt=zi(er),Zt=uD(hr,Bt);if(T&&(hr=Kb(hr,T,B,je)),F&&(hr=jb(hr,F,U,je)),dr-=Zt,je&&dr<Pe){var Kr=va(hr,Bt);return t1(c,v,fu,er.placeholder,m,hr,Kr,J,se,Pe-dr)}var xn=Le?m:this,Qn=Fe?xn[c]:c;return dr=hr.length,J?hr=pM(hr,J):Je&&dr>1&&hr.reverse(),Ie&&se<dr&&(hr.length=se),this&&this!==vt&&this instanceof er&&(Qn=ur||ko(Qn)),Qn.apply(xn,hr)}return er}function e1(c,v){return function(m,T){return _B(m,c,v(T),{})}}function cu(c,v){return function(m,T){var B;if(m===t&&T===t)return v;if(m!==t&&(B=m),T!==t){if(B===t)return T;typeof m=="string"||typeof T=="string"?(m=jt(m),T=jt(T)):(m=Fb(m),T=Fb(T)),B=c(m,T)}return B}}function Kf(c){return jn(function(v){return v=Or(v,Kt(Qe())),fr(function(m){var T=this;return c(v,function(B){return Ht(B,T,m)})})})}function du(c,v){v=v===t?" ":jt(v);var m=v.length;if(m<2)return m?zf(v,c):v;var T=zf(v,Qs(c/Bi(v)));return Di(v)?ma(mn(T),0,c).join(""):T.slice(0,c)}function ZB(c,v,m,T){var B=v&b,F=ko(c);function U(){for(var J=-1,se=arguments.length,Pe=-1,Ie=T.length,Le=pe(Ie+se),Fe=this&&this!==vt&&this instanceof U?F:c;++Pe<Ie;)Le[Pe]=T[Pe];for(;se--;)Le[Pe++]=arguments[++J];return Ht(Fe,B?m:this,Le)}return U}function r1(c){return function(v,m,T){return T&&typeof T!="number"&&Dt(v,m,T)&&(m=T=t),v=Zn(v),m===t?(m=v,v=0):m=Zn(m),T=T===t?v<m?1:-1:Zn(T),kB(v,m,T,c)}}function vu(c){return function(v,m){return typeof v=="string"&&typeof m=="string"||(v=fn(v),m=fn(m)),c(v,m)}}function t1(c,v,m,T,B,F,U,J,se,Pe){var Ie=v&E,Le=Ie?U:t,Fe=Ie?t:U,je=Ie?F:t,Je=Ie?t:F;v|=Ie?S:R,v&=~(Ie?R:S),v&y||(v&=-4);var ur=[c,v,B,je,Le,Je,Fe,J,se,Pe],er=m.apply(t,ur);return rc(c)&&h1(er,ur),er.placeholder=T,g1(er,c,v)}function jf(c){var v=Jr[c];return function(m,T){if(m=fn(m),T=T==null?0:Ct(or(T),292),T&&gb(m)){var B=(xr(m)+"e").split("e"),F=v(B[0]+"e"+(+B[1]+T));return B=(xr(F)+"e").split("e"),+(B[0]+"e"+(+B[1]-T))}return v(m)}}var QB=Oi&&1/Vs(new Oi([,-0]))[1]==V?function(c){return new Oi(c)}:pc;function n1(c){return function(v){var m=_t(v);return m==we?_f(v):m==re?gD(v):sD(v,c(v))}}function Kn(c,v,m,T,B,F,U,J){var se=v&w;if(!se&&typeof c!="function")throw new an(o);var Pe=T?T.length:0;if(Pe||(v&=-97,T=B=t),U=U===t?U:et(or(U),0),J=J===t?J:or(J),Pe-=B?B.length:0,v&R){var Ie=T,Le=B;T=B=t}var Fe=se?t:Zf(c),je=[c,v,m,T,B,Ie,Le,F,U,J];if(Fe&&vM(je,Fe),c=je[0],v=je[1],m=je[2],T=je[3],B=je[4],J=je[9]=je[9]===t?se?0:c.length:et(je[9]-Pe,0),!J&&v&(E|C)&&(v&=-25),!v||v==b)var Je=YB(c,v,m);else v==E||v==C?Je=XB(c,v,J):(v==S||v==(b|S))&&!B.length?Je=ZB(c,v,m,T):Je=fu.apply(t,je);var ur=Fe?qb:h1;return g1(ur(Je,je),c,v)}function a1(c,v,m,T){return c===t||wn(c,Li[m])&&!wr.call(T,m)?v:c}function i1(c,v,m,T,B,F){return Fr(c)&&Fr(v)&&(F.set(v,c),ou(c,v,t,i1,F),F.delete(v)),c}function JB(c){return Fo(c)?t:c}function o1(c,v,m,T,B,F){var U=m&p,J=c.length,se=v.length;if(J!=se&&!(U&&se>J))return!1;var Pe=F.get(c),Ie=F.get(v);if(Pe&&Ie)return Pe==v&&Ie==c;var Le=-1,Fe=!0,je=m&x?new ja:t;for(F.set(c,v),F.set(v,c);++Le<J;){var Je=c[Le],ur=v[Le];if(T)var er=U?T(ur,Je,Le,v,c,F):T(Je,ur,Le,c,v,F);if(er!==t){if(er)continue;Fe=!1;break}if(je){if(!mf(v,function(dr,hr){if(!So(je,hr)&&(Je===dr||B(Je,dr,m,T,F)))return je.push(hr)})){Fe=!1;break}}else if(!(Je===ur||B(Je,ur,m,T,F))){Fe=!1;break}}return F.delete(c),F.delete(v),Fe}function eM(c,v,m,T,B,F,U){switch(m){case ze:if(c.byteLength!=v.byteLength||c.byteOffset!=v.byteOffset)return!1;c=c.buffer,v=v.buffer;case Ne:return!(c.byteLength!=v.byteLength||!F(new js(c),new js(v)));case ue:case oe:case Ae:return wn(+c,+v);case Q:return c.name==v.name&&c.message==v.message;case Ee:case ce:return c==v+"";case we:var J=_f;case re:var se=T&p;if(J||(J=Vs),c.size!=v.size&&!se)return!1;var Pe=U.get(c);if(Pe)return Pe==v;T|=x,U.set(c,v);var Ie=o1(J(c),J(v),T,B,F,U);return U.delete(c),Ie;case _e:if(Io)return Io.call(c)==Io.call(v)}return!1}function rM(c,v,m,T,B,F){var U=m&p,J=Yf(c),se=J.length,Pe=Yf(v),Ie=Pe.length;if(se!=Ie&&!U)return!1;for(var Le=se;Le--;){var Fe=J[Le];if(!(U?Fe in v:wr.call(v,Fe)))return!1}var je=F.get(c),Je=F.get(v);if(je&&Je)return je==v&&Je==c;var ur=!0;F.set(c,v),F.set(v,c);for(var er=U;++Le<se;){Fe=J[Le];var dr=c[Fe],hr=v[Fe];if(T)var Xt=U?T(hr,dr,Fe,v,c,F):T(dr,hr,Fe,c,v,F);if(!(Xt===t?dr===hr||B(dr,hr,m,T,F):Xt)){ur=!1;break}er||(er=Fe=="constructor")}if(ur&&!er){var Bt=c.constructor,Zt=v.constructor;Bt!=Zt&&"constructor"in c&&"constructor"in v&&!(typeof Bt=="function"&&Bt instanceof Bt&&typeof Zt=="function"&&Zt instanceof Zt)&&(ur=!1)}return F.delete(c),F.delete(v),ur}function jn(c){return nc(d1(c,t,x1),c+"")}function Yf(c){return Tb(c,st,Jf)}function Xf(c){return Tb(c,Ft,s1)}var Zf=eu?function(c){return eu.get(c)}:pc;function hu(c){for(var v=c.name+"",m=ki[v],T=wr.call(ki,v)?m.length:0;T--;){var B=m[T],F=B.func;if(F==null||F==c)return B.name}return v}function zi(c){var v=wr.call(k,"placeholder")?k:c;return v.placeholder}function Qe(){var c=k.iteratee||hc;return c=c===hc?Pb:c,arguments.length?c(arguments[0],arguments[1]):c}function gu(c,v){var m=c.__data__;return lM(v)?m[typeof v=="string"?"string":"hash"]:m.map}function Qf(c){for(var v=st(c),m=v.length;m--;){var T=v[m],B=c[T];v[m]=[T,B,f1(B)]}return v}function Za(c,v){var m=dD(c,v);return Ab(m)?m:t}function tM(c){var v=wr.call(c,Ha),m=c[Ha];try{c[Ha]=t;var T=!0}catch{}var B=Hs.call(c);return T&&(v?c[Ha]=m:delete c[Ha]),B}var Jf=Tf?function(c){return c==null?[]:(c=Sr(c),ca(Tf(c),function(v){return vb.call(c,v)}))}:yc,s1=Tf?function(c){for(var v=[];c;)da(v,Jf(c)),c=Ys(c);return v}:yc,_t=It;(Rf&&_t(new Rf(new ArrayBuffer(1)))!=ze||Ro&&_t(new Ro)!=we||Af&&_t(Af.resolve())!=Me||Oi&&_t(new Oi)!=re||Ao&&_t(new Ao)!=Te)&&(_t=function(c){var v=It(c),m=v==le?c.constructor:t,T=m?Qa(m):"";if(T)switch(T){case ND:return ze;case FD:return we;case zD:return Me;case $D:return re;case VD:return Te}return v});function nM(c,v,m){for(var T=-1,B=m.length;++T<B;){var F=m[T],U=F.size;switch(F.type){case"drop":c+=U;break;case"dropRight":v-=U;break;case"take":v=Ct(v,c+U);break;case"takeRight":c=et(c,v-U);break}}return{start:c,end:v}}function aM(c){var v=c.match(Vr);return v?v[1].split(pn):[]}function u1(c,v,m){v=ya(v,c);for(var T=-1,B=v.length,F=!1;++T<B;){var U=Bn(v[T]);if(!(F=c!=null&&m(c,U)))break;c=c[U]}return F||++T!=B?F:(B=c==null?0:c.length,!!B&&Eu(B)&&Yn(U,B)&&(nr(c)||Ja(c)))}function iM(c){var v=c.length,m=new c.constructor(v);return v&&typeof c[0]=="string"&&wr.call(c,"index")&&(m.index=c.index,m.input=c.input),m}function l1(c){return typeof c.constructor=="function"&&!qo(c)?qi(Ys(c)):{}}function oM(c,v,m){var T=c.constructor;switch(v){case Ne:return Hf(c);case ue:case oe:return new T(+c);case ze:return GB(c,m);case $e:case ke:case Oe:case ye:case O:case ne:case he:case ge:case be:return Ub(c,m);case we:return new T;case Ae:case ce:return new T(c);case Ee:return WB(c);case re:return new T;case _e:return UB(c)}}function sM(c,v){var m=v.length;if(!m)return c;var T=m-1;return v[T]=(m>1?"& ":"")+v[T],v=v.join(m>2?", ":" "),c.replace(Pn,`{
|
|
9
|
-
/* [wrapped with `+v+`] */
|
|
10
|
-
`)}function uM(c){return nr(c)||Ja(c)||!!(hb&&c&&c[hb])}function Yn(c,v){var m=typeof c;return v=v??$,!!v&&(m=="number"||m!="symbol"&&qs.test(c))&&c>-1&&c%1==0&&c<v}function Dt(c,v,m){if(!Fr(m))return!1;var T=typeof v;return(T=="number"?Nt(m)&&Yn(v,m.length):T=="string"&&v in m)?wn(m[v],c):!1}function ec(c,v){if(nr(c))return!1;var m=typeof c;return m=="number"||m=="symbol"||m=="boolean"||c==null||Yt(c)?!0:Mr.test(c)||!Ur.test(c)||v!=null&&c in Sr(v)}function lM(c){var v=typeof c;return v=="string"||v=="number"||v=="symbol"||v=="boolean"?c!=="__proto__":c===null}function rc(c){var v=hu(c),m=k[v];if(typeof m!="function"||!(v in vr.prototype))return!1;if(c===m)return!0;var T=Zf(m);return!!T&&c===T[0]}function fM(c){return!!fb&&fb in c}var cM=Ws?Xn:mc;function qo(c){var v=c&&c.constructor,m=typeof v=="function"&&v.prototype||Li;return c===m}function f1(c){return c===c&&!Fr(c)}function c1(c,v){return function(m){return m==null?!1:m[c]===v&&(v!==t||c in Sr(m))}}function dM(c){var v=wu(c,function(T){return m.size===l&&m.clear(),T}),m=v.cache;return v}function vM(c,v){var m=c[1],T=v[1],B=m|T,F=B<(b|w|_),U=T==_&&m==E||T==_&&m==A&&c[7].length<=v[8]||T==(_|A)&&v[7].length<=v[8]&&m==E;if(!(F||U))return c;T&b&&(c[2]=v[2],B|=m&b?0:y);var J=v[3];if(J){var se=c[3];c[3]=se?Kb(se,J,v[4]):J,c[4]=se?va(c[3],f):v[4]}return J=v[5],J&&(se=c[5],c[5]=se?jb(se,J,v[6]):J,c[6]=se?va(c[5],f):v[6]),J=v[7],J&&(c[7]=J),T&_&&(c[8]=c[8]==null?v[8]:Ct(c[8],v[8])),c[9]==null&&(c[9]=v[9]),c[0]=v[0],c[1]=B,c}function hM(c){var v=[];if(c!=null)for(var m in Sr(c))v.push(m);return v}function gM(c){return Hs.call(c)}function d1(c,v,m){return v=et(v===t?c.length-1:v,0),function(){for(var T=arguments,B=-1,F=et(T.length-v,0),U=pe(F);++B<F;)U[B]=T[v+B];B=-1;for(var J=pe(v+1);++B<v;)J[B]=T[B];return J[v]=m(U),Ht(c,this,J)}}function v1(c,v){return v.length<2?c:Xa(c,un(v,0,-1))}function pM(c,v){for(var m=c.length,T=Ct(v.length,m),B=qt(c);T--;){var F=v[T];c[T]=Yn(F,m)?B[F]:t}return c}function tc(c,v){if(!(v==="constructor"&&typeof c[v]=="function")&&v!="__proto__")return c[v]}var h1=p1(qb),No=DD||function(c,v){return vt.setTimeout(c,v)},nc=p1(FB);function g1(c,v,m){var T=v+"";return nc(c,sM(T,yM(aM(T),m)))}function p1(c){var v=0,m=0;return function(){var T=OD(),B=M-(T-m);if(m=T,B>0){if(++v>=L)return arguments[0]}else v=0;return c.apply(t,arguments)}}function pu(c,v){var m=-1,T=c.length,B=T-1;for(v=v===t?T:v;++m<v;){var F=Ff(m,B),U=c[F];c[F]=c[m],c[m]=U}return c.length=v,c}var y1=dM(function(c){var v=[];return c.charCodeAt(0)===46&&v.push(""),c.replace(ct,function(m,T,B,F){v.push(B?F.replace(Ci,"$1"):T||m)}),v});function Bn(c){if(typeof c=="string"||Yt(c))return c;var v=c+"";return v=="0"&&1/c==-V?"-0":v}function Qa(c){if(c!=null){try{return Us.call(c)}catch{}try{return c+""}catch{}}return""}function yM(c,v){return nn(G,function(m){var T="_."+m[0];v&m[1]&&!zs(c,T)&&c.push(T)}),c.sort()}function m1(c){if(c instanceof vr)return c.clone();var v=new on(c.__wrapped__,c.__chain__);return v.__actions__=qt(c.__actions__),v.__index__=c.__index__,v.__values__=c.__values__,v}function mM(c,v,m){(m?Dt(c,v,m):v===t)?v=1:v=et(or(v),0);var T=c==null?0:c.length;if(!T||v<1)return[];for(var B=0,F=0,U=pe(Qs(T/v));B<T;)U[F++]=un(c,B,B+=v);return U}function bM(c){for(var v=-1,m=c==null?0:c.length,T=0,B=[];++v<m;){var F=c[v];F&&(B[T++]=F)}return B}function wM(){var c=arguments.length;if(!c)return[];for(var v=pe(c-1),m=arguments[0],T=c;T--;)v[T-1]=arguments[T];return da(nr(m)?qt(m):[m],ht(v,1))}var xM=fr(function(c,v){return Hr(c)?Bo(c,ht(v,1,Hr,!0)):[]}),EM=fr(function(c,v){var m=ln(v);return Hr(m)&&(m=t),Hr(c)?Bo(c,ht(v,1,Hr,!0),Qe(m,2)):[]}),CM=fr(function(c,v){var m=ln(v);return Hr(m)&&(m=t),Hr(c)?Bo(c,ht(v,1,Hr,!0),t,m):[]});function _M(c,v,m){var T=c==null?0:c.length;return T?(v=m||v===t?1:or(v),un(c,v<0?0:v,T)):[]}function SM(c,v,m){var T=c==null?0:c.length;return T?(v=m||v===t?1:or(v),v=T-v,un(c,0,v<0?0:v)):[]}function TM(c,v){return c&&c.length?uu(c,Qe(v,3),!0,!0):[]}function RM(c,v){return c&&c.length?uu(c,Qe(v,3),!0):[]}function AM(c,v,m,T){var B=c==null?0:c.length;return B?(m&&typeof m!="number"&&Dt(c,v,m)&&(m=0,T=B),wB(c,v,m,T)):[]}function b1(c,v,m){var T=c==null?0:c.length;if(!T)return-1;var B=m==null?0:or(m);return B<0&&(B=et(T+B,0)),$s(c,Qe(v,3),B)}function w1(c,v,m){var T=c==null?0:c.length;if(!T)return-1;var B=T-1;return m!==t&&(B=or(m),B=m<0?et(T+B,0):Ct(B,T-1)),$s(c,Qe(v,3),B,!0)}function x1(c){var v=c==null?0:c.length;return v?ht(c,1):[]}function PM(c){var v=c==null?0:c.length;return v?ht(c,V):[]}function IM(c,v){var m=c==null?0:c.length;return m?(v=v===t?1:or(v),ht(c,v)):[]}function DM(c){for(var v=-1,m=c==null?0:c.length,T={};++v<m;){var B=c[v];T[B[0]]=B[1]}return T}function E1(c){return c&&c.length?c[0]:t}function BM(c,v,m){var T=c==null?0:c.length;if(!T)return-1;var B=m==null?0:or(m);return B<0&&(B=et(T+B,0)),Ii(c,v,B)}function MM(c){var v=c==null?0:c.length;return v?un(c,0,-1):[]}var LM=fr(function(c){var v=Or(c,Wf);return v.length&&v[0]===c[0]?Lf(v):[]}),OM=fr(function(c){var v=ln(c),m=Or(c,Wf);return v===ln(m)?v=t:m.pop(),m.length&&m[0]===c[0]?Lf(m,Qe(v,2)):[]}),kM=fr(function(c){var v=ln(c),m=Or(c,Wf);return v=typeof v=="function"?v:t,v&&m.pop(),m.length&&m[0]===c[0]?Lf(m,t,v):[]});function qM(c,v){return c==null?"":MD.call(c,v)}function ln(c){var v=c==null?0:c.length;return v?c[v-1]:t}function NM(c,v,m){var T=c==null?0:c.length;if(!T)return-1;var B=T;return m!==t&&(B=or(m),B=B<0?et(T+B,0):Ct(B,T-1)),v===v?yD(c,v,B):$s(c,tb,B,!0)}function FM(c,v){return c&&c.length?Mb(c,or(v)):t}var zM=fr(C1);function C1(c,v){return c&&c.length&&v&&v.length?Nf(c,v):c}function $M(c,v,m){return c&&c.length&&v&&v.length?Nf(c,v,Qe(m,2)):c}function VM(c,v,m){return c&&c.length&&v&&v.length?Nf(c,v,t,m):c}var GM=jn(function(c,v){var m=c==null?0:c.length,T=If(c,v);return kb(c,Or(v,function(B){return Yn(B,m)?+B:B}).sort(Hb)),T});function WM(c,v){var m=[];if(!(c&&c.length))return m;var T=-1,B=[],F=c.length;for(v=Qe(v,3);++T<F;){var U=c[T];v(U,T,c)&&(m.push(U),B.push(T))}return kb(c,B),m}function ac(c){return c==null?c:qD.call(c)}function UM(c,v,m){var T=c==null?0:c.length;return T?(m&&typeof m!="number"&&Dt(c,v,m)?(v=0,m=T):(v=v==null?0:or(v),m=m===t?T:or(m)),un(c,v,m)):[]}function HM(c,v){return su(c,v)}function KM(c,v,m){return $f(c,v,Qe(m,2))}function jM(c,v){var m=c==null?0:c.length;if(m){var T=su(c,v);if(T<m&&wn(c[T],v))return T}return-1}function YM(c,v){return su(c,v,!0)}function XM(c,v,m){return $f(c,v,Qe(m,2),!0)}function ZM(c,v){var m=c==null?0:c.length;if(m){var T=su(c,v,!0)-1;if(wn(c[T],v))return T}return-1}function QM(c){return c&&c.length?Nb(c):[]}function JM(c,v){return c&&c.length?Nb(c,Qe(v,2)):[]}function eL(c){var v=c==null?0:c.length;return v?un(c,1,v):[]}function rL(c,v,m){return c&&c.length?(v=m||v===t?1:or(v),un(c,0,v<0?0:v)):[]}function tL(c,v,m){var T=c==null?0:c.length;return T?(v=m||v===t?1:or(v),v=T-v,un(c,v<0?0:v,T)):[]}function nL(c,v){return c&&c.length?uu(c,Qe(v,3),!1,!0):[]}function aL(c,v){return c&&c.length?uu(c,Qe(v,3)):[]}var iL=fr(function(c){return pa(ht(c,1,Hr,!0))}),oL=fr(function(c){var v=ln(c);return Hr(v)&&(v=t),pa(ht(c,1,Hr,!0),Qe(v,2))}),sL=fr(function(c){var v=ln(c);return v=typeof v=="function"?v:t,pa(ht(c,1,Hr,!0),t,v)});function uL(c){return c&&c.length?pa(c):[]}function lL(c,v){return c&&c.length?pa(c,Qe(v,2)):[]}function fL(c,v){return v=typeof v=="function"?v:t,c&&c.length?pa(c,t,v):[]}function ic(c){if(!(c&&c.length))return[];var v=0;return c=ca(c,function(m){if(Hr(m))return v=et(m.length,v),!0}),Ef(v,function(m){return Or(c,bf(m))})}function _1(c,v){if(!(c&&c.length))return[];var m=ic(c);return v==null?m:Or(m,function(T){return Ht(v,t,T)})}var cL=fr(function(c,v){return Hr(c)?Bo(c,v):[]}),dL=fr(function(c){return Gf(ca(c,Hr))}),vL=fr(function(c){var v=ln(c);return Hr(v)&&(v=t),Gf(ca(c,Hr),Qe(v,2))}),hL=fr(function(c){var v=ln(c);return v=typeof v=="function"?v:t,Gf(ca(c,Hr),t,v)}),gL=fr(ic);function pL(c,v){return Vb(c||[],v||[],Do)}function yL(c,v){return Vb(c||[],v||[],Oo)}var mL=fr(function(c){var v=c.length,m=v>1?c[v-1]:t;return m=typeof m=="function"?(c.pop(),m):t,_1(c,m)});function S1(c){var v=k(c);return v.__chain__=!0,v}function bL(c,v){return v(c),c}function yu(c,v){return v(c)}var wL=jn(function(c){var v=c.length,m=v?c[0]:0,T=this.__wrapped__,B=function(F){return If(F,c)};return v>1||this.__actions__.length||!(T instanceof vr)||!Yn(m)?this.thru(B):(T=T.slice(m,+m+(v?1:0)),T.__actions__.push({func:yu,args:[B],thisArg:t}),new on(T,this.__chain__).thru(function(F){return v&&!F.length&&F.push(t),F}))});function xL(){return S1(this)}function EL(){return new on(this.value(),this.__chain__)}function CL(){this.__values__===t&&(this.__values__=F1(this.value()));var c=this.__index__>=this.__values__.length,v=c?t:this.__values__[this.__index__++];return{done:c,value:v}}function _L(){return this}function SL(c){for(var v,m=this;m instanceof tu;){var T=m1(m);T.__index__=0,T.__values__=t,v?B.__wrapped__=T:v=T;var B=T;m=m.__wrapped__}return B.__wrapped__=c,v}function TL(){var c=this.__wrapped__;if(c instanceof vr){var v=c;return this.__actions__.length&&(v=new vr(this)),v=v.reverse(),v.__actions__.push({func:yu,args:[ac],thisArg:t}),new on(v,this.__chain__)}return this.thru(ac)}function RL(){return $b(this.__wrapped__,this.__actions__)}var AL=lu(function(c,v,m){wr.call(c,m)?++c[m]:Hn(c,m,1)});function PL(c,v,m){var T=nr(c)?eb:bB;return m&&Dt(c,v,m)&&(v=t),T(c,Qe(v,3))}function IL(c,v){var m=nr(c)?ca:_b;return m(c,Qe(v,3))}var DL=Qb(b1),BL=Qb(w1);function ML(c,v){return ht(mu(c,v),1)}function LL(c,v){return ht(mu(c,v),V)}function OL(c,v,m){return m=m===t?1:or(m),ht(mu(c,v),m)}function T1(c,v){var m=nr(c)?nn:ga;return m(c,Qe(v,3))}function R1(c,v){var m=nr(c)?eD:Cb;return m(c,Qe(v,3))}var kL=lu(function(c,v,m){wr.call(c,m)?c[m].push(v):Hn(c,m,[v])});function qL(c,v,m,T){c=Nt(c)?c:Vi(c),m=m&&!T?or(m):0;var B=c.length;return m<0&&(m=et(B+m,0)),Cu(c)?m<=B&&c.indexOf(v,m)>-1:!!B&&Ii(c,v,m)>-1}var NL=fr(function(c,v,m){var T=-1,B=typeof v=="function",F=Nt(c)?pe(c.length):[];return ga(c,function(U){F[++T]=B?Ht(v,U,m):Mo(U,v,m)}),F}),FL=lu(function(c,v,m){Hn(c,m,v)});function mu(c,v){var m=nr(c)?Or:Ib;return m(c,Qe(v,3))}function zL(c,v,m,T){return c==null?[]:(nr(v)||(v=v==null?[]:[v]),m=T?t:m,nr(m)||(m=m==null?[]:[m]),Lb(c,v,m))}var $L=lu(function(c,v,m){c[m?0:1].push(v)},function(){return[[],[]]});function VL(c,v,m){var T=nr(c)?yf:ab,B=arguments.length<3;return T(c,Qe(v,4),m,B,ga)}function GL(c,v,m){var T=nr(c)?rD:ab,B=arguments.length<3;return T(c,Qe(v,4),m,B,Cb)}function WL(c,v){var m=nr(c)?ca:_b;return m(c,xu(Qe(v,3)))}function UL(c){var v=nr(c)?bb:qB;return v(c)}function HL(c,v,m){(m?Dt(c,v,m):v===t)?v=1:v=or(v);var T=nr(c)?hB:NB;return T(c,v)}function KL(c){var v=nr(c)?gB:zB;return v(c)}function jL(c){if(c==null)return 0;if(Nt(c))return Cu(c)?Bi(c):c.length;var v=_t(c);return v==we||v==re?c.size:kf(c).length}function YL(c,v,m){var T=nr(c)?mf:$B;return m&&Dt(c,v,m)&&(v=t),T(c,Qe(v,3))}var XL=fr(function(c,v){if(c==null)return[];var m=v.length;return m>1&&Dt(c,v[0],v[1])?v=[]:m>2&&Dt(v[0],v[1],v[2])&&(v=[v[0]]),Lb(c,ht(v,1),[])}),bu=ID||function(){return vt.Date.now()};function ZL(c,v){if(typeof v!="function")throw new an(o);return c=or(c),function(){if(--c<1)return v.apply(this,arguments)}}function A1(c,v,m){return v=m?t:v,v=c&&v==null?c.length:v,Kn(c,_,t,t,t,t,v)}function P1(c,v){var m;if(typeof v!="function")throw new an(o);return c=or(c),function(){return--c>0&&(m=v.apply(this,arguments)),c<=1&&(v=t),m}}var oc=fr(function(c,v,m){var T=b;if(m.length){var B=va(m,zi(oc));T|=S}return Kn(c,T,v,m,B)}),I1=fr(function(c,v,m){var T=b|w;if(m.length){var B=va(m,zi(I1));T|=S}return Kn(v,T,c,m,B)});function D1(c,v,m){v=m?t:v;var T=Kn(c,E,t,t,t,t,t,v);return T.placeholder=D1.placeholder,T}function B1(c,v,m){v=m?t:v;var T=Kn(c,C,t,t,t,t,t,v);return T.placeholder=B1.placeholder,T}function M1(c,v,m){var T,B,F,U,J,se,Pe=0,Ie=!1,Le=!1,Fe=!0;if(typeof c!="function")throw new an(o);v=fn(v)||0,Fr(m)&&(Ie=!!m.leading,Le="maxWait"in m,F=Le?et(fn(m.maxWait)||0,v):F,Fe="trailing"in m?!!m.trailing:Fe);function je(Kr){var xn=T,Qn=B;return T=B=t,Pe=Kr,U=c.apply(Qn,xn),U}function Je(Kr){return Pe=Kr,J=No(dr,v),Ie?je(Kr):U}function ur(Kr){var xn=Kr-se,Qn=Kr-Pe,Q1=v-xn;return Le?Ct(Q1,F-Qn):Q1}function er(Kr){var xn=Kr-se,Qn=Kr-Pe;return se===t||xn>=v||xn<0||Le&&Qn>=F}function dr(){var Kr=bu();if(er(Kr))return hr(Kr);J=No(dr,ur(Kr))}function hr(Kr){return J=t,Fe&&T?je(Kr):(T=B=t,U)}function Xt(){J!==t&&Gb(J),Pe=0,T=se=B=J=t}function Bt(){return J===t?U:hr(bu())}function Zt(){var Kr=bu(),xn=er(Kr);if(T=arguments,B=this,se=Kr,xn){if(J===t)return Je(se);if(Le)return Gb(J),J=No(dr,v),je(se)}return J===t&&(J=No(dr,v)),U}return Zt.cancel=Xt,Zt.flush=Bt,Zt}var QL=fr(function(c,v){return Eb(c,1,v)}),JL=fr(function(c,v,m){return Eb(c,fn(v)||0,m)});function eO(c){return Kn(c,P)}function wu(c,v){if(typeof c!="function"||v!=null&&typeof v!="function")throw new an(o);var m=function(){var T=arguments,B=v?v.apply(this,T):T[0],F=m.cache;if(F.has(B))return F.get(B);var U=c.apply(this,T);return m.cache=F.set(B,U)||F,U};return m.cache=new(wu.Cache||Un),m}wu.Cache=Un;function xu(c){if(typeof c!="function")throw new an(o);return function(){var v=arguments;switch(v.length){case 0:return!c.call(this);case 1:return!c.call(this,v[0]);case 2:return!c.call(this,v[0],v[1]);case 3:return!c.call(this,v[0],v[1],v[2])}return!c.apply(this,v)}}function rO(c){return P1(2,c)}var tO=VB(function(c,v){v=v.length==1&&nr(v[0])?Or(v[0],Kt(Qe())):Or(ht(v,1),Kt(Qe()));var m=v.length;return fr(function(T){for(var B=-1,F=Ct(T.length,m);++B<F;)T[B]=v[B].call(this,T[B]);return Ht(c,this,T)})}),sc=fr(function(c,v){var m=va(v,zi(sc));return Kn(c,S,t,v,m)}),L1=fr(function(c,v){var m=va(v,zi(L1));return Kn(c,R,t,v,m)}),nO=jn(function(c,v){return Kn(c,A,t,t,t,v)});function aO(c,v){if(typeof c!="function")throw new an(o);return v=v===t?v:or(v),fr(c,v)}function iO(c,v){if(typeof c!="function")throw new an(o);return v=v==null?0:et(or(v),0),fr(function(m){var T=m[v],B=ma(m,0,v);return T&&da(B,T),Ht(c,this,B)})}function oO(c,v,m){var T=!0,B=!0;if(typeof c!="function")throw new an(o);return Fr(m)&&(T="leading"in m?!!m.leading:T,B="trailing"in m?!!m.trailing:B),M1(c,v,{leading:T,maxWait:v,trailing:B})}function sO(c){return A1(c,1)}function uO(c,v){return sc(Uf(v),c)}function lO(){if(!arguments.length)return[];var c=arguments[0];return nr(c)?c:[c]}function fO(c){return sn(c,g)}function cO(c,v){return v=typeof v=="function"?v:t,sn(c,g,v)}function dO(c){return sn(c,d|g)}function vO(c,v){return v=typeof v=="function"?v:t,sn(c,d|g,v)}function hO(c,v){return v==null||xb(c,v,st(v))}function wn(c,v){return c===v||c!==c&&v!==v}var gO=vu(Mf),pO=vu(function(c,v){return c>=v}),Ja=Rb((function(){return arguments})())?Rb:function(c){return Gr(c)&&wr.call(c,"callee")&&!vb.call(c,"callee")},nr=pe.isArray,yO=j0?Kt(j0):SB;function Nt(c){return c!=null&&Eu(c.length)&&!Xn(c)}function Hr(c){return Gr(c)&&Nt(c)}function mO(c){return c===!0||c===!1||Gr(c)&&It(c)==ue}var ba=BD||mc,bO=Y0?Kt(Y0):TB;function wO(c){return Gr(c)&&c.nodeType===1&&!Fo(c)}function xO(c){if(c==null)return!0;if(Nt(c)&&(nr(c)||typeof c=="string"||typeof c.splice=="function"||ba(c)||$i(c)||Ja(c)))return!c.length;var v=_t(c);if(v==we||v==re)return!c.size;if(qo(c))return!kf(c).length;for(var m in c)if(wr.call(c,m))return!1;return!0}function EO(c,v){return Lo(c,v)}function CO(c,v,m){m=typeof m=="function"?m:t;var T=m?m(c,v):t;return T===t?Lo(c,v,t,m):!!T}function uc(c){if(!Gr(c))return!1;var v=It(c);return v==Q||v==Z||typeof c.message=="string"&&typeof c.name=="string"&&!Fo(c)}function _O(c){return typeof c=="number"&&gb(c)}function Xn(c){if(!Fr(c))return!1;var v=It(c);return v==ie||v==de||v==te||v==Se}function O1(c){return typeof c=="number"&&c==or(c)}function Eu(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=$}function Fr(c){var v=typeof c;return c!=null&&(v=="object"||v=="function")}function Gr(c){return c!=null&&typeof c=="object"}var k1=X0?Kt(X0):AB;function SO(c,v){return c===v||Of(c,v,Qf(v))}function TO(c,v,m){return m=typeof m=="function"?m:t,Of(c,v,Qf(v),m)}function RO(c){return q1(c)&&c!=+c}function AO(c){if(cM(c))throw new tr(i);return Ab(c)}function PO(c){return c===null}function IO(c){return c==null}function q1(c){return typeof c=="number"||Gr(c)&&It(c)==Ae}function Fo(c){if(!Gr(c)||It(c)!=le)return!1;var v=Ys(c);if(v===null)return!0;var m=wr.call(v,"constructor")&&v.constructor;return typeof m=="function"&&m instanceof m&&Us.call(m)==TD}var lc=Z0?Kt(Z0):PB;function DO(c){return O1(c)&&c>=-$&&c<=$}var N1=Q0?Kt(Q0):IB;function Cu(c){return typeof c=="string"||!nr(c)&&Gr(c)&&It(c)==ce}function Yt(c){return typeof c=="symbol"||Gr(c)&&It(c)==_e}var $i=J0?Kt(J0):DB;function BO(c){return c===t}function MO(c){return Gr(c)&&_t(c)==Te}function LO(c){return Gr(c)&&It(c)==De}var OO=vu(qf),kO=vu(function(c,v){return c<=v});function F1(c){if(!c)return[];if(Nt(c))return Cu(c)?mn(c):qt(c);if(To&&c[To])return hD(c[To]());var v=_t(c),m=v==we?_f:v==re?Vs:Vi;return m(c)}function Zn(c){if(!c)return c===0?c:0;if(c=fn(c),c===V||c===-V){var v=c<0?-1:1;return v*X}return c===c?c:0}function or(c){var v=Zn(c),m=v%1;return v===v?m?v-m:v:0}function z1(c){return c?Ya(or(c),0,K):0}function fn(c){if(typeof c=="number")return c;if(Yt(c))return ee;if(Fr(c)){var v=typeof c.valueOf=="function"?c.valueOf():c;c=Fr(v)?v+"":v}if(typeof c!="string")return c===0?c:+c;c=ib(c);var m=Et.test(c);return m||kt.test(c)?ZI(c.slice(2),m?2:8):ot.test(c)?ee:+c}function $1(c){return Dn(c,Ft(c))}function qO(c){return c?Ya(or(c),-$,$):c===0?c:0}function xr(c){return c==null?"":jt(c)}var NO=Ni(function(c,v){if(qo(v)||Nt(v)){Dn(v,st(v),c);return}for(var m in v)wr.call(v,m)&&Do(c,m,v[m])}),V1=Ni(function(c,v){Dn(v,Ft(v),c)}),_u=Ni(function(c,v,m,T){Dn(v,Ft(v),c,T)}),FO=Ni(function(c,v,m,T){Dn(v,st(v),c,T)}),zO=jn(If);function $O(c,v){var m=qi(c);return v==null?m:wb(m,v)}var VO=fr(function(c,v){c=Sr(c);var m=-1,T=v.length,B=T>2?v[2]:t;for(B&&Dt(v[0],v[1],B)&&(T=1);++m<T;)for(var F=v[m],U=Ft(F),J=-1,se=U.length;++J<se;){var Pe=U[J],Ie=c[Pe];(Ie===t||wn(Ie,Li[Pe])&&!wr.call(c,Pe))&&(c[Pe]=F[Pe])}return c}),GO=fr(function(c){return c.push(t,i1),Ht(G1,t,c)});function WO(c,v){return rb(c,Qe(v,3),In)}function UO(c,v){return rb(c,Qe(v,3),Bf)}function HO(c,v){return c==null?c:Df(c,Qe(v,3),Ft)}function KO(c,v){return c==null?c:Sb(c,Qe(v,3),Ft)}function jO(c,v){return c&&In(c,Qe(v,3))}function YO(c,v){return c&&Bf(c,Qe(v,3))}function XO(c){return c==null?[]:iu(c,st(c))}function ZO(c){return c==null?[]:iu(c,Ft(c))}function fc(c,v,m){var T=c==null?t:Xa(c,v);return T===t?m:T}function QO(c,v){return c!=null&&u1(c,v,xB)}function cc(c,v){return c!=null&&u1(c,v,EB)}var JO=e1(function(c,v,m){v!=null&&typeof v.toString!="function"&&(v=Hs.call(v)),c[v]=m},vc(zt)),ek=e1(function(c,v,m){v!=null&&typeof v.toString!="function"&&(v=Hs.call(v)),wr.call(c,v)?c[v].push(m):c[v]=[m]},Qe),rk=fr(Mo);function st(c){return Nt(c)?mb(c):kf(c)}function Ft(c){return Nt(c)?mb(c,!0):BB(c)}function tk(c,v){var m={};return v=Qe(v,3),In(c,function(T,B,F){Hn(m,v(T,B,F),T)}),m}function nk(c,v){var m={};return v=Qe(v,3),In(c,function(T,B,F){Hn(m,B,v(T,B,F))}),m}var ak=Ni(function(c,v,m){ou(c,v,m)}),G1=Ni(function(c,v,m,T){ou(c,v,m,T)}),ik=jn(function(c,v){var m={};if(c==null)return m;var T=!1;v=Or(v,function(F){return F=ya(F,c),T||(T=F.length>1),F}),Dn(c,Xf(c),m),T&&(m=sn(m,d|h|g,JB));for(var B=v.length;B--;)Vf(m,v[B]);return m});function ok(c,v){return W1(c,xu(Qe(v)))}var sk=jn(function(c,v){return c==null?{}:LB(c,v)});function W1(c,v){if(c==null)return{};var m=Or(Xf(c),function(T){return[T]});return v=Qe(v),Ob(c,m,function(T,B){return v(T,B[0])})}function uk(c,v,m){v=ya(v,c);var T=-1,B=v.length;for(B||(B=1,c=t);++T<B;){var F=c==null?t:c[Bn(v[T])];F===t&&(T=B,F=m),c=Xn(F)?F.call(c):F}return c}function lk(c,v,m){return c==null?c:Oo(c,v,m)}function fk(c,v,m,T){return T=typeof T=="function"?T:t,c==null?c:Oo(c,v,m,T)}var U1=n1(st),H1=n1(Ft);function ck(c,v,m){var T=nr(c),B=T||ba(c)||$i(c);if(v=Qe(v,4),m==null){var F=c&&c.constructor;B?m=T?new F:[]:Fr(c)?m=Xn(F)?qi(Ys(c)):{}:m={}}return(B?nn:In)(c,function(U,J,se){return v(m,U,J,se)}),m}function dk(c,v){return c==null?!0:Vf(c,v)}function vk(c,v,m){return c==null?c:zb(c,v,Uf(m))}function hk(c,v,m,T){return T=typeof T=="function"?T:t,c==null?c:zb(c,v,Uf(m),T)}function Vi(c){return c==null?[]:Cf(c,st(c))}function gk(c){return c==null?[]:Cf(c,Ft(c))}function pk(c,v,m){return m===t&&(m=v,v=t),m!==t&&(m=fn(m),m=m===m?m:0),v!==t&&(v=fn(v),v=v===v?v:0),Ya(fn(c),v,m)}function yk(c,v,m){return v=Zn(v),m===t?(m=v,v=0):m=Zn(m),c=fn(c),CB(c,v,m)}function mk(c,v,m){if(m&&typeof m!="boolean"&&Dt(c,v,m)&&(v=m=t),m===t&&(typeof v=="boolean"?(m=v,v=t):typeof c=="boolean"&&(m=c,c=t)),c===t&&v===t?(c=0,v=1):(c=Zn(c),v===t?(v=c,c=0):v=Zn(v)),c>v){var T=c;c=v,v=T}if(m||c%1||v%1){var B=pb();return Ct(c+B*(v-c+XI("1e-"+((B+"").length-1))),v)}return Ff(c,v)}var bk=Fi(function(c,v,m){return v=v.toLowerCase(),c+(m?K1(v):v)});function K1(c){return dc(xr(c).toLowerCase())}function j1(c){return c=xr(c),c&&c.replace(rf,lD).replace(zI,"")}function wk(c,v,m){c=xr(c),v=jt(v);var T=c.length;m=m===t?T:Ya(or(m),0,T);var B=m;return m-=v.length,m>=0&&c.slice(m,B)==v}function xk(c){return c=xr(c),c&&ar.test(c)?c.replace(Xe,fD):c}function Ek(c){return c=xr(c),c&&jr.test(c)?c.replace(Lr,"\\$&"):c}var Ck=Fi(function(c,v,m){return c+(m?"-":"")+v.toLowerCase()}),_k=Fi(function(c,v,m){return c+(m?" ":"")+v.toLowerCase()}),Sk=Zb("toLowerCase");function Tk(c,v,m){c=xr(c),v=or(v);var T=v?Bi(c):0;if(!v||T>=v)return c;var B=(v-T)/2;return du(Js(B),m)+c+du(Qs(B),m)}function Rk(c,v,m){c=xr(c),v=or(v);var T=v?Bi(c):0;return v&&T<v?c+du(v-T,m):c}function Ak(c,v,m){c=xr(c),v=or(v);var T=v?Bi(c):0;return v&&T<v?du(v-T,m)+c:c}function Pk(c,v,m){return m||v==null?v=0:v&&(v=+v),kD(xr(c).replace(Nr,""),v||0)}function Ik(c,v,m){return(m?Dt(c,v,m):v===t)?v=1:v=or(v),zf(xr(c),v)}function Dk(){var c=arguments,v=xr(c[0]);return c.length<3?v:v.replace(c[1],c[2])}var Bk=Fi(function(c,v,m){return c+(m?"_":"")+v.toLowerCase()});function Mk(c,v,m){return m&&typeof m!="number"&&Dt(c,v,m)&&(v=m=t),m=m===t?K:m>>>0,m?(c=xr(c),c&&(typeof v=="string"||v!=null&&!lc(v))&&(v=jt(v),!v&&Di(c))?ma(mn(c),0,m):c.split(v,m)):[]}var Lk=Fi(function(c,v,m){return c+(m?" ":"")+dc(v)});function Ok(c,v,m){return c=xr(c),m=m==null?0:Ya(or(m),0,c.length),v=jt(v),c.slice(m,m+v.length)==v}function kk(c,v,m){var T=k.templateSettings;m&&Dt(c,v,m)&&(v=t),c=xr(c),v=_u({},v,T,a1);var B=_u({},v.imports,T.imports,a1),F=st(B),U=Cf(B,F),J,se,Pe=0,Ie=v.interpolate||_i,Le="__p += '",Fe=Sf((v.escape||_i).source+"|"+Ie.source+"|"+(Ie===ir?Gn:_i).source+"|"+(v.evaluate||_i).source+"|$","g"),je="//# sourceURL="+(wr.call(v,"sourceURL")?(v.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++UI+"]")+`
|
|
11
|
-
`;c.replace(Fe,function(er,dr,hr,Xt,Bt,Zt){return hr||(hr=Xt),Le+=c.slice(Pe,Zt).replace(tf,cD),dr&&(J=!0,Le+=`' +
|
|
12
|
-
__e(`+dr+`) +
|
|
13
|
-
'`),Bt&&(se=!0,Le+=`';
|
|
14
|
-
`+Bt+`;
|
|
15
|
-
__p += '`),hr&&(Le+=`' +
|
|
16
|
-
((__t = (`+hr+`)) == null ? '' : __t) +
|
|
17
|
-
'`),Pe=Zt+er.length,er}),Le+=`';
|
|
18
|
-
`;var Je=wr.call(v,"variable")&&v.variable;if(!Je)Le=`with (obj) {
|
|
19
|
-
`+Le+`
|
|
20
|
-
}
|
|
21
|
-
`;else if(ua.test(Je))throw new tr(s);Le=(se?Le.replace(Ve,""):Le).replace(Be,"$1").replace(He,"$1;"),Le="function("+(Je||"obj")+`) {
|
|
22
|
-
`+(Je?"":`obj || (obj = {});
|
|
23
|
-
`)+"var __t, __p = ''"+(J?", __e = _.escape":"")+(se?`, __j = Array.prototype.join;
|
|
24
|
-
function print() { __p += __j.call(arguments, '') }
|
|
25
|
-
`:`;
|
|
26
|
-
`)+Le+`return __p
|
|
27
|
-
}`;var ur=X1(function(){return br(F,je+"return "+Le).apply(t,U)});if(ur.source=Le,uc(ur))throw ur;return ur}function qk(c){return xr(c).toLowerCase()}function Nk(c){return xr(c).toUpperCase()}function Fk(c,v,m){if(c=xr(c),c&&(m||v===t))return ib(c);if(!c||!(v=jt(v)))return c;var T=mn(c),B=mn(v),F=ob(T,B),U=sb(T,B)+1;return ma(T,F,U).join("")}function zk(c,v,m){if(c=xr(c),c&&(m||v===t))return c.slice(0,lb(c)+1);if(!c||!(v=jt(v)))return c;var T=mn(c),B=sb(T,mn(v))+1;return ma(T,0,B).join("")}function $k(c,v,m){if(c=xr(c),c&&(m||v===t))return c.replace(Nr,"");if(!c||!(v=jt(v)))return c;var T=mn(c),B=ob(T,mn(v));return ma(T,B).join("")}function Vk(c,v){var m=I,T=D;if(Fr(v)){var B="separator"in v?v.separator:B;m="length"in v?or(v.length):m,T="omission"in v?jt(v.omission):T}c=xr(c);var F=c.length;if(Di(c)){var U=mn(c);F=U.length}if(m>=F)return c;var J=m-Bi(T);if(J<1)return T;var se=U?ma(U,0,J).join(""):c.slice(0,J);if(B===t)return se+T;if(U&&(J+=se.length-J),lc(B)){if(c.slice(J).search(B)){var Pe,Ie=se;for(B.global||(B=Sf(B.source,xr(dt.exec(B))+"g")),B.lastIndex=0;Pe=B.exec(Ie);)var Le=Pe.index;se=se.slice(0,Le===t?J:Le)}}else if(c.indexOf(jt(B),J)!=J){var Fe=se.lastIndexOf(B);Fe>-1&&(se=se.slice(0,Fe))}return se+T}function Gk(c){return c=xr(c),c&&sr.test(c)?c.replace(We,mD):c}var Wk=Fi(function(c,v,m){return c+(m?" ":"")+v.toUpperCase()}),dc=Zb("toUpperCase");function Y1(c,v,m){return c=xr(c),v=m?t:v,v===t?vD(c)?xD(c):aD(c):c.match(v)||[]}var X1=fr(function(c,v){try{return Ht(c,t,v)}catch(m){return uc(m)?m:new tr(m)}}),Uk=jn(function(c,v){return nn(v,function(m){m=Bn(m),Hn(c,m,oc(c[m],c))}),c});function Hk(c){var v=c==null?0:c.length,m=Qe();return c=v?Or(c,function(T){if(typeof T[1]!="function")throw new an(o);return[m(T[0]),T[1]]}):[],fr(function(T){for(var B=-1;++B<v;){var F=c[B];if(Ht(F[0],this,T))return Ht(F[1],this,T)}})}function Kk(c){return mB(sn(c,d))}function vc(c){return function(){return c}}function jk(c,v){return c==null||c!==c?v:c}var Yk=Jb(),Xk=Jb(!0);function zt(c){return c}function hc(c){return Pb(typeof c=="function"?c:sn(c,d))}function Zk(c){return Db(sn(c,d))}function Qk(c,v){return Bb(c,sn(v,d))}var Jk=fr(function(c,v){return function(m){return Mo(m,c,v)}}),eq=fr(function(c,v){return function(m){return Mo(c,m,v)}});function gc(c,v,m){var T=st(v),B=iu(v,T);m==null&&!(Fr(v)&&(B.length||!T.length))&&(m=v,v=c,c=this,B=iu(v,st(v)));var F=!(Fr(m)&&"chain"in m)||!!m.chain,U=Xn(c);return nn(B,function(J){var se=v[J];c[J]=se,U&&(c.prototype[J]=function(){var Pe=this.__chain__;if(F||Pe){var Ie=c(this.__wrapped__),Le=Ie.__actions__=qt(this.__actions__);return Le.push({func:se,args:arguments,thisArg:c}),Ie.__chain__=Pe,Ie}return se.apply(c,da([this.value()],arguments))})}),c}function rq(){return vt._===this&&(vt._=RD),this}function pc(){}function tq(c){return c=or(c),fr(function(v){return Mb(v,c)})}var nq=Kf(Or),aq=Kf(eb),iq=Kf(mf);function Z1(c){return ec(c)?bf(Bn(c)):OB(c)}function oq(c){return function(v){return c==null?t:Xa(c,v)}}var sq=r1(),uq=r1(!0);function yc(){return[]}function mc(){return!1}function lq(){return{}}function fq(){return""}function cq(){return!0}function dq(c,v){if(c=or(c),c<1||c>$)return[];var m=K,T=Ct(c,K);v=Qe(v),c-=K;for(var B=Ef(T,v);++m<c;)v(m);return B}function vq(c){return nr(c)?Or(c,Bn):Yt(c)?[c]:qt(y1(xr(c)))}function hq(c){var v=++SD;return xr(c)+v}var gq=cu(function(c,v){return c+v},0),pq=jf("ceil"),yq=cu(function(c,v){return c/v},1),mq=jf("floor");function bq(c){return c&&c.length?au(c,zt,Mf):t}function wq(c,v){return c&&c.length?au(c,Qe(v,2),Mf):t}function xq(c){return nb(c,zt)}function Eq(c,v){return nb(c,Qe(v,2))}function Cq(c){return c&&c.length?au(c,zt,qf):t}function _q(c,v){return c&&c.length?au(c,Qe(v,2),qf):t}var Sq=cu(function(c,v){return c*v},1),Tq=jf("round"),Rq=cu(function(c,v){return c-v},0);function Aq(c){return c&&c.length?xf(c,zt):0}function Pq(c,v){return c&&c.length?xf(c,Qe(v,2)):0}return k.after=ZL,k.ary=A1,k.assign=NO,k.assignIn=V1,k.assignInWith=_u,k.assignWith=FO,k.at=zO,k.before=P1,k.bind=oc,k.bindAll=Uk,k.bindKey=I1,k.castArray=lO,k.chain=S1,k.chunk=mM,k.compact=bM,k.concat=wM,k.cond=Hk,k.conforms=Kk,k.constant=vc,k.countBy=AL,k.create=$O,k.curry=D1,k.curryRight=B1,k.debounce=M1,k.defaults=VO,k.defaultsDeep=GO,k.defer=QL,k.delay=JL,k.difference=xM,k.differenceBy=EM,k.differenceWith=CM,k.drop=_M,k.dropRight=SM,k.dropRightWhile=TM,k.dropWhile=RM,k.fill=AM,k.filter=IL,k.flatMap=ML,k.flatMapDeep=LL,k.flatMapDepth=OL,k.flatten=x1,k.flattenDeep=PM,k.flattenDepth=IM,k.flip=eO,k.flow=Yk,k.flowRight=Xk,k.fromPairs=DM,k.functions=XO,k.functionsIn=ZO,k.groupBy=kL,k.initial=MM,k.intersection=LM,k.intersectionBy=OM,k.intersectionWith=kM,k.invert=JO,k.invertBy=ek,k.invokeMap=NL,k.iteratee=hc,k.keyBy=FL,k.keys=st,k.keysIn=Ft,k.map=mu,k.mapKeys=tk,k.mapValues=nk,k.matches=Zk,k.matchesProperty=Qk,k.memoize=wu,k.merge=ak,k.mergeWith=G1,k.method=Jk,k.methodOf=eq,k.mixin=gc,k.negate=xu,k.nthArg=tq,k.omit=ik,k.omitBy=ok,k.once=rO,k.orderBy=zL,k.over=nq,k.overArgs=tO,k.overEvery=aq,k.overSome=iq,k.partial=sc,k.partialRight=L1,k.partition=$L,k.pick=sk,k.pickBy=W1,k.property=Z1,k.propertyOf=oq,k.pull=zM,k.pullAll=C1,k.pullAllBy=$M,k.pullAllWith=VM,k.pullAt=GM,k.range=sq,k.rangeRight=uq,k.rearg=nO,k.reject=WL,k.remove=WM,k.rest=aO,k.reverse=ac,k.sampleSize=HL,k.set=lk,k.setWith=fk,k.shuffle=KL,k.slice=UM,k.sortBy=XL,k.sortedUniq=QM,k.sortedUniqBy=JM,k.split=Mk,k.spread=iO,k.tail=eL,k.take=rL,k.takeRight=tL,k.takeRightWhile=nL,k.takeWhile=aL,k.tap=bL,k.throttle=oO,k.thru=yu,k.toArray=F1,k.toPairs=U1,k.toPairsIn=H1,k.toPath=vq,k.toPlainObject=$1,k.transform=ck,k.unary=sO,k.union=iL,k.unionBy=oL,k.unionWith=sL,k.uniq=uL,k.uniqBy=lL,k.uniqWith=fL,k.unset=dk,k.unzip=ic,k.unzipWith=_1,k.update=vk,k.updateWith=hk,k.values=Vi,k.valuesIn=gk,k.without=cL,k.words=Y1,k.wrap=uO,k.xor=dL,k.xorBy=vL,k.xorWith=hL,k.zip=gL,k.zipObject=pL,k.zipObjectDeep=yL,k.zipWith=mL,k.entries=U1,k.entriesIn=H1,k.extend=V1,k.extendWith=_u,gc(k,k),k.add=gq,k.attempt=X1,k.camelCase=bk,k.capitalize=K1,k.ceil=pq,k.clamp=pk,k.clone=fO,k.cloneDeep=dO,k.cloneDeepWith=vO,k.cloneWith=cO,k.conformsTo=hO,k.deburr=j1,k.defaultTo=jk,k.divide=yq,k.endsWith=wk,k.eq=wn,k.escape=xk,k.escapeRegExp=Ek,k.every=PL,k.find=DL,k.findIndex=b1,k.findKey=WO,k.findLast=BL,k.findLastIndex=w1,k.findLastKey=UO,k.floor=mq,k.forEach=T1,k.forEachRight=R1,k.forIn=HO,k.forInRight=KO,k.forOwn=jO,k.forOwnRight=YO,k.get=fc,k.gt=gO,k.gte=pO,k.has=QO,k.hasIn=cc,k.head=E1,k.identity=zt,k.includes=qL,k.indexOf=BM,k.inRange=yk,k.invoke=rk,k.isArguments=Ja,k.isArray=nr,k.isArrayBuffer=yO,k.isArrayLike=Nt,k.isArrayLikeObject=Hr,k.isBoolean=mO,k.isBuffer=ba,k.isDate=bO,k.isElement=wO,k.isEmpty=xO,k.isEqual=EO,k.isEqualWith=CO,k.isError=uc,k.isFinite=_O,k.isFunction=Xn,k.isInteger=O1,k.isLength=Eu,k.isMap=k1,k.isMatch=SO,k.isMatchWith=TO,k.isNaN=RO,k.isNative=AO,k.isNil=IO,k.isNull=PO,k.isNumber=q1,k.isObject=Fr,k.isObjectLike=Gr,k.isPlainObject=Fo,k.isRegExp=lc,k.isSafeInteger=DO,k.isSet=N1,k.isString=Cu,k.isSymbol=Yt,k.isTypedArray=$i,k.isUndefined=BO,k.isWeakMap=MO,k.isWeakSet=LO,k.join=qM,k.kebabCase=Ck,k.last=ln,k.lastIndexOf=NM,k.lowerCase=_k,k.lowerFirst=Sk,k.lt=OO,k.lte=kO,k.max=bq,k.maxBy=wq,k.mean=xq,k.meanBy=Eq,k.min=Cq,k.minBy=_q,k.stubArray=yc,k.stubFalse=mc,k.stubObject=lq,k.stubString=fq,k.stubTrue=cq,k.multiply=Sq,k.nth=FM,k.noConflict=rq,k.noop=pc,k.now=bu,k.pad=Tk,k.padEnd=Rk,k.padStart=Ak,k.parseInt=Pk,k.random=mk,k.reduce=VL,k.reduceRight=GL,k.repeat=Ik,k.replace=Dk,k.result=uk,k.round=Tq,k.runInContext=ae,k.sample=UL,k.size=jL,k.snakeCase=Bk,k.some=YL,k.sortedIndex=HM,k.sortedIndexBy=KM,k.sortedIndexOf=jM,k.sortedLastIndex=YM,k.sortedLastIndexBy=XM,k.sortedLastIndexOf=ZM,k.startCase=Lk,k.startsWith=Ok,k.subtract=Rq,k.sum=Aq,k.sumBy=Pq,k.template=kk,k.times=dq,k.toFinite=Zn,k.toInteger=or,k.toLength=z1,k.toLower=qk,k.toNumber=fn,k.toSafeInteger=qO,k.toString=xr,k.toUpper=Nk,k.trim=Fk,k.trimEnd=zk,k.trimStart=$k,k.truncate=Vk,k.unescape=Gk,k.uniqueId=hq,k.upperCase=Wk,k.upperFirst=dc,k.each=T1,k.eachRight=R1,k.first=E1,gc(k,(function(){var c={};return In(k,function(v,m){wr.call(k.prototype,m)||(c[m]=v)}),c})(),{chain:!1}),k.VERSION=n,nn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){k[c].placeholder=k}),nn(["drop","take"],function(c,v){vr.prototype[c]=function(m){m=m===t?1:et(or(m),0);var T=this.__filtered__&&!v?new vr(this):this.clone();return T.__filtered__?T.__takeCount__=Ct(m,T.__takeCount__):T.__views__.push({size:Ct(m,K),type:c+(T.__dir__<0?"Right":"")}),T},vr.prototype[c+"Right"]=function(m){return this.reverse()[c](m).reverse()}}),nn(["filter","map","takeWhile"],function(c,v){var m=v+1,T=m==q||m==W;vr.prototype[c]=function(B){var F=this.clone();return F.__iteratees__.push({iteratee:Qe(B,3),type:m}),F.__filtered__=F.__filtered__||T,F}}),nn(["head","last"],function(c,v){var m="take"+(v?"Right":"");vr.prototype[c]=function(){return this[m](1).value()[0]}}),nn(["initial","tail"],function(c,v){var m="drop"+(v?"":"Right");vr.prototype[c]=function(){return this.__filtered__?new vr(this):this[m](1)}}),vr.prototype.compact=function(){return this.filter(zt)},vr.prototype.find=function(c){return this.filter(c).head()},vr.prototype.findLast=function(c){return this.reverse().find(c)},vr.prototype.invokeMap=fr(function(c,v){return typeof c=="function"?new vr(this):this.map(function(m){return Mo(m,c,v)})}),vr.prototype.reject=function(c){return this.filter(xu(Qe(c)))},vr.prototype.slice=function(c,v){c=or(c);var m=this;return m.__filtered__&&(c>0||v<0)?new vr(m):(c<0?m=m.takeRight(-c):c&&(m=m.drop(c)),v!==t&&(v=or(v),m=v<0?m.dropRight(-v):m.take(v-c)),m)},vr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},vr.prototype.toArray=function(){return this.take(K)},In(vr.prototype,function(c,v){var m=/^(?:filter|find|map|reject)|While$/.test(v),T=/^(?:head|last)$/.test(v),B=k[T?"take"+(v=="last"?"Right":""):v],F=T||/^find/.test(v);B&&(k.prototype[v]=function(){var U=this.__wrapped__,J=T?[1]:arguments,se=U instanceof vr,Pe=J[0],Ie=se||nr(U),Le=function(dr){var hr=B.apply(k,da([dr],J));return T&&Fe?hr[0]:hr};Ie&&m&&typeof Pe=="function"&&Pe.length!=1&&(se=Ie=!1);var Fe=this.__chain__,je=!!this.__actions__.length,Je=F&&!Fe,ur=se&&!je;if(!F&&Ie){U=ur?U:new vr(this);var er=c.apply(U,J);return er.__actions__.push({func:yu,args:[Le],thisArg:t}),new on(er,Fe)}return Je&&ur?c.apply(this,J):(er=this.thru(Le),Je?T?er.value()[0]:er.value():er)})}),nn(["pop","push","shift","sort","splice","unshift"],function(c){var v=Gs[c],m=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",T=/^(?:pop|shift)$/.test(c);k.prototype[c]=function(){var B=arguments;if(T&&!this.__chain__){var F=this.value();return v.apply(nr(F)?F:[],B)}return this[m](function(U){return v.apply(nr(U)?U:[],B)})}}),In(vr.prototype,function(c,v){var m=k[v];if(m){var T=m.name+"";wr.call(ki,T)||(ki[T]=[]),ki[T].push({name:v,func:m})}}),ki[fu(t,w).name]=[{name:"wrapper",func:t}],vr.prototype.clone=GD,vr.prototype.reverse=WD,vr.prototype.value=UD,k.prototype.at=wL,k.prototype.chain=xL,k.prototype.commit=EL,k.prototype.next=CL,k.prototype.plant=SL,k.prototype.reverse=TL,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=RL,k.prototype.first=k.prototype.head,To&&(k.prototype[To]=_L),k}),Mi=ED();Ua?((Ua.exports=Mi)._=Mi,hf._=Mi):vt._=Mi}).call(kq)})(Ko,Ko.exports)),Ko.exports}var pr=qq();const pl={label:"Untitled",description:"",isTask:!1,isLocked:!1},$m={id:null,type:"text",data:{...pl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",borderColor:"transparent",borderRadius:25,borderWidth:0,boxShadow:"none",textOverflow:"ellipsis",fontWeight:"bold",textColor:"gray.800",textAlign:"center"}}},rw={id:null,type:"objectView",data:{...pl,headerTitle:null,viewProps:{width:"100%",borderWidth:2,borderRadius:25,height:"100%",justifyContent:"space-between",flexDirection:"row",textColor:"gray.900"}}},Nq={id:null,type:"arrayView",data:{...pl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",textAlign:"center",borderRadius:25,fontSize:"5xl",borderWidth:2,textOverflow:"ellipsis",wordBreak:"keep-all",fontWeight:"bold",textColor:"gray.900",placeholder:"Start Typing"}}},tw={id:null,type:"workflowStep",data:{...pl,viewProps:{width:"max-content !important",maxWidth:350,minWidth:280,height:"100%",borderRadius:15,borderWidth:3}}};let Su;const Fq=new Uint8Array(16);function zq(){if(!Su&&(Su=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Su))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Su(Fq)}const pt=[];for(let r=0;r<256;++r)pt.push((r+256).toString(16).slice(1));function $q(r,e=0){return pt[r[e+0]]+pt[r[e+1]]+pt[r[e+2]]+pt[r[e+3]]+"-"+pt[r[e+4]]+pt[r[e+5]]+"-"+pt[r[e+6]]+pt[r[e+7]]+"-"+pt[r[e+8]]+pt[r[e+9]]+"-"+pt[r[e+10]]+pt[r[e+11]]+pt[r[e+12]]+pt[r[e+13]]+pt[r[e+14]]+pt[r[e+15]]}const Vq=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),nw={randomUUID:Vq};function Gq(r,e,t){if(nw.randomUUID&&!r)return nw.randomUUID();r=r||{};const n=r.random||(r.rng||zq)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,$q(n)}const Qt=r=>typeof r=="object",fR=r=>Array.isArray(r),Wq=["order","position","selected","locked","grabbed","grabbable","scratch"],Pa=r=>Object.entries(r).reduce((e,[t,n])=>(!Qt(n)&&!t.startsWith("$")&&(e[t]=n),e),{}),Vm=(r,e)=>typeof r=="string"&&r.startsWith("$")?bc(r,e):Qt(r)&&!fR(r)?Object.entries(r).reduce((t,[n,a])=>(typeof a=="string"&&a.startsWith("$")&&n==="..."?(delete t["..."],t[n]={...bc(a,e),...r}):typeof a=="string"&&a.startsWith("$")?t[n]=bc(a,e):t[n]=a,t),{}):r,Ia=r=>Object.entries(r).reduce((e,[t,n])=>(Qt(n)&&t&&n&&!t.startsWith("$")&&(Wq.includes(t)&&(t=t+"#"),e[t]=n),e),{}),ai=(r,e,{label:t,parent:n=void 0},a,i=null)=>(i!==null&&(Qt(i)||fR(i))&&(i=JSON.stringify(i,null,2)),{data:{parent:n,...r.data,id:e,text:t||"",label:t,code:i||null,type:r.type,description:a}}),Ca=(r,e,t=null,n=null,a=null,i=!1,o=null)=>({data:{id:Gq(),source:a?e:r,target:a?r:e,label:n||"",isInverted:a,isEdgeAnimated:i,parent:o}}),_n=(r,e=[])=>{const t={},n={};let a=[];if(r)for(const[i,o]of Object.entries(r))i.startsWith("$")&&i!=="$"?t[i.slice(1)]=o:i!=="$"?n[i]=o:i==="$"&&(a=o);return{newConfig:t,updatedObject:n,arrayObject:a}},Qi=(r,e)=>{let t=rw;const{view:n,borderColor:a,borderRadius:i,bgColor:o,textColor:s,fontSize:u,stepType:l}=e;r=n||r,l?t={...tw}:r==="object"?t=rw:r==="text"?t=$m:r==="array"?t=Nq:r==="workflowStep"&&(t={...tw});const f=t.data.viewProps;return t.data.viewProps={...f,borderRadius:i||(l?15:50),bgColor:o,borderColor:a,textColor:s,fontSize:u},t.data.config=e,{config:t}},ss=(r,e)=>(r=e.find(n=>n.data.id===r)?`${r}.#`:r,r),bc=(r,{ids:e,jsnObjct:t})=>{if(typeof r=="string"&&(r!=null&&r.startsWith("$"))){const n=r.replace("$","").replace("*","");r==null||r.endsWith("*");const a=e.find(s=>s.split(".").slice(-1)[0]===n||n===s);if(!a)return r;const i=Uq(a,t);return JSON.stringify(i).includes(r)?r:i||r}return r},Uq=(r,e)=>{let t=r.split(".").splice(1);return t=t[t.length-1]==="#"||t[t.length-1].includes("{")?t.slice(0,-2):t,(i=>t.reduce((o,s)=>{s=s.replace("[","").replace("]","");const{arrayObject:u}=_n(o);return o=u.length?u:o,o[s]},i))(e)};function to(r,e="root",t=[]){try{const{arrayObject:n}=_n(r);n.length&&(r=n);const a=Pa(r),i=Ia(r);return Qt(r)?(pr.isArray(r)||pr.isArray(r)&&e==="root"||!pr.isArray(r)&&Object.keys(a).length||e==="root")&&t.push(e):t.push(e),Object.keys(i).length&&!pr.isArray(r)?rs({chldPth:null,itrblObjct:i,nodes:t,path:e}):pr.isArray(r)&&r.forEach((o,s)=>{const u=Pa(o),l=Ia(o),{newConfig:f,arrayObject:d}=_n(o);let h=`${e}.${s}`;Qt(o)?Object.keys(u).length?(to(u,h,t),Object.keys(l).length&&!pr.isArray(o)&&rs({chldPth:h,itrblObjct:l,nodes:t,path:e})):Object.keys(l).length&&!pr.isArray(o)?rs({chldPth:h,itrblObjct:l,nodes:t,path:e}):pr.isArray(o)&&cR({chldPth:h,item:o,nodes:t,path:e}):t.push(h)}),{nodes:t}}catch{return{nodes:t}}}const rs=({chldPth:r,itrblObjct:e,nodes:t,path:n})=>Object.entries(e).forEach(([a,i],o)=>{const s=Pa(i),u=Ia(i),{newConfig:l,arrayObject:f}=_n(i);f.length&&(i=f),n.split(".").slice(0,2).join(".");let d=r?`${r}.${a}`:`${n}.${a}`;if(Qt(i)&&!pr.isArray(i)){const h=Object.keys(s).length===0;if(h&&(Qi("array",l),t.push(d)),Object.keys(s).length){const g=pr.isArray(i)?`${i.length||""}`:`{${Object.keys(i).length||""}}`;let p=d;h&&(p=`${d}.${g}`),to(i,p,t)}else Object.keys(u).length&&!pr.isArray(i)?rs({chldPth:d,itrblObjct:u,path:d,nodes:t}):to(i,d,t)}else pr.isArray(i)&&to(i,d,t)}),cR=({chldPth:r,item:e,nodes:t,path:n})=>e.forEach((a,i)=>{let o=`${r}.${i}`;const s=Ia(a),u=Pa(a);Qt(a)?!pr.isArray(a)&&Object.keys(u).length?to(a,o,t):Object.keys(s).length&&!pr.isArray(a)?rs({chldPth:o,itrblObjct:s,path:n,nodes:t}):pr.isArray(a)&&cR({chldPth:o,item:a,nodes:t,path:n}):t.push(o)}),Qu=[];let ts;function li(r,e="root",t=[],n=[],a="untitled",i={hideDefaultObject:!1,sprtObjctKy:!1,isCntr:!1},o={}){if(!r||typeof r!="object")return console.error("Invalid object passed",r),{nodes:t,edges:n};const s=r;if(!ts){const{nodes:f}=to(r);ts={ids:f,jsnObjct:r}}let{hideDefaultObject:u,sprtObjctKy:l}=i;try{e=ss(e,t);const{newConfig:f,arrayObject:d}=_n(r),h=Object.keys(o).length>0?o:f;d.length&&(r=d);const g=Pa(r),p=Ia(r),{label:x,collapsed:b,parent:w}=h;if(!Qt(r))t.push(ai($m,e,{label:x||e,parent:w},r,s));else if(pr.isArray(r)||pr.isArray(r)&&e==="root"){const{config:y}=Qi("array",h),E=pr.isArray(r)?`${r.length||""}`:`{${Object.keys(r).length||""}}`,C=e==="root"?a:`${a} ${E}`;t.push(ai(y,e,{label:x||C,parent:w},r,pr.isArray(s)?{[a]:s}:s))}else if(!pr.isArray(r)&&Object.keys(g).length||e==="root"){const{config:y}=Qi(null,h),E=pr.isArray(r)?`${r.length||""}`:`{${Object.keys(r).length||""}}`,C=e.split("."),S=C[C.length-1];let R=isNaN(Number(S))?null:Number(S)+1;const _=isNaN(Number(S))?S:C[C.length-2]+" "+R,A=e==="root"?a:_;let P=!1;Number.isNaN(Number(a))||(P=!0);const I=r;if(x){const{config:D}=Qi("object",h);t.push(ai(D,e,{label:x||`${x} ${E}`,parent:w},g,I))}else y.data.headerTitle=A,t.push(ai(y,e,{label:x,parent:w},g,I))}return b||(Object.keys(p).length&&!pr.isArray(r)?ns({flowConfig:i,chldPth:null,edges:n,isInverted:null,itrblObjct:p,nodes:t,path:e,newConfig:h}):pr.isArray(r)&&r.forEach((y,E)=>{y=Vm(y,ts);const C=y,S=Pa(y),R=Ia(y),{newConfig:_,arrayObject:A}=_n(y);A.length&&(y=A);const{config:P}=Qi(typeof y=="string"?"text":"array",_),{hideConfig:I,sourceLabel:D,label:L,isEdgeAnimated:M,parent:q}=_;u=u||I;const N=e==="root"&&i.isCntr,W=e.split(".").slice(0,2).join("."),V=Qu.includes(W),$=i.isCntr&&V||E%2===0&&N;let X=`${e}.${E}`;X=ss(X,t),$&&Qu.push(X),Qt(y)?Object.keys(S).length&&!pr.isArray(y)?(n.push(Ca(e,X,null,D,$,M)),li(y,X,t,n,L||E,i,_)):Object.keys(R).length&&!pr.isArray(y)?ns({flowConfig:i,chldPth:X,isInverted:$,edges:n,itrblObjct:R,nodes:t,path:e,newConfig:_,forceIsInverted:!0}):pr.isArray(y)?dR({flowConfig:i,chldPth:X,edges:n,isInverted:$,item:y,nodes:t,path:e}):Qt(y)&&ns({flowConfig:i,chldPth:X,isInverted:$,edges:n,itrblObjct:[y],nodes:t,path:e,newConfig:_}):(n.push(Ca(e,X,null,D,$,M)),t.push(ai(P,X,{label:L||String(y),parent:q},y,C)))})),{nodes:t,edges:n}}catch{return{nodes:t,edges:n}}}const ns=({chldPth:r,flowConfig:e,edges:t,itrblObjct:n,nodes:a,isInverted:i,path:o,newConfig:s,forceIsInverted:u=!1})=>{let{hideDefaultObject:l,sprtObjctKy:f}=e;return Object.entries(n).forEach(([d,h],g)=>{h=Vm(h,ts);const p=h,x=Pa(h),b=Ia(h),{newConfig:w,arrayObject:y}=_n(h);y.length&&(h=y);const{hideConfig:E,sourceLabel:C,label:S,content:R,target:_,targetLabel:A,collapsed:P,isEdgeAnimated:I,parent:D}=w;l=l||E;const L=o==="root"&&e.isCntr,M=o.split(".").slice(0,2).join("."),q=Qu.includes(M);u||(i=e.isCntr&&q||g%2===0&&L);let N=r?`${r}.${d}`:`${o}.${d}`;if(N=ss(N,a),i&&Qu.push(N),_&&t.push(Ca(N,_,null,A,i,I)),Qt(h)&&!pr.isArray(h)){t.push(Ca(o,N,null,C,i,I));const W=f||Object.keys(x).length===0;if(W){const V=R?"object":"array",{config:$}=Qi(V,w);$.data.headerTitle=R?S:null,a.push(ai($,N,{label:S||d,parent:D},h,p))}if(Object.keys(x).length&&!l){const V=pr.isArray(h)?` ${h.length||""}`:`{${Object.keys(h).length||""}}`;let $=N;W&&($=`${N}.${V}`,$=ss($,a),t.push(Ca(N,$,null,C,i,I))),li(h,$,a,t,S||d,e,w)}else Object.keys(b).length&&!pr.isArray(h)?ns({chldPth:N,flowConfig:e,itrblObjct:b,path:N,edges:t,nodes:a,newConfig:w,isInverted:i}):li(h,N,a,t,d,e,w)}else pr.isArray(h)&&(t.push(Ca(o,N,null,C,i,I)),li(h,N,a,t,d,e,w))})},dR=({flowConfig:r,chldPth:e,edges:t,isInverted:n,item:a,nodes:i,path:o})=>a.forEach((s,u)=>{let l=`${e}.${u}`;l=ss(l,i);const f=s;s=Vm(s,ts);const d=Ia(s),h=Pa(s),{newConfig:g}=_n(s),{collapsed:p,label:x,parent:b,sourceLabel:w,isEdgeAnimated:y,content:E}=g;Qt(s)?!pr.isArray(s)&&Object.keys(h).length?(t.push(Ca(o,l,null,w,n,y)),li(s,l,i,t,u,r,g)):Object.keys(d).length&&!pr.isArray(s)&&!p?ns({chldPth:l,flowConfig:r,itrblObjct:d,path:o,edges:t,nodes:i,isInverted:n,newConfig:g}):pr.isArray(s)&&dR({flowConfig:r,chldPth:l,edges:t,isInverted:n,item:s,nodes:i,path:o}):(t.push(Ca(o,l,null,w,n,y)),i.push(ai($m,l,{label:x||String(s),parent:b},s,f)))}),yl="root",aw=r=>r==="#"||r.startsWith("{")||/^\s\d*$/.test(r);function fi(r){const e=r.split(".");for(e[0]===yl&&e.shift();e.length&&aw(e[e.length-1]);)e.pop();return e.filter(t=>!aw(t))}function Hq(r){if(r==null||typeof r!="object")return r;const{arrayObject:e}=_n(r);return Array.isArray(e)&&e.length?e:r}function mm(r,e){return fi(e).reduce((t,n)=>{var a;if(t!=null)return(a=Hq(t))==null?void 0:a[n]},r)}function Kq(r){return Array.isArray(r)?[...r]:{...r}}function pi(r,e,t){const n=fi(e),a=(i,o)=>{if(o===n.length)return t(i);const s=n[o],{arrayObject:u}=_n(i),l=Array.isArray(u)&&u.length>0,f=l?u:i;if(f==null||typeof f!="object")return i;const d=Kq(f);return d[s]=a(f[s],o+1),l?{...i,$:d}:d};return a(r,0)}function Gm(r,e,t){const n=t===""||t===void 0||t===null;if(Array.isArray(r))return n?r:{[e]:t,$:[...r]};const a=r!=null&&typeof r=="object"?{...r}:{};return r!=null&&typeof r!="object"&&(a.$label=String(r)),n?delete a[e]:a[e]=t,a}function no(r,e,t,n){return pi(r,e,a=>Gm(a,t,n))}const vR=(r,e,t)=>no(r,e,"$collapsed",t||void 0);function ml(r){const e=r.isInverted?r.target:r.source,t=r.isInverted?r.source:r.target,n=fi(e).join("."),a=fi(t).join(".");return a.startsWith(n?n+".":"")&&a!==n?{address:t,kind:"hierarchy"}:n.startsWith(a?a+".":"")&&n!==a?{address:e,kind:"hierarchy"}:{address:e,kind:"target"}}function us(r,e,t,n){const{address:a,kind:i}=ml(e),o=i==="target"&&t==="$sourceLabel"?"$targetLabel":t;return pi(r,a,s=>Gm(s,o,n))}const hR=(r,e,t)=>us(us(r,e,"$isEdgeAnimated",t==="animated"||void 0),e,"$isEdgeDashed",t==="dashed"||void 0);function gR(r,e,t,n){let a=n||"";const i=pi(r,e,s=>{const u=s!=null&&typeof s=="object"&&!Array.isArray(s)?{...s}:s!=null&&typeof s!="object"?{$label:String(s)}:{};if(Array.isArray(s))return a=String(s.length),[...s,t];if(!a){let l=1;for(;`node_${l}`in u;)l++;a=`node_${l}`}return u[a]=t,u}),o=fi(e);return{json:i,address:[yl,...o,a].join(".")}}function pR(r,e){const t=fi(e);if(!t.length)return r;const n=t[t.length-1],a=[yl,...t.slice(0,-1)].join(".");return pi(r,a,i=>{const{arrayObject:o}=_n(i);if(Array.isArray(o)&&o.length)return{...i,$:o.filter((l,f)=>String(f)!==n)};if(Array.isArray(i))return i.filter((l,f)=>String(f)!==n);const{[n]:s,...u}=i;return u})}const yR=(r,e,t,n)=>no(n?pi(r,e,a=>Gm(a,"$targetLabel",n)):r,e,"$target",t);function mR(r,e){const{address:t,kind:n}=ml(e);return n!=="target"?{json:r,removed:!1}:{json:pi(r,t,i=>{const{$target:o,$targetLabel:s,...u}=i||{};return u}),removed:!0}}function bR(r,e={}){const{nodes:t,edges:n}=li(r,yl,[],[],e.title||"untitled",{hideDefaultObject:!!e.hideDefaultObject,sprtObjctKy:!!e.separateObjectKeys,isCntr:!!e.isCenter}),a=t.map(s=>{const u=mm(r,s.data.id);if(!u||typeof u!="object"||Array.isArray(u))return s;const l={...s.data};return typeof u.$label=="string"&&(l.label=u.$label,l.headerTitle=u.$label),(u.$collapsed!==void 0||u.$icon!==void 0)&&(l.config={...l.config||{}},u.$collapsed!==void 0&&(l.config.collapsed=!!u.$collapsed),u.$icon!==void 0&&(l.config.icon=u.$icon)),{data:l}}),i=new Map,o=n.map(s=>{const u=`${s.data.source}->${s.data.target}`,l=i.get(u)??0;i.set(u,l+1);const f=mm(r,ml(s.data).address),d={...s.data,id:l?`${u}#${l}`:u};return f&&typeof f=="object"&&(f.$isEdgeAnimated!==void 0&&(d.isEdgeAnimated=!!f.$isEdgeAnimated),f.$isEdgeDashed!==void 0&&(d.isEdgeDashed=!!f.$isEdgeDashed),f.$edgeColor&&(d.color=f.$edgeColor)),{data:d}});return{nodes:a,edges:o}}function jq(r,e){const t=new Set(r.filter(i=>{var o,s;return(s=(o=i.data)==null?void 0:o.config)==null?void 0:s.collapsed}).map(i=>i.data.id));if(!t.size)return{nodes:r,edges:e};const n=new Map;for(const i of e){const o=i.data.isInverted?i.data.target:i.data.source,s=i.data.isInverted?i.data.source:i.data.target;(n.get(o)??n.set(o,[]).get(o)).push(s)}const a=new Set;for(const i of t){const o=[...n.get(i)||[]];for(;o.length;){const s=o.pop();t.has(s)||a.has(s)||(a.add(s),o.push(...n.get(s)||[]))}}return{nodes:r.filter(i=>!a.has(i.data.id)),edges:e.filter(i=>!a.has(i.data.source)&&!a.has(i.data.target))}}function Yq(r,e){const t=a=>r&&typeof r=="object"&&a in r;let n=1;for(;t(`${e}_${n}`);)n++;return`${e}_${n}`}function wR(r,e,t,n){const a=(o,s)=>{o!==r&&(n==null||n(o,s))},i=o=>{var u;const s=(u=e.find(l=>l.data.id===o))==null?void 0:u.data;return s&&{source:s.source,target:s.target,isInverted:s.isInverted}};return{...t,onNodeLabelChange:(o,s)=>{var u;(u=t.onNodeLabelChange)==null||u.call(t,o,s),a(no(r,o,"$label",s),{type:"nodeLabel",address:o,key:"$label",value:s})},onNodeColorChange:(o,s,u)=>{var f;(f=t.onNodeColorChange)==null||f.call(t,o,s,u);const l=s==="bg"?"$bgColor":"$textColor";a(no(r,o,l,u),{type:"nodeColor",address:o,key:l,value:u})},onNodeIconChange:(o,s)=>{var u;(u=t.onNodeIconChange)==null||u.call(t,o,s),a(no(r,o,"$icon",s),{type:"nodeIcon",address:o,key:"$icon",value:s})},onNodeCollapse:(o,s)=>{var u;(u=t.onNodeCollapse)==null||u.call(t,o,s),a(vR(r,o,s),{type:"nodeCollapse",address:o,key:"$collapsed",value:s})},onNodeCreate:o=>{var d;(d=t.onNodeCreate)==null||d.call(t,o);const s=o.sourceNodeId||"root",l=Yq(s==="root"?r:void 0,o.isArrayMode?"list":"node"),f=gR(r,s,o.isArrayMode?[]:{},l);a(f.json,{type:"nodeCreate",address:f.address,value:o.isArrayMode?"array":"set"})},onNodeDelete:(o,s)=>{var u;(u=t.onNodeDelete)==null||u.call(t,o,s),a(pR(r,o),{type:"nodeDelete",address:o})},onEdgeCreate:(o,s)=>{var u;(u=t.onEdgeCreate)==null||u.call(t,o,s),a(yR(r,o,s),{type:"edgeCreate",address:o,key:"$target",value:s})},onEdgeLabelChange:(o,s)=>{var l;(l=t.onEdgeLabelChange)==null||l.call(t,o,s);const u=i(o);u&&a(us(r,u,"$sourceLabel",s),{type:"edgeLabel",edge:u,key:"$sourceLabel",value:s})},onEdgeStyleChange:(o,s)=>{var l;(l=t.onEdgeStyleChange)==null||l.call(t,o,s);const u=i(o);u&&a(hR(r,u,s),{type:"edgeStyle",edge:u,value:s})},onEdgeColorChange:(o,s)=>{var l;(l=t.onEdgeColorChange)==null||l.call(t,o,s);const u=i(o);u&&a(us(r,u,"$edgeColor",s),{type:"edgeColor",edge:u,key:"$edgeColor",value:s})},onEdgeDelete:(o,s)=>{var f;(f=t.onEdgeDelete)==null||f.call(t,o,s);const u=i(o);if(!u)return;const l=mR(r,u);l.removed&&a(l.json,{type:"edgeDelete",edge:u,key:"$target"})}}}const xR=xe.createContext(null),ER=xe.createContext({nodeById:new Map,edgeById:new Map});function Wm(){return xe.useContext(ER)}function en(){const r=xe.useContext(xR);if(!r)throw new Error("useFlowDiagramContext must be used within FlowDiagram");return r}function Xq({config:r,callbacks:e,nodes:t=[],edges:n=[],children:a}){const i=xe.useMemo(()=>{var te,ue;const z=new Map;for(const oe of t)(te=oe.data)!=null&&te.id&&z.set(oe.data.id,oe);const Y=new Map;for(const oe of n)(ue=oe.data)!=null&&ue.id&&Y.set(oe.data.id,oe);return{nodeById:z,edgeById:Y}},[t,n]),o=xe.useRef(null),[s,u]=xe.useState([]),[l,f]=xe.useState(null),[d,h]=xe.useState(!0),[g,p]=xe.useState(!1),[x,b]=xe.useState(!0),[w,y]=xe.useState(r.edgeHandles===!0),[E,C]=xe.useState(!1),[S,R]=xe.useState(!0),[_,A]=xe.useState(!1),P=xe.useRef(e);P.current=e;const I=xe.useMemo(()=>{const z=Y=>(...te)=>{var ue,oe;return(oe=(ue=P.current)==null?void 0:ue[Y])==null?void 0:oe.call(ue,...te)};return{onNodeSelect:z("onNodeSelect"),onNodeDeselect:z("onNodeDeselect"),onNodeDoubleClick:z("onNodeDoubleClick"),onNodeCreate:z("onNodeCreate"),onNodeDelete:z("onNodeDelete"),onNodeLabelChange:z("onNodeLabelChange"),onNodeCollapse:z("onNodeCollapse"),onNodeColorChange:z("onNodeColorChange"),onNodeIconChange:z("onNodeIconChange"),onNodeHoverAction:z("onNodeHoverAction"),onEdgeCreate:z("onEdgeCreate"),onEdgeSelect:z("onEdgeSelect"),onEdgeDeselect:z("onEdgeDeselect"),onEdgeRemove:z("onEdgeRemove"),onEdgeDelete:z("onEdgeDelete"),onEdgeColorChange:z("onEdgeColorChange"),onEdgeLabelChange:z("onEdgeLabelChange"),onEdgeStyleChange:z("onEdgeStyleChange"),onViewportChange:z("onViewportChange"),onDirectionChange:z("onDirectionChange"),onArrayModeChange:z("onArrayModeChange"),onCyInit:z("onCyInit"),onJsonChange:z("onJsonChange")}},[]),D=r.themeColor||"blue.500",L=r.edgeColor||"",M=r.colorMode||"light",q=r.direction||"LR",N=r.readOnly??!1,W=JSON.stringify(r.parentNodeStyle??null),V=xe.useMemo(()=>r.parentNodeStyle,[W]),$=r.isZoomMode!==void 0?r.isZoomMode:d,X=r.isMultiSelectMode!==void 0?r.isMultiSelectMode:g,ee=r.isEdgeHandlesEnabled!==void 0?r.isEdgeHandlesEnabled:w,K=r.isDragMode!==void 0?r.isDragMode:x,j=xe.useRef(r);j.current=r;const fe=xe.useMemo(()=>({get direction(){return j.current.direction},get themeColor(){return j.current.themeColor},get colorMode(){return j.current.colorMode},get readOnly(){return j.current.readOnly},get editable(){return j.current.editable},get minZoom(){return j.current.minZoom},get maxZoom(){return j.current.maxZoom},get backgroundPattern(){return j.current.backgroundPattern},get edgeColor(){return j.current.edgeColor},get parentNodeStyle(){return j.current.parentNodeStyle},get backgroundColor(){return j.current.backgroundColor},get edgeHandles(){return j.current.edgeHandles},get initialViewport(){return j.current.initialViewport},get nodeOverlayActions(){return j.current.nodeOverlayActions},get renderNodeOverlay(){return j.current.renderNodeOverlay},get renderSelectedNodeToolbar(){return j.current.renderSelectedNodeToolbar},get renderSelectedEdgeToolbar(){return j.current.renderSelectedEdgeToolbar},get renderBottomBar(){return j.current.renderBottomBar},get selectionToolbar(){return j.current.selectionToolbar},get customViews(){return j.current.customViews},get disableKeyboardShortcuts(){return j.current.disableKeyboardShortcuts},get isZoomMode(){return j.current.isZoomMode},get isMultiSelectMode(){return j.current.isMultiSelectMode},get isEdgeHandlesEnabled(){return j.current.isEdgeHandlesEnabled},get isDragMode(){return j.current.isDragMode}}),[]),G=xe.useMemo(()=>({themeColor:D,edgeColor:L,colorMode:M,direction:q,parentNodeStyle:V,selectedNodeIds:s,setSelectedNodeIds:u,selectedEdgeId:l,setSelectedEdgeId:f,isZoomMode:$,setIsZoomMode:h,isMultiSelectMode:X,setIsMultiSelectMode:p,isDragMode:K,setIsDragMode:b,isEdgeHandlesEnabled:ee,setIsEdgeHandlesEnabled:y,isArrayNodeMode:E,setIsArrayNodeMode:C,isPinned:S,setIsPinned:R,isPerformanceMode:_,setIsPerformanceMode:A,cyRef:o,callbacks:I,config:fe,readOnly:N}),[D,L,M,q,V,s,l,$,X,K,ee,E,S,_,N,I,fe]);return H.jsx(xR.Provider,{value:G,children:H.jsx(ER.Provider,{value:i,children:a})})}function Ju(r,e=.2){const t=r.replace(/^#/,""),n=parseInt(t,16);let a=n>>16&255,i=n>>8&255,o=n&255;return a=Math.max(0,Math.floor(a*(1-e))),i=Math.max(0,Math.floor(i*(1-e))),o=Math.max(0,Math.floor(o*(1-e))),"#"+((1<<24)+(a<<16)+(i<<8)+o).toString(16).slice(1).toUpperCase()}function Zq(r,e,t){const n=s=>{const u=/^#?([0-9a-f]{6})$/i.exec((s==null?void 0:s.trim())??"");return u?parseInt(u[1],16):null},a=n(r),i=n(e);if(a===null||i===null)return null;const o=s=>Math.round((a>>s&255)*(1-t)+(i>>s&255)*t);return"#"+((1<<24)+(o(16)<<16)+(o(8)<<8)+o(0)).toString(16).slice(1).toUpperCase()}const kn=r=>r!=null&&r.startsWith("#")?{background:r,highlight:Ju(r,.1),border:Ju(r,.5),property:"gray.900",boolean:"green.200",string:"gray.900",number:"orange.800"}:r==="gray"?{background:"gray.950",highlight:"gray.800",border:"gray.700",property:"gray.200",boolean:"green.400",string:"gray.200",number:"orange.600"}:r==="white"?{background:"white",highlight:"gray.200",border:"gray.400",property:"gray.900",boolean:"green.400",string:"gray.900",number:"orange.600"}:{background:r+".100",highlight:r+".200",border:r+".700",property:"gray.900",boolean:"green.800",string:"gray.900",number:"orange.800"},CR=r=>{let e=r;if(e!=null&&e.startsWith("#"))return{secondary:Ju(r)};let t=String(Number(r.slice(-3))+200);t=r.slice(0,-3).concat(t);let n=String(Number(r.slice(-3))-100);return n=r.slice(0,-3).concat(n),{primary:e,secondary:t,light:n}},iw={red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#EBF8FF",100:"#BEE3F8",200:"#90CDF4",300:"#63B3ED",400:"#4299E1",500:"#3182CE",600:"#2B6CB0",700:"#2C5282",800:"#2A4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923",950:"#0d1117"}},zr=(r,e)=>{var i;if(r!=null&&r.startsWith("#"))return r;if(!r)return"whitesmoke";const t=r.replace(/\./g,"-");try{const s=getComputedStyle(document.documentElement).getPropertyValue(`--chakra-colors-${t}`).trim();if(s&&s!=="")return s}catch{}const[n,a]=r.split(".");return n&&a&&((i=iw[n])!=null&&i[Number(a)])?iw[n][Number(a)]:`var(--chakra-colors-${t})`};function gt(r,e,t){return r?t:e}function bs(r){const[e]=(r==null?void 0:r.split("."))||[],{secondary:t}=CR(r),n=kn(e).background,a=kn(e).highlight,i=kn(e).border,o=kn(e).property,s=kn(e).property;let u=kn(e).background,l=kn(e).highlight;return u=zr(u)+50,l=zr(l)+20,{bgColor:n,highlightColor:a,borderColor:i,textColor:o,propertyColor:s,secondary:t,bgColorFaint:u,highlightColorFaint:l}}function Rn(r=null){const{colorMode:e}=en(),t=r==null?void 0:r.includes("gray"),n=e==="dark",a=gt(n,"white","gray.900"),i=gt(n,"gray.100","gray.800"),o=gt(n,"gray.200","blackAlpha.400"),s=gt(n,"gray.200","blackAlpha.600"),u=gt(n,"gray.500","gray.700"),l=gt(n,"gray.700","gray.700"),f=gt(n,"gray.900","gray.900"),d=gt(n,"gray.400","gray.500"),h=gt(n,"gray.400","gray.700"),g=gt(n,"gray.900","gray.200"),p=gt(n,t?"gray.900":"gray.200",t?"gray.200":"gray.900"),x=gt(n,"gray.900","gray.200"),b=gt(n,r&&"#000000",r||"#ffffff"),w=gt(n,r||"#ffffff",r?"#000000":"#ffffff"),y=l,E=gt(n,"gray.300","gray.800"),C=gt(n,"white","blackAlpha.400"),S=gt(n,"green.100","green.700");return{canvas:a,background:i,backgroundSecondary:o,darkBackgroundSecondary:s,border:u,darkColor:f,backgroundWhiteColor:C,borderSecondary:l,colorActive:d,colorInactive:h,iconColor:x,moreIconColor:y,colorText:g,themedColorText:p,logoColor:b,logoColorSecondary:w,darkColorActive:E,greenColor:S}}var jo=(r=>(r.TOP_DOWN="TB",r.BOTTOM_UP="BT",r.LEFT_RIGHT="LR",r.RIGHT_LEFT="RL",r.CENTER="C",r))(jo||{});function rt({label:r,children:e}){if(!Re.Tooltip.Root){const t=Re.Tooltip;return H.jsx(t,{label:r,placement:"top",fontSize:"xs",children:e})}return H.jsxs(Re.Tooltip.Root,{positioning:{placement:"top"},children:[H.jsx(Re.Tooltip.Trigger,{asChild:!0,children:e}),H.jsx(Re.Tooltip.Positioner,{children:H.jsx(Re.Tooltip.Content,{fontSize:"xs",children:r})})]})}function yt({icon:r,...e}){return H.jsx(Re.IconButton,{...e,children:r})}const Qq=["blue.500","teal.500","green.500","yellow.500","orange.500","red.500","purple.500","pink.500","gray.500"],Jq=["gray.900","gray.600","gray.200","white"];function _R(){const{config:r}=en(),e=r.selectionToolbar||{},t=new Set(e.hide||[]);return{palette:e.palette||Qq,show:n=>!t.has(n)}}function qn(){const{border:r}=Rn();return H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:r})}function SR({onClick:r}){const{colorText:e}=Rn();return H.jsx(rt,{label:"Close",children:H.jsx(yt,{"aria-label":"Close selection tools",icon:H.jsx(Re.Icon,{as:rr.PiX,boxSize:5}),size:"sm",variant:"ghost",color:e,onClick:r})})}function bm({value:r,placeholder:e,ariaLabel:t,width:n="140px",onCommit:a}){const{colorText:i,border:o}=Rn(),[s,u]=xe.useState(r);xe.useEffect(()=>u(r),[r]);const l=()=>{const f=s.trim();f!==r&&a(f)};return H.jsx(Re.Input,{"aria-label":t,size:"xs",w:n,value:s,placeholder:e,color:i,borderColor:o,borderRadius:"8px",onChange:f=>u(f.target.value),onBlur:l,onKeyDown:f=>{f.key==="Enter"&&(l(),f.target.blur()),f.key==="Escape"&&(u(r),f.target.blur())}})}function wm({colors:r,value:e,label:t,onPick:n,onReset:a}){const{colorInactive:i}=Rn();return H.jsxs(Re.HStack,{gap:1,"aria-label":t,role:"group",children:[r.map(o=>{const s=e===o;return H.jsx(rt,{label:`${t}: ${o}`,children:H.jsx(Re.Box,{as:"button","aria-label":`${t} ${o}`,"aria-pressed":s,w:4,h:4,borderRadius:"full",cursor:"pointer",style:{backgroundColor:zr(o)},outline:s?"2px solid white":"none",outlineOffset:"1px",_hover:{transform:"scale(1.15)"},onClick:()=>n(o)})},o)}),a&&H.jsx(rt,{label:`Reset ${t.toLowerCase()}`,children:H.jsx(yt,{"aria-label":`Reset ${t}`,icon:H.jsx(Re.Icon,{as:rr.PiEraser,boxSize:4}),size:"xs",variant:"ghost",color:i,onClick:a})})]})}function eN({edgeId:r,onClose:e}){var d;const{callbacks:t,themeColor:n}=en(),{colorInactive:a}=Rn(),{edgeById:i}=Wm(),{palette:o,show:s}=_R(),u=(d=i.get(r))==null?void 0:d.data,l=u!=null&&u.isEdgeAnimated?"animated":u!=null&&u.isEdgeDashed?"dashed":"solid",f=[{key:"solid",icon:rr.PiLineSegment,label:"Solid"},{key:"dashed",icon:rr.PiLineSegments,label:"Dashed"},{key:"animated",icon:rr.PiFastForward,label:"Animated"}];return H.jsxs(H.Fragment,{children:[H.jsx(SR,{onClick:e}),s("label")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(bm,{ariaLabel:"Edge label",placeholder:"Edge label",value:(u==null?void 0:u.label)||"",onCommit:h=>{var g;return(g=t.onEdgeLabelChange)==null?void 0:g.call(t,r,h)}})]}),s("style")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),f.map(h=>H.jsx(rt,{label:h.label,children:H.jsx(yt,{"aria-label":`Edge style ${h.key}`,"aria-pressed":l===h.key,icon:H.jsx(Re.Icon,{as:h.icon,boxSize:5}),size:"sm",variant:"ghost",color:l===h.key?n:a,onClick:()=>{var g;return(g=t.onEdgeStyleChange)==null?void 0:g.call(t,r,h.key)}})},h.key))]}),s("color")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(wm,{label:"Edge color",colors:o,value:u==null?void 0:u.color,onPick:h=>{var g;return(g=t.onEdgeColorChange)==null?void 0:g.call(t,r,h)},onReset:()=>{var h;return(h=t.onEdgeColorChange)==null?void 0:h.call(t,r,"")}})]}),s("delete")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(rt,{label:"Delete edge",children:H.jsx(yt,{"aria-label":"Delete edge",icon:H.jsx(Re.Icon,{as:rr.PiTrash,boxSize:5}),size:"sm",variant:"ghost",color:"red.400",onClick:()=>{var h;(h=t.onEdgeDelete)==null||h.call(t,r,u),e()}})})]})]})}function rN({ids:r,onClose:e}){var g,p,x,b,w;const{callbacks:t,colorMode:n}=en(),{colorText:a,colorInactive:i}=Rn(),{nodeById:o}=Wm(),{palette:s,show:u}=_R(),l=r.length===1,f=l?(g=o.get(r[0]))==null?void 0:g.data:void 0,d=(p=f==null?void 0:f.config)==null?void 0:p.collapsed,h=y=>r.forEach(y);return H.jsxs(H.Fragment,{children:[H.jsx(SR,{onClick:e}),H.jsx(qn,{}),l&&u("label")?H.jsx(bm,{ariaLabel:"Node label",placeholder:"Node label",value:(f==null?void 0:f.label)??(f==null?void 0:f.headerTitle)??"",onCommit:y=>{var E;return(E=t.onNodeLabelChange)==null?void 0:E.call(t,r[0],y)}}):H.jsxs(Re.Text,{fontSize:"xs",color:a,whiteSpace:"nowrap",px:1,children:[r.length," selected"]}),u("color")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(wm,{label:"Background",colors:s,value:(x=f==null?void 0:f.viewProps)==null?void 0:x.bgColor,onPick:y=>h(E=>{var C;return(C=t.onNodeColorChange)==null?void 0:C.call(t,E,"bg",y)}),onReset:()=>h(y=>{var E;return(E=t.onNodeColorChange)==null?void 0:E.call(t,y,"bg","")})})]}),u("textColor")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(wm,{label:"Text color",colors:Jq,value:(b=f==null?void 0:f.viewProps)==null?void 0:b.textColor,onPick:y=>h(E=>{var C;return(C=t.onNodeColorChange)==null?void 0:C.call(t,E,"text",y)}),onReset:()=>h(y=>{var E;return(E=t.onNodeColorChange)==null?void 0:E.call(t,y,"text","")})})]}),l&&u("icon")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(bm,{ariaLabel:"Node icon",placeholder:"Icon (e.g. PiGear)",width:"120px",value:((w=f==null?void 0:f.config)==null?void 0:w.icon)||"",onCommit:y=>{var E;return(E=t.onNodeIconChange)==null?void 0:E.call(t,r[0],y)}})]}),l&&u("collapse")&&d!==void 0&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(rt,{label:d?"Expand":"Collapse",children:H.jsx(yt,{"aria-label":d?"Expand node":"Collapse node",icon:H.jsx(Re.Icon,{as:d?rr.PiArrowsOutLineVertical:rr.PiArrowsInLineVertical,boxSize:5}),size:"sm",variant:"ghost",color:i,onClick:()=>{var y;return(y=t.onNodeCollapse)==null?void 0:y.call(t,r[0],!d)}})})]}),u("delete")&&H.jsxs(H.Fragment,{children:[H.jsx(qn,{}),H.jsx(rt,{label:l?"Delete node":`Delete ${r.length} nodes`,children:H.jsx(yt,{"aria-label":"Delete selected nodes",icon:H.jsx(Re.Icon,{as:rr.PiTrash,boxSize:5}),size:"sm",variant:"ghost",color:n==="dark"?"red.300":"red.500",onClick:()=>{h(y=>{var E,C;return(C=t.onNodeDelete)==null?void 0:C.call(t,y,((E=o.get(y))==null?void 0:E.data)||{id:y})}),e()}})})]})]})}const tN=[{value:"BT",label:"Bottom to Up",icon:rr.PiArrowUp,flowType:jo.BOTTOM_UP},{value:"TB",label:"Top to Bottom",icon:rr.PiArrowDown,flowType:jo.TOP_DOWN},{value:"LR",label:"Left to Right",icon:rr.PiArrowRight,flowType:jo.LEFT_RIGHT},{value:"RL",label:"Right to Left",icon:rr.PiArrowLeft,flowType:jo.RIGHT_LEFT}],TR=()=>{const{cyRef:r,themeColor:e,direction:t,selectedNodeIds:n,setSelectedNodeIds:a,selectedEdgeId:i,setSelectedEdgeId:o,isZoomMode:s,setIsZoomMode:u,isMultiSelectMode:l,setIsMultiSelectMode:f,isDragMode:d,setIsDragMode:h,isEdgeHandlesEnabled:g,setIsEdgeHandlesEnabled:p,isArrayNodeMode:x,setIsArrayNodeMode:b,isPinned:w,setIsPinned:y,callbacks:E,config:C,readOnly:S}=en(),{nodeById:R}=Wm(),_=C.colorMode==="dark",{background:A,border:P,colorInactive:I,colorText:D,colorActive:L,darkBackgroundSecondary:M}=Rn(),[q,N]=xe.useState(!0),[W,V]=xe.useState(!1),[$,X]=xe.useState(!0),[ee,K]=xe.useState(!1),[j,fe]=xe.useState(!0);xe.useEffect(()=>{const Se=()=>X(window.innerWidth>=768);return Se(),window.addEventListener("resize",Se),()=>window.removeEventListener("resize",Se)},[]),xe.useEffect(()=>{if(!$){N(!0);return}if(!w){N(!1);return}const Se=re=>{N(window.innerHeight-re.clientY<=250)},Ee=()=>N(!1);return window.addEventListener("mousemove",Se),window.addEventListener("mouseleave",Ee),()=>{window.removeEventListener("mousemove",Se),window.removeEventListener("mouseleave",Ee)}},[$,w]);const G=xe.useCallback(Se=>{const Ee=r.current;if(!Ee)return;const re=C.minZoom??.01,ce=C.maxZoom??1.5,_e=.02,me=Ee.zoomingEnabled(),Te=Ee.userZoomingEnabled();Ee.zoomingEnabled(!0),Ee.userZoomingEnabled(!0);let De=Ee.zoom();switch(Se){case"increase":De=Math.min(ce,De+_e),Ee.zoom(De),Ee.center();break;case"decrease":De=Math.max(re,De-_e),Ee.zoom(De),Ee.center();break;case"reset":Ee.fit(void 0,50);break}Ee.zoomingEnabled(me),Ee.userZoomingEnabled(Te)},[r,C.minZoom,C.maxZoom]),z=C.renderSelectedNodeToolbar,Y=n.length>0&&!!z,te=xe.useMemo(()=>{if(!Y)return[];const Se=r.current;return n.map(Ee=>{var _e;const re=Se==null?void 0:Se.getElementById(Ee);return{...((_e=R.get(Ee))==null?void 0:_e.data)??(re!=null&&re.length?re.data():{id:Ee}),isParent:!!(re!=null&&re.length)&&re.isParent()}})},[Y,n,r,R]),ue=xe.useCallback(()=>{var Se;a([]),(Se=E.onNodeDeselect)==null||Se.call(E)},[a,E]),oe=C.renderSelectedEdgeToolbar,Z=!!i&&!!oe,Q=xe.useMemo(()=>{if(!Z||!i)return null;const Se=r.current;if(!Se)return{id:i};const Ee=Se.getElementById(i);return Ee!=null&&Ee.length?Ee.data():{id:i}},[Z,i,r]),ie=xe.useCallback(()=>{var Ee;o(null);const Se=r.current;Se&&Se.edges().unselect(),(Ee=E.onEdgeDeselect)==null||Ee.call(E)},[o,r,E]),de=C.selectionToolbar!==!1&&!S,we=de&&!!i&&!oe,Ae=de&&!we&&n.length>0&&!z,ve=we||Ae,le=q||W||ee||ve,Me=C.renderBottomBar;return Me?H.jsxs(H.Fragment,{children:[Y&&H.jsx(Re.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:z({selectedNodeIds:n,selectedNodeData:te,onDeselect:ue})}),Z&&Q&&H.jsx(Re.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:oe({edgeId:i,edgeData:Q,onDeselect:ie})}),H.jsx(Re.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",children:Me({zoomIn:()=>G("increase"),zoomOut:()=>G("decrease"),resetZoom:()=>G("reset"),direction:t,isZoomMode:s,setIsZoomMode:u,isMultiSelectMode:l,setIsMultiSelectMode:f,isDragMode:d,setIsDragMode:h,isEdgeHandlesEnabled:g,setIsEdgeHandlesEnabled:p,isArrayNodeMode:x,setIsArrayNodeMode:b,selectedNodeIds:n,selectedNodeData:te,selectedEdgeId:i,selectedEdgeData:Q,onNodeDeselect:ue,onEdgeDeselect:ie,callbacks:E})})]}):H.jsxs(H.Fragment,{children:[Y&&H.jsx(Re.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:z({selectedNodeIds:n,selectedNodeData:te,onDeselect:ue})}),Z&&Q&&H.jsx(Re.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:oe({edgeId:i,edgeData:Q,onDeselect:ie})}),!w&&H.jsx(Re.Box,{position:"absolute",bottom:5,left:0,zIndex:101,w:3,children:H.jsx(rt,{label:"Show Bottom Bar",children:H.jsx(Re.Flex,{align:"center",bg:A,borderColor:P,borderWidth:1,py:6,px:0,w:4,h:50,borderRadius:"15px",borderLeftRadius:0,onMouseEnter:()=>{V(!0),N(!0)},onMouseLeave:()=>V(!1),_hover:{bg:M},children:H.jsx(Re.Icon,{ml:-1,as:rr.PiLineVerticalBold,boxSize:5,color:P})})})}),H.jsx(Re.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",transition:"opacity 0.3s ease-in, transform 0.3s ease",transform:le?"translateY(0)":"translateY(100%)",pointerEvents:le?"auto":"none",opacity:le?1:0,onMouseEnter:()=>{w||N(!0)},onMouseLeave:()=>{w||(N(!1),V(!1))},children:H.jsxs(Re.Flex,{w:"100%",px:5,position:"absolute",bottom:5,flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[H.jsx(Re.Box,{bg:A,alignContent:"center",h:50,borderColor:P,borderWidth:1,borderRadius:"15px",children:H.jsx(Re.HStack,{px:2,gap:1,children:we?H.jsx(eN,{edgeId:i,onClose:ie}):Ae?H.jsx(rN,{ids:n,onClose:ue}):H.jsxs(H.Fragment,{children:[H.jsx(rt,{label:w?"Unpin":"Pin",children:H.jsx(yt,{"aria-label":"Pin",icon:H.jsx(Re.Icon,{as:w?rr.PiPushPinFill:rr.PiPushPin,boxSize:5}),size:"sm",variant:"ghost",color:w?e:I,onClick:()=>{const Se=!w;y(Se),N(Se)}})}),H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:P}),H.jsx(rt,{label:"Zoom Out",children:H.jsx(yt,{"aria-label":"Zoom out",icon:H.jsx(Re.Icon,{as:rr.PiMinus,boxSize:5}),size:"sm",variant:"ghost",color:D,onClick:()=>G("decrease")})}),H.jsx(rt,{label:"Zoom In",children:H.jsx(yt,{"aria-label":"Zoom in",icon:H.jsx(Re.Icon,{as:rr.PiPlus,boxSize:5}),size:"sm",variant:"ghost",color:D,onClick:()=>G("increase")})}),H.jsx(rt,{label:"Reset Zoom",children:H.jsx(yt,{"aria-label":"Reset zoom",icon:H.jsx(Re.Icon,{as:rr.PiArrowCounterClockwise,boxSize:5}),size:"sm",variant:"ghost",color:D,onClick:()=>G("reset")})}),!j&&H.jsxs(H.Fragment,{children:[H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:P}),H.jsx(rt,{label:s?"Zoom Mode (z)":"Pan Mode (z)",children:H.jsx(yt,{"aria-label":"Toggle zoom mode",icon:H.jsx(Re.Icon,{as:s?rr.PiMagnifyingGlassPlus:rr.PiArrowsOutCardinal,boxSize:5}),size:"sm",variant:"ghost",color:s?e:I,onClick:()=>u(!s)})}),H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:P}),H.jsx(rt,{label:l?"Multi-Select On (m)":"Multi-Select Off (m)",children:H.jsx(yt,{"aria-label":"Toggle multi-select",icon:H.jsx(Re.Icon,{as:rr.PiSelectionPlus,boxSize:5}),size:"sm",variant:"ghost",color:l?e:I,onClick:()=>f(!l)})}),H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:P}),H.jsx(rt,{label:d?"Drag Mode On (d)":"Drag Mode Off (d)",children:H.jsx(yt,{"aria-label":"Toggle drag mode",icon:H.jsx(Re.Icon,{as:rr.PiHandGrabbing,boxSize:5}),size:"sm",variant:"ghost",color:d?e:I,onClick:()=>h(!d)})}),C.edgeHandles!==!1&&H.jsxs(H.Fragment,{children:[H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:P}),H.jsx(rt,{label:g?"Draw Mode On":"Draw Mode Off",children:H.jsx(yt,{"aria-label":"Toggle draw mode",icon:H.jsx(Re.Icon,{as:rr.PiPencilSimpleLine,boxSize:5}),size:"sm",variant:"ghost",color:g?e:I,onClick:()=>p(!g)})})]}),H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:P}),H.jsx(rt,{label:x?"Array Mode [ ]":"Set Mode { }",children:H.jsx(yt,{"aria-label":"Toggle array mode",icon:H.jsx(Re.Icon,{as:x?rr.PiBracketsSquare:rr.PiBracketsCurly,boxSize:5}),size:"sm",variant:"ghost",color:x?e:I,onClick:()=>{var Ee;const Se=!x;b(Se),(Ee=E.onArrayModeChange)==null||Ee.call(E,Se)}})})]}),H.jsx(Re.Icon,{mx:-1,as:rr.PiLineVerticalThin,boxSize:5,color:P}),H.jsx(rt,{label:j?"Expand toolbar":"Collapse toolbar",children:H.jsx(yt,{"aria-label":"Toggle toolbar collapse",icon:H.jsx(Re.Icon,{as:j?rr.PiCaretRight:rr.PiCaretLeft,boxSize:5}),size:"sm",variant:"ghost",color:I,onClick:()=>fe(!j)})})]})})}),!ve&&H.jsxs(Re.Box,{position:"relative",ml:"auto",onMouseLeave:()=>K(!1),children:[H.jsx(Re.Box,{bg:A,borderWidth:1,borderColor:P,borderRadius:"15px",h:50,px:3,cursor:"pointer",onClick:()=>K(!ee),children:H.jsxs(Re.Flex,{align:"center",h:"100%",children:[H.jsx(rt,{label:"Flow Direction",children:H.jsx(yt,{"aria-label":"Direction",icon:H.jsx(Re.Icon,{as:rr.PiCaretUp,boxSize:5}),size:"sm",variant:"ghost",color:I})}),H.jsx(Re.Text,{fontSize:"xs",color:_?"whiteAlpha.600":"blackAlpha.500",ml:1,children:t})]})}),ee&&H.jsx(Re.Box,{position:"absolute",bottom:"100%",right:0,pb:"10px",zIndex:200,children:H.jsxs(Re.Box,{bg:A,borderWidth:1,borderColor:P,borderRadius:"15px",p:2,minW:"180px",shadow:"lg",children:[tN.map(Se=>H.jsxs(Re.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:_?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var Ee;(Ee=E.onDirectionChange)==null||Ee.call(E,Se.value),K(!1)},children:[H.jsx(Re.Icon,{as:Se.icon,boxSize:5,color:D}),H.jsx(Re.Text,{fontSize:"sm",color:D,flex:1,whiteSpace:"nowrap",children:Se.label}),t===Se.value&&H.jsx(Re.Icon,{as:rr.PiCheck,boxSize:4,color:L})]},Se.value)),H.jsxs(Re.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:_?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var Se;(Se=E.onDirectionChange)==null||Se.call(E,"C"),K(!1)},children:[H.jsx(Re.Icon,{as:rr.PiAlignCenterHorizontal,boxSize:5,color:D}),H.jsx(Re.Text,{fontSize:"sm",color:D,flex:1,whiteSpace:"nowrap",children:"Center"}),t==="C"&&H.jsx(Re.Icon,{as:rr.PiCheck,boxSize:4,color:L})]})]})})]})]})})]})};TR.displayName="BottomBar";const nN=xe.memo(TR),aN=r=>{const n=1/(Math.cbrt(r)*.8);let a=Math.round(650*n),i=Math.round(350*n);return a=Math.max(40,Math.min(450,a)),i=Math.max(30,Math.min(300,i)),{edgeSep:a,rankSep:i}},ao=new Map;let ii=null;const iN=.1,oN=1e3;function RR(){ii=null;const r=Date.now()*iN%oN,e=new Set;for(const{edge:t}of ao.values())t.removed()||e.add(t.cy());e.forEach(t=>t.startBatch());for(const{edge:t,inverted:n}of ao.values())t.removed()||t.style("line-dash-offset",n?r:-r);e.forEach(t=>t.endBatch()),ao.size&&(ii=requestAnimationFrame(RR))}function ow(r,e,t=!1){if(e){ao.set(r,{edge:e,inverted:t}),ii===null&&(ii=requestAnimationFrame(RR));return}ao.delete(r),!ao.size&&ii!==null&&(cancelAnimationFrame(ii),ii=null)}function wc(r,e,t){let n=2;return r.getElementById(e).length===1&&(n-=1),r.getElementById(t).length===1&&(n-=1),n}function sN({cytoInstance:r,id:e,source:t,type:n,target:a,label:i,children:o,layout:s,styleCallback:u,isPerformanceMode:l,animated:f=!1,inverted:d=!1,edgeData:h}){const g=xe.useRef(null),p=xe.useRef({}),[x,b]=xe.useState(2);function w(S){u&&S.style(u(S,t,a,h))}function y(){const S=r.getElementById(e);S.length===0?(w(r.add({data:{id:e,source:t,target:a,label:i,type:n}})),s()):(S.data({source:t,target:a,label:i,type:n}),w(S))}if(xe.useEffect(()=>{const S=wc(r,t,a);b(S),S===0&&y()},[t,a,e,i,n,r]),xe.useEffect(()=>{function S(_){const A=_.target.id();if(A!==t&&A!==a)return;const P=wc(r,t,a);b(P),P===0&&y()}function R(_){const A=_.target.id();if(A!==t&&A!==a)return;const P=wc(r,t,a);b(P),P>0&&r.getElementById(e).length&&(r.getElementById(e).remove(),s())}return r.on("add","node",S),r.on("remove","node",R),()=>{r.off("add","node",S),r.off("remove","node",R),ow(p.current,null),r.getElementById(e).length&&(r.getElementById(e).remove(),s())}},[]),xe.useEffect(()=>{const S=r.getElementById(e),R=f&&!l&&x===0&&S.length>0;ow(p.current,R?S:null,d)},[f,d,l,x,r,e]),xe.useEffect(()=>{if(x)return;const S=r.getElementById(e);S.length&&w(S)},[u,h,x]),x>0)return null;function E(S){return xe.cloneElement(S,{cytoInstance:r,layout:s})}const C=xe.Children.map(o,E);return H.jsx("div",{ref:g,className:"cytoscape-react-edge",children:C})}var xc,sw;function rn(){if(sw)return xc;sw=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return xc=r,xc}var Ec,uw;function AR(){if(uw)return Ec;uw=1;var r=typeof St=="object"&&St&&St.Object===Object&&St;return Ec=r,Ec}var Cc,lw;function An(){if(lw)return Cc;lw=1;var r=AR(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Cc=t,Cc}var _c,fw;function PR(){if(fw)return _c;fw=1;var r=An(),e=function(){return r.Date.now()};return _c=e,_c}var Sc,cw;function uN(){if(cw)return Sc;cw=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Sc=e,Sc}var Tc,dw;function lN(){if(dw)return Tc;dw=1;var r=uN(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Tc=t,Tc}var Rc,vw;function vo(){if(vw)return Rc;vw=1;var r=An(),e=r.Symbol;return Rc=e,Rc}var Ac,hw;function fN(){if(hw)return Ac;hw=1;var r=vo(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,a=r?r.toStringTag:void 0;function i(o){var s=t.call(o,a),u=o[a];try{o[a]=void 0;var l=!0}catch{}var f=n.call(o);return l&&(s?o[a]=u:delete o[a]),f}return Ac=i,Ac}var Pc,gw;function cN(){if(gw)return Pc;gw=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Pc=t,Pc}var Ic,pw;function yi(){if(pw)return Ic;pw=1;var r=vo(),e=fN(),t=cN(),n="[object Null]",a="[object Undefined]",i=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?a:n:i&&i in Object(s)?e(s):t(s)}return Ic=o,Ic}var Dc,yw;function zn(){if(yw)return Dc;yw=1;function r(e){return e!=null&&typeof e=="object"}return Dc=r,Dc}var Bc,mw;function ho(){if(mw)return Bc;mw=1;var r=yi(),e=zn(),t="[object Symbol]";function n(a){return typeof a=="symbol"||e(a)&&r(a)==t}return Bc=n,Bc}var Mc,bw;function IR(){if(bw)return Mc;bw=1;var r=lN(),e=rn(),t=ho(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=r(l);var d=i.test(l);return d||o.test(l)?s(l.slice(2),d?2:8):a.test(l)?n:+l}return Mc=u,Mc}var Lc,ww;function dN(){if(ww)return Lc;ww=1;var r=rn(),e=PR(),t=IR(),n="Expected a function",a=Math.max,i=Math.min;function o(s,u,l){var f,d,h,g,p,x,b=0,w=!1,y=!1,E=!0;if(typeof s!="function")throw new TypeError(n);u=t(u)||0,r(l)&&(w=!!l.leading,y="maxWait"in l,h=y?a(t(l.maxWait)||0,u):h,E="trailing"in l?!!l.trailing:E);function C(M){var q=f,N=d;return f=d=void 0,b=M,g=s.apply(N,q),g}function S(M){return b=M,p=setTimeout(A,u),w?C(M):g}function R(M){var q=M-x,N=M-b,W=u-q;return y?i(W,h-N):W}function _(M){var q=M-x,N=M-b;return x===void 0||q>=u||q<0||y&&N>=h}function A(){var M=e();if(_(M))return P(M);p=setTimeout(A,R(M))}function P(M){return p=void 0,E&&f?C(M):(f=d=void 0,g)}function I(){p!==void 0&&clearTimeout(p),b=0,f=x=d=p=void 0}function D(){return p===void 0?g:P(e())}function L(){var M=e(),q=_(M);if(f=arguments,d=this,x=M,q){if(p===void 0)return S(x);if(y)return clearTimeout(p),p=setTimeout(A,u),C(x)}return p===void 0&&(p=setTimeout(A,u)),g}return L.cancel=I,L.flush=D,L}return Lc=o,Lc}var vN=dN();const xw=gl(vN);function xm(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function hN(r){if(Array.isArray(r))return r}function gN(r){if(Array.isArray(r))return xm(r)}function qa(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function pN(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,BR(n.key),n)}}function Na(r,e,t){return e&&pN(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Gt(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Um(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
28
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){t=t.call(r)},n:function(){var u=t.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||t.return==null||t.return()}finally{if(s)throw i}}}}function DR(r,e,t){return(e=BR(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yN(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function mN(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,a,i,o,s=[],u=!0,l=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(f){l=!0,a=f}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(l)throw a}}return s}}function bN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
29
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wN(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
30
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xr(r,e){return hN(r)||mN(r,e)||Um(r,e)||bN()}function el(r){return gN(r)||yN(r)||Um(r)||wN()}function xN(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function BR(r){var e=xN(r,"string");return typeof e=="symbol"?e:e+""}function at(r){"@babel/helpers - typeof";return at=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(r)}function Um(r,e){if(r){if(typeof r=="string")return xm(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?xm(r,e):void 0}}var tt=typeof window>"u"?null:window,Ew=tt?tt.navigator:null;tt&&tt.document;var EN=at(""),MR=at({}),CN=at(function(){}),_N=typeof HTMLElement>"u"?"undefined":at(HTMLElement),ws=function(e){return e&&e.instanceString&&$r(e.instanceString)?e.instanceString():null},Ye=function(e){return e!=null&&at(e)==EN},$r=function(e){return e!=null&&at(e)===CN},Tr=function(e){return!Jt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},yr=function(e){return e!=null&&at(e)===MR&&!Tr(e)&&e.constructor===Object},SN=function(e){return e!=null&&at(e)===MR},qe=function(e){return e!=null&&at(e)===at(1)&&!isNaN(e)},TN=function(e){return qe(e)&&Math.floor(e)===e},rl=function(e){if(_N!=="undefined")return e!=null&&e instanceof HTMLElement},Jt=function(e){return xs(e)||LR(e)},xs=function(e){return ws(e)==="collection"&&e._private.single},LR=function(e){return ws(e)==="collection"&&!e._private.single},Hm=function(e){return ws(e)==="core"},OR=function(e){return ws(e)==="stylesheet"},RN=function(e){return ws(e)==="event"},Da=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},AN=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},PN=function(e){return yr(e)&&qe(e.x1)&&qe(e.x2)&&qe(e.y1)&&qe(e.y2)},IN=function(e){return SN(e)&&$r(e.then)},DN=function(){return Ew&&Ew.userAgent.match(/msie|trident|edge/i)},lo=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var n=function(){var i=this,o=arguments,s,u=t.apply(i,o),l=n.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return n.cache={},n},Km=lo(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),bl=lo(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),kR=lo(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),Cw=function(e){return Da(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},_a=function(e,t){return e.slice(-1*t.length)===t},nt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",BN="rgb[a]?\\(("+nt+"[%]?)\\s*,\\s*("+nt+"[%]?)\\s*,\\s*("+nt+"[%]?)(?:\\s*,\\s*("+nt+"))?\\)",MN="rgb[a]?\\((?:"+nt+"[%]?)\\s*,\\s*(?:"+nt+"[%]?)\\s*,\\s*(?:"+nt+"[%]?)(?:\\s*,\\s*(?:"+nt+"))?\\)",LN="hsl[a]?\\(("+nt+")\\s*,\\s*("+nt+"[%])\\s*,\\s*("+nt+"[%])(?:\\s*,\\s*("+nt+"))?\\)",ON="hsl[a]?\\((?:"+nt+")\\s*,\\s*(?:"+nt+"[%])\\s*,\\s*(?:"+nt+"[%])(?:\\s*,\\s*(?:"+nt+"))?\\)",kN="\\#[0-9a-fA-F]{3}",qN="\\#[0-9a-fA-F]{6}",qR=function(e,t){return e<t?-1:e>t?1:0},NN=function(e,t){return-1*qR(e,t)},Ze=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var n=e[t];if(n!=null)for(var a=Object.keys(n),i=0;i<a.length;i++){var o=a[i];r[o]=n[o]}}return r},FN=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,n,a,i,o=16;return t?(n=parseInt(e[1]+e[1],o),a=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(n=parseInt(e[1]+e[2],o),a=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[n,a,i]}},zN=function(e){var t,n,a,i,o,s,u,l;function f(p,x,b){return b<0&&(b+=1),b>1&&(b-=1),b<1/6?p+(x-p)*6*b:b<1/2?x:b<2/3?p+(x-p)*(2/3-b)*6:p}var d=new RegExp("^"+LN+"$").exec(e);if(d){if(n=parseInt(d[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,a=parseFloat(d[2]),a<0||a>100||(a=a/100,i=parseFloat(d[3]),i<0||i>100)||(i=i/100,o=d[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(a===0)s=u=l=Math.round(i*255);else{var h=i<.5?i*(1+a):i+a-i*a,g=2*i-h;s=Math.round(255*f(g,h,n+1/3)),u=Math.round(255*f(g,h,n)),l=Math.round(255*f(g,h,n-1/3))}t=[s,u,l,o]}return t},$N=function(e){var t,n=new RegExp("^"+BN+"$").exec(e);if(n){t=[];for(var a=[],i=1;i<=3;i++){var o=n[i];if(o[o.length-1]==="%"&&(a[i]=!0),o=parseFloat(o),a[i]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var s=a[1]||a[2]||a[3],u=a[1]&&a[2]&&a[3];if(s&&!u)return;var l=n[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},VN=function(e){return GN[e.toLowerCase()]},NR=function(e){return(Tr(e)?e:null)||VN(e)||FN(e)||$N(e)||zN(e)},GN={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},FR=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var o=n[i];if(yr(o))throw Error("Tried to set map with object key");i<n.length-1?(t[o]==null&&(t[o]={}),t=t[o]):t[o]=e.value}},zR=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var o=n[i];if(yr(o))throw Error("Tried to get map with object key");if(t=t[o],t==null)return t}return t},Tu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Es(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Oc,_w;function Cs(){if(_w)return Oc;_w=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Oc=r,Oc}var kc,Sw;function WN(){if(Sw)return kc;Sw=1;var r=typeof Tu=="object"&&Tu&&Tu.Object===Object&&Tu;return kc=r,kc}var qc,Tw;function wl(){if(Tw)return qc;Tw=1;var r=WN(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return qc=t,qc}var Nc,Rw;function UN(){if(Rw)return Nc;Rw=1;var r=wl(),e=function(){return r.Date.now()};return Nc=e,Nc}var Fc,Aw;function HN(){if(Aw)return Fc;Aw=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Fc=e,Fc}var zc,Pw;function KN(){if(Pw)return zc;Pw=1;var r=HN(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return zc=t,zc}var $c,Iw;function jm(){if(Iw)return $c;Iw=1;var r=wl(),e=r.Symbol;return $c=e,$c}var Vc,Dw;function jN(){if(Dw)return Vc;Dw=1;var r=jm(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,a=r?r.toStringTag:void 0;function i(o){var s=t.call(o,a),u=o[a];try{o[a]=void 0;var l=!0}catch{}var f=n.call(o);return l&&(s?o[a]=u:delete o[a]),f}return Vc=i,Vc}var Gc,Bw;function YN(){if(Bw)return Gc;Bw=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Gc=t,Gc}var Wc,Mw;function $R(){if(Mw)return Wc;Mw=1;var r=jm(),e=jN(),t=YN(),n="[object Null]",a="[object Undefined]",i=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?a:n:i&&i in Object(s)?e(s):t(s)}return Wc=o,Wc}var Uc,Lw;function XN(){if(Lw)return Uc;Lw=1;function r(e){return e!=null&&typeof e=="object"}return Uc=r,Uc}var Hc,Ow;function _s(){if(Ow)return Hc;Ow=1;var r=$R(),e=XN(),t="[object Symbol]";function n(a){return typeof a=="symbol"||e(a)&&r(a)==t}return Hc=n,Hc}var Kc,kw;function ZN(){if(kw)return Kc;kw=1;var r=KN(),e=Cs(),t=_s(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=r(l);var d=i.test(l);return d||o.test(l)?s(l.slice(2),d?2:8):a.test(l)?n:+l}return Kc=u,Kc}var jc,qw;function QN(){if(qw)return jc;qw=1;var r=Cs(),e=UN(),t=ZN(),n="Expected a function",a=Math.max,i=Math.min;function o(s,u,l){var f,d,h,g,p,x,b=0,w=!1,y=!1,E=!0;if(typeof s!="function")throw new TypeError(n);u=t(u)||0,r(l)&&(w=!!l.leading,y="maxWait"in l,h=y?a(t(l.maxWait)||0,u):h,E="trailing"in l?!!l.trailing:E);function C(M){var q=f,N=d;return f=d=void 0,b=M,g=s.apply(N,q),g}function S(M){return b=M,p=setTimeout(A,u),w?C(M):g}function R(M){var q=M-x,N=M-b,W=u-q;return y?i(W,h-N):W}function _(M){var q=M-x,N=M-b;return x===void 0||q>=u||q<0||y&&N>=h}function A(){var M=e();if(_(M))return P(M);p=setTimeout(A,R(M))}function P(M){return p=void 0,E&&f?C(M):(f=d=void 0,g)}function I(){p!==void 0&&clearTimeout(p),b=0,f=x=d=p=void 0}function D(){return p===void 0?g:P(e())}function L(){var M=e(),q=_(M);if(f=arguments,d=this,x=M,q){if(p===void 0)return S(x);if(y)return clearTimeout(p),p=setTimeout(A,u),C(x)}return p===void 0&&(p=setTimeout(A,u)),g}return L.cancel=I,L.flush=D,L}return jc=o,jc}var JN=QN(),Ss=Es(JN),Yc=tt?tt.performance:null,VR=Yc&&Yc.now?function(){return Yc.now()}:function(){return Date.now()},eF=(function(){if(tt){if(tt.requestAnimationFrame)return function(r){tt.requestAnimationFrame(r)};if(tt.mozRequestAnimationFrame)return function(r){tt.mozRequestAnimationFrame(r)};if(tt.webkitRequestAnimationFrame)return function(r){tt.webkitRequestAnimationFrame(r)};if(tt.msRequestAnimationFrame)return function(r){tt.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(VR())},1e3/60)}})(),tl=function(e){return eF(e)},ta=VR,oi=9261,GR=65599,Zi=5381,WR=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oi,n=t,a;a=e.next(),!a.done;)n=n*GR+a.value|0;return n},ls=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oi;return t*GR+e|0},fs=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zi;return(t<<5)+t+e|0},rF=function(e,t){return e*2097152+t},wa=function(e){return e[0]*2097152+e[1]},Ru=function(e,t){return[ls(e[0],t[0]),fs(e[1],t[1])]},Nw=function(e,t){var n={value:0,done:!1},a=0,i=e.length,o={next:function(){return a<i?n.value=e[a++]:n.done=!0,n}};return WR(o,t)},ci=function(e,t){var n={value:0,done:!1},a=0,i=e.length,o={next:function(){return a<i?n.value=e.charCodeAt(a++):n.done=!0,n}};return WR(o,t)},UR=function(){return tF(arguments)},tF=function(e){for(var t,n=0;n<e.length;n++){var a=e[n];n===0?t=ci(a):t=ci(a,t)}return t};function nF(r,e,t,n,a){var i=a*Math.PI/180,o=Math.cos(i)*(r-t)-Math.sin(i)*(e-n)+t,s=Math.sin(i)*(r-t)+Math.cos(i)*(e-n)+n;return{x:o,y:s}}var aF=function(e,t,n,a,i,o){return{x:(e-n)*i+n,y:(t-a)*o+a}};function iF(r,e,t){if(t===0)return r;var n=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=nF(r.x,r.y,n,a,t),u=aF(s.x,s.y,n,a,i,o);return{x:u.x,y:u.y}}var Fw=!0,oF=console.warn!=null,sF=console.trace!=null,Ym=Number.MAX_SAFE_INTEGER||9007199254740991,HR=function(){return!0},nl=function(){return!1},zw=function(){return 0},Xm=function(){},kr=function(e){throw new Error(e)},KR=function(e){if(e!==void 0)Fw=!!e;else return Fw},Cr=function(e){KR()&&(oF?console.warn(e):(console.log(e),sF&&console.trace()))},uF=function(e){return Ze({},e)},Nn=function(e){return e==null?e:Tr(e)?e.slice():yr(e)?uF(e):e},lF=function(e){return e.slice()},jR=function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},fF={},YR=function(){return fF},wt=function(e){var t=Object.keys(e);return function(n){for(var a={},i=0;i<t.length;i++){var o=t[i],s=n==null?void 0:n[o];a[o]=s===void 0?e[o]:s}return a}},Ba=function(e,t,n){for(var a=e.length-1;a>=0;a--)e[a]===t&&e.splice(a,1)},Zm=function(e){e.splice(0,e.length)},cF=function(e,t){for(var n=0;n<t.length;n++){var a=t[n];e.push(a)}},$t=function(e,t,n){return n&&(t=kR(n,t)),e[t]},ea=function(e,t,n,a){n&&(t=kR(n,t)),e[t]=a},dF=(function(){function r(){qa(this,r),this._obj={}}return Na(r,[{key:"set",value:function(t,n){return this._obj[t]=n,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}])})(),ra=typeof Map<"u"?Map:dF,vF="undefined",hF=(function(){function r(e){if(qa(this,r),this._obj=Object.create(null),this.size=0,e!=null){var t;e.instanceString!=null&&e.instanceString()===this.instanceString()?t=e.toArray():t=e;for(var n=0;n<t.length;n++)this.add(t[n])}}return Na(r,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var n=this._obj;n[t]!==1&&(n[t]=1,this.size++)}},{key:"delete",value:function(t){var n=this._obj;n[t]===1&&(n[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return this._obj[t]===1}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(n){return t.has(n)})}},{key:"forEach",value:function(t,n){return this.toArray().forEach(t,n)}}])})(),go=(typeof Set>"u"?"undefined":at(Set))!==vF?Set:hF,xl=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Hm(e)){kr("An element must have a core reference and parameters set");return}var a=t.group;if(a==null&&(t.data&&t.data.source!=null&&t.data.target!=null?a="edges":a="nodes"),a!=="nodes"&&a!=="edges"){kr("An element must be of type `nodes` or `edges`; you specified `"+a+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:a,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?a==="edges":!!t.pannable,active:!1,classes:new go,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];Tr(t.classes)?l=t.classes:Ye(t.classes)&&(l=t.classes.split(/\s+/));for(var f=0,d=l.length;f<d;f++){var h=l[f];!h||h===""||i.classes.add(h)}this.createEmitter(),(n===void 0||n)&&this.restore();var g=t.style||t.css;g&&(Cr("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(g))},$w=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,a,i){var o;yr(n)&&!Jt(n)&&(o=n,n=o.roots||o.root,a=o.visit,i=o.directed),i=arguments.length===2&&!$r(a)?a:i,a=$r(a)?a:function(){};for(var s=this._private.cy,u=n=Ye(n)?this.filter(n):n,l=[],f=[],d={},h={},g={},p=0,x,b=this.byGroup(),w=b.nodes,y=b.edges,E=0;E<u.length;E++){var C=u[E],S=C.id();C.isNode()&&(l.unshift(C),e.bfs&&(g[S]=!0,f.push(C)),h[S]=0)}for(var R=function(){var M=e.bfs?l.shift():l.pop(),q=M.id();if(e.dfs){if(g[q])return 0;g[q]=!0,f.push(M)}var N=h[q],W=d[q],V=W!=null?W.source():null,$=W!=null?W.target():null,X=W==null?void 0:M.same(V)?$[0]:V[0],ee;if(ee=a(M,W,X,p++,N),ee===!0)return x=M,1;if(ee===!1)return 1;for(var K=M.connectedEdges().filter(function(Y){return(!i||Y.source().same(M))&&y.has(Y)}),j=0;j<K.length;j++){var fe=K[j],G=fe.connectedNodes().filter(function(Y){return!Y.same(M)&&w.has(Y)}),z=G.id();G.length!==0&&!g[z]&&(G=G[0],l.push(G),e.bfs&&(g[z]=!0,f.push(G)),d[z]=fe,h[z]=h[q]+1)}},_;l.length!==0&&(_=R(),!(_!==0&&_===1)););for(var A=s.collection(),P=0;P<f.length;P++){var I=f[P],D=d[I.id()];D!=null&&A.push(D),A.push(I)}return{path:s.collection(A),found:s.collection(x)}}},cs={breadthFirstSearch:$w({bfs:!0}),depthFirstSearch:$w({dfs:!0})};cs.bfs=cs.breadthFirstSearch;cs.dfs=cs.depthFirstSearch;var Fu={exports:{}},gF=Fu.exports,Vw;function pF(){return Vw||(Vw=1,(function(r,e){(function(){var t,n,a,i,o,s,u,l,f,d,h,g,p,x,b;a=Math.floor,d=Math.min,n=function(w,y){return w<y?-1:w>y?1:0},f=function(w,y,E,C,S){var R;if(E==null&&(E=0),S==null&&(S=n),E<0)throw new Error("lo must be non-negative");for(C==null&&(C=w.length);E<C;)R=a((E+C)/2),S(y,w[R])<0?C=R:E=R+1;return[].splice.apply(w,[E,E-E].concat(y)),y},s=function(w,y,E){return E==null&&(E=n),w.push(y),x(w,0,w.length-1,E)},o=function(w,y){var E,C;return y==null&&(y=n),E=w.pop(),w.length?(C=w[0],w[0]=E,b(w,0,y)):C=E,C},l=function(w,y,E){var C;return E==null&&(E=n),C=w[0],w[0]=y,b(w,0,E),C},u=function(w,y,E){var C;return E==null&&(E=n),w.length&&E(w[0],y)<0&&(C=[w[0],y],y=C[0],w[0]=C[1],b(w,0,E)),y},i=function(w,y){var E,C,S,R,_,A;for(y==null&&(y=n),R=(function(){A=[];for(var P=0,I=a(w.length/2);0<=I?P<I:P>I;0<=I?P++:P--)A.push(P);return A}).apply(this).reverse(),_=[],C=0,S=R.length;C<S;C++)E=R[C],_.push(b(w,E,y));return _},p=function(w,y,E){var C;if(E==null&&(E=n),C=w.indexOf(y),C!==-1)return x(w,0,C,E),b(w,C,E)},h=function(w,y,E){var C,S,R,_,A;if(E==null&&(E=n),S=w.slice(0,y),!S.length)return S;for(i(S,E),A=w.slice(y),R=0,_=A.length;R<_;R++)C=A[R],u(S,C,E);return S.sort(E).reverse()},g=function(w,y,E){var C,S,R,_,A,P,I,D,L;if(E==null&&(E=n),y*10<=w.length){if(R=w.slice(0,y).sort(E),!R.length)return R;for(S=R[R.length-1],I=w.slice(y),_=0,P=I.length;_<P;_++)C=I[_],E(C,S)<0&&(f(R,C,0,null,E),R.pop(),S=R[R.length-1]);return R}for(i(w,E),L=[],A=0,D=d(y,w.length);0<=D?A<D:A>D;0<=D?++A:--A)L.push(o(w,E));return L},x=function(w,y,E,C){var S,R,_;for(C==null&&(C=n),S=w[E];E>y;){if(_=E-1>>1,R=w[_],C(S,R)<0){w[E]=R,E=_;continue}break}return w[E]=S},b=function(w,y,E){var C,S,R,_,A;for(E==null&&(E=n),S=w.length,A=y,R=w[y],C=2*y+1;C<S;)_=C+1,_<S&&!(E(w[C],w[_])<0)&&(C=_),w[y]=w[C],y=C,C=2*y+1;return w[y]=R,x(w,A,y,E)},t=(function(){w.push=s,w.pop=o,w.replace=l,w.pushpop=u,w.heapify=i,w.updateItem=p,w.nlargest=h,w.nsmallest=g;function w(y){this.cmp=y??n,this.nodes=[]}return w.prototype.push=function(y){return s(this.nodes,y,this.cmp)},w.prototype.pop=function(){return o(this.nodes,this.cmp)},w.prototype.peek=function(){return this.nodes[0]},w.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},w.prototype.replace=function(y){return l(this.nodes,y,this.cmp)},w.prototype.pushpop=function(y){return u(this.nodes,y,this.cmp)},w.prototype.heapify=function(){return i(this.nodes,this.cmp)},w.prototype.updateItem=function(y){return p(this.nodes,y,this.cmp)},w.prototype.clear=function(){return this.nodes=[]},w.prototype.empty=function(){return this.nodes.length===0},w.prototype.size=function(){return this.nodes.length},w.prototype.clone=function(){var y;return y=new w,y.nodes=this.nodes.slice(0),y},w.prototype.toArray=function(){return this.nodes.slice(0)},w.prototype.insert=w.prototype.push,w.prototype.top=w.prototype.peek,w.prototype.front=w.prototype.peek,w.prototype.has=w.prototype.contains,w.prototype.copy=w.prototype.clone,w})(),(function(w,y){return r.exports=y()})(this,function(){return t})}).call(gF)})(Fu)),Fu.exports}var Xc,Gw;function yF(){return Gw||(Gw=1,Xc=pF()),Xc}var mF=yF(),Ts=Es(mF),bF=wt({root:null,weight:function(e){return 1},directed:!1}),wF={dijkstra:function(e){if(!yr(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=bF(e),a=n.root,i=n.weight,o=n.directed,s=this,u=i,l=Ye(a)?this.filter(a)[0]:a[0],f={},d={},h={},g=this.byGroup(),p=g.nodes,x=g.edges;x.unmergeBy(function(N){return N.isLoop()});for(var b=function(W){return f[W.id()]},w=function(W,V){f[W.id()]=V,y.updateItem(W)},y=new Ts(function(N,W){return b(N)-b(W)}),E=0;E<p.length;E++){var C=p[E];f[C.id()]=C.same(l)?0:1/0,y.push(C)}for(var S=function(W,V){for(var $=(o?W.edgesTo(V):W.edgesWith(V)).intersect(x),X=1/0,ee,K=0;K<$.length;K++){var j=$[K],fe=u(j);(fe<X||!ee)&&(X=fe,ee=j)}return{edge:ee,dist:X}};y.size()>0;){var R=y.pop(),_=b(R),A=R.id();if(h[A]=_,_!==1/0)for(var P=R.neighborhood().intersect(p),I=0;I<P.length;I++){var D=P[I],L=D.id(),M=S(R,D),q=_+M.dist;q<b(D)&&(w(D,q),d[L]={node:R,edge:M.edge})}}return{distanceTo:function(W){var V=Ye(W)?p.filter(W)[0]:W[0];return h[V.id()]},pathTo:function(W){var V=Ye(W)?p.filter(W)[0]:W[0],$=[],X=V,ee=X.id();if(V.length>0)for($.unshift(V);d[ee];){var K=d[ee];$.unshift(K.edge),$.unshift(K.node),X=K.node,ee=X.id()}return s.spawn($)}}}},xF={kruskal:function(e){e=e||function(E){return 1};for(var t=this.byGroup(),n=t.nodes,a=t.edges,i=n.length,o=new Array(i),s=n,u=function(C){for(var S=0;S<o.length;S++){var R=o[S];if(R.has(C))return S}},l=0;l<i;l++)o[l]=this.spawn(n[l]);for(var f=a.sort(function(E,C){return e(E)-e(C)}),d=0;d<f.length;d++){var h=f[d],g=h.source()[0],p=h.target()[0],x=u(g),b=u(p),w=o[x],y=o[b];x!==b&&(s.merge(h),w.merge(y),o.splice(b,1))}return s}},EF=wt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),CF={aStar:function(e){var t=this.cy(),n=EF(e),a=n.root,i=n.goal,o=n.heuristic,s=n.directed,u=n.weight;a=t.collection(a)[0],i=t.collection(i)[0];var l=a.id(),f=i.id(),d={},h={},g={},p=new Ts(function(ee,K){return h[ee.id()]-h[K.id()]}),x=new go,b={},w={},y=function(K,j){p.push(K),x.add(j)},E,C,S=function(){E=p.pop(),C=E.id(),x.delete(C)},R=function(K){return x.has(K)};y(a,l),d[l]=0,h[l]=o(a);for(var _=0;p.size()>0;){if(S(),_++,C===f){for(var A=[],P=i,I=f,D=w[I];A.unshift(P),D!=null&&A.unshift(D),P=b[I],P!=null;)I=P.id(),D=w[I];return{found:!0,distance:d[C],path:this.spawn(A),steps:_}}g[C]=!0;for(var L=E._private.edges,M=0;M<L.length;M++){var q=L[M];if(this.hasElementWithId(q.id())&&!(s&&q.data("source")!==C)){var N=q.source(),W=q.target(),V=N.id()!==C?N:W,$=V.id();if(this.hasElementWithId($)&&!g[$]){var X=d[C]+u(q);if(!R($)){d[$]=X,h[$]=X+o(V),y(V,$),b[$]=E,w[$]=q;continue}X<d[$]&&(d[$]=X,h[$]=X+o(V),b[$]=E,w[$]=q)}}}}return{found:!1,distance:void 0,path:void 0,steps:_}}},_F=wt({weight:function(e){return 1},directed:!1}),SF={floydWarshall:function(e){for(var t=this.cy(),n=_F(e),a=n.weight,i=n.directed,o=a,s=this.byGroup(),u=s.nodes,l=s.edges,f=u.length,d=f*f,h=function(fe){return u.indexOf(fe)},g=function(fe){return u[fe]},p=new Array(d),x=0;x<d;x++){var b=x%f,w=(x-b)/f;w===b?p[x]=0:p[x]=1/0}for(var y=new Array(d),E=new Array(d),C=0;C<l.length;C++){var S=l[C],R=S.source()[0],_=S.target()[0];if(R!==_){var A=h(R),P=h(_),I=A*f+P,D=o(S);if(p[I]>D&&(p[I]=D,y[I]=P,E[I]=S),!i){var L=P*f+A;!i&&p[L]>D&&(p[L]=D,y[L]=A,E[L]=S)}}}for(var M=0;M<f;M++)for(var q=0;q<f;q++)for(var N=q*f+M,W=0;W<f;W++){var V=q*f+W,$=M*f+W;p[N]+p[$]<p[V]&&(p[V]=p[N]+p[$],y[V]=y[N])}var X=function(fe){return(Ye(fe)?t.filter(fe):fe)[0]},ee=function(fe){return h(X(fe))},K={distance:function(fe,G){var z=ee(fe),Y=ee(G);return p[z*f+Y]},path:function(fe,G){var z=ee(fe),Y=ee(G),te=g(z);if(z===Y)return te.collection();if(y[z*f+Y]==null)return t.collection();var ue=t.collection(),oe=z,Z;for(ue.merge(te);z!==Y;)oe=z,z=y[z*f+Y],Z=E[oe*f+z],ue.merge(Z),ue.merge(g(z));return ue}};return K}},TF=wt({weight:function(e){return 1},directed:!1,root:null}),RF={bellmanFord:function(e){var t=this,n=TF(e),a=n.weight,i=n.directed,o=n.root,s=a,u=this,l=this.cy(),f=this.byGroup(),d=f.edges,h=f.nodes,g=h.length,p=new ra,x=!1,b=[];o=l.collection(o)[0],d.unmergeBy(function(le){return le.isLoop()});for(var w=d.length,y=function(Me){var Se=p.get(Me.id());return Se||(Se={},p.set(Me.id(),Se)),Se},E=function(Me){return(Ye(Me)?l.$(Me):Me)[0]},C=function(Me){return y(E(Me)).dist},S=function(Me){for(var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,Ee=E(Me),re=[],ce=Ee;;){if(ce==null)return t.spawn();var _e=y(ce),me=_e.edge,Te=_e.pred;if(re.unshift(ce[0]),ce.same(Se)&&re.length>0)break;me!=null&&re.unshift(me),ce=Te}return u.spawn(re)},R=0;R<g;R++){var _=h[R],A=y(_);_.same(o)?A.dist=0:A.dist=1/0,A.pred=null,A.edge=null}for(var P=!1,I=function(Me,Se,Ee,re,ce,_e){var me=re.dist+_e;me<ce.dist&&!Ee.same(re.edge)&&(ce.dist=me,ce.pred=Me,ce.edge=Ee,P=!0)},D=1;D<g;D++){P=!1;for(var L=0;L<w;L++){var M=d[L],q=M.source(),N=M.target(),W=s(M),V=y(q),$=y(N);I(q,N,M,V,$,W),i||I(N,q,M,$,V,W)}if(!P)break}if(P)for(var X=[],ee=0;ee<w;ee++){var K=d[ee],j=K.source(),fe=K.target(),G=s(K),z=y(j).dist,Y=y(fe).dist;if(z+G<Y||!i&&Y+G<z)if(x||(Cr("Graph contains a negative weight cycle for Bellman-Ford"),x=!0),e.findNegativeWeightCycles!==!1){var te=[];z+G<Y&&te.push(j),!i&&Y+G<z&&te.push(fe);for(var ue=te.length,oe=0;oe<ue;oe++){var Z=te[oe],Q=[Z];Q.push(y(Z).edge);for(var ie=y(Z).pred;Q.indexOf(ie)===-1;)Q.push(ie),Q.push(y(ie).edge),ie=y(ie).pred;Q=Q.slice(Q.indexOf(ie));for(var de=Q[0].id(),we=0,Ae=2;Ae<Q.length;Ae+=2)Q[Ae].id()<de&&(de=Q[Ae].id(),we=Ae);Q=Q.slice(we).concat(Q.slice(0,we)),Q.push(Q[0]);var ve=Q.map(function(le){return le.id()}).join(",");X.indexOf(ve)===-1&&(b.push(u.spawn(Q)),X.push(ve))}}else break}return{distanceTo:C,pathTo:S,hasNegativeWeightCycle:x,negativeWeightCycles:b}}},AF=Math.sqrt(2),PF=function(e,t,n){n.length===0&&kr("Karger-Stein must be run on a connected (sub)graph");for(var a=n[e],i=a[1],o=a[2],s=t[i],u=t[o],l=n,f=l.length-1;f>=0;f--){var d=l[f],h=d[1],g=d[2];(t[h]===s&&t[g]===u||t[h]===u&&t[g]===s)&&l.splice(f,1)}for(var p=0;p<l.length;p++){var x=l[p];x[1]===u?(l[p]=x.slice(),l[p][1]=s):x[2]===u&&(l[p]=x.slice(),l[p][2]=s)}for(var b=0;b<t.length;b++)t[b]===u&&(t[b]=s);return l},Zc=function(e,t,n,a){for(;n>a;){var i=Math.floor(Math.random()*t.length);t=PF(i,e,t),n--}return t},IF={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,a=t.edges;a.unmergeBy(function($){return $.isLoop()});var i=n.length,o=a.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/AF);if(i<2){kr("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<o;f++){var d=a[f];l.push([f,n.indexOf(d.source()),n.indexOf(d.target())])}for(var h=1/0,g=[],p=new Array(i),x=new Array(i),b=new Array(i),w=function(X,ee){for(var K=0;K<i;K++)ee[K]=X[K]},y=0;y<=s;y++){for(var E=0;E<i;E++)x[E]=E;var C=Zc(x,l.slice(),i,u),S=C.slice();w(x,b);var R=Zc(x,C,u,2),_=Zc(b,S,u,2);R.length<=_.length&&R.length<h?(h=R.length,g=R,w(x,p)):_.length<=R.length&&_.length<h&&(h=_.length,g=_,w(b,p))}for(var A=this.spawn(g.map(function($){return a[$[0]]})),P=this.spawn(),I=this.spawn(),D=p[0],L=0;L<p.length;L++){var M=p[L],q=n[L];M===D?P.merge(q):I.merge(q)}var N=function(X){var ee=e.spawn();return X.forEach(function(K){ee.merge(K),K.connectedEdges().forEach(function(j){e.contains(j)&&!A.contains(j)&&ee.merge(j)})}),ee},W=[N(P),N(I)],V={cut:A,components:W,partition1:P,partition2:I};return V}},Qc,DF=function(e){return{x:e.x,y:e.y}},El=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},XR=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Ji=function(e){return{x:e[0],y:e[1]}},BF=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(a=Math.min(o,a))}return a},MF=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=-1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(a=Math.max(o,a))}return a},LF=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=0,i=0,o=t;o<n;o++){var s=e[o];isFinite(s)&&(a+=s,i++)}return a/i},OF=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;a?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(h,g){return h-g});var f=e.length,d=Math.floor(f/2);return f%2!==0?e[d+1+s]:(e[d-1+s]+e[d+s])/2},kF=function(e){return Math.PI*e/180},Au=function(e,t){return Math.atan2(t,e)-Math.PI/2},Qm=Math.log2||function(r){return Math.log(r)/Math.log(2)},Jm=function(e){return e>0?1:e<0?-1:0},di=function(e,t){return Math.sqrt(ti(e,t))},ti=function(e,t){var n=t.x-e.x,a=t.y-e.y;return n*n+a*a},qF=function(e){for(var t=e.length,n=0,a=0;a<t;a++)n+=e[a];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},ut=function(e,t,n,a){return(1-a)*(1-a)*e+2*(1-a)*a*t+a*a*n},io=function(e,t,n,a){return{x:ut(e.x,t.x,n.x,a),y:ut(e.y,t.y,n.y,a)}},NF=function(e,t,n,a){var i={x:t.x-e.x,y:t.y-e.y},o=di(e,t),s={x:i.x/o,y:i.y/o};return n=n??0,a=a??n*o,{x:e.x+s.x*a,y:e.y+s.y*a}},ds=function(e,t,n){return Math.max(e,Math.min(n,t))},Lt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},FF=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},zF=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},$F=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},ZR=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},zu=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},$u=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,a,i,o;if(t.length===1)n=a=i=o=t[0];else if(t.length===2)n=i=t[0],o=a=t[1];else if(t.length===4){var s=Xr(t,4);n=s[0],a=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=a,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ww=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},e0=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},Sa=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Uw=function(e,t){return Sa(e,t.x,t.y)},QR=function(e,t){return Sa(e,t.x1,t.y1)&&Sa(e,t.x2,t.y2)},VF=(Qc=Math.hypot)!==null&&Qc!==void 0?Qc:function(r,e){return Math.sqrt(r*r+e*e)};function GF(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=function(A,P){return{x:A.x+P.x,y:A.y+P.y}},n=function(A,P){return{x:A.x-P.x,y:A.y-P.y}},a=function(A,P){return{x:A.x*P,y:A.y*P}},i=function(A,P){return A.x*P.y-A.y*P.x},o=function(A){var P=VF(A.x,A.y);return P===0?{x:0,y:0}:{x:A.x/P,y:A.y/P}},s=function(A){for(var P=0,I=0;I<A.length;I++){var D=A[I],L=A[(I+1)%A.length];P+=D.x*L.y-L.x*D.y}return P/2},u=function(A,P,I,D){var L=n(P,A),M=n(D,I),q=i(L,M);if(Math.abs(q)<1e-9)return t(A,a(L,.5));var N=i(n(I,A),M)/q;return t(A,a(L,N))},l=r.map(function(_){return{x:_.x,y:_.y}});s(l)<0&&l.reverse();for(var f=l.length,d=[],h=0;h<f;h++){var g=l[h],p=l[(h+1)%f],x=n(p,g),b=o({x:x.y,y:-x.x});d.push(b)}for(var w=d.map(function(_,A){var P=t(l[A],a(_,e)),I=t(l[(A+1)%f],a(_,e));return{p1:P,p2:I}}),y=[],E=0;E<f;E++){var C=w[(E-1+f)%f],S=w[E],R=u(C.p1,C.p2,S.p1,S.p2);y.push(R)}return y}function WF(r,e,t,n,a,i){var o=JF(r,e,t,n,a),s=GF(o,i),u=Lt();return s.forEach(function(l){return ZR(u,l.x,l.y)}),u}var JR=function(e,t,n,a,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?Ma(i,o):u,f=i/2,d=o/2;l=Math.min(l,f,d);var h=l!==f,g=l!==d,p;if(h){var x=n-f+l-s,b=a-d-s,w=n+f-l+s,y=b;if(p=Ta(e,t,n,a,x,b,w,y,!1),p.length>0)return p}if(g){var E=n+f+s,C=a-d+l-s,S=E,R=a+d-l+s;if(p=Ta(e,t,n,a,E,C,S,R,!1),p.length>0)return p}if(h){var _=n-f+l-s,A=a+d+s,P=n+f-l+s,I=A;if(p=Ta(e,t,n,a,_,A,P,I,!1),p.length>0)return p}if(g){var D=n-f-s,L=a-d+l-s,M=D,q=a+d-l+s;if(p=Ta(e,t,n,a,D,L,M,q,!1),p.length>0)return p}var N;{var W=n-f+l,V=a-d+l;if(N=Yo(e,t,n,a,W,V,l+s),N.length>0&&N[0]<=W&&N[1]<=V)return[N[0],N[1]]}{var $=n+f-l,X=a-d+l;if(N=Yo(e,t,n,a,$,X,l+s),N.length>0&&N[0]>=$&&N[1]<=X)return[N[0],N[1]]}{var ee=n+f-l,K=a+d-l;if(N=Yo(e,t,n,a,ee,K,l+s),N.length>0&&N[0]>=ee&&N[1]>=K)return[N[0],N[1]]}{var j=n-f+l,fe=a+d-l;if(N=Yo(e,t,n,a,j,fe,l+s),N.length>0&&N[0]<=j&&N[1]>=fe)return[N[0],N[1]]}return[]},UF=function(e,t,n,a,i,o,s){var u=s,l=Math.min(n,i),f=Math.max(n,i),d=Math.min(a,o),h=Math.max(a,o);return l-u<=e&&e<=f+u&&d-u<=t&&t<=h+u},HF=function(e,t,n,a,i,o,s,u,l){var f={x1:Math.min(n,s,i)-l,x2:Math.max(n,s,i)+l,y1:Math.min(a,u,o)-l,y2:Math.max(a,u,o)+l};return!(e<f.x1||e>f.x2||t<f.y1||t>f.y2)},KF=function(e,t,n,a){n-=a;var i=t*t-4*e*n;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-t+o)/s,l=(-t-o)/s;return[u,l]},jF=function(e,t,n,a,i){var o=1e-5;e===0&&(e=o),t/=e,n/=e,a/=e;var s,u,l,f,d,h,g,p;if(u=(3*n-t*t)/9,l=-(27*a)+t*(9*n-2*(t*t)),l/=54,s=u*u*u+l*l,i[1]=0,g=t/3,s>0){d=l+Math.sqrt(s),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),h=l-Math.sqrt(s),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),i[0]=-g+d+h,g+=(d+h)/2,i[4]=i[2]=-g,g=Math.sqrt(3)*(-h+d)/2,i[3]=g,i[5]=-g;return}if(i[5]=i[3]=0,s===0){p=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-g+2*p,i[4]=i[2]=-(p+g);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),p=2*Math.sqrt(u),i[0]=-g+p*Math.cos(f/3),i[2]=-g+p*Math.cos((f+2*Math.PI)/3),i[4]=-g+p*Math.cos((f+4*Math.PI)/3)},YF=function(e,t,n,a,i,o,s,u){var l=1*n*n-4*n*i+2*n*s+4*i*i-4*i*s+s*s+a*a-4*a*o+2*a*u+4*o*o-4*o*u+u*u,f=9*n*i-3*n*n-3*n*s-6*i*i+3*i*s+9*a*o-3*a*a-3*a*u-6*o*o+3*o*u,d=3*n*n-6*n*i+n*s-n*e+2*i*i+2*i*e-s*e+3*a*a-6*a*o+a*u-a*t+2*o*o+2*o*t-u*t,h=1*n*i-n*n+n*e-i*e+a*o-a*a+a*t-o*t,g=[];jF(l,f,d,h,g);for(var p=1e-7,x=[],b=0;b<6;b+=2)Math.abs(g[b+1])<p&&g[b]>=0&&g[b]<=1&&x.push(g[b]);x.push(1),x.push(0);for(var w=-1,y,E,C,S=0;S<x.length;S++)y=Math.pow(1-x[S],2)*n+2*(1-x[S])*x[S]*i+x[S]*x[S]*s,E=Math.pow(1-x[S],2)*a+2*(1-x[S])*x[S]*o+x[S]*x[S]*u,C=Math.pow(y-e,2)+Math.pow(E-t,2),w>=0?C<w&&(w=C):w=C;return w},XF=function(e,t,n,a,i,o){var s=[e-n,t-a],u=[i-n,o-a],l=u[0]*u[0]+u[1]*u[1],f=s[0]*s[0]+s[1]*s[1],d=s[0]*u[0]+s[1]*u[1],h=d*d/l;return d<0?f:h>l?(e-i)*(e-i)+(t-o)*(t-o):f-h},Vt=function(e,t,n){for(var a,i,o,s,u,l=0,f=0;f<n.length/2;f++)if(a=n[f*2],i=n[f*2+1],f+1<n.length/2?(o=n[(f+1)*2],s=n[(f+1)*2+1]):(o=n[(f+1-n.length/2)*2],s=n[(f+1-n.length/2)*2+1]),!(a==e&&o==e))if(a>=e&&e>=o||a<=e&&e<=o)u=(e-a)/(o-a)*(s-i)+i,u>t&&l++;else continue;return l%2!==0},na=function(e,t,n,a,i,o,s,u,l){var f=new Array(n.length),d;u[0]!=null?(d=Math.atan(u[1]/u[0]),u[0]<0?d=d+Math.PI/2:d=-d-Math.PI/2):d=u;for(var h=Math.cos(-d),g=Math.sin(-d),p=0;p<f.length/2;p++)f[p*2]=o/2*(n[p*2]*h-n[p*2+1]*g),f[p*2+1]=s/2*(n[p*2+1]*h+n[p*2]*g),f[p*2]+=a,f[p*2+1]+=i;var x;if(l>0){var b=il(f,-l);x=al(b)}else x=f;return Vt(e,t,x)},ZF=function(e,t,n,a,i,o,s,u){for(var l=new Array(n.length*2),f=0;f<u.length;f++){var d=u[f];l[f*4+0]=d.startX,l[f*4+1]=d.startY,l[f*4+2]=d.stopX,l[f*4+3]=d.stopY;var h=Math.pow(d.cx-e,2)+Math.pow(d.cy-t,2);if(h<=Math.pow(d.radius,2))return!0}return Vt(e,t,l)},al=function(e){for(var t=new Array(e.length/2),n,a,i,o,s,u,l,f,d=0;d<e.length/4;d++){n=e[d*4],a=e[d*4+1],i=e[d*4+2],o=e[d*4+3],d<e.length/4-1?(s=e[(d+1)*4],u=e[(d+1)*4+1],l=e[(d+1)*4+2],f=e[(d+1)*4+3]):(s=e[0],u=e[1],l=e[2],f=e[3]);var h=Ta(n,a,i,o,s,u,l,f,!0);t[d*2]=h[0],t[d*2+1]=h[1]}return t},il=function(e,t){for(var n=new Array(e.length*2),a,i,o,s,u=0;u<e.length/2;u++){a=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,f=-(o-a),d=Math.sqrt(l*l+f*f),h=l/d,g=f/d;n[u*4]=a+h*t,n[u*4+1]=i+g*t,n[u*4+2]=o+h*t,n[u*4+3]=s+g*t}return n},QF=function(e,t,n,a,i,o){var s=n-e,u=a-t;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),f=l-1;if(f<0)return[];var d=f/l;return[(n-e)*d+e,(a-t)*d+t]},ui=function(e,t,n,a,i,o,s){return e-=i,t-=o,e/=n/2+s,t/=a/2+s,e*e+t*t<=1},Yo=function(e,t,n,a,i,o,s){var u=[n-e,a-t],l=[e-i,t-o],f=u[0]*u[0]+u[1]*u[1],d=2*(l[0]*u[0]+l[1]*u[1]),h=l[0]*l[0]+l[1]*l[1]-s*s,g=d*d-4*f*h;if(g<0)return[];var p=(-d+Math.sqrt(g))/(2*f),x=(-d-Math.sqrt(g))/(2*f),b=Math.min(p,x),w=Math.max(p,x),y=[];if(b>=0&&b<=1&&y.push(b),w>=0&&w<=1&&y.push(w),y.length===0)return[];var E=y[0]*u[0]+e,C=y[0]*u[1]+t;if(y.length>1){if(y[0]==y[1])return[E,C];var S=y[1]*u[0]+e,R=y[1]*u[1]+t;return[E,C,S,R]}else return[E,C]},Jc=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Ta=function(e,t,n,a,i,o,s,u,l){var f=e-i,d=n-e,h=s-i,g=t-o,p=a-t,x=u-o,b=h*g-x*f,w=d*g-p*f,y=x*d-h*p;if(y!==0){var E=b/y,C=w/y,S=.001,R=0-S,_=1+S;return R<=E&&E<=_&&R<=C&&C<=_?[e+E*d,t+E*p]:l?[e+E*d,t+E*p]:[]}else return b===0||w===0?Jc(e,n,s)===s?[s,u]:Jc(e,n,i)===i?[i,o]:Jc(i,s,n)===n?[n,a]:[]:[]},JF=function(e,t,n,a,i){var o=[],s=a/2,u=i/2,l=t,f=n;o.push({x:l+s*e[0],y:f+u*e[1]});for(var d=1;d<e.length/2;d++)o.push({x:l+s*e[d*2],y:f+u*e[d*2+1]});return o},vs=function(e,t,n,a,i,o,s,u){var l=[],f,d=new Array(n.length),h=!0;o==null&&(h=!1);var g;if(h){for(var p=0;p<d.length/2;p++)d[p*2]=n[p*2]*o+a,d[p*2+1]=n[p*2+1]*s+i;if(u>0){var x=il(d,-u);g=al(x)}else g=d}else g=n;for(var b,w,y,E,C=0;C<g.length/2;C++)b=g[C*2],w=g[C*2+1],C<g.length/2-1?(y=g[(C+1)*2],E=g[(C+1)*2+1]):(y=g[0],E=g[1]),f=Ta(e,t,a,i,b,w,y,E),f.length!==0&&l.push(f[0],f[1]);return l},ez=function(e,t,n,a,i,o,s,u,l){var f=[],d,h=new Array(n.length*2);l.forEach(function(y,E){E===0?(h[h.length-2]=y.startX,h[h.length-1]=y.startY):(h[E*4-2]=y.startX,h[E*4-1]=y.startY),h[E*4]=y.stopX,h[E*4+1]=y.stopY,d=Yo(e,t,a,i,y.cx,y.cy,y.radius),d.length!==0&&f.push(d[0],d[1])});for(var g=0;g<h.length/4;g++)d=Ta(e,t,a,i,h[g*4],h[g*4+1],h[g*4+2],h[g*4+3],!1),d.length!==0&&f.push(d[0],d[1]);if(f.length>2){for(var p=[f[0],f[1]],x=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),b=1;b<f.length/2;b++){var w=Math.pow(f[b*2]-e,2)+Math.pow(f[b*2+1]-t,2);w<=x&&(p[0]=f[b*2],p[1]=f[b*2+1],x=w)}return p}return f},Pu=function(e,t,n){var a=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(a[0]*a[0]+a[1]*a[1]),o=(i-n)/i;return o<0&&(o=1e-5),[t[0]+o*a[0],t[1]+o*a[1]]},Mt=function(e,t){var n=Em(e,t);return n=eA(n),n},eA=function(e){for(var t,n,a=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<a;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,n),u=Math.max(u,n);for(var f=2/(s-i),d=2/(u-o),h=0;h<a;h++)t=e[2*h]=e[2*h]*f,n=e[2*h+1]=e[2*h+1]*d,i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,n),u=Math.max(u,n);if(o<-1)for(var g=0;g<a;g++)n=e[2*g+1]=e[2*g+1]+(-1-o);return e},Em=function(e,t){var n=1/e*2*Math.PI,a=e%2===0?Math.PI/2+n/2:Math.PI/2;a+=t;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*n+a,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},Ma=function(e,t){return Math.min(e/4,t/4,8)},rA=function(e,t){return Math.min(e/10,t/10,8)},r0=function(){return 8},rz=function(e,t,n){return[e-2*t+n,2*(t-e),e]},Cm=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function ed(r,e){function t(d){for(var h=[],g=0;g<d.length;g++){var p=d[g],x=d[(g+1)%d.length],b={x:x.x-p.x,y:x.y-p.y},w={x:-b.y,y:b.x},y=Math.sqrt(w.x*w.x+w.y*w.y);h.push({x:w.x/y,y:w.y/y})}return h}function n(d,h){var g=1/0,p=-1/0,x=Gt(d),b;try{for(x.s();!(b=x.n()).done;){var w=b.value,y=w.x*h.x+w.y*h.y;g=Math.min(g,y),p=Math.max(p,y)}}catch(E){x.e(E)}finally{x.f()}return{min:g,max:p}}function a(d,h){return!(d.max<h.min||h.max<d.min)}var i=[].concat(el(t(r)),el(t(e))),o=Gt(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=n(r,u),f=n(e,u);if(!a(l,f))return!1}}catch(d){o.e(d)}finally{o.f()}return!0}var tz=wt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),nz={pageRank:function(e){for(var t=tz(e),n=t.dampingFactor,a=t.precision,i=t.iterations,o=t.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,d=l.length,h=d*d,g=f.length,p=new Array(h),x=new Array(d),b=(1-n)/d,w=0;w<d;w++){for(var y=0;y<d;y++){var E=w*d+y;p[E]=0}x[w]=0}for(var C=0;C<g;C++){var S=f[C],R=S.data("source"),_=S.data("target");if(R!==_){var A=l.indexOfId(R),P=l.indexOfId(_),I=o(S),D=P*d+A;p[D]+=I,x[A]+=I}}for(var L=1/d+b,M=0;M<d;M++)if(x[M]===0)for(var q=0;q<d;q++){var N=q*d+M;p[N]=L}else for(var W=0;W<d;W++){var V=W*d+M;p[V]=p[V]/x[M]+b}for(var $=new Array(d),X=new Array(d),ee,K=0;K<d;K++)$[K]=1;for(var j=0;j<i;j++){for(var fe=0;fe<d;fe++)X[fe]=0;for(var G=0;G<d;G++)for(var z=0;z<d;z++){var Y=G*d+z;X[G]+=p[Y]*$[z]}qF(X),ee=$,$=X,X=ee;for(var te=0,ue=0;ue<d;ue++){var oe=ee[ue]-$[ue];te+=oe*oe}if(te<a)break}var Z={rank:function(ie){return ie=s.collection(ie)[0],$[l.indexOf(ie)]}};return Z}},Hw=wt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),oo={degreeCentralityNormalized:function(e){e=Hw(e);var t=this.cy(),n=this.nodes(),a=n.length;if(e.directed){for(var f={},d={},h=0,g=0,p=0;p<a;p++){var x=n[p],b=x.id();e.root=x;var w=this.degreeCentrality(e);h<w.indegree&&(h=w.indegree),g<w.outdegree&&(g=w.outdegree),f[b]=w.indegree,d[b]=w.outdegree}return{indegree:function(E){return h==0?0:(Ye(E)&&(E=t.filter(E)),f[E.id()]/h)},outdegree:function(E){return g===0?0:(Ye(E)&&(E=t.filter(E)),d[E.id()]/g)}}}else{for(var i={},o=0,s=0;s<a;s++){var u=n[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(E){return o===0?0:(Ye(E)&&(E=t.filter(E)),i[E.id()]/o)}}}},degreeCentrality:function(e){e=Hw(e);var t=this.cy(),n=this,a=e,i=a.root,o=a.weight,s=a.directed,u=a.alpha;if(i=t.collection(i)[0],s){for(var g=i.connectedEdges(),p=g.filter(function(R){return R.target().same(i)&&n.has(R)}),x=g.filter(function(R){return R.source().same(i)&&n.has(R)}),b=p.length,w=x.length,y=0,E=0,C=0;C<p.length;C++)y+=o(p[C]);for(var S=0;S<x.length;S++)E+=o(x[S]);return{indegree:Math.pow(b,1-u)*Math.pow(y,u),outdegree:Math.pow(w,1-u)*Math.pow(E,u)}}else{for(var l=i.connectedEdges().intersection(n),f=l.length,d=0,h=0;h<l.length;h++)d+=o(l[h]);return{degree:Math.pow(f,1-u)*Math.pow(d,u)}}}};oo.dc=oo.degreeCentrality;oo.dcn=oo.degreeCentralityNormalised=oo.degreeCentralityNormalized;var Kw=wt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),so={closenessCentralityNormalized:function(e){for(var t=Kw(e),n=t.harmonic,a=t.weight,i=t.directed,o=this.cy(),s={},u=0,l=this.nodes(),f=this.floydWarshall({weight:a,directed:i}),d=0;d<l.length;d++){for(var h=0,g=l[d],p=0;p<l.length;p++)if(d!==p){var x=f.distance(g,l[p]);n?h+=1/x:h+=x}n||(h=1/h),u<h&&(u=h),s[g.id()]=h}return{closeness:function(w){return u==0?0:(Ye(w)?w=o.filter(w)[0].id():w=w.id(),s[w]/u)}}},closenessCentrality:function(e){var t=Kw(e),n=t.root,a=t.weight,i=t.directed,o=t.harmonic;n=this.filter(n)[0];for(var s=this.dijkstra({root:n,weight:a,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var d=l[f];if(!d.same(n)){var h=s.distanceTo(d);o?u+=1/h:u+=h}}return o?u:1/u}};so.cc=so.closenessCentrality;so.ccn=so.closenessCentralityNormalised=so.closenessCentralityNormalized;var az=wt({weight:null,directed:!1}),_m={betweennessCentrality:function(e){for(var t=az(e),n=t.directed,a=t.weight,i=a!=null,o=this.cy(),s=this.nodes(),u={},l={},f=0,d={set:function(E,C){l[E]=C,C>f&&(f=C)},get:function(E){return l[E]}},h=0;h<s.length;h++){var g=s[h],p=g.id();n?u[p]=g.outgoers().nodes():u[p]=g.openNeighborhood().nodes(),d.set(p,0)}for(var x=function(){for(var E=s[b].id(),C=[],S={},R={},_={},A=new Ts(function(G,z){return _[G]-_[z]}),P=0;P<s.length;P++){var I=s[P].id();S[I]=[],R[I]=0,_[I]=1/0}for(R[E]=1,_[E]=0,A.push(E);!A.empty();){var D=A.pop();if(C.push(D),i)for(var L=0;L<u[D].length;L++){var M=u[D][L],q=o.getElementById(D),N=void 0;q.edgesTo(M).length>0?N=q.edgesTo(M)[0]:N=M.edgesTo(q)[0];var W=a(N);M=M.id(),_[M]>_[D]+W&&(_[M]=_[D]+W,A.nodes.indexOf(M)<0?A.push(M):A.updateItem(M),R[M]=0,S[M]=[]),_[M]==_[D]+W&&(R[M]=R[M]+R[D],S[M].push(D))}else for(var V=0;V<u[D].length;V++){var $=u[D][V].id();_[$]==1/0&&(A.push($),_[$]=_[D]+1),_[$]==_[D]+1&&(R[$]=R[$]+R[D],S[$].push(D))}}for(var X={},ee=0;ee<s.length;ee++)X[s[ee].id()]=0;for(;C.length>0;){for(var K=C.pop(),j=0;j<S[K].length;j++){var fe=S[K][j];X[fe]=X[fe]+R[fe]/R[K]*(1+X[K])}K!=s[b].id()&&d.set(K,d.get(K)+X[K])}},b=0;b<s.length;b++)x();var w={betweenness:function(E){var C=o.collection(E).id();return d.get(C)},betweennessNormalized:function(E){if(f==0)return 0;var C=o.collection(E).id();return d.get(C)/f}};return w.betweennessNormalised=w.betweennessNormalized,w}};_m.bc=_m.betweennessCentrality;var iz=wt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),oz=function(e){return iz(e)},sz=function(e,t){for(var n=0,a=0;a<t.length;a++)n+=t[a](e);return n},uz=function(e,t,n){for(var a=0;a<t;a++)e[a*t+a]=n},tA=function(e,t){for(var n,a=0;a<t;a++){n=0;for(var i=0;i<t;i++)n+=e[i*t+a];for(var o=0;o<t;o++)e[o*t+a]=e[o*t+a]/n}},lz=function(e,t,n){for(var a=new Array(n*n),i=0;i<n;i++){for(var o=0;o<n;o++)a[i*n+o]=0;for(var s=0;s<n;s++)for(var u=0;u<n;u++)a[i*n+u]+=e[i*n+s]*t[s*n+u]}return a},fz=function(e,t,n){for(var a=e.slice(0),i=1;i<n;i++)e=lz(e,a,t);return e},cz=function(e,t,n){for(var a=new Array(t*t),i=0;i<t*t;i++)a[i]=Math.pow(e[i],n);return tA(a,t),a},dz=function(e,t,n,a){for(var i=0;i<n;i++){var o=Math.round(e[i]*Math.pow(10,a))/Math.pow(10,a),s=Math.round(t[i]*Math.pow(10,a))/Math.pow(10,a);if(o!==s)return!1}return!0},vz=function(e,t,n,a){for(var i=[],o=0;o<t;o++){for(var s=[],u=0;u<t;u++)Math.round(e[o*t+u]*1e3)/1e3>0&&s.push(n[u]);s.length!==0&&i.push(a.collection(s))}return i},hz=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},gz=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&hz(e[t],e[n])&&e.splice(n,1);return e},jw=function(e){for(var t=this.nodes(),n=this.edges(),a=this.cy(),i=oz(e),o={},s=0;s<t.length;s++)o[t[s].id()]=s;for(var u=t.length,l=u*u,f=new Array(l),d,h=0;h<l;h++)f[h]=0;for(var g=0;g<n.length;g++){var p=n[g],x=o[p.source().id()],b=o[p.target().id()],w=sz(p,i.attributes);f[x*u+b]+=w,f[b*u+x]+=w}uz(f,u,i.multFactor),tA(f,u);for(var y=!0,E=0;y&&E<i.maxIterations;)y=!1,d=fz(f,u,i.expandFactor),f=cz(d,u,i.inflateFactor),dz(f,d,l,4)||(y=!0),E++;var C=vz(f,u,t,a);return C=gz(C),C},pz={markovClustering:jw,mcl:jw},yz=function(e){return e},nA=function(e,t){return Math.abs(t-e)},Yw=function(e,t,n){return e+nA(t,n)},Xw=function(e,t,n){return e+Math.pow(n-t,2)},mz=function(e){return Math.sqrt(e)},bz=function(e,t,n){return Math.max(e,nA(t,n))},zo=function(e,t,n,a,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:yz,s=a,u,l,f=0;f<e;f++)u=t(f),l=n(f),s=i(s,u,l);return o(s)},fo={euclidean:function(e,t,n){return e>=2?zo(e,t,n,0,Xw,mz):zo(e,t,n,0,Yw)},squaredEuclidean:function(e,t,n){return zo(e,t,n,0,Xw)},manhattan:function(e,t,n){return zo(e,t,n,0,Yw)},max:function(e,t,n){return zo(e,t,n,-1/0,bz)}};fo["squared-euclidean"]=fo.squaredEuclidean;fo.squaredeuclidean=fo.squaredEuclidean;function Cl(r,e,t,n,a,i){var o;return $r(r)?o=r:o=fo[r]||fo.euclidean,e===0&&$r(r)?o(a,i):o(e,t,n,a,i)}var wz=wt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),t0=function(e){return wz(e)},ol=function(e,t,n,a,i){var o=i!=="kMedoids",s=o?function(d){return n[d]}:function(d){return a[d](n)},u=function(h){return a[h](t)},l=n,f=t;return Cl(e,a.length,s,u,l,f)},rd=function(e,t,n){for(var a=n.length,i=new Array(a),o=new Array(a),s=new Array(t),u=null,l=0;l<a;l++)i[l]=e.min(n[l]).value,o[l]=e.max(n[l]).value;for(var f=0;f<t;f++){u=[];for(var d=0;d<a;d++)u[d]=Math.random()*(o[d]-i[d])+i[d];s[f]=u}return s},aA=function(e,t,n,a,i){for(var o=1/0,s=0,u=0;u<t.length;u++){var l=ol(n,e,t[u],a,i);l<o&&(o=l,s=u)}return s},iA=function(e,t,n){for(var a=[],i=null,o=0;o<t.length;o++)i=t[o],n[i.id()]===e&&a.push(i);return a},xz=function(e,t,n){return Math.abs(t-e)<=n},Ez=function(e,t,n){for(var a=0;a<e.length;a++)for(var i=0;i<e[a].length;i++){var o=Math.abs(e[a][i]-t[a][i]);if(o>n)return!1}return!0},Cz=function(e,t,n){for(var a=0;a<n;a++)if(e===t[a])return!0;return!1},Zw=function(e,t){var n=new Array(t);if(e.length<50)for(var a=0;a<t;a++){for(var i=e[Math.floor(Math.random()*e.length)];Cz(i,n,a);)i=e[Math.floor(Math.random()*e.length)];n[a]=i}else for(var o=0;o<t;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},Qw=function(e,t,n){for(var a=0,i=0;i<t.length;i++)a+=ol("manhattan",t[i],e,n,"kMedoids");return a},_z=function(e){var t=this.cy(),n=this.nodes(),a=null,i=t0(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=rd(n,i.k,i.attributes)):at(i.testCentroids)==="object"?u=i.testCentroids:u=rd(n,i.k,i.attributes):u=rd(n,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var d=0;d<n.length;d++)a=n[d],s[a.id()]=aA(a,u,i.distance,i.attributes,"kMeans");l=!1;for(var h=0;h<i.k;h++){var g=iA(h,n,s);if(g.length!==0){for(var p=i.attributes.length,x=u[h],b=new Array(p),w=new Array(p),y=0;y<p;y++){w[y]=0;for(var E=0;E<g.length;E++)a=g[E],w[y]+=i.attributes[y](a);b[y]=w[y]/g.length,xz(b[y],x[y],i.sensitivityThreshold)||(l=!0)}u[h]=b,o[h]=t.collection(g)}}f++}return o},Sz=function(e){var t=this.cy(),n=this.nodes(),a=null,i=t0(e),o=new Array(i.k),s,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(at(i.testCentroids)==="object"?s=i.testCentroids:s=Zw(n,i.k)):s=Zw(n,i.k);for(var d=!0,h=0;d&&h<i.maxIterations;){for(var g=0;g<n.length;g++)a=n[g],u[a.id()]=aA(a,s,i.distance,i.attributes,"kMedoids");d=!1;for(var p=0;p<s.length;p++){var x=iA(p,n,u);if(x.length!==0){f[p]=Qw(s[p],x,i.attributes);for(var b=0;b<x.length;b++)l=Qw(x[b],x,i.attributes),l<f[p]&&(f[p]=l,s[p]=x[b],d=!0);o[p]=t.collection(x)}}h++}return o},Tz=function(e,t,n,a,i){for(var o,s,u=0;u<t.length;u++)for(var l=0;l<e.length;l++)a[u][l]=Math.pow(n[u][l],i.m);for(var f=0;f<e.length;f++)for(var d=0;d<i.attributes.length;d++){o=0,s=0;for(var h=0;h<t.length;h++)o+=a[h][f]*i.attributes[d](t[h]),s+=a[h][f];e[f][d]=o/s}},Rz=function(e,t,n,a,i){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var s,u,l,f=2/(i.m-1),d=0;d<n.length;d++)for(var h=0;h<a.length;h++){s=0;for(var g=0;g<n.length;g++)u=ol(i.distance,a[h],n[d],i.attributes,"cmeans"),l=ol(i.distance,a[h],n[g],i.attributes,"cmeans"),s+=Math.pow(u/l,f);e[h][d]=1/s}},Az=function(e,t,n,a){for(var i=new Array(n.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<t.length;l++){s=-1/0,u=-1;for(var f=0;f<t[0].length;f++)t[l][f]>s&&(s=t[l][f],u=f);i[u].push(e[l])}for(var d=0;d<i.length;d++)i[d]=a.collection(i[d]);return i},Jw=function(e){var t=this.cy(),n=this.nodes(),a=t0(e),i,o,s,u,l;u=new Array(n.length);for(var f=0;f<n.length;f++)u[f]=new Array(a.k);s=new Array(n.length);for(var d=0;d<n.length;d++)s[d]=new Array(a.k);for(var h=0;h<n.length;h++){for(var g=0,p=0;p<a.k;p++)s[h][p]=Math.random(),g+=s[h][p];for(var x=0;x<a.k;x++)s[h][x]=s[h][x]/g}o=new Array(a.k);for(var b=0;b<a.k;b++)o[b]=new Array(a.attributes.length);l=new Array(n.length);for(var w=0;w<n.length;w++)l[w]=new Array(a.k);for(var y=!0,E=0;y&&E<a.maxIterations;)y=!1,Tz(o,n,s,l,a),Rz(s,u,o,n,a),Ez(s,u,a.sensitivityThreshold)||(y=!0),E++;return i=Az(n,s,a,t),{clusters:i,degreeOfMembership:s}},Pz={kMeans:_z,kMedoids:Sz,fuzzyCMeans:Jw,fcm:Jw},Iz=wt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Dz={single:"min",complete:"max"},Bz=function(e){var t=Iz(e),n=Dz[t.linkage];return n!=null&&(t.linkage=n),t},ex=function(e,t,n,a,i){for(var o=0,s=1/0,u,l=i.attributes,f=function(P,I){return Cl(i.distance,l.length,function(D){return l[D](P)},function(D){return l[D](I)},P,I)},d=0;d<e.length;d++){var h=e[d].key,g=n[h][a[h]];g<s&&(o=h,s=g)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var p=t[o],x=t[a[o]],b;i.mode==="dendrogram"?b={left:p,right:x,key:p.key}:b={value:p.value.concat(x.value),key:p.key},e[p.index]=b,e.splice(x.index,1),t[p.key]=b;for(var w=0;w<e.length;w++){var y=e[w];p.key===y.key?u=1/0:i.linkage==="min"?(u=n[p.key][y.key],n[p.key][y.key]>n[x.key][y.key]&&(u=n[x.key][y.key])):i.linkage==="max"?(u=n[p.key][y.key],n[p.key][y.key]<n[x.key][y.key]&&(u=n[x.key][y.key])):i.linkage==="mean"?u=(n[p.key][y.key]*p.size+n[x.key][y.key]*x.size)/(p.size+x.size):i.mode==="dendrogram"?u=f(y.value,p.value):u=f(y.value[0],p.value[0]),n[p.key][y.key]=n[y.key][p.key]=u}for(var E=0;E<e.length;E++){var C=e[E].key;if(a[C]===p.key||a[C]===x.key){for(var S=C,R=0;R<e.length;R++){var _=e[R].key;n[C][_]<n[C][S]&&(S=_)}a[C]=S}e[E].index=E}return p.key=x.key=p.index=x.index=null,!0},eo=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&eo(e.left,t),e.right&&eo(e.right,t)))},Sm=function(e,t){if(!e)return"";if(e.left&&e.right){var n=Sm(e.left,t),a=Sm(e.right,t),i=t.add({group:"nodes",data:{id:n+","+a}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Tm=function(e,t,n){if(!e)return[];var a=[],i=[],o=[];return t===0?(e.left&&eo(e.left,a),e.right&&eo(e.right,i),o=a.concat(i),[n.collection(o)]):t===1?e.value?[n.collection(e.value)]:(e.left&&eo(e.left,a),e.right&&eo(e.right,i),[n.collection(a),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(a=Tm(e.left,t-1,n)),e.right&&(i=Tm(e.right,t-1,n)),a.concat(i))},rx=function(e){for(var t=this.cy(),n=this.nodes(),a=Bz(e),i=a.attributes,o=function(E,C){return Cl(a.distance,i.length,function(S){return i[S](E)},function(S){return i[S](C)},E,C)},s=[],u=[],l=[],f=[],d=0;d<n.length;d++){var h={value:a.mode==="dendrogram"?n[d]:[n[d]],key:d,index:d};s[d]=h,f[d]=h,u[d]=[],l[d]=0}for(var g=0;g<s.length;g++)for(var p=0;p<=g;p++){var x=void 0;a.mode==="dendrogram"?x=g===p?1/0:o(s[g].value,s[p].value):x=g===p?1/0:o(s[g].value[0],s[p].value[0]),u[g][p]=x,u[p][g]=x,x<u[g][l[g]]&&(l[g]=p)}for(var b=ex(s,f,u,l,a);b;)b=ex(s,f,u,l,a);var w;return a.mode==="dendrogram"?(w=Tm(s[0],a.dendrogramDepth,t),a.addDendrogram&&Sm(s[0],t)):(w=new Array(s.length),s.forEach(function(y,E){y.key=y.index=null,w[E]=t.collection(y.value)})),w},Mz={hierarchicalClustering:rx,hca:rx},Lz=wt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Oz=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||kr("Damping must range on [0.5, 1). Got: ".concat(t));var a=["median","mean","min","max"];return a.some(function(i){return i===n})||qe(n)||kr("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(n)),Lz(e)},kz=function(e,t,n,a){var i=function(s,u){return a[u](s)};return-Cl(e,a.length,function(o){return i(t,o)},function(o){return i(n,o)},t,n)},qz=function(e,t){var n=null;return t==="median"?n=OF(e):t==="mean"?n=LF(e):t==="min"?n=BF(e):t==="max"?n=MF(e):n=t,n},Nz=function(e,t,n){for(var a=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&a.push(i);return a},tx=function(e,t,n){for(var a=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<n.length;u++){var l=n[u];t[i*e+l]>s&&(o=l,s=t[i*e+l])}o>0&&a.push(o)}for(var f=0;f<n.length;f++)a[n[f]]=n[f];return a},Fz=function(e,t,n){for(var a=tx(e,t,n),i=0;i<n.length;i++){for(var o=[],s=0;s<a.length;s++)a[s]===n[i]&&o.push(s);for(var u=-1,l=-1/0,f=0;f<o.length;f++){for(var d=0,h=0;h<o.length;h++)d+=t[o[h]*e+o[f]];d>l&&(u=f,l=d)}n[i]=o[u]}return a=tx(e,t,n),a},nx=function(e){for(var t=this.cy(),n=this.nodes(),a=Oz(e),i={},o=0;o<n.length;o++)i[n[o].id()]=o;var s,u,l,f,d,h;s=n.length,u=s*s,l=new Array(u);for(var g=0;g<u;g++)l[g]=-1/0;for(var p=0;p<s;p++)for(var x=0;x<s;x++)p!==x&&(l[p*s+x]=kz(a.distance,n[p],n[x],a.attributes));f=qz(l,a.preference);for(var b=0;b<s;b++)l[b*s+b]=f;d=new Array(u);for(var w=0;w<u;w++)d[w]=0;h=new Array(u);for(var y=0;y<u;y++)h[y]=0;for(var E=new Array(s),C=new Array(s),S=new Array(s),R=0;R<s;R++)E[R]=0,C[R]=0,S[R]=0;for(var _=new Array(s*a.minIterations),A=0;A<_.length;A++)_[A]=0;var P;for(P=0;P<a.maxIterations;P++){for(var I=0;I<s;I++){for(var D=-1/0,L=-1/0,M=-1,q=0,N=0;N<s;N++)E[N]=d[I*s+N],q=h[I*s+N]+l[I*s+N],q>=D?(L=D,D=q,M=N):q>L&&(L=q);for(var W=0;W<s;W++)d[I*s+W]=(1-a.damping)*(l[I*s+W]-D)+a.damping*E[W];d[I*s+M]=(1-a.damping)*(l[I*s+M]-L)+a.damping*E[M]}for(var V=0;V<s;V++){for(var $=0,X=0;X<s;X++)E[X]=h[X*s+V],C[X]=Math.max(0,d[X*s+V]),$+=C[X];$-=C[V],C[V]=d[V*s+V],$+=C[V];for(var ee=0;ee<s;ee++)h[ee*s+V]=(1-a.damping)*Math.min(0,$-C[ee])+a.damping*E[ee];h[V*s+V]=(1-a.damping)*($-C[V])+a.damping*E[V]}for(var K=0,j=0;j<s;j++){var fe=h[j*s+j]+d[j*s+j]>0?1:0;_[P%a.minIterations*s+j]=fe,K+=fe}if(K>0&&(P>=a.minIterations-1||P==a.maxIterations-1)){for(var G=0,z=0;z<s;z++){S[z]=0;for(var Y=0;Y<a.minIterations;Y++)S[z]+=_[Y*s+z];(S[z]===0||S[z]===a.minIterations)&&G++}if(G===s)break}}for(var te=Nz(s,d,h),ue=Fz(s,l,te),oe={},Z=0;Z<te.length;Z++)oe[te[Z]]=[];for(var Q=0;Q<n.length;Q++){var ie=i[n[Q].id()],de=ue[ie];de!=null&&oe[de].push(n[Q])}for(var we=new Array(te.length),Ae=0;Ae<te.length;Ae++)we[Ae]=t.collection(oe[te[Ae]]);return we},zz={affinityPropagation:nx,ap:nx},$z=wt({root:void 0,directed:!1}),Vz={hierholzer:function(e){if(!yr(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=$z(e),a=n.root,i=n.directed,o=this,s=!1,u,l,f;a&&(f=Ye(a)?this.filter(a)[0].id():a[0].id());var d={},h={};i?o.forEach(function(y){var E=y.id();if(y.isNode()){var C=y.indegree(!0),S=y.outdegree(!0),R=C-S,_=S-C;R==1?u?s=!0:u=E:_==1?l?s=!0:l=E:(_>1||R>1)&&(s=!0),d[E]=[],y.outgoers().forEach(function(A){A.isEdge()&&d[E].push(A.id())})}else h[E]=[void 0,y.target().id()]}):o.forEach(function(y){var E=y.id();if(y.isNode()){var C=y.degree(!0);C%2&&(u?l?s=!0:l=E:u=E),d[E]=[],y.connectedEdges().forEach(function(S){return d[E].push(S.id())})}else h[E]=[y.source().id(),y.target().id()]});var g={found:!1,trail:void 0};if(s)return g;if(l&&u)if(i){if(f&&l!=f)return g;f=l}else{if(f&&l!=f&&u!=f)return g;f||(f=l)}else f||(f=o[0].id());var p=function(E){for(var C=E,S=[E],R,_,A;d[C].length;)R=d[C].shift(),_=h[R][0],A=h[R][1],C!=A?(d[A]=d[A].filter(function(P){return P!=R}),C=A):!i&&C!=_&&(d[_]=d[_].filter(function(P){return P!=R}),C=_),S.unshift(R),S.unshift(C);return S},x=[],b=[];for(b=p(f);b.length!=1;)d[b[0]].length==0?(x.unshift(o.getElementById(b.shift())),x.unshift(o.getElementById(b.shift()))):b=p(b.shift()).concat(b);x.unshift(o.getElementById(b.shift()));for(var w in d)if(d[w].length)return g;return g.found=!0,g.trail=this.spawn(x,!0),g}},Iu=function(){var e=this,t={},n=0,a=0,i=[],o=[],s={},u=function(h,g){for(var p=o.length-1,x=[],b=e.spawn();o[p].x!=h||o[p].y!=g;)x.push(o.pop().edge),p--;x.push(o.pop().edge),x.forEach(function(w){var y=w.connectedNodes().intersection(e);b.merge(w),y.forEach(function(E){var C=E.id(),S=E.connectedEdges().intersection(e);b.merge(E),t[C].cutVertex?b.merge(S.filter(function(R){return R.isLoop()})):b.merge(S)})}),i.push(b)},l=function(h,g,p){h===p&&(a+=1),t[g]={id:n,low:n++,cutVertex:!1};var x=e.getElementById(g).connectedEdges().intersection(e);if(x.size()===0)i.push(e.spawn(e.getElementById(g)));else{var b,w,y,E;x.forEach(function(C){b=C.source().id(),w=C.target().id(),y=b===g?w:b,y!==p&&(E=C.id(),s[E]||(s[E]=!0,o.push({x:g,y,edge:C})),y in t?t[g].low=Math.min(t[g].low,t[y].id):(l(h,y,g),t[g].low=Math.min(t[g].low,t[y].low),t[g].id<=t[y].low&&(t[g].cutVertex=!0,u(g,y))))})}};e.forEach(function(d){if(d.isNode()){var h=d.id();h in t||(a=0,l(h,h),t[h].cutVertex=a>1)}});var f=Object.keys(t).filter(function(d){return t[d].cutVertex}).map(function(d){return e.getElementById(d)});return{cut:e.spawn(f),components:i}},Gz={hopcroftTarjanBiconnected:Iu,htbc:Iu,htb:Iu,hopcroftTarjanBiconnectedComponents:Iu},Du=function(){var e=this,t={},n=0,a=[],i=[],o=e.spawn(e),s=function(l){i.push(l),t[l]={index:n,low:n++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(x){var b=x.target().id();b!==l&&(b in t||s(b),t[b].explored||(t[l].low=Math.min(t[l].low,t[b].low)))}),t[l].index===t[l].low){for(var d=e.spawn();;){var h=i.pop();if(d.merge(e.getElementById(h)),t[h].low=t[l].index,t[h].explored=!0,h===l)break}var g=d.edgesWith(d),p=d.merge(g);a.push(p),o=o.difference(p)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||s(l)}}),{cut:o,components:a}},Wz={tarjanStronglyConnected:Du,tsc:Du,tscc:Du,tarjanStronglyConnectedComponents:Du},oA={};[cs,wF,xF,CF,SF,RF,IF,nz,oo,so,_m,pz,Pz,Mz,zz,Vz,Gz,Wz].forEach(function(r){Ze(oA,r)});/*!
|
|
31
|
-
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
32
|
-
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
33
|
-
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
34
|
-
*/var sA=0,uA=1,lA=2,Sn=function(e){if(!(this instanceof Sn))return new Sn(e);this.id="Thenable/1.0.7",this.state=sA,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Sn.prototype={fulfill:function(e){return ax(this,uA,"fulfillValue",e)},reject:function(e){return ax(this,lA,"rejectReason",e)},then:function(e,t){var n=this,a=new Sn;return n.onFulfilled.push(ox(e,a,"fulfill")),n.onRejected.push(ox(t,a,"reject")),fA(n),a.proxy}};var ax=function(e,t,n,a){return e.state===sA&&(e.state=t,e[n]=a,fA(e)),e},fA=function(e){e.state===uA?ix(e,"onFulfilled",e.fulfillValue):e.state===lA&&ix(e,"onRejected",e.rejectReason)},ix=function(e,t,n){if(e[t].length!==0){var a=e[t];e[t]=[];var i=function(){for(var s=0;s<a.length;s++)a[s](n)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},ox=function(e,t,n){return function(a){if(typeof e!="function")t[n].call(t,a);else{var i;try{i=e(a)}catch(o){t.reject(o);return}cA(t,i)}}},cA=function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(at(t)==="object"&&t!==null||typeof t=="function")try{n=t.then}catch(i){e.reject(i);return}if(typeof n=="function"){var a=!1;try{n.call(t,function(i){a||(a=!0,i===t?e.reject(new TypeError("circular thenable chain")):cA(e,i))},function(i){a||(a=!0,e.reject(i))})}catch(i){a||e.reject(i)}return}e.fulfill(t)};Sn.all=function(r){return new Sn(function(e,t){for(var n=new Array(r.length),a=0,i=function(u,l){n[u]=l,a++,a===r.length&&e(n)},o=0;o<r.length;o++)(function(s){var u=r[s],l=u!=null&&u.then!=null;if(l)u.then(function(d){i(s,d)},function(d){t(d)});else{var f=u;i(s,f)}})(o)})};Sn.resolve=function(r){return new Sn(function(e,t){e(r)})};Sn.reject=function(r){return new Sn(function(e,t){t(r)})};var po=typeof Promise<"u"?Promise:Sn,Rm=function(e,t,n){var a=Hm(e),i=!a,o=this._private=Ze({duration:1e3},t,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&$r(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(a){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},vi=Rm.prototype;Ze(vi,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;e.queue?t=n.queue:t=n.current,t.push(this),Jt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(l,f){var d=e[l];d!=null&&(e[l]=e[f],e[f]=d)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var a=0;a<e.style.length;a++){var i=e.style[a],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[a]=s}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case"frame":n=t.frames;break;default:case"complete":case"completed":n=t.completes}return new po(function(a,i){n.push(function(){a()})})}});vi.complete=vi.completed;vi.run=vi.play;vi.running=vi.playing;var Uz={animated:function(){return function(){var t=this,n=t.length!==void 0,a=n?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=a[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var t=this,n=t.length!==void 0,a=n?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<a.length;o++){var s=a[o];s._private.animation.queue=[]}return this}},delay:function(){return function(t,n){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:t,duration:t,complete:n}):this}},delayAnimation:function(){return function(t,n){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:t,duration:t,complete:n}):this}},animation:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var f=s.style();t=Ze({},t,n);var d=Object.keys(t).length===0;if(d)return new Rm(o[0],t);switch(t.duration===void 0&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200;break}if(l&&(t.style=f.getPropsList(t.style||t.css),t.css=void 0),l&&t.renderedPosition!=null){var h=t.renderedPosition,g=s.pan(),p=s.zoom();t.position=XR(h,p,g)}if(u&&t.panBy!=null){var x=t.panBy,b=s.pan();t.pan={x:b.x+x.x,y:b.y+x.y}}var w=t.center||t.centre;if(u&&w!=null){var y=s.getCenterPan(w.eles,t.zoom);y!=null&&(t.pan=y)}if(u&&t.fit!=null){var E=t.fit,C=s.getFitViewport(E.eles||E.boundingBox,E.padding);C!=null&&(t.pan=C.pan,t.zoom=C.zoom)}if(u&&yr(t.zoom)){var S=s.getZoomedViewport(t.zoom);S!=null?(S.zoomed&&(t.zoom=S.zoom),S.panned&&(t.pan=S.pan)):t.zoom=null}return new Rm(o[0],t)}},animate:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return this;n&&(t=Ze({},t,n));for(var u=0;u<o.length;u++){var l=o[u],f=l.animated()&&(t.queue===void 0||t.queue),d=l.animation(t,f?{queue:!0}:void 0);d.play()}return this}},stop:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var l=o[u],f=l._private,d=f.animation.current,h=0;h<d.length;h++){var g=d[h],p=g._private;n&&(p.duration=0)}t&&(f.animation.queue=[]),n||(f.animation.current=[])}return s.notify("draw"),this}}},td,sx;function _l(){if(sx)return td;sx=1;var r=Array.isArray;return td=r,td}var nd,ux;function Hz(){if(ux)return nd;ux=1;var r=_l(),e=_s(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,o){if(r(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:n.test(i)||!t.test(i)||o!=null&&i in Object(o)}return nd=a,nd}var ad,lx;function Kz(){if(lx)return ad;lx=1;var r=$R(),e=Cs(),t="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=r(s);return u==n||u==a||u==t||u==i}return ad=o,ad}var id,fx;function jz(){if(fx)return id;fx=1;var r=wl(),e=r["__core-js_shared__"];return id=e,id}var od,cx;function Yz(){if(cx)return od;cx=1;var r=jz(),e=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function t(n){return!!e&&e in n}return od=t,od}var sd,dx;function Xz(){if(dx)return sd;dx=1;var r=Function.prototype,e=r.toString;function t(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return sd=t,sd}var ud,vx;function Zz(){if(vx)return ud;vx=1;var r=Kz(),e=Yz(),t=Cs(),n=Xz(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,f=RegExp("^"+u.call(l).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(h){if(!t(h)||e(h))return!1;var g=r(h)?f:i;return g.test(n(h))}return ud=d,ud}var ld,hx;function Qz(){if(hx)return ld;hx=1;function r(e,t){return e==null?void 0:e[t]}return ld=r,ld}var fd,gx;function n0(){if(gx)return fd;gx=1;var r=Zz(),e=Qz();function t(n,a){var i=e(n,a);return r(i)?i:void 0}return fd=t,fd}var cd,px;function Sl(){if(px)return cd;px=1;var r=n0(),e=r(Object,"create");return cd=e,cd}var dd,yx;function Jz(){if(yx)return dd;yx=1;var r=Sl();function e(){this.__data__=r?r(null):{},this.size=0}return dd=e,dd}var vd,mx;function e5(){if(mx)return vd;mx=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return vd=r,vd}var hd,bx;function r5(){if(bx)return hd;bx=1;var r=Sl(),e="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function a(i){var o=this.__data__;if(r){var s=o[i];return s===e?void 0:s}return n.call(o,i)?o[i]:void 0}return hd=a,hd}var gd,wx;function t5(){if(wx)return gd;wx=1;var r=Sl(),e=Object.prototype,t=e.hasOwnProperty;function n(a){var i=this.__data__;return r?i[a]!==void 0:t.call(i,a)}return gd=n,gd}var pd,xx;function n5(){if(xx)return pd;xx=1;var r=Sl(),e="__lodash_hash_undefined__";function t(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=r&&a===void 0?e:a,this}return pd=t,pd}var yd,Ex;function a5(){if(Ex)return yd;Ex=1;var r=Jz(),e=e5(),t=r5(),n=t5(),a=n5();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,yd=i,yd}var md,Cx;function i5(){if(Cx)return md;Cx=1;function r(){this.__data__=[],this.size=0}return md=r,md}var bd,_x;function dA(){if(_x)return bd;_x=1;function r(e,t){return e===t||e!==e&&t!==t}return bd=r,bd}var wd,Sx;function Tl(){if(Sx)return wd;Sx=1;var r=dA();function e(t,n){for(var a=t.length;a--;)if(r(t[a][0],n))return a;return-1}return wd=e,wd}var xd,Tx;function o5(){if(Tx)return xd;Tx=1;var r=Tl(),e=Array.prototype,t=e.splice;function n(a){var i=this.__data__,o=r(i,a);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():t.call(i,o,1),--this.size,!0}return xd=n,xd}var Ed,Rx;function s5(){if(Rx)return Ed;Rx=1;var r=Tl();function e(t){var n=this.__data__,a=r(n,t);return a<0?void 0:n[a][1]}return Ed=e,Ed}var Cd,Ax;function u5(){if(Ax)return Cd;Ax=1;var r=Tl();function e(t){return r(this.__data__,t)>-1}return Cd=e,Cd}var _d,Px;function l5(){if(Px)return _d;Px=1;var r=Tl();function e(t,n){var a=this.__data__,i=r(a,t);return i<0?(++this.size,a.push([t,n])):a[i][1]=n,this}return _d=e,_d}var Sd,Ix;function f5(){if(Ix)return Sd;Ix=1;var r=i5(),e=o5(),t=s5(),n=u5(),a=l5();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Sd=i,Sd}var Td,Dx;function c5(){if(Dx)return Td;Dx=1;var r=n0(),e=wl(),t=r(e,"Map");return Td=t,Td}var Rd,Bx;function d5(){if(Bx)return Rd;Bx=1;var r=a5(),e=f5(),t=c5();function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return Rd=n,Rd}var Ad,Mx;function v5(){if(Mx)return Ad;Mx=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return Ad=r,Ad}var Pd,Lx;function Rl(){if(Lx)return Pd;Lx=1;var r=v5();function e(t,n){var a=t.__data__;return r(n)?a[typeof n=="string"?"string":"hash"]:a.map}return Pd=e,Pd}var Id,Ox;function h5(){if(Ox)return Id;Ox=1;var r=Rl();function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}return Id=e,Id}var Dd,kx;function g5(){if(kx)return Dd;kx=1;var r=Rl();function e(t){return r(this,t).get(t)}return Dd=e,Dd}var Bd,qx;function p5(){if(qx)return Bd;qx=1;var r=Rl();function e(t){return r(this,t).has(t)}return Bd=e,Bd}var Md,Nx;function y5(){if(Nx)return Md;Nx=1;var r=Rl();function e(t,n){var a=r(this,t),i=a.size;return a.set(t,n),this.size+=a.size==i?0:1,this}return Md=e,Md}var Ld,Fx;function m5(){if(Fx)return Ld;Fx=1;var r=d5(),e=h5(),t=g5(),n=p5(),a=y5();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Ld=i,Ld}var Od,zx;function b5(){if(zx)return Od;zx=1;var r=m5(),e="Expected a function";function t(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(e);var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=n.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(t.Cache||r),i}return t.Cache=r,Od=t,Od}var kd,$x;function w5(){if($x)return kd;$x=1;var r=b5(),e=500;function t(n){var a=r(n,function(o){return i.size===e&&i.clear(),o}),i=a.cache;return a}return kd=t,kd}var qd,Vx;function vA(){if(Vx)return qd;Vx=1;var r=w5(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(e,function(o,s,u,l){i.push(u?l.replace(t,"$1"):s||o)}),i});return qd=n,qd}var Nd,Gx;function hA(){if(Gx)return Nd;Gx=1;function r(e,t){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}return Nd=r,Nd}var Fd,Wx;function x5(){if(Wx)return Fd;Wx=1;var r=jm(),e=hA(),t=_l(),n=_s(),a=r?r.prototype:void 0,i=a?a.toString:void 0;function o(s){if(typeof s=="string")return s;if(t(s))return e(s,o)+"";if(n(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return Fd=o,Fd}var zd,Ux;function gA(){if(Ux)return zd;Ux=1;var r=x5();function e(t){return t==null?"":r(t)}return zd=e,zd}var $d,Hx;function pA(){if(Hx)return $d;Hx=1;var r=_l(),e=Hz(),t=vA(),n=gA();function a(i,o){return r(i)?i:e(i,o)?[i]:t(n(i))}return $d=a,$d}var Vd,Kx;function a0(){if(Kx)return Vd;Kx=1;var r=_s();function e(t){if(typeof t=="string"||r(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return Vd=e,Vd}var Gd,jx;function E5(){if(jx)return Gd;jx=1;var r=pA(),e=a0();function t(n,a){a=r(a,n);for(var i=0,o=a.length;n!=null&&i<o;)n=n[e(a[i++])];return i&&i==o?n:void 0}return Gd=t,Gd}var Wd,Yx;function C5(){if(Yx)return Wd;Yx=1;var r=E5();function e(t,n,a){var i=t==null?void 0:r(t,n);return i===void 0?a:i}return Wd=e,Wd}var _5=C5(),S5=Es(_5),Ud,Xx;function T5(){if(Xx)return Ud;Xx=1;var r=n0(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}})();return Ud=e,Ud}var Hd,Zx;function R5(){if(Zx)return Hd;Zx=1;var r=T5();function e(t,n,a){n=="__proto__"&&r?r(t,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):t[n]=a}return Hd=e,Hd}var Kd,Qx;function A5(){if(Qx)return Kd;Qx=1;var r=R5(),e=dA(),t=Object.prototype,n=t.hasOwnProperty;function a(i,o,s){var u=i[o];(!(n.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&r(i,o,s)}return Kd=a,Kd}var jd,Jx;function P5(){if(Jx)return jd;Jx=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(n,a){var i=typeof n;return a=a??r,!!a&&(i=="number"||i!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<a}return jd=t,jd}var Yd,eE;function I5(){if(eE)return Yd;eE=1;var r=A5(),e=pA(),t=P5(),n=Cs(),a=a0();function i(o,s,u,l){if(!n(o))return o;s=e(s,o);for(var f=-1,d=s.length,h=d-1,g=o;g!=null&&++f<d;){var p=a(s[f]),x=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(f!=h){var b=g[p];x=l?l(b,p,g):void 0,x===void 0&&(x=n(b)?b:t(s[f+1])?[]:{})}r(g,p,x),g=g[p]}return o}return Yd=i,Yd}var Xd,rE;function D5(){if(rE)return Xd;rE=1;var r=I5();function e(t,n,a){return t==null?t:r(t,n,a)}return Xd=e,Xd}var B5=D5(),M5=Es(B5),Zd,tE;function L5(){if(tE)return Zd;tE=1;function r(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}return Zd=r,Zd}var Qd,nE;function O5(){if(nE)return Qd;nE=1;var r=hA(),e=L5(),t=_l(),n=_s(),a=vA(),i=a0(),o=gA();function s(u){return t(u)?r(u,i):n(u)?[u]:e(a(o(u)))}return Qd=s,Qd}var k5=O5(),q5=Es(k5),N5={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return e=Ze({},t,e),function(a,i){var o=e,s=this,u=s.length!==void 0,l=u?s:[s],f=u?s[0]:s;if(Ye(a)){var d=a.indexOf(".")!==-1,h=d&&q5(a);if(o.allowGetting&&i===void 0){var g;return f&&(o.beforeGet(f),h&&f._private[o.field][a]===void 0?g=S5(f._private[o.field],h):g=f._private[o.field][a]),g}else if(o.allowSetting&&i!==void 0){var p=!o.immutableKeys[a];if(p){var x=DR({},a,i);o.beforeSet(s,x);for(var b=0,w=l.length;b<w;b++){var y=l[b];o.canSet(y)&&(h&&f._private[o.field][a]===void 0?M5(y._private[o.field],h,i):y._private[o.field][a]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&yr(a)){var E=a,C,S,R=Object.keys(E);o.beforeSet(s,E);for(var _=0;_<R.length;_++){C=R[_],S=E[C];var A=!o.immutableKeys[C];if(A)for(var P=0;P<l.length;P++){var I=l[P];o.canSet(I)&&(I._private[o.field][C]=S)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&$r(a)){var D=a;s.on(o.bindingEvent,D)}else if(o.allowGetting&&a===void 0){var L;return f&&(o.beforeGet(f),L=f._private[o.field]),L}return s}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=Ze({},t,e),function(a){var i=e,o=this,s=o.length!==void 0,u=s?o:[o];if(Ye(a)){for(var l=a.split(/\s+/),f=l.length,d=0;d<f;d++){var h=l[d];if(!Da(h)){var g=!i.immutableKeys[h];if(g)for(var p=0,x=u.length;p<x;p++)u[p]._private[i.field][h]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(a===void 0){for(var b=0,w=u.length;b<w;b++)for(var y=u[b]._private[i.field],E=Object.keys(y),C=0;C<E.length;C++){var S=E[C],R=!i.immutableKeys[S];R&&(y[S]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},F5={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(n,a){var i=this,o=Array.prototype.slice.call(arguments,0);return new po(function(s,u){var l=function(g){i.off.apply(i,d),s(g)},f=o.concat([l]),d=f.concat([]);i.on.apply(i,f)})}}},Er={};[Uz,N5,F5].forEach(function(r){Ze(Er,r)});var z5={animate:Er.animate(),animation:Er.animation(),animated:Er.animated(),clearQueue:Er.clearQueue(),delay:Er.delay(),delayAnimation:Er.delayAnimation(),stop:Er.stop()},Vu={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(p){return n.push(p)}),n}else Tr(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new go(e),o=0;o<t.length;o++){for(var s=t[o],u=s._private,l=u.classes,f=!1,d=0;d<e.length;d++){var h=e[d],g=l.has(h);if(!g){f=!0;break}}f||(f=l.size!==e.length),f&&(u.classes=i,a.push(s))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Tr(e)||(e=e.match(/\S+/g)||[]);for(var n=this,a=t===void 0,i=[],o=0,s=n.length;o<s;o++)for(var u=n[o],l=u._private.classes,f=!1,d=0;d<e.length;d++){var h=e[d],g=l.has(h),p=!1;t||a&&!g?(l.add(h),p=!0):(!t||a&&g)&&(l.delete(h),p=!0),!f&&p&&(i.push(u),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Vu.className=Vu.classNames=Vu.classes;var gr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:nt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};gr.variable="(?:[\\w-.]|(?:\\\\"+gr.metaChar+"))+";gr.className="(?:[\\w-]|(?:\\\\"+gr.metaChar+"))+";gr.value=gr.string+"|"+gr.number;gr.id=gr.variable;(function(){var r,e,t;for(r=gr.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],gr.comparatorOp+="|@"+e;for(r=gr.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],!(e.indexOf("!")>=0)&&e!=="="&&(gr.comparatorOp+="|\\!"+e)})();var _r=function(){return{checks:[]}},Ue={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Am=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return NN(r.selector,e.selector)}),$5=(function(){for(var r={},e,t=0;t<Am.length;t++)e=Am[t],r[e.selector]=e.matches;return r})(),V5=function(e,t){return $5[e](t)},G5="("+Am.map(function(r){return r.selector}).join("|")+")",Gi=function(e){return e.replace(new RegExp("\\\\("+gr.metaChar+")","g"),function(t,n){return n})},xa=function(e,t,n){e[e.length-1]=n},Pm=[{name:"group",query:!0,regex:"("+gr.group+")",populate:function(e,t,n){var a=Xr(n,1),i=a[0];t.checks.push({type:Ue.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:G5,populate:function(e,t,n){var a=Xr(n,1),i=a[0];t.checks.push({type:Ue.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+gr.id+")",populate:function(e,t,n){var a=Xr(n,1),i=a[0];t.checks.push({type:Ue.ID,value:Gi(i)})}},{name:"className",query:!0,regex:"\\.("+gr.className+")",populate:function(e,t,n){var a=Xr(n,1),i=a[0];t.checks.push({type:Ue.CLASS,value:Gi(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+gr.variable+")\\s*\\]",populate:function(e,t,n){var a=Xr(n,1),i=a[0];t.checks.push({type:Ue.DATA_EXIST,field:Gi(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+gr.variable+")\\s*("+gr.comparatorOp+")\\s*("+gr.value+")\\s*\\]",populate:function(e,t,n){var a=Xr(n,3),i=a[0],o=a[1],s=a[2],u=new RegExp("^"+gr.string+"$").exec(s)!=null;u?s=s.substring(1,s.length-1):s=parseFloat(s),t.checks.push({type:Ue.DATA_COMPARE,field:Gi(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+gr.boolOp+")\\s*("+gr.variable+")\\s*\\]",populate:function(e,t,n){var a=Xr(n,2),i=a[0],o=a[1];t.checks.push({type:Ue.DATA_BOOL,field:Gi(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+gr.meta+")\\s*("+gr.comparatorOp+")\\s*("+gr.number+")\\s*\\]\\]",populate:function(e,t,n){var a=Xr(n,3),i=a[0],o=a[1],s=a[2];t.checks.push({type:Ue.META_COMPARE,field:Gi(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:gr.separator,populate:function(e,t){var n=e.currentSubject,a=e.edgeCount,i=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=a,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=_r();return s}},{name:"directedEdge",separator:!0,regex:gr.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=t,i=_r();return n.checks.push({type:Ue.DIRECTED_EDGE,source:a,target:i}),xa(e,t,n),e.edgeCount++,i}else{var o=_r(),s=t,u=_r();return o.checks.push({type:Ue.NODE_SOURCE,source:s,target:u}),xa(e,t,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:gr.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=t,i=_r();return n.checks.push({type:Ue.UNDIRECTED_EDGE,nodes:[a,i]}),xa(e,t,n),e.edgeCount++,i}else{var o=_r(),s=t,u=_r();return o.checks.push({type:Ue.NODE_NEIGHBOR,node:s,neighbor:u}),xa(e,t,o),u}}},{name:"child",separator:!0,regex:gr.child,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=_r(),i=e[e.length-1];return n.checks.push({type:Ue.CHILD,parent:i,child:a}),xa(e,t,n),e.compoundCount++,a}else if(e.currentSubject===t){var o=_r(),s=e[e.length-1],u=_r(),l=_r(),f=_r(),d=_r();return o.checks.push({type:Ue.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:Ue.TRUE}],d.checks.push({type:Ue.TRUE}),u.checks.push({type:Ue.PARENT,parent:d,child:f}),xa(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var h=_r(),g=_r(),p=[{type:Ue.PARENT,parent:h,child:g}];return h.checks=t.checks,t.checks=p,e.compoundCount++,g}}},{name:"descendant",separator:!0,regex:gr.descendant,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=_r(),i=e[e.length-1];return n.checks.push({type:Ue.DESCENDANT,ancestor:i,descendant:a}),xa(e,t,n),e.compoundCount++,a}else if(e.currentSubject===t){var o=_r(),s=e[e.length-1],u=_r(),l=_r(),f=_r(),d=_r();return o.checks.push({type:Ue.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:Ue.TRUE}],d.checks.push({type:Ue.TRUE}),u.checks.push({type:Ue.ANCESTOR,ancestor:d,descendant:f}),xa(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var h=_r(),g=_r(),p=[{type:Ue.ANCESTOR,ancestor:h,descendant:g}];return h.checks=t.checks,t.checks=p,e.compoundCount++,g}}},{name:"subject",modifier:!0,regex:gr.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Cr("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1],a=n.checks[0],i=a==null?null:a.type;i===Ue.DIRECTED_EDGE?a.type=Ue.NODE_TARGET:i===Ue.UNDIRECTED_EDGE&&(a.type=Ue.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];Pm.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var W5=function(e){for(var t,n,a,i=0;i<Pm.length;i++){var o=Pm[i],s=o.name,u=e.match(o.regexObj);if(u!=null){n=u,t=o,a=s;var l=u[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:a,remaining:e}},U5=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},H5=function(e){var t=this,n=t.inputText=e,a=t[0]=_r();for(t.length=1,n=U5(n);;){var i=W5(n);if(i.expr==null)return Cr("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(t,a,o);if(s===!1)return!1;if(s!=null&&(a=s),n=i.remaining,n.match(/^\s*$/))break}var u=t[t.length-1];t.currentSubject!=null&&(u.subject=t.currentSubject),u.edgeCount=t.edgeCount,u.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var f=t[l];if(f.compoundCount>0&&f.edgeCount>0)return Cr("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Cr("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Cr("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},K5=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},t=function(f){return Ye(f)?'"'+f+'"':e(f)},n=function(f){return" "+f+" "},a=function(f,d){var h=f.type,g=f.value;switch(h){case Ue.GROUP:{var p=e(g);return p.substring(0,p.length-1)}case Ue.DATA_COMPARE:{var x=f.field,b=f.operator;return"["+x+n(e(b))+t(g)+"]"}case Ue.DATA_BOOL:{var w=f.operator,y=f.field;return"["+e(w)+y+"]"}case Ue.DATA_EXIST:{var E=f.field;return"["+E+"]"}case Ue.META_COMPARE:{var C=f.operator,S=f.field;return"[["+S+n(e(C))+t(g)+"]]"}case Ue.STATE:return g;case Ue.ID:return"#"+g;case Ue.CLASS:return"."+g;case Ue.PARENT:case Ue.CHILD:return i(f.parent,d)+n(">")+i(f.child,d);case Ue.ANCESTOR:case Ue.DESCENDANT:return i(f.ancestor,d)+" "+i(f.descendant,d);case Ue.COMPOUND_SPLIT:{var R=i(f.left,d),_=i(f.subject,d),A=i(f.right,d);return R+(R.length>0?" ":"")+_+A}case Ue.TRUE:return""}},i=function(f,d){return f.checks.reduce(function(h,g,p){return h+(d===f&&p===0?"$":"")+a(g,d)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},j5={parse:H5,toString:K5},yA=function(e,t,n){var a,i=Ye(e),o=qe(e),s=Ye(n),u,l,f=!1,d=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),d=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),f=!0),(i||s||f)&&(u=!i&&!o?"":""+e,l=""+n),f&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":a=u.indexOf(l)>=0;break;case"$=":a=u.indexOf(l,u.length-l.length)>=0;break;case"^=":a=u.indexOf(l)===0;break;case"=":a=e===n;break;case">":h=!0,a=e>n;break;case">=":h=!0,a=e>=n;break;case"<":h=!0,a=e<n;break;case"<=":h=!0,a=e<=n;break;default:a=!1;break}return d&&(e!=null||!h)&&(a=!a),a},Y5=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},X5=function(e){return e!==void 0},i0=function(e,t){return e.data(t)},Z5=function(e,t){return e[t]()},Wr=[],Br=function(e,t){return e.checks.every(function(n){return Wr[n.type](n,t)})};Wr[Ue.GROUP]=function(r,e){var t=r.value;return t==="*"||t===e.group()};Wr[Ue.STATE]=function(r,e){var t=r.value;return V5(t,e)};Wr[Ue.ID]=function(r,e){var t=r.value;return e.id()===t};Wr[Ue.CLASS]=function(r,e){var t=r.value;return e.hasClass(t)};Wr[Ue.META_COMPARE]=function(r,e){var t=r.field,n=r.operator,a=r.value;return yA(Z5(e,t),n,a)};Wr[Ue.DATA_COMPARE]=function(r,e){var t=r.field,n=r.operator,a=r.value;return yA(i0(e,t),n,a)};Wr[Ue.DATA_BOOL]=function(r,e){var t=r.field,n=r.operator;return Y5(i0(e,t),n)};Wr[Ue.DATA_EXIST]=function(r,e){var t=r.field;return r.operator,X5(i0(e,t))};Wr[Ue.UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],n=r.nodes[1],a=e.source(),i=e.target();return Br(t,a)&&Br(n,i)||Br(n,a)&&Br(t,i)};Wr[Ue.NODE_NEIGHBOR]=function(r,e){return Br(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&Br(r.neighbor,t)})};Wr[Ue.DIRECTED_EDGE]=function(r,e){return Br(r.source,e.source())&&Br(r.target,e.target())};Wr[Ue.NODE_SOURCE]=function(r,e){return Br(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&Br(r.target,t)})};Wr[Ue.NODE_TARGET]=function(r,e){return Br(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&Br(r.source,t)})};Wr[Ue.CHILD]=function(r,e){return Br(r.child,e)&&Br(r.parent,e.parent())};Wr[Ue.PARENT]=function(r,e){return Br(r.parent,e)&&e.children().some(function(t){return Br(r.child,t)})};Wr[Ue.DESCENDANT]=function(r,e){return Br(r.descendant,e)&&e.ancestors().some(function(t){return Br(r.ancestor,t)})};Wr[Ue.ANCESTOR]=function(r,e){return Br(r.ancestor,e)&&e.descendants().some(function(t){return Br(r.descendant,t)})};Wr[Ue.COMPOUND_SPLIT]=function(r,e){return Br(r.subject,e)&&Br(r.left,e)&&Br(r.right,e)};Wr[Ue.TRUE]=function(){return!0};Wr[Ue.COLLECTION]=function(r,e){var t=r.value;return t.has(e)};Wr[Ue.FILTER]=function(r,e){var t=r.value;return t(e)};var Q5=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===Ue.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(i){for(var o=0;o<t.length;o++){var s=t[o];if(Br(s,i))return!0}return!1};return t.text()==null&&(n=function(){return!0}),e.filter(n)},J5=function(e){for(var t=this,n=0;n<t.length;n++){var a=t[n];if(Br(a,e))return!0}return!1},e$={matches:J5,filter:Q5},La=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Ye(e)&&e.match(/^\s*$/)||(Jt(e)?this.addQuery({checks:[{type:Ue.COLLECTION,value:e.collection()}]}):$r(e)?this.addQuery({checks:[{type:Ue.FILTER,value:e}]}):Ye(e)?this.parse(e)||(this.invalid=!0):kr("A selector must be created from a string; found "))},Oa=La.prototype;[j5,e$].forEach(function(r){return Ze(Oa,r)});Oa.text=function(){return this.inputText};Oa.size=function(){return this.length};Oa.eq=function(r){return this[r]};Oa.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()};Oa.addQuery=function(r){this[this.length++]=r};Oa.selector=Oa.toString;var Ra={allAre:function(e){var t=new La(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new La(e);return this.some(function(n){return t.matches(n)})},some:function(e,t){for(var n=0;n<this.length;n++){var a=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(a)return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){var a=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(!a)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,n=e.length;return t!==n?!1:t===1?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};Ra.allAreNeighbours=Ra.allAreNeighbors;Ra.has=Ra.contains;Ra.equal=Ra.equals=Ra.same;var hn=function(e,t){return function(a,i,o,s){var u=a,l=this,f;if(u==null?f="":Jt(u)&&u.length===1&&(f=u.id()),l.length===1&&f){var d=l[0]._private,h=d.traversalCache=d.traversalCache||{},g=h[t]=h[t]||[],p=ci(f),x=g[p];return x||(g[p]=e.call(l,a,i,o,s))}else return e.call(l,a,i,o,s)}},co={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var a=0;a<this.length;a++){var i=this[a],o=i._private.parent;o&&t.push(o)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var a=0;a<n.length;a++){var i=n[a];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var a=this[n],i=a.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:hn(function(r){for(var e=[],t=0;t<this.length;t++)for(var n=this[t],a=n._private.children,i=0;i<a.length;i++)e.push(a[i]);return this.spawn(e,!0).filter(r)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(a){for(var i=0;i<a.length;i++){var o=a[i];t.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function o0(r,e,t,n){for(var a=[],i=new go,o=r.cy(),s=o.hasCompoundNodes(),u=0;u<r.length;u++){var l=r[u];t?a.push(l):s&&n(a,i,l)}for(;a.length>0;){var f=a.shift();e(f),i.add(f.id()),s&&n(a,i,f)}return r}function mA(r,e,t){if(t.isParent())for(var n=t._private.children,a=0;a<n.length;a++){var i=n[a];e.has(i.id())||r.push(i)}}co.forEachDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return o0(this,r,e,mA)};function bA(r,e,t){if(t.isChild()){var n=t._private.parent;e.has(n.id())||r.push(n)}}co.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return o0(this,r,e,bA)};function r$(r,e,t){bA(r,e,t),mA(r,e,t)}co.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return o0(this,r,e,r$)};co.ancestors=co.parents;var hs,wA;hs=wA={data:Er.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Er.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Er.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Er.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Er.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Er.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};hs.attr=hs.data;hs.removeAttr=hs.removeData;var t$=wA,Al={};function Jd(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var n=0,a=t[0],i=a._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(n+=r(a,s))}return n}else return}}Ze(Al,{degree:Jd(function(r,e){return e.source().same(e.target())?2:1}),indegree:Jd(function(r,e){return e.target().same(r)?1:0}),outdegree:Jd(function(r,e){return e.source().same(r)?1:0})});function Wi(r,e){return function(t){for(var n,a=this.nodes(),i=0;i<a.length;i++){var o=a[i],s=o[r](t);s!==void 0&&(n===void 0||e(s,n))&&(n=s)}return n}}Ze(Al,{minDegree:Wi("degree",function(r,e){return r<e}),maxDegree:Wi("degree",function(r,e){return r>e}),minIndegree:Wi("indegree",function(r,e){return r<e}),maxIndegree:Wi("indegree",function(r,e){return r>e}),minOutdegree:Wi("outdegree",function(r,e){return r<e}),maxOutdegree:Wi("outdegree",function(r,e){return r>e})});Ze(Al,{totalDegree:function(e){for(var t=0,n=this.nodes(),a=0;a<n.length;a++)t+=n[a].degree(e);return t}});var Cn,xA,EA=function(e,t,n){for(var a=0;a<e.length;a++){var i=e[a];if(!i.locked()){var o=i._private.position,s={x:t.x!=null?t.x-o.x:0,y:t.y!=null?t.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,n),i.dirtyBoundingBoxCache()}}},aE={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){EA(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Cn=xA={position:Er.data(aE),silentPosition:Er.data(Ze({},aE,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){EA(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(yr(e))t?this.silentPosition(e):this.position(e);else if($r(e)){var n=e,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=n(o,i))&&(t?o.silentPosition(s):o.position(s))}a.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var a;if(yr(e)?(a={x:qe(e.x)?e.x:0,y:qe(e.y)?e.y:0},n=t):Ye(e)&&qe(t)&&(a={x:0,y:0},a[e]=t),a!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var u=s.position(),l={x:u.x+a.x,y:u.y+a.y};n?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return yr(e)?this.shift(e,!0):Ye(e)&&qe(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],a=this.cy(),i=a.zoom(),o=a.pan(),s=yr(e)?e:void 0,u=s!==void 0||t!==void 0&&Ye(e);if(n&&n.isNode())if(u)for(var l=0;l<this.length;l++){var f=this[l];t!==void 0?f.position(e,(t-o[e])/i):s!==void 0&&f.position(XR(s,i,o))}else{var d=n.position();return s=El(d,i,o),e===void 0?s:s[e]}else if(!u)return;return this},relativePosition:function(e,t){var n=this[0],a=this.cy(),i=yr(e)?e:void 0,o=i!==void 0||t!==void 0&&Ye(e),s=a.hasCompoundNodes();if(n&&n.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],f=s?l.parent():null,d=f&&f.length>0,h=d;d&&(f=f[0]);var g=h?f.position():{x:0,y:0};t!==void 0?l.position(e,t+g[e]):i!==void 0&&l.position({x:i.x+g.x,y:i.y+g.y})}else{var p=n.position(),x=s?n.parent():null,b=x&&x.length>0,w=b;b&&(x=x[0]);var y=w?x.position():{x:0,y:0};return i={x:p.x-y.x,y:p.y-y.y},e===void 0?i:i[e]}else if(!o)return;return this}};Cn.modelPosition=Cn.point=Cn.position;Cn.modelPositions=Cn.points=Cn.positions;Cn.renderedPoint=Cn.renderedPosition;Cn.relativePoint=Cn.relativePosition;var n$=xA,uo,Fa;uo=Fa={};Fa.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),n=t.zoom(),a=t.pan(),i=e.x1*n+a.x,o=e.x2*n+a.x,s=e.y1*n+a.y,u=e.y2*n+a.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}};Fa.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};Fa.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},d=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),h=s.position;(d.w===0||d.h===0)&&(d={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},d.x1=h.x-d.w/2,d.x2=h.x+d.w/2,d.y1=h.y-d.h/2,d.y2=h.y+d.h/2);function g(P,I,D){var L=0,M=0,q=I+D;return P>0&&q>0&&(L=I/q*P,M=D/q*P),{biasDiff:L,biasComplementDiff:M}}function p(P,I,D,L){if(D.units==="%")switch(L){case"width":return P>0?D.pfValue*P:0;case"height":return I>0?D.pfValue*I:0;case"average":return P>0&&I>0?D.pfValue*(P+I)/2:0;case"min":return P>0&&I>0?P>I?D.pfValue*I:D.pfValue*P:0;case"max":return P>0&&I>0?P>I?D.pfValue*P:D.pfValue*I:0;default:return 0}else return D.units==="px"?D.pfValue:0}var x=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(x=x*100/f.width.val);var b=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(b=b*100/f.width.val);var w=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(w=w*100/f.height.val);var y=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(y=y*100/f.height.val);var E=g(f.width.val-d.w,x,b),C=E.biasDiff,S=E.biasComplementDiff,R=g(f.height.val-d.h,w,y),_=R.biasDiff,A=R.biasComplementDiff;s.autoPadding=p(d.w,d.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(d.w,f.width.val),h.x=(-C+d.x1+d.x2+S)/2,s.autoHeight=Math.max(d.h,f.height.val),h.y=(-_+d.y1+d.y2+A)/2}for(var n=0;n<this.length;n++){var a=this[n],i=a._private;(!i.compoundBoundsClean||r)&&(t(a),e.batching()||(i.compoundBoundsClean=!0))}return this};var dn=function(e){return e===1/0||e===-1/0?0:e},En=function(e,t,n,a,i){a-t===0||i-n===0||t==null||n==null||a==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=a>e.x2?a:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ea=function(e,t){return t==null?e:En(e,t.x1,t.y1,t.x2,t.y2)},$o=function(e,t,n){return $t(e,t,n)},Bu=function(e,t,n){if(!t.cy().headless()){var a=t._private,i=a.rstyle,o=i.arrowWidth/2,s=t.pstyle(n+"-arrow-shape").value,u,l;if(s!=="none"){n==="source"?(u=i.srcX,l=i.srcY):n==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=a.arrowBounds=a.arrowBounds||{},d=f[n]=f[n]||{};d.x1=u-o,d.y1=l-o,d.x2=u+o,d.y2=l+o,d.w=d.x2-d.x1,d.h=d.y2-d.y1,zu(d,1),En(e,d.x1,d.y1,d.x2,d.y2)}}},ev=function(e,t,n){if(!t.cy().headless()){var a;n?a=n+"-":a="";var i=t._private,o=i.rstyle,s=t.pstyle(a+"label").strValue;if(s){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),f=$o(o,"labelWidth",n),d=$o(o,"labelHeight",n),h=$o(o,"labelX",n),g=$o(o,"labelY",n),p=t.pstyle(a+"text-margin-x").pfValue,x=t.pstyle(a+"text-margin-y").pfValue,b=t.isEdge(),w=t.pstyle(a+"text-rotation"),y=t.pstyle("text-outline-width").pfValue,E=t.pstyle("text-border-width").pfValue,C=E/2,S=t.pstyle("text-background-padding").pfValue,R=2,_=d,A=f,P=A/2,I=_/2,D,L,M,q;if(b)D=h-P,L=h+P,M=g-I,q=g+I;else{switch(u.value){case"left":D=h-A,L=h;break;case"center":D=h-P,L=h+P;break;case"right":D=h,L=h+A;break}switch(l.value){case"top":M=g-_,q=g;break;case"center":M=g-I,q=g+I;break;case"bottom":M=g,q=g+_;break}}var N=p-Math.max(y,C)-S-R,W=p+Math.max(y,C)+S+R,V=x-Math.max(y,C)-S-R,$=x+Math.max(y,C)+S+R;D+=N,L+=W,M+=V,q+=$;var X=n||"main",ee=i.labelBounds,K=ee[X]=ee[X]||{};K.x1=D,K.y1=M,K.x2=L,K.y2=q,K.w=L-D,K.h=q-M,K.leftPad=N,K.rightPad=W,K.topPad=V,K.botPad=$;var j=b&&w.strValue==="autorotate",fe=w.pfValue!=null&&w.pfValue!==0;if(j||fe){var G=j?$o(i.rstyle,"labelAngle",n):w.pfValue,z=Math.cos(G),Y=Math.sin(G),te=(D+L)/2,ue=(M+q)/2;if(!b){switch(u.value){case"left":te=L;break;case"right":te=D;break}switch(l.value){case"top":ue=q;break;case"bottom":ue=M;break}}var oe=function(le,Me){return le=le-te,Me=Me-ue,{x:le*z-Me*Y+te,y:le*Y+Me*z+ue}},Z=oe(D,M),Q=oe(D,q),ie=oe(L,M),de=oe(L,q);D=Math.min(Z.x,Q.x,ie.x,de.x),L=Math.max(Z.x,Q.x,ie.x,de.x),M=Math.min(Z.y,Q.y,ie.y,de.y),q=Math.max(Z.y,Q.y,ie.y,de.y)}var we=X+"Rot",Ae=ee[we]=ee[we]||{};Ae.x1=D,Ae.y1=M,Ae.x2=L,Ae.y2=q,Ae.w=L-D,Ae.h=q-M,En(e,D,M,L,q),En(i.labelBounds.all,D,M,L,q)}return e}},iE=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,a=t.pstyle("outline-width").value,i=t.pstyle("outline-offset").value,o=a+i;CA(e,t,n,o,"outside",o/2)}},CA=function(e,t,n,a,i,o){if(!(n===0||a<=0||i==="inside")){var s=t.cy(),u=t.pstyle("shape").value,l=s.renderer().nodeShapes[u],f=t.position(),d=f.x,h=f.y,g=t.width(),p=t.height();if(l.hasMiterBounds){i==="center"&&(a/=2);var x=l.miterBounds(d,h,g,p,a);Ea(e,x)}else o!=null&&o>0&&$u(e,[o,o,o,o])}},a$=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,a=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;CA(e,t,n,a,i)}},i$=function(e,t){var n=e._private.cy,a=n.styleEnabled(),i=n.headless(),o=Lt(),s=e._private,u=e.isNode(),l=e.isEdge(),f,d,h,g,p,x,b=s.rstyle,w=u&&a?e.pstyle("bounds-expansion").pfValue:[0],y=function(ve){return ve.pstyle("display").value!=="none"},E=!a||y(e)&&(!l||y(e.source())&&y(e.target()));if(E){var C=0,S=0;a&&t.includeOverlays&&(C=e.pstyle("overlay-opacity").value,C!==0&&(S=e.pstyle("overlay-padding").value));var R=0,_=0;a&&t.includeUnderlays&&(R=e.pstyle("underlay-opacity").value,R!==0&&(_=e.pstyle("underlay-padding").value));var A=Math.max(S,_),P=0,I=0;if(a&&(P=e.pstyle("width").pfValue,I=P/2),u&&t.includeNodes){var D=e.position();p=D.x,x=D.y;var L=e.outerWidth(),M=L/2,q=e.outerHeight(),N=q/2;f=p-M,d=p+M,h=x-N,g=x+N,En(o,f,h,d,g),a&&iE(o,e),a&&t.includeOutlines&&!i&&iE(o,e),a&&a$(o,e)}else if(l&&t.includeEdges)if(a&&!i){var W=e.pstyle("curve-style").strValue;if(f=Math.min(b.srcX,b.midX,b.tgtX),d=Math.max(b.srcX,b.midX,b.tgtX),h=Math.min(b.srcY,b.midY,b.tgtY),g=Math.max(b.srcY,b.midY,b.tgtY),f-=I,d+=I,h-=I,g+=I,En(o,f,h,d,g),W==="haystack"){var V=b.haystackPts;if(V&&V.length===2){if(f=V[0].x,h=V[0].y,d=V[1].x,g=V[1].y,f>d){var $=f;f=d,d=$}if(h>g){var X=h;h=g,g=X}En(o,f-I,h-I,d+I,g+I)}}else if(W==="bezier"||W==="unbundled-bezier"||_a(W,"segments")||_a(W,"taxi")){var ee;switch(W){case"bezier":case"unbundled-bezier":ee=b.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":ee=b.linePts;break}if(ee!=null)for(var K=0;K<ee.length;K++){var j=ee[K];f=j.x-I,d=j.x+I,h=j.y-I,g=j.y+I,En(o,f,h,d,g)}}}else{var fe=e.source(),G=fe.position(),z=e.target(),Y=z.position();if(f=G.x,d=Y.x,h=G.y,g=Y.y,f>d){var te=f;f=d,d=te}if(h>g){var ue=h;h=g,g=ue}f-=I,d+=I,h-=I,g+=I,En(o,f,h,d,g)}if(a&&t.includeEdges&&l&&(Bu(o,e,"mid-source"),Bu(o,e,"mid-target"),Bu(o,e,"source"),Bu(o,e,"target")),a){var oe=e.pstyle("ghost").value==="yes";if(oe){var Z=e.pstyle("ghost-offset-x").pfValue,Q=e.pstyle("ghost-offset-y").pfValue;En(o,o.x1+Z,o.y1+Q,o.x2+Z,o.y2+Q)}}var ie=s.bodyBounds=s.bodyBounds||{};Ww(ie,o),$u(ie,w),zu(ie,1),a&&(f=o.x1,d=o.x2,h=o.y1,g=o.y2,En(o,f-A,h-A,d+A,g+A));var de=s.overlayBounds=s.overlayBounds||{};Ww(de,o),$u(de,w),zu(de,1);var we=s.labelBounds=s.labelBounds||{};we.all!=null?zF(we.all):we.all=Lt(),a&&t.includeLabels&&(t.includeMainLabels&&ev(o,e,null),l&&(t.includeSourceLabels&&ev(o,e,"source"),t.includeTargetLabels&&ev(o,e,"target")))}return o.x1=dn(o.x1),o.y1=dn(o.y1),o.x2=dn(o.x2),o.y2=dn(o.y2),o.w=dn(o.x2-o.x1),o.h=dn(o.y2-o.y1),o.w>0&&o.h>0&&E&&($u(o,w),zu(o,1)),o},_A=function(e){var t=0,n=function(o){return(o?1:0)<<t++},a=0;return a+=n(e.incudeNodes),a+=n(e.includeEdges),a+=n(e.includeLabels),a+=n(e.includeMainLabels),a+=n(e.includeSourceLabels),a+=n(e.includeTargetLabels),a+=n(e.includeOverlays),a+=n(e.includeOutlines),a},SA=function(e){var t=function(s){return Math.round(s)};if(e.isEdge()){var n=e.source().position(),a=e.target().position();return Nw([t(n.x),t(n.y),t(a.x),t(a.y)])}else{var i=e.position();return Nw([t(i.x),t(i.y)])}},oE=function(e,t){var n=e._private,a,i=e.isEdge(),o=t==null?sE:_A(t),s=o===sE;if(n.bbCache==null?(a=i$(e,gs),n.bbCache=a,n.bbCachePosKey=SA(e)):a=n.bbCache,!s){var u=e.isNode();a=Lt(),(t.includeNodes&&u||t.includeEdges&&!u)&&(t.includeOverlays?Ea(a,n.overlayBounds):Ea(a,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?Ea(a,n.labelBounds.all):(t.includeMainLabels&&Ea(a,n.labelBounds.mainRot),t.includeSourceLabels&&Ea(a,n.labelBounds.sourceRot),t.includeTargetLabels&&Ea(a,n.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},gs={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},sE=_A(gs),uE=wt(gs);Fa.boundingBox=function(r){var e,t=r===void 0||r.useCache===void 0||r.useCache===!0,n=lo(function(f){var d=f._private;return d.bbCache==null||d.styleDirty||d.bbCachePosKey!==SA(f)},function(f){return f.id()});if(t&&this.length===1&&!n(this[0]))r===void 0?r=gs:r=uE(r),e=oE(this[0],r);else{e=Lt(),r=r||gs;var a=uE(r),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),s&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var u=0;u<i.length;u++){var l=i[u];n(l)&&l.dirtyBoundingBoxCache(),Ea(e,oE(l,a))}}return e.x1=dn(e.x1),e.y1=dn(e.y1),e.x2=dn(e.x2),e.y2=dn(e.y2),e.w=dn(e.x2-e.x1),e.h=dn(e.y2-e.y1),e};Fa.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};Fa.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),n=t.hasCompoundNodes(),a=t.collection();if(n&&(a=e.filter(function(l){return l.isParent()}),e=e.not(a)),yr(r)){var i=r;r=function(){return i}}var o=function(f,d){return f._private.bbAtOldPos=r(f,d)},s=function(f){return f._private.bbAtOldPos};t.startBatch(),e.forEach(o).silentPositions(r),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var u=FF(this.boundingBox({useCache:!1}));return e.silentPositions(s),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),t.endBatch(),u};uo.boundingbox=uo.bb=uo.boundingBox;uo.renderedBoundingbox=uo.renderedBoundingBox;var o$=Fa,Xo,Rs;Xo=Rs={};var TA=function(e){e.uppercaseName=Cw(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Cw(e.outerName),Xo[e.name]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){if(n.isParent())return n.updateCompoundBounds(),a[e.autoName]||0;var s=n.pstyle(e.name);switch(s.strValue){case"label":return n.recalculateRenderedStyle(),a.rstyle[e.labelName]||0;default:return s.pfValue}}else return 1},Xo["outer"+e.uppercaseName]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){var s=n[e.name](),u=n.pstyle("border-position").value,l;u==="center"?l=n.pstyle("border-width").pfValue:u==="outside"?l=2*n.pstyle("border-width").pfValue:l=0;var f=2*n.padding();return s+l+f}else return 1},Xo["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var a=n[e.name]();return a*this.cy().zoom()}},Xo["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var a=n[e.outerName]();return a*this.cy().zoom()}}};TA({name:"width"});TA({name:"height"});Rs.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue};Rs.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()};Rs.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var s$=Rs,u$=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},l$=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return El(t(e),n.zoom(),n.pan())}},f$=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),a=n.pan(),i=n.zoom();return t(e).map(function(o){return El(o,i,a)})}},c$=function(e){return e.renderer().getControlPoints(e)},d$=function(e){return e.renderer().getSegmentPoints(e)},v$=function(e){return e.renderer().getSourceEndpoint(e)},h$=function(e){return e.renderer().getTargetEndpoint(e)},g$=function(e){return e.renderer().getEdgeMidpoint(e)},lE={controlPoints:{get:c$,mult:!0},segmentPoints:{get:d$,mult:!0},sourceEndpoint:{get:v$},targetEndpoint:{get:h$},midpoint:{get:g$}},p$=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},y$=Object.keys(lE).reduce(function(r,e){var t=lE[e],n=p$(e);return r[e]=function(){return u$(this,t.get)},t.mult?r[n]=function(){return f$(this,t.get)}:r[n]=function(){return l$(this,t.get)},r},{}),m$=Ze({},n$,o$,s$,y$);/*!
|
|
35
|
-
Event object based on jQuery events, MIT license
|
|
36
|
-
|
|
37
|
-
https://jquery.org/license/
|
|
38
|
-
https://tldrlegal.com/license/mit-license
|
|
39
|
-
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
40
|
-
*/var RA=function(e,t){this.recycle(e,t)};function Vo(){return!1}function Mu(){return!0}RA.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Vo,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Mu:Vo):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*a+i.x,y:n.y*a+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Mu;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Mu;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Mu,this.stopPropagation()},isDefaultPrevented:Vo,isPropagationStopped:Vo,isImmediatePropagationStopped:Vo};var AA=/^([^.]+)(\.(?:[^.]+))?$/,b$=".*",PA={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},fE=Object.keys(PA),w$={};function Pl(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w$,e=arguments.length>1?arguments[1]:void 0,t=0;t<fE.length;t++){var n=fE[t];this[n]=r[n]||PA[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ka=Pl.prototype,IA=function(e,t,n,a,i,o,s){$r(a)&&(i=a,a=null),s&&(o==null?o=s:o=Ze({},o,s));for(var u=Tr(n)?n:n.split(/\s+/),l=0;l<u.length;l++){var f=u[l];if(!Da(f)){var d=f.match(AA);if(d){var h=d[1],g=d[2]?d[2]:null,p=t(e,f,h,g,a,i,o);if(p===!1)break}}}},cE=function(e,t){return e.addEventFields(e.context,t),new RA(t.type,t)},x$=function(e,t,n){if(RN(n)){t(e,n);return}else if(yr(n)){t(e,cE(e,n));return}for(var a=Tr(n)?n:n.split(/\s+/),i=0;i<a.length;i++){var o=a[i];if(!Da(o)){var s=o.match(AA);if(s){var u=s[1],l=s[2]?s[2]:null,f=cE(e,{type:u,namespace:l,target:e.context});t(e,f)}}}};ka.on=ka.addListener=function(r,e,t,n,a){return IA(this,function(i,o,s,u,l,f,d){$r(f)&&i.listeners.push({event:o,callback:f,type:s,namespace:u,qualifier:l,conf:d})},r,e,t,n,a),this};ka.one=function(r,e,t,n){return this.on(r,e,t,n,{one:!0})};ka.removeListener=ka.off=function(r,e,t,n){var a=this;this.emitting!==0&&(this.listeners=lF(this.listeners));for(var i=this.listeners,o=function(l){var f=i[l];IA(a,function(d,h,g,p,x,b){if((f.type===g||r==="*")&&(!p&&f.namespace!==".*"||f.namespace===p)&&(!x||d.qualifierCompare(f.qualifier,x))&&(!b||f.callback===b))return i.splice(l,1),!1},r,e,t,n)},s=i.length-1;s>=0;s--)o(s);return this};ka.removeAllListeners=function(){return this.removeListener("*")};ka.emit=ka.trigger=function(r,e,t){var n=this.listeners,a=n.length;return this.emitting++,Tr(e)||(e=[e]),x$(this,function(i,o){t!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:t}],a=n.length);for(var s=function(){var f=n[u];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===b$)&&i.eventMatches(i.context,f,o)){var d=[o];e!=null&&cF(d,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(p){return p!==f}));var h=i.callbackContext(i.context,f,o),g=f.callback.apply(h,d);i.afterEmit(i.context,f,o),g===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<a;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},r),this.emitting--,this};var E$={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return a!=null?e!==n.target&&xs(n.target)&&a.matches(n.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Lu=function(e){return Ye(e)?new La(e):e},DA={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new Pl(E$,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var a=Lu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n)}return this},removeListener:function(e,t,n){for(var a=Lu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,a,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,n){for(var a=Lu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,a,n)}return this},once:function(e,t,n){for(var a=Lu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var a=this[n];a.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};Er.eventAliasesOn(DA);var BA={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var a=this[n];a.isNode()?e.push(a):t.push(a)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(Ye(e)||Jt(e))return new La(e).filter(this);if($r(e)){for(var n=this.spawn(),a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){Ye(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var a=this[n],i=e.has(a);i||t.push(a)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Ye(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),a=this,i=e,o=this.length<e.length,s=o?a:i,u=o?i:a,l=0;l<s.length;l++){var f=s[l];u.has(f)&&n.push(f)}return n},xor:function(e){var t=this._private.cy;Ye(e)&&(e=t.$(e));var n=this.spawn(),a=this,i=e,o=function(u,l){for(var f=0;f<u.length;f++){var d=u[f],h=d._private.data.id,g=l.hasElementWithId(h);g||n.push(d)}};return o(a,i),o(i,a),n},diff:function(e){var t=this._private.cy;Ye(e)&&(e=t.$(e));var n=this.spawn(),a=this.spawn(),i=this.spawn(),o=this,s=e,u=function(f,d,h){for(var g=0;g<f.length;g++){var p=f[g],x=p._private.data.id,b=d.hasElementWithId(x);b?i.merge(p):h.push(p)}};return u(o,s,n),u(s,o,a),{left:n,right:a,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(Ye(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&a.push(o)}return a},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&Ye(e)){var a=e;e=n.mutableElements().filter(a)}for(var i=t.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id,l=!i.has(u);if(l){var f=this.length++;this[f]=s,i.set(u,{ele:s,index:f})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),a=this._private,i=a.map;this[e]=void 0,i.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,a=t.map,i=a.get(n);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&Ye(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=0;a<e.length;a++)this.unmergeOne(e[a]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);n.push(s)}return n},reduce:function(e,t){for(var n=t,a=this,i=0;i<a.length;i++)n=e(n,a[i],i,a);return n},max:function(e,t){for(var n=-1/0,a,i=this,o=0;o<i.length;o++){var s=i[o],u=t?e.apply(t,[s,o,i]):e(s,o,i);u>n&&(n=u,a=s)}return{value:n,ele:a}},min:function(e,t){for(var n=1/0,a,i=this,o=0;o<i.length;o++){var s=i[o],u=t?e.apply(t,[s,o,i]):e(s,o,i);u<n&&(n=u,a=s)}return{value:n,ele:a}}},mr=BA;mr.u=mr["|"]=mr["+"]=mr.union=mr.or=mr.add;mr["\\"]=mr["!"]=mr["-"]=mr.difference=mr.relativeComplement=mr.subtract=mr.not;mr.n=mr["&"]=mr["."]=mr.and=mr.intersection=mr.intersect;mr["^"]=mr["(+)"]=mr["(-)"]=mr.symmetricDifference=mr.symdiff=mr.xor;mr.fnFilter=mr.filterFn=mr.stdFilter=mr.filter;mr.complement=mr.abscomp=mr.absoluteComplement;var C$={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},MA=function(e,t){var n=e.cy(),a=n.hasCompoundNodes();function i(f){var d=f.pstyle("z-compound-depth");return d.value==="auto"?a?f.zDepth():0:d.value==="bottom"?-1:d.value==="top"?Ym:0}var o=i(e)-i(t);if(o!==0)return o;function s(f){var d=f.pstyle("z-index-compare");return d.value==="auto"&&f.isNode()?1:0}var u=s(e)-s(t);if(u!==0)return u;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},sl={forEach:function(e,t){if($r(e))for(var n=this.length,a=0;a<n;a++){var i=this[a],o=t?e.apply(t,[i,a,this]):e(i,a,this);if(o===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],a=this.length;t==null&&(t=a),e==null&&(e=0),e<0&&(e=a+e),t<0&&(t=a+t);for(var i=e;i>=0&&i<t&&i<a;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!$r(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(MA)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if(n==="nodes"){var a=t.data.parent?e.parents().size():0;return e.isParent()?a:Ym-1}else{var i=t.source,o=t.target,s=i.zDepth(),u=o.zDepth();return Math.max(s,u,0)}}}};sl.each=sl.forEach;var _$=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":at(Symbol))!=e&&at(Symbol.iterator)!=e;t&&(sl[Symbol.iterator]=function(){var n=this,a={value:void 0,done:!1},i=0,o=this.length;return DR({next:function(){return i<o?a.value=n[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};_$();var S$=wt({nodeDimensionsIncludeLabels:!1}),Gu={layoutDimensions:function(e){e=S$(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var a=this.nodes().filter(function(S){return!S.isParent()}),i=this.cy(),o=t.eles,s=function(R){return R.id()},u=lo(n,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(R,_,A){var P={x:_.x1+_.w/2,y:_.y1+_.h/2},I={x:(A.x-P.x)*R,y:(A.y-P.y)*R};return{x:P.x+I.x,y:P.y+I.y}},f=t.spacingFactor&&t.spacingFactor!==1,d=function(){if(!f)return null;for(var R=Lt(),_=0;_<a.length;_++){var A=a[_],P=u(A,_);ZR(R,P.x,P.y)}return R},h=d(),g=lo(function(S,R){var _=u(S,R);if(f){var A=Math.abs(t.spacingFactor);_=l(A,h,_)}return t.transform!=null&&(_=t.transform(S,_)),_},s);if(t.animate){for(var p=0;p<a.length;p++){var x=a[p],b=g(x,p),w=t.animateFilter==null||t.animateFilter(x,p);if(w){var y=x.animation({position:b,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else x.position(b)}if(t.fit){var E=i.animation({fit:{boundingBox:o.boundingBoxAt(g),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(E)}else if(t.zoom!==void 0&&t.pan!==void 0){var C=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(C)}e.animations.forEach(function(S){return S.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),po.all(e.animations.map(function(S){return S.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else a.positions(g),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(Ze({},e,{eles:this}))}};Gu.createLayout=Gu.makeLayout=Gu.layout;function LA(r,e,t){var n=t._private,a=n.styleCache=n.styleCache||[],i;return(i=a[r])!=null||(i=a[r]=e(t)),i}function Il(r,e){return r=ci(r),function(n){return LA(r,e,n)}}function Dl(r,e){r=ci(r);var t=function(a){return e.call(a)};return function(){var a=this[0];if(a)return LA(r,t,a)}}var mt={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),a=t.styleEnabled();return n&&a&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(a){t(a),a.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var a=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),a&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],a=n.cy();if(a.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,a.style().apply(n));var i=n._private.style[e];return i??(t?a.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var a=!1,i=n.style();if(yr(e)){var o=e;i.applyBypass(this,o,a),this.emitAndNotify("style")}else if(Ye(e))if(t===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,t,a),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,a=t.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];a.removeAllBypasses(s,n)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];a.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var a=n._private,i=n.pstyle("opacity").value;if(!t)return i;var o=a.data.parent?n.parents():null;if(o)for(var s=0;s<o.length;s++){var u=o[s],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();if(t)return n?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function rv(r,e){var t=r._private,n=t.data.parent?r.parents():null;if(n)for(var a=0;a<n.length;a++){var i=n[a];if(!e(i))return!1}return!0}function s0(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,n=r.parentOk||r.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],o=a.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||rv(i,n);var u=s.source,l=s.target;return t(u)&&(!o||rv(u,t))&&(u===l||t(l)&&(!o||rv(l,t)))}}}var yo=Il("eleTakesUpSpace",function(r){return r.pstyle("display").value==="element"&&r.width()!==0&&(r.isNode()?r.height()!==0:!0)});mt.takesUpSpace=Dl("takesUpSpace",s0({ok:yo}));var T$=Il("eleInteractive",function(r){return r.pstyle("events").value==="yes"&&r.pstyle("visibility").value==="visible"&&yo(r)}),R$=Il("parentInteractive",function(r){return r.pstyle("visibility").value==="visible"&&yo(r)});mt.interactive=Dl("interactive",s0({ok:T$,parentOk:R$,edgeOkViaNode:yo}));mt.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var A$=Il("eleVisible",function(r){return r.pstyle("visibility").value==="visible"&&r.pstyle("opacity").pfValue!==0&&yo(r)}),P$=yo;mt.visible=Dl("visible",s0({ok:A$,edgeOkViaNode:P$}));mt.hidden=function(){var r=this[0];if(r)return!r.visible()};mt.isBundledBezier=Dl("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});mt.bypass=mt.css=mt.style;mt.renderedCss=mt.renderedStyle;mt.removeBypass=mt.removeCss=mt.removeStyle;mt.pstyle=mt.parsedStyle;var Aa={};function dE(r){return function(){var e=arguments,t=[];if(e.length===2){var n=e[0],a=e[1];this.on(r.event,n,a)}else if(e.length===1&&$r(e[0])){var i=e[0];this.on(r.event,i)}else if(e.length===0||e.length===1&&Tr(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!r.ableField||u._private[r.ableField],f=u._private[r.field]!=r.value;if(r.overrideAble){var d=r.overrideAble(u);if(d!==void 0&&(l=d,!d))return this}l&&(u._private[r.field]=r.value,f&&t.push(u))}var h=this.spawn(t);h.updateStyle(),h.emit(r.event),o&&h.emit(o)}return this}}function mo(r){Aa[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(t!==void 0)return t}return e._private[r.field]}},Aa[r.on]=dE({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),Aa[r.off]=dE({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}mo({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});mo({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});mo({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});mo({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Aa.deselect=Aa.unselect;Aa.grabbed=function(){var r=this[0];if(r)return r._private.grabbed};mo({field:"active",on:"activate",off:"unactivate"});mo({field:"pannable",on:"panify",off:"unpanify"});Aa.inactive=function(){var r=this[0];if(r)return!r._private.active};var Tt={},vE=function(e){return function(n){for(var a=this,i=[],o=0;o<a.length;o++){var s=a[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),f=0;f<l.length;f++){var d=l[f],h=d.source(),g=d.target();if(e.noIncomingEdges&&g===s&&h!==s||e.noOutgoingEdges&&h===s&&g!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(n)}},hE=function(e){return function(t){for(var n=this,a=[],i=0;i<n.length;i++){var o=n[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],f=l.source(),d=l.target();e.outgoing&&f===o?(a.push(l),a.push(d)):e.incoming&&d===o&&(a.push(l),a.push(f))}}return this.spawn(a,!0).filter(t)}},gE=function(e){return function(t){for(var n=this,a=[],i={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],f=l.id();i[f]||(i[f]=!0,a.push(l),s=!0)}if(!s)break;n=o}return this.spawn(a,!0).filter(t)}};Tt.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null};Ze(Tt,{roots:vE({noIncomingEdges:!0}),leaves:vE({noOutgoingEdges:!0}),outgoers:hn(hE({outgoing:!0}),"outgoers"),successors:gE({outgoing:!0}),incomers:hn(hE({incoming:!0}),"incomers"),predecessors:gE({})});Ze(Tt,{neighborhood:hn(function(r){for(var e=[],t=this.nodes(),n=0;n<t.length;n++)for(var a=t[n],i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),f=a===u?l:u;f.length>0&&e.push(f[0]),e.push(s[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});Tt.neighbourhood=Tt.neighborhood;Tt.closedNeighbourhood=Tt.closedNeighborhood;Tt.openNeighbourhood=Tt.openNeighborhood;Ze(Tt,{source:hn(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:hn(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:pE({attr:"source"}),targets:pE({attr:"target"})});function pE(r){return function(t){for(var n=[],a=0;a<this.length;a++){var i=this[a],o=i._private[r.attr];o&&n.push(o)}return this.spawn(n,!0).filter(t)}}Ze(Tt,{edgesWith:hn(yE(),"edgesWith"),edgesTo:hn(yE({thisIsSrc:!0}),"edgesTo")});function yE(r){return function(t){var n=[],a=this._private.cy,i=r||{};Ye(t)&&(t=a.$(t));for(var o=0;o<t.length;o++)for(var s=t[o]._private.edges,u=0;u<s.length;u++){var l=s[u],f=l._private.data,d=this.hasElementWithId(f.source)&&t.hasElementWithId(f.target),h=t.hasElementWithId(f.source)&&this.hasElementWithId(f.target),g=d||h;g&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!d||i.thisIsTgt&&!h)||n.push(l))}return this.spawn(n,!0)}}Ze(Tt,{connectedEdges:hn(function(r){for(var e=[],t=this,n=0;n<t.length;n++){var a=t[n];if(a.isNode())for(var i=a._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:hn(function(r){for(var e=[],t=this,n=0;n<t.length;n++){var a=t[n];a.isEdge()&&(e.push(a.source()[0]),e.push(a.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:hn(mE(),"parallelEdges"),codirectedEdges:hn(mE({codirected:!0}),"codirectedEdges")});function mE(r){var e={codirected:!1};return r=Ze({},e,r),function(n){for(var a=[],i=this.edges(),o=r,s=0;s<i.length;s++)for(var u=i[s],l=u._private,f=l.source,d=f._private.data.id,h=l.data.target,g=f._private.edges,p=0;p<g.length;p++){var x=g[p],b=x._private.data,w=b.target,y=b.source,E=w===h&&y===d,C=d===w&&h===y;(o.codirected&&E||!o.codirected&&(E||C))&&a.push(x)}return this.spawn(a,!0).filter(n)}}Ze(Tt,{components:function(e){var t=this,n=t.cy(),a=n.collection(),i=e==null?t.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(f,d){a.merge(f),i.unmerge(f),d.merge(f)};if(i.empty())return t.spawn();var u=function(){var f=n.collection();o.push(f);var d=i[0];s(d,f),t.bfs({directed:!1,roots:d,visit:function(g){return s(g,f)}}),f.forEach(function(h){h.connectedEdges().forEach(function(g){t.has(g)&&f.has(g.source())&&f.has(g.target())&&f.merge(g)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Tt.componentsOf=Tt.components;var bt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){kr("A collection must have a reference to the core");return}var i=new ra,o=!1;if(!t)t=[];else if(t.length>0&&yr(t[0])&&!xs(t[0])){o=!0;for(var s=[],u=new go,l=0,f=t.length;l<f;l++){var d=t[l];d.data==null&&(d.data={});var h=d.data;if(h.id==null)h.id=jR();else if(e.hasElementWithId(h.id)||u.has(h.id))continue;var g=new xl(e,d,!1);s.push(g),u.add(h.id)}t=s}this.length=0;for(var p=0,x=t.length;p<x;p++){var b=t[p][0];if(b!=null){var w=b._private.data.id;(!n||!i.has(w))&&(n&&i.set(w,{index:this.length,ele:b}),this[this.length]=b,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(y){this.lazyMap=y},rebuildMap:function(){for(var E=this.lazyMap=new ra,C=this.eles,S=0;S<C.length;S++){var R=C[S];E.set(R.id(),{index:S,ele:R})}}},n&&(this._private.map=i),o&&!a&&this.restore()},Ir=xl.prototype=bt.prototype=Object.create(Array.prototype);Ir.instanceString=function(){return"collection"};Ir.spawn=function(r,e){return new bt(this.cy(),r,e)};Ir.spawnSelf=function(){return this.spawn(this)};Ir.cy=function(){return this._private.cy};Ir.renderer=function(){return this._private.cy.renderer()};Ir.element=function(){return this[0]};Ir.collection=function(){return LR(this)?this:new bt(this._private.cy,[this])};Ir.unique=function(){return new bt(this._private.cy,this,!0)};Ir.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)};Ir.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new bt(e)};Ir.$id=Ir.getElementById;Ir.poolIndex=function(){var r=this._private.cy,e=r._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index};Ir.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index};Ir.indexOfId=function(r){return r=""+r,this._private.map.get(r).index};Ir.json=function(r){var e=this.element(),t=this.cy();if(e==null&&r)return this;if(e!=null){var n=e._private;if(yr(r)){if(t.startBatch(),r.data){e.data(r.data);var a=n.data;if(e.isEdge()){var i=!1,o={},s=r.data.source,u=r.data.target;s!=null&&s!=a.source&&(o.source=""+s,i=!0),u!=null&&u!=a.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in r.data,f=r.data.parent;l&&(f!=null||a.parent!=null)&&f!=a.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}r.position&&e.position(r.position);var d=function(x,b,w){var y=r[x];y!=null&&y!==n[x]&&(y?e[b]():e[w]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),r.classes!=null&&e.classes(r.classes),t.endBatch(),this}else if(r===void 0){var h={data:Nn(n.data),position:Nn(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};h.classes="";var g=0;return n.classes.forEach(function(p){return h.classes+=g++===0?p:" "+p}),h}}};Ir.jsons=function(){for(var r=[],e=0;e<this.length;e++){var t=this[e],n=t.json();r.push(n)}return r};Ir.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var n=this[t],a=n.json(),i=new xl(r,a,!1);e.push(i)}return new bt(r,e)};Ir.copy=Ir.clone;Ir.restore=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,n=t.cy(),a=n._private,i=[],o=[],s,u=0,l=t.length;u<l;u++){var f=t[u];e&&!f.removed()||(f.isNode()?i.push(f):o.push(f))}s=i.concat(o);var d,h=function(){s.splice(d,1),d--};for(d=0;d<s.length;d++){var g=s[d],p=g._private,x=p.data;if(g.clearTraversalCache(),!(!e&&!p.removed)){if(x.id===void 0)x.id=jR();else if(qe(x.id))x.id=""+x.id;else if(Da(x.id)||!Ye(x.id)){kr("Can not create element with invalid string ID `"+x.id+"`"),h();continue}else if(n.hasElementWithId(x.id)){kr("Can not create second element with ID `"+x.id+"`"),h();continue}}var b=x.id;if(g.isNode()){var w=p.position;w.x==null&&(w.x=0),w.y==null&&(w.y=0)}if(g.isEdge()){for(var y=g,E=["source","target"],C=E.length,S=!1,R=0;R<C;R++){var _=E[R],A=x[_];qe(A)&&(A=x[_]=""+x[_]),A==null||A===""?(kr("Can not create edge `"+b+"` with unspecified "+_),S=!0):n.hasElementWithId(A)||(kr("Can not create edge `"+b+"` with nonexistant "+_+" `"+A+"`"),S=!0)}if(S){h();continue}var P=n.getElementById(x.source),I=n.getElementById(x.target);P.same(I)?P._private.edges.push(y):(P._private.edges.push(y),I._private.edges.push(y)),y._private.source=P,y._private.target=I}p.map=new ra,p.map.set(b,{ele:g,index:0}),p.removed=!1,e&&n.addToPool(g)}for(var D=0;D<i.length;D++){var L=i[D],M=L._private.data;qe(M.parent)&&(M.parent=""+M.parent);var q=M.parent,N=q!=null;if(N||L._private.parent){var W=L._private.parent?n.collection().merge(L._private.parent):n.getElementById(q);if(W.empty())M.parent=void 0;else if(W[0].removed())Cr("Node added with missing parent, reference to parent removed"),M.parent=void 0,L._private.parent=null;else{for(var V=!1,$=W;!$.empty();){if(L.same($)){V=!0,M.parent=void 0;break}$=$.parent()}V||(W[0]._private.children.push(L),L._private.parent=W[0],a.hasCompoundNodes=!0)}}}if(s.length>0){for(var X=s.length===t.length?t:new bt(n,s),ee=0;ee<X.length;ee++){var K=X[ee];K.isNode()||(K.parallelEdges().clearTraversalCache(),K.source().clearTraversalCache(),K.target().clearTraversalCache())}var j;a.hasCompoundNodes?j=n.collection().merge(X).merge(X.connectedNodes()).merge(X.parent()):j=X,j.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?X.emitAndNotify("add"):e&&X.emit("add")}return t};Ir.removed=function(){var r=this[0];return r&&r._private.removed};Ir.inside=function(){var r=this[0];return r&&!r._private.removed};Ir.remove=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,n=[],a={},i=t._private.cy;function o(q){for(var N=q._private.edges,W=0;W<N.length;W++)u(N[W])}function s(q){for(var N=q._private.children,W=0;W<N.length;W++)u(N[W])}function u(q){var N=a[q.id()];e&&q.removed()||N||(a[q.id()]=!0,q.isNode()?(n.push(q),o(q),s(q)):n.unshift(q))}for(var l=0,f=t.length;l<f;l++){var d=t[l];u(d)}function h(q,N){var W=q._private.edges;Ba(W,N),q.clearTraversalCache()}function g(q){q.clearTraversalCache()}var p=[];p.ids={};function x(q,N){N=N[0],q=q[0];var W=q._private.children,V=q.id();Ba(W,N),N._private.parent=null,p.ids[V]||(p.ids[V]=!0,p.push(q))}t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(n);for(var b=0;b<n.length;b++){var w=n[b];if(w.isEdge()){var y=w.source()[0],E=w.target()[0];h(y,w),h(E,w);for(var C=w.parallelEdges(),S=0;S<C.length;S++){var R=C[S];g(R),R.isBundledBezier()&&R.dirtyBoundingBoxCache()}}else{var _=w.parent();_.length!==0&&x(_,w)}e&&(w._private.removed=!0)}var A=i._private.elements;i._private.hasCompoundNodes=!1;for(var P=0;P<A.length;P++){var I=A[P];if(I.isParent()){i._private.hasCompoundNodes=!0;break}}var D=new bt(this.cy(),n);D.size()>0&&(r?D.emitAndNotify("remove"):e&&D.emit("remove"));for(var L=0;L<p.length;L++){var M=p[L];(!e||!M.removed())&&M.updateStyle()}return D};Ir.move=function(r){var e=this._private.cy,t=this,n=!1,a=!1,i=function(p){return p==null?p:""+p};if(r.source!==void 0||r.target!==void 0){var o=i(r.source),s=i(r.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){t.remove(n,a),t.emitAndNotify("moveout");for(var g=0;g<t.length;g++){var p=t[g],x=p._private.data;p.isEdge()&&(u&&(x.source=o),l&&(x.target=s))}t.restore(n,a)}),t.emitAndNotify("move"))}else if(r.parent!==void 0){var f=i(r.parent),d=f===null||e.hasElementWithId(f);if(d){var h=f===null?void 0:f;e.batch(function(){var g=t.remove(n,a);g.emitAndNotify("moveout");for(var p=0;p<t.length;p++){var x=t[p],b=x._private.data;x.isNode()&&(b.parent=h)}g.restore(n,a)}),t.emitAndNotify("move")}}return this};[oA,z5,Vu,Ra,co,t$,Al,m$,DA,BA,C$,sl,Gu,mt,Aa,Tt].forEach(function(r){Ze(Ir,r)});var I$={add:function(e){var t,n=this;if(Jt(e)){var a=e;if(a._private.cy===n)t=a.restore();else{for(var i=[],o=0;o<a.length;o++){var s=a[o];i.push(s.json())}t=new bt(n,i)}}else if(Tr(e)){var u=e;t=new bt(n,u)}else if(yr(e)&&(Tr(e.nodes)||Tr(e.edges))){for(var l=e,f=[],d=["nodes","edges"],h=0,g=d.length;h<g;h++){var p=d[h],x=l[p];if(Tr(x))for(var b=0,w=x.length;b<w;b++){var y=Ze({group:p},x[b]);f.push(y)}}t=new bt(n,f)}else{var E=e;t=new xl(n,E).collection()}return t},remove:function(e){if(!Jt(e)){if(Ye(e)){var t=e;e=this.$(t)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function D$(r,e,t,n){var a=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!="number"||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var h=f?new Float32Array(u):new Array(u);function g(I,D){return 1-3*D+3*I}function p(I,D){return 3*D-6*I}function x(I){return 3*I}function b(I,D,L){return((g(D,L)*I+p(D,L))*I+x(D))*I}function w(I,D,L){return 3*g(D,L)*I*I+2*p(D,L)*I+x(D)}function y(I,D){for(var L=0;L<a;++L){var M=w(D,r,t);if(M===0)return D;var q=b(D,r,t)-I;D-=q/M}return D}function E(){for(var I=0;I<u;++I)h[I]=b(I*l,r,t)}function C(I,D,L){var M,q,N=0;do q=D+(L-D)/2,M=b(q,r,t)-I,M>0?L=q:D=q;while(Math.abs(M)>o&&++N<s);return q}function S(I){for(var D=0,L=1,M=u-1;L!==M&&h[L]<=I;++L)D+=l;--L;var q=(I-h[L])/(h[L+1]-h[L]),N=D+q*l,W=w(N,r,t);return W>=i?y(I,N):W===0?N:C(I,D,D+l)}var R=!1;function _(){R=!0,(r!==e||t!==n)&&E()}var A=function(D){return R||_(),r===e&&t===n?D:D===0?0:D===1?1:b(S(D),e,n)};A.getControlPoints=function(){return[{x:r,y:e},{x:t,y:n}]};var P="generateBezier("+[r,e,t,n]+")";return A.toString=function(){return P},A}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var B$=(function(){function r(n){return-n.tension*n.x-n.friction*n.v}function e(n,a,i){var o={x:n.x+i.dx*a,v:n.v+i.dv*a,tension:n.tension,friction:n.friction};return{dx:o.v,dv:r(o)}}function t(n,a){var i={dx:n.v,dv:r(n)},o=e(n,a*.5,i),s=e(n,a*.5,o),u=e(n,a,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),f=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return n.x=n.x+l*a,n.v=n.v+f*a,n}return function n(a,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,d=16/1e3,h,g,p;for(a=parseFloat(a)||500,i=parseFloat(i)||20,o=o||null,s.tension=a,s.friction=i,h=o!==null,h?(l=n(a,i),g=l/o*d):g=d;p=t(p||s,g),u.push(1+p.x),l+=16,Math.abs(p.x)>f&&Math.abs(p.v)>f;);return h?function(x){return u[x*(u.length-1)|0]}:l}})(),Pr=function(e,t,n,a){var i=D$(e,t,n,a);return function(o,s,u){return o+(s-o)*i(u)}},Wu={linear:function(e,t,n){return e+(t-e)*n},ease:Pr(.25,.1,.25,1),"ease-in":Pr(.42,0,1,1),"ease-out":Pr(0,0,.58,1),"ease-in-out":Pr(.42,0,.58,1),"ease-in-sine":Pr(.47,0,.745,.715),"ease-out-sine":Pr(.39,.575,.565,1),"ease-in-out-sine":Pr(.445,.05,.55,.95),"ease-in-quad":Pr(.55,.085,.68,.53),"ease-out-quad":Pr(.25,.46,.45,.94),"ease-in-out-quad":Pr(.455,.03,.515,.955),"ease-in-cubic":Pr(.55,.055,.675,.19),"ease-out-cubic":Pr(.215,.61,.355,1),"ease-in-out-cubic":Pr(.645,.045,.355,1),"ease-in-quart":Pr(.895,.03,.685,.22),"ease-out-quart":Pr(.165,.84,.44,1),"ease-in-out-quart":Pr(.77,0,.175,1),"ease-in-quint":Pr(.755,.05,.855,.06),"ease-out-quint":Pr(.23,1,.32,1),"ease-in-out-quint":Pr(.86,0,.07,1),"ease-in-expo":Pr(.95,.05,.795,.035),"ease-out-expo":Pr(.19,1,.22,1),"ease-in-out-expo":Pr(1,0,0,1),"ease-in-circ":Pr(.6,.04,.98,.335),"ease-out-circ":Pr(.075,.82,.165,1),"ease-in-out-circ":Pr(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return Wu.linear;var a=B$(e,t,n);return function(i,o,s){return i+(o-i)*a(s)}},"cubic-bezier":Pr};function bE(r,e,t,n,a){if(n===1||e===t)return t;var i=a(e,t,n);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function wE(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Ui(r,e,t,n,a){var i=a!=null?a.type:null;t<0?t=0:t>1&&(t=1);var o=wE(r,a),s=wE(e,a);if(qe(o)&&qe(s))return bE(i,o,s,t,n);if(Tr(o)&&Tr(s)){for(var u=[],l=0;l<s.length;l++){var f=o[l],d=s[l];if(f!=null&&d!=null){var h=bE(i,f,d,t,n);u.push(h)}else u.push(d)}return u}}function M$(r,e,t,n){var a=!n,i=r._private,o=e._private,s=o.easing,u=o.startTime,l=n?r:r.cy(),f=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=Wu.linear;else{var d;if(Ye(s)){var h=f.parse("transition-timing-function",s);d=h.value}else d=s;var g,p;Ye(d)?(g=d,p=[]):(g=d[1],p=d.slice(2).map(function(X){return+X})),p.length>0?(g==="spring"&&p.push(o.duration),o.easingImpl=Wu[g].apply(null,p)):o.easingImpl=Wu[g]}var x=o.easingImpl,b;if(o.duration===0?b=1:b=(t-u)/o.duration,o.applying&&(b=o.progress),b<0?b=0:b>1&&(b=1),o.delay==null){var w=o.startPosition,y=o.position;if(y&&a&&!r.locked()){var E={};Go(w.x,y.x)&&(E.x=Ui(w.x,y.x,b,x)),Go(w.y,y.y)&&(E.y=Ui(w.y,y.y,b,x)),r.position(E)}var C=o.startPan,S=o.pan,R=i.pan,_=S!=null&&n;_&&(Go(C.x,S.x)&&(R.x=Ui(C.x,S.x,b,x)),Go(C.y,S.y)&&(R.y=Ui(C.y,S.y,b,x)),r.emit("pan"));var A=o.startZoom,P=o.zoom,I=P!=null&&n;I&&(Go(A,P)&&(i.zoom=ds(i.minZoom,Ui(A,P,b,x),i.maxZoom)),r.emit("zoom")),(_||I)&&r.emit("viewport");var D=o.style;if(D&&D.length>0&&a){for(var L=0;L<D.length;L++){var M=D[L],q=M.name,N=M,W=o.startStyle[q],V=f.properties[W.name],$=Ui(W,N,b,x,V);f.overrideBypass(r,q,$)}r.emit("style")}}return o.progress=b,b}function Go(r,e){return r==null||e==null?!1:qe(r)&&qe(e)?!0:!!(r&&e)}function L$(r,e,t,n){var a=e._private;a.started=!0,a.startTime=t-a.progress*a.duration}function xE(r,e){var t=e._private.aniEles,n=[];function a(f,d){var h=f._private,g=h.animation.current,p=h.animation.queue,x=!1;if(g.length===0){var b=p.shift();b&&g.push(b)}for(var w=function(R){for(var _=R.length-1;_>=0;_--){var A=R[_];A()}R.splice(0,R.length)},y=g.length-1;y>=0;y--){var E=g[y],C=E._private;if(C.stopped){g.splice(y,1),C.hooked=!1,C.playing=!1,C.started=!1,w(C.frames);continue}!C.playing&&!C.applying||(C.playing&&C.applying&&(C.applying=!1),C.started||L$(f,E,r),M$(f,E,r,d),C.applying&&(C.applying=!1),w(C.frames),C.step!=null&&C.step(r),E.completed()&&(g.splice(y,1),C.hooked=!1,C.playing=!1,C.started=!1,w(C.completes)),x=!0)}return!d&&g.length===0&&p.length===0&&n.push(f),x}for(var i=!1,o=0;o<t.length;o++){var s=t[o],u=a(s);i=i||u}var l=a(e,!0);(i||l)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(n),e.emit("step")}var O$={animate:Er.animate(),animation:Er.animation(),animated:Er.animated(),clearQueue:Er.clearQueue(),delay:Er.delay(),delayAnimation:Er.delayAnimation(),stop:Er.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&tl(function(i){xE(i,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(i,o){xE(o,e)},n.beforeRenderPriorities.animations):t()}},k$={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return a!=null?e!==n.target&&xs(n.target)&&a.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},Ou=function(e){return Ye(e)?new La(e):e},OA={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Pl(k$,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Ou(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Ou(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Ou(t),n),this},once:function(e,t,n){return this.emitter().one(e,Ou(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Er.eventAliasesOn(OA);var Im={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Im.jpeg=Im.jpg;var Uu={layout:function(e){var t=this;if(e==null){kr("Layout options must be specified to make a layout");return}if(e.name==null){kr("A `name` must be specified to make a layout");return}var n=e.name,a=t.extension("layout",n);if(a==null){kr("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;Ye(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new a(Ze({},e,{cy:t,eles:i}));return o}};Uu.createLayout=Uu.makeLayout=Uu.layout;var q$={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var a=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&a.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var a=e.batchNotifications[n];a.empty()?t.notify(n):t.notify(n,a)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),a=0;a<n.length;a++){var i=n[a],o=e[i],s=t.getElementById(i);s.data(o)}})}},N$=wt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Dm={renderTo:function(e,t,n,a){var i=this._private.renderer;return i.renderTo(e,t,n,a),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(n==null){kr("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Cr("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var a=N$(e);a.cy=t,t._private.renderer=new n(a),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var a=n._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Dm.invalidateDimensions=Dm.resize;var Hu={collection:function(e,t){return Ye(e)?this.$(e):Jt(e)?e.collection():Tr(e)?(t||(t={}),new bt(this,e,t.unique,t.removed)):new bt(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Hu.elements=Hu.filter=Hu.$;var ft={},as="t",F$="f";ft.apply=function(r){for(var e=this,t=e._private,n=t.cy,a=n.collection(),i=0;i<r.length;i++){var o=r[i],s=e.getContextMeta(o);if(!s.empty){var u=e.getContextStyle(s),l=e.applyContextStyle(s,u,o);o._private.appliedInitStyle?e.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var f=e.updateStyleHints(o);f&&a.push(o)}}return a};ft.getPropertiesDiff=function(r,e){var t=this,n=t._private.propDiffs=t._private.propDiffs||{},a=r+"-"+e,i=n[a];if(i)return i;for(var o=[],s={},u=0;u<t.length;u++){var l=t[u],f=r[u]===as,d=e[u]===as,h=f!==d,g=l.mappedProperties.length>0;if(h||d&&g){var p=void 0;h&&g||h?p=l.properties:g&&(p=l.mappedProperties);for(var x=0;x<p.length;x++){for(var b=p[x],w=b.name,y=!1,E=u+1;E<t.length;E++){var C=t[E],S=e[E]===as;if(S&&(y=C.properties[b.name]!=null,y))break}!s[w]&&!y&&(s[w]=!0,o.push(w))}}}return n[a]=o,o};ft.getContextMeta=function(r){for(var e=this,t="",n,a=r._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(r);s?t+=as:t+=F$}return n=e.getPropertiesDiff(a,t),r._private.styleCxtKey=t,{key:t,diffPropNames:n,empty:n.length===0}};ft.getContextStyle=function(r){var e=r.key,t=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var a={_private:{key:e}},i=0;i<t.length;i++){var o=t[i],s=e[i]===as;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];a[l.name]=l}}return n[e]=a,a};ft.applyContextStyle=function(r,e,t){for(var n=this,a=r.diffPropNames,i={},o=n.types,s=0;s<a.length;s++){var u=a[s],l=e[u],f=t.pstyle(u);if(!l)if(f)f.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(f!==l){if(l.mapped===o.fn&&f!=null&&f.mapping!=null&&f.mapping.value===l.value){var d=f.mapping,h=d.fnValue=l.value(t);if(h===d.prevFnValue)continue}var g=i[u]={prev:f};n.applyParsedProperty(t,l),g.next=t.pstyle(u),g.next&&g.next.bypass&&(g.next=g.next.bypassed)}}return{diffProps:i}};ft.updateStyleHints=function(r){var e=r._private,t=this,n=t.propertyGroupNames,a=t.propertyGroupKeys,i=function(ie,de,we){return t.getPropertiesHash(ie,de,we)},o=e.styleKey;if(r.removed())return!1;var s=e.group==="nodes",u=r._private.style;n=Object.keys(u);for(var l=0;l<a.length;l++){var f=a[l];e.styleKeys[f]=[oi,Zi]}for(var d=function(ie,de){return e.styleKeys[de][0]=ls(ie,e.styleKeys[de][0])},h=function(ie,de){return e.styleKeys[de][1]=fs(ie,e.styleKeys[de][1])},g=function(ie,de){d(ie,de),h(ie,de)},p=function(ie,de){for(var we=0;we<ie.length;we++){var Ae=ie.charCodeAt(we);d(Ae,de),h(Ae,de)}},x=2e9,b=function(ie){return-128<ie&&ie<128&&Math.floor(ie)!==ie?x-(ie*1024|0):ie},w=0;w<n.length;w++){var y=n[w],E=u[y];if(E!=null){var C=this.properties[y],S=C.type,R=C.groupKey,_=void 0;C.hashOverride!=null?_=C.hashOverride(r,E):E.pfValue!=null&&(_=E.pfValue);var A=C.enums==null?E.value:null,P=_!=null,I=A!=null,D=P||I,L=E.units;if(S.number&&D&&!S.multiple){var M=P?_:A;g(b(M),R),!P&&L!=null&&p(L,R)}else p(E.strValue,R)}}for(var q=[oi,Zi],N=0;N<a.length;N++){var W=a[N],V=e.styleKeys[W];q[0]=ls(V[0],q[0]),q[1]=fs(V[1],q[1])}e.styleKey=rF(q[0],q[1]);var $=e.styleKeys;e.labelDimsKey=wa($.labelDimensions);var X=i(r,["label"],$.labelDimensions);if(e.labelKey=wa(X),e.labelStyleKey=wa(Ru($.commonLabel,X)),!s){var ee=i(r,["source-label"],$.labelDimensions);e.sourceLabelKey=wa(ee),e.sourceLabelStyleKey=wa(Ru($.commonLabel,ee));var K=i(r,["target-label"],$.labelDimensions);e.targetLabelKey=wa(K),e.targetLabelStyleKey=wa(Ru($.commonLabel,K))}if(s){var j=e.styleKeys,fe=j.nodeBody,G=j.nodeBorder,z=j.nodeOutline,Y=j.backgroundImage,te=j.compound,ue=j.pie,oe=j.stripe,Z=[fe,G,z,Y,te,ue,oe].filter(function(Q){return Q!=null}).reduce(Ru,[oi,Zi]);e.nodeKey=wa(Z),e.hasPie=ue!=null&&ue[0]!==oi&&ue[1]!==Zi,e.hasStripe=oe!=null&&oe[0]!==oi&&oe[1]!==Zi}return o!==e.styleKey};ft.clearStyleHints=function(r){var e=r._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};ft.applyParsedProperty=function(r,e){var t=this,n=e,a=r._private.style,i,o=t.types,s=t.properties[n.name].type,u=n.bypass,l=a[n.name],f=l&&l.bypass,d=r._private,h="mapping",g=function(fe){return fe==null?null:fe.pfValue!=null?fe.pfValue:fe.value},p=function(){var fe=g(l),G=g(n);t.checkTriggers(r,n.name,fe,G)};if(e.name==="curve-style"&&r.isEdge()&&(e.value!=="bezier"&&r.isLoop()||e.value==="haystack"&&(r.source().isParent()||r.target().isParent()))&&(n=e=this.parse(e.name,"bezier",u)),n.delete)return a[n.name]=void 0,p(),!0;if(n.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,p(),!0):!1:(p(),!0);if(n.deleteBypass)return l?l.bypass?(a[n.name]=l.bypassed,p(),!0):!1:(p(),!0);var x=function(){Cr("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case o.mapData:{for(var b=n.field.split("."),w=d.data,y=0;y<b.length&&w;y++){var E=b[y];w=w[E]}if(w==null)return x(),!1;var C;if(qe(w)){var S=n.fieldMax-n.fieldMin;S===0?C=0:C=(w-n.fieldMin)/S}else return Cr("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+w+"` for `"+r.id()+"` is non-numeric)"),!1;if(C<0?C=0:C>1&&(C=1),s.color){var R=n.valueMin[0],_=n.valueMax[0],A=n.valueMin[1],P=n.valueMax[1],I=n.valueMin[2],D=n.valueMax[2],L=n.valueMin[3]==null?1:n.valueMin[3],M=n.valueMax[3]==null?1:n.valueMax[3],q=[Math.round(R+(_-R)*C),Math.round(A+(P-A)*C),Math.round(I+(D-I)*C),Math.round(L+(M-L)*C)];i={bypass:n.bypass,name:n.name,value:q,strValue:"rgb("+q[0]+", "+q[1]+", "+q[2]+")"}}else if(s.number){var N=n.valueMin+(n.valueMax-n.valueMin)*C;i=this.parse(n.name,N,n.bypass,h)}else return!1;if(!i)return x(),!1;i.mapping=n,n=i;break}case o.data:{for(var W=n.field.split("."),V=d.data,$=0;$<W.length&&V;$++){var X=W[$];V=V[X]}if(V!=null&&(i=this.parse(n.name,V,n.bypass,h)),!i)return x(),!1;i.mapping=n,n=i;break}case o.fn:{var ee=n.value,K=n.fnValue!=null?n.fnValue:ee(r);if(n.prevFnValue=K,K==null)return Cr("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+r.id()+"` is null)"),!1;if(i=this.parse(n.name,K,n.bypass,h),!i)return Cr("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=Nn(n),n=i;break}case void 0:break;default:return!1}return u?(f?n.bypassed=l.bypassed:n.bypassed=l,a[n.name]=n):f?l.bypassed=n:a[n.name]=n,p(),!0};ft.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!e)n._private.style={};else for(var a=n._private.style,i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s];u!=null&&(u.bypass?u.bypassed=null:a[s]=null)}}};ft.update=function(){var r=this._private.cy,e=r.mutableElements();e.updateStyle()};ft.updateTransitions=function(r,e){var t=this,n=r._private,a=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,o=r.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var s={},u=!1,l=0;l<a.length;l++){var f=a[l],d=r.pstyle(f),h=e[f];if(h){var g=h.prev,p=g,x=h.next!=null?h.next:d,b=!1,w=void 0,y=1e-6;p&&(qe(p.pfValue)&&qe(x.pfValue)?(b=x.pfValue-p.pfValue,w=p.pfValue+y*b):qe(p.value)&&qe(x.value)?(b=x.value-p.value,w=p.value+y*b):Tr(p.value)&&Tr(x.value)&&(b=p.value[0]!==x.value[0]||p.value[1]!==x.value[1]||p.value[2]!==x.value[2],w=p.strValue),b&&(s[f]=x.strValue,this.applyBypass(r,f,w),u=!0))}}if(!u)return;n.transitioning=!0,new po(function(E){o>0?r.delayAnimation(o).play().promise().then(E):E()}).then(function(){return r.animation({style:s,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,a),r.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(r,a),r.emitAndNotify("style"),n.transitioning=!1)};ft.checkTrigger=function(r,e,t,n,a,i){var o=this.properties[e],s=a(o);r.removed()||s!=null&&s(t,n,r)&&i(o)};ft.checkZOrderTrigger=function(r,e,t,n){var a=this;this.checkTrigger(r,e,t,n,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",r)})};ft.checkBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBounds},function(a){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};ft.checkConnectedEdgesBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfConnectedEdges},function(a){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ft.checkParallelEdgesBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfParallelEdges},function(a){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ft.checkTriggers=function(r,e,t,n){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,n),this.checkBoundsTrigger(r,e,t,n),this.checkConnectedEdgesBoundsTrigger(r,e,t,n),this.checkParallelEdgesBoundsTrigger(r,e,t,n)};var As={};As.applyBypass=function(r,e,t,n){var a=this,i=[],o=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var s=0;s<a.properties.length;s++){var u=a.properties[s],l=u.name,f=this.parse(l,t,!0);f&&i.push(f)}}else if(Ye(e)){var d=this.parse(e,t,!0);d&&i.push(d)}else if(yr(e)){var h=e;n=t;for(var g=Object.keys(h),p=0;p<g.length;p++){var x=g[p],b=h[x];if(b===void 0&&(b=h[bl(x)]),b!==void 0){var w=this.parse(x,b,!0);w&&i.push(w)}}}else return!1;if(i.length===0)return!1;for(var y=!1,E=0;E<r.length;E++){for(var C=r[E],S={},R=void 0,_=0;_<i.length;_++){var A=i[_];if(n){var P=C.pstyle(A.name);R=S[A.name]={prev:P}}y=this.applyParsedProperty(C,Nn(A))||y,n&&(R.next=C.pstyle(A.name))}y&&this.updateStyleHints(C),n&&this.updateTransitions(C,S,o)}return y};As.overrideBypass=function(r,e,t){e=Km(e);for(var n=0;n<r.length;n++){var a=r[n],i=a._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,e,t):(i.value=t,i.pfValue!=null&&(i.pfValue=t),s?i.strValue="rgb("+t.join(",")+")":u?i.strValue=t.join(" "):i.strValue=""+t,this.updateStyleHints(a)),this.checkTriggers(a,e,l,t)}};As.removeAllBypasses=function(r,e){return this.removeBypasses(r,this.propertyNames,e)};As.removeBypasses=function(r,e,t){for(var n=!0,a=0;a<r.length;a++){for(var i=r[a],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],f=i.pstyle(l.name);if(!(!f||!f.bypass)){var d="",h=this.parse(u,d,!0),g=o[l.name]={prev:f};this.applyParsedProperty(i,h),g.next=i.pstyle(l.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,o,n)}};var u0={};u0.getEmSizeInPixels=function(){var r=this.containerCss("font-size");return r!=null?parseFloat(r):1};u0.containerCss=function(r){var e=this._private.cy,t=e.container(),n=e.window();if(n&&t&&n.getComputedStyle)return n.getComputedStyle(t).getPropertyValue(r)};var Fn={};Fn.getRenderedStyle=function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)};Fn.getRawStyle=function(r,e){var t=this;if(r=r[0],r){for(var n={},a=0;a<t.properties.length;a++){var i=t.properties[a],o=t.getStylePropertyValue(r,i.name,e);o!=null&&(n[i.name]=o,n[bl(i.name)]=o)}return n}};Fn.getIndexedStyle=function(r,e,t,n){var a=r.pstyle(e)[t][n];return a??r.cy().style().getDefaultProperty(e)[t][0]};Fn.getStylePropertyValue=function(r,e,t){var n=this;if(r=r[0],r){var a=n.properties[e];a.alias&&(a=a.pointsTo);var i=a.type,o=r.pstyle(a.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(t&&i.number&&s!=null&&qe(s)){var f=r.cy().zoom(),d=function(b){return b*f},h=function(b,w){return d(b)+w},g=Tr(s),p=g?u.every(function(x){return x!=null}):u!=null;return p?g?s.map(function(x,b){return h(x,u[b])}).join(" "):h(s,u):g?s.map(function(x){return Ye(x)?x:""+d(x)}).join(" "):""+d(s)}else if(l!=null)return l}return null}};Fn.getAnimationStartStyle=function(r,e){for(var t={},n=0;n<e.length;n++){var a=e[n],i=a.name,o=r.pstyle(i);o!==void 0&&(yr(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(t[i]=o)}return t};Fn.getPropsList=function(r){var e=this,t=[],n=r,a=e.properties;if(n)for(var i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s],l=a[s]||a[Km(s)],f=this.parse(l.name,u);f&&t.push(f)}return t};Fn.getNonDefaultPropertiesHash=function(r,e,t){var n=t.slice(),a,i,o,s,u,l;for(u=0;u<e.length;u++)if(a=e[u],i=r.pstyle(a,!1),i!=null)if(i.pfValue!=null)n[0]=ls(s,n[0]),n[1]=fs(s,n[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),n[0]=ls(s,n[0]),n[1]=fs(s,n[1]);return n};Fn.getPropertiesHash=Fn.getNonDefaultPropertiesHash;var Bl={};Bl.appendFromJson=function(r){for(var e=this,t=0;t<r.length;t++){var n=r[t],a=n.selector,i=n.style||n.css,o=Object.keys(i);e.selector(a);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e};Bl.fromJson=function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e};Bl.json=function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],n=t.selector,a=t.properties,i={},o=0;o<a.length;o++){var s=a[o];i[s.name]=s.strValue}r.push({selector:n?n.toString():"core",style:i})}return r};var l0={};l0.appendFromString=function(r){var e=this,t=this,n=""+r,a,i,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){n.length>a.length?n=n.substr(a.length):n=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=n.match(/^\s*$/);if(l)break;var f=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Cr("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}a=f[0];var d=f[1];if(d!=="core"){var h=new La(d);if(h.invalid){Cr("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),s();continue}}var g=f[2],p=!1;i=g;for(var x=[];;){var b=i.match(/^\s*$/);if(b)break;var w=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!w){Cr("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+g),p=!0;break}o=w[0];var y=w[1],E=w[2],C=e.properties[y];if(!C){Cr("Skipping property: Invalid property name in: "+o),u();continue}var S=t.parse(y,E);if(!S){Cr("Skipping property: Invalid property definition in: "+o),u();continue}x.push({name:y,val:E}),u()}if(p){s();break}t.selector(d);for(var R=0;R<x.length;R++){var _=x[R];t.css(_.name,_.val)}s()}return t};l0.fromString=function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e};var Yr={};(function(){var r=nt,e=MN,t=ON,n=kN,a=qN,i=function(Q){return"^"+Q+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(Q){var ie=r+"|\\w+|"+e+"|"+t+"|"+n+"|"+a;return"^"+Q+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+ie+")\\s*\\,\\s*("+ie+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Yr.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(Q,ie){switch(Q.length){case 2:return ie[0]!=="deg"&&ie[0]!=="rad"&&ie[1]!=="deg"&&ie[1]!=="rad";case 1:return Ye(Q[0])||ie[0]==="deg"||ie[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(Q){var ie=Q.length;return ie===1||ie===2||ie===4}}};var u={zeroNonZero:function(Q,ie){return(Q==null||ie==null)&&Q!==ie||Q==0&&ie!=0?!0:Q!=0&&ie==0},any:function(Q,ie){return Q!=ie},emptyNonEmpty:function(Q,ie){var de=Da(Q),we=Da(ie);return de&&!we||!de&&we}},l=Yr.types,f=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],d=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],g=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],p=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],x=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],b=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(Q,ie,de){return Q===ie?!1:de.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],w=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],y=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],E=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],C=function(Q,ie){return ie.value==="label"?-Q.poolIndex():ie.pfValue},S=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:C},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:C},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],R=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],_=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],A=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],P=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],I=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(Q,ie){return Q===ie?!1:Q==="bezier"||ie==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],D=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],L=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],M=[];Yr.pieBackgroundN=16,M.push({name:"pie-size",type:l.sizeMaybePercent}),M.push({name:"pie-hole",type:l.sizeMaybePercent}),M.push({name:"pie-start-angle",type:l.angle});for(var q=1;q<=Yr.pieBackgroundN;q++)M.push({name:"pie-"+q+"-background-color",type:l.color}),M.push({name:"pie-"+q+"-background-size",type:l.percent}),M.push({name:"pie-"+q+"-background-opacity",type:l.zeroOneNumber});var N=[];Yr.stripeBackgroundN=16,N.push({name:"stripe-size",type:l.sizeMaybePercent}),N.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var W=1;W<=Yr.stripeBackgroundN;W++)N.push({name:"stripe-"+W+"-background-color",type:l.color}),N.push({name:"stripe-"+W+"-background-size",type:l.percent}),N.push({name:"stripe-"+W+"-background-opacity",type:l.zeroOneNumber});var V=[],$=Yr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(Z){$.forEach(function(Q){var ie=Q+"-"+Z.name,de=Z.type,we=Z.triggersBounds;V.push({name:ie,type:de,triggersBounds:we})})},{});var X=Yr.properties=[].concat(x,E,b,w,y,D,p,g,f,d,h,S,R,_,A,M,N,P,I,V,L),ee=Yr.propertyGroups={behavior:x,transition:E,visibility:b,overlay:w,underlay:y,ghost:D,commonLabel:p,labelDimensions:g,mainLabel:f,sourceLabel:d,targetLabel:h,nodeBody:S,nodeBorder:R,nodeOutline:_,backgroundImage:A,pie:M,stripe:N,compound:P,edgeLine:I,edgeArrow:V,core:L},K=Yr.propertyGroupNames={},j=Yr.propertyGroupKeys=Object.keys(ee);j.forEach(function(Z){K[Z]=ee[Z].map(function(Q){return Q.name}),ee[Z].forEach(function(Q){return Q.groupKey=Z})});var fe=Yr.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Yr.propertyNames=X.map(function(Z){return Z.name});for(var G=0;G<X.length;G++){var z=X[G];X[z.name]=z}for(var Y=0;Y<fe.length;Y++){var te=fe[Y],ue=X[te.pointsTo],oe={name:te.name,alias:!0,pointsTo:ue};X.push(oe),X[te.name]=oe}})();Yr.getDefaultProperty=function(r){return this.getDefaultProperties()[r]};Yr.getDefaultProperties=function(){var r=this._private;if(r.defaultProperties!=null)return r.defaultProperties;for(var e=Ze({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Yr.pieBackgroundN;f++){var d=l.name.replace("{{i}}",f),h=l.value;u[d]=h}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Yr.stripeBackgroundN;f++){var d=l.name.replace("{{i}}",f),h=l.value;u[d]=h}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return Yr.arrowPrefixes.forEach(function(f){var d=f+"-"+l.name,h=l.value;u[d]=h}),u},{})),t={},n=0;n<this.properties.length;n++){var a=this.properties[n];if(!a.pointsTo){var i=a.name,o=e[i],s=this.parse(i,o);t[i]=s}}return r.defaultProperties=t,r.defaultProperties};Yr.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Ml={};Ml.parse=function(r,e,t,n){var a=this;if($r(e))return a.parseImplWarn(r,e,t,n);var i=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=t?"t":"f",s=""+e,u=UR(r,s,o,i),l=a.propCache=a.propCache||[],f;return(f=l[u])||(f=l[u]=a.parseImplWarn(r,e,t,n)),(t||n==="mapping")&&(f=Nn(f),f&&(f.value=Nn(f.value))),f};Ml.parseImplWarn=function(r,e,t,n){var a=this.parseImpl(r,e,t,n);return!a&&e!=null&&Cr("The style property `".concat(r,": ").concat(e,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&e==="label"&&Cr("The style value of `label` is deprecated for `"+a.name+"`"),a};Ml.parseImpl=function(r,e,t,n){var a=this;r=Km(r);var i=a.properties[r],o=e,s=a.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,r=i.name);var u=Ye(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(t&&(e===""||e===null))return{name:r,value:e,bypass:!0,deleteBypass:!0};if($r(e))return{name:r,value:e,strValue:"fn",mapped:s.fn,bypass:t};var f,d;if(!(!u||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(s.data.regex).exec(e))){if(t)return!1;var h=s.data;return{name:r,value:f,strValue:""+e,mapped:h,field:f[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(d=new RegExp(s.mapData.regex).exec(e))){if(t||l.multiple)return!1;var g=s.mapData;if(!(l.color||l.number))return!1;var p=this.parse(r,d[4]);if(!p||p.mapped)return!1;var x=this.parse(r,d[5]);if(!x||x.mapped)return!1;if(p.pfValue===x.pfValue||p.strValue===x.strValue)return Cr("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+p.strValue+"`"),this.parse(r,p.strValue);if(l.color){var b=p.value,w=x.value,y=b[0]===w[0]&&b[1]===w[1]&&b[2]===w[2]&&(b[3]===w[3]||(b[3]==null||b[3]===1)&&(w[3]==null||w[3]===1));if(y)return!1}return{name:r,value:d,strValue:""+e,mapped:g,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:p.value,valueMax:x.value,bypass:t}}}if(l.multiple&&n!=="multiple"){var E;if(u?E=e.split(/\s+/):Tr(e)?E=e:E=[e],l.evenMultiple&&E.length%2!==0)return null;for(var C=[],S=[],R=[],_="",A=!1,P=0;P<E.length;P++){var I=a.parse(r,E[P],t,"multiple");A=A||Ye(I.value),C.push(I.value),R.push(I.pfValue!=null?I.pfValue:I.value),S.push(I.units),_+=(P>0?" ":"")+I.strValue}return l.validate&&!l.validate(C,S)?null:l.singleEnum&&A?C.length===1&&Ye(C[0])?{name:r,value:C[0],strValue:C[0],bypass:t}:null:{name:r,value:C,pfValue:R,strValue:_,bypass:t,units:S}}var D=function(){for(var oe=0;oe<l.enums.length;oe++){var Z=l.enums[oe];if(Z===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null};if(l.number){var L,M="px";if(l.units&&(L=l.units),l.implicitUnits&&(M=l.implicitUnits),!l.unitless)if(u){var q="px|em"+(l.allowPercent?"|\\%":"");L&&(q=L);var N=e.match("^("+nt+")("+q+")?$");N&&(e=N[1],L=N[2]||M)}else(!L||l.implicitUnits)&&(L=M);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,D();if(l.integer&&!TN(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var W={name:r,value:e,strValue:""+e+(L||""),units:L,bypass:t};return l.unitless||L!=="px"&&L!=="em"?W.pfValue=e:W.pfValue=L==="px"||!L?e:this.getEmSizeInPixels()*e,(L==="ms"||L==="s")&&(W.pfValue=L==="ms"?e:1e3*e),(L==="deg"||L==="rad")&&(W.pfValue=L==="rad"?e:kF(e)),L==="%"&&(W.pfValue=e/100),W}else if(l.propList){var V=[],$=""+e;if($!=="none"){for(var X=$.split(/\s*,\s*|\s+/),ee=0;ee<X.length;ee++){var K=X[ee].trim();a.properties[K]?V.push(K):Cr("`"+K+"` is not a valid property name")}if(V.length===0)return null}return{name:r,value:V,strValue:V.length===0?"none":V.join(" "),bypass:t}}else if(l.color){var j=NR(e);return j?{name:r,value:j,pfValue:j,strValue:"rgb("+j[0]+","+j[1]+","+j[2]+")",bypass:t}:null}else if(l.regex||l.regexes){if(l.enums){var fe=D();if(fe)return fe}for(var G=l.regexes?l.regexes:[l.regex],z=0;z<G.length;z++){var Y=new RegExp(G[z]),te=Y.exec(e);if(te)return{name:r,value:l.singleRegexMatchValue?te[1]:te,strValue:""+e,bypass:t}}return null}else return l.string?{name:r,value:""+e,strValue:""+e,bypass:t}:l.enums?D():null};var lt=function(e){if(!(this instanceof lt))return new lt(e);if(!Hm(e)){kr("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Rt=lt.prototype;Rt.instanceString=function(){return"style"};Rt.clear=function(){for(var r=this._private,e=r.cy,t=e.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};Rt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Rt.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)};Rt.selector=function(r){var e=r==="core"?null:new La(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this};Rt.css=function(){var r=this,e=arguments;if(e.length===1)for(var t=e[0],n=0;n<r.properties.length;n++){var a=r.properties[n],i=t[a.name];i===void 0&&(i=t[bl(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Rt.style=Rt.css;Rt.cssRule=function(r,e){var t=this.parse(r,e);if(t){var n=this.length-1;this[n].properties.push(t),this[n].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.name.match(/stripe-(\d+)-background-size/)&&t.value&&(this._private.hasStripe=!0),t.mapped&&this[n].mappedProperties.push(t);var a=!this[n].selector;a&&(this._private.coreStyle[t.name]=t)}return this};Rt.append=function(r){return OR(r)?r.appendToStyle(this):Tr(r)?this.appendFromJson(r):Ye(r)&&this.appendFromString(r),this};lt.fromJson=function(r,e){var t=new lt(r);return t.fromJson(e),t};lt.fromString=function(r,e){return new lt(r).fromString(e)};[ft,As,u0,Fn,Bl,l0,Yr,Ml].forEach(function(r){Ze(Rt,r)});lt.types=Rt.types;lt.properties=Rt.properties;lt.propertyGroups=Rt.propertyGroups;lt.propertyGroupNames=Rt.propertyGroupNames;lt.propertyGroupKeys=Rt.propertyGroupKeys;var z$={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return OR(e)?t.style=e.generateStyle(this):Tr(e)?t.style=lt.fromJson(this,e):Ye(e)?t.style=lt.fromString(this,e):t.style=lt(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},$$="single",hi={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=$$),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,a,i,o,s;switch(e.length){case 0:return t;case 1:if(Ye(e[0]))return n=e[0],t[n];if(yr(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,qe(o)&&(t.x=o),qe(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],a=e[1],(n==="x"||n==="y")&&qe(a)&&(t[n]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n=arguments,a=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(n.length){case 1:yr(e)&&(s=n[0],u=s.x,l=s.y,qe(u)&&(a.x+=u),qe(l)&&(a.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=t,(i==="x"||i==="y")&&qe(o)&&(a[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var a=this._private;a.zoom=n.zoom,a.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(qe(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(Ye(e)){var a=e;e=this.$(a)}else if(PN(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else Jt(e)||(e=this.mutableElements());if(!(Jt(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),s=this.height(),u;if(t=qe(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((o-2*t)/n.w,(s-2*t)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(n.x1+n.x2))/2,y:(s-u*(n.y1+n.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var a=e;e=a.min,t=a.max}return qe(e)&&qe(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):qe(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:qe(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,a=t.zoom,i,o,s=!1;if(t.zoomingEnabled||(s=!0),qe(e)?o=e:yr(e)&&(o=e.level,e.position!=null?i=El(e.position,a,n):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(s=!0)),o=o>t.maxZoom?t.maxZoom:o,o=o<t.minZoom?t.minZoom:o,s||!qe(o)||o===a||i!=null&&(!qe(i.x)||!qe(i.y)))return null;if(i!=null){var u=n,l=a,f=o,d={x:-f/l*(i.x-u.x)+i.x,y:-f/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:d}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,n=!0,a=!0,i=[],o=!1,s=!1;if(!e)return this;if(qe(e.zoom)||(n=!1),yr(e.pan)||(a=!1),!n&&!a)return this;if(n){var u=e.zoom;u<t.minZoom||u>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=u,i.push("zoom"))}if(a&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;qe(l.x)&&(t.pan.x=l.x,s=!1),qe(l.y)&&(t.pan.y=l.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(Ye(e)){var n=e;e=this.mutableElements().filter(n)}else Jt(e)||(e=this.mutableElements());if(e.length!==0){var a=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var s={x:(i-t*(a.x1+a.x2))/2,y:(o-t*(a.y1+a.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?(function(){var a=n.window().getComputedStyle(t),i=function(s){return parseFloat(a.getPropertyValue(s))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),a={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};hi.centre=hi.center;hi.autolockNodes=hi.autolock;hi.autoungrabifyNodes=hi.autoungrabify;var ps={data:Er.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Er.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Er.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Er.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ps.attr=ps.data;ps.removeAttr=ps.removeData;var ys=function(e){var t=this;e=Ze({},e);var n=e.container;n&&!rl(n)&&rl(n[0])&&(n=n[0]);var a=n?n._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];n&&(n._cyreg=a),a.cy=t;var o=tt!==void 0&&n!==void 0&&!e.headless,s=e;s.layout=Ze({name:o?"grid":"null"},s.layout),s.renderer=Ze({name:o?"canvas":"null"},s.renderer);var u=function(p,x,b){return x!==void 0?x:b!==void 0?b:p},l=this._private={container:n,ready:!1,options:s,elements:new bt(this),listeners:[],aniEles:new bt(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:qe(s.zoom)?s.zoom:1,pan:{x:yr(s.pan)&&qe(s.pan.x)?s.pan.x:0,y:yr(s.pan)&&qe(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var f=function(p,x){var b=p.some(IN);if(b)return po.all(p).then(x);x(p)};l.styleEnabled&&t.setStyle([]);var d=Ze({},s,s.renderer);t.initRenderer(d);var h=function(p,x,b){t.notifications(!1);var w=t.mutableElements();w.length>0&&w.remove(),p!=null&&(yr(p)||Tr(p))&&t.add(p),t.one("layoutready",function(E){t.notifications(!0),t.emit(E),t.one("load",x),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",b),t.emit("done")});var y=Ze({},t._private.options.layout);y.eles=t.elements(),t.layout(y).run()};f([s.style,s.elements],function(g){var p=g[0],x=g[1];l.styleEnabled&&t.style().append(p),h(x,function(){t.startAnimationLoop(),l.ready=!0,$r(s.ready)&&t.on("ready",s.ready);for(var b=0;b<i.length;b++){var w=i[b];t.on("ready",w)}a&&(a.readies=[]),t.emit("ready")},s.done)})},ul=ys.prototype;Ze(ul,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return tt;var t=this._private.container.ownerDocument;return t===void 0||t==null?tt:t.defaultView||tt},mount:function(e){if(e!=null){var t=this,n=t._private,a=n.options;return!rl(e)&&rl(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(Ze({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),t.startAnimationLoop(),t.style(a.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Nn(this._private.options)},json:function(e){var t=this,n=t._private,a=t.mutableElements(),i=function(C){return t.getElementById(C.id())};if(yr(e)){if(t.startBatch(),e.elements){var o={},s=function(C,S){for(var R=[],_=[],A=0;A<C.length;A++){var P=C[A];if(!P.data.id){Cr("cy.json() cannot handle elements without an ID attribute");continue}var I=""+P.data.id,D=t.getElementById(I);o[I]=!0,D.length!==0?_.push({ele:D,json:P}):(S&&(P.group=S),R.push(P))}t.add(R);for(var L=0;L<_.length;L++){var M=_[L],q=M.ele,N=M.json;q.json(N)}};if(Tr(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var f=u[l],d=e.elements[f];Tr(d)&&s(d,f)}var h=t.collection();a.filter(function(E){return!o[E.id()]}).forEach(function(E){E.isParent()?h.merge(E):E.remove()}),h.forEach(function(E){return E.children().move({parent:null})}),h.forEach(function(E){return i(E).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var g=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<g.length;p++){var x=g[p];e[x]!=null&&t[x](e[x])}return t.endBatch(),this}else{var b=!!e,w={};b?w.elements=this.elements().map(function(E){return E.json()}):(w.elements={},a.forEach(function(E){var C=E.group();w.elements[C]||(w.elements[C]=[]),w.elements[C].push(E.json())})),this._private.styleEnabled&&(w.style=t.style().json()),w.data=Nn(t.data());var y=n.options;return w.zoomingEnabled=n.zoomingEnabled,w.userZoomingEnabled=n.userZoomingEnabled,w.zoom=n.zoom,w.minZoom=n.minZoom,w.maxZoom=n.maxZoom,w.panningEnabled=n.panningEnabled,w.userPanningEnabled=n.userPanningEnabled,w.pan=Nn(n.pan),w.boxSelectionEnabled=n.boxSelectionEnabled,w.renderer=Nn(y.renderer),w.hideEdgesOnViewport=y.hideEdgesOnViewport,w.textureOnViewport=y.textureOnViewport,w.wheelSensitivity=y.wheelSensitivity,w.motionBlur=y.motionBlur,w.multiClickDebounceTime=y.multiClickDebounceTime,w}}});ul.$id=ul.getElementById;[I$,O$,OA,Im,Uu,q$,Dm,Hu,z$,hi,ps].forEach(function(r){Ze(ul,r)});var V$={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},G$={maximal:!1,acyclic:!1},Hi=function(e){return e.scratch("breadthfirst")},EE=function(e,t){return e.scratch("breadthfirst",t)};function kA(r){this.options=Ze({},V$,G$,r)}kA.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=t.nodes().filter(function(Se){return Se.isChildless()}),a=t,i=r.directed,o=r.acyclic||r.maximal||r.maximalAdjustments>0,s=!!r.boundingBox,u=Lt(s?r.boundingBox:structuredClone(e.extent())),l;if(Jt(r.roots))l=r.roots;else if(Tr(r.roots)){for(var f=[],d=0;d<r.roots.length;d++){var h=r.roots[d],g=e.getElementById(h);f.push(g)}l=e.collection(f)}else if(Ye(r.roots))l=e.$(r.roots);else if(i)l=n.roots();else{var p=t.components();l=e.collection();for(var x=function(){var Ee=p[b],re=Ee.maxDegree(!1),ce=Ee.filter(function(_e){return _e.degree(!1)===re});l=l.add(ce)},b=0;b<p.length;b++)x()}var w=[],y={},E=function(Ee,re){w[re]==null&&(w[re]=[]);var ce=w[re].length;w[re].push(Ee),EE(Ee,{index:ce,depth:re})},C=function(Ee,re){var ce=Hi(Ee),_e=ce.depth,me=ce.index;w[_e][me]=null,Ee.isChildless()&&E(Ee,re)};a.bfs({roots:l,directed:r.directed,visit:function(Ee,re,ce,_e,me){var Te=Ee[0],De=Te.id();Te.isChildless()&&E(Te,me),y[De]=!0}});for(var S=[],R=0;R<n.length;R++){var _=n[R];y[_.id()]||S.push(_)}var A=function(Ee){for(var re=w[Ee],ce=0;ce<re.length;ce++){var _e=re[ce];if(_e==null){re.splice(ce,1),ce--;continue}EE(_e,{depth:Ee,index:ce})}},P=function(Ee,re){for(var ce=Hi(Ee),_e=Ee.incomers().filter(function(ke){return ke.isNode()&&t.has(ke)}),me=-1,Te=Ee.id(),De=0;De<_e.length;De++){var Ne=_e[De],ze=Hi(Ne);me=Math.max(me,ze.depth)}if(ce.depth<=me){if(!r.acyclic&&re[Te])return null;var $e=me+1;return C(Ee,$e),re[Te]=$e,!0}return!1};if(i&&o){var I=[],D={},L=function(Ee){return I.push(Ee)},M=function(){return I.shift()};for(n.forEach(function(Se){return I.push(Se)});I.length>0;){var q=M(),N=P(q,D);if(N)q.outgoers().filter(function(Se){return Se.isNode()&&t.has(Se)}).forEach(L);else if(N===null){Cr("Detected double maximal shift for node `"+q.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var W=0;if(r.avoidOverlap)for(var V=0;V<n.length;V++){var $=n[V],X=$.layoutDimensions(r),ee=X.w,K=X.h;W=Math.max(W,ee,K)}var j={},fe=function(Ee){if(j[Ee.id()])return j[Ee.id()];for(var re=Hi(Ee).depth,ce=Ee.neighborhood(),_e=0,me=0,Te=0;Te<ce.length;Te++){var De=ce[Te];if(!(De.isEdge()||De.isParent()||!n.has(De))){var Ne=Hi(De);if(Ne!=null){var ze=Ne.index,$e=Ne.depth;if(!(ze==null||$e==null)){var ke=w[$e].length;$e<re&&(_e+=ze/ke,me++)}}}}return me=Math.max(1,me),_e=_e/me,me===0&&(_e=0),j[Ee.id()]=_e,_e},G=function(Ee,re){var ce=fe(Ee),_e=fe(re),me=ce-_e;return me===0?qR(Ee.id(),re.id()):me};r.depthSort!==void 0&&(G=r.depthSort);for(var z=w.length,Y=0;Y<z;Y++)w[Y].sort(G),A(Y);for(var te=[],ue=0;ue<S.length;ue++)te.push(S[ue]);var oe=function(){for(var Ee=0;Ee<z;Ee++)A(Ee)};te.length&&(w.unshift(te),z=w.length,oe());for(var Z=0,Q=0;Q<z;Q++)Z=Math.max(w[Q].length,Z);var ie={x:u.x1+u.w/2,y:u.y1+u.h/2},de=n.reduce(function(Se,Ee){return(function(re){return{w:Se.w===-1?re.w:(Se.w+re.w)/2,h:Se.h===-1?re.h:(Se.h+re.h)/2}})(Ee.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),we=Math.max(z===1?0:s?(u.h-r.padding*2-de.h)/(z-1):(u.h-r.padding*2-de.h)/(z+1),W),Ae=w.reduce(function(Se,Ee){return Math.max(Se,Ee.length)},0),ve=function(Ee){var re=Hi(Ee),ce=re.depth,_e=re.index;if(r.circle){var me=Math.min(u.w/2/z,u.h/2/z);me=Math.max(me,W);var Te=me*ce+me-(z>0&&w[0].length<=3?me/2:0),De=2*Math.PI/w[ce].length*_e;return ce===0&&w[0].length===1&&(Te=1),{x:ie.x+Te*Math.cos(De),y:ie.y+Te*Math.sin(De)}}else{var Ne=w[ce].length,ze=Math.max(Ne===1?0:s?(u.w-r.padding*2-de.w)/((r.grid?Ae:Ne)-1):(u.w-r.padding*2-de.w)/((r.grid?Ae:Ne)+1),W),$e={x:ie.x+(_e+1-(Ne+1)/2)*ze,y:ie.y+(ce+1-(z+1)/2)*we};return $e}},le={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(le).indexOf(r.direction)===-1&&kr("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(le).join(", ")));var Me=function(Ee){return iF(ve(Ee),u,le[r.direction])};return t.nodes().layoutPositions(this,r,Me),this};var W$={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function qA(r){this.options=Ze({},W$,r)}qA.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=Lt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,d=0,h=0;h<i.length;h++){var g=i[h],p=g.layoutDimensions(e),x=p.w,b=p.h;d=Math.max(d,x,b)}if(qe(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(o.h,o.w)/2-d,i.length>1&&e.avoidOverlap){d*=1.75;var w=Math.cos(l)-Math.cos(0),y=Math.sin(l)-Math.sin(0),E=Math.sqrt(d*d/(w*w+y*y));f=Math.max(E,f)}var C=function(R,_){var A=e.startAngle+_*l*(a?1:-1),P=f*Math.cos(A),I=f*Math.sin(A),D={x:s.x+P,y:s.y+I};return D};return n.nodes().layoutPositions(this,e,C),this};var U$={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function NA(r){this.options=Ze({},U$,r)}NA.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=r.cy,a=e.eles,i=a.nodes().not(":parent"),o=Lt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,f=0;f<i.length;f++){var d=i[f],h=void 0;h=e.concentric(d),u.push({value:h,node:d}),d._private.scratch.concentric=h}i.updateStyle();for(var g=0;g<i.length;g++){var p=i[g],x=p.layoutDimensions(e);l=Math.max(l,x.w,x.h)}u.sort(function(we,Ae){return Ae.value-we.value});for(var b=e.levelWidth(i),w=[[]],y=w[0],E=0;E<u.length;E++){var C=u[E];if(y.length>0){var S=Math.abs(y[0].value-C.value);S>=b&&(y=[],w.push(y))}y.push(C)}var R=l+e.minNodeSpacing;if(!e.avoidOverlap){var _=w.length>0&&w[0].length>1,A=Math.min(o.w,o.h)/2-R,P=A/(w.length+_?1:0);R=Math.min(R,P)}for(var I=0,D=0;D<w.length;D++){var L=w[D],M=e.sweep===void 0?2*Math.PI-2*Math.PI/L.length:e.sweep,q=L.dTheta=M/Math.max(1,L.length-1);if(L.length>1&&e.avoidOverlap){var N=Math.cos(q)-Math.cos(0),W=Math.sin(q)-Math.sin(0),V=Math.sqrt(R*R/(N*N+W*W));I=Math.max(V,I)}L.r=I,I+=R}if(e.equidistant){for(var $=0,X=0,ee=0;ee<w.length;ee++){var K=w[ee],j=K.r-X;$=Math.max($,j)}X=0;for(var fe=0;fe<w.length;fe++){var G=w[fe];fe===0&&(X=G.r),G.r=X,X+=$}}for(var z={},Y=0;Y<w.length;Y++)for(var te=w[Y],ue=te.dTheta,oe=te.r,Z=0;Z<te.length;Z++){var Q=te[Z],ie=e.startAngle+(t?1:-1)*ue*Z,de={x:s.x+oe*Math.cos(ie),y:s.y+oe*Math.sin(ie)};z[Q.node.id()]=de}return a.nodes().layoutPositions(this,e,function(we){var Ae=we.id();return z[Ae]}),this};var tv,H$={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Ll(r){this.options=Ze({},H$,r),this.options.layout=this;var e=this.options.eles.nodes(),t=this.options.eles.edges(),n=t.filter(function(a){var i=a.source().data("id"),o=a.target().data("id"),s=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(n)}Ll.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(r.animate===!0||r.animate===!1)&&t.emit({type:"layoutstart",layout:t}),r.debug===!0?tv=!0:tv=!1;var n=K$(e,t,r);tv&&Y$(n),r.randomize&&X$(n);var a=ta(),i=function(){Z$(n,e,r),r.fit===!0&&e.fit(r.padding)},o=function(h){return!(t.stopped||h>=r.numIter||(Q$(n,r),n.temperature=n.temperature*r.coolingFactor,n.temperature<r.minTemp))},s=function(){if(r.animate===!0||r.animate===!1)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var h=r.eles.nodes(),g=zA(n,r,h);h.layoutPositions(t,r,g)}},u=0,l=!0;if(r.animate===!0){var f=function(){for(var h=0;l&&h<r.refresh;)l=o(u),u++,h++;if(!l)_E(n,r),s();else{var g=ta();g-a>=r.animationThreshold&&i(),tl(f)}};f()}else{for(;l;)l=o(u),u++;_E(n,r),s()}return this};Ll.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Ll.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var K$=function(e,t,n){for(var a=n.eles.edges(),i=n.eles.nodes(),o=Lt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=n.eles.components(),l={},f=0;f<u.length;f++)for(var d=u[f],h=0;h<d.length;h++){var g=d[h];l[g.id()]=f}for(var f=0;f<s.nodeSize;f++){var p=i[f],x=p.layoutDimensions(n),b={};b.isLocked=p.locked(),b.id=p.data("id"),b.parentId=p.data("parent"),b.cmptId=l[p.id()],b.children=[],b.positionX=p.position("x"),b.positionY=p.position("y"),b.offsetX=0,b.offsetY=0,b.height=x.w,b.width=x.h,b.maxX=b.positionX+b.width/2,b.minX=b.positionX-b.width/2,b.maxY=b.positionY+b.height/2,b.minY=b.positionY-b.height/2,b.padLeft=parseFloat(p.style("padding")),b.padRight=parseFloat(p.style("padding")),b.padTop=parseFloat(p.style("padding")),b.padBottom=parseFloat(p.style("padding")),b.nodeRepulsion=$r(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,s.layoutNodes.push(b),s.idToIndex[b.id]=f}for(var w=[],y=0,E=-1,C=[],f=0;f<s.nodeSize;f++){var p=s.layoutNodes[f],S=p.parentId;S!=null?s.layoutNodes[s.idToIndex[S]].children.push(p.id):(w[++E]=p.id,C.push(p.id))}for(s.graphSet.push(C);y<=E;){var R=w[y++],_=s.idToIndex[R],g=s.layoutNodes[_],A=g.children;if(A.length>0){s.graphSet.push(A);for(var f=0;f<A.length;f++)w[++E]=A[f]}}for(var f=0;f<s.graphSet.length;f++)for(var P=s.graphSet[f],h=0;h<P.length;h++){var I=s.idToIndex[P[h]];s.indexToGraph[I]=f}for(var f=0;f<s.edgeSize;f++){var D=a[f],L={};L.id=D.data("id"),L.sourceId=D.data("source"),L.targetId=D.data("target");var M=$r(n.idealEdgeLength)?n.idealEdgeLength(D):n.idealEdgeLength,q=$r(n.edgeElasticity)?n.edgeElasticity(D):n.edgeElasticity,N=s.idToIndex[L.sourceId],W=s.idToIndex[L.targetId],V=s.indexToGraph[N],$=s.indexToGraph[W];if(V!=$){for(var X=j$(L.sourceId,L.targetId,s),ee=s.graphSet[X],K=0,b=s.layoutNodes[N];ee.indexOf(b.id)===-1;)b=s.layoutNodes[s.idToIndex[b.parentId]],K++;for(b=s.layoutNodes[W];ee.indexOf(b.id)===-1;)b=s.layoutNodes[s.idToIndex[b.parentId]],K++;M*=K*n.nestingFactor}L.idealLength=M,L.elasticity=q,s.layoutEdges.push(L)}return s},j$=function(e,t,n){var a=FA(e,t,0,n);return 2>a.count?0:a.graph},FA=function(e,t,n,a){var i=a.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=a.idToIndex[u],f=a.layoutNodes[l].children;if(f.length!==0){var d=a.indexToGraph[a.idToIndex[f[0]]],h=FA(e,t,d,a);if(h.count!==0)if(h.count===1){if(o++,o===2)break}else return h}}return{count:o,graph:n}},Y$,X$=function(e,t){for(var n=e.clientWidth,a=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*a)}},zA=function(e,t,n){var a=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(t.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,f=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:a.x1+l*a.w,y:a.y1+f*a.h}}else return{x:u.positionX,y:u.positionY}}},Z$=function(e,t,n){var a=n.layout,i=n.eles.nodes(),o=zA(e,n,i);i.positions(o),e.ready!==!0&&(e.ready=!0,a.one("layoutready",n.ready),a.emit({type:"layoutready",layout:this}))},Q$=function(e,t,n){J$(e,t),t3(e),n3(e,t),a3(e),i3(e)},J$=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var a=e.graphSet[n],i=a.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[a[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[a[u]]];e3(s,l,e,t)}},CE=function(e){return-1+2*e*Math.random()},e3=function(e,t,n,a){var i=e.cmptId,o=t.cmptId;if(!(i!==o&&!n.isCompound)){var s=t.positionX-e.positionX,u=t.positionY-e.positionY,l=1;s===0&&u===0&&(s=CE(l),u=CE(l));var f=r3(e,t,s,u);if(f>0)var d=a.nodeOverlap*f,h=Math.sqrt(s*s+u*u),g=d*s/h,p=d*u/h;else var x=ll(e,s,u),b=ll(t,-1*s,-1*u),w=b.x-x.x,y=b.y-x.y,E=w*w+y*y,h=Math.sqrt(E),d=(e.nodeRepulsion+t.nodeRepulsion)/E,g=d*w/h,p=d*y/h;e.isLocked||(e.offsetX-=g,e.offsetY-=p),t.isLocked||(t.offsetX+=g,t.offsetY+=p)}},r3=function(e,t,n,a){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(a>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},ll=function(e,t,n){var a=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=n/t,l=o/s,f={};return t===0&&0<n||t===0&&0>n?(f.x=a,f.y=i+o/2,f):0<t&&-1*l<=u&&u<=l?(f.x=a+s/2,f.y=i+s*n/2/t,f):0>t&&-1*l<=u&&u<=l?(f.x=a-s/2,f.y=i-s*n/2/t,f):0<n&&(u<=-1*l||u>=l)?(f.x=a+o*t/2/n,f.y=i+o/2,f):(0>n&&(u<=-1*l||u>=l)&&(f.x=a-o*t/2/n,f.y=i-o/2),f)},t3=function(e,t){for(var n=0;n<e.edgeSize;n++){var a=e.layoutEdges[n],i=e.idToIndex[a.sourceId],o=e.layoutNodes[i],s=e.idToIndex[a.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,f=u.positionY-o.positionY;if(!(l===0&&f===0)){var d=ll(o,l,f),h=ll(u,-1*l,-1*f),g=h.x-d.x,p=h.y-d.y,x=Math.sqrt(g*g+p*p),b=Math.pow(a.idealLength-x,2)/a.elasticity;if(x!==0)var w=b*g/x,y=b*p/x;else var w=0,y=0;o.isLocked||(o.offsetX+=w,o.offsetY+=y),u.isLocked||(u.offsetX-=w,u.offsetY-=y)}}},n3=function(e,t){if(t.gravity!==0)for(var n=1,a=0;a<e.graphSet.length;a++){var i=e.graphSet[a],o=i.length;if(a===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[l.parentId]],s=f.positionX,u=f.positionY;for(var d=0;d<o;d++){var h=e.layoutNodes[e.idToIndex[i[d]]];if(!h.isLocked){var g=s-h.positionX,p=u-h.positionY,x=Math.sqrt(g*g+p*p);if(x>n){var b=t.gravity*g/x,w=t.gravity*p/x;h.offsetX+=b,h.offsetY+=w}}}}},a3=function(e,t){var n=[],a=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;a<=i;){var o=n[a++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var f=u.offsetX,d=u.offsetY,h=0;h<l.length;h++){var g=e.layoutNodes[e.idToIndex[l[h]]];g.offsetX+=f,g.offsetY+=d,n[++i]=l[h]}u.offsetX=0,u.offsetY=0}}},i3=function(e,t){for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];if(!(0<a.children.length||a.isLocked)){var i=o3(a.offsetX,a.offsetY,e.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,$A(a,e)}}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},o3=function(e,t,n){var a=Math.sqrt(e*e+t*t);if(a>n)var i={x:n*e/a,y:n*t/a};else var i={x:e,y:t};return i},$A=function(e,t){var n=e.parentId;if(n!=null){var a=t.layoutNodes[t.idToIndex[n]],i=!1;if((a.maxX==null||e.maxX+a.padRight>a.maxX)&&(a.maxX=e.maxX+a.padRight,i=!0),(a.minX==null||e.minX-a.padLeft<a.minX)&&(a.minX=e.minX-a.padLeft,i=!0),(a.maxY==null||e.maxY+a.padBottom>a.maxY)&&(a.maxY=e.maxY+a.padBottom,i=!0),(a.minY==null||e.minY-a.padTop<a.minY)&&(a.minY=e.minY-a.padTop,i=!0),i)return $A(a,t)}},_E=function(e,t){for(var n=e.layoutNodes,a=[],i=0;i<n.length;i++){var o=n[i],s=o.cmptId,u=a[s]=a[s]||[];u.push(o)}for(var l=0,i=0;i<a.length;i++){var f=a[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var d=0;d<f.length;d++){var h=f[d];f.x1=Math.min(f.x1,h.positionX-h.width/2),f.x2=Math.max(f.x2,h.positionX+h.width/2),f.y1=Math.min(f.y1,h.positionY-h.height/2),f.y2=Math.max(f.y2,h.positionY+h.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,l+=f.w*f.h}}a.sort(function(y,E){return E.w*E.h-y.w*y.h});for(var g=0,p=0,x=0,b=0,w=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<a.length;i++){var f=a[i];if(f){for(var d=0;d<f.length;d++){var h=f[d];h.isLocked||(h.positionX+=g-f.x1,h.positionY+=p-f.y1)}g+=f.w+t.componentSpacing,x+=f.w+t.componentSpacing,b=Math.max(b,f.h),x>w&&(p+=b+t.componentSpacing,g=0,x=0,b=0)}}},s3={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function VA(r){this.options=Ze({},s3,r)}VA.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));var i=Lt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)n.nodes().layoutPositions(this,e,function(fe){return{x:i.x1,y:i.y1}});else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),f=function(G){if(G==null)return Math.min(u,l);var z=Math.min(u,l);z==u?u=G:l=G},d=function(G){if(G==null)return Math.max(u,l);var z=Math.max(u,l);z==u?u=G:l=G},h=e.rows,g=e.cols!=null?e.cols:e.columns;if(h!=null&&g!=null)u=h,l=g;else if(h!=null&&g==null)u=h,l=Math.ceil(o/u);else if(h==null&&g!=null)l=g,u=Math.ceil(o/l);else if(l*u>o){var p=f(),x=d();(p-1)*x>=o?f(p-1):(x-1)*p>=o&&d(x-1)}else for(;l*u<o;){var b=f(),w=d();(w+1)*b>=o?d(w+1):f(b+1)}var y=i.w/l,E=i.h/u;if(e.condense&&(y=0,E=0),e.avoidOverlap)for(var C=0;C<a.length;C++){var S=a[C],R=S._private.position;(R.x==null||R.y==null)&&(R.x=0,R.y=0);var _=S.layoutDimensions(e),A=e.avoidOverlapPadding,P=_.w+A,I=_.h+A;y=Math.max(y,P),E=Math.max(E,I)}for(var D={},L=function(G,z){return!!D["c-"+G+"-"+z]},M=function(G,z){D["c-"+G+"-"+z]=!0},q=0,N=0,W=function(){N++,N>=l&&(N=0,q++)},V={},$=0;$<a.length;$++){var X=a[$],ee=e.position(X);if(ee&&(ee.row!==void 0||ee.col!==void 0)){var K={row:ee.row,col:ee.col};if(K.col===void 0)for(K.col=0;L(K.row,K.col);)K.col++;else if(K.row===void 0)for(K.row=0;L(K.row,K.col);)K.row++;V[X.id()]=K,M(K.row,K.col)}}var j=function(G,z){var Y,te;if(G.locked()||G.isParent())return!1;var ue=V[G.id()];if(ue)Y=ue.col*y+y/2+i.x1,te=ue.row*E+E/2+i.y1;else{for(;L(q,N);)W();Y=N*y+y/2+i.x1,te=q*E+E/2+i.y1,M(q,N),W()}return{x:Y,y:te}};a.layoutPositions(this,e,j)}return this};var u3={ready:function(){},stop:function(){}};function f0(r){this.options=Ze({},u3,r)}f0.prototype.run=function(){var r=this.options,e=r.eles,t=this;return r.cy,t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this};f0.prototype.stop=function(){return this};var l3={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function GA(r){this.options=Ze({},l3,r)}GA.prototype.run=function(){var r=this.options,e=r.eles,t=e.nodes(),n=$r(r.positions);function a(i){if(r.positions==null)return DF(i.position());if(n)return r.positions(i);var o=r.positions[i._private.data.id];return o??null}return t.layoutPositions(this,r,function(i,o){var s=a(i);return i.locked()||s==null?!1:s}),this};var f3={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function WA(r){this.options=Ze({},f3,r)}WA.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=Lt(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a=function(o,s){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return t.nodes().layoutPositions(this,r,a),this};var c3=[{name:"breadthfirst",impl:kA},{name:"circle",impl:qA},{name:"concentric",impl:NA},{name:"cose",impl:Ll},{name:"grid",impl:VA},{name:"null",impl:f0},{name:"preset",impl:GA},{name:"random",impl:WA}];function UA(r){this.options=r,this.notifications=0}var SE=function(){},TE=function(){throw new Error("A headless instance can not render images")};UA.prototype={recalculateRenderedStyle:SE,notify:function(){this.notifications++},init:SE,isHeadless:function(){return!0},png:TE,jpg:TE};var c0={};c0.arrowShapeWidth=.3;c0.registerArrowShapes=function(){var r=this.arrowShapes={},e=this,t=function(l,f,d,h,g,p,x){var b=g.x-d/2-x,w=g.x+d/2+x,y=g.y-d/2-x,E=g.y+d/2+x,C=b<=l&&l<=w&&y<=f&&f<=E;return C},n=function(l,f,d,h,g){var p=l*Math.cos(h)-f*Math.sin(h),x=l*Math.sin(h)+f*Math.cos(h),b=p*d,w=x*d,y=b+g.x,E=w+g.y;return{x:y,y:E}},a=function(l,f,d,h){for(var g=[],p=0;p<l.length;p+=2){var x=l[p],b=l[p+1];g.push(n(x,b,f,d,h))}return g},i=function(l){for(var f=[],d=0;d<l.length;d++){var h=l[d];f.push(h.x,h.y)}return f},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,f){Ye(f)&&(f=r[f]),r[l]=Ze({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(h,g,p,x,b,w){var y=i(a(this.points,p+2*w,x,b)),E=Vt(h,g,y);return E},roughCollide:t,draw:function(h,g,p,x){var b=a(this.points,g,p,x);e.arrowShapeImpl("polygon")(h,b)},spacing:function(h){return 0},gap:o},f)};s("none",{collide:nl,roughCollide:nl,draw:Xm,spacing:zw,gap:zw}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:function(l,f,d,h,g){var p=a(this.points,f,d,h),x=this.controlPoint,b=n(x[0],x[1],f,d,h);e.arrowShapeImpl(this.name)(l,p,b)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,f,d,h,g,p,x){var b=i(a(this.points,d+2*x,h,g)),w=i(a(this.pointsTee,d+2*x,h,g)),y=Vt(l,f,b)||Vt(l,f,w);return y},draw:function(l,f,d,h,g){var p=a(this.points,f,d,h),x=a(this.pointsTee,f,d,h);e.arrowShapeImpl(this.name)(l,p,x)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,f,d,h,g,p,x){var b=g,w=Math.pow(b.x-l,2)+Math.pow(b.y-f,2)<=Math.pow((d+2*x)*this.radius,2),y=i(a(this.points,d+2*x,h,g));return Vt(l,f,y)||w},draw:function(l,f,d,h,g){var p=a(this.pointsTr,f,d,h);e.arrowShapeImpl(this.name)(l,p,h.x,h.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,f){var d=this.baseCrossLinePts.slice(),h=f/l,g=3,p=5;return d[g]=d[g]-h,d[p]=d[p]-h,d},collide:function(l,f,d,h,g,p,x){var b=i(a(this.points,d+2*x,h,g)),w=i(a(this.crossLinePts(d,p),d+2*x,h,g)),y=Vt(l,f,b)||Vt(l,f,w);return y},draw:function(l,f,d,h,g){var p=a(this.points,f,d,h),x=a(this.crossLinePts(f,g),f,d,h);e.arrowShapeImpl(this.name)(l,p,x)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,f,d,h,g,p,x){var b=g,w=Math.pow(b.x-l,2)+Math.pow(b.y-f,2)<=Math.pow((d+2*x)*this.radius,2);return w},draw:function(l,f,d,h,g){e.arrowShapeImpl(this.name)(l,h.x,h.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var mi={};mi.projectIntoViewport=function(r,e){var t=this.cy,n=this.findContainerClientCoords(),a=n[0],i=n[1],o=n[4],s=t.pan(),u=t.zoom(),l=((r-a)/o-s.x)/u,f=((e-i)/o-s.y)/u;return[l,f]};mi.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),n=function(w){return parseFloat(t.getPropertyValue(w))},a={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},i={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=r.clientWidth,s=r.clientHeight,u=a.left+a.right,l=a.top+a.bottom,f=i.left+i.right,d=e.width/(o+f),h=o-u,g=s-l,p=e.left+a.left+i.left,x=e.top+a.top+i.top;return this.containerBB=[p,x,h,g,d]};mi.invalidateContainerClientCoordsCache=function(){this.containerBB=null};mi.findNearestElement=function(r,e,t,n){return this.findNearestElements(r,e,t,n)[0]};mi.findNearestElements=function(r,e,t,n){var a=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),f=(n?24:8)/u,d=(n?8:2)/u,h=(n?8:2)/u,g=1/0,p,x;t&&(o=o.interactive);function b(_,A){if(_.isNode()){if(x)return;x=_,s.push(_)}if(_.isEdge()&&(A==null||A<g))if(p){if(p.pstyle("z-compound-depth").value===_.pstyle("z-compound-depth").value&&p.pstyle("z-compound-depth").value===_.pstyle("z-compound-depth").value){for(var P=0;P<s.length;P++)if(s[P].isEdge()){s[P]=_,p=_,g=A??g;break}}}else s.push(_),p=_,g=A??g}function w(_){var A=_.outerWidth()+2*d,P=_.outerHeight()+2*d,I=A/2,D=P/2,L=_.position(),M=_.pstyle("corner-radius").value==="auto"?"auto":_.pstyle("corner-radius").pfValue,q=_._private.rscratch;if(L.x-I<=r&&r<=L.x+I&&L.y-D<=e&&e<=L.y+D){var N=i.nodeShapes[a.getNodeShape(_)];if(N.checkPoint(r,e,0,A,P,L.x,L.y,M,q))return b(_,0),!0}}function y(_){var A=_._private,P=A.rscratch,I=_.pstyle("width").pfValue,D=_.pstyle("arrow-scale").value,L=I/2+f,M=L*L,q=L*2,$=A.source,X=A.target,N;if(P.edgeType==="segments"||P.edgeType==="straight"||P.edgeType==="haystack"){for(var W=P.allpts,V=0;V+3<W.length;V+=2)if(UF(r,e,W[V],W[V+1],W[V+2],W[V+3],q)&&M>(N=XF(r,e,W[V],W[V+1],W[V+2],W[V+3])))return b(_,N),!0}else if(P.edgeType==="bezier"||P.edgeType==="multibezier"||P.edgeType==="self"||P.edgeType==="compound"){for(var W=P.allpts,V=0;V+5<P.allpts.length;V+=4)if(HF(r,e,W[V],W[V+1],W[V+2],W[V+3],W[V+4],W[V+5],q)&&M>(N=YF(r,e,W[V],W[V+1],W[V+2],W[V+3],W[V+4],W[V+5])))return b(_,N),!0}for(var $=$||A.source,X=X||A.target,ee=a.getArrowWidth(I,D),K=[{name:"source",x:P.arrowStartX,y:P.arrowStartY,angle:P.srcArrowAngle},{name:"target",x:P.arrowEndX,y:P.arrowEndY,angle:P.tgtArrowAngle},{name:"mid-source",x:P.midX,y:P.midY,angle:P.midsrcArrowAngle},{name:"mid-target",x:P.midX,y:P.midY,angle:P.midtgtArrowAngle}],V=0;V<K.length;V++){var j=K[V],fe=i.arrowShapes[_.pstyle(j.name+"-arrow-shape").value],G=_.pstyle("width").pfValue;if(fe.roughCollide(r,e,ee,j.angle,{x:j.x,y:j.y},G,f)&&fe.collide(r,e,ee,j.angle,{x:j.x,y:j.y},G,f))return b(_),!0}l&&s.length>0&&(w($),w(X))}function E(_,A,P){return $t(_,A,P)}function C(_,A){var P=_._private,I=h,D;A?D=A+"-":D="",_.boundingBox();var L=P.labelBounds[A||"main"],M=_.pstyle(D+"label").value,q=_.pstyle("text-events").strValue==="yes";if(!(!q||!M)){var N=E(P.rscratch,"labelX",A),W=E(P.rscratch,"labelY",A),V=E(P.rscratch,"labelAngle",A),$=_.pstyle(D+"text-margin-x").pfValue,X=_.pstyle(D+"text-margin-y").pfValue,ee=L.x1-I-$,K=L.x2+I-$,j=L.y1-I-X,fe=L.y2+I-X;if(V){var G=Math.cos(V),z=Math.sin(V),Y=function(de,we){return de=de-N,we=we-W,{x:de*G-we*z+N,y:de*z+we*G+W}},te=Y(ee,j),ue=Y(ee,fe),oe=Y(K,j),Z=Y(K,fe),Q=[te.x+$,te.y+X,oe.x+$,oe.y+X,Z.x+$,Z.y+X,ue.x+$,ue.y+X];if(Vt(r,e,Q))return b(_),!0}else if(Sa(L,r,e))return b(_),!0}}for(var S=o.length-1;S>=0;S--){var R=o[S];R.isNode()?w(R)||C(R):y(R)||C(R)||C(R,"source")||C(R,"target")}return s};mi.getAllInBox=function(r,e,t,n){var a=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(r,t),l=Math.max(r,t),f=Math.min(e,n),d=Math.max(e,n);r=u,t=l,e=f,n=d;var h=Lt({x1:r,y1:e,x2:t,y2:n}),g=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]],[g[3],g[0]]];function x(de,we,Ae){return $t(de,we,Ae)}function b(de,we){var Ae=de._private,ve=o,le="";de.boundingBox();var Me=Ae.labelBounds.main;if(!Me)return null;var Se=x(Ae.rscratch,"labelX",we),Ee=x(Ae.rscratch,"labelY",we),re=x(Ae.rscratch,"labelAngle",we),ce=de.pstyle(le+"text-margin-x").pfValue,_e=de.pstyle(le+"text-margin-y").pfValue,me=Me.x1-ve-ce,Te=Me.x2+ve-ce,De=Me.y1-ve-_e,Ne=Me.y2+ve-_e;if(re){var ze=Math.cos(re),$e=Math.sin(re),ke=function(ye,O){return ye=ye-Se,O=O-Ee,{x:ye*ze-O*$e+Se,y:ye*$e+O*ze+Ee}};return[ke(me,De),ke(Te,De),ke(Te,Ne),ke(me,Ne)]}else return[{x:me,y:De},{x:Te,y:De},{x:Te,y:Ne},{x:me,y:Ne}]}function w(de,we,Ae,ve){function le(Me,Se,Ee){return(Ee.y-Me.y)*(Se.x-Me.x)>(Se.y-Me.y)*(Ee.x-Me.x)}return le(de,Ae,ve)!==le(we,Ae,ve)&&le(de,we,Ae)!==le(de,we,ve)}for(var y=0;y<a.length;y++){var E=a[y];if(E.isNode()){var C=E,S=C.pstyle("text-events").strValue==="yes",R=C.pstyle("box-selection").strValue,_=C.pstyle("box-select-labels").strValue==="yes";if(R==="none")continue;var A=(R==="overlap"||_)&&S,P=C.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:A});if(R==="contain"){var I=!1;if(_&&S){var D=b(C);D&&ed(D,g)&&(s.push(C),I=!0)}!I&&QR(h,P)&&s.push(C)}else if(R==="overlap"&&e0(h,P)){var L=C.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),M=[{x:L.x1,y:L.y1},{x:L.x2,y:L.y1},{x:L.x2,y:L.y2},{x:L.x1,y:L.y2}];if(ed(M,g))s.push(C);else{var q=b(C);q&&ed(q,g)&&s.push(C)}}}else{var N=E,W=N._private,V=W.rscratch,$=N.pstyle("box-selection").strValue;if($==="none")continue;if($==="contain"){if(V.startX!=null&&V.startY!=null&&!Sa(h,V.startX,V.startY)||V.endX!=null&&V.endY!=null&&!Sa(h,V.endX,V.endY))continue;if(V.edgeType==="bezier"||V.edgeType==="multibezier"||V.edgeType==="self"||V.edgeType==="compound"||V.edgeType==="segments"||V.edgeType==="haystack"){for(var X=W.rstyle.bezierPts||W.rstyle.linePts||W.rstyle.haystackPts,ee=!0,K=0;K<X.length;K++)if(!Uw(h,X[K])){ee=!1;break}ee&&s.push(N)}else V.edgeType==="straight"&&s.push(N)}else if($==="overlap"){var j=!1;if(V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(Sa(h,V.startX,V.startY)||Sa(h,V.endX,V.endY)))s.push(N),j=!0;else if(!j&&V.edgeType==="haystack"){for(var fe=W.rstyle.haystackPts,G=0;G<fe.length;G++)if(Uw(h,fe[G])){s.push(N),j=!0;break}}if(!j){var z=W.rstyle.bezierPts||W.rstyle.linePts||W.rstyle.haystackPts;if((!z||z.length<2)&&V.edgeType==="straight"&&V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(z=[{x:V.startX,y:V.startY},{x:V.endX,y:V.endY}]),!z||z.length<2)continue;for(var Y=0;Y<z.length-1;Y++){for(var te=z[Y],ue=z[Y+1],oe=0;oe<p.length;oe++){var Z=Xr(p[oe],2),Q=Z[0],ie=Z[1];if(w(te,ue,Q,ie)){s.push(N),j=!0;break}}if(j)break}}}}}return s};var fl={};fl.calculateArrowAngles=function(r){var e=r._private.rscratch,t=e.edgeType==="haystack",n=e.edgeType==="bezier",a=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,f,d,h,g,w,y;if(t?(f=e.haystackPts[0],d=e.haystackPts[1],h=e.haystackPts[2],g=e.haystackPts[3]):(f=e.arrowStartX,d=e.arrowStartY,h=e.arrowEndX,g=e.arrowEndY),w=e.midX,y=e.midY,i)u=f-e.segpts[0],l=d-e.segpts[1];else if(a||o||s||n){var p=e.allpts,x=ut(p[0],p[2],p[4],.1),b=ut(p[1],p[3],p[5],.1);u=f-x,l=d-b}else u=f-w,l=d-y;e.srcArrowAngle=Au(u,l);var w=e.midX,y=e.midY;if(t&&(w=(f+h)/2,y=(d+g)/2),u=h-f,l=g-d,i){var p=e.allpts;if(p.length/2%2===0){var E=p.length/2,C=E-2;u=p[E]-p[C],l=p[E+1]-p[C+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var E=p.length/2-1,C=E-2;u=p[E]-p[C],l=p[E+1]-p[C+1]}}else if(a||o||s){var p=e.allpts,S=e.ctrlpts,R,_,A,P;if(S.length/2%2===0){var I=p.length/2-1,D=I+2,L=D+2;R=ut(p[I],p[D],p[L],0),_=ut(p[I+1],p[D+1],p[L+1],0),A=ut(p[I],p[D],p[L],1e-4),P=ut(p[I+1],p[D+1],p[L+1],1e-4)}else{var D=p.length/2-1,I=D-2,L=D+2;R=ut(p[I],p[D],p[L],.4999),_=ut(p[I+1],p[D+1],p[L+1],.4999),A=ut(p[I],p[D],p[L],.5),P=ut(p[I+1],p[D+1],p[L+1],.5)}u=A-R,l=P-_}if(e.midtgtArrowAngle=Au(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var p=e.allpts;if(p.length/2%2!==0){if(!e.isRound){var E=p.length/2-1,M=E+2;u=-(p[M]-p[E]),l=-(p[M+1]-p[E+1])}}}if(e.midsrcArrowAngle=Au(u,l),i)u=h-e.segpts[e.segpts.length-2],l=g-e.segpts[e.segpts.length-1];else if(a||o||s||n){var p=e.allpts,q=p.length,x=ut(p[q-6],p[q-4],p[q-2],.9),b=ut(p[q-5],p[q-3],p[q-1],.9);u=h-x,l=g-b}else u=h-w,l=g-y;e.tgtArrowAngle=Au(u,l)};fl.getArrowWidth=fl.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},n=t[r+", "+e];return n||(n=Math.max(Math.pow(r*13.37,.9),29)*e,t[r+", "+e]=n,n)};var Bm,Mm,On={},cn={},RE,AE,si,Ku,Jn,ei,ni,Mn,Ki,ku,HA,KA,Lm,Om,PE,IE=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},d3=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},v3=function(e,t,n,a,i){if(e!==PE?IE(t,e,On):d3(cn,On),IE(t,n,cn),RE=On.nx*cn.ny-On.ny*cn.nx,AE=On.nx*cn.nx-On.ny*-cn.ny,Jn=Math.asin(Math.max(-1,Math.min(1,RE))),Math.abs(Jn)<1e-6){Bm=t.x,Mm=t.y,ni=Ki=0;return}si=1,Ku=!1,AE<0?Jn<0?Jn=Math.PI+Jn:(Jn=Math.PI-Jn,si=-1,Ku=!0):Jn>0&&(si=-1,Ku=!0),t.radius!==void 0?Ki=t.radius:Ki=a,ei=Jn/2,ku=Math.min(On.len/2,cn.len/2),i?(Mn=Math.abs(Math.cos(ei)*Ki/Math.sin(ei)),Mn>ku?(Mn=ku,ni=Math.abs(Mn*Math.sin(ei)/Math.cos(ei))):ni=Ki):(Mn=Math.min(ku,Ki),ni=Math.abs(Mn*Math.sin(ei)/Math.cos(ei))),Lm=t.x+cn.nx*Mn,Om=t.y+cn.ny*Mn,Bm=Lm-cn.ny*ni*si,Mm=Om+cn.nx*ni*si,HA=t.x+On.nx*Mn,KA=t.y+On.ny*Mn,PE=t};function jA(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function d0(r,e,t,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(v3(r,e,t,n,a),{cx:Bm,cy:Mm,radius:ni,startX:HA,startY:KA,stopX:Lm,stopY:Om,startAngle:On.ang+Math.PI/2*si,endAngle:cn.ang-Math.PI/2*si,counterClockwise:Ku})}var ms=.01,h3=Math.sqrt(2*ms),At={};At.findMidptPtsEtc=function(r,e){var t=e.posPts,n=e.intersectionPts,a=e.vectorNormInverse,i,o=r.pstyle("source-endpoint"),s=r.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(S,R,_,A){var P=A-R,I=_-S,D=Math.sqrt(I*I+P*P);return{x:-P/D,y:I/D}},f=r.pstyle("edge-distances").value;switch(f){case"node-position":i=t;break;case"intersection":i=n;break;case"endpoints":{if(u){var d=this.manualEndptToPx(r.source()[0],o),h=Xr(d,2),g=h[0],p=h[1],x=this.manualEndptToPx(r.target()[0],s),b=Xr(x,2),w=b[0],y=b[1],E={x1:g,y1:p,x2:w,y2:y};a=l(g,p,w,y),i=E}else Cr("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=n;break}}return{midptPts:i,vectorNormInverse:a}};At.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],n=t._private,a=n.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=n.source,s=n.target,u=o.position(),l=s.position(),f=o.width(),d=s.width(),h=o.height(),g=s.height(),p=t.pstyle("haystack-radius").value,x=p/2;a.haystackPts=a.allpts=[a.source.x*f*x+u.x,a.source.y*h*x+u.y,a.target.x*d*x+l.x,a.target.y*g*x+l.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}};At.findSegmentsPoints=function(r,e){var t=r._private.rscratch,n=r.pstyle("segment-weights"),a=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),o=r.pstyle("radius-type"),s=Math.min(n.pfValue.length,a.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var f=0;f<s;f++){var d=n.pfValue[f],h=a.pfValue[f],g=1-d,p=d,x=this.findMidptPtsEtc(r,e),b=x.midptPts,w=x.vectorNormInverse,y={x:b.x1*g+b.x2*p,y:b.y1*g+b.y2*p};t.segpts.push(y.x+w.x*h,y.y+w.y*h),t.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:u),t.isArcRadius.push((o.pfValue[f]!==void 0?o.pfValue[f]:l)==="arc-radius")}};At.findLoopPoints=function(r,e,t,n){var a=r._private.rscratch,i=e.dirCounts,o=e.srcPos,s=r.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=r.pstyle("loop-direction").pfValue,f=r.pstyle("loop-sweep").pfValue,d=r.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=t,g=d;n&&(h=0,g=u);var p=l-Math.PI/2,x=p-f/2,b=p+f/2,w=l+"_"+f;h=i[w]===void 0?i[w]=0:++i[w],a.ctrlpts=[o.x+Math.cos(x)*1.4*g*(h/3+1),o.y+Math.sin(x)*1.4*g*(h/3+1),o.x+Math.cos(b)*1.4*g*(h/3+1),o.y+Math.sin(b)*1.4*g*(h/3+1)]};At.findCompoundLoopPoints=function(r,e,t,n){var a=r._private.rscratch;a.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,f=e.tgtH,d=r.pstyle("control-point-step-size").pfValue,h=r.pstyle("control-point-distances"),g=h?h.pfValue[0]:void 0,p=t,x=d;n&&(p=0,x=g);var b=50,w={x:i.x-s/2,y:i.y-u/2},y={x:o.x-l/2,y:o.y-f/2},E={x:Math.min(w.x,y.x),y:Math.min(w.y,y.y)},C=.5,S=Math.max(C,Math.log(s*ms)),R=Math.max(C,Math.log(l*ms));a.ctrlpts=[E.x,E.y-(1+Math.pow(b,1.12)/100)*x*(p/3+1)*S,E.x-(1+Math.pow(b,1.12)/100)*x*(p/3+1)*R,E.y]};At.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"};At.findBezierPoints=function(r,e,t,n,a){var i=r._private.rscratch,o=r.pstyle("control-point-step-size").pfValue,s=r.pstyle("control-point-distances"),u=r.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,f=s?s.pfValue[0]:void 0,d=u.value[0],h=n;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var g=0;g<l;g++){var p=(.5-e.eles.length/2+t)*o*(a?-1:1),x=void 0,b=Jm(p);h&&(f=s?s.pfValue[g]:o,d=u.value[g]),n?x=f:x=f!==void 0?b*f:void 0;var w=x!==void 0?x:p,y=1-d,E=d,C=this.findMidptPtsEtc(r,e),S=C.midptPts,R=C.vectorNormInverse,_={x:S.x1*y+S.x2*E,y:S.y1*y+S.y2*E};i.ctrlpts.push(_.x+R.x*w,_.y+R.y*w)}};At.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var n="vertical",a="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",f=e.posPts,d=e.srcW,h=e.srcH,g=e.tgtW,p=e.tgtH,x=r.pstyle("edge-distances").value,b=x!=="node-position",w=r.pstyle("taxi-direction").value,y=w,E=r.pstyle("taxi-turn"),C=E.units==="%",S=E.pfValue,R=S<0,_=r.pstyle("taxi-turn-min-distance").pfValue,A=b?(d+g)/2:0,P=b?(h+p)/2:0,I=f.x2-f.x1,D=f.y2-f.y1,L=function(O,ne){return O>0?Math.max(O-ne,0):Math.min(O+ne,0)},M=L(I,A),q=L(D,P),N=!1;y===l?w=Math.abs(M)>Math.abs(q)?a:n:y===u||y===s?(w=n,N=!0):(y===i||y===o)&&(w=a,N=!0);var W=w===n,V=W?q:M,$=W?D:I,X=Jm($),ee=!1;!(N&&(C||R))&&(y===s&&$<0||y===u&&$>0||y===i&&$>0||y===o&&$<0)&&(X*=-1,V=X*Math.abs(V),ee=!0);var K;if(C){var j=S<0?1+S:S;K=j*V}else{var fe=S<0?V:0;K=fe+S*X}var G=function(O){return Math.abs(O)<_||Math.abs(O)>=Math.abs(V)},z=G(K),Y=G(Math.abs(V)-Math.abs(K)),te=z||Y;if(te&&!ee)if(W){var ue=Math.abs($)<=h/2,oe=Math.abs(I)<=g/2;if(ue){var Z=(f.x1+f.x2)/2,Q=f.y1,ie=f.y2;t.segpts=[Z,Q,Z,ie]}else if(oe){var de=(f.y1+f.y2)/2,we=f.x1,Ae=f.x2;t.segpts=[we,de,Ae,de]}else t.segpts=[f.x1,f.y2]}else{var ve=Math.abs($)<=d/2,le=Math.abs(D)<=p/2;if(ve){var Me=(f.y1+f.y2)/2,Se=f.x1,Ee=f.x2;t.segpts=[Se,Me,Ee,Me]}else if(le){var re=(f.x1+f.x2)/2,ce=f.y1,_e=f.y2;t.segpts=[re,ce,re,_e]}else t.segpts=[f.x2,f.y1]}else if(W){var me=f.y1+K+(b?h/2*X:0),Te=f.x1,De=f.x2;t.segpts=[Te,me,De,me]}else{var Ne=f.x1+K+(b?d/2*X:0),ze=f.y1,$e=f.y2;t.segpts=[Ne,ze,Ne,$e]}if(t.isRound){var ke=r.pstyle("taxi-radius").value,Oe=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(ke),t.isArcRadius=new Array(t.segpts.length/2).fill(Oe)}};At.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var n=e.srcPos,a=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,d=e.srcCornerRadius,h=e.tgtCornerRadius,g=e.srcRs,p=e.tgtRs,x=!qe(t.startX)||!qe(t.startY),b=!qe(t.arrowStartX)||!qe(t.arrowStartY),w=!qe(t.endX)||!qe(t.endY),y=!qe(t.arrowEndX)||!qe(t.arrowEndY),E=3,C=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,S=E*C,R=di({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),_=R<S,A=di({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),P=A<S,I=!1;if(x||b||_){I=!0;var D={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},L=Math.sqrt(D.x*D.x+D.y*D.y),M={x:D.x/L,y:D.y/L},q=Math.max(i,o),N={x:t.ctrlpts[0]+M.x*2*q,y:t.ctrlpts[1]+M.y*2*q},W=l.intersectLine(n.x,n.y,i,o,N.x,N.y,0,d,g);_?(t.ctrlpts[0]=t.ctrlpts[0]+M.x*(S-R),t.ctrlpts[1]=t.ctrlpts[1]+M.y*(S-R)):(t.ctrlpts[0]=W[0]+M.x*S,t.ctrlpts[1]=W[1]+M.y*S)}if(w||y||P){I=!0;var V={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},$=Math.sqrt(V.x*V.x+V.y*V.y),X={x:V.x/$,y:V.y/$},ee=Math.max(i,o),K={x:t.ctrlpts[0]+X.x*2*ee,y:t.ctrlpts[1]+X.y*2*ee},j=f.intersectLine(a.x,a.y,s,u,K.x,K.y,0,h,p);P?(t.ctrlpts[0]=t.ctrlpts[0]+X.x*(S-A),t.ctrlpts[1]=t.ctrlpts[1]+X.y*(S-A)):(t.ctrlpts[0]=j[0]+X.x*S,t.ctrlpts[1]=j[1]+X.y*S)}I&&this.findEndpoints(r)}};At.storeAllpts=function(r){var e=r._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);e.allpts.push(e.endX,e.endY);var n,a;e.ctrlpts.length/2%2===0?(n=e.allpts.length/2-1,e.midX=e.allpts[n],e.midY=e.allpts[n+1]):(n=e.allpts.length/2-3,a=.5,e.midX=ut(e.allpts[n],e.allpts[n+2],e.allpts[n+4],a),e.midY=ut(e.allpts[n+1],e.allpts[n+3],e.allpts[n+5],a))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(d0({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var d={x:e.segpts[f],y:e.segpts[f+1]},h=e.roundCorners[f/2];if(h.radius===0){var g={x:e.segpts[f+2],y:e.segpts[f+3]};e.midX=d.x,e.midY=d.y,e.midVector=[d.y-g.y,g.x-d.x]}else{var p=[d.x-h.cx,d.y-h.cy],x=h.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map(function(b){return b*x}),e.midX=h.cx+p[0],e.midY=h.cy+p[1],e.midVector=p}}}}};At.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||qe(e.startX)&&qe(e.startY)&&qe(e.endX)&&qe(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Cr("Edge `"+r.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};At.findEdgeControlPoints=function(r){var e=this;if(!(!r||r.length===0)){for(var t=this,n=t.cy,a=n.hasCompoundNodes(),i=new ra,o=function(P,I){return[].concat(el(P),[I?1:0]).join("-")},s=[],u=[],l=0;l<r.length;l++){var f=r[l],d=f._private,h=f.pstyle("curve-style").value;if(!(f.removed()||!f.takesUpSpace())){if(h==="haystack"){u.push(f);continue}var g=h==="unbundled-bezier"||_a(h,"segments")||h==="straight"||h==="straight-triangle"||_a(h,"taxi"),p=h==="unbundled-bezier"||h==="bezier",x=d.source,b=d.target,w=x.poolIndex(),y=b.poolIndex(),E=[w,y].sort(),C=o(E,g),S=i.get(C);S==null&&(S={eles:[]},s.push({pairId:E,edgeIsUnbundled:g}),i.set(C,S)),S.eles.push(f),g&&(S.hasUnbundled=!0),p&&(S.hasBezier=!0)}}for(var R=function(){var P=s[_],I=P.pairId,D=P.edgeIsUnbundled,L=o(I,D),M=i.get(L),q;if(!M.hasUnbundled){var N=M.eles[0].parallelEdges().filter(function(Oe){return Oe.isBundledBezier()});Zm(M.eles),N.forEach(function(Oe){return M.eles.push(Oe)}),M.eles.sort(function(Oe,ye){return Oe.poolIndex()-ye.poolIndex()})}var W=M.eles[0],V=W.source(),$=W.target();if(V.poolIndex()>$.poolIndex()){var X=V;V=$,$=X}var ee=M.srcPos=V.position(),K=M.tgtPos=$.position(),j=M.srcW=V.outerWidth(),fe=M.srcH=V.outerHeight(),G=M.tgtW=$.outerWidth(),z=M.tgtH=$.outerHeight(),Y=M.srcShape=t.nodeShapes[e.getNodeShape(V)],te=M.tgtShape=t.nodeShapes[e.getNodeShape($)],ue=M.srcCornerRadius=V.pstyle("corner-radius").value==="auto"?"auto":V.pstyle("corner-radius").pfValue,oe=M.tgtCornerRadius=$.pstyle("corner-radius").value==="auto"?"auto":$.pstyle("corner-radius").pfValue,Z=M.tgtRs=$._private.rscratch,Q=M.srcRs=V._private.rscratch;M.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var ie=0;ie<M.eles.length;ie++){var de=M.eles[ie],we=de[0]._private.rscratch,Ae=de.pstyle("curve-style").value,ve=Ae==="unbundled-bezier"||_a(Ae,"segments")||_a(Ae,"taxi"),le=!V.same(de.source());if(!M.calculatedIntersection&&V!==$&&(M.hasBezier||M.hasUnbundled)){M.calculatedIntersection=!0;var Me=Y.intersectLine(ee.x,ee.y,j,fe,K.x,K.y,0,ue,Q),Se=M.srcIntn=Me,Ee=te.intersectLine(K.x,K.y,G,z,ee.x,ee.y,0,oe,Z),re=M.tgtIntn=Ee,ce=M.intersectionPts={x1:Me[0],x2:Ee[0],y1:Me[1],y2:Ee[1]},_e=M.posPts={x1:ee.x,x2:K.x,y1:ee.y,y2:K.y},me=Ee[1]-Me[1],Te=Ee[0]-Me[0],De=Math.sqrt(Te*Te+me*me);qe(De)&&De>=h3||(De=Math.sqrt(Math.max(Te*Te,ms)+Math.max(me*me,ms)));var Ne=M.vector={x:Te,y:me},ze=M.vectorNorm={x:Ne.x/De,y:Ne.y/De},$e={x:-ze.y,y:ze.x};M.nodesOverlap=!qe(De)||te.checkPoint(Me[0],Me[1],0,G,z,K.x,K.y,oe,Z)||Y.checkPoint(Ee[0],Ee[1],0,j,fe,ee.x,ee.y,ue,Q),M.vectorNormInverse=$e,q={nodesOverlap:M.nodesOverlap,dirCounts:M.dirCounts,calculatedIntersection:!0,hasBezier:M.hasBezier,hasUnbundled:M.hasUnbundled,eles:M.eles,srcPos:K,srcRs:Z,tgtPos:ee,tgtRs:Q,srcW:G,srcH:z,tgtW:j,tgtH:fe,srcIntn:re,tgtIntn:Se,srcShape:te,tgtShape:Y,posPts:{x1:_e.x2,y1:_e.y2,x2:_e.x1,y2:_e.y1},intersectionPts:{x1:ce.x2,y1:ce.y2,x2:ce.x1,y2:ce.y1},vector:{x:-Ne.x,y:-Ne.y},vectorNorm:{x:-ze.x,y:-ze.y},vectorNormInverse:{x:-$e.x,y:-$e.y}}}var ke=le?q:M;we.nodesOverlap=ke.nodesOverlap,we.srcIntn=ke.srcIntn,we.tgtIntn=ke.tgtIntn,we.isRound=Ae.startsWith("round"),a&&(V.isParent()||V.isChild()||$.isParent()||$.isChild())&&(V.parents().anySame($)||$.parents().anySame(V)||V.same($)&&V.isParent())?e.findCompoundLoopPoints(de,ke,ie,ve):V===$?e.findLoopPoints(de,ke,ie,ve):Ae.endsWith("segments")?e.findSegmentsPoints(de,ke):Ae.endsWith("taxi")?e.findTaxiPoints(de,ke):Ae==="straight"||!ve&&M.eles.length%2===1&&ie===Math.floor(M.eles.length/2)?e.findStraightEdgePoints(de):e.findBezierPoints(de,ke,ie,ve,le),e.findEndpoints(de),e.tryToCorrectInvalidPoints(de,ke),e.checkForInvalidEdgeWarning(de),e.storeAllpts(de),e.storeEdgeProjections(de),e.calculateArrowAngles(de),e.recalculateEdgeLabelProjections(de),e.calculateLabelAngles(de)}},_=0;_<s.length;_++)R();this.findHaystackPoints(u)}};function YA(r){var e=[];if(r!=null){for(var t=0;t<r.length;t+=2){var n=r[t],a=r[t+1];e.push({x:n,y:a})}return e}}At.getSegmentPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="segments")return YA(e.segpts)};At.getControlPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="bezier"||t==="multibezier"||t==="self"||t==="compound")return YA(e.ctrlpts)};At.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Ps={};Ps.manualEndptToPx=function(r,e){var t=this,n=r.position(),a=r.outerWidth(),i=r.outerHeight(),o=r._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*a),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=n.x,s[1]+=n.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(a,i),f=[n.x+Math.cos(u)*l,n.y+Math.sin(u)*l];return t.nodeShapes[this.getNodeShape(r)].intersectLine(n.x,n.y,a,i,f[0],f[1],0,r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,o)}};Ps.findEndpoints=function(r){var e,t,n,a,i=this,o,s=r.source()[0],u=r.target()[0],l=s.position(),f=u.position(),d=r.pstyle("target-arrow-shape").value,h=r.pstyle("source-arrow-shape").value,g=r.pstyle("target-distance-from-node").pfValue,p=r.pstyle("source-distance-from-node").pfValue,x=s._private.rscratch,b=u._private.rscratch,w=r.pstyle("curve-style").value,y=r._private.rscratch,E=y.edgeType,C=_a(w,"taxi"),S=E==="self"||E==="compound",R=E==="bezier"||E==="multibezier"||S,_=E!=="bezier",A=E==="straight"||E==="segments",P=E==="segments",I=R||_||A,D=S||C,L=r.pstyle("source-endpoint"),M=D?"outside-to-node":L.value,q=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,N=r.pstyle("target-endpoint"),W=D?"outside-to-node":N.value,V=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;y.srcManEndpt=L,y.tgtManEndpt=N;var $,X,ee,K,j=(e=(N==null||(t=N.pfValue)===null||t===void 0?void 0:t.length)===2?N.pfValue:null)!==null&&e!==void 0?e:[0,0],fe=(n=(L==null||(a=L.pfValue)===null||a===void 0?void 0:a.length)===2?L.pfValue:null)!==null&&n!==void 0?n:[0,0];if(R){var G=[y.ctrlpts[0],y.ctrlpts[1]],z=_?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:G;$=z,X=G}else if(A){var Y=P?y.segpts.slice(0,2):[f.x+j[0],f.y+j[1]],te=P?y.segpts.slice(y.segpts.length-2):[l.x+fe[0],l.y+fe[1]];$=te,X=Y}if(W==="inside-to-node")o=[f.x,f.y];else if(N.units)o=this.manualEndptToPx(u,N);else if(W==="outside-to-line")o=y.tgtIntn;else if(W==="outside-to-node"||W==="outside-to-node-or-label"?ee=$:(W==="outside-to-line"||W==="outside-to-line-or-label")&&(ee=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),ee[0],ee[1],0,V,b),W==="outside-to-node-or-label"||W==="outside-to-line-or-label"){var ue=u._private.rscratch,oe=ue.labelWidth,Z=ue.labelHeight,Q=ue.labelX,ie=ue.labelY,de=oe/2,we=Z/2,Ae=u.pstyle("text-valign").value;Ae==="top"?ie-=we:Ae==="bottom"&&(ie+=we);var ve=u.pstyle("text-halign").value;ve==="left"?Q-=de:ve==="right"&&(Q+=de);var le=vs(ee[0],ee[1],[Q-de,ie-we,Q+de,ie-we,Q+de,ie+we,Q-de,ie+we],f.x,f.y);if(le.length>0){var Me=l,Se=ti(Me,Ji(o)),Ee=ti(Me,Ji(le)),re=Se;if(Ee<Se&&(o=le,re=Ee),le.length>2){var ce=ti(Me,{x:le[2],y:le[3]});ce<re&&(o=[le[2],le[3]])}}}var _e=Pu(o,$,i.arrowShapes[d].spacing(r)+g),me=Pu(o,$,i.arrowShapes[d].gap(r)+g);if(y.endX=me[0],y.endY=me[1],y.arrowEndX=_e[0],y.arrowEndY=_e[1],M==="inside-to-node")o=[l.x,l.y];else if(L.units)o=this.manualEndptToPx(s,L);else if(M==="outside-to-line")o=y.srcIntn;else if(M==="outside-to-node"||M==="outside-to-node-or-label"?K=X:(M==="outside-to-line"||M==="outside-to-line-or-label")&&(K=[f.x,f.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),K[0],K[1],0,q,x),M==="outside-to-node-or-label"||M==="outside-to-line-or-label"){var Te=s._private.rscratch,De=Te.labelWidth,Ne=Te.labelHeight,ze=Te.labelX,$e=Te.labelY,ke=De/2,Oe=Ne/2,ye=s.pstyle("text-valign").value;ye==="top"?$e-=Oe:ye==="bottom"&&($e+=Oe);var O=s.pstyle("text-halign").value;O==="left"?ze-=ke:O==="right"&&(ze+=ke);var ne=vs(K[0],K[1],[ze-ke,$e-Oe,ze+ke,$e-Oe,ze+ke,$e+Oe,ze-ke,$e+Oe],l.x,l.y);if(ne.length>0){var he=f,ge=ti(he,Ji(o)),be=ti(he,Ji(ne)),Ve=ge;if(be<ge&&(o=[ne[0],ne[1]],Ve=be),ne.length>2){var Be=ti(he,{x:ne[2],y:ne[3]});Be<Ve&&(o=[ne[2],ne[3]])}}}var He=Pu(o,X,i.arrowShapes[h].spacing(r)+p),We=Pu(o,X,i.arrowShapes[h].gap(r)+p);y.startX=We[0],y.startY=We[1],y.arrowStartX=He[0],y.arrowStartY=He[1],I&&(!qe(y.startX)||!qe(y.startY)||!qe(y.endX)||!qe(y.endY)?y.badLine=!0:y.badLine=!1)};Ps.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Ps.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var v0={};function g3(r,e,t){for(var n=function(l,f,d,h){return ut(l,f,d,h)},a=e._private,i=a.rstyle.bezierPts,o=0;o<r.bezierProjPcts.length;o++){var s=r.bezierProjPcts[o];i.push({x:n(t[0],t[2],t[4],s),y:n(t[1],t[3],t[5],s)})}}v0.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,n=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){e.rstyle.bezierPts=[];for(var a=0;a+5<t.allpts.length;a+=4)g3(this,r,t.allpts.slice(a,a+6))}else if(n==="segments")for(var i=e.rstyle.linePts=[],a=0;a+1<t.allpts.length;a+=2)i.push({x:t.allpts[a],y:t.allpts[a+1]});else if(n==="haystack"){var o=t.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth};v0.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var $n={};$n.recalculateNodeLabelProjection=function(r){var e=r.pstyle("label").strValue;if(!Da(e)){var t,n,a=r._private,i=r.width(),o=r.height(),s=r.padding(),u=r.position(),l=r.pstyle("text-halign").strValue,f=r.pstyle("text-valign").strValue,d=a.rscratch,h=a.rstyle;switch(l){case"left":t=u.x-i/2-s;break;case"right":t=u.x+i/2+s;break;default:t=u.x}switch(f){case"top":n=u.y-o/2-s;break;case"bottom":n=u.y+o/2+s;break;default:n=u.y}d.labelX=t,d.labelY=n,h.labelX=t,h.labelY=n,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}};var XA=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n=n*-1),n},ZA=function(e,t){var n=t.x-e.x,a=t.y-e.y;return XA(n,a)},p3=function(e,t,n,a){var i=ds(0,a-.001,1),o=ds(0,a+.001,1),s=io(e,t,n,i),u=io(e,t,n,o);return ZA(s,u)};$n.recalculateEdgeLabelProjections=function(r){var e,t=r._private,n=t.rscratch,a=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:n.midX,y:n.midY};var o=function(d,h,g){ea(t.rscratch,d,h,g),ea(t.rstyle,d,h,g)};o("labelX",null,e.x),o("labelY",null,e.y);var s=XA(n.midDispX,n.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var d=[],h=0;h+5<n.allpts.length;h+=4){var g={x:n.allpts[h],y:n.allpts[h+1]},p={x:n.allpts[h+2],y:n.allpts[h+3]},x={x:n.allpts[h+4],y:n.allpts[h+5]};d.push({p0:g,p1:p,p2:x,startDist:0,length:0,segments:[]})}var b=t.rstyle.bezierPts,w=a.bezierProjPcts.length;function y(_,A,P,I,D){var L=di(A,P),M=_.segments[_.segments.length-1],q={p0:A,p1:P,t0:I,t1:D,startDist:M?M.startDist+M.length:0,length:L};_.segments.push(q),_.length+=L}for(var E=0;E<d.length;E++){var C=d[E],S=d[E-1];S&&(C.startDist=S.startDist+S.length),y(C,C.p0,b[E*w],0,a.bezierProjPcts[0]);for(var R=0;R<w-1;R++)y(C,b[E*w+R],b[E*w+R+1],a.bezierProjPcts[R],a.bezierProjPcts[R+1]);y(C,b[E*w+w-1],C.p2,a.bezierProjPcts[w-1],1)}return u.cache=d},l=function(d){var h,g=d==="source";if(i[d]){var p=r.pstyle(d+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var x=u(),b,w=0,y=0,E=0;E<x.length;E++){for(var C=x[g?E:x.length-1-E],S=0;S<C.segments.length;S++){var R=C.segments[g?S:C.segments.length-1-S],_=E===x.length-1&&S===C.segments.length-1;if(w=y,y+=R.length,y>=p||_){b={cp:C,segment:R};break}}if(b)break}var A=b.cp,P=b.segment,I=(p-w)/P.length,D=P.t1-P.t0,L=g?P.t0+D*I:P.t1-D*I;L=ds(0,L,1),e=io(A.p0,A.p1,A.p2,L),h=p3(A.p0,A.p1,A.p2,L);break}case"straight":case"segments":case"haystack":{for(var M=0,q,N,W,V,$=n.allpts.length,X=0;X+3<$&&(g?(W={x:n.allpts[X],y:n.allpts[X+1]},V={x:n.allpts[X+2],y:n.allpts[X+3]}):(W={x:n.allpts[$-2-X],y:n.allpts[$-1-X]},V={x:n.allpts[$-4-X],y:n.allpts[$-3-X]}),q=di(W,V),N=M,M+=q,!(M>=p));X+=2);var ee=p-N,K=ee/q;K=ds(0,K,1),e=NF(W,V,K),h=ZA(W,V);break}}o("labelX",d,e.x),o("labelY",d,e.y),o("labelAutoAngle",d,h)}};l("source"),l("target"),this.applyLabelDimensions(r)}};$n.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};$n.applyPrefixedLabelDimensions=function(r,e){var t=r._private,n=this.getLabelText(r,e),a=ci(n,r._private.labelDimsKey);if($t(t.rscratch,"prefixedLabelDimsKey",e)!==a){ea(t.rscratch,"prefixedLabelDimsKey",e,a);var i=this.calculateLabelDimensions(r,n),o=r.pstyle("line-height").pfValue,s=r.pstyle("text-wrap").strValue,u=$t(t.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(u.length,1),f=i.height/l,d=f*o,h=i.width,g=i.height+(l-1)*(o-1)*f;ea(t.rstyle,"labelWidth",e,h),ea(t.rscratch,"labelWidth",e,h),ea(t.rstyle,"labelHeight",e,g),ea(t.rscratch,"labelHeight",e,g),ea(t.rscratch,"labelLineHeight",e,d)}};$n.getLabelText=function(r,e){var t=r._private,n=e?e+"-":"",a=r.pstyle(n+"label").strValue,i=r.pstyle("text-transform").value,o=function(fe,G){return G?(ea(t.rscratch,fe,e,G),G):$t(t.rscratch,fe,e)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var s=r.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="",f=a.split(`
|
|
41
|
-
`),d=r.pstyle("text-max-width").pfValue,h=r.pstyle("text-overflow-wrap").value,g=h==="anywhere",p=[],x=/[\s\u200b]+|$/g,b=0;b<f.length;b++){var w=f[b],y=this.calculateLabelDimensions(r,w),E=y.width;if(g){var C=w.split("").join(l);w=C}if(E>d){var S=w.matchAll(x),R="",_=0,A=Gt(S),P;try{for(A.s();!(P=A.n()).done;){var I=P.value,D=I[0],L=w.substring(_,I.index);_=I.index+D.length;var M=R.length===0?L:R+L+D,q=this.calculateLabelDimensions(r,M),N=q.width;N<=d?R+=L+D:(R&&p.push(R),R=L+D)}}catch(j){A.e(j)}finally{A.f()}R.match(/^[\s\u200b]+$/)||p.push(R)}else p.push(w)}o("labelWrapCachedLines",p),a=o("labelWrapCachedText",p.join(`
|
|
42
|
-
`)),o("labelWrapKey",u)}else if(s==="ellipsis"){var W=r.pstyle("text-max-width").pfValue,V="",$="…",X=!1;if(this.calculateLabelDimensions(r,a).width<W)return a;for(var ee=0;ee<a.length;ee++){var K=this.calculateLabelDimensions(r,V+a[ee]+$).width;if(K>W)break;V+=a[ee],ee===a.length-1&&(X=!0)}return X||(V+=$),V}return a};$n.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};$n.calculateLabelDimensions=function(r,e){var t=this,n=t.cy.window(),a=n.document,i=0,o=r.pstyle("font-style").strValue,s=r.pstyle("font-size").pfValue,u=r.pstyle("font-family").strValue,l=r.pstyle("font-weight").strValue,f=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=a.createElement("canvas"),d=this.labelCalcCanvasContext=f.getContext("2d");var h=f.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}d.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var g=0,p=0,x=e.split(`
|
|
43
|
-
`),b=0;b<x.length;b++){var w=x[b],y=d.measureText(w),E=Math.ceil(y.width),C=s;g=Math.max(E,g),p+=C}return g+=i,p+=i,{width:g,height:p}};$n.calculateLabelAngle=function(r,e){var t=r._private,n=t.rscratch,a=r.isEdge(),i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:a&&s==="autorotate"?n.labelAutoAngle:s==="autorotate"?0:o.pfValue};$n.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),n=r._private,a=n.rscratch;a.labelAngle=e.calculateLabelAngle(r),t&&(a.sourceLabelAngle=e.calculateLabelAngle(r,"source"),a.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var QA={},DE=28,BE=!1;QA.getNodeShape=function(r){var e=this,t=r.pstyle("shape").value;if(t==="cutrectangle"&&(r.width()<DE||r.height()<DE))return BE||(Cr("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),BE=!0),"rectangle";if(r.isParent())return t==="rectangle"||t==="roundrectangle"||t==="round-rectangle"||t==="cutrectangle"||t==="cut-rectangle"||t==="barrel"?t:"rectangle";if(t==="polygon"){var n=r.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(n).name}return t};var Ol={};Ol.registerCalculationListeners=function(){var r=this.cy,e=r.collection(),t=this,n=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u],f=l._private,d=f.rstyle;d.clean=!1,d.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(o){var s=o.target;n(s)}).on("style.* background.*",function(o){var s=o.target;n(s,!1)});var a=function(o){if(o){var s=t.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],f=l._private.rstyle;l.isNode()&&!f.cleanConnected&&(n(l.connectedEdges()),f.cleanConnected=!0)}if(s)for(var d=0;d<s.length;d++){var h=s[d];h(o,e)}t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){a(!0)},t.beforeRender(a,t.beforeRenderPriorities.eleCalcs)};Ol.onUpdateEleCalcs=function(r){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(r)};Ol.recalculateRenderedStyle=function(r,e){var t=function(C){return C._private.rstyle.cleanConnected};if(r.length!==0){var n=[],a=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<r.length;i++){var o=r[i],s=o._private,u=s.rstyle;o.isEdge()&&(!t(o.source())||!t(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(E){return!E._private.rstyle.clean&&E.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?a.push(o):n.push(o),u.clean=!0)}for(var l=0;l<a.length;l++){var f=a[l],d=f._private,h=d.rstyle,g=f.position();this.recalculateNodeLabelProjection(f),h.nodeX=g.x,h.nodeY=g.y,h.nodeW=f.pstyle("width").pfValue,h.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var p=0;p<n.length;p++){var x=n[p],b=x._private,w=b.rstyle,y=b.rscratch;w.srcX=y.arrowStartX,w.srcY=y.arrowStartY,w.tgtX=y.arrowEndX,w.tgtY=y.arrowEndY,w.midX=y.midX,w.midY=y.midY,w.labelAngle=y.labelAngle,w.sourceLabelAngle=y.sourceLabelAngle,w.targetLabelAngle=y.targetLabelAngle}}}};var kl={};kl.updateCachedGrabbedEles=function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var n=r[t],a=n._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):a.inDragLayer?r.drag.push(n):r.nondrag.push(n)}for(var t=0;t<e.length;t++){var n=e[t];r.drag.push(n)}}};kl.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};kl.getCachedZSortedEles=function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(MA),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var JA={};[mi,fl,At,Ps,v0,$n,QA,Ol,kl].forEach(function(r){Ze(JA,r)});var eP={};eP.getCachedImage=function(r,e,t){var n=this,a=n.imageCache=n.imageCache||{},i=a[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;i=a[r]=a[r]||{};var o=i.image=new Image;o.addEventListener("load",t),o.addEventListener("error",function(){o.error=!0});var s="data:",u=r.substring(0,s.length).toLowerCase()===s;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=r,o};var bo={};bo.registerBinding=function(r,e,t,n){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(r)){for(var i=[],o=0;o<r.length;o++){var s=r[o];if(s!==void 0){var u=this.binder(s);i.push(u.on.apply(u,a))}}return i}var u=this.binder(r);return u.on.apply(u,a)};bo.binder=function(r){var e=this,t=e.cy.window(),n=r===t||r===t.document||r===t.document.body||AN(r);if(e.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=a}var o=function(u,l,f){var d=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(d[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:d}),(r.addEventListener||r.on).apply(r,d),this};return{on:o,addEventListener:o,addListener:o,bind:o}};bo.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()};bo.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()};bo.load=function(){var r=this,e=r.cy.window(),t=function(O){return O.selected()},n=function(O){var ne=O.getRootNode();if(ne&&ne.nodeType===11&&ne.host!==void 0)return ne},a=function(O,ne,he,ge){O==null&&(O=r.cy);for(var be=0;be<ne.length;be++){var Ve=ne[be];O.emit({originalEvent:he,type:Ve,position:ge})}},i=function(O){return O.shiftKey||O.metaKey||O.ctrlKey},o=function(O,ne){var he=!0;if(r.cy.hasCompoundNodes()&&O&&O.pannable())for(var ge=0;ne&&ge<ne.length;ge++){var O=ne[ge];if(O.isNode()&&O.isParent()&&!O.pannable()){he=!1;break}}else he=!0;return he},s=function(O){O[0]._private.grabbed=!0},u=function(O){O[0]._private.grabbed=!1},l=function(O){O[0]._private.rscratch.inDragLayer=!0},f=function(O){O[0]._private.rscratch.inDragLayer=!1},d=function(O){O[0]._private.rscratch.isGrabTarget=!0},h=function(O){O[0]._private.rscratch.isGrabTarget=!1},g=function(O,ne){var he=ne.addToList,ge=he.has(O);!ge&&O.grabbable()&&!O.locked()&&(he.merge(O),s(O))},p=function(O,ne){if(O.cy().hasCompoundNodes()&&!(ne.inDragLayer==null&&ne.addToList==null)){var he=O.descendants();ne.inDragLayer&&(he.forEach(l),he.connectedEdges().forEach(l)),ne.addToList&&g(he,ne)}},x=function(O,ne){ne=ne||{};var he=O.cy().hasCompoundNodes();ne.inDragLayer&&(O.forEach(l),O.neighborhood().stdFilter(function(ge){return!he||ge.isEdge()}).forEach(l)),ne.addToList&&O.forEach(function(ge){g(ge,ne)}),p(O,ne),y(O,{inDragLayer:ne.inDragLayer}),r.updateCachedGrabbedEles()},b=x,w=function(O){O&&(r.getCachedZSortedEles().forEach(function(ne){u(ne),f(ne),h(ne)}),r.updateCachedGrabbedEles())},y=function(O,ne){if(!(ne.inDragLayer==null&&ne.addToList==null)&&O.cy().hasCompoundNodes()){var he=O.ancestors().orphans();if(!he.same(O)){var ge=he.descendants().spawnSelf().merge(he).unmerge(O).unmerge(O.descendants()),be=ge.connectedEdges();ne.inDragLayer&&(be.forEach(l),ge.forEach(l)),ne.addToList&&ge.forEach(function(Ve){g(Ve,ne)})}}},E=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},C=typeof MutationObserver<"u",S=typeof ResizeObserver<"u";C?(r.removeObserver=new MutationObserver(function(ye){for(var O=0;O<ye.length;O++){var ne=ye[O],he=ne.removedNodes;if(he)for(var ge=0;ge<he.length;ge++){var be=he[ge];if(be===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(ye){r.destroy()});var R=Ss(function(){r.cy.resize()},100);C&&(r.styleObserver=new MutationObserver(R),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",R),S&&(r.resizeObserver=new ResizeObserver(R),r.resizeObserver.observe(r.container));var _=function(O,ne){for(;O!=null;)ne(O),O=O.parentNode},A=function(){r.invalidateContainerClientCoordsCache()};_(r.container,function(ye){r.registerBinding(ye,"transitionend",A),r.registerBinding(ye,"animationend",A),r.registerBinding(ye,"scroll",A)}),r.registerBinding(r.container,"contextmenu",function(ye){ye.preventDefault()});var P=function(){return r.selection[4]!==0},I=function(O){for(var ne=r.findContainerClientCoords(),he=ne[0],ge=ne[1],be=ne[2],Ve=ne[3],Be=O.touches?O.touches:[O],He=!1,We=0;We<Be.length;We++){var Xe=Be[We];if(he<=Xe.clientX&&Xe.clientX<=he+be&&ge<=Xe.clientY&&Xe.clientY<=ge+Ve){He=!0;break}}if(!He)return!1;for(var sr=r.container,ar=O.target,Ke=ar.parentNode,lr=!1;Ke;){if(Ke===sr){lr=!0;break}Ke=Ke.parentNode}return!!lr};r.registerBinding(r.container,"mousedown",function(O){if(I(O)&&!(r.hoverData.which===1&&O.which!==1)){O.preventDefault(),E(),r.hoverData.capture=!0,r.hoverData.which=O.which;var ne=r.cy,he=[O.clientX,O.clientY],ge=r.projectIntoViewport(he[0],he[1]),be=r.selection,Ve=r.findNearestElements(ge[0],ge[1],!0,!1),Be=Ve[0],He=r.dragData.possibleDragElements;r.hoverData.mdownPos=ge,r.hoverData.mdownGPos=he;var We=function(ir){return{originalEvent:O,type:ir,position:{x:ge[0],y:ge[1]}}},Xe=function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var ir=r.hoverData.down;ir?ir.emit(We("taphold")):ne.emit(We("taphold"))}},r.tapholdDuration)};if(O.which==3){r.hoverData.cxtStarted=!0;var sr={originalEvent:O,type:"cxttapstart",position:{x:ge[0],y:ge[1]}};Be?(Be.activate(),Be.emit(sr),r.hoverData.down=Be):ne.emit(sr),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(O.which==1){Be&&Be.activate();{if(Be!=null&&r.nodeIsGrabbable(Be)){var ar=function(ir){ir.emit(We("grab"))};if(d(Be),!Be.selected())He=r.dragData.possibleDragElements=ne.collection(),b(Be,{addToList:He}),Be.emit(We("grabon")).emit(We("grab"));else{He=r.dragData.possibleDragElements=ne.collection();var Ke=ne.$(function(lr){return lr.isNode()&&lr.selected()&&r.nodeIsGrabbable(lr)});x(Ke,{addToList:He}),Be.emit(We("grabon")),Ke.forEach(ar)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=Be,r.hoverData.downs=Ve,r.hoverData.downTime=new Date().getTime()}a(Be,["mousedown","tapstart","vmousedown"],O,{x:ge[0],y:ge[1]}),Be==null?(be[4]=1,r.data.bgActivePosistion={x:ge[0],y:ge[1]},r.redrawHint("select",!0),r.redraw()):Be.pannable()&&(be[4]=1),Xe()}be[0]=be[2]=ge[0],be[1]=be[3]=ge[1]}},!1);var D=n(r.container);r.registerBinding([e,D],"mousemove",function(O){var ne=r.hoverData.capture;if(!(!ne&&!I(O))){var he=!1,ge=r.cy,be=ge.zoom(),Ve=[O.clientX,O.clientY],Be=r.projectIntoViewport(Ve[0],Ve[1]),He=r.hoverData.mdownPos,We=r.hoverData.mdownGPos,Xe=r.selection,sr=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(sr=r.findNearestElement(Be[0],Be[1],!0,!1));var ar=r.hoverData.last,Ke=r.hoverData.down,lr=[Be[0]-Xe[2],Be[1]-Xe[3]],ir=r.dragData.possibleDragElements,Ur;if(We){var Mr=Ve[0]-We[0],ct=Mr*Mr,Lr=Ve[1]-We[1],jr=Lr*Lr,Nr=ct+jr;r.hoverData.isOverThresholdDrag=Ur=Nr>=r.desktopTapThreshold2}var Qr=i(O);Ur&&(r.hoverData.tapholdCancelled=!0);var Pn=function(){var kt=r.hoverData.dragDelta=r.hoverData.dragDelta||[];kt.length===0?(kt.push(lr[0]),kt.push(lr[1])):(kt[0]+=lr[0],kt[1]+=lr[1])};he=!0,a(sr,["mousemove","vmousemove","tapdrag"],O,{x:Be[0],y:Be[1]});var Vr=function(kt){return{originalEvent:O,type:kt,position:{x:Be[0],y:Be[1]}}},pn=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||ge.emit(Vr("boxstart")),Xe[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(Ur){var yn=Vr("cxtdrag");Ke?Ke.emit(yn):ge.emit(yn),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||sr!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(Vr("cxtdragout")),r.hoverData.cxtOver=sr,sr&&sr.emit(Vr("cxtdragover")))}}else if(r.hoverData.dragging){if(he=!0,ge.panningEnabled()&&ge.userPanningEnabled()){var ua;if(r.hoverData.justStartedPan){var Ci=r.hoverData.mdownPos;ua={x:(Be[0]-Ci[0])*be,y:(Be[1]-Ci[1])*be},r.hoverData.justStartedPan=!1}else ua={x:lr[0]*be,y:lr[1]*be};ge.panBy(ua),ge.emit(Vr("dragpan")),r.hoverData.dragged=!0}Be=r.projectIntoViewport(O.clientX,O.clientY)}else if(Xe[4]==1&&(Ke==null||Ke.pannable())){if(Ur){if(!r.hoverData.dragging&&ge.boxSelectionEnabled()&&(Qr||!ge.panningEnabled()||!ge.userPanningEnabled()))pn();else if(!r.hoverData.selecting&&ge.panningEnabled()&&ge.userPanningEnabled()){var Gn=o(Ke,r.hoverData.downs);Gn&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,Xe[4]=0,r.data.bgActivePosistion=Ji(He),r.redrawHint("select",!0),r.redraw())}Ke&&Ke.pannable()&&Ke.active()&&Ke.unactivate()}}else{if(Ke&&Ke.pannable()&&Ke.active()&&Ke.unactivate(),(!Ke||!Ke.grabbed())&&sr!=ar&&(ar&&a(ar,["mouseout","tapdragout"],O,{x:Be[0],y:Be[1]}),sr&&a(sr,["mouseover","tapdragover"],O,{x:Be[0],y:Be[1]}),r.hoverData.last=sr),Ke)if(Ur){if(ge.boxSelectionEnabled()&&Qr)Ke&&Ke.grabbed()&&(w(ir),Ke.emit(Vr("freeon")),ir.emit(Vr("free")),r.dragData.didDrag&&(Ke.emit(Vr("dragfreeon")),ir.emit(Vr("dragfree")))),pn();else if(Ke&&Ke.grabbed()&&r.nodeIsDraggable(Ke)){var dt=!r.dragData.didDrag;dt&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||x(ir,{inDragLayer:!0});var ot={x:0,y:0};if(qe(lr[0])&&qe(lr[1])&&(ot.x+=lr[0],ot.y+=lr[1],dt)){var Et=r.hoverData.dragDelta;Et&&qe(Et[0])&&qe(Et[1])&&(ot.x+=Et[0],ot.y+=Et[1])}r.hoverData.draggingEles=!0,ir.silentShift(ot).emit(Vr("position")).emit(Vr("drag")),r.redrawHint("drag",!0),r.redraw()}}else Pn();he=!0}if(Xe[2]=Be[0],Xe[3]=Be[1],he)return O.stopPropagation&&O.stopPropagation(),O.preventDefault&&O.preventDefault(),!1}},!1);var L,M,q;r.registerBinding(e,"mouseup",function(O){if(!(r.hoverData.which===1&&O.which!==1&&r.hoverData.capture)){var ne=r.hoverData.capture;if(ne){r.hoverData.capture=!1;var he=r.cy,ge=r.projectIntoViewport(O.clientX,O.clientY),be=r.selection,Ve=r.findNearestElement(ge[0],ge[1],!0,!1),Be=r.dragData.possibleDragElements,He=r.hoverData.down,We=i(O);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,He&&He.unactivate();var Xe=function(Mr){return{originalEvent:O,type:Mr,position:{x:ge[0],y:ge[1]}}};if(r.hoverData.which===3){var sr=Xe("cxttapend");if(He?He.emit(sr):he.emit(sr),!r.hoverData.cxtDragged){var ar=Xe("cxttap");He?He.emit(ar):he.emit(ar)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(a(Ve,["mouseup","tapend","vmouseup"],O,{x:ge[0],y:ge[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(He,["click","tap","vclick"],O,{x:ge[0],y:ge[1]}),M=!1,O.timeStamp-q<=he.multiClickDebounceTime()?(L&&clearTimeout(L),M=!0,q=null,a(He,["dblclick","dbltap","vdblclick"],O,{x:ge[0],y:ge[1]})):(L=setTimeout(function(){M||a(He,["oneclick","onetap","voneclick"],O,{x:ge[0],y:ge[1]})},he.multiClickDebounceTime()),q=O.timeStamp)),He==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(O)&&(he.$(t).unselect(["tapunselect"]),Be.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=Be=he.collection()),Ve==He&&!r.dragData.didDrag&&!r.hoverData.selecting&&Ve!=null&&Ve._private.selectable&&(r.hoverData.dragging||(he.selectionType()==="additive"||We?Ve.selected()?Ve.unselect(["tapunselect"]):Ve.select(["tapselect"]):We||(he.$(t).unmerge(Ve).unselect(["tapunselect"]),Ve.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var Ke=he.collection(r.getAllInBox(be[0],be[1],be[2],be[3]));r.redrawHint("select",!0),Ke.length>0&&r.redrawHint("eles",!0),he.emit(Xe("boxend"));var lr=function(Mr){return Mr.selectable()&&!Mr.selected()};he.selectionType()==="additive"||We||he.$(t).unmerge(Ke).unselect(),Ke.emit(Xe("box")).stdFilter(lr).select().emit(Xe("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!be[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var ir=He&&He.grabbed();w(Be),ir&&(He.emit(Xe("freeon")),Be.emit(Xe("free")),r.dragData.didDrag&&(He.emit(Xe("dragfreeon")),Be.emit(Xe("dragfree"))))}}be[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var N=[],W=4,V,$=1e5,X=function(O,ne){for(var he=0;he<O.length;he++)if(O[he]%ne!==0)return!1;return!0},ee=function(O){for(var ne=Math.abs(O[0]),he=1;he<O.length;he++)if(Math.abs(O[he])!==ne)return!1;return!0},K=function(O){var ne=!1,he=O.deltaY;if(he==null&&(O.wheelDeltaY!=null?he=O.wheelDeltaY/4:O.wheelDelta!=null&&(he=O.wheelDelta/4)),he!==0){if(V==null)if(N.length>=W){var ge=N;if(V=X(ge,5),!V){var be=Math.abs(ge[0]);V=ee(ge)&&be>5}if(V)for(var Ve=0;Ve<ge.length;Ve++)$=Math.min(Math.abs(ge[Ve]),$)}else N.push(he),ne=!0;else V&&($=Math.min(Math.abs(he),$));if(!r.scrollingPage){var Be=r.cy,He=Be.zoom(),We=Be.pan(),Xe=r.projectIntoViewport(O.clientX,O.clientY),sr=[Xe[0]*He+We.x,Xe[1]*He+We.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||P()){O.preventDefault();return}if(Be.panningEnabled()&&Be.userPanningEnabled()&&Be.zoomingEnabled()&&Be.userZoomingEnabled()){O.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var ar;ne&&Math.abs(he)>5&&(he=Jm(he)*5),ar=he/-250,V&&(ar/=$,ar*=3),ar=ar*r.wheelSensitivity;var Ke=O.deltaMode===1;Ke&&(ar*=33);var lr=Be.zoom()*Math.pow(10,ar);O.type==="gesturechange"&&(lr=r.gestureStartZoom*O.scale),Be.zoom({level:lr,renderedPosition:{x:sr[0],y:sr[1]}}),Be.emit({type:O.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:O,position:{x:Xe[0],y:Xe[1]}})}}}};r.registerBinding(r.container,"wheel",K,!0),r.registerBinding(e,"scroll",function(O){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(O){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||O.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(ye){r.hasTouchStarted||K(ye)},!0),r.registerBinding(r.container,"mouseout",function(O){var ne=r.projectIntoViewport(O.clientX,O.clientY);r.cy.emit({originalEvent:O,type:"mouseout",position:{x:ne[0],y:ne[1]}})},!1),r.registerBinding(r.container,"mouseover",function(O){var ne=r.projectIntoViewport(O.clientX,O.clientY);r.cy.emit({originalEvent:O,type:"mouseover",position:{x:ne[0],y:ne[1]}})},!1);var j,fe,G,z,Y,te,ue,oe,Z,Q,ie,de,we,Ae=function(O,ne,he,ge){return Math.sqrt((he-O)*(he-O)+(ge-ne)*(ge-ne))},ve=function(O,ne,he,ge){return(he-O)*(he-O)+(ge-ne)*(ge-ne)},le;r.registerBinding(r.container,"touchstart",le=function(O){if(r.hasTouchStarted=!0,!!I(O)){E(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var ne=r.cy,he=r.touchData.now,ge=r.touchData.earlier;if(O.touches[0]){var be=r.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);he[0]=be[0],he[1]=be[1]}if(O.touches[1]){var be=r.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);he[2]=be[0],he[3]=be[1]}if(O.touches[2]){var be=r.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);he[4]=be[0],he[5]=be[1]}var Ve=function(Qr){return{originalEvent:O,type:Qr,position:{x:he[0],y:he[1]}}};if(O.touches[1]){r.touchData.singleTouchMoved=!0,w(r.dragData.touchDragEles);var Be=r.findContainerClientCoords();Z=Be[0],Q=Be[1],ie=Be[2],de=Be[3],j=O.touches[0].clientX-Z,fe=O.touches[0].clientY-Q,G=O.touches[1].clientX-Z,z=O.touches[1].clientY-Q,we=0<=j&&j<=ie&&0<=G&&G<=ie&&0<=fe&&fe<=de&&0<=z&&z<=de;var He=ne.pan(),We=ne.zoom();Y=Ae(j,fe,G,z),te=ve(j,fe,G,z),ue=[(j+G)/2,(fe+z)/2],oe=[(ue[0]-He.x)/We,(ue[1]-He.y)/We];var Xe=200,sr=Xe*Xe;if(te<sr&&!O.touches[2]){var ar=r.findNearestElement(he[0],he[1],!0,!0),Ke=r.findNearestElement(he[2],he[3],!0,!0);ar&&ar.isNode()?(ar.activate().emit(Ve("cxttapstart")),r.touchData.start=ar):Ke&&Ke.isNode()?(Ke.activate().emit(Ve("cxttapstart")),r.touchData.start=Ke):ne.emit(Ve("cxttapstart")),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,r.redraw();return}}if(O.touches[2])ne.boxSelectionEnabled()&&O.preventDefault();else if(!O.touches[1]){if(O.touches[0]){var lr=r.findNearestElements(he[0],he[1],!0,!0),ir=lr[0];if(ir!=null&&(ir.activate(),r.touchData.start=ir,r.touchData.starts=lr,r.nodeIsGrabbable(ir))){var Ur=r.dragData.touchDragEles=ne.collection(),Mr=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),ir.selected()?(Mr=ne.$(function(Nr){return Nr.selected()&&r.nodeIsGrabbable(Nr)}),x(Mr,{addToList:Ur})):b(ir,{addToList:Ur}),d(ir),ir.emit(Ve("grabon")),Mr?Mr.forEach(function(Nr){Nr.emit(Ve("grab"))}):ir.emit(Ve("grab"))}a(ir,["touchstart","tapstart","vmousedown"],O,{x:he[0],y:he[1]}),ir==null&&(r.data.bgActivePosistion={x:be[0],y:be[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){r.touchData.singleTouchMoved===!1&&!r.pinching&&!r.touchData.selecting&&a(r.touchData.start,["taphold"],O,{x:he[0],y:he[1]})},r.tapholdDuration)}}if(O.touches.length>=1){for(var ct=r.touchData.startPosition=[null,null,null,null,null,null],Lr=0;Lr<he.length;Lr++)ct[Lr]=ge[Lr]=he[Lr];var jr=O.touches[0];r.touchData.startGPosition=[jr.clientX,jr.clientY]}}},!1);var Me;r.registerBinding(e,"touchmove",Me=function(O){var ne=r.touchData.capture;if(!(!ne&&!I(O))){var he=r.selection,ge=r.cy,be=r.touchData.now,Ve=r.touchData.earlier,Be=ge.zoom();if(O.touches[0]){var He=r.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);be[0]=He[0],be[1]=He[1]}if(O.touches[1]){var He=r.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);be[2]=He[0],be[3]=He[1]}if(O.touches[2]){var He=r.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);be[4]=He[0],be[5]=He[1]}var We=function(Ai){return{originalEvent:O,type:Ai,position:{x:be[0],y:be[1]}}},Xe=r.touchData.startGPosition,sr;if(ne&&O.touches[0]&&Xe){for(var ar=[],Ke=0;Ke<be.length;Ke++)ar[Ke]=be[Ke]-Ve[Ke];var lr=O.touches[0].clientX-Xe[0],ir=lr*lr,Ur=O.touches[0].clientY-Xe[1],Mr=Ur*Ur,ct=ir+Mr;sr=ct>=r.touchTapThreshold2}if(ne&&r.touchData.cxt){O.preventDefault();var Lr=O.touches[0].clientX-Z,jr=O.touches[0].clientY-Q,Nr=O.touches[1].clientX-Z,Qr=O.touches[1].clientY-Q,Pn=ve(Lr,jr,Nr,Qr),Vr=Pn/te,pn=150,yn=pn*pn,ua=1.5,Ci=ua*ua;if(Vr>=Ci||Pn>=yn){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Gn=We("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(Gn),r.touchData.start=null):ge.emit(Gn)}}if(ne&&r.touchData.cxt){var Gn=We("cxtdrag");r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Gn):ge.emit(Gn),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var dt=r.findNearestElement(be[0],be[1],!0,!0);(!r.touchData.cxtOver||dt!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(We("cxtdragout")),r.touchData.cxtOver=dt,dt&&dt.emit(We("cxtdragover")))}else if(ne&&O.touches[2]&&ge.boxSelectionEnabled())O.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||ge.emit(We("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,he[4]=1,!he||he.length===0||he[0]===void 0?(he[0]=(be[0]+be[2]+be[4])/3,he[1]=(be[1]+be[3]+be[5])/3,he[2]=(be[0]+be[2]+be[4])/3+1,he[3]=(be[1]+be[3]+be[5])/3+1):(he[2]=(be[0]+be[2]+be[4])/3,he[3]=(be[1]+be[3]+be[5])/3),r.redrawHint("select",!0),r.redraw();else if(ne&&O.touches[1]&&!r.touchData.didSelect&&ge.zoomingEnabled()&&ge.panningEnabled()&&ge.userZoomingEnabled()&&ge.userPanningEnabled()){O.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var ot=r.dragData.touchDragEles;if(ot){r.redrawHint("drag",!0);for(var Et=0;Et<ot.length;Et++){var Ga=ot[Et]._private;Ga.grabbed=!1,Ga.rscratch.inDragLayer=!1}}var kt=r.touchData.start,Lr=O.touches[0].clientX-Z,jr=O.touches[0].clientY-Q,Nr=O.touches[1].clientX-Z,Qr=O.touches[1].clientY-Q,qs=Ae(Lr,jr,Nr,Qr),rf=qs/Y;if(we){var _i=Lr-j,tf=jr-fe,Si=Nr-G,nf=Qr-z,af=(_i+Si)/2,of=(tf+nf)/2,la=ge.zoom(),Ti=la*rf,Wa=ge.pan(),Ns=oe[0]*la+Wa.x,Fs=oe[1]*la+Wa.y,sf={x:-Ti/la*(Ns-Wa.x-af)+Ns,y:-Ti/la*(Fs-Wa.y-of)+Fs};if(kt&&kt.active()){var ot=r.dragData.touchDragEles;w(ot),r.redrawHint("drag",!0),r.redrawHint("eles",!0),kt.unactivate().emit(We("freeon")),ot.emit(We("free")),r.dragData.didDrag&&(kt.emit(We("dragfreeon")),ot.emit(We("dragfree")))}ge.viewport({zoom:Ti,pan:sf,cancelOnFailedZoom:!0}),ge.emit(We("pinchzoom")),Y=qs,j=Lr,fe=jr,G=Nr,z=Qr,r.pinching=!0}if(O.touches[0]){var He=r.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);be[0]=He[0],be[1]=He[1]}if(O.touches[1]){var He=r.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);be[2]=He[0],be[3]=He[1]}if(O.touches[2]){var He=r.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);be[4]=He[0],be[5]=He[1]}}else if(O.touches[0]&&!r.touchData.didSelect){var Ut=r.touchData.start,Ri=r.touchData.last,dt;if(!r.hoverData.draggingEles&&!r.swipePanning&&(dt=r.findNearestElement(be[0],be[1],!0,!0)),ne&&Ut!=null&&O.preventDefault(),ne&&Ut!=null&&r.nodeIsDraggable(Ut))if(sr){var ot=r.dragData.touchDragEles,_o=!r.dragData.didDrag;_o&&x(ot,{inDragLayer:!0}),r.dragData.didDrag=!0;var fa={x:0,y:0};if(qe(ar[0])&&qe(ar[1])&&(fa.x+=ar[0],fa.y+=ar[1],_o)){r.redrawHint("eles",!0);var Pt=r.touchData.dragDelta;Pt&&qe(Pt[0])&&qe(Pt[1])&&(fa.x+=Pt[0],fa.y+=Pt[1])}r.hoverData.draggingEles=!0,ot.silentShift(fa).emit(We("position")).emit(We("drag")),r.redrawHint("drag",!0),r.touchData.startPosition[0]==Ve[0]&&r.touchData.startPosition[1]==Ve[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Pt=r.touchData.dragDelta=r.touchData.dragDelta||[];Pt.length===0?(Pt.push(ar[0]),Pt.push(ar[1])):(Pt[0]+=ar[0],Pt[1]+=ar[1])}if(a(Ut||dt,["touchmove","tapdrag","vmousemove"],O,{x:be[0],y:be[1]}),(!Ut||!Ut.grabbed())&&dt!=Ri&&(Ri&&Ri.emit(We("tapdragout")),dt&&dt.emit(We("tapdragover"))),r.touchData.last=dt,ne)for(var Et=0;Et<be.length;Et++)be[Et]&&r.touchData.startPosition[Et]&&sr&&(r.touchData.singleTouchMoved=!0);if(ne&&(Ut==null||Ut.pannable())&&ge.panningEnabled()&&ge.userPanningEnabled()){var uf=o(Ut,r.touchData.starts);uf&&(O.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Ji(r.touchData.startPosition)),r.swipePanning?(ge.panBy({x:ar[0]*Be,y:ar[1]*Be}),ge.emit(We("dragpan"))):sr&&(r.swipePanning=!0,ge.panBy({x:lr*Be,y:Ur*Be}),ge.emit(We("dragpan")),Ut&&(Ut.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var He=r.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);be[0]=He[0],be[1]=He[1]}}for(var Ke=0;Ke<be.length;Ke++)Ve[Ke]=be[Ke];ne&&O.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var Se;r.registerBinding(e,"touchcancel",Se=function(O){var ne=r.touchData.start;r.touchData.capture=!1,ne&&ne.unactivate()});var Ee,re,ce,_e;if(r.registerBinding(e,"touchend",Ee=function(O){var ne=r.touchData.start,he=r.touchData.capture;if(he)O.touches.length===0&&(r.touchData.capture=!1),O.preventDefault();else return;var ge=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var be=r.cy,Ve=be.zoom(),Be=r.touchData.now,He=r.touchData.earlier;if(O.touches[0]){var We=r.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);Be[0]=We[0],Be[1]=We[1]}if(O.touches[1]){var We=r.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);Be[2]=We[0],Be[3]=We[1]}if(O.touches[2]){var We=r.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);Be[4]=We[0],Be[5]=We[1]}var Xe=function(yn){return{originalEvent:O,type:yn,position:{x:Be[0],y:Be[1]}}};ne&&ne.unactivate();var sr;if(r.touchData.cxt){if(sr=Xe("cxttapend"),ne?ne.emit(sr):be.emit(sr),!r.touchData.cxtDragged){var ar=Xe("cxttap");ne?ne.emit(ar):be.emit(ar)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!O.touches[2]&&be.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var Ke=be.collection(r.getAllInBox(ge[0],ge[1],ge[2],ge[3]));ge[0]=void 0,ge[1]=void 0,ge[2]=void 0,ge[3]=void 0,ge[4]=0,r.redrawHint("select",!0),be.emit(Xe("boxend"));var lr=function(yn){return yn.selectable()&&!yn.selected()};Ke.emit(Xe("box")).stdFilter(lr).select().emit(Xe("boxselect")),Ke.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(ne!=null&&ne.unactivate(),O.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!O.touches[1]){if(!O.touches[0]){if(!O.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var ir=r.dragData.touchDragEles;if(ne!=null){var Ur=ne._private.grabbed;w(ir),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Ur&&(ne.emit(Xe("freeon")),ir.emit(Xe("free")),r.dragData.didDrag&&(ne.emit(Xe("dragfreeon")),ir.emit(Xe("dragfree")))),a(ne,["touchend","tapend","vmouseup","tapdragout"],O,{x:Be[0],y:Be[1]}),ne.unactivate(),r.touchData.start=null}else{var Mr=r.findNearestElement(Be[0],Be[1],!0,!0);a(Mr,["touchend","tapend","vmouseup","tapdragout"],O,{x:Be[0],y:Be[1]})}var ct=r.touchData.startPosition[0]-Be[0],Lr=ct*ct,jr=r.touchData.startPosition[1]-Be[1],Nr=jr*jr,Qr=Lr+Nr,Pn=Qr*Ve*Ve;r.touchData.singleTouchMoved||(ne||be.$(":selected").unselect(["tapunselect"]),a(ne,["tap","vclick"],O,{x:Be[0],y:Be[1]}),re=!1,O.timeStamp-_e<=be.multiClickDebounceTime()?(ce&&clearTimeout(ce),re=!0,_e=null,a(ne,["dbltap","vdblclick"],O,{x:Be[0],y:Be[1]})):(ce=setTimeout(function(){re||a(ne,["onetap","voneclick"],O,{x:Be[0],y:Be[1]})},be.multiClickDebounceTime()),_e=O.timeStamp)),ne!=null&&!r.dragData.didDrag&&ne._private.selectable&&Pn<r.touchTapThreshold2&&!r.pinching&&(be.selectionType()==="single"?(be.$(t).unmerge(ne).unselect(["tapunselect"]),ne.select(["tapselect"])):ne.selected()?ne.unselect(["tapunselect"]):ne.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var Vr=0;Vr<Be.length;Vr++)He[Vr]=Be[Vr];r.dragData.didDrag=!1,O.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),O.touches.length<2&&(O.touches.length===1&&(r.touchData.startGPosition=[O.touches[0].clientX,O.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},!1),typeof TouchEvent>"u"){var me=[],Te=function(O){return{clientX:O.clientX,clientY:O.clientY,force:1,identifier:O.pointerId,pageX:O.pageX,pageY:O.pageY,radiusX:O.width/2,radiusY:O.height/2,screenX:O.screenX,screenY:O.screenY,target:O.target}},De=function(O){return{event:O,touch:Te(O)}},Ne=function(O){me.push(De(O))},ze=function(O){for(var ne=0;ne<me.length;ne++){var he=me[ne];if(he.event.pointerId===O.pointerId){me.splice(ne,1);return}}},$e=function(O){var ne=me.filter(function(he){return he.event.pointerId===O.pointerId})[0];ne.event=O,ne.touch=Te(O)},ke=function(O){O.touches=me.map(function(ne){return ne.touch})},Oe=function(O){return O.pointerType==="mouse"||O.pointerType===4};r.registerBinding(r.container,"pointerdown",function(ye){Oe(ye)||(ye.preventDefault(),Ne(ye),ke(ye),le(ye))}),r.registerBinding(r.container,"pointerup",function(ye){Oe(ye)||(ze(ye),ke(ye),Ee(ye))}),r.registerBinding(r.container,"pointercancel",function(ye){Oe(ye)||(ze(ye),ke(ye),Se(ye))}),r.registerBinding(r.container,"pointermove",function(ye){Oe(ye)||(ye.preventDefault(),$e(ye),ke(ye),Me(ye))})}};var aa={};aa.generatePolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(n,a,i,o,s,u){this.renderer.nodeShapeImpl("polygon",n,a,i,o,s,this.points)},intersectLine:function(n,a,i,o,s,u,l,f){return vs(s,u,this.points,n,a,i/2,o/2,l)},checkPoint:function(n,a,i,o,s,u,l,f){return na(n,a,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:r!=="rectangle",miterBounds:function(n,a,i,o,s,u){return WF(this.points,n,a,i,o,s)}}};aa.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,o,s,u){return QF(i,o,e,t,n/2+s,a/2+s)},checkPoint:function(e,t,n,a,i,o,s,u){return ui(e,t,a,i,o,s,n)}}};aa.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(n,a,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===n&&u[l+"-cy"]===a)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=n,u[l+"-cy"]=a;var f=i/2,d=o/2;s=s==="auto"?rA(i,o):s;for(var h=new Array(e.length/2),g=0;g<e.length/2;g++)h[g]={x:n+f*e[g*2],y:a+d*e[g*2+1]};var p,x,b,w,y=h.length;for(x=h[y-1],p=0;p<y;p++)b=h[p%y],w=h[(p+1)%y],u[l][p]=d0(x,b,w,s),x=b,b=w;return u[l]},draw:function(n,a,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",n,a,i,o,s,this.points,this.getOrCreateCorners(a,i,o,s,u,l,"drawCorners"))},intersectLine:function(n,a,i,o,s,u,l,f,d){return ez(s,u,this.points,n,a,i,o,l,this.getOrCreateCorners(n,a,i,o,f,d,"corners"))},checkPoint:function(n,a,i,o,s,u,l,f,d){return ZF(n,a,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,f,d,"corners"))}}};aa.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,o)},intersectLine:function(e,t,n,a,i,o,s,u){return JR(i,o,e,t,n,a,s,u)},checkPoint:function(e,t,n,a,i,o,s,u){var l=a/2,f=i/2;u=u==="auto"?Ma(a,i):u,u=Math.min(l,f,u);var d=u*2;return!!(na(e,t,this.points,o,s,a,i-d,[0,-1],n)||na(e,t,this.points,o,s,a-d,i,[0,-1],n)||ui(e,t,d,d,o-l+u,s-f+u,n)||ui(e,t,d,d,o+l-u,s-f+u,n)||ui(e,t,d,d,o+l-u,s+f-u,n)||ui(e,t,d,d,o-l+u,s+f-u,n))}}};aa.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:r0(),points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,null,o)},generateCutTrianglePts:function(e,t,n,a,i){var o=i==="auto"?this.cornerLength:i,s=t/2,u=e/2,l=n-u,f=n+u,d=a-s,h=a+s;return{topLeft:[l,d+o,l+o,d,l+o,d+o],topRight:[f-o,d,f,d+o,f-o,d+o],bottomRight:[f,h-o,f-o,h,f-o,h-o],bottomLeft:[l+o,h,l,h-o,l+o,h-o]}},intersectLine:function(e,t,n,a,i,o,s,u){var l=this.generateCutTrianglePts(n+2*s,a+2*s,e,t,u),f=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return vs(i,o,f,e,t)},checkPoint:function(e,t,n,a,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(na(e,t,this.points,o,s,a,i-2*l,[0,-1],n)||na(e,t,this.points,o,s,a-2*l,i,[0,-1],n))return!0;var f=this.generateCutTrianglePts(a,i,o,s);return Vt(e,t,f.topLeft)||Vt(e,t,f.topRight)||Vt(e,t,f.bottomRight)||Vt(e,t,f.bottomLeft)}}};aa.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,o,s,u){var l=.15,f=.5,d=.85,h=this.generateBarrelBezierPts(n+2*s,a+2*s,e,t),g=function(b){var w=io({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},l),y=io({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},f),E=io({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},d);return[b[0],b[1],w.x,w.y,y.x,y.y,E.x,E.y,b[4],b[5]]},p=[].concat(g(h.topLeft),g(h.topRight),g(h.bottomRight),g(h.bottomLeft));return vs(i,o,p,e,t)},generateBarrelBezierPts:function(e,t,n,a){var i=t/2,o=e/2,s=n-o,u=n+o,l=a-i,f=a+i,d=Cm(e,t),h=d.heightOffset,g=d.widthOffset,p=d.ctrlPtOffsetPct*e,x={topLeft:[s,l+h,s+p,l,s+g,l],topRight:[u-g,l,u-p,l,u,l+h],bottomRight:[u,f-h,u-p,f,u-g,f],bottomLeft:[s+g,f,s+p,f,s,f-h]};return x.topLeft.isTop=!0,x.topRight.isTop=!0,x.bottomLeft.isBottom=!0,x.bottomRight.isBottom=!0,x},checkPoint:function(e,t,n,a,i,o,s,u){var l=Cm(a,i),f=l.heightOffset,d=l.widthOffset;if(na(e,t,this.points,o,s,a,i-2*f,[0,-1],n)||na(e,t,this.points,o,s,a-2*d,i,[0,-1],n))return!0;for(var h=this.generateBarrelBezierPts(a,i,o,s),g=function(A,P,I){var D=I[4],L=I[2],M=I[0],q=I[5],N=I[1],W=Math.min(D,M),V=Math.max(D,M),$=Math.min(q,N),X=Math.max(q,N);if(W<=A&&A<=V&&$<=P&&P<=X){var ee=rz(D,L,M),K=KF(ee[0],ee[1],ee[2],A),j=K.filter(function(fe){return 0<=fe&&fe<=1});if(j.length>0)return j[0]}return null},p=Object.keys(h),x=0;x<p.length;x++){var b=p[x],w=h[b],y=g(e,t,w);if(y!=null){var E=w[5],C=w[3],S=w[1],R=ut(E,C,S,y);if(w.isTop&&R<=t||w.isBottom&&t<=R)return!0}}return!1}}};aa.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,o)},intersectLine:function(e,t,n,a,i,o,s,u){var l=e-(n/2+s),f=t-(a/2+s),d=f,h=e+(n/2+s),g=Ta(i,o,e,t,l,f,h,d,!1);return g.length>0?g:JR(i,o,e,t,n,a,s,u)},checkPoint:function(e,t,n,a,i,o,s,u){u=u==="auto"?Ma(a,i):u;var l=2*u;if(na(e,t,this.points,o,s,a,i-l,[0,-1],n)||na(e,t,this.points,o,s,a-l,i,[0,-1],n))return!0;var f=a/2+2*n,d=i/2+2*n,h=[o-f,s-d,o-f,s,o+f,s,o+f,s-d];return!!(Vt(e,t,h)||ui(e,t,l,l,o+a/2-u,s+i/2-u,n)||ui(e,t,l,l,o-a/2+u,s+i/2-u,n))}}};aa.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Mt(3,0)),this.generateRoundPolygon("round-triangle",Mt(3,0)),this.generatePolygon("rectangle",Mt(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",Mt(5,0)),this.generateRoundPolygon("round-pentagon",Mt(5,0)),this.generatePolygon("hexagon",Mt(6,0)),this.generateRoundPolygon("round-hexagon",Mt(6,0)),this.generatePolygon("heptagon",Mt(7,0)),this.generateRoundPolygon("round-heptagon",Mt(7,0)),this.generatePolygon("octagon",Mt(8,0)),this.generateRoundPolygon("round-octagon",Mt(8,0));var n=new Array(20);{var a=Em(5,0),i=Em(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)n[s*4]=a[s*2],n[s*4+1]=a[s*2+1],n[s*4+2]=i[s*2],n[s*4+3]=i[s*2+1]}n=eA(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}r.makePolygon=function(l){var f=l.join("$"),d="polygon-"+f,h;return(h=this[d])?h:e.generatePolygon(d,l)}};var Is={};Is.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Is.redraw=function(r){r=r||YR();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r};Is.beforeRender=function(r,e){if(!this.destroyed){e==null&&kr("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(n,a){return a.priority-n.priority})}};var ME=function(e,t,n){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(t,n)};Is.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function(a){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){ME(r,!0,a);var i=ta();r.render(r.renderOptions);var o=r.lastDrawTime=ta();r.averageRedrawTime===void 0&&(r.averageRedrawTime=o-i),r.redrawCount===void 0&&(r.redrawCount=0),r.redrawCount++,r.redrawTotalTime===void 0&&(r.redrawTotalTime=0);var s=o-i;r.redrawTotalTime+=s,r.lastRedrawTime=s,r.averageRedrawTime=r.averageRedrawTime/2+s/2,r.requestedFrame=!1}else ME(r,!1,a);r.skipFrame=!1,tl(t)}};tl(t)}};var y3=function(e){this.init(e)},rP=y3,wo=rP.prototype;wo.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];wo.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),n=e.cy.window();if(n){var a=n.document,i=a.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=a.getElementById(o)!=null;if(t.className.indexOf(s)<0&&(t.className=(t.className||"")+" "+s),!u){var l=a.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}var f=n.getComputedStyle(t),d=f.getPropertyValue("position");d==="static"&&Cr("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=r.showFps,e.debug=r.debug,e.webgl=r.webgl,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=qe(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};wo.notify=function(r,e){var t=this,n=t.cy;if(!this.destroyed){if(r==="init"){t.load();return}if(r==="destroy"){t.destroy();return}(r==="add"||r==="remove"||r==="move"&&n.hasCompoundNodes()||r==="load"||r==="zorder"||r==="mount")&&t.invalidateCachedZSortedEles(),r==="viewport"&&t.redrawHint("select",!0),r==="gc"&&t.redrawHint("gc",!0),(r==="load"||r==="resize"||r==="mount")&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};wo.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var t=r.bindings[e],n=t,a=n.target;(a.off||a.removeEventListener).apply(a,n.args)}if(r.bindings=[],r.beforeRenderCallbacks=[],r.onUpdateEleCalcsFns=[],r.removeObserver&&r.removeObserver.disconnect(),r.styleObserver&&r.styleObserver.disconnect(),r.resizeObserver&&r.resizeObserver.disconnect(),r.labelCalcDiv)try{document.body.removeChild(r.labelCalcDiv)}catch{}};wo.isHeadless=function(){return!1};[c0,JA,eP,bo,aa,Is].forEach(function(r){Ze(wo,r)});var nv=1e3/60,tP={setupDequeueing:function(e){return function(){var n=this,a=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var i=Ss(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold),o=function(l,f){var d=ta(),h=a.averageRedrawTime,g=a.lastRedrawTime,p=[],x=a.cy.extent(),b=a.getPixelRatio();for(l||a.flushRenderedStyleQueue();;){var w=ta(),y=w-d,E=w-f;if(g<nv){var C=nv-(l?h:0);if(E>=e.deqFastCost*C)break}else if(l){if(y>=e.deqCost*g||y>=e.deqAvgCost*h)break}else if(E>=e.deqNoDrawCost*nv)break;var S=e.deq(n,b,x);if(S.length>0)for(var R=0;R<S.length;R++)p.push(S[R]);else break}p.length>0&&(e.onDeqd(n,p),!l&&e.shouldRedraw(n,p,b,x)&&i())},s=e.priority||Xm;a.beforeRender(o,s(n))}}}},m3=(function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:nl;qa(this,r),this.idsByKey=new ra,this.keyForId=new ra,this.cachesByLvl=new ra,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return Na(r,[{key:"getIdsFor",value:function(t){t==null&&kr("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(t);return a||(a=new go,n.set(t,a)),a}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n),i=this.getKey(t);this.deleteIdForKey(a,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteIdForKey(a,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),a=this.keyForId.get(n),i=this.getKey(t);return a!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,a=this.lvls,i=n.get(t);return i||(i=new ra,n.set(t,i),a.push(t)),i}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var a=this.getKey(t),i=this.getCache(a,n);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,n){var a=this.keyForId.get(t.id()),i=this.getCache(a,n);return i}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var a=this.getKey(t);return this.hasCache(a,n)}},{key:"setCache",value:function(t,n,a){a.key=t,this.getCachesAt(n).set(t,a)}},{key:"set",value:function(t,n,a){var i=this.getKey(t);this.setCache(i,n,a),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var a=this.getKey(t);this.deleteCache(a,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(a){return n.deleteCache(t,a)})}},{key:"invalidate",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}])})(),LE=25,qu=50,ju=-4,km=3,nP=7.99,b3=8,w3=1024,x3=1024,E3=1024,C3=.2,_3=.8,S3=10,T3=.15,R3=.1,A3=.9,P3=.9,I3=100,D3=1,ro={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},B3=wt({getKey:null,doesEleInvalidateKey:nl,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:HR,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Zo=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var a=B3(t);Ze(n,a),n.lookup=new m3(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},it=Zo.prototype;it.reasons=ro;it.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};it.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=t[r]=t[r]||[];return n};it.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Ts(function(t,n){return n.reqs-t.reqs});return e};it.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};it.getElement=function(r,e,t,n,a){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(n==null&&(n=Math.ceil(Qm(s*t))),n<ju)n=ju;else if(s>=nP||n>km)return null;var l=Math.pow(2,n),f=e.h*l,d=e.w*l,h=o.eleTextBiggerThanMin(r,l);if(!this.isVisible(r,h))return null;var g=u.get(r,n);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;var p;if(f<=LE?p=LE:f<=qu?p=qu:p=Math.ceil(f/qu)*qu,f>E3||d>x3)return null;var x=i.getTextureQueue(p),b=x[x.length-2],w=function(){return i.recycleTexture(p,d)||i.addTexture(p,d)};b||(b=x[x.length-1]),b||(b=w()),b.width-b.usedWidth<d&&(b=w());for(var y=function(W){return W&&W.scaledLabelShown===h},E=a&&a===ro.dequeue,C=a&&a===ro.highQuality,S=a&&a===ro.downscale,R,_=n+1;_<=km;_++){var A=u.get(r,_);if(A){R=A;break}}var P=R&&R.level===n+1?R:null,I=function(){b.context.drawImage(P.texture.canvas,P.x,0,P.width,P.height,b.usedWidth,0,d,f)};if(b.context.setTransform(1,0,0,1,0,0),b.context.clearRect(b.usedWidth,0,d,p),y(P))I();else if(y(R))if(C){for(var D=R.level;D>n;D--)P=i.getElement(r,e,t,D,ro.downscale);I()}else return i.queueElement(r,R.level-1),R;else{var L;if(!E&&!C&&!S)for(var M=n-1;M>=ju;M--){var q=u.get(r,M);if(q){L=q;break}}if(y(L))return i.queueElement(r,n),L;b.context.translate(b.usedWidth,0),b.context.scale(l,l),this.drawElement(b.context,r,e,h,!1),b.context.scale(1/l,1/l),b.context.translate(-b.usedWidth,0)}return g={x:b.usedWidth,texture:b,level:n,scale:l,width:d,height:f,scaledLabelShown:h},b.usedWidth+=Math.ceil(d+b3),b.eleCaches.push(g),u.set(r,n,g),i.checkTextureFullness(b),g};it.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])};it.invalidateElement=function(r){var e=this,t=e.lookup,n=[],a=t.isInvalid(r);if(a){for(var i=ju;i<=km;i++){var o=t.getForCachedKey(r,i);o&&n.push(o)}var s=t.invalidate(r);if(s)for(var u=0;u<n.length;u++){var l=n[u],f=l.texture;f.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(r)}};it.checkTextureUtility=function(r){r.invalidatedWidth>=C3*r.width&&this.retireTexture(r)};it.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>_3&&r.fullnessChecks>=S3?Ba(t,r):r.fullnessChecks++};it.retireTexture=function(r){var e=this,t=r.height,n=e.getTextureQueue(t),a=this.lookup;Ba(n,r),r.retired=!0;for(var i=r.eleCaches,o=0;o<i.length;o++){var s=i[o];a.deleteCache(s.key,s.level)}Zm(i);var u=e.getRetiredTextureQueue(t);u.push(r)};it.addTexture=function(r,e){var t=this,n=t.getTextureQueue(r),a={};return n.push(a),a.eleCaches=[],a.height=r,a.width=Math.max(w3,e),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=t.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a};it.recycleTexture=function(r,e){for(var t=this,n=t.getTextureQueue(r),a=t.getRetiredTextureQueue(r),i=0;i<a.length;i++){var o=a[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Zm(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Ba(a,o),n.push(o),o}};it.queueElement=function(r,e){var t=this,n=t.getElementQueue(),a=t.getElementKeyToQueue(),i=this.getKey(r),o=a[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(r),o.reqs++,n.updateItem(o);else{var s={eles:r.spawn().merge(r),level:e,reqs:1,key:i};n.push(s),a[i]=s}};it.dequeue=function(r){for(var e=this,t=e.getElementQueue(),n=e.getElementKeyToQueue(),a=[],i=e.lookup,o=0;o<D3&&t.size()>0;o++){var s=t.pop(),u=s.key,l=s.eles[0],f=i.hasCache(l,s.level);if(n[u]=null,f)continue;a.push(s);var d=e.getBoundingBox(l);e.getElement(l,d,r,s.level,ro.dequeue)}return a};it.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),n=e.getElementKeyToQueue(),a=this.getKey(r),i=n[a];i!=null&&(i.eles.length===1?(i.reqs=Ym,t.updateItem(i),t.pop(),n[a]=null):i.eles.unmerge(r))};it.onDequeue=function(r){this.onDequeues.push(r)};it.offDequeue=function(r){Ba(this.onDequeues,r)};it.setupDequeueing=tP.setupDequeueing({deqRedrawThreshold:I3,deqCost:T3,deqAvgCost:R3,deqNoDrawCost:A3,deqFastCost:P3,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var a=e.onDequeues[n];a(t)}},shouldRedraw:function(e,t,n,a){for(var i=0;i<t.length;i++)for(var o=t[i].eles,s=0;s<o.length;s++){var u=o[s].boundingBox();if(e0(u,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var M3=1,is=-4,cl=2,L3=3.99,O3=50,k3=50,q3=.15,N3=.1,F3=.9,z3=.9,$3=1,OE=250,V3=4e3*4e3,kE=32767,G3=!0,aP=function(e){var t=this,n=t.renderer=e,a=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=ta()-2*OE,t.skipping=!1,t.eleTxrDeqs=a.collection(),t.scheduleElementRefinement=Ss(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},k3),n.beforeRender(function(o,s){s-t.lastInvalidationTime<=OE?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var i=function(s,u){return u.reqs-s.reqs};t.layersQueue=new Ts(i),t.setupDequeueing()},xt=aP.prototype,qE=0,W3=Math.pow(2,53)-1;xt.makeLayer=function(r,e){var t=Math.pow(2,e),n=Math.ceil(r.w*t),a=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(n,a),o={id:qE=++qE%W3,bb:r,level:e,width:n,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(t,t),s.translate(u,l),o};xt.getLayers=function(r,e,t){var n=this,a=n.renderer,i=a.cy,o=i.zoom(),s=n.firstGet;if(n.firstGet=!1,t==null){if(t=Math.ceil(Qm(o*e)),t<is)t=is;else if(o>=L3||t>cl)return null}n.validateLayersElesOrdering(t,r);var u=n.layersByLevel,l=Math.pow(2,t),f=u[t]=u[t]||[],d,h=n.levelIsComplete(t,r),g,p=function(){var I=function(N){if(n.validateLayersElesOrdering(N,r),n.levelIsComplete(N,r))return g=u[N],!0},D=function(N){if(!g)for(var W=t+N;is<=W&&W<=cl&&!I(W);W+=N);};D(1),D(-1);for(var L=f.length-1;L>=0;L--){var M=f[L];M.invalid&&Ba(f,M)}};if(!h)p();else return f;var x=function(){if(!d){d=Lt();for(var I=0;I<r.length;I++)$F(d,r[I].boundingBox())}return d},b=function(I){I=I||{};var D=I.after;x();var L=Math.ceil(d.w*l),M=Math.ceil(d.h*l);if(L>kE||M>kE)return null;var q=L*M;if(q>V3)return null;var N=n.makeLayer(d,t);if(D!=null){var W=f.indexOf(D)+1;f.splice(W,0,N)}else(I.insert===void 0||I.insert)&&f.unshift(N);return N};if(n.skipping&&!s)return null;for(var w=null,y=r.length/M3,E=!s,C=0;C<r.length;C++){var S=r[C],R=S._private.rscratch,_=R.imgLayerCaches=R.imgLayerCaches||{},A=_[t];if(A){w=A;continue}if((!w||w.eles.length>=y||!QR(w.bb,S.boundingBox()))&&(w=b({insert:!0,after:w}),!w))return null;g||E?n.queueLayer(w,S):n.drawEleInLayer(w,S,t,e),w.eles.push(S),_[t]=w}return g||(E?null:f)};xt.getEleLevelForLayerLevel=function(r,e){return r};xt.drawEleInLayer=function(r,e,t,n){var a=this,i=this.renderer,o=r.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(t=a.getEleLevelForLayerLevel(t,n),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,t,G3),i.setImgSmoothing(o,!0))};xt.levelIsComplete=function(r,e){var t=this,n=t.layersByLevel[r];if(!n||n.length===0)return!1;for(var a=0,i=0;i<n.length;i++){var o=n[i];if(o.reqs>0||o.invalid)return!1;a+=o.eles.length}return a===e.length};xt.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var n=0;n<t.length;n++){for(var a=t[n],i=-1,o=0;o<e.length;o++)if(a.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(a);continue}for(var s=i,o=0;o<a.eles.length;o++)if(a.eles[o]!==e[s+o]){this.invalidateLayer(a);break}}};xt.updateElementsInLayers=function(r,e){for(var t=this,n=xs(r[0]),a=0;a<r.length;a++)for(var i=n?null:r[a],o=n?r[a]:r[a].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=is;l<=cl;l++){var f=u[l];f&&(i&&t.getEleLevelForLayerLevel(f.level)!==i.level||e(f,o,i))}};xt.haveLayers=function(){for(var r=this,e=!1,t=is;t<=cl;t++){var n=r.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e};xt.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=ta(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(n,a,i){e.invalidateLayer(n)}))};xt.invalidateLayer=function(r){if(this.lastInvalidationTime=ta(),!r.invalid){var e=r.level,t=r.eles,n=this.layersByLevel[e];Ba(n,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var a=0;a<t.length;a++){var i=t[a]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};xt.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(n,a,i){var o=n.replacement;if(o||(o=n.replacement=e.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};xt.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()};xt.queueLayer=function(r,e){var t=this,n=t.layersQueue,a=r.elesQueue,i=a.hasId=a.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;a.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,n.updateItem(r)):(r.reqs=1,n.push(r))}};xt.dequeue=function(r){for(var e=this,t=e.layersQueue,n=[],a=0;a<$3&&t.size()!==0;){var i=t.peek();if(i.replacement){t.pop();continue}if(i.replaces&&i!==i.replaces.replacement){t.pop();continue}if(i.invalid){t.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,r),a++),n.length===0&&n.push(!0),i.elesQueue.length===0&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return n};xt.applyLayerReplacement=function(r){var e=this,t=e.layersByLevel[r.level],n=r.replaces,a=t.indexOf(n);if(!(a<0||n.invalid)){t[a]=r;for(var i=0;i<r.eles.length;i++){var o=r.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[r.level]=r)}e.requestRedraw()}};xt.requestRedraw=Ss(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);xt.setupDequeueing=tP.setupDequeueing({deqRedrawThreshold:O3,deqCost:q3,deqAvgCost:N3,deqNoDrawCost:F3,deqFastCost:z3,deq:function(e,t){return e.dequeue(t)},onDeqd:Xm,shouldRedraw:HR,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var iP={},NE;function U3(r,e){for(var t=0;t<e.length;t++){var n=e[t];r.lineTo(n.x,n.y)}}function H3(r,e,t){for(var n,a=0;a<e.length;a++){var i=e[a];a===0&&(n=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,n.x,n.y)}function FE(r,e,t){r.beginPath&&r.beginPath();for(var n=e,a=0;a<n.length;a++){var i=n[a];r.lineTo(i.x,i.y)}var o=t,s=t[0];r.moveTo(s.x,s.y);for(var a=1;a<o.length;a++){var i=o[a];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}function K3(r,e,t,n,a){r.beginPath&&r.beginPath(),r.arc(t,n,a,0,Math.PI*2,!1);var i=e,o=i[0];r.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var u=i[s];r.lineTo(u.x,u.y)}r.closePath&&r.closePath()}function j3(r,e,t,n){r.arc(e,t,n,0,Math.PI*2,!1)}iP.arrowShapeImpl=function(r){return(NE||(NE={polygon:U3,"triangle-backcurve":H3,"triangle-tee":FE,"circle-triangle":K3,"triangle-cross":FE,circle:j3}))[r]};var Vn={};Vn.drawElement=function(r,e,t,n,a,i){var o=this;e.isNode()?o.drawNode(r,e,t,n,a,i):o.drawEdge(r,e,t,n,a,i)};Vn.drawElementOverlay=function(r,e){var t=this;e.isNode()?t.drawNodeOverlay(r,e):t.drawEdgeOverlay(r,e)};Vn.drawElementUnderlay=function(r,e){var t=this;e.isNode()?t.drawNodeUnderlay(r,e):t.drawEdgeUnderlay(r,e)};Vn.drawCachedElementPortion=function(r,e,t,n,a,i,o,s){var u=this,l=t.getBoundingBox(e);if(!(l.w===0||l.h===0)){var f=t.getElement(e,l,n,a,i);if(f!=null){var d=s(u,e);if(d===0)return;var h=o(u,e),g=l.x1,p=l.y1,x=l.w,b=l.h,w,y,E,C,S;if(h!==0){var R=t.getRotationPoint(e);E=R.x,C=R.y,r.translate(E,C),r.rotate(h),S=u.getImgSmoothing(r),S||u.setImgSmoothing(r,!0);var _=t.getRotationOffset(e);w=_.x,y=_.y}else w=g,y=p;var A;d!==1&&(A=r.globalAlpha,r.globalAlpha=A*d),r.drawImage(f.texture.canvas,f.x,0,f.width,f.height,w,y,x,b),d!==1&&(r.globalAlpha=A),h!==0&&(r.rotate(-h),r.translate(-E,-C),S||u.setImgSmoothing(r,!1))}else t.drawElement(r,e)}};var Y3=function(){return 0},X3=function(e,t){return e.getTextAngle(t,null)},Z3=function(e,t){return e.getTextAngle(t,"source")},Q3=function(e,t){return e.getTextAngle(t,"target")},J3=function(e,t){return t.effectiveOpacity()},av=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};Vn.drawCachedElement=function(r,e,t,n,a,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,f=s.slbTxrCache,d=s.tlbTxrCache,h=e.boundingBox(),g=i===!0?u.reasons.highQuality:null;if(!(h.w===0||h.h===0||!e.visible())&&(!n||e0(h,n))){var p=e.isEdge(),x=e.element()._private.rscratch.badLine;o.drawElementUnderlay(r,e),o.drawCachedElementPortion(r,e,u,t,a,g,Y3,J3),(!p||!x)&&o.drawCachedElementPortion(r,e,l,t,a,g,X3,av),p&&!x&&(o.drawCachedElementPortion(r,e,f,t,a,g,Z3,av),o.drawCachedElementPortion(r,e,d,t,a,g,Q3,av)),o.drawElementOverlay(r,e)}};Vn.drawElements=function(r,e){for(var t=this,n=0;n<e.length;n++){var a=e[n];t.drawElement(r,a)}};Vn.drawCachedElements=function(r,e,t,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];a.drawCachedElement(r,o,t,n)}};Vn.drawCachedNodes=function(r,e,t,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&a.drawCachedElement(r,o,t,n)}};Vn.drawLayeredElements=function(r,e,t,n){var a=this,i=a.data.lyrTxrCache.getLayers(e,t);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||r.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else a.drawCachedElements(r,e,t,n)};var ia={};ia.drawEdge=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;t&&(u=t,r.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,d=e.pstyle("curve-style").value,h=e.pstyle("line-style").value,g=e.pstyle("width").pfValue,p=e.pstyle("line-cap").value,x=e.pstyle("line-outline-width").value,b=e.pstyle("line-outline-color").value,w=l*f,y=l*f,E=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w;d==="straight-triangle"?(o.eleStrokeStyle(r,e,N),o.drawEdgeTrianglePath(e,r,s.allpts)):(r.lineWidth=g,r.lineCap=p,o.eleStrokeStyle(r,e,N),o.drawEdgePath(e,r,s.allpts,h),r.lineCap="butt")},C=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w;if(r.lineWidth=g+x,r.lineCap=p,x>0)o.colorStrokeStyle(r,b[0],b[1],b[2],N);else{r.lineCap="butt";return}d==="straight-triangle"?o.drawEdgeTrianglePath(e,r,s.allpts):(o.drawEdgePath(e,r,s.allpts,h),r.lineCap="butt")},S=function(){a&&o.drawEdgeOverlay(r,e)},R=function(){a&&o.drawEdgeUnderlay(r,e)},_=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;o.drawArrowheads(r,e,N)},A=function(){o.drawElementText(r,e,null,n)};r.lineJoin="round";var P=e.pstyle("ghost").value==="yes";if(P){var I=e.pstyle("ghost-offset-x").pfValue,D=e.pstyle("ghost-offset-y").pfValue,L=e.pstyle("ghost-opacity").value,M=w*L;r.translate(I,D),E(M),_(M),r.translate(-I,-D)}else C();R(),E(),_(),S(),A(),t&&r.translate(u.x1,u.y1)}};var oP=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var a=n.pstyle("".concat(e,"-opacity")).value;if(a!==0){var i=this,o=i.usePaths(),s=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,s.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,f[0],f[1],f[2],a),i.drawEdgePath(n,t,s.allpts,"solid")}}}};ia.drawEdgeOverlay=oP("overlay");ia.drawEdgeUnderlay=oP("underlay");ia.drawEdgePath=function(r,e,t,n){var a=r._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=r.pstyle("line-dash-pattern").pfValue,f=r.pstyle("line-dash-offset").pfValue;if(u){var d=t.join("$"),h=a.pathCacheKey&&a.pathCacheKey===d;h?(o=e=a.pathCache,s=!0):(o=e=new Path2D,a.pathCacheKey=d,a.pathCache=o)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!s&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var g=2;g+3<t.length;g+=4)e.quadraticCurveTo(t[g],t[g+1],t[g+2],t[g+3]);break;case"straight":case"haystack":for(var p=2;p+1<t.length;p+=2)e.lineTo(t[p],t[p+1]);break;case"segments":if(a.isRound){var x=Gt(a.roundCorners),b;try{for(x.s();!(b=x.n()).done;){var w=b.value;jA(e,w)}}catch(E){x.e(E)}finally{x.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var y=2;y+1<t.length;y+=2)e.lineTo(t[y],t[y+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};ia.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var n=r.pstyle("width").pfValue,a=0;a+1<t.length;a+=2){var i=[t[a+2]-t[a],t[a+3]-t[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*n/2,s[1]*n/2];e.beginPath(),e.moveTo(t[a]-u[0],t[a+1]-u[1]),e.lineTo(t[a]+u[0],t[a+1]+u[1]),e.lineTo(t[a+2],t[a+3]),e.closePath(),e.fill()}};ia.drawArrowheads=function(r,e,t){var n=e._private.rscratch,a=n.edgeType==="haystack";a||this.drawArrowhead(r,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,t),a||this.drawArrowhead(r,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,t)};ia.drawArrowhead=function(r,e,t,n,a,i,o){if(!(isNaN(n)||n==null||isNaN(a)||a==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(t+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(t+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(t+"-arrow-fill").value,d=e.pstyle("width").pfValue,h=e.pstyle(t+"-arrow-width"),g=h.value==="match-line"?d:h.pfValue;h.units==="%"&&(g*=d);var p=e.pstyle("opacity").value;o===void 0&&(o=p);var x=r.globalCompositeOperation;(o!==1||f==="hollow")&&(r.globalCompositeOperation="destination-out",s.colorFillStyle(r,255,255,255,1),s.colorStrokeStyle(r,255,255,255,1),s.drawArrowShape(e,r,l,d,u,g,n,a,i),r.globalCompositeOperation=x);var b=e.pstyle(t+"-arrow-color").value;s.colorFillStyle(r,b[0],b[1],b[2],o),s.colorStrokeStyle(r,b[0],b[1],b[2],o),s.drawArrowShape(e,r,f,d,u,g,n,a,i)}}};ia.drawArrowShape=function(r,e,t,n,a,i,o,s,u){var l=this,f=this.usePaths()&&a!=="triangle-cross",d=!1,h,g=e,p={x:o,y:s},x=r.pstyle("arrow-scale").value,b=this.getArrowWidth(n,x),w=l.arrowShapes[a];if(f){var y=l.arrowPathCache=l.arrowPathCache||[],E=ci(a),C=y[E];C!=null?(h=e=C,d=!0):(h=e=new Path2D,y[E]=h)}d||(e.beginPath&&e.beginPath(),f?w.draw(e,1,0,{x:0,y:0},1):w.draw(e,b,u,p,n),e.closePath&&e.closePath()),e=g,f&&(e.translate(o,s),e.rotate(u),e.scale(b,b)),(t==="filled"||t==="both")&&(f?e.fill(h):e.fill()),(t==="hollow"||t==="both")&&(e.lineWidth=i/(f?b:1),e.lineJoin="miter",f?e.stroke(h):e.stroke()),f&&(e.scale(1/b,1/b),e.rotate(-u),e.translate(-o,-s))};var h0={};h0.safeDrawImage=function(r,e,t,n,a,i,o,s,u,l){if(!(a<=0||i<=0||u<=0||l<=0))try{r.drawImage(e,t,n,a,i,o,s,u,l)}catch(f){Cr(f)}};h0.drawInscribedImage=function(r,e,t,n,a){var i=this,o=t.position(),s=o.x,u=o.y,l=t.cy().style(),f=l.getIndexedStyle.bind(l),d=f(t,"background-fit","value",n),h=f(t,"background-repeat","value",n),g=t.width(),p=t.height(),x=t.padding()*2,b=g+(f(t,"background-width-relative-to","value",n)==="inner"?0:x),w=p+(f(t,"background-height-relative-to","value",n)==="inner"?0:x),y=t._private.rscratch,E=f(t,"background-clip","value",n),C=E==="node",S=f(t,"background-image-opacity","value",n)*a,R=f(t,"background-image-smoothing","value",n),_=t.pstyle("corner-radius").value;_!=="auto"&&(_=t.pstyle("corner-radius").pfValue);var A=e.width||e.cachedW,P=e.height||e.cachedH;(A==null||P==null)&&(document.body.appendChild(e),A=e.cachedW=e.width||e.offsetWidth,P=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var I=A,D=P;if(f(t,"background-width","value",n)!=="auto"&&(f(t,"background-width","units",n)==="%"?I=f(t,"background-width","pfValue",n)*b:I=f(t,"background-width","pfValue",n)),f(t,"background-height","value",n)!=="auto"&&(f(t,"background-height","units",n)==="%"?D=f(t,"background-height","pfValue",n)*w:D=f(t,"background-height","pfValue",n)),!(I===0||D===0)){if(d==="contain"){var L=Math.min(b/I,w/D);I*=L,D*=L}else if(d==="cover"){var L=Math.max(b/I,w/D);I*=L,D*=L}var M=s-b/2,q=f(t,"background-position-x","units",n),N=f(t,"background-position-x","pfValue",n);q==="%"?M+=(b-I)*N:M+=N;var W=f(t,"background-offset-x","units",n),V=f(t,"background-offset-x","pfValue",n);W==="%"?M+=(b-I)*V:M+=V;var $=u-w/2,X=f(t,"background-position-y","units",n),ee=f(t,"background-position-y","pfValue",n);X==="%"?$+=(w-D)*ee:$+=ee;var K=f(t,"background-offset-y","units",n),j=f(t,"background-offset-y","pfValue",n);K==="%"?$+=(w-D)*j:$+=j,y.pathCache&&(M-=s,$-=u,s=0,u=0);var fe=r.globalAlpha;r.globalAlpha=S;var G=i.getImgSmoothing(r),z=!1;if(R==="no"&&G?(i.setImgSmoothing(r,!1),z=!0):R==="yes"&&!G&&(i.setImgSmoothing(r,!0),z=!0),h==="no-repeat")C&&(r.save(),y.pathCache?r.clip(y.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,s,u,b,w,_,y),r.clip())),i.safeDrawImage(r,e,0,0,A,P,M,$,I,D),C&&r.restore();else{var Y=r.createPattern(e,h);r.fillStyle=Y,i.nodeShapes[i.getNodeShape(t)].draw(r,s,u,b,w,_,y),r.translate(M,$),r.fill(),r.translate(-M,-$)}r.globalAlpha=fe,z&&i.setImgSmoothing(r,G)}};var bi={};bi.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),n=this.getPixelRatio(),a=Math.ceil(Qm(t*n));e=Math.pow(2,a)}var i=r.pstyle("font-size").pfValue*e,o=r.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};bi.drawElementText=function(r,e,t,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e);r.textAlign=u,r.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,f=e.pstyle("label"),d=e.pstyle("source-label"),h=e.pstyle("target-label");if(l||(!f||!f.value)&&(!d||!d.value)&&(!h||!h.value))return;r.textAlign="center",r.textBaseline="bottom"}var g=!t,p;t&&(p=t,r.translate(-p.x1,-p.y1)),a==null?(o.drawText(r,e,null,g,i),e.isEdge()&&(o.drawText(r,e,"source",g,i),o.drawText(r,e,"target",g,i))):o.drawText(r,e,a,g,i),t&&r.translate(p.x1,p.y1)};bi.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if(e=this.fontCaches[t],e.context===r)return e;return e={context:r},this.fontCaches.push(e),e};bi.setupTextStyle=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;r.font=n+" "+o+" "+a+" "+i,r.lineJoin="round",this.colorFillStyle(r,l[0],l[1],l[2],s),this.colorStrokeStyle(r,f[0],f[1],f[2],u)};function eV(r,e,t,n,a){var i=Math.min(n,a),o=i/2,s=e+n/2,u=t+a/2;r.beginPath(),r.arc(s,u,o,0,Math.PI*2),r.closePath()}function zE(r,e,t,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,n/2,a/2);r.beginPath(),r.moveTo(e+o,t),r.lineTo(e+n-o,t),r.quadraticCurveTo(e+n,t,e+n,t+o),r.lineTo(e+n,t+a-o),r.quadraticCurveTo(e+n,t+a,e+n-o,t+a),r.lineTo(e+o,t+a),r.quadraticCurveTo(e,t+a,e,t+a-o),r.lineTo(e,t+o),r.quadraticCurveTo(e,t,e+o,t),r.closePath()}bi.getTextAngle=function(r,e){var t,n=r._private,a=n.rscratch,i=e?e+"-":"",o=r.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=$t(a,"labelAngle",e);t=r.isEdge()?s:0}else o.strValue==="none"?t=0:t=o.pfValue;return t};bi.drawText=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=a?e.effectiveOpacity():1;if(!(a&&(s===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var u=$t(o,"labelX",t),l=$t(o,"labelY",t),f,d,h=this.getLabelText(e,t);if(h!=null&&h!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(r,e,a);var g=t?t+"-":"",p=$t(o,"labelWidth",t),x=$t(o,"labelHeight",t),b=e.pstyle(g+"text-margin-x").pfValue,w=e.pstyle(g+"text-margin-y").pfValue,y=e.isEdge(),E=e.pstyle("text-halign").value,C=e.pstyle("text-valign").value;y&&(E="center",C="center"),u+=b,l+=w;var S;switch(n?S=this.getTextAngle(e,t):S=0,S!==0&&(f=u,d=l,r.translate(f,d),r.rotate(S),u=0,l=0),C){case"top":break;case"center":l+=x/2;break;case"bottom":l+=x;break}var R=e.pstyle("text-background-opacity").value,_=e.pstyle("text-border-opacity").value,A=e.pstyle("text-border-width").pfValue,P=e.pstyle("text-background-padding").pfValue,I=e.pstyle("text-background-shape").strValue,D=I==="round-rectangle"||I==="roundrectangle",L=I==="circle",M=2;if(R>0||A>0&&_>0){var q=r.fillStyle,N=r.strokeStyle,W=r.lineWidth,V=e.pstyle("text-background-color").value,$=e.pstyle("text-border-color").value,X=e.pstyle("text-border-style").value,ee=R>0,K=A>0&&_>0,j=u-P;switch(E){case"left":j-=p;break;case"center":j-=p/2;break}var fe=l-x-P,G=p+2*P,z=x+2*P;if(ee&&(r.fillStyle="rgba(".concat(V[0],",").concat(V[1],",").concat(V[2],",").concat(R*s,")")),K&&(r.strokeStyle="rgba(".concat($[0],",").concat($[1],",").concat($[2],",").concat(_*s,")"),r.lineWidth=A,r.setLineDash))switch(X){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=A/4,r.setLineDash([]);break;case"solid":default:r.setLineDash([]);break}if(D?(r.beginPath(),zE(r,j,fe,G,z,M)):L?(r.beginPath(),eV(r,j,fe,G,z)):(r.beginPath(),r.rect(j,fe,G,z)),ee&&r.fill(),K&&r.stroke(),K&&X==="double"){var Y=A/2;r.beginPath(),D?zE(r,j+Y,fe+Y,G-2*Y,z-2*Y,M):r.rect(j+Y,fe+Y,G-2*Y,z-2*Y),r.stroke()}r.fillStyle=q,r.strokeStyle=N,r.lineWidth=W,r.setLineDash&&r.setLineDash([])}var te=2*e.pstyle("text-outline-width").pfValue;if(te>0&&(r.lineWidth=te),e.pstyle("text-wrap").value==="wrap"){var ue=$t(o,"labelWrapCachedLines",t),oe=$t(o,"labelLineHeight",t),Z=p/2,Q=this.getLabelJustification(e);switch(Q==="auto"||(E==="left"?Q==="left"?u+=-p:Q==="center"&&(u+=-Z):E==="center"?Q==="left"?u+=-Z:Q==="right"&&(u+=Z):E==="right"&&(Q==="center"?u+=Z:Q==="right"&&(u+=p))),C){case"top":l-=(ue.length-1)*oe;break;case"center":case"bottom":l-=(ue.length-1)*oe;break}for(var ie=0;ie<ue.length;ie++)te>0&&r.strokeText(ue[ie],u,l),r.fillText(ue[ie],u,l),l+=oe}else te>0&&r.strokeText(h,u,l),r.fillText(h,u,l);S!==0&&(r.rotate(-S),r.translate(-f,-d))}}};var za={};za.drawNode=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,f=l.rscratch,d=e.position();if(!(!qe(d.x)||!qe(d.y))&&!(i&&!e.visible())){var h=i?e.effectiveOpacity():1,g=o.usePaths(),p,x=!1,b=e.padding();s=e.width()+2*b,u=e.height()+2*b;var w;t&&(w=t,r.translate(-w.x1,-w.y1));for(var y=e.pstyle("background-image"),E=y.value,C=new Array(E.length),S=new Array(E.length),R=0,_=0;_<E.length;_++){var A=E[_],P=C[_]=A!=null&&A!=="none";if(P){var I=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",_);R++,S[_]=o.getCachedImage(A,I,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,L=e.pstyle("border-width").pfValue,M=e.pstyle("background-opacity").value*h,q=e.pstyle("border-color").value,N=e.pstyle("border-style").value,W=e.pstyle("border-join").value,V=e.pstyle("border-cap").value,$=e.pstyle("border-position").value,X=e.pstyle("border-dash-pattern").pfValue,ee=e.pstyle("border-dash-offset").pfValue,K=e.pstyle("border-opacity").value*h,j=e.pstyle("outline-width").pfValue,fe=e.pstyle("outline-color").value,G=e.pstyle("outline-style").value,z=e.pstyle("outline-opacity").value*h,Y=e.pstyle("outline-offset").value,te=e.pstyle("corner-radius").value;te!=="auto"&&(te=e.pstyle("corner-radius").pfValue);var ue=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M;o.eleFillStyle(r,e,Oe)},oe=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;o.colorStrokeStyle(r,q[0],q[1],q[2],Oe)},Z=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;o.colorStrokeStyle(r,fe[0],fe[1],fe[2],Oe)},Q=function(Oe,ye,O,ne){var he=o.nodePathCache=o.nodePathCache||[],ge=UR(O==="polygon"?O+","+ne.join(","):O,""+ye,""+Oe,""+te),be=he[ge],Ve,Be=!1;return be!=null?(Ve=be,Be=!0,f.pathCache=Ve):(Ve=new Path2D,he[ge]=f.pathCache=Ve),{path:Ve,cacheHit:Be}},ie=e.pstyle("shape").strValue,de=e.pstyle("shape-polygon-points").pfValue;if(g){r.translate(d.x,d.y);var we=Q(s,u,ie,de);p=we.path,x=we.cacheHit}var Ae=function(){if(!x){var Oe=d;g&&(Oe={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(p||r,Oe.x,Oe.y,s,u,te,f)}g?r.fill(p):r.fill()},ve=function(){for(var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,O=l.backgrounding,ne=0,he=0;he<S.length;he++){var ge=e.cy().style().getIndexedStyle(e,"background-image-containment","value",he);if(ye&&ge==="over"||!ye&&ge==="inside"){ne++;continue}C[he]&&S[he].complete&&!S[he].error&&(ne++,o.drawInscribedImage(r,S[he],e,he,Oe))}l.backgrounding=ne!==R,O!==l.backgrounding&&e.updateStyle(!1)},le=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;o.hasPie(e)&&(o.drawPie(r,e,ye),Oe&&(g||o.nodeShapes[o.getNodeShape(e)].draw(r,d.x,d.y,s,u,te,f)))},Me=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;o.hasStripe(e)&&(r.save(),g?r.clip(f.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(r,d.x,d.y,s,u,te,f),r.clip()),o.drawStripe(r,e,ye),r.restore(),Oe&&(g||o.nodeShapes[o.getNodeShape(e)].draw(r,d.x,d.y,s,u,te,f)))},Se=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ye=(D>0?D:-D)*Oe,O=D>0?0:255;D!==0&&(o.colorFillStyle(r,O,O,O,ye),g?r.fill(p):r.fill())},Ee=function(){if(L>0){if(r.lineWidth=L,r.lineCap=V,r.lineJoin=W,r.setLineDash)switch(N){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(X),r.lineDashOffset=ee;break;case"solid":case"double":r.setLineDash([]);break}if($!=="center"){if(r.save(),r.lineWidth*=2,$==="inside")g?r.clip(p):r.clip();else{var Oe=new Path2D;Oe.rect(-s/2-L,-u/2-L,s+2*L,u+2*L),Oe.addPath(p),r.clip(Oe,"evenodd")}g?r.stroke(p):r.stroke(),r.restore()}else g?r.stroke(p):r.stroke();if(N==="double"){r.lineWidth=L/3;var ye=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",g?r.stroke(p):r.stroke(),r.globalCompositeOperation=ye}r.setLineDash&&r.setLineDash([])}},re=function(){if(j>0){if(r.lineWidth=j,r.lineCap="butt",r.setLineDash)switch(G){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var Oe=d;g&&(Oe={x:0,y:0});var ye=o.getNodeShape(e),O=L;$==="inside"&&(O=0),$==="outside"&&(O*=2);var ne=(s+O+(j+Y))/s,he=(u+O+(j+Y))/u,ge=s*ne,be=u*he,Ve=o.nodeShapes[ye].points,Be;if(g){var He=Q(ge,be,ye,Ve);Be=He.path}if(ye==="ellipse")o.drawEllipsePath(Be||r,Oe.x,Oe.y,ge,be);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ye)){var We=0,Xe=0,sr=0;ye==="round-diamond"?We=(O+Y+j)*1.4:ye==="round-heptagon"?(We=(O+Y+j)*1.075,sr=-(O/2+Y+j)/35):ye==="round-hexagon"?We=(O+Y+j)*1.12:ye==="round-pentagon"?(We=(O+Y+j)*1.13,sr=-(O/2+Y+j)/15):ye==="round-tag"?(We=(O+Y+j)*1.12,Xe=(O/2+j+Y)*.07):ye==="round-triangle"&&(We=(O+Y+j)*(Math.PI/2),sr=-(O+Y/2+j)/Math.PI),We!==0&&(ne=(s+We)/s,ge=s*ne,["round-hexagon","round-tag"].includes(ye)||(he=(u+We)/u,be=u*he)),te=te==="auto"?rA(ge,be):te;for(var ar=ge/2,Ke=be/2,lr=te+(O+j+Y)/2,ir=new Array(Ve.length/2),Ur=new Array(Ve.length/2),Mr=0;Mr<Ve.length/2;Mr++)ir[Mr]={x:Oe.x+Xe+ar*Ve[Mr*2],y:Oe.y+sr+Ke*Ve[Mr*2+1]};var ct,Lr,jr,Nr,Qr=ir.length;for(Lr=ir[Qr-1],ct=0;ct<Qr;ct++)jr=ir[ct%Qr],Nr=ir[(ct+1)%Qr],Ur[ct]=d0(Lr,jr,Nr,lr),Lr=jr,jr=Nr;o.drawRoundPolygonPath(Be||r,Oe.x+Xe,Oe.y+sr,s*ne,u*he,Ve,Ur)}else if(["roundrectangle","round-rectangle"].includes(ye))te=te==="auto"?Ma(ge,be):te,o.drawRoundRectanglePath(Be||r,Oe.x,Oe.y,ge,be,te+(O+j+Y)/2);else if(["cutrectangle","cut-rectangle"].includes(ye))te=te==="auto"?r0():te,o.drawCutRectanglePath(Be||r,Oe.x,Oe.y,ge,be,null,te+(O+j+Y)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ye))te=te==="auto"?Ma(ge,be):te,o.drawBottomRoundRectanglePath(Be||r,Oe.x,Oe.y,ge,be,te+(O+j+Y)/2);else if(ye==="barrel")o.drawBarrelPath(Be||r,Oe.x,Oe.y,ge,be);else if(ye.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ye)){var Pn=(O+j+Y)/s;Ve=al(il(Ve,Pn)),o.drawPolygonPath(Be||r,Oe.x,Oe.y,s,u,Ve)}else{var Vr=(O+j+Y)/s;Ve=al(il(Ve,-Vr)),o.drawPolygonPath(Be||r,Oe.x,Oe.y,s,u,Ve)}if(g?r.stroke(Be):r.stroke(),G==="double"){r.lineWidth=O/3;var pn=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",g?r.stroke(Be):r.stroke(),r.globalCompositeOperation=pn}r.setLineDash&&r.setLineDash([])}},ce=function(){a&&o.drawNodeOverlay(r,e,d,s,u)},_e=function(){a&&o.drawNodeUnderlay(r,e,d,s,u)},me=function(){o.drawElementText(r,e,null,n)},Te=e.pstyle("ghost").value==="yes";if(Te){var De=e.pstyle("ghost-offset-x").pfValue,Ne=e.pstyle("ghost-offset-y").pfValue,ze=e.pstyle("ghost-opacity").value,$e=ze*h;r.translate(De,Ne),Z(),re(),ue(ze*M),Ae(),ve($e,!0),oe(ze*K),Ee(),le(D!==0||L!==0),Me(D!==0||L!==0),ve($e,!1),Se($e),r.translate(-De,-Ne)}g&&r.translate(-d.x,-d.y),_e(),g&&r.translate(d.x,d.y),Z(),re(),ue(),Ae(),ve(h,!0),oe(),Ee(),le(D!==0||L!==0),Me(D!==0||L!==0),ve(h,!1),Se(),g&&r.translate(-d.x,-d.y),me(),ce(),t&&r.translate(w.x1,w.y1)}};var sP=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,a,i,o){var s=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,f=n.pstyle("".concat(e,"-color")).value,d=n.pstyle("".concat(e,"-shape")).value,h=n.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(a=a||n.position(),i==null||o==null){var g=n.padding();i=n.width()+2*g,o=n.height()+2*g}s.colorFillStyle(t,f[0],f[1],f[2],l),s.nodeShapes[d].draw(t,a.x,a.y,i+u*2,o+u*2,h),t.fill()}}}};za.drawNodeOverlay=sP("overlay");za.drawNodeUnderlay=sP("underlay");za.hasPie=function(r){return r=r[0],r._private.hasPie};za.hasStripe=function(r){return r=r[0],r._private.hasStripe};za.drawPie=function(r,e,t,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=n.x,l=n.y,f=e.width(),d=e.height(),h=Math.min(f,d)/2,g,p=0,x=this.usePaths();if(x&&(u=0,l=0),i.units==="%"?h=h*i.pfValue:i.pfValue!==void 0&&(h=i.pfValue/2),o.units==="%"?g=h*o.pfValue:o.pfValue!==void 0&&(g=o.pfValue/2),!(g>=h))for(var b=1;b<=a.pieBackgroundN;b++){var w=e.pstyle("pie-"+b+"-background-size").value,y=e.pstyle("pie-"+b+"-background-color").value,E=e.pstyle("pie-"+b+"-background-opacity").value*t,C=w/100;C+p>1&&(C=1-p);var S=1.5*Math.PI+2*Math.PI*p;S+=s;var R=2*Math.PI*C,_=S+R;w===0||p>=1||p+C>1||(g===0?(r.beginPath(),r.moveTo(u,l),r.arc(u,l,h,S,_),r.closePath()):(r.beginPath(),r.arc(u,l,h,S,_),r.arc(u,l,g,_,S,!0),r.closePath()),this.colorFillStyle(r,y[0],y[1],y[2],E),r.fill(),p+=C)}};za.drawStripe=function(r,e,t,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=n.x,o=n.y,s=e.width(),u=e.height(),l=0,f=this.usePaths();r.save();var d=e.pstyle("stripe-direction").value,h=e.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":r.rotate(-Math.PI/2);break}var g=s,p=u;h.units==="%"?(g=g*h.pfValue,p=p*h.pfValue):h.pfValue!==void 0&&(g=h.pfValue,p=h.pfValue),f&&(i=0,o=0),o-=g/2,i-=p/2;for(var x=1;x<=a.stripeBackgroundN;x++){var b=e.pstyle("stripe-"+x+"-background-size").value,w=e.pstyle("stripe-"+x+"-background-color").value,y=e.pstyle("stripe-"+x+"-background-opacity").value*t,E=b/100;E+l>1&&(E=1-l),!(b===0||l>=1||l+E>1)&&(r.beginPath(),r.rect(i,o+p*l,g,p*E),r.closePath(),this.colorFillStyle(r,w[0],w[1],w[2],y),r.fill(),l+=E)}r.restore()};var Ot={},rV=100;Ot.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};Ot.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,n,a=0;a<e.length;a++)if(n=e[a],n.context===r){t=!1;break}return t&&(n={context:r},e.push(n)),n};Ot.createGradientStyleFor=function(r,e,t,n,a){var i,o=this.usePaths(),s=t.pstyle(e+"-gradient-stop-colors").value,u=t.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(t.isEdge()){var l=t.sourceEndpoint(),f=t.targetEndpoint(),d=t.midpoint(),h=di(l,d),g=di(f,d);i=r.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,g))}else{var p=o?{x:0,y:0}:t.position(),x=t.paddedWidth(),b=t.paddedHeight();i=r.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(x,b))}else if(t.isEdge()){var w=t.sourceEndpoint(),y=t.targetEndpoint();i=r.createLinearGradient(w.x,w.y,y.x,y.y)}else{var E=o?{x:0,y:0}:t.position(),C=t.paddedWidth(),S=t.paddedHeight(),R=C/2,_=S/2,A=t.pstyle("background-gradient-direction").value;switch(A){case"to-bottom":i=r.createLinearGradient(E.x,E.y-_,E.x,E.y+_);break;case"to-top":i=r.createLinearGradient(E.x,E.y+_,E.x,E.y-_);break;case"to-left":i=r.createLinearGradient(E.x+R,E.y,E.x-R,E.y);break;case"to-right":i=r.createLinearGradient(E.x-R,E.y,E.x+R,E.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(E.x-R,E.y-_,E.x+R,E.y+_);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(E.x-R,E.y+_,E.x+R,E.y-_);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(E.x+R,E.y-_,E.x-R,E.y+_);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(E.x+R,E.y+_,E.x-R,E.y-_);break}}if(!i)return null;for(var P=u.length===s.length,I=s.length,D=0;D<I;D++)i.addColorStop(P?u[D]:D/(I-1),"rgba("+s[D][0]+","+s[D][1]+","+s[D][2]+","+a+")");return i};Ot.gradientFillStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"background",e,t,n);if(!a)return null;r.fillStyle=a};Ot.colorFillStyle=function(r,e,t,n,a){r.fillStyle="rgba("+e+","+t+","+n+","+a+")"};Ot.eleFillStyle=function(r,e,t){var n=e.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(r,e,n,t);else{var a=e.pstyle("background-color").value;this.colorFillStyle(r,a[0],a[1],a[2],t)}};Ot.gradientStrokeStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"line",e,t,n);if(!a)return null;r.strokeStyle=a};Ot.colorStrokeStyle=function(r,e,t,n,a){r.strokeStyle="rgba("+e+","+t+","+n+","+a+")"};Ot.eleStrokeStyle=function(r,e,t){var n=e.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(r,e,n,t);else{var a=e.pstyle("line-color").value;this.colorStrokeStyle(r,a[0],a[1],a[2],t)}};Ot.matchCanvasSize=function(r){var e=this,t=e.data,n=e.findContainerClientCoords(),a=n[2],i=n[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=a*o,l=i*o,f;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var d=t.canvasContainer;d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<e.CANVAS_LAYERS;h++)f=t.canvases[h],f.width=u,f.height=l,f.style.width=a+"px",f.style.height=i+"px";for(var h=0;h<e.BUFFER_COUNT;h++)f=t.bufferCanvases[h],f.width=u,f.height=l,f.style.width=a+"px",f.style.height=i+"px";e.textureMult=1,o<=1&&(f=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=u*e.textureMult,f.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}};Ot.renderTo=function(r,e,t,n){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:n})};Ot.clearCanvas=function(){var r=this,e=r.data;function t(n){n.clearRect(0,0,r.canvasWidth,r.canvasHeight)}t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])};Ot.render=function(r){var e=this;r=r||YR();var t=e.cy,n=r.forcedContext,a=r.drawAllLayers,i=r.drawOnlyNodeLayer,o=r.forcedZoom,s=r.forcedPan,u=r.forcedPxRatio===void 0?this.getPixelRatio():r.forcedPxRatio,l=e.data,f=l.canvasNeedsRedraw,d=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),h=r.motionBlur!==void 0?r.motionBlur:e.motionBlur,g=e.motionBlurPxRatio,p=t.hasCompoundNodes(),x=e.hoverData.draggingEles,b=!!(e.hoverData.selecting||e.touchData.selecting);h=h&&!n&&e.motionBlurEnabled&&!b;var w=h;n||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!n&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),h&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(w=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!d&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var y=t.style(),E=t.zoom(),C=o!==void 0?o:E,S=t.pan(),R={x:S.x,y:S.y},_={zoom:E,pan:{x:S.x,y:S.y}},A=e.prevViewport,P=A===void 0||_.zoom!==A.zoom||_.pan.x!==A.pan.x||_.pan.y!==A.pan.y;!P&&!(x&&!p)&&(e.motionBlurPxRatio=1),s&&(R=s),C*=u,R.x*=u,R.y*=u;var I=e.getCachedZSortedEles();function D(oe,Z,Q,ie,de){var we=oe.globalCompositeOperation;oe.globalCompositeOperation="destination-out",e.colorFillStyle(oe,255,255,255,e.motionBlurTransparency),oe.fillRect(Z,Q,ie,de),oe.globalCompositeOperation=we}function L(oe,Z){var Q,ie,de,we;!e.clearingMotionBlur&&(oe===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||oe===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(Q={x:S.x*g,y:S.y*g},ie=E*g,de=e.canvasWidth*g,we=e.canvasHeight*g):(Q=R,ie=C,de=e.canvasWidth,we=e.canvasHeight),oe.setTransform(1,0,0,1,0,0),Z==="motionBlur"?D(oe,0,0,de,we):!n&&(Z===void 0||Z)&&oe.clearRect(0,0,de,we),a||(oe.translate(Q.x,Q.y),oe.scale(ie,ie)),s&&oe.translate(s.x,s.y),o&&oe.scale(o,o)}if(d||(e.textureDrawLastFrame=!1),d){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var M=e.data.bufferContexts[e.TEXTURE_BUFFER];M.setTransform(1,0,0,1,0,0),M.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:M,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var _=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};_.mpan={x:(0-_.pan.x)/_.zoom,y:(0-_.pan.y)/_.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var q=l.contexts[e.NODE],N=e.textureCache.texture,_=e.textureCache.viewport;q.setTransform(1,0,0,1,0,0),h?D(q,0,0,_.width,_.height):q.clearRect(0,0,_.width,_.height);var W=y.core("outside-texture-bg-color").value,V=y.core("outside-texture-bg-opacity").value;e.colorFillStyle(q,W[0],W[1],W[2],V),q.fillRect(0,0,_.width,_.height);var E=t.zoom();L(q,!1),q.clearRect(_.mpan.x,_.mpan.y,_.width/_.zoom/u,_.height/_.zoom/u),q.drawImage(N,_.mpan.x,_.mpan.y,_.width/_.zoom/u,_.height/_.zoom/u)}else e.textureOnViewport&&!n&&(e.textureCache=null);var $=t.extent(),X=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),ee=e.hideEdgesOnViewport&&X,K=[];if(K[e.NODE]=!f[e.NODE]&&h&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,K[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),K[e.DRAG]=!f[e.DRAG]&&h&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,K[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||a||i||K[e.NODE]){var j=h&&!K[e.NODE]&&g!==1,q=n||(j?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),fe=h&&!j?"motionBlur":void 0;L(q,fe),ee?e.drawCachedNodes(q,I.nondrag,u,$):e.drawLayeredElements(q,I.nondrag,u,$),e.debug&&e.drawDebugPoints(q,I.nondrag),!a&&!h&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||a||K[e.DRAG])){var j=h&&!K[e.DRAG]&&g!==1,q=n||(j?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);L(q,h&&!j?"motionBlur":void 0),ee?e.drawCachedNodes(q,I.drag,u,$):e.drawCachedElements(q,I.drag,u,$),e.debug&&e.drawDebugPoints(q,I.drag),!a&&!h&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,L),h&&g!==1){var G=l.contexts[e.NODE],z=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Y=l.contexts[e.DRAG],te=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ue=function(Z,Q,ie){Z.setTransform(1,0,0,1,0,0),ie||!w?Z.clearRect(0,0,e.canvasWidth,e.canvasHeight):D(Z,0,0,e.canvasWidth,e.canvasHeight);var de=g;Z.drawImage(Q,0,0,e.canvasWidth*de,e.canvasHeight*de,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||K[e.NODE])&&(ue(G,z,K[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||K[e.DRAG])&&(ue(Y,te,K[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=_,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),h&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!d,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},rV)),n||t.emit("render")};var Wo;Ot.drawSelectionRectangle=function(r,e){var t=this,n=t.cy,a=t.data,i=n.style(),o=r.drawOnlyNodeLayer,s=r.drawAllLayers,u=a.canvasNeedsRedraw,l=r.forcedContext;if(t.showFps||!o&&u[t.SELECT_BOX]&&!s){var f=l||a.contexts[t.SELECT_BOX];if(e(f),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var d=t.cy.zoom(),h=i.core("selection-box-border-width").value/d;f.lineWidth=h,f.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",f.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),h>0&&(f.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",f.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(a.bgActivePosistion&&!t.hoverData.selecting){var d=t.cy.zoom(),g=a.bgActivePosistion;f.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",f.beginPath(),f.arc(g.x,g.y,i.core("active-bg-size").pfValue/d,0,2*Math.PI),f.fill()}var p=t.lastRedrawTime;if(t.showFps&&p){p=Math.round(p);var x=Math.round(1e3/p),b="1 frame = "+p+" ms = "+x+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!Wo){var w=f.measureText(b);Wo=w.actualBoundingBoxAscent}f.fillText(b,0,Wo);var y=60;f.strokeRect(0,Wo+10,250,20),f.fillRect(0,Wo+10,250*Math.min(x/y,1),20)}s||(u[t.SELECT_BOX]=!1)}};function $E(r,e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(n));return n}function tV(r,e,t){var n=$E(r,r.VERTEX_SHADER,e),a=$E(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,n),r.attachShader(i,a),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function nV(r,e,t){t===void 0&&(t=e);var n=r.makeOffscreenCanvas(e,t),a=n.context=n.getContext("2d");return n.clear=function(){return a.clearRect(0,0,n.width,n.height)},n.clear(),n}function g0(r){var e=r.pixelRatio,t=r.cy.zoom(),n=r.cy.pan();return{zoom:t*e,pan:{x:n.x*e,y:n.y*e}}}function aV(r){var e=r.pixelRatio,t=r.cy.zoom();return t*e}function iV(r,e,t,n,a){var i=n*t+e.x,o=a*t+e.y;return o=Math.round(r.canvasHeight-o),[i,o]}function oV(r){return r.pstyle("background-fill").value!=="solid"||r.pstyle("background-image").strValue!=="none"?!1:r.pstyle("border-width").value===0||r.pstyle("border-opacity").value===0?!0:r.pstyle("border-style").value==="solid"}function sV(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function ri(r,e,t){var n=r[0]/255,a=r[1]/255,i=r[2]/255,o=e,s=t||new Array(4);return s[0]=n*o,s[1]=a*o,s[2]=i*o,s[3]=o,s}function ji(r,e){var t=e||new Array(4);return t[0]=(r>>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function uV(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function lV(r,e){var t=r.createTexture();return t.buffer=function(n){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}function uP(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function lP(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function fV(r,e,t,n,a,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*n,a);case r.INT:return new Int32Array(t.buffer,i*n,a)}}function cV(r,e,t,n){var a=uP(r,e),i=Xr(a,2),o=i[0],s=i[1],u=lP(r,s,n),l=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),s===r.FLOAT?r.vertexAttribPointer(t,o,s,!1,0,0):s===r.INT&&r.vertexAttribIPointer(t,o,s,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),l}function Ln(r,e,t,n){var a=uP(r,t),i=Xr(a,3),o=i[0],s=i[1],u=i[2],l=lP(r,s,e*o),f=o*u,d=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,d),r.bufferData(r.ARRAY_BUFFER,e*f,r.DYNAMIC_DRAW),r.enableVertexAttribArray(n),s===r.FLOAT?r.vertexAttribPointer(n,o,s,!1,f,0):s===r.INT&&r.vertexAttribIPointer(n,o,s,f,0),r.vertexAttribDivisor(n,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var h=new Array(e),g=0;g<e;g++)h[g]=fV(r,s,l,f,o,g);return d.dataArray=l,d.stride=f,d.size=o,d.getView=function(p){return h[p]},d.setPoint=function(p,x,b){var w=h[p];w[0]=x,w[1]=b},d.bufferSubData=function(p){r.bindBuffer(r.ARRAY_BUFFER,d),p?r.bufferSubData(r.ARRAY_BUFFER,0,l,0,p*o):r.bufferSubData(r.ARRAY_BUFFER,0,l)},d}function dV(r,e,t){for(var n=9,a=new Float32Array(e*n),i=new Array(e),o=0;o<e;o++){var s=o*n*4;i[o]=new Float32Array(a.buffer,s,n)}var u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,a.byteLength,r.DYNAMIC_DRAW);for(var l=0;l<3;l++){var f=t+l;r.enableVertexAttribArray(f),r.vertexAttribPointer(f,3,r.FLOAT,!1,36,l*12),r.vertexAttribDivisor(f,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),u.getMatrixView=function(d){return i[d]},u.setData=function(d,h){i[h].set(d,0)},u.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferSubData(r.ARRAY_BUFFER,0,a)},u}function vV(r){var e=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,e);var t=r.createTexture();return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.bindFramebuffer(r.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(n,a){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,n,a,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}var VE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function iv(){var r=new VE(9);return VE!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function GE(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function hV(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],d=e[8],h=t[0],g=t[1],p=t[2],x=t[3],b=t[4],w=t[5],y=t[6],E=t[7],C=t[8];return r[0]=h*n+g*o+p*l,r[1]=h*a+g*s+p*f,r[2]=h*i+g*u+p*d,r[3]=x*n+b*o+w*l,r[4]=x*a+b*s+w*f,r[5]=x*i+b*u+w*d,r[6]=y*n+E*o+C*l,r[7]=y*a+E*s+C*f,r[8]=y*i+E*u+C*d,r}function Yu(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],d=e[8],h=t[0],g=t[1];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=s,r[5]=u,r[6]=h*n+g*o+l,r[7]=h*a+g*s+f,r[8]=h*i+g*u+d,r}function WE(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],d=e[8],h=Math.sin(t),g=Math.cos(t);return r[0]=g*n+h*o,r[1]=g*a+h*s,r[2]=g*i+h*u,r[3]=g*o-h*n,r[4]=g*s-h*a,r[5]=g*u-h*i,r[6]=l,r[7]=f,r[8]=d,r}function qm(r,e,t){var n=t[0],a=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=a*e[3],r[4]=a*e[4],r[5]=a*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function gV(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}var pV=(function(){function r(e,t,n,a){qa(this,r),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=t,this.texRows=n,this.texHeight=Math.floor(t/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(e,t,t),this.scratch=a(e,t,this.texHeight,"scratch")}return Na(r,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var n=t.w,a=t.h,i=this.texHeight,o=this.texSize,s=i/a,u=n*s,l=a*s;return u>o&&(s=o/n,u=n*s,l=a*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(t,n,a){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(n),f=l.scale,d=l.texW,h=l.texH,g=function(E,C){if(a&&C){var S=C.context,R=E.x,_=E.row,A=R,P=u*_;S.save(),S.translate(A,P),S.scale(f,f),a(S,n),S.restore()}},p=[null,null],x=function(){g(i.freePointer,i.canvas),p[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:d,h},p[1]={x:i.freePointer.x+d,y:i.freePointer.row*u,w:0,h},i.freePointer.x+=d,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},b=function(){var E=i.scratch,C=i.canvas;E.clear(),g({x:0,row:0},E);var S=o-i.freePointer.x,R=d-S,_=u;{var A=i.freePointer.x,P=i.freePointer.row*u,I=S;C.context.drawImage(E,0,0,I,_,A,P,I,_),p[0]={x:A,y:P,w:I,h}}{var D=S,L=(i.freePointer.row+1)*u,M=R;C&&C.context.drawImage(E,D,0,M,_,0,L,M,_),p[1]={x:0,y:L,w:M,h}}i.freePointer.x=R,i.freePointer.row++},w=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+d<=o)x();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(w(),x()):this.enableWrapping?b():(w(),x())}return this.keyToLocation.set(t,p),this.needsBuffer=!0,p}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(t){if(this.locked)return!1;var n=this.texSize,a=this.texRows,i=this.getScale(t),o=i.texW;return this.freePointer.x+o>n?this.freePointer.row<a-1:!0}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=lV(t,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),yV=(function(){function r(e,t,n,a){qa(this,r),this.r=e,this.texSize=t,this.texRows=n,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return Na(r,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,n=this.texSize,a=this.texRows,i=this.createTextureCanvas;return new pV(t,n,a,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,n=this.texSize,a=this.texRows,i=this.createTextureCanvas,o=Math.floor(n/a);this.scratch=i(t,n,o,"scratch")}return this.scratch}},{key:"draw",value:function(t,n,a){var i=this.styleKeyToAtlas.get(t);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(n))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,n,a),this.styleKeyToAtlas.set(t,i)),i}},{key:"getAtlas",value:function(t){return this.styleKeyToAtlas.get(t)}},{key:"hasAtlas",value:function(t){return this.styleKeyToAtlas.has(t)}},{key:"markKeyForGC",value:function(t){this.markedKeys.add(t)}},{key:"gc",value:function(){var t=this,n=this.markedKeys;if(n.size===0){console.log("nothing to garbage collect");return}var a=[],i=new Map,o=null,s=Gt(this.atlases),u;try{var l=function(){var d=u.value,h=d.getKeys(),g=mV(n,h);if(g.size===0)return a.push(d),h.forEach(function(S){return i.set(S,d)}),1;o||(o=t._createAtlas(),a.push(o));var p=Gt(h),x;try{for(p.s();!(x=p.n()).done;){var b=x.value;if(!g.has(b)){var w=d.getOffsets(b),y=Xr(w,2),E=y[0],C=y[1];o.canFit({w:E.w+C.w,h:E.h})||(o.lock(),o=t._createAtlas(),a.push(o)),d.canvas&&(t._copyTextureToNewAtlas(b,d,o),i.set(b,o))}}}catch(S){p.e(S)}finally{p.f()}d.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(f){s.e(f)}finally{s.f()}this.atlases=a,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(t,n,a){var i=n.getOffsets(t),o=Xr(i,2),s=o[0],u=o[1];if(u.w===0)a.draw(t,s,function(h){h.drawImage(n.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(n.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),l.context.drawImage(n.canvas,u.x,u.y,u.w,u.h,s.w,0,u.w,u.h);var f=s.w+u.w,d=s.h;a.draw(t,{w:f,h:d},function(h){h.drawImage(l,0,0,f,d,0,0,f,d)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function mV(r,e){return r.intersection?r.intersection(e):new Set(el(r).filter(function(t){return e.has(t)}))}var bV=(function(){function r(e,t){qa(this,r),this.r=e,this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return Na(r,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,n){var a=this.globalOptions,i=a.webglTexSize,o=a.createTextureCanvas,s=n.texRows,u=this._cacheScratchCanvas(o),l=new yV(this.r,i,s,u);this.collections.set(t,l)}},{key:"addRenderType",value:function(t,n){var a=n.collection;if(!this.collections.has(a))throw new Error("invalid atlas collection name '".concat(a,"'"));var i=this.collections.get(a),o=Ze({type:t,atlasCollection:i},n);this.renderTypes.set(t,o)}},{key:"getRenderTypeOpts",value:function(t){return this.renderTypes.get(t)}},{key:"getAtlasCollection",value:function(t){return this.collections.get(t)}},{key:"_cacheScratchCanvas",value:function(t){var n=-1,a=-1,i=null;return function(o,s,u,l){return l?((!i||s!=n||u!=a)&&(n=s,a=u,i=t(o,s,u)),i):t(o,s,u)}}},{key:"_key",value:function(t,n){return"".concat(t,"-").concat(n)}},{key:"invalidate",value:function(t){var n=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.forceRedraw,o=i===void 0?!1:i,s=a.filterEle,u=s===void 0?function(){return!0}:s,l=a.filterType,f=l===void 0?function(){return!0}:l,d=!1,h=!1,g=Gt(t),p;try{for(g.s();!(p=g.n()).done;){var x=p.value;if(u(x)){var b=Gt(this.renderTypes.values()),w;try{var y=function(){var C=w.value,S=C.type;if(f(S)){var R=n.collections.get(C.collection),_=C.getKey(x),A=Array.isArray(_)?_:[_];if(o)A.forEach(function(L){return R.markKeyForGC(L)}),h=!0;else{var P=C.getID?C.getID(x):x.id(),I=n._key(S,P),D=n.typeAndIdToKey.get(I);D!==void 0&&!sV(A,D)&&(d=!0,n.typeAndIdToKey.delete(I),D.forEach(function(L){return R.markKeyForGC(L)}))}}};for(b.s();!(w=b.n()).done;)y()}catch(E){b.e(E)}finally{b.f()}}}}catch(E){g.e(E)}finally{g.f()}return h&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var t=Gt(this.collections.values()),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,n,a,i){var o=this.renderTypes.get(n),s=this.collections.get(o.collection),u=!1,l=s.draw(i,a,function(h){o.drawClipped?(h.save(),h.beginPath(),h.rect(0,0,a.w,a.h),h.clip(),o.drawElement(h,t,a,!0,!0),h.restore()):o.drawElement(h,t,a,!0,!0),u=!0});if(u){var f=o.getID?o.getID(t):t.id(),d=this._key(n,f);this.typeAndIdToKey.has(d)?this.typeAndIdToKey.get(d).push(i):this.typeAndIdToKey.set(d,[i])}return l}},{key:"getAtlasInfo",value:function(t,n){var a=this,i=this.renderTypes.get(n),o=i.getKey(t),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(t,u),f=a.getOrCreateAtlas(t,n,l,u),d=f.getOffsets(u),h=Xr(d,2),g=h[0],p=h[1];return{atlas:f,tex:g,tex1:g,tex2:p,bb:l}})}},{key:"getDebugInfo",value:function(){var t=[],n=Gt(this.collections),a;try{for(n.s();!(a=n.n()).done;){var i=Xr(a.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,f=u.atlasCount;t.push({type:o,keyCount:l,atlasCount:f})}}catch(d){n.e(d)}finally{n.f()}return t}}])})(),wV=(function(){function r(e){qa(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return Na(r,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,n){return n})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(t){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0}},{key:"getAtlasIndexForBatch",value:function(t){var n=this.batchAtlases.indexOf(t);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),n=this.batchAtlases.length-1}return n}}])})(),xV=`
|
|
44
|
-
float circleSD(vec2 p, float r) {
|
|
45
|
-
return distance(vec2(0), p) - r; // signed distance
|
|
46
|
-
}
|
|
47
|
-
`,EV=`
|
|
48
|
-
float rectangleSD(vec2 p, vec2 b) {
|
|
49
|
-
vec2 d = abs(p)-b;
|
|
50
|
-
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
51
|
-
}
|
|
52
|
-
`,CV=`
|
|
53
|
-
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
54
|
-
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
55
|
-
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
56
|
-
vec2 q = abs(p) - b + cr.x;
|
|
57
|
-
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
58
|
-
}
|
|
59
|
-
`,_V=`
|
|
60
|
-
float ellipseSD(vec2 p, vec2 ab) {
|
|
61
|
-
p = abs( p ); // symmetry
|
|
62
|
-
|
|
63
|
-
// find root with Newton solver
|
|
64
|
-
vec2 q = ab*(p-ab);
|
|
65
|
-
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
66
|
-
for( int i=0; i<5; i++ ) {
|
|
67
|
-
vec2 cs = vec2(cos(w),sin(w));
|
|
68
|
-
vec2 u = ab*vec2( cs.x,cs.y);
|
|
69
|
-
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
70
|
-
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// compute final point and distance
|
|
74
|
-
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
75
|
-
|
|
76
|
-
// return signed distance
|
|
77
|
-
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
78
|
-
}
|
|
79
|
-
`,os={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},dl={IGNORE:1,USE_BB:2},ov=0,UE=1,HE=2,sv=3,Yi=4,Nu=5,Uo=6,Ho=7,SV=(function(){function r(e,t,n){qa(this,r),this.r=e,this.gl=t,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=nV,this.atlasManager=new bV(e,n),this.batchManager=new wV(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(os.SCREEN),this.pickingProgram=this._createShaderProgram(os.PICKING),this.vao=this._createVAO()}return Na(r,[{key:"addAtlasCollection",value:function(t,n){this.atlasManager.addAtlasCollection(t,n)}},{key:"addTextureAtlasRenderType",value:function(t,n){this.atlasManager.addRenderType(t,n)}},{key:"addSimpleShapeRenderType",value:function(t,n){this.simpleShapeOptions.set(t,n)}},{key:"invalidate",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.type,i=this.atlasManager;return a?i.invalidate(t,{filterType:function(s){return s===a},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var n=this.gl,a=`#version 300 es
|
|
80
|
-
precision highp float;
|
|
81
|
-
|
|
82
|
-
uniform mat3 uPanZoomMatrix;
|
|
83
|
-
uniform int uAtlasSize;
|
|
84
|
-
|
|
85
|
-
// instanced
|
|
86
|
-
in vec2 aPosition; // a vertex from the unit square
|
|
87
|
-
|
|
88
|
-
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
89
|
-
in int aVertType; // the type of thing we are rendering
|
|
90
|
-
|
|
91
|
-
// the z-index that is output when using picking mode
|
|
92
|
-
in vec4 aIndex;
|
|
93
|
-
|
|
94
|
-
// For textures
|
|
95
|
-
in int aAtlasId; // which shader unit/atlas to use
|
|
96
|
-
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
97
|
-
|
|
98
|
-
// for edges
|
|
99
|
-
in vec4 aPointAPointB;
|
|
100
|
-
in vec4 aPointCPointD;
|
|
101
|
-
in vec2 aLineWidth; // also used for node border width
|
|
102
|
-
|
|
103
|
-
// simple shapes
|
|
104
|
-
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
105
|
-
in vec4 aColor; // also used for edges
|
|
106
|
-
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
107
|
-
|
|
108
|
-
// output values passed to the fragment shader
|
|
109
|
-
out vec2 vTexCoord;
|
|
110
|
-
out vec4 vColor;
|
|
111
|
-
out vec2 vPosition;
|
|
112
|
-
// flat values are not interpolated
|
|
113
|
-
flat out int vAtlasId;
|
|
114
|
-
flat out int vVertType;
|
|
115
|
-
flat out vec2 vTopRight;
|
|
116
|
-
flat out vec2 vBotLeft;
|
|
117
|
-
flat out vec4 vCornerRadius;
|
|
118
|
-
flat out vec4 vBorderColor;
|
|
119
|
-
flat out vec2 vBorderWidth;
|
|
120
|
-
flat out vec4 vIndex;
|
|
121
|
-
|
|
122
|
-
void main(void) {
|
|
123
|
-
int vid = gl_VertexID;
|
|
124
|
-
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
125
|
-
|
|
126
|
-
if(aVertType == `.concat(ov,`) {
|
|
127
|
-
float texX = aTex.x; // texture coordinates
|
|
128
|
-
float texY = aTex.y;
|
|
129
|
-
float texW = aTex.z;
|
|
130
|
-
float texH = aTex.w;
|
|
131
|
-
|
|
132
|
-
if(vid == 1 || vid == 2 || vid == 4) {
|
|
133
|
-
texX += texW;
|
|
134
|
-
}
|
|
135
|
-
if(vid == 2 || vid == 4 || vid == 5) {
|
|
136
|
-
texY += texH;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
float d = float(uAtlasSize);
|
|
140
|
-
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
141
|
-
|
|
142
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
143
|
-
}
|
|
144
|
-
else if(aVertType == `).concat(Yi," || aVertType == ").concat(Ho,`
|
|
145
|
-
|| aVertType == `).concat(Nu," || aVertType == ").concat(Uo,`) { // simple shapes
|
|
146
|
-
|
|
147
|
-
// the bounding box is needed by the fragment shader
|
|
148
|
-
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
149
|
-
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
150
|
-
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
151
|
-
|
|
152
|
-
// calculations are done in the fragment shader, just pass these along
|
|
153
|
-
vColor = aColor;
|
|
154
|
-
vCornerRadius = aCornerRadius;
|
|
155
|
-
vBorderColor = aBorderColor;
|
|
156
|
-
vBorderWidth = aLineWidth;
|
|
157
|
-
|
|
158
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
159
|
-
}
|
|
160
|
-
else if(aVertType == `).concat(UE,`) {
|
|
161
|
-
vec2 source = aPointAPointB.xy;
|
|
162
|
-
vec2 target = aPointAPointB.zw;
|
|
163
|
-
|
|
164
|
-
// adjust the geometry so that the line is centered on the edge
|
|
165
|
-
position.y = position.y - 0.5;
|
|
166
|
-
|
|
167
|
-
// stretch the unit square into a long skinny rectangle
|
|
168
|
-
vec2 xBasis = target - source;
|
|
169
|
-
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
170
|
-
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
171
|
-
|
|
172
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
173
|
-
vColor = aColor;
|
|
174
|
-
}
|
|
175
|
-
else if(aVertType == `).concat(HE,`) {
|
|
176
|
-
vec2 pointA = aPointAPointB.xy;
|
|
177
|
-
vec2 pointB = aPointAPointB.zw;
|
|
178
|
-
vec2 pointC = aPointCPointD.xy;
|
|
179
|
-
vec2 pointD = aPointCPointD.zw;
|
|
180
|
-
|
|
181
|
-
// adjust the geometry so that the line is centered on the edge
|
|
182
|
-
position.y = position.y - 0.5;
|
|
183
|
-
|
|
184
|
-
vec2 p0, p1, p2, pos;
|
|
185
|
-
if(position.x == 0.0) { // The left side of the unit square
|
|
186
|
-
p0 = pointA;
|
|
187
|
-
p1 = pointB;
|
|
188
|
-
p2 = pointC;
|
|
189
|
-
pos = position;
|
|
190
|
-
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
191
|
-
p0 = pointD;
|
|
192
|
-
p1 = pointC;
|
|
193
|
-
p2 = pointB;
|
|
194
|
-
pos = vec2(0.0, -position.y);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
vec2 p01 = p1 - p0;
|
|
198
|
-
vec2 p12 = p2 - p1;
|
|
199
|
-
vec2 p21 = p1 - p2;
|
|
200
|
-
|
|
201
|
-
// Find the normal vector.
|
|
202
|
-
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
203
|
-
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
204
|
-
|
|
205
|
-
// Find the vector perpendicular to p0 -> p1.
|
|
206
|
-
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
207
|
-
|
|
208
|
-
// Determine the bend direction.
|
|
209
|
-
float sigma = sign(dot(p01 + p21, normal));
|
|
210
|
-
float width = aLineWidth[0];
|
|
211
|
-
|
|
212
|
-
if(sign(pos.y) == -sigma) {
|
|
213
|
-
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
214
|
-
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
215
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
216
|
-
} else {
|
|
217
|
-
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
218
|
-
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
219
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
vColor = aColor;
|
|
223
|
-
}
|
|
224
|
-
else if(aVertType == `).concat(sv,` && vid < 3) {
|
|
225
|
-
// massage the first triangle into an edge arrow
|
|
226
|
-
if(vid == 0)
|
|
227
|
-
position = vec2(-0.15, -0.3);
|
|
228
|
-
if(vid == 1)
|
|
229
|
-
position = vec2( 0.0, 0.0);
|
|
230
|
-
if(vid == 2)
|
|
231
|
-
position = vec2( 0.15, -0.3);
|
|
232
|
-
|
|
233
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
234
|
-
vColor = aColor;
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
vAtlasId = aAtlasId;
|
|
241
|
-
vVertType = aVertType;
|
|
242
|
-
vIndex = aIndex;
|
|
243
|
-
}
|
|
244
|
-
`),i=this.batchManager.getIndexArray(),o=`#version 300 es
|
|
245
|
-
precision highp float;
|
|
246
|
-
|
|
247
|
-
// declare texture unit for each texture atlas in the batch
|
|
248
|
-
`.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
|
|
249
|
-
`),`
|
|
250
|
-
|
|
251
|
-
uniform vec4 uBGColor;
|
|
252
|
-
uniform float uZoom;
|
|
253
|
-
|
|
254
|
-
in vec2 vTexCoord;
|
|
255
|
-
in vec4 vColor;
|
|
256
|
-
in vec2 vPosition; // model coordinates
|
|
257
|
-
|
|
258
|
-
flat in int vAtlasId;
|
|
259
|
-
flat in vec4 vIndex;
|
|
260
|
-
flat in int vVertType;
|
|
261
|
-
flat in vec2 vTopRight;
|
|
262
|
-
flat in vec2 vBotLeft;
|
|
263
|
-
flat in vec4 vCornerRadius;
|
|
264
|
-
flat in vec4 vBorderColor;
|
|
265
|
-
flat in vec2 vBorderWidth;
|
|
266
|
-
|
|
267
|
-
out vec4 outColor;
|
|
268
|
-
|
|
269
|
-
`).concat(xV,`
|
|
270
|
-
`).concat(EV,`
|
|
271
|
-
`).concat(CV,`
|
|
272
|
-
`).concat(_V,`
|
|
273
|
-
|
|
274
|
-
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
275
|
-
return vec4(
|
|
276
|
-
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
277
|
-
top.a + (bot.a * (1.0 - top.a))
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
282
|
-
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
283
|
-
// note 1.5 is an aribitrary value chosen because it looks good
|
|
284
|
-
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
void main(void) {
|
|
288
|
-
if(vVertType == `).concat(ov,`) {
|
|
289
|
-
// look up the texel from the texture unit
|
|
290
|
-
`).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
|
|
291
|
-
else `),`
|
|
292
|
-
}
|
|
293
|
-
else if(vVertType == `).concat(sv,`) {
|
|
294
|
-
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
295
|
-
outColor = blend(vColor, uBGColor);
|
|
296
|
-
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
297
|
-
}
|
|
298
|
-
else if(vVertType == `).concat(Yi,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
299
|
-
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
300
|
-
}
|
|
301
|
-
else if(vVertType == `).concat(Yi," || vVertType == ").concat(Ho,`
|
|
302
|
-
|| vVertType == `).concat(Nu," || vVertType == ").concat(Uo,`) { // use SDF
|
|
303
|
-
|
|
304
|
-
float outerBorder = vBorderWidth[0];
|
|
305
|
-
float innerBorder = vBorderWidth[1];
|
|
306
|
-
float borderPadding = outerBorder * 2.0;
|
|
307
|
-
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
308
|
-
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
309
|
-
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
310
|
-
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
311
|
-
|
|
312
|
-
float d; // signed distance
|
|
313
|
-
if(vVertType == `).concat(Yi,`) {
|
|
314
|
-
d = rectangleSD(p, b);
|
|
315
|
-
} else if(vVertType == `).concat(Ho,` && w == h) {
|
|
316
|
-
d = circleSD(p, b.x); // faster than ellipse
|
|
317
|
-
} else if(vVertType == `).concat(Ho,`) {
|
|
318
|
-
d = ellipseSD(p, b);
|
|
319
|
-
} else {
|
|
320
|
-
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
324
|
-
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
325
|
-
if(d > 0.0) {
|
|
326
|
-
if(d > outerBorder) {
|
|
327
|
-
discard;
|
|
328
|
-
} else {
|
|
329
|
-
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
330
|
-
}
|
|
331
|
-
} else {
|
|
332
|
-
if(d > innerBorder) {
|
|
333
|
-
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
334
|
-
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
335
|
-
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
336
|
-
}
|
|
337
|
-
else {
|
|
338
|
-
vec4 outerColor;
|
|
339
|
-
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
340
|
-
outerColor = vec4(0);
|
|
341
|
-
} else if(innerBorder == 0.0) {
|
|
342
|
-
outerColor = vBorderColor;
|
|
343
|
-
} else {
|
|
344
|
-
outerColor = blend(vBorderColor, vColor);
|
|
345
|
-
}
|
|
346
|
-
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
outColor = vColor;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
`).concat(t.picking?`if(outColor.a == 0.0) discard;
|
|
355
|
-
else outColor = vIndex;`:"",`
|
|
356
|
-
}
|
|
357
|
-
`),s=tV(n,a,o);s.aPosition=n.getAttribLocation(s,"aPosition"),s.aIndex=n.getAttribLocation(s,"aIndex"),s.aVertType=n.getAttribLocation(s,"aVertType"),s.aTransform=n.getAttribLocation(s,"aTransform"),s.aAtlasId=n.getAttribLocation(s,"aAtlasId"),s.aTex=n.getAttribLocation(s,"aTex"),s.aPointAPointB=n.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=n.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=n.getAttribLocation(s,"aLineWidth"),s.aColor=n.getAttribLocation(s,"aColor"),s.aCornerRadius=n.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=n.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=n.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=n.getUniformLocation(s,"uAtlasSize"),s.uBGColor=n.getUniformLocation(s,"uBGColor"),s.uZoom=n.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)s.uTextures.push(n.getUniformLocation(s,"uTexture".concat(u)));return s}},{key:"_createVAO",value:function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var n=this.maxInstances,a=this.gl,i=this.program,o=a.createVertexArray();return a.bindVertexArray(o),cV(a,"vec2",i.aPosition,t),this.transformBuffer=dV(a,n,i.aTransform),this.indexBuffer=Ln(a,n,"vec4",i.aIndex),this.vertTypeBuffer=Ln(a,n,"int",i.aVertType),this.atlasIdBuffer=Ln(a,n,"int",i.aAtlasId),this.texBuffer=Ln(a,n,"vec4",i.aTex),this.pointAPointBBuffer=Ln(a,n,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Ln(a,n,"vec4",i.aPointCPointD),this.lineWidthBuffer=Ln(a,n,"vec2",i.aLineWidth),this.colorBuffer=Ln(a,n,"vec4",i.aColor),this.cornerRadiusBuffer=Ln(a,n,"vec4",i.aCornerRadius),this.borderColorBuffer=Ln(a,n,"vec4",i.aBorderColor),a.bindVertexArray(null),o}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return _a(n,"Buffer")}).map(function(n){return t[n]})),this._buffers}},{key:"startFrame",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:os.SCREEN;this.panZoomMatrix=t,this.renderTarget=n,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,n){return t.visible()?n&&n.isVisible?n.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,n,a){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(a);if(this._isVisible(t,s)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(t);if(u===dl.IGNORE)return;if(u==dl.USE_BB){this.drawPickingRectangle(t,n,a);return}}var l=i.getAtlasInfo(t,a),f=Gt(l),d;try{for(f.s();!(d=f.n()).done;){var h=d.value,g=h.atlas,p=h.tex1,x=h.tex2;o.canAddToCurrentBatch(g)||this.endBatch();for(var b=o.getAtlasIndexForBatch(g),w=0,y=[[p,!0],[x,!1]];w<y.length;w++){var E=Xr(y[w],2),C=E[0],S=E[1];if(C.w!=0){var R=this.instanceCount;this.vertTypeBuffer.getView(R)[0]=ov;var _=this.indexBuffer.getView(R);ji(n,_);var A=this.atlasIdBuffer.getView(R);A[0]=b;var P=this.texBuffer.getView(R);P[0]=C.x,P[1]=C.y,P[2]=C.w,P[3]=C.h;var I=this.transformBuffer.getMatrixView(R);this.setTransformMatrix(t,I,s,h,S),this.instanceCount++,S||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(D){f.e(D)}finally{f.f()}}}},{key:"setTransformMatrix",value:function(t,n,a,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(a.shapeProps&&a.shapeProps.padding&&(s=t.pstyle(a.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,d=l.w/(l.w+f.w);o||(d=1-d);var h=this._getAdjustedBB(u,s,o,d);this._applyTransformMatrix(n,h,a,t)}else{var g=a.getBoundingBox(t),p=this._getAdjustedBB(g,s,!0,1);this._applyTransformMatrix(n,p,a,t)}}},{key:"_applyTransformMatrix",value:function(t,n,a,i){var o,s;GE(t);var u=a.getRotation?a.getRotation(i):0;if(u!==0){var l=a.getRotationPoint(i),f=l.x,d=l.y;Yu(t,t,[f,d]),WE(t,t,u);var h=a.getRotationOffset(i);o=h.x+(n.xOffset||0),s=h.y+(n.yOffset||0)}else o=n.x1,s=n.y1;Yu(t,t,[o,s]),qm(t,t,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(t,n,a,i){var o=t.x1,s=t.y1,u=t.w,l=t.h,f=t.yOffset;n&&(o-=n,s-=n,u+=2*n,l+=2*n);var d=0,h=u*i;return a&&i<1?u=h:!a&&i<1&&(d=u-h,o+=d,u=h),{x1:o,y1:s,w:u,h:l,xOffset:d,yOffset:f}}},{key:"drawPickingRectangle",value:function(t,n,a){var i=this.atlasManager.getRenderTypeOpts(a),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Yi;var s=this.indexBuffer.getView(o);ji(n,s);var u=this.colorBuffer.getView(o);ri([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(t,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,n,a){var i=this.simpleShapeOptions.get(a);if(this._isVisible(t,i)){var o=i.shapeProps,s=this._getVertTypeForShape(t,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(t)){this.drawTexture(t,n,a);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===Nu||s===Uo){var l=i.getBoundingBox(t),f=this._getCornerRadius(t,o.radius,l),d=this.cornerRadiusBuffer.getView(u);d[0]=f,d[1]=f,d[2]=f,d[3]=f,s===Uo&&(d[0]=0,d[2]=0)}var h=this.indexBuffer.getView(u);ji(n,h);var g=t.pstyle(o.color).value,p=t.pstyle(o.opacity).value,x=this.colorBuffer.getView(u);ri(g,p,x);var b=this.lineWidthBuffer.getView(u);if(b[0]=0,b[1]=0,o.border){var w=t.pstyle("border-width").value;if(w>0){var y=t.pstyle("border-color").value,E=t.pstyle("border-opacity").value,C=this.borderColorBuffer.getView(u);ri(y,E,C);var S=t.pstyle("border-position").value;if(S==="inside")b[0]=0,b[1]=-w;else if(S==="outside")b[0]=w,b[1]=0;else{var R=w/2;b[0]=R,b[1]=-R}}}var _=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(t,_,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,n){var a=t.pstyle(n).value;switch(a){case"rectangle":return Yi;case"ellipse":return Ho;case"roundrectangle":case"round-rectangle":return Nu;case"bottom-round-rectangle":return Uo;default:return}}},{key:"_getCornerRadius",value:function(t,n,a){var i=a.w,o=a.h;if(t.pstyle(n).value==="auto")return Ma(i,o);var s=t.pstyle(n).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(t,n,a){if(t.visible()){var i=t._private.rscratch,o,s,u;if(a==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=t.pstyle(a+"-arrow-shape").value;if(l!=="none"){var f=t.pstyle(a+"-arrow-color").value,d=t.pstyle("opacity").value,h=t.pstyle("line-opacity").value,g=d*h,p=t.pstyle("width").pfValue,x=t.pstyle("arrow-scale").value,b=this.r.getArrowWidth(p,x),w=this.instanceCount,y=this.transformBuffer.getMatrixView(w);GE(y),Yu(y,y,[o,s]),qm(y,y,[b,b]),WE(y,y,u),this.vertTypeBuffer.getView(w)[0]=sv;var E=this.indexBuffer.getView(w);ji(n,E);var C=this.colorBuffer.getView(w);ri(f,g,C),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,n){if(t.visible()){var a=this._getEdgePoints(t);if(a){var i=t.pstyle("opacity").value,o=t.pstyle("line-opacity").value,s=t.pstyle("width").pfValue,u=t.pstyle("line-color").value,l=i*o;if(a.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),a.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=UE;var d=this.indexBuffer.getView(f);ji(n,d);var h=this.colorBuffer.getView(f);ri(u,l,h);var g=this.lineWidthBuffer.getView(f);g[0]=s;var p=this.pointAPointBBuffer.getView(f);p[0]=a[0],p[1]=a[1],p[2]=a[2],p[3]=a[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var x=0;x<a.length-2;x+=2){var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=HE;var w=this.indexBuffer.getView(b);ji(n,w);var y=this.colorBuffer.getView(b);ri(u,l,y);var E=this.lineWidthBuffer.getView(b);E[0]=s;var C=a[x-2],S=a[x-1],R=a[x],_=a[x+1],A=a[x+2],P=a[x+3],I=a[x+4],D=a[x+5];x==0&&(C=2*R-A+.001,S=2*_-P+.001),x==a.length-4&&(I=2*A-R+.001,D=2*P-_+.001);var L=this.pointAPointBBuffer.getView(b);L[0]=C,L[1]=S,L[2]=R,L[3]=_;var M=this.pointCPointDBuffer.getView(b);M[0]=A,M[1]=P,M[2]=I,M[3]=D,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var n=t._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var n=t._private.rscratch;if(this._isValidEdge(t)){var a=n.allpts;if(a.length==4)return a;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(a,i)}}},{key:"_getNumSegments",value:function(t){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,n){if(t.length==4)return t;for(var a=Array((n+1)*2),i=0;i<=n;i++)if(i==0)a[0]=t[0],a[1]=t[1];else if(i==n)a[i*2]=t[t.length-2],a[i*2+1]=t[t.length-1];else{var o=i/n;this._setCurvePoint(t,o,a,i*2)}return a}},{key:"_setCurvePoint",value:function(t,n,a,i){if(t.length<=2)a[i]=t[0],a[i+1]=t[1];else{for(var o=Array(t.length-2),s=0;s<o.length;s+=2){var u=(1-n)*t[s]+n*t[s+2],l=(1-n)*t[s+1]+n*t[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,n,a,i)}}},{key:"endBatch",value:function(){var t=this.gl,n=this.vao,a=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(o),t.bindVertexArray(n);var s=Gt(this.buffers),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(p){s.e(p)}finally{s.f()}for(var f=this.batchManager.getAtlases(),d=0;d<f.length;d++)f[d].bufferIfNeeded(t);for(var h=0;h<f.length;h++)t.activeTexture(t.TEXTURE0+h),t.bindTexture(t.TEXTURE_2D,f[h].texture),t.uniform1i(o.uTextures[h],h);t.uniform1f(o.uZoom,aV(this.r)),t.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var g=ri(this.bgColor,1);t.uniform4fv(o.uBGColor,g),t.drawArraysInstanced(t.TRIANGLES,0,a,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),n=t.reduce(function(o,s){return o+s.atlasCount},0),a=this.batchDebugInfo,i=a.reduce(function(o,s){return o+s.count},0);return{atlasInfo:t,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:a.length,batchInfo:a,totalInstances:i}}}])})(),fP={};fP.initWebgl=function(r,e){var t=this,n=t.data.contexts[t.WEBGL];r.bgColor=TV(t),r.webglTexSize=Math.min(r.webglTexSize,n.getParameter(n.MAX_TEXTURE_SIZE)),r.webglTexRows=Math.min(r.webglTexRows,54),r.webglTexRowsNodes=Math.min(r.webglTexRowsNodes,54),r.webglBatchSize=Math.min(r.webglBatchSize,16384),r.webglTexPerBatch=Math.min(r.webglTexPerBatch,n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=vV(n),t.pickingFrameBuffer.needsDraw=!0,t.drawing=new SV(t,n,r);var a=function(d){return function(h){return t.getTextAngle(h,d)}},i=function(d){return function(h){var g=h.pstyle(d);return g&&g.value}},o=function(d){return function(h){return h.pstyle("".concat(d,"-opacity")).value>0}},s=function(d){var h=d.pstyle("text-events").strValue==="yes";return h?dl.USE_BB:dl.IGNORE},u=function(d){var h=d.position(),g=h.x,p=h.y,x=d.outerWidth(),b=d.outerHeight();return{w:x,h:b,x1:g-x/2,y1:p-b/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:oV,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:uv(e.getLabelKey,null),getBoundingBox:lv(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:a(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:uv(e.getSourceLabelKey,"source"),getBoundingBox:lv(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:a("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:uv(e.getTargetLabelKey,"target"),getBoundingBox:lv(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:a("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=Ss(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(f,d){var h=!1;d&&d.length>0&&(h|=t.drawing.invalidate(d)),h&&l()}),RV(t)};function TV(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return NR(t)}function cP(r,e){var t=r._private.rscratch;return $t(t,"labelWrapCachedLines",e)||[]}var uv=function(e,t){return function(n){var a=e(n),i=cP(n,t);return i.length>1?i.map(function(o,s){return"".concat(a,"_").concat(s)}):a}},lv=function(e,t){return function(n,a){var i=e(n);if(typeof a=="string"){var o=a.indexOf("_");if(o>0){var s=Number(a.substring(o+1)),u=cP(n,t),l=i.h/u.length,f=l*s,d=i.y1+f;return{x1:i.x1,w:i.w,y1:d,h:l,yOffset:f}}}return i}};function RV(r){{var e=r.render;r.render=function(i){i=i||{};var o=r.cy;r.webgl&&(o.zoom()>nP?(AV(r),e.call(r,i)):(PV(r),vP(r,i,os.SCREEN)))}}{var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(i,o,s,u){return OV(r,i,o)};{var n=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){n.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var a=r.notify;r.notify=function(i,o){a.call(r,i,o),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(o,{type:"node-body"})}}}function AV(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function PV(r){var e=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,r.canvasWidth,r.canvasHeight),n.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}function IV(r){var e=r.canvasWidth,t=r.canvasHeight,n=g0(r),a=n.pan,i=n.zoom,o=iv();Yu(o,o,[a.x,a.y]),qm(o,o,[i,i]);var s=iv();gV(s,e,t);var u=iv();return hV(u,s,o),u}function dP(r,e){var t=r.canvasWidth,n=r.canvasHeight,a=g0(r),i=a.pan,o=a.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,n),e.translate(i.x,i.y),e.scale(o,o)}function DV(r,e){r.drawSelectionRectangle(e,function(t){return dP(r,t)})}function BV(r){var e=r.data.contexts[r.NODE];e.save(),dP(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function MV(r){var e=function(a,i,o){for(var s=a.atlasManager.getAtlasCollection(i),u=r.data.contexts[r.NODE],l=s.atlases,f=0;f<l.length;f++){var d=l[f],h=d.canvas;if(h){var g=h.width,p=h.height,x=g*f,b=h.height*o,w=.4;u.save(),u.scale(w,w),u.drawImage(h,x,b),u.strokeStyle="black",u.rect(x,b,g,p),u.stroke(),u.restore()}}},t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}function LV(r,e,t,n,a){var i,o,s,u,l=g0(r),f=l.pan,d=l.zoom;{var h=iV(r,f,d,e,t),g=Xr(h,2),p=g[0],x=g[1],b=6;i=p-b/2,o=x-b/2,s=b,u=b}if(s===0||u===0)return[];var w=r.data.contexts[r.WEBGL];w.bindFramebuffer(w.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(w.viewport(0,0,w.canvas.width,w.canvas.height),vP(r,null,os.PICKING),r.pickingFrameBuffer.needsDraw=!1);var y=s*u,E=new Uint8Array(y*4);w.readPixels(i,o,s,u,w.RGBA,w.UNSIGNED_BYTE,E),w.bindFramebuffer(w.FRAMEBUFFER,null);for(var C=new Set,S=0;S<y;S++){var R=E.slice(S*4,S*4+4),_=uV(R)-1;_>=0&&C.add(_)}return C}function OV(r,e,t){var n=LV(r,e,t),a=r.getCachedZSortedEles(),i,o,s=Gt(n),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,f=a[l];if(!i&&f.isNode()&&(i=f),!o&&f.isEdge()&&(o=f),i&&o)break}}catch(d){s.e(d)}finally{s.f()}return[i,o].filter(Boolean)}function fv(r,e,t){var n=r.drawing;e+=1,t.isNode()?(n.drawNode(t,e,"node-underlay"),n.drawNode(t,e,"node-body"),n.drawTexture(t,e,"label"),n.drawNode(t,e,"node-overlay")):(n.drawEdgeLine(t,e),n.drawEdgeArrow(t,e,"source"),n.drawEdgeArrow(t,e,"target"),n.drawTexture(t,e,"label"),n.drawTexture(t,e,"edge-source-label"),n.drawTexture(t,e,"edge-target-label"))}function vP(r,e,t){var n;r.webglDebug&&(n=performance.now());var a=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&DV(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var o=r.data.contexts[r.WEBGL];t.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=IV(r),u=r.getCachedZSortedEles();if(i=u.length,a.startFrame(s,t),t.screen){for(var l=0;l<u.nondrag.length;l++)fv(r,l,u.nondrag[l]);for(var f=0;f<u.drag.length;f++)fv(r,f,u.drag[f])}else if(t.picking)for(var d=0;d<u.length;d++)fv(r,d,u[d]);a.endFrame(),t.screen&&r.webglDebugShowAtlases&&(BV(r),MV(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var h=performance.now(),g=!1,p=Math.ceil(h-n),x=a.getDebugInfo(),b=["".concat(i," elements"),"".concat(x.totalInstances," instances"),"".concat(x.batchCount," batches"),"".concat(x.totalAtlases," atlases"),"".concat(x.wrappedCount," wrapped textures"),"".concat(x.simpleCount," simple shapes")].join(", ");if(g)console.log("WebGL (".concat(t.name,") - time ").concat(p,"ms, ").concat(b));else{console.log("WebGL (".concat(t.name,") - frame time ").concat(p,"ms")),console.log("Totals:"),console.log(" ".concat(b)),console.log("Texture Atlases Used:");var w=x.atlasInfo,y=Gt(w),E;try{for(y.s();!(E=y.n()).done;){var C=E.value;console.log(" ".concat(C.type,": ").concat(C.keyCount," keys, ").concat(C.atlasCount," atlases"))}}catch(S){y.e(S)}finally{y.f()}console.log("")}}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,a.gc())}var $a={};$a.drawPolygonPath=function(r,e,t,n,a,i){var o=n/2,s=a/2;r.beginPath&&r.beginPath(),r.moveTo(e+o*i[0],t+s*i[1]);for(var u=1;u<i.length/2;u++)r.lineTo(e+o*i[u*2],t+s*i[u*2+1]);r.closePath()};$a.drawRoundPolygonPath=function(r,e,t,n,a,i,o){o.forEach(function(s){return jA(r,s)}),r.closePath()};$a.drawRoundRectanglePath=function(r,e,t,n,a,i){var o=n/2,s=a/2,u=i==="auto"?Ma(n,a):Math.min(i,s,o);r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.arcTo(e+o,t-s,e+o,t,u),r.arcTo(e+o,t+s,e,t+s,u),r.arcTo(e-o,t+s,e-o,t,u),r.arcTo(e-o,t-s,e,t-s,u),r.lineTo(e,t-s),r.closePath()};$a.drawBottomRoundRectanglePath=function(r,e,t,n,a,i){var o=n/2,s=a/2,u=i==="auto"?Ma(n,a):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.lineTo(e+o,t-s),r.lineTo(e+o,t),r.arcTo(e+o,t+s,e,t+s,u),r.arcTo(e-o,t+s,e-o,t,u),r.lineTo(e-o,t-s),r.lineTo(e,t-s),r.closePath()};$a.drawCutRectanglePath=function(r,e,t,n,a,i,o){var s=n/2,u=a/2,l=o==="auto"?r0():o;r.beginPath&&r.beginPath(),r.moveTo(e-s+l,t-u),r.lineTo(e+s-l,t-u),r.lineTo(e+s,t-u+l),r.lineTo(e+s,t+u-l),r.lineTo(e+s-l,t+u),r.lineTo(e-s+l,t+u),r.lineTo(e-s,t+u-l),r.lineTo(e-s,t-u+l),r.closePath()};$a.drawBarrelPath=function(r,e,t,n,a){var i=n/2,o=a/2,s=e-i,u=e+i,l=t-o,f=t+o,d=Cm(n,a),h=d.widthOffset,g=d.heightOffset,p=d.ctrlPtOffsetPct*h;r.beginPath&&r.beginPath(),r.moveTo(s,l+g),r.lineTo(s,f-g),r.quadraticCurveTo(s+p,f,s+h,f),r.lineTo(u-h,f),r.quadraticCurveTo(u-p,f,u,f-g),r.lineTo(u,l+g),r.quadraticCurveTo(u-p,l,u-h,l),r.lineTo(s+h,l),r.quadraticCurveTo(s+p,l,s,l+g),r.closePath()};var KE=Math.sin(0),jE=Math.cos(0),Nm={},Fm={},hP=Math.PI/40;for(var Xi=0*Math.PI;Xi<2*Math.PI;Xi+=hP)Nm[Xi]=Math.sin(Xi),Fm[Xi]=Math.cos(Xi);$a.drawEllipsePath=function(r,e,t,n,a){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,n/2,a/2,0,0,2*Math.PI);else for(var i,o,s=n/2,u=a/2,l=0*Math.PI;l<2*Math.PI;l+=hP)i=e-s*Nm[l]*KE+s*Fm[l]*jE,o=t+u*Fm[l]*KE+u*Nm[l]*jE,l===0?r.moveTo(i,o):r.lineTo(i,o);r.closePath()};var Ds={};Ds.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]};Ds.bufferCanvasImage=function(r){var e=this.cy,t=e.mutableElements(),n=t.boundingBox(),a=this.findContainerClientCoords(),i=r.full?Math.ceil(n.w):a[2],o=r.full?Math.ceil(n.h):a[3],s=qe(r.maxWidth)||qe(r.maxHeight),u=this.getPixelRatio(),l=1;if(r.scale!==void 0)i*=r.scale,o*=r.scale,l=r.scale;else if(s){var f=1/0,d=1/0;qe(r.maxWidth)&&(f=l*r.maxWidth/i),qe(r.maxHeight)&&(d=l*r.maxHeight/o),l=Math.min(f,d),i*=l,o*=l}s||(i*=u,o*=u,l*=u);var h=document.createElement("canvas");h.width=i,h.height=o,h.style.width=i+"px",h.style.height=o+"px";var g=h.getContext("2d");if(i>0&&o>0){g.clearRect(0,0,i,o),g.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(r.full)g.translate(-n.x1*l,-n.y1*l),g.scale(l,l),this.drawElements(g,p),g.scale(1/l,1/l),g.translate(n.x1*l,n.y1*l);else{var x=e.pan(),b={x:x.x*l,y:x.y*l};l*=e.zoom(),g.translate(b.x,b.y),g.scale(l,l),this.drawElements(g,p),g.scale(1/l,1/l),g.translate(-b.x,-b.y)}r.bg&&(g.globalCompositeOperation="destination-over",g.fillStyle=r.bg,g.rect(0,0,i,o),g.fill())}return h};function kV(r,e){for(var t=atob(r),n=new ArrayBuffer(t.length),a=new Uint8Array(n),i=0;i<t.length;i++)a[i]=t.charCodeAt(i);return new Blob([n],{type:e})}function YE(r){var e=r.indexOf(",");return r.substr(e+1)}function gP(r,e,t){var n=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new po(function(a,i){try{e.toBlob(function(o){o!=null?a(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(o){i(o)}});case"blob":return kV(YE(n()),t);case"base64":return YE(n());case"base64uri":default:return n()}}Ds.png=function(r){return gP(r,this.bufferCanvasImage(r),"image/png")};Ds.jpg=function(r){return gP(r,this.bufferCanvasImage(r),"image/jpeg")};var pP={};pP.nodeShapeImpl=function(r,e,t,n,a,i,o,s){switch(r){case"ellipse":return this.drawEllipsePath(e,t,n,a,i);case"polygon":return this.drawPolygonPath(e,t,n,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,t,n,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,n,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,n,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,n,a,i,s);case"barrel":return this.drawBarrelPath(e,t,n,a,i)}};var qV=yP,cr=yP.prototype;cr.CANVAS_LAYERS=3;cr.SELECT_BOX=0;cr.DRAG=1;cr.NODE=2;cr.WEBGL=3;cr.CANVAS_TYPES=["2d","2d","2d","webgl2"];cr.BUFFER_COUNT=3;cr.TEXTURE_BUFFER=0;cr.MOTIONBLUR_BUFFER_NODE=1;cr.MOTIONBLUR_BUFFER_DRAG=2;function yP(r){var e=this,t=e.cy.window(),n=t.document;r.webgl&&(cr.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(cr.CANVAS_LAYERS),contexts:new Array(cr.CANVAS_LAYERS),canvasNeedsRedraw:new Array(cr.CANVAS_LAYERS),bufferCanvases:new Array(cr.BUFFER_COUNT),bufferContexts:new Array(cr.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=r.cy.container();s.appendChild(e.data.canvasContainer),s.style[a]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};DN()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<cr.CANVAS_LAYERS;l++){var f=e.data.canvases[l]=n.createElement("canvas"),d=cr.CANVAS_TYPES[l];e.data.contexts[l]=f.getContext(d),e.data.contexts[l]||kr("Could not create canvas of type "+d),Object.keys(u).forEach(function(oe){f.style[oe]=u[oe]}),f.style.position="absolute",f.setAttribute("data-id","layer"+l),f.style.zIndex=String(cr.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(f),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[cr.NODE].setAttribute("data-id","layer"+cr.NODE+"-node"),e.data.canvases[cr.SELECT_BOX].setAttribute("data-id","layer"+cr.SELECT_BOX+"-selectbox"),e.data.canvases[cr.DRAG].setAttribute("data-id","layer"+cr.DRAG+"-drag"),e.data.canvases[cr.WEBGL]&&e.data.canvases[cr.WEBGL].setAttribute("data-id","layer"+cr.WEBGL+"-webgl");for(var l=0;l<cr.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=n.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var h=Lt(),g=function(Z){return{x:(Z.x1+Z.x2)/2,y:(Z.y1+Z.y2)/2}},p=function(Z){return{x:-Z.w/2,y:-Z.h/2}},x=function(Z){var Q=Z[0]._private,ie=Q.oldBackgroundTimestamp===Q.backgroundTimestamp;return!ie},b=function(Z){return Z[0]._private.nodeKey},w=function(Z){return Z[0]._private.labelStyleKey},y=function(Z){return Z[0]._private.sourceLabelStyleKey},E=function(Z){return Z[0]._private.targetLabelStyleKey},C=function(Z,Q,ie,de,we){return e.drawElement(Z,Q,ie,!1,!1,we)},S=function(Z,Q,ie,de,we){return e.drawElementText(Z,Q,ie,de,"main",we)},R=function(Z,Q,ie,de,we){return e.drawElementText(Z,Q,ie,de,"source",we)},_=function(Z,Q,ie,de,we){return e.drawElementText(Z,Q,ie,de,"target",we)},A=function(Z){return Z.boundingBox(),Z[0]._private.bodyBounds},P=function(Z){return Z.boundingBox(),Z[0]._private.labelBounds.main||h},I=function(Z){return Z.boundingBox(),Z[0]._private.labelBounds.source||h},D=function(Z){return Z.boundingBox(),Z[0]._private.labelBounds.target||h},L=function(Z,Q){return Q},M=function(Z){return g(A(Z))},q=function(Z,Q,ie){var de=Z?Z+"-":"";return{x:Q.x+ie.pstyle(de+"text-margin-x").pfValue,y:Q.y+ie.pstyle(de+"text-margin-y").pfValue}},N=function(Z,Q,ie){var de=Z[0]._private.rscratch;return{x:de[Q],y:de[ie]}},W=function(Z){return q("",N(Z,"labelX","labelY"),Z)},V=function(Z){return q("source",N(Z,"sourceLabelX","sourceLabelY"),Z)},$=function(Z){return q("target",N(Z,"targetLabelX","targetLabelY"),Z)},X=function(Z){return p(A(Z))},ee=function(Z){return p(I(Z))},K=function(Z){return p(D(Z))},j=function(Z){var Q=P(Z),ie=p(P(Z));if(Z.isNode()){switch(Z.pstyle("text-halign").value){case"left":ie.x=-Q.w-(Q.leftPad||0);break;case"right":ie.x=-(Q.rightPad||0);break}switch(Z.pstyle("text-valign").value){case"top":ie.y=-Q.h-(Q.topPad||0);break;case"bottom":ie.y=-(Q.botPad||0);break}}return ie},fe=e.data.eleTxrCache=new Zo(e,{getKey:b,doesEleInvalidateKey:x,drawElement:C,getBoundingBox:A,getRotationPoint:M,getRotationOffset:X,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),G=e.data.lblTxrCache=new Zo(e,{getKey:w,drawElement:S,getBoundingBox:P,getRotationPoint:W,getRotationOffset:j,isVisible:L}),z=e.data.slbTxrCache=new Zo(e,{getKey:y,drawElement:R,getBoundingBox:I,getRotationPoint:V,getRotationOffset:ee,isVisible:L}),Y=e.data.tlbTxrCache=new Zo(e,{getKey:E,drawElement:_,getBoundingBox:D,getRotationPoint:$,getRotationOffset:K,isVisible:L}),te=e.data.lyrTxrCache=new aP(e);e.onUpdateEleCalcs(function(Z,Q){fe.invalidateElements(Q),G.invalidateElements(Q),z.invalidateElements(Q),Y.invalidateElements(Q),te.invalidateElements(Q);for(var ie=0;ie<Q.length;ie++){var de=Q[ie]._private;de.oldBackgroundTimestamp=de.backgroundTimestamp}});var ue=function(Z){for(var Q=0;Q<Z.length;Q++)te.enqueueElementRefinement(Z[Q].ele)};fe.onDequeue(ue),G.onDequeue(ue),z.onDequeue(ue),Y.onDequeue(ue),r.webgl&&e.initWebgl(r,{getStyleKey:b,getLabelKey:w,getSourceLabelKey:y,getTargetLabelKey:E,drawElement:C,drawLabel:S,drawSourceLabel:R,drawTargetLabel:_,getElementBox:A,getLabelBox:P,getSourceLabelBox:I,getTargetLabelBox:D,getElementRotationPoint:M,getElementRotationOffset:X,getLabelRotationPoint:W,getSourceLabelRotationPoint:V,getTargetLabelRotationPoint:$,getLabelRotationOffset:j,getSourceLabelRotationOffset:ee,getTargetLabelRotationOffset:K})}cr.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[cr.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[cr.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[cr.SELECT_BOX]=e;break;case"gc":t.data.gc=!0;break}};var NV=typeof Path2D<"u";cr.path2dEnabled=function(r){if(r===void 0)return this.pathsEnabled;this.pathsEnabled=!!r};cr.usePaths=function(){return NV&&this.pathsEnabled};cr.setImgSmoothing=function(r,e){r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)};cr.getImgSmoothing=function(r){return r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled};cr.makeOffscreenCanvas=function(r,e){var t;if((typeof OffscreenCanvas>"u"?"undefined":at(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var n=this.cy.window(),a=n.document;t=a.createElement("canvas"),t.width=r,t.height=e}return t};[iP,Vn,ia,h0,bi,za,Ot,fP,$a,Ds,pP].forEach(function(r){Ze(cr,r)});var FV=[{name:"null",impl:UA},{name:"base",impl:rP},{name:"canvas",impl:qV}],zV=[{type:"layout",extensions:c3},{type:"renderer",extensions:FV}],mP={},bP={};function wP(r,e,t){var n=t,a=function(A){Cr("Can not register `"+e+"` for `"+r+"` since `"+A+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(ys.prototype[e])return a(e);ys.prototype[e]=t}else if(r==="collection"){if(bt.prototype[e])return a(e);bt.prototype[e]=t}else if(r==="layout"){for(var i=function(A){this.options=A,t.call(this,A),yr(this._private)||(this._private={}),this._private.cy=A.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(t.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var f=t.prototype.stop;o.stop=function(){var _=this.options;if(_&&_.animate){var A=this.animations;if(A)for(var P=0;P<A.length;P++)A[P].stop()}return f?f.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var d=function(A){return A._private.cy},h={addEventFields:function(A,P){P.layout=A,P.cy=d(A),P.target=A},bubble:function(){return!0},parent:function(A){return d(A)}};Ze(o,{createEmitter:function(){return this._private.emitter=new Pl(h,this),this},emitter:function(){return this._private.emitter},on:function(A,P){return this.emitter().on(A,P),this},one:function(A,P){return this.emitter().one(A,P),this},once:function(A,P){return this.emitter().one(A,P),this},removeListener:function(A,P){return this.emitter().removeListener(A,P),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(A,P){return this.emitter().emit(A,P),this}}),Er.eventAliasesOn(o),n=i}else if(r==="renderer"&&e!=="null"&&e!=="base"){var g=xP("renderer","base"),p=g.prototype,x=t,b=t.prototype,w=function(){g.apply(this,arguments),x.apply(this,arguments)},y=w.prototype;for(var E in p){var C=p[E],S=b[E]!=null;if(S)return a(E);y[E]=C}for(var R in b)y[R]=b[R];p.clientFunctions.forEach(function(_){y[_]=y[_]||function(){kr("Renderer does not implement `renderer."+_+"()` on its prototype")}}),n=w}else if(r==="__proto__"||r==="constructor"||r==="prototype")return kr(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return FR({map:mP,keys:[r,e],value:n})}function xP(r,e){return zR({map:mP,keys:[r,e]})}function $V(r,e,t,n,a){return FR({map:bP,keys:[r,e,t,n],value:a})}function VV(r,e,t,n){return zR({map:bP,keys:[r,e,t,n]})}var zm=function(){if(arguments.length===2)return xP.apply(null,arguments);if(arguments.length===3)return wP.apply(null,arguments);if(arguments.length===4)return VV.apply(null,arguments);if(arguments.length===5)return $V.apply(null,arguments);kr("Invalid extension access syntax")};ys.prototype.extension=zm;zV.forEach(function(r){r.extensions.forEach(function(e){wP(r.type,e.name,e.impl)})});var vl=function(){if(!(this instanceof vl))return new vl;this.length=0},gi=vl.prototype;gi.instanceString=function(){return"stylesheet"};gi.selector=function(r){var e=this.length++;return this[e]={selector:r,properties:[]},this};gi.css=function(r,e){var t=this.length-1;if(Ye(r))this[t].properties.push({name:r,value:e});else if(yr(r))for(var n=r,a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],s=n[o];if(s!=null){var u=lt.properties[o]||lt.properties[bl(o)];if(u!=null){var l=u.name,f=s;this[t].properties.push({name:l,value:f})}}}return this};gi.style=gi.css;gi.generateStyle=function(r){var e=new lt(r);return this.appendToStyle(e)};gi.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],n=t.selector,a=t.properties;r.selector(n);for(var i=0;i<a.length;i++){var o=a[i];r.css(o.name,o.value)}}return r};var GV="3.33.1",vn=function(e){if(e===void 0&&(e={}),yr(e))return new ys(e);if(Ye(e))return zm.apply(zm,arguments)};vn.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(vn),r.apply(null,e),this};vn.warnings=function(r){return KR(r)};vn.version=GV;vn.stylesheet=vn.Stylesheet=vl;var Xu={exports:{}};function p0(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var cv,XE;function WV(){if(XE)return cv;XE=1;function r(){this.__data__=[],this.size=0}return cv=r,cv}var dv,ZE;function xo(){if(ZE)return dv;ZE=1;function r(e,t){return e===t||e!==e&&t!==t}return dv=r,dv}var vv,QE;function ql(){if(QE)return vv;QE=1;var r=xo();function e(t,n){for(var a=t.length;a--;)if(r(t[a][0],n))return a;return-1}return vv=e,vv}var hv,JE;function UV(){if(JE)return hv;JE=1;var r=ql(),e=Array.prototype,t=e.splice;function n(a){var i=this.__data__,o=r(i,a);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():t.call(i,o,1),--this.size,!0}return hv=n,hv}var gv,eC;function HV(){if(eC)return gv;eC=1;var r=ql();function e(t){var n=this.__data__,a=r(n,t);return a<0?void 0:n[a][1]}return gv=e,gv}var pv,rC;function KV(){if(rC)return pv;rC=1;var r=ql();function e(t){return r(this.__data__,t)>-1}return pv=e,pv}var yv,tC;function jV(){if(tC)return yv;tC=1;var r=ql();function e(t,n){var a=this.__data__,i=r(a,t);return i<0?(++this.size,a.push([t,n])):a[i][1]=n,this}return yv=e,yv}var mv,nC;function Nl(){if(nC)return mv;nC=1;var r=WV(),e=UV(),t=HV(),n=KV(),a=jV();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,mv=i,mv}var bv,aC;function YV(){if(aC)return bv;aC=1;var r=Nl();function e(){this.__data__=new r,this.size=0}return bv=e,bv}var wv,iC;function XV(){if(iC)return wv;iC=1;function r(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}return wv=r,wv}var xv,oC;function ZV(){if(oC)return xv;oC=1;function r(e){return this.__data__.get(e)}return xv=r,xv}var Ev,sC;function QV(){if(sC)return Ev;sC=1;function r(e){return this.__data__.has(e)}return Ev=r,Ev}var Cv,uC;function Bs(){if(uC)return Cv;uC=1;var r=yi(),e=rn(),t="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=r(s);return u==n||u==a||u==t||u==i}return Cv=o,Cv}var _v,lC;function JV(){if(lC)return _v;lC=1;var r=An(),e=r["__core-js_shared__"];return _v=e,_v}var Sv,fC;function e4(){if(fC)return Sv;fC=1;var r=JV(),e=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function t(n){return!!e&&e in n}return Sv=t,Sv}var Tv,cC;function EP(){if(cC)return Tv;cC=1;var r=Function.prototype,e=r.toString;function t(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Tv=t,Tv}var Rv,dC;function r4(){if(dC)return Rv;dC=1;var r=Bs(),e=e4(),t=rn(),n=EP(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,f=RegExp("^"+u.call(l).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(h){if(!t(h)||e(h))return!1;var g=r(h)?f:i;return g.test(n(h))}return Rv=d,Rv}var Av,vC;function t4(){if(vC)return Av;vC=1;function r(e,t){return e==null?void 0:e[t]}return Av=r,Av}var Pv,hC;function wi(){if(hC)return Pv;hC=1;var r=r4(),e=t4();function t(n,a){var i=e(n,a);return r(i)?i:void 0}return Pv=t,Pv}var Iv,gC;function y0(){if(gC)return Iv;gC=1;var r=wi(),e=An(),t=r(e,"Map");return Iv=t,Iv}var Dv,pC;function Fl(){if(pC)return Dv;pC=1;var r=wi(),e=r(Object,"create");return Dv=e,Dv}var Bv,yC;function n4(){if(yC)return Bv;yC=1;var r=Fl();function e(){this.__data__=r?r(null):{},this.size=0}return Bv=e,Bv}var Mv,mC;function a4(){if(mC)return Mv;mC=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return Mv=r,Mv}var Lv,bC;function i4(){if(bC)return Lv;bC=1;var r=Fl(),e="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function a(i){var o=this.__data__;if(r){var s=o[i];return s===e?void 0:s}return n.call(o,i)?o[i]:void 0}return Lv=a,Lv}var Ov,wC;function o4(){if(wC)return Ov;wC=1;var r=Fl(),e=Object.prototype,t=e.hasOwnProperty;function n(a){var i=this.__data__;return r?i[a]!==void 0:t.call(i,a)}return Ov=n,Ov}var kv,xC;function s4(){if(xC)return kv;xC=1;var r=Fl(),e="__lodash_hash_undefined__";function t(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=r&&a===void 0?e:a,this}return kv=t,kv}var qv,EC;function u4(){if(EC)return qv;EC=1;var r=n4(),e=a4(),t=i4(),n=o4(),a=s4();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,qv=i,qv}var Nv,CC;function l4(){if(CC)return Nv;CC=1;var r=u4(),e=Nl(),t=y0();function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return Nv=n,Nv}var Fv,_C;function f4(){if(_C)return Fv;_C=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return Fv=r,Fv}var zv,SC;function zl(){if(SC)return zv;SC=1;var r=f4();function e(t,n){var a=t.__data__;return r(n)?a[typeof n=="string"?"string":"hash"]:a.map}return zv=e,zv}var $v,TC;function c4(){if(TC)return $v;TC=1;var r=zl();function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}return $v=e,$v}var Vv,RC;function d4(){if(RC)return Vv;RC=1;var r=zl();function e(t){return r(this,t).get(t)}return Vv=e,Vv}var Gv,AC;function v4(){if(AC)return Gv;AC=1;var r=zl();function e(t){return r(this,t).has(t)}return Gv=e,Gv}var Wv,PC;function h4(){if(PC)return Wv;PC=1;var r=zl();function e(t,n){var a=r(this,t),i=a.size;return a.set(t,n),this.size+=a.size==i?0:1,this}return Wv=e,Wv}var Uv,IC;function m0(){if(IC)return Uv;IC=1;var r=l4(),e=c4(),t=d4(),n=v4(),a=h4();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Uv=i,Uv}var Hv,DC;function g4(){if(DC)return Hv;DC=1;var r=Nl(),e=y0(),t=m0(),n=200;function a(i,o){var s=this.__data__;if(s instanceof r){var u=s.__data__;if(!e||u.length<n-1)return u.push([i,o]),this.size=++s.size,this;s=this.__data__=new t(u)}return s.set(i,o),this.size=s.size,this}return Hv=a,Hv}var Kv,BC;function $l(){if(BC)return Kv;BC=1;var r=Nl(),e=YV(),t=XV(),n=ZV(),a=QV(),i=g4();function o(s){var u=this.__data__=new r(s);this.size=u.size}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,Kv=o,Kv}var jv,MC;function b0(){if(MC)return jv;MC=1;function r(e,t){for(var n=-1,a=e==null?0:e.length;++n<a&&t(e[n],n,e)!==!1;);return e}return jv=r,jv}var Yv,LC;function CP(){if(LC)return Yv;LC=1;var r=wi(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}})();return Yv=e,Yv}var Xv,OC;function Vl(){if(OC)return Xv;OC=1;var r=CP();function e(t,n,a){n=="__proto__"&&r?r(t,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):t[n]=a}return Xv=e,Xv}var Zv,kC;function Gl(){if(kC)return Zv;kC=1;var r=Vl(),e=xo(),t=Object.prototype,n=t.hasOwnProperty;function a(i,o,s){var u=i[o];(!(n.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&r(i,o,s)}return Zv=a,Zv}var Qv,qC;function Ms(){if(qC)return Qv;qC=1;var r=Gl(),e=Vl();function t(n,a,i,o){var s=!i;i||(i={});for(var u=-1,l=a.length;++u<l;){var f=a[u],d=o?o(i[f],n[f],f,i,n):void 0;d===void 0&&(d=n[f]),s?e(i,f,d):r(i,f,d)}return i}return Qv=t,Qv}var Jv,NC;function p4(){if(NC)return Jv;NC=1;function r(e,t){for(var n=-1,a=Array(e);++n<e;)a[n]=t(n);return a}return Jv=r,Jv}var eh,FC;function y4(){if(FC)return eh;FC=1;var r=yi(),e=zn(),t="[object Arguments]";function n(a){return e(a)&&r(a)==t}return eh=n,eh}var rh,zC;function Ls(){if(zC)return rh;zC=1;var r=y4(),e=zn(),t=Object.prototype,n=t.hasOwnProperty,a=t.propertyIsEnumerable,i=r((function(){return arguments})())?r:function(o){return e(o)&&n.call(o,"callee")&&!a.call(o,"callee")};return rh=i,rh}var th,$C;function Zr(){if($C)return th;$C=1;var r=Array.isArray;return th=r,th}var Qo={exports:{}},nh,VC;function m4(){if(VC)return nh;VC=1;function r(){return!1}return nh=r,nh}Qo.exports;var GC;function Eo(){return GC||(GC=1,(function(r,e){var t=An(),n=m4(),a=e&&!e.nodeType&&e,i=a&&!0&&r&&!r.nodeType&&r,o=i&&i.exports===a,s=o?t.Buffer:void 0,u=s?s.isBuffer:void 0,l=u||n;r.exports=l})(Qo,Qo.exports)),Qo.exports}var ah,WC;function Wl(){if(WC)return ah;WC=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(n,a){var i=typeof n;return a=a??r,!!a&&(i=="number"||i!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<a}return ah=t,ah}var ih,UC;function w0(){if(UC)return ih;UC=1;var r=9007199254740991;function e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=r}return ih=e,ih}var oh,HC;function b4(){if(HC)return oh;HC=1;var r=yi(),e=w0(),t=zn(),n="[object Arguments]",a="[object Array]",i="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",l="[object Map]",f="[object Number]",d="[object Object]",h="[object RegExp]",g="[object Set]",p="[object String]",x="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",y="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",S="[object Int16Array]",R="[object Int32Array]",_="[object Uint8Array]",A="[object Uint8ClampedArray]",P="[object Uint16Array]",I="[object Uint32Array]",D={};D[y]=D[E]=D[C]=D[S]=D[R]=D[_]=D[A]=D[P]=D[I]=!0,D[n]=D[a]=D[b]=D[i]=D[w]=D[o]=D[s]=D[u]=D[l]=D[f]=D[d]=D[h]=D[g]=D[p]=D[x]=!1;function L(M){return t(M)&&e(M.length)&&!!D[r(M)]}return oh=L,oh}var sh,KC;function Ul(){if(KC)return sh;KC=1;function r(e){return function(t){return e(t)}}return sh=r,sh}var Jo={exports:{}};Jo.exports;var jC;function x0(){return jC||(jC=1,(function(r,e){var t=AR(),n=e&&!e.nodeType&&e,a=n&&!0&&r&&!r.nodeType&&r,i=a&&a.exports===n,o=i&&t.process,s=(function(){try{var u=a&&a.require&&a.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();r.exports=s})(Jo,Jo.exports)),Jo.exports}var uh,YC;function Os(){if(YC)return uh;YC=1;var r=b4(),e=Ul(),t=x0(),n=t&&t.isTypedArray,a=n?e(n):r;return uh=a,uh}var lh,XC;function _P(){if(XC)return lh;XC=1;var r=p4(),e=Ls(),t=Zr(),n=Eo(),a=Wl(),i=Os(),o=Object.prototype,s=o.hasOwnProperty;function u(l,f){var d=t(l),h=!d&&e(l),g=!d&&!h&&n(l),p=!d&&!h&&!g&&i(l),x=d||h||g||p,b=x?r(l.length,String):[],w=b.length;for(var y in l)(f||s.call(l,y))&&!(x&&(y=="length"||g&&(y=="offset"||y=="parent")||p&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||a(y,w)))&&b.push(y);return b}return lh=u,lh}var fh,ZC;function Hl(){if(ZC)return fh;ZC=1;var r=Object.prototype;function e(t){var n=t&&t.constructor,a=typeof n=="function"&&n.prototype||r;return t===a}return fh=e,fh}var ch,QC;function SP(){if(QC)return ch;QC=1;function r(e,t){return function(n){return e(t(n))}}return ch=r,ch}var dh,JC;function w4(){if(JC)return dh;JC=1;var r=SP(),e=r(Object.keys,Object);return dh=e,dh}var vh,e_;function E0(){if(e_)return vh;e_=1;var r=Hl(),e=w4(),t=Object.prototype,n=t.hasOwnProperty;function a(i){if(!r(i))return e(i);var o=[];for(var s in Object(i))n.call(i,s)&&s!="constructor"&&o.push(s);return o}return vh=a,vh}var hh,r_;function oa(){if(r_)return hh;r_=1;var r=Bs(),e=w0();function t(n){return n!=null&&e(n.length)&&!r(n)}return hh=t,hh}var gh,t_;function Va(){if(t_)return gh;t_=1;var r=_P(),e=E0(),t=oa();function n(a){return t(a)?r(a):e(a)}return gh=n,gh}var ph,n_;function x4(){if(n_)return ph;n_=1;var r=Ms(),e=Va();function t(n,a){return n&&r(a,e(a),n)}return ph=t,ph}var yh,a_;function E4(){if(a_)return yh;a_=1;function r(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}return yh=r,yh}var mh,i_;function C4(){if(i_)return mh;i_=1;var r=rn(),e=Hl(),t=E4(),n=Object.prototype,a=n.hasOwnProperty;function i(o){if(!r(o))return t(o);var s=e(o),u=[];for(var l in o)l=="constructor"&&(s||!a.call(o,l))||u.push(l);return u}return mh=i,mh}var bh,o_;function xi(){if(o_)return bh;o_=1;var r=_P(),e=C4(),t=oa();function n(a){return t(a)?r(a,!0):e(a)}return bh=n,bh}var wh,s_;function _4(){if(s_)return wh;s_=1;var r=Ms(),e=xi();function t(n,a){return n&&r(a,e(a),n)}return wh=t,wh}var es={exports:{}};es.exports;var u_;function TP(){return u_||(u_=1,(function(r,e){var t=An(),n=e&&!e.nodeType&&e,a=n&&!0&&r&&!r.nodeType&&r,i=a&&a.exports===n,o=i?t.Buffer:void 0,s=o?o.allocUnsafe:void 0;function u(l,f){if(f)return l.slice();var d=l.length,h=s?s(d):new l.constructor(d);return l.copy(h),h}r.exports=u})(es,es.exports)),es.exports}var xh,l_;function RP(){if(l_)return xh;l_=1;function r(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}return xh=r,xh}var Eh,f_;function AP(){if(f_)return Eh;f_=1;function r(e,t){for(var n=-1,a=e==null?0:e.length,i=0,o=[];++n<a;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}return Eh=r,Eh}var Ch,c_;function PP(){if(c_)return Ch;c_=1;function r(){return[]}return Ch=r,Ch}var _h,d_;function C0(){if(d_)return _h;d_=1;var r=AP(),e=PP(),t=Object.prototype,n=t.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(o){return o==null?[]:(o=Object(o),r(a(o),function(s){return n.call(o,s)}))}:e;return _h=i,_h}var Sh,v_;function S4(){if(v_)return Sh;v_=1;var r=Ms(),e=C0();function t(n,a){return r(n,e(n),a)}return Sh=t,Sh}var Th,h_;function _0(){if(h_)return Th;h_=1;function r(e,t){for(var n=-1,a=t.length,i=e.length;++n<a;)e[i+n]=t[n];return e}return Th=r,Th}var Rh,g_;function Kl(){if(g_)return Rh;g_=1;var r=SP(),e=r(Object.getPrototypeOf,Object);return Rh=e,Rh}var Ah,p_;function IP(){if(p_)return Ah;p_=1;var r=_0(),e=Kl(),t=C0(),n=PP(),a=Object.getOwnPropertySymbols,i=a?function(o){for(var s=[];o;)r(s,t(o)),o=e(o);return s}:n;return Ah=i,Ah}var Ph,y_;function T4(){if(y_)return Ph;y_=1;var r=Ms(),e=IP();function t(n,a){return r(n,e(n),a)}return Ph=t,Ph}var Ih,m_;function DP(){if(m_)return Ih;m_=1;var r=_0(),e=Zr();function t(n,a,i){var o=a(n);return e(n)?o:r(o,i(n))}return Ih=t,Ih}var Dh,b_;function BP(){if(b_)return Dh;b_=1;var r=DP(),e=C0(),t=Va();function n(a){return r(a,t,e)}return Dh=n,Dh}var Bh,w_;function R4(){if(w_)return Bh;w_=1;var r=DP(),e=IP(),t=xi();function n(a){return r(a,t,e)}return Bh=n,Bh}var Mh,x_;function A4(){if(x_)return Mh;x_=1;var r=wi(),e=An(),t=r(e,"DataView");return Mh=t,Mh}var Lh,E_;function P4(){if(E_)return Lh;E_=1;var r=wi(),e=An(),t=r(e,"Promise");return Lh=t,Lh}var Oh,C_;function MP(){if(C_)return Oh;C_=1;var r=wi(),e=An(),t=r(e,"Set");return Oh=t,Oh}var kh,__;function I4(){if(__)return kh;__=1;var r=wi(),e=An(),t=r(e,"WeakMap");return kh=t,kh}var qh,S_;function Co(){if(S_)return qh;S_=1;var r=A4(),e=y0(),t=P4(),n=MP(),a=I4(),i=yi(),o=EP(),s="[object Map]",u="[object Object]",l="[object Promise]",f="[object Set]",d="[object WeakMap]",h="[object DataView]",g=o(r),p=o(e),x=o(t),b=o(n),w=o(a),y=i;return(r&&y(new r(new ArrayBuffer(1)))!=h||e&&y(new e)!=s||t&&y(t.resolve())!=l||n&&y(new n)!=f||a&&y(new a)!=d)&&(y=function(E){var C=i(E),S=C==u?E.constructor:void 0,R=S?o(S):"";if(R)switch(R){case g:return h;case p:return s;case x:return l;case b:return f;case w:return d}return C}),qh=y,qh}var Nh,T_;function D4(){if(T_)return Nh;T_=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n){var a=n.length,i=new n.constructor(a);return a&&typeof n[0]=="string"&&e.call(n,"index")&&(i.index=n.index,i.input=n.input),i}return Nh=t,Nh}var Fh,R_;function LP(){if(R_)return Fh;R_=1;var r=An(),e=r.Uint8Array;return Fh=e,Fh}var zh,A_;function S0(){if(A_)return zh;A_=1;var r=LP();function e(t){var n=new t.constructor(t.byteLength);return new r(n).set(new r(t)),n}return zh=e,zh}var $h,P_;function B4(){if(P_)return $h;P_=1;var r=S0();function e(t,n){var a=n?r(t.buffer):t.buffer;return new t.constructor(a,t.byteOffset,t.byteLength)}return $h=e,$h}var Vh,I_;function M4(){if(I_)return Vh;I_=1;var r=/\w*$/;function e(t){var n=new t.constructor(t.source,r.exec(t));return n.lastIndex=t.lastIndex,n}return Vh=e,Vh}var Gh,D_;function L4(){if(D_)return Gh;D_=1;var r=vo(),e=r?r.prototype:void 0,t=e?e.valueOf:void 0;function n(a){return t?Object(t.call(a)):{}}return Gh=n,Gh}var Wh,B_;function OP(){if(B_)return Wh;B_=1;var r=S0();function e(t,n){var a=n?r(t.buffer):t.buffer;return new t.constructor(a,t.byteOffset,t.length)}return Wh=e,Wh}var Uh,M_;function O4(){if(M_)return Uh;M_=1;var r=S0(),e=B4(),t=M4(),n=L4(),a=OP(),i="[object Boolean]",o="[object Date]",s="[object Map]",u="[object Number]",l="[object RegExp]",f="[object Set]",d="[object String]",h="[object Symbol]",g="[object ArrayBuffer]",p="[object DataView]",x="[object Float32Array]",b="[object Float64Array]",w="[object Int8Array]",y="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",S="[object Uint8ClampedArray]",R="[object Uint16Array]",_="[object Uint32Array]";function A(P,I,D){var L=P.constructor;switch(I){case g:return r(P);case i:case o:return new L(+P);case p:return e(P,D);case x:case b:case w:case y:case E:case C:case S:case R:case _:return a(P,D);case s:return new L;case u:case d:return new L(P);case l:return t(P);case f:return new L;case h:return n(P)}}return Uh=A,Uh}var Hh,L_;function kP(){if(L_)return Hh;L_=1;var r=rn(),e=Object.create,t=(function(){function n(){}return function(a){if(!r(a))return{};if(e)return e(a);n.prototype=a;var i=new n;return n.prototype=void 0,i}})();return Hh=t,Hh}var Kh,O_;function qP(){if(O_)return Kh;O_=1;var r=kP(),e=Kl(),t=Hl();function n(a){return typeof a.constructor=="function"&&!t(a)?r(e(a)):{}}return Kh=n,Kh}var jh,k_;function k4(){if(k_)return jh;k_=1;var r=Co(),e=zn(),t="[object Map]";function n(a){return e(a)&&r(a)==t}return jh=n,jh}var Yh,q_;function q4(){if(q_)return Yh;q_=1;var r=k4(),e=Ul(),t=x0(),n=t&&t.isMap,a=n?e(n):r;return Yh=a,Yh}var Xh,N_;function N4(){if(N_)return Xh;N_=1;var r=Co(),e=zn(),t="[object Set]";function n(a){return e(a)&&r(a)==t}return Xh=n,Xh}var Zh,F_;function F4(){if(F_)return Zh;F_=1;var r=N4(),e=Ul(),t=x0(),n=t&&t.isSet,a=n?e(n):r;return Zh=a,Zh}var Qh,z_;function NP(){if(z_)return Qh;z_=1;var r=$l(),e=b0(),t=Gl(),n=x4(),a=_4(),i=TP(),o=RP(),s=S4(),u=T4(),l=BP(),f=R4(),d=Co(),h=D4(),g=O4(),p=qP(),x=Zr(),b=Eo(),w=q4(),y=rn(),E=F4(),C=Va(),S=xi(),R=1,_=2,A=4,P="[object Arguments]",I="[object Array]",D="[object Boolean]",L="[object Date]",M="[object Error]",q="[object Function]",N="[object GeneratorFunction]",W="[object Map]",V="[object Number]",$="[object Object]",X="[object RegExp]",ee="[object Set]",K="[object String]",j="[object Symbol]",fe="[object WeakMap]",G="[object ArrayBuffer]",z="[object DataView]",Y="[object Float32Array]",te="[object Float64Array]",ue="[object Int8Array]",oe="[object Int16Array]",Z="[object Int32Array]",Q="[object Uint8Array]",ie="[object Uint8ClampedArray]",de="[object Uint16Array]",we="[object Uint32Array]",Ae={};Ae[P]=Ae[I]=Ae[G]=Ae[z]=Ae[D]=Ae[L]=Ae[Y]=Ae[te]=Ae[ue]=Ae[oe]=Ae[Z]=Ae[W]=Ae[V]=Ae[$]=Ae[X]=Ae[ee]=Ae[K]=Ae[j]=Ae[Q]=Ae[ie]=Ae[de]=Ae[we]=!0,Ae[M]=Ae[q]=Ae[fe]=!1;function ve(le,Me,Se,Ee,re,ce){var _e,me=Me&R,Te=Me&_,De=Me&A;if(Se&&(_e=re?Se(le,Ee,re,ce):Se(le)),_e!==void 0)return _e;if(!y(le))return le;var Ne=x(le);if(Ne){if(_e=h(le),!me)return o(le,_e)}else{var ze=d(le),$e=ze==q||ze==N;if(b(le))return i(le,me);if(ze==$||ze==P||$e&&!re){if(_e=Te||$e?{}:p(le),!me)return Te?u(le,a(_e,le)):s(le,n(_e,le))}else{if(!Ae[ze])return re?le:{};_e=g(le,ze,me)}}ce||(ce=new r);var ke=ce.get(le);if(ke)return ke;ce.set(le,_e),E(le)?le.forEach(function(O){_e.add(ve(O,Me,Se,O,le,ce))}):w(le)&&le.forEach(function(O,ne){_e.set(ne,ve(O,Me,Se,ne,le,ce))});var Oe=De?Te?f:l:Te?S:C,ye=Ne?void 0:Oe(le);return e(ye||le,function(O,ne){ye&&(ne=O,O=le[ne]),t(_e,ne,ve(O,Me,Se,ne,le,ce))}),_e}return Qh=ve,Qh}var Jh,$_;function z4(){if($_)return Jh;$_=1;var r=NP(),e=4;function t(n){return r(n,e)}return Jh=t,Jh}var eg,V_;function T0(){if(V_)return eg;V_=1;function r(e){return function(){return e}}return eg=r,eg}var rg,G_;function $4(){if(G_)return rg;G_=1;function r(e){return function(t,n,a){for(var i=-1,o=Object(t),s=a(t),u=s.length;u--;){var l=s[e?u:++i];if(n(o[l],l,o)===!1)break}return t}}return rg=r,rg}var tg,W_;function R0(){if(W_)return tg;W_=1;var r=$4(),e=r();return tg=e,tg}var ng,U_;function A0(){if(U_)return ng;U_=1;var r=R0(),e=Va();function t(n,a){return n&&r(n,a,e)}return ng=t,ng}var ag,H_;function V4(){if(H_)return ag;H_=1;var r=oa();function e(t,n){return function(a,i){if(a==null)return a;if(!r(a))return t(a,i);for(var o=a.length,s=n?o:-1,u=Object(a);(n?s--:++s<o)&&i(u[s],s,u)!==!1;);return a}}return ag=e,ag}var ig,K_;function jl(){if(K_)return ig;K_=1;var r=A0(),e=V4(),t=e(r);return ig=t,ig}var og,j_;function Ei(){if(j_)return og;j_=1;function r(e){return e}return og=r,og}var sg,Y_;function FP(){if(Y_)return sg;Y_=1;var r=Ei();function e(t){return typeof t=="function"?t:r}return sg=e,sg}var ug,X_;function zP(){if(X_)return ug;X_=1;var r=b0(),e=jl(),t=FP(),n=Zr();function a(i,o){var s=n(i)?r:e;return s(i,t(o))}return ug=a,ug}var lg,Z_;function $P(){return Z_||(Z_=1,lg=zP()),lg}var fg,Q_;function G4(){if(Q_)return fg;Q_=1;var r=jl();function e(t,n){var a=[];return r(t,function(i,o,s){n(i,o,s)&&a.push(i)}),a}return fg=e,fg}var cg,J_;function W4(){if(J_)return cg;J_=1;var r="__lodash_hash_undefined__";function e(t){return this.__data__.set(t,r),this}return cg=e,cg}var dg,eS;function U4(){if(eS)return dg;eS=1;function r(e){return this.__data__.has(e)}return dg=r,dg}var vg,rS;function VP(){if(rS)return vg;rS=1;var r=m0(),e=W4(),t=U4();function n(a){var i=-1,o=a==null?0:a.length;for(this.__data__=new r;++i<o;)this.add(a[i])}return n.prototype.add=n.prototype.push=e,n.prototype.has=t,vg=n,vg}var hg,tS;function H4(){if(tS)return hg;tS=1;function r(e,t){for(var n=-1,a=e==null?0:e.length;++n<a;)if(t(e[n],n,e))return!0;return!1}return hg=r,hg}var gg,nS;function GP(){if(nS)return gg;nS=1;function r(e,t){return e.has(t)}return gg=r,gg}var pg,aS;function WP(){if(aS)return pg;aS=1;var r=VP(),e=H4(),t=GP(),n=1,a=2;function i(o,s,u,l,f,d){var h=u&n,g=o.length,p=s.length;if(g!=p&&!(h&&p>g))return!1;var x=d.get(o),b=d.get(s);if(x&&b)return x==s&&b==o;var w=-1,y=!0,E=u&a?new r:void 0;for(d.set(o,s),d.set(s,o);++w<g;){var C=o[w],S=s[w];if(l)var R=h?l(S,C,w,s,o,d):l(C,S,w,o,s,d);if(R!==void 0){if(R)continue;y=!1;break}if(E){if(!e(s,function(_,A){if(!t(E,A)&&(C===_||f(C,_,u,l,d)))return E.push(A)})){y=!1;break}}else if(!(C===S||f(C,S,u,l,d))){y=!1;break}}return d.delete(o),d.delete(s),y}return pg=i,pg}var yg,iS;function K4(){if(iS)return yg;iS=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(a,i){n[++t]=[i,a]}),n}return yg=r,yg}var mg,oS;function P0(){if(oS)return mg;oS=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(a){n[++t]=a}),n}return mg=r,mg}var bg,sS;function j4(){if(sS)return bg;sS=1;var r=vo(),e=LP(),t=xo(),n=WP(),a=K4(),i=P0(),o=1,s=2,u="[object Boolean]",l="[object Date]",f="[object Error]",d="[object Map]",h="[object Number]",g="[object RegExp]",p="[object Set]",x="[object String]",b="[object Symbol]",w="[object ArrayBuffer]",y="[object DataView]",E=r?r.prototype:void 0,C=E?E.valueOf:void 0;function S(R,_,A,P,I,D,L){switch(A){case y:if(R.byteLength!=_.byteLength||R.byteOffset!=_.byteOffset)return!1;R=R.buffer,_=_.buffer;case w:return!(R.byteLength!=_.byteLength||!D(new e(R),new e(_)));case u:case l:case h:return t(+R,+_);case f:return R.name==_.name&&R.message==_.message;case g:case x:return R==_+"";case d:var M=a;case p:var q=P&o;if(M||(M=i),R.size!=_.size&&!q)return!1;var N=L.get(R);if(N)return N==_;P|=s,L.set(R,_);var W=n(M(R),M(_),P,I,D,L);return L.delete(R),W;case b:if(C)return C.call(R)==C.call(_)}return!1}return bg=S,bg}var wg,uS;function Y4(){if(uS)return wg;uS=1;var r=BP(),e=1,t=Object.prototype,n=t.hasOwnProperty;function a(i,o,s,u,l,f){var d=s&e,h=r(i),g=h.length,p=r(o),x=p.length;if(g!=x&&!d)return!1;for(var b=g;b--;){var w=h[b];if(!(d?w in o:n.call(o,w)))return!1}var y=f.get(i),E=f.get(o);if(y&&E)return y==o&&E==i;var C=!0;f.set(i,o),f.set(o,i);for(var S=d;++b<g;){w=h[b];var R=i[w],_=o[w];if(u)var A=d?u(_,R,w,o,i,f):u(R,_,w,i,o,f);if(!(A===void 0?R===_||l(R,_,s,u,f):A)){C=!1;break}S||(S=w=="constructor")}if(C&&!S){var P=i.constructor,I=o.constructor;P!=I&&"constructor"in i&&"constructor"in o&&!(typeof P=="function"&&P instanceof P&&typeof I=="function"&&I instanceof I)&&(C=!1)}return f.delete(i),f.delete(o),C}return wg=a,wg}var xg,lS;function X4(){if(lS)return xg;lS=1;var r=$l(),e=WP(),t=j4(),n=Y4(),a=Co(),i=Zr(),o=Eo(),s=Os(),u=1,l="[object Arguments]",f="[object Array]",d="[object Object]",h=Object.prototype,g=h.hasOwnProperty;function p(x,b,w,y,E,C){var S=i(x),R=i(b),_=S?f:a(x),A=R?f:a(b);_=_==l?d:_,A=A==l?d:A;var P=_==d,I=A==d,D=_==A;if(D&&o(x)){if(!o(b))return!1;S=!0,P=!1}if(D&&!P)return C||(C=new r),S||s(x)?e(x,b,w,y,E,C):t(x,b,_,w,y,E,C);if(!(w&u)){var L=P&&g.call(x,"__wrapped__"),M=I&&g.call(b,"__wrapped__");if(L||M){var q=L?x.value():x,N=M?b.value():b;return C||(C=new r),E(q,N,w,y,C)}}return D?(C||(C=new r),n(x,b,w,y,E,C)):!1}return xg=p,xg}var Eg,fS;function UP(){if(fS)return Eg;fS=1;var r=X4(),e=zn();function t(n,a,i,o,s){return n===a?!0:n==null||a==null||!e(n)&&!e(a)?n!==n&&a!==a:r(n,a,i,o,t,s)}return Eg=t,Eg}var Cg,cS;function Z4(){if(cS)return Cg;cS=1;var r=$l(),e=UP(),t=1,n=2;function a(i,o,s,u){var l=s.length,f=l,d=!u;if(i==null)return!f;for(i=Object(i);l--;){var h=s[l];if(d&&h[2]?h[1]!==i[h[0]]:!(h[0]in i))return!1}for(;++l<f;){h=s[l];var g=h[0],p=i[g],x=h[1];if(d&&h[2]){if(p===void 0&&!(g in i))return!1}else{var b=new r;if(u)var w=u(p,x,g,i,o,b);if(!(w===void 0?e(x,p,t|n,u,b):w))return!1}}return!0}return Cg=a,Cg}var _g,dS;function HP(){if(dS)return _g;dS=1;var r=rn();function e(t){return t===t&&!r(t)}return _g=e,_g}var Sg,vS;function Q4(){if(vS)return Sg;vS=1;var r=HP(),e=Va();function t(n){for(var a=e(n),i=a.length;i--;){var o=a[i],s=n[o];a[i]=[o,s,r(s)]}return a}return Sg=t,Sg}var Tg,hS;function KP(){if(hS)return Tg;hS=1;function r(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}return Tg=r,Tg}var Rg,gS;function J4(){if(gS)return Rg;gS=1;var r=Z4(),e=Q4(),t=KP();function n(a){var i=e(a);return i.length==1&&i[0][2]?t(i[0][0],i[0][1]):function(o){return o===a||r(o,a,i)}}return Rg=n,Rg}var Ag,pS;function I0(){if(pS)return Ag;pS=1;var r=Zr(),e=ho(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,o){if(r(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:n.test(i)||!t.test(i)||o!=null&&i in Object(o)}return Ag=a,Ag}var Pg,yS;function eG(){if(yS)return Pg;yS=1;var r=m0(),e="Expected a function";function t(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(e);var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=n.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(t.Cache||r),i}return t.Cache=r,Pg=t,Pg}var Ig,mS;function rG(){if(mS)return Ig;mS=1;var r=eG(),e=500;function t(n){var a=r(n,function(o){return i.size===e&&i.clear(),o}),i=a.cache;return a}return Ig=t,Ig}var Dg,bS;function tG(){if(bS)return Dg;bS=1;var r=rG(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(e,function(o,s,u,l){i.push(u?l.replace(t,"$1"):s||o)}),i});return Dg=n,Dg}var Bg,wS;function Yl(){if(wS)return Bg;wS=1;function r(e,t){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}return Bg=r,Bg}var Mg,xS;function nG(){if(xS)return Mg;xS=1;var r=vo(),e=Yl(),t=Zr(),n=ho(),a=r?r.prototype:void 0,i=a?a.toString:void 0;function o(s){if(typeof s=="string")return s;if(t(s))return e(s,o)+"";if(n(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return Mg=o,Mg}var Lg,ES;function jP(){if(ES)return Lg;ES=1;var r=nG();function e(t){return t==null?"":r(t)}return Lg=e,Lg}var Og,CS;function Xl(){if(CS)return Og;CS=1;var r=Zr(),e=I0(),t=tG(),n=jP();function a(i,o){return r(i)?i:e(i,o)?[i]:t(n(i))}return Og=a,Og}var kg,_S;function ks(){if(_S)return kg;_S=1;var r=ho();function e(t){if(typeof t=="string"||r(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return kg=e,kg}var qg,SS;function Zl(){if(SS)return qg;SS=1;var r=Xl(),e=ks();function t(n,a){a=r(a,n);for(var i=0,o=a.length;n!=null&&i<o;)n=n[e(a[i++])];return i&&i==o?n:void 0}return qg=t,qg}var Ng,TS;function aG(){if(TS)return Ng;TS=1;var r=Zl();function e(t,n,a){var i=t==null?void 0:r(t,n);return i===void 0?a:i}return Ng=e,Ng}var Fg,RS;function iG(){if(RS)return Fg;RS=1;function r(e,t){return e!=null&&t in Object(e)}return Fg=r,Fg}var zg,AS;function YP(){if(AS)return zg;AS=1;var r=Xl(),e=Ls(),t=Zr(),n=Wl(),a=w0(),i=ks();function o(s,u,l){u=r(u,s);for(var f=-1,d=u.length,h=!1;++f<d;){var g=i(u[f]);if(!(h=s!=null&&l(s,g)))break;s=s[g]}return h||++f!=d?h:(d=s==null?0:s.length,!!d&&a(d)&&n(g,d)&&(t(s)||e(s)))}return zg=o,zg}var $g,PS;function XP(){if(PS)return $g;PS=1;var r=iG(),e=YP();function t(n,a){return n!=null&&e(n,a,r)}return $g=t,$g}var Vg,IS;function oG(){if(IS)return Vg;IS=1;var r=UP(),e=aG(),t=XP(),n=I0(),a=HP(),i=KP(),o=ks(),s=1,u=2;function l(f,d){return n(f)&&a(d)?i(o(f),d):function(h){var g=e(h,f);return g===void 0&&g===d?t(h,f):r(d,g,s|u)}}return Vg=l,Vg}var Gg,DS;function ZP(){if(DS)return Gg;DS=1;function r(e){return function(t){return t==null?void 0:t[e]}}return Gg=r,Gg}var Wg,BS;function sG(){if(BS)return Wg;BS=1;var r=Zl();function e(t){return function(n){return r(n,t)}}return Wg=e,Wg}var Ug,MS;function uG(){if(MS)return Ug;MS=1;var r=ZP(),e=sG(),t=I0(),n=ks();function a(i){return t(i)?r(n(i)):e(i)}return Ug=a,Ug}var Hg,LS;function sa(){if(LS)return Hg;LS=1;var r=J4(),e=oG(),t=Ei(),n=Zr(),a=uG();function i(o){return typeof o=="function"?o:o==null?t:typeof o=="object"?n(o)?e(o[0],o[1]):r(o):a(o)}return Hg=i,Hg}var Kg,OS;function QP(){if(OS)return Kg;OS=1;var r=AP(),e=G4(),t=sa(),n=Zr();function a(i,o){var s=n(i)?r:e;return s(i,t(o,3))}return Kg=a,Kg}var jg,kS;function lG(){if(kS)return jg;kS=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n,a){return n!=null&&e.call(n,a)}return jg=t,jg}var Yg,qS;function JP(){if(qS)return Yg;qS=1;var r=lG(),e=YP();function t(n,a){return n!=null&&e(n,a,r)}return Yg=t,Yg}var Xg,NS;function fG(){if(NS)return Xg;NS=1;var r=E0(),e=Co(),t=Ls(),n=Zr(),a=oa(),i=Eo(),o=Hl(),s=Os(),u="[object Map]",l="[object Set]",f=Object.prototype,d=f.hasOwnProperty;function h(g){if(g==null)return!0;if(a(g)&&(n(g)||typeof g=="string"||typeof g.splice=="function"||i(g)||s(g)||t(g)))return!g.length;var p=e(g);if(p==u||p==l)return!g.size;if(o(g))return!r(g).length;for(var x in g)if(d.call(g,x))return!1;return!0}return Xg=h,Xg}var Zg,FS;function eI(){if(FS)return Zg;FS=1;function r(e){return e===void 0}return Zg=r,Zg}var Qg,zS;function rI(){if(zS)return Qg;zS=1;var r=jl(),e=oa();function t(n,a){var i=-1,o=e(n)?Array(n.length):[];return r(n,function(s,u,l){o[++i]=a(s,u,l)}),o}return Qg=t,Qg}var Jg,$S;function tI(){if($S)return Jg;$S=1;var r=Yl(),e=sa(),t=rI(),n=Zr();function a(i,o){var s=n(i)?r:t;return s(i,e(o,3))}return Jg=a,Jg}var ep,VS;function cG(){if(VS)return ep;VS=1;function r(e,t,n,a){var i=-1,o=e==null?0:e.length;for(a&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}return ep=r,ep}var rp,GS;function dG(){if(GS)return rp;GS=1;function r(e,t,n,a,i){return i(e,function(o,s,u){n=a?(a=!1,o):t(n,o,s,u)}),n}return rp=r,rp}var tp,WS;function nI(){if(WS)return tp;WS=1;var r=cG(),e=jl(),t=sa(),n=dG(),a=Zr();function i(o,s,u){var l=a(o)?r:n,f=arguments.length<3;return l(o,t(s,4),u,f,e)}return tp=i,tp}var np,US;function vG(){if(US)return np;US=1;var r=yi(),e=Zr(),t=zn(),n="[object String]";function a(i){return typeof i=="string"||!e(i)&&t(i)&&r(i)==n}return np=a,np}var ap,HS;function hG(){if(HS)return ap;HS=1;var r=ZP(),e=r("length");return ap=e,ap}var ip,KS;function gG(){if(KS)return ip;KS=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=e+t+n,i="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+r+a+i+"]");function u(l){return s.test(l)}return ip=u,ip}var op,jS;function pG(){if(jS)return op;jS=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=e+t+n,i="\\ufe0e\\ufe0f",o="["+r+"]",s="["+a+"]",u="\\ud83c[\\udffb-\\udfff]",l="(?:"+s+"|"+u+")",f="[^"+r+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",p=l+"?",x="["+i+"]?",b="(?:"+g+"(?:"+[f,d,h].join("|")+")"+x+p+")*",w=x+p+b,y="(?:"+[f+s+"?",s,d,h,o].join("|")+")",E=RegExp(u+"(?="+u+")|"+y+w,"g");function C(S){for(var R=E.lastIndex=0;E.test(S);)++R;return R}return op=C,op}var sp,YS;function yG(){if(YS)return sp;YS=1;var r=hG(),e=gG(),t=pG();function n(a){return e(a)?t(a):r(a)}return sp=n,sp}var up,XS;function mG(){if(XS)return up;XS=1;var r=E0(),e=Co(),t=oa(),n=vG(),a=yG(),i="[object Map]",o="[object Set]";function s(u){if(u==null)return 0;if(t(u))return n(u)?a(u):u.length;var l=e(u);return l==i||l==o?u.size:r(u).length}return up=s,up}var lp,ZS;function bG(){if(ZS)return lp;ZS=1;var r=b0(),e=kP(),t=A0(),n=sa(),a=Kl(),i=Zr(),o=Eo(),s=Bs(),u=rn(),l=Os();function f(d,h,g){var p=i(d),x=p||o(d)||l(d);if(h=n(h,4),g==null){var b=d&&d.constructor;x?g=p?new b:[]:u(d)?g=s(b)?e(a(d)):{}:g={}}return(x?r:t)(d,function(w,y,E){return h(g,w,y,E)}),g}return lp=f,lp}var fp,QS;function wG(){if(QS)return fp;QS=1;var r=vo(),e=Ls(),t=Zr(),n=r?r.isConcatSpreadable:void 0;function a(i){return t(i)||e(i)||!!(n&&i&&i[n])}return fp=a,fp}var cp,JS;function D0(){if(JS)return cp;JS=1;var r=_0(),e=wG();function t(n,a,i,o,s){var u=-1,l=n.length;for(i||(i=e),s||(s=[]);++u<l;){var f=n[u];a>0&&i(f)?a>1?t(f,a-1,i,o,s):r(s,f):o||(s[s.length]=f)}return s}return cp=t,cp}var dp,eT;function xG(){if(eT)return dp;eT=1;function r(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}return dp=r,dp}var vp,rT;function aI(){if(rT)return vp;rT=1;var r=xG(),e=Math.max;function t(n,a,i){return a=e(a===void 0?n.length-1:a,0),function(){for(var o=arguments,s=-1,u=e(o.length-a,0),l=Array(u);++s<u;)l[s]=o[a+s];s=-1;for(var f=Array(a+1);++s<a;)f[s]=o[s];return f[a]=i(l),r(n,this,f)}}return vp=t,vp}var hp,tT;function EG(){if(tT)return hp;tT=1;var r=T0(),e=CP(),t=Ei(),n=e?function(a,i){return e(a,"toString",{configurable:!0,enumerable:!1,value:r(i),writable:!0})}:t;return hp=n,hp}var gp,nT;function CG(){if(nT)return gp;nT=1;var r=800,e=16,t=Date.now;function n(a){var i=0,o=0;return function(){var s=t(),u=e-(s-o);if(o=s,u>0){if(++i>=r)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return gp=n,gp}var pp,aT;function iI(){if(aT)return pp;aT=1;var r=EG(),e=CG(),t=e(r);return pp=t,pp}var yp,iT;function Ql(){if(iT)return yp;iT=1;var r=Ei(),e=aI(),t=iI();function n(a,i){return t(e(a,i,r),a+"")}return yp=n,yp}var mp,oT;function oI(){if(oT)return mp;oT=1;function r(e,t,n,a){for(var i=e.length,o=n+(a?1:-1);a?o--:++o<i;)if(t(e[o],o,e))return o;return-1}return mp=r,mp}var bp,sT;function _G(){if(sT)return bp;sT=1;function r(e){return e!==e}return bp=r,bp}var wp,uT;function SG(){if(uT)return wp;uT=1;function r(e,t,n){for(var a=n-1,i=e.length;++a<i;)if(e[a]===t)return a;return-1}return wp=r,wp}var xp,lT;function TG(){if(lT)return xp;lT=1;var r=oI(),e=_G(),t=SG();function n(a,i,o){return i===i?t(a,i,o):r(a,e,o)}return xp=n,xp}var Ep,fT;function RG(){if(fT)return Ep;fT=1;var r=TG();function e(t,n){var a=t==null?0:t.length;return!!a&&r(t,n,0)>-1}return Ep=e,Ep}var Cp,cT;function AG(){if(cT)return Cp;cT=1;function r(e,t,n){for(var a=-1,i=e==null?0:e.length;++a<i;)if(n(t,e[a]))return!0;return!1}return Cp=r,Cp}var _p,dT;function PG(){if(dT)return _p;dT=1;function r(){}return _p=r,_p}var Sp,vT;function IG(){if(vT)return Sp;vT=1;var r=MP(),e=PG(),t=P0(),n=1/0,a=r&&1/t(new r([,-0]))[1]==n?function(i){return new r(i)}:e;return Sp=a,Sp}var Tp,hT;function DG(){if(hT)return Tp;hT=1;var r=VP(),e=RG(),t=AG(),n=GP(),a=IG(),i=P0(),o=200;function s(u,l,f){var d=-1,h=e,g=u.length,p=!0,x=[],b=x;if(f)p=!1,h=t;else if(g>=o){var w=l?null:a(u);if(w)return i(w);p=!1,h=n,b=new r}else b=l?[]:x;e:for(;++d<g;){var y=u[d],E=l?l(y):y;if(y=f||y!==0?y:0,p&&E===E){for(var C=b.length;C--;)if(b[C]===E)continue e;l&&b.push(E),x.push(y)}else h(b,E,f)||(b!==x&&b.push(E),x.push(y))}return x}return Tp=s,Tp}var Rp,gT;function sI(){if(gT)return Rp;gT=1;var r=oa(),e=zn();function t(n){return e(n)&&r(n)}return Rp=t,Rp}var Ap,pT;function BG(){if(pT)return Ap;pT=1;var r=D0(),e=Ql(),t=DG(),n=sI(),a=e(function(i){return t(r(i,1,n,!0))});return Ap=a,Ap}var Pp,yT;function MG(){if(yT)return Pp;yT=1;var r=Yl();function e(t,n){return r(n,function(a){return t[a]})}return Pp=e,Pp}var Ip,mT;function uI(){if(mT)return Ip;mT=1;var r=MG(),e=Va();function t(n){return n==null?[]:r(n,e(n))}return Ip=t,Ip}var Dp,bT;function gn(){if(bT)return Dp;bT=1;var r;if(typeof p0=="function")try{r={clone:z4(),constant:T0(),each:$P(),filter:QP(),has:JP(),isArray:Zr(),isEmpty:fG(),isFunction:Bs(),isUndefined:eI(),keys:Va(),map:tI(),reduce:nI(),size:mG(),transform:bG(),union:BG(),values:uI()}}catch{}return r||(r=window._),Dp=r,Dp}var Bp,wT;function B0(){if(wT)return Bp;wT=1;var r=gn();Bp=a;var e="\0",t="\0",n="";function a(f){this._isDirected=r.has(f,"directed")?f.directed:!0,this._isMultigraph=r.has(f,"multigraph")?f.multigraph:!1,this._isCompound=r.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(f){return this._label=f,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(f){return r.isFunction(f)||(f=r.constant(f)),this._defaultNodeLabelFn=f,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return r.keys(this._nodes)},a.prototype.sources=function(){var f=this;return r.filter(this.nodes(),function(d){return r.isEmpty(f._in[d])})},a.prototype.sinks=function(){var f=this;return r.filter(this.nodes(),function(d){return r.isEmpty(f._out[d])})},a.prototype.setNodes=function(f,d){var h=arguments,g=this;return r.each(f,function(p){h.length>1?g.setNode(p,d):g.setNode(p)}),this},a.prototype.setNode=function(f,d){return r.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=d),this):(this._nodes[f]=arguments.length>1?d:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=t,this._children[f]={},this._children[t][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},a.prototype.node=function(f){return this._nodes[f]},a.prototype.hasNode=function(f){return r.has(this._nodes,f)},a.prototype.removeNode=function(f){var d=this;if(r.has(this._nodes,f)){var h=function(g){d.removeEdge(d._edgeObjs[g])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],r.each(this.children(f),function(g){d.setParent(g)}),delete this._children[f]),r.each(r.keys(this._in[f]),h),delete this._in[f],delete this._preds[f],r.each(r.keys(this._out[f]),h),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},a.prototype.setParent=function(f,d){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(d))d=t;else{d+="";for(var h=d;!r.isUndefined(h);h=this.parent(h))if(h===f)throw new Error("Setting "+d+" as parent of "+f+" would create a cycle");this.setNode(d)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=d,this._children[d][f]=!0,this},a.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},a.prototype.parent=function(f){if(this._isCompound){var d=this._parent[f];if(d!==t)return d}},a.prototype.children=function(f){if(r.isUndefined(f)&&(f=t),this._isCompound){var d=this._children[f];if(d)return r.keys(d)}else{if(f===t)return this.nodes();if(this.hasNode(f))return[]}},a.prototype.predecessors=function(f){var d=this._preds[f];if(d)return r.keys(d)},a.prototype.successors=function(f){var d=this._sucs[f];if(d)return r.keys(d)},a.prototype.neighbors=function(f){var d=this.predecessors(f);if(d)return r.union(d,this.successors(f))},a.prototype.isLeaf=function(f){var d;return this.isDirected()?d=this.successors(f):d=this.neighbors(f),d.length===0},a.prototype.filterNodes=function(f){var d=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});d.setGraph(this.graph());var h=this;r.each(this._nodes,function(x,b){f(b)&&d.setNode(b,x)}),r.each(this._edgeObjs,function(x){d.hasNode(x.v)&&d.hasNode(x.w)&&d.setEdge(x,h.edge(x))});var g={};function p(x){var b=h.parent(x);return b===void 0||d.hasNode(b)?(g[x]=b,b):b in g?g[b]:p(b)}return this._isCompound&&r.each(d.nodes(),function(x){d.setParent(x,p(x))}),d},a.prototype.setDefaultEdgeLabel=function(f){return r.isFunction(f)||(f=r.constant(f)),this._defaultEdgeLabelFn=f,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return r.values(this._edgeObjs)},a.prototype.setPath=function(f,d){var h=this,g=arguments;return r.reduce(f,function(p,x){return g.length>1?h.setEdge(p,x,d):h.setEdge(p,x),x}),this},a.prototype.setEdge=function(){var f,d,h,g,p=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(f=x.v,d=x.w,h=x.name,arguments.length===2&&(g=arguments[1],p=!0)):(f=x,d=arguments[1],h=arguments[3],arguments.length>2&&(g=arguments[2],p=!0)),f=""+f,d=""+d,r.isUndefined(h)||(h=""+h);var b=s(this._isDirected,f,d,h);if(r.has(this._edgeLabels,b))return p&&(this._edgeLabels[b]=g),this;if(!r.isUndefined(h)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(d),this._edgeLabels[b]=p?g:this._defaultEdgeLabelFn(f,d,h);var w=u(this._isDirected,f,d,h);return f=w.v,d=w.w,Object.freeze(w),this._edgeObjs[b]=w,i(this._preds[d],f),i(this._sucs[f],d),this._in[d][b]=w,this._out[f][b]=w,this._edgeCount++,this},a.prototype.edge=function(f,d,h){var g=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,f,d,h);return this._edgeLabels[g]},a.prototype.hasEdge=function(f,d,h){var g=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,f,d,h);return r.has(this._edgeLabels,g)},a.prototype.removeEdge=function(f,d,h){var g=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,f,d,h),p=this._edgeObjs[g];return p&&(f=p.v,d=p.w,delete this._edgeLabels[g],delete this._edgeObjs[g],o(this._preds[d],f),o(this._sucs[f],d),delete this._in[d][g],delete this._out[f][g],this._edgeCount--),this},a.prototype.inEdges=function(f,d){var h=this._in[f];if(h){var g=r.values(h);return d?r.filter(g,function(p){return p.v===d}):g}},a.prototype.outEdges=function(f,d){var h=this._out[f];if(h){var g=r.values(h);return d?r.filter(g,function(p){return p.w===d}):g}},a.prototype.nodeEdges=function(f,d){var h=this.inEdges(f,d);if(h)return h.concat(this.outEdges(f,d))};function i(f,d){f[d]?f[d]++:f[d]=1}function o(f,d){--f[d]||delete f[d]}function s(f,d,h,g){var p=""+d,x=""+h;if(!f&&p>x){var b=p;p=x,x=b}return p+n+x+n+(r.isUndefined(g)?e:g)}function u(f,d,h,g){var p=""+d,x=""+h;if(!f&&p>x){var b=p;p=x,x=b}var w={v:p,w:x};return g&&(w.name=g),w}function l(f,d){return s(f,d.v,d.w,d.name)}return Bp}var Mp,xT;function LG(){return xT||(xT=1,Mp="2.1.8"),Mp}var Lp,ET;function OG(){return ET||(ET=1,Lp={Graph:B0(),version:LG()}),Lp}var Op,CT;function kG(){if(CT)return Op;CT=1;var r=gn(),e=B0();Op={write:t,read:i};function t(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:a(o)};return r.isUndefined(o.graph())||(s.value=r.clone(o.graph())),s}function n(o){return r.map(o.nodes(),function(s){var u=o.node(s),l=o.parent(s),f={v:s};return r.isUndefined(u)||(f.value=u),r.isUndefined(l)||(f.parent=l),f})}function a(o){return r.map(o.edges(),function(s){var u=o.edge(s),l={v:s.v,w:s.w};return r.isUndefined(s.name)||(l.name=s.name),r.isUndefined(u)||(l.value=u),l})}function i(o){var s=new e(o.options).setGraph(o.value);return r.each(o.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),r.each(o.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return Op}var kp,_T;function qG(){if(_T)return kp;_T=1;var r=gn();kp=e;function e(t){var n={},a=[],i;function o(s){r.has(n,s)||(n[s]=!0,i.push(s),r.each(t.successors(s),o),r.each(t.predecessors(s),o))}return r.each(t.nodes(),function(s){i=[],o(s),i.length&&a.push(i)}),a}return kp}var qp,ST;function lI(){if(ST)return qp;ST=1;var r=gn();qp=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(t){return t.key})},e.prototype.has=function(t){return r.has(this._keyIndices,t)},e.prototype.priority=function(t){var n=this._keyIndices[t];if(n!==void 0)return this._arr[n].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(t,n){var a=this._keyIndices;if(t=String(t),!r.has(a,t)){var i=this._arr,o=i.length;return a[t]=o,i.push({key:t,priority:n}),this._decrease(o),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},e.prototype.decrease=function(t,n){var a=this._keyIndices[t];if(n>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[a].priority+" New: "+n);this._arr[a].priority=n,this._decrease(a)},e.prototype._heapify=function(t){var n=this._arr,a=2*t,i=a+1,o=t;a<n.length&&(o=n[a].priority<n[o].priority?a:o,i<n.length&&(o=n[i].priority<n[o].priority?i:o),o!==t&&(this._swap(t,o),this._heapify(o)))},e.prototype._decrease=function(t){for(var n=this._arr,a=n[t].priority,i;t!==0&&(i=t>>1,!(n[i].priority<a));)this._swap(t,i),t=i},e.prototype._swap=function(t,n){var a=this._arr,i=this._keyIndices,o=a[t],s=a[n];a[t]=s,a[n]=o,i[s.key]=t,i[o.key]=n},qp}var Np,TT;function fI(){if(TT)return Np;TT=1;var r=gn(),e=lI();Np=n;var t=r.constant(1);function n(i,o,s,u){return a(i,String(o),s||t,u||function(l){return i.outEdges(l)})}function a(i,o,s,u){var l={},f=new e,d,h,g=function(p){var x=p.v!==d?p.v:p.w,b=l[x],w=s(p),y=h.distance+w;if(w<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+w);y<b.distance&&(b.distance=y,b.predecessor=d,f.decrease(x,y))};for(i.nodes().forEach(function(p){var x=p===o?0:Number.POSITIVE_INFINITY;l[p]={distance:x},f.add(p,x)});f.size()>0&&(d=f.removeMin(),h=l[d],h.distance!==Number.POSITIVE_INFINITY);)u(d).forEach(g);return l}return Np}var Fp,RT;function NG(){if(RT)return Fp;RT=1;var r=fI(),e=gn();Fp=t;function t(n,a,i){return e.transform(n.nodes(),function(o,s){o[s]=r(n,s,a,i)},{})}return Fp}var zp,AT;function cI(){if(AT)return zp;AT=1;var r=gn();zp=e;function e(t){var n=0,a=[],i={},o=[];function s(u){var l=i[u]={onStack:!0,lowlink:n,index:n++};if(a.push(u),t.successors(u).forEach(function(h){r.has(i,h)?i[h].onStack&&(l.lowlink=Math.min(l.lowlink,i[h].index)):(s(h),l.lowlink=Math.min(l.lowlink,i[h].lowlink))}),l.lowlink===l.index){var f=[],d;do d=a.pop(),i[d].onStack=!1,f.push(d);while(u!==d);o.push(f)}}return t.nodes().forEach(function(u){r.has(i,u)||s(u)}),o}return zp}var $p,PT;function FG(){if(PT)return $p;PT=1;var r=gn(),e=cI();$p=t;function t(n){return r.filter(e(n),function(a){return a.length>1||a.length===1&&n.hasEdge(a[0],a[0])})}return $p}var Vp,IT;function zG(){if(IT)return Vp;IT=1;var r=gn();Vp=t;var e=r.constant(1);function t(a,i,o){return n(a,i||e,o||function(s){return a.outEdges(s)})}function n(a,i,o){var s={},u=a.nodes();return u.forEach(function(l){s[l]={},s[l][l]={distance:0},u.forEach(function(f){l!==f&&(s[l][f]={distance:Number.POSITIVE_INFINITY})}),o(l).forEach(function(f){var d=f.v===l?f.w:f.v,h=i(f);s[l][d]={distance:h,predecessor:l}})}),u.forEach(function(l){var f=s[l];u.forEach(function(d){var h=s[d];u.forEach(function(g){var p=h[l],x=f[g],b=h[g],w=p.distance+x.distance;w<b.distance&&(b.distance=w,b.predecessor=x.predecessor)})})}),s}return Vp}var Gp,DT;function dI(){if(DT)return Gp;DT=1;var r=gn();Gp=e,e.CycleException=t;function e(n){var a={},i={},o=[];function s(u){if(r.has(i,u))throw new t;r.has(a,u)||(i[u]=!0,a[u]=!0,r.each(n.predecessors(u),s),delete i[u],o.push(u))}if(r.each(n.sinks(),s),r.size(a)!==n.nodeCount())throw new t;return o}function t(){}return t.prototype=new Error,Gp}var Wp,BT;function $G(){if(BT)return Wp;BT=1;var r=dI();Wp=e;function e(t){try{r(t)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return Wp}var Up,MT;function vI(){if(MT)return Up;MT=1;var r=gn();Up=e;function e(n,a,i){r.isArray(a)||(a=[a]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),s=[],u={};return r.each(a,function(l){if(!n.hasNode(l))throw new Error("Graph does not have node: "+l);t(n,l,i==="post",u,o,s)}),s}function t(n,a,i,o,s,u){r.has(o,a)||(o[a]=!0,i||u.push(a),r.each(s(a),function(l){t(n,l,i,o,s,u)}),i&&u.push(a))}return Up}var Hp,LT;function VG(){if(LT)return Hp;LT=1;var r=vI();Hp=e;function e(t,n){return r(t,n,"post")}return Hp}var Kp,OT;function GG(){if(OT)return Kp;OT=1;var r=vI();Kp=e;function e(t,n){return r(t,n,"pre")}return Kp}var jp,kT;function WG(){if(kT)return jp;kT=1;var r=gn(),e=B0(),t=lI();jp=n;function n(a,i){var o=new e,s={},u=new t,l;function f(h){var g=h.v===l?h.w:h.v,p=u.priority(g);if(p!==void 0){var x=i(h);x<p&&(s[g]=l,u.decrease(g,x))}}if(a.nodeCount()===0)return o;r.each(a.nodes(),function(h){u.add(h,Number.POSITIVE_INFINITY),o.setNode(h)}),u.decrease(a.nodes()[0],0);for(var d=!1;u.size()>0;){if(l=u.removeMin(),r.has(s,l))o.setEdge(l,s[l]);else{if(d)throw new Error("Input graph is not connected: "+a);d=!0}a.nodeEdges(l).forEach(f)}return o}return jp}var Yp,qT;function UG(){return qT||(qT=1,Yp={components:qG(),dijkstra:fI(),dijkstraAll:NG(),findCycles:FG(),floydWarshall:zG(),isAcyclic:$G(),postorder:VG(),preorder:GG(),prim:WG(),tarjan:cI(),topsort:dI()}),Yp}var Xp,NT;function HG(){if(NT)return Xp;NT=1;var r=OG();return Xp={Graph:r.Graph,json:kG(),alg:UG(),version:r.version},Xp}var Zp,FT;function Tn(){if(FT)return Zp;FT=1;var r;if(typeof p0=="function")try{r=HG()}catch{}return r||(r=window.graphlib),Zp=r,Zp}var Qp,zT;function KG(){if(zT)return Qp;zT=1;var r=NP(),e=1,t=4;function n(a){return r(a,e|t)}return Qp=n,Qp}var Jp,$T;function Jl(){if($T)return Jp;$T=1;var r=xo(),e=oa(),t=Wl(),n=rn();function a(i,o,s){if(!n(s))return!1;var u=typeof o;return(u=="number"?e(s)&&t(o,s.length):u=="string"&&o in s)?r(s[o],i):!1}return Jp=a,Jp}var ey,VT;function jG(){if(VT)return ey;VT=1;var r=Ql(),e=xo(),t=Jl(),n=xi(),a=Object.prototype,i=a.hasOwnProperty,o=r(function(s,u){s=Object(s);var l=-1,f=u.length,d=f>2?u[2]:void 0;for(d&&t(u[0],u[1],d)&&(f=1);++l<f;)for(var h=u[l],g=n(h),p=-1,x=g.length;++p<x;){var b=g[p],w=s[b];(w===void 0||e(w,a[b])&&!i.call(s,b))&&(s[b]=h[b])}return s});return ey=o,ey}var ry,GT;function YG(){if(GT)return ry;GT=1;var r=sa(),e=oa(),t=Va();function n(a){return function(i,o,s){var u=Object(i);if(!e(i)){var l=r(o,3);i=t(i),o=function(d){return l(u[d],d,u)}}var f=a(i,o,s);return f>-1?u[l?i[f]:f]:void 0}}return ry=n,ry}var ty,WT;function hI(){if(WT)return ty;WT=1;var r=IR(),e=1/0,t=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=r(a),a===e||a===-e){var i=a<0?-1:1;return i*t}return a===a?a:0}return ty=n,ty}var ny,UT;function XG(){if(UT)return ny;UT=1;var r=hI();function e(t){var n=r(t),a=n%1;return n===n?a?n-a:n:0}return ny=e,ny}var ay,HT;function ZG(){if(HT)return ay;HT=1;var r=oI(),e=sa(),t=XG(),n=Math.max;function a(i,o,s){var u=i==null?0:i.length;if(!u)return-1;var l=s==null?0:t(s);return l<0&&(l=n(u+l,0)),r(i,e(o,3),l)}return ay=a,ay}var iy,KT;function QG(){if(KT)return iy;KT=1;var r=YG(),e=ZG(),t=r(e);return iy=t,iy}var oy,jT;function gI(){if(jT)return oy;jT=1;var r=D0();function e(t){var n=t==null?0:t.length;return n?r(t,1):[]}return oy=e,oy}var sy,YT;function JG(){if(YT)return sy;YT=1;var r=R0(),e=FP(),t=xi();function n(a,i){return a==null?a:r(a,e(i),t)}return sy=n,sy}var uy,XT;function eW(){if(XT)return uy;XT=1;function r(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}return uy=r,uy}var ly,ZT;function rW(){if(ZT)return ly;ZT=1;var r=Vl(),e=A0(),t=sa();function n(a,i){var o={};return i=t(i,3),e(a,function(s,u,l){r(o,u,i(s,u,l))}),o}return ly=n,ly}var fy,QT;function M0(){if(QT)return fy;QT=1;var r=ho();function e(t,n,a){for(var i=-1,o=t.length;++i<o;){var s=t[i],u=n(s);if(u!=null&&(l===void 0?u===u&&!r(u):a(u,l)))var l=u,f=s}return f}return fy=e,fy}var cy,JT;function tW(){if(JT)return cy;JT=1;function r(e,t){return e>t}return cy=r,cy}var dy,e2;function nW(){if(e2)return dy;e2=1;var r=M0(),e=tW(),t=Ei();function n(a){return a&&a.length?r(a,t,e):void 0}return dy=n,dy}var vy,r2;function pI(){if(r2)return vy;r2=1;var r=Vl(),e=xo();function t(n,a,i){(i!==void 0&&!e(n[a],i)||i===void 0&&!(a in n))&&r(n,a,i)}return vy=t,vy}var hy,t2;function aW(){if(t2)return hy;t2=1;var r=yi(),e=Kl(),t=zn(),n="[object Object]",a=Function.prototype,i=Object.prototype,o=a.toString,s=i.hasOwnProperty,u=o.call(Object);function l(f){if(!t(f)||r(f)!=n)return!1;var d=e(f);if(d===null)return!0;var h=s.call(d,"constructor")&&d.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==u}return hy=l,hy}var gy,n2;function yI(){if(n2)return gy;n2=1;function r(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}return gy=r,gy}var py,a2;function iW(){if(a2)return py;a2=1;var r=Ms(),e=xi();function t(n){return r(n,e(n))}return py=t,py}var yy,i2;function oW(){if(i2)return yy;i2=1;var r=pI(),e=TP(),t=OP(),n=RP(),a=qP(),i=Ls(),o=Zr(),s=sI(),u=Eo(),l=Bs(),f=rn(),d=aW(),h=Os(),g=yI(),p=iW();function x(b,w,y,E,C,S,R){var _=g(b,y),A=g(w,y),P=R.get(A);if(P){r(b,y,P);return}var I=S?S(_,A,y+"",b,w,R):void 0,D=I===void 0;if(D){var L=o(A),M=!L&&u(A),q=!L&&!M&&h(A);I=A,L||M||q?o(_)?I=_:s(_)?I=n(_):M?(D=!1,I=e(A,!0)):q?(D=!1,I=t(A,!0)):I=[]:d(A)||i(A)?(I=_,i(_)?I=p(_):(!f(_)||l(_))&&(I=a(A))):D=!1}D&&(R.set(A,I),C(I,A,E,S,R),R.delete(A)),r(b,y,I)}return yy=x,yy}var my,o2;function sW(){if(o2)return my;o2=1;var r=$l(),e=pI(),t=R0(),n=oW(),a=rn(),i=xi(),o=yI();function s(u,l,f,d,h){u!==l&&t(l,function(g,p){if(h||(h=new r),a(g))n(u,l,p,f,s,d,h);else{var x=d?d(o(u,p),g,p+"",u,l,h):void 0;x===void 0&&(x=g),e(u,p,x)}},i)}return my=s,my}var by,s2;function uW(){if(s2)return by;s2=1;var r=Ql(),e=Jl();function t(n){return r(function(a,i){var o=-1,s=i.length,u=s>1?i[s-1]:void 0,l=s>2?i[2]:void 0;for(u=n.length>3&&typeof u=="function"?(s--,u):void 0,l&&e(i[0],i[1],l)&&(u=s<3?void 0:u,s=1),a=Object(a);++o<s;){var f=i[o];f&&n(a,f,o,u)}return a})}return by=t,by}var wy,u2;function lW(){if(u2)return wy;u2=1;var r=sW(),e=uW(),t=e(function(n,a,i){r(n,a,i)});return wy=t,wy}var xy,l2;function mI(){if(l2)return xy;l2=1;function r(e,t){return e<t}return xy=r,xy}var Ey,f2;function fW(){if(f2)return Ey;f2=1;var r=M0(),e=mI(),t=Ei();function n(a){return a&&a.length?r(a,t,e):void 0}return Ey=n,Ey}var Cy,c2;function cW(){if(c2)return Cy;c2=1;var r=M0(),e=sa(),t=mI();function n(a,i){return a&&a.length?r(a,e(i,2),t):void 0}return Cy=n,Cy}var _y,d2;function dW(){if(d2)return _y;d2=1;var r=Gl(),e=Xl(),t=Wl(),n=rn(),a=ks();function i(o,s,u,l){if(!n(o))return o;s=e(s,o);for(var f=-1,d=s.length,h=d-1,g=o;g!=null&&++f<d;){var p=a(s[f]),x=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(f!=h){var b=g[p];x=l?l(b,p,g):void 0,x===void 0&&(x=n(b)?b:t(s[f+1])?[]:{})}r(g,p,x),g=g[p]}return o}return _y=i,_y}var Sy,v2;function vW(){if(v2)return Sy;v2=1;var r=Zl(),e=dW(),t=Xl();function n(a,i,o){for(var s=-1,u=i.length,l={};++s<u;){var f=i[s],d=r(a,f);o(d,f)&&e(l,t(f,a),d)}return l}return Sy=n,Sy}var Ty,h2;function hW(){if(h2)return Ty;h2=1;var r=vW(),e=XP();function t(n,a){return r(n,a,function(i,o){return e(n,o)})}return Ty=t,Ty}var Ry,g2;function gW(){if(g2)return Ry;g2=1;var r=gI(),e=aI(),t=iI();function n(a){return t(e(a,void 0,r),a+"")}return Ry=n,Ry}var Ay,p2;function pW(){if(p2)return Ay;p2=1;var r=hW(),e=gW(),t=e(function(n,a){return n==null?{}:r(n,a)});return Ay=t,Ay}var Py,y2;function yW(){if(y2)return Py;y2=1;var r=Math.ceil,e=Math.max;function t(n,a,i,o){for(var s=-1,u=e(r((a-n)/(i||1)),0),l=Array(u);u--;)l[o?u:++s]=n,n+=i;return l}return Py=t,Py}var Iy,m2;function mW(){if(m2)return Iy;m2=1;var r=yW(),e=Jl(),t=hI();function n(a){return function(i,o,s){return s&&typeof s!="number"&&e(i,o,s)&&(o=s=void 0),i=t(i),o===void 0?(o=i,i=0):o=t(o),s=s===void 0?i<o?1:-1:t(s),r(i,o,s,a)}}return Iy=n,Iy}var Dy,b2;function bW(){if(b2)return Dy;b2=1;var r=mW(),e=r();return Dy=e,Dy}var By,w2;function wW(){if(w2)return By;w2=1;function r(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}return By=r,By}var My,x2;function xW(){if(x2)return My;x2=1;var r=ho();function e(t,n){if(t!==n){var a=t!==void 0,i=t===null,o=t===t,s=r(t),u=n!==void 0,l=n===null,f=n===n,d=r(n);if(!l&&!d&&!s&&t>n||s&&u&&f&&!l&&!d||i&&u&&f||!a&&f||!o)return 1;if(!i&&!s&&!d&&t<n||d&&a&&o&&!i&&!s||l&&a&&o||!u&&o||!f)return-1}return 0}return My=e,My}var Ly,E2;function EW(){if(E2)return Ly;E2=1;var r=xW();function e(t,n,a){for(var i=-1,o=t.criteria,s=n.criteria,u=o.length,l=a.length;++i<u;){var f=r(o[i],s[i]);if(f){if(i>=l)return f;var d=a[i];return f*(d=="desc"?-1:1)}}return t.index-n.index}return Ly=e,Ly}var Oy,C2;function CW(){if(C2)return Oy;C2=1;var r=Yl(),e=Zl(),t=sa(),n=rI(),a=wW(),i=Ul(),o=EW(),s=Ei(),u=Zr();function l(f,d,h){d.length?d=r(d,function(x){return u(x)?function(b){return e(b,x.length===1?x[0]:x)}:x}):d=[s];var g=-1;d=r(d,i(t));var p=n(f,function(x,b,w){var y=r(d,function(E){return E(x)});return{criteria:y,index:++g,value:x}});return a(p,function(x,b){return o(x,b,h)})}return Oy=l,Oy}var ky,_2;function _W(){if(_2)return ky;_2=1;var r=D0(),e=CW(),t=Ql(),n=Jl(),a=t(function(i,o){if(i==null)return[];var s=o.length;return s>1&&n(i,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),e(i,r(o,1),[])});return ky=a,ky}var qy,S2;function SW(){if(S2)return qy;S2=1;var r=jP(),e=0;function t(n){var a=++e;return r(n)+a}return qy=t,qy}var Ny,T2;function TW(){if(T2)return Ny;T2=1;function r(e,t,n){for(var a=-1,i=e.length,o=t.length,s={};++a<i;){var u=a<o?t[a]:void 0;n(s,e[a],u)}return s}return Ny=r,Ny}var Fy,R2;function RW(){if(R2)return Fy;R2=1;var r=Gl(),e=TW();function t(n,a){return e(n||[],a||[],r)}return Fy=t,Fy}var zy,A2;function qr(){if(A2)return zy;A2=1;var r;if(typeof p0=="function")try{r={cloneDeep:KG(),constant:T0(),defaults:jG(),each:$P(),filter:QP(),find:QG(),flatten:gI(),forEach:zP(),forIn:JG(),has:JP(),isUndefined:eI(),last:eW(),map:tI(),mapValues:rW(),max:nW(),merge:lW(),min:fW(),minBy:cW(),now:PR(),pick:pW(),range:bW(),reduce:nI(),sortBy:_W(),uniqueId:SW(),values:uI(),zipObject:RW()}}catch{}return r||(r=window._),zy=r,zy}var $y,P2;function AW(){if(P2)return $y;P2=1,$y=r;function r(){var n={};n._next=n._prev=n,this._sentinel=n}r.prototype.dequeue=function(){var n=this._sentinel,a=n._prev;if(a!==n)return e(a),a},r.prototype.enqueue=function(n){var a=this._sentinel;n._prev&&n._next&&e(n),n._next=a._next,a._next._prev=n,a._next=n,n._prev=a},r.prototype.toString=function(){for(var n=[],a=this._sentinel,i=a._prev;i!==a;)n.push(JSON.stringify(i,t)),i=i._prev;return"["+n.join(", ")+"]"};function e(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function t(n,a){if(n!=="_next"&&n!=="_prev")return a}return $y}var Vy,I2;function PW(){if(I2)return Vy;I2=1;var r=qr(),e=Tn().Graph,t=AW();Vy=a;var n=r.constant(1);function a(l,f){if(l.nodeCount()<=1)return[];var d=s(l,f||n),h=i(d.graph,d.buckets,d.zeroIdx);return r.flatten(r.map(h,function(g){return l.outEdges(g.v,g.w)}),!0)}function i(l,f,d){for(var h=[],g=f[f.length-1],p=f[0],x;l.nodeCount();){for(;x=p.dequeue();)o(l,f,d,x);for(;x=g.dequeue();)o(l,f,d,x);if(l.nodeCount()){for(var b=f.length-2;b>0;--b)if(x=f[b].dequeue(),x){h=h.concat(o(l,f,d,x,!0));break}}}return h}function o(l,f,d,h,g){var p=g?[]:void 0;return r.forEach(l.inEdges(h.v),function(x){var b=l.edge(x),w=l.node(x.v);g&&p.push({v:x.v,w:x.w}),w.out-=b,u(f,d,w)}),r.forEach(l.outEdges(h.v),function(x){var b=l.edge(x),w=x.w,y=l.node(w);y.in-=b,u(f,d,y)}),l.removeNode(h.v),p}function s(l,f){var d=new e,h=0,g=0;r.forEach(l.nodes(),function(b){d.setNode(b,{v:b,in:0,out:0})}),r.forEach(l.edges(),function(b){var w=d.edge(b.v,b.w)||0,y=f(b),E=w+y;d.setEdge(b.v,b.w,E),g=Math.max(g,d.node(b.v).out+=y),h=Math.max(h,d.node(b.w).in+=y)});var p=r.range(g+h+3).map(function(){return new t}),x=h+1;return r.forEach(d.nodes(),function(b){u(p,x,d.node(b))}),{graph:d,buckets:p,zeroIdx:x}}function u(l,f,d){d.out?d.in?l[d.out-d.in+f].enqueue(d):l[l.length-1].enqueue(d):l[0].enqueue(d)}return Vy}var Gy,D2;function IW(){if(D2)return Gy;D2=1;var r=qr(),e=PW();Gy={run:t,undo:a};function t(i){var o=i.graph().acyclicer==="greedy"?e(i,s(i)):n(i);r.forEach(o,function(u){var l=i.edge(u);i.removeEdge(u),l.forwardName=u.name,l.reversed=!0,i.setEdge(u.w,u.v,l,r.uniqueId("rev"))});function s(u){return function(l){return u.edge(l).weight}}}function n(i){var o=[],s={},u={};function l(f){r.has(u,f)||(u[f]=!0,s[f]=!0,r.forEach(i.outEdges(f),function(d){r.has(s,d.w)?o.push(d):l(d.w)}),delete s[f])}return r.forEach(i.nodes(),l),o}function a(i){r.forEach(i.edges(),function(o){var s=i.edge(o);if(s.reversed){i.removeEdge(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,i.setEdge(o.w,o.v,s,u)}})}return Gy}var Wy,B2;function Wt(){if(B2)return Wy;B2=1;var r=qr(),e=Tn().Graph;Wy={addDummyNode:t,simplify:n,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:o,intersectRect:s,buildLayerMatrix:u,normalizeRanks:l,removeEmptyRanks:f,addBorderNode:d,maxRank:h,partition:g,time:p,notime:x};function t(b,w,y,E){var C;do C=r.uniqueId(E);while(b.hasNode(C));return y.dummy=w,b.setNode(C,y),C}function n(b){var w=new e().setGraph(b.graph());return r.forEach(b.nodes(),function(y){w.setNode(y,b.node(y))}),r.forEach(b.edges(),function(y){var E=w.edge(y.v,y.w)||{weight:0,minlen:1},C=b.edge(y);w.setEdge(y.v,y.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),w}function a(b){var w=new e({multigraph:b.isMultigraph()}).setGraph(b.graph());return r.forEach(b.nodes(),function(y){b.children(y).length||w.setNode(y,b.node(y))}),r.forEach(b.edges(),function(y){w.setEdge(y,b.edge(y))}),w}function i(b){var w=r.map(b.nodes(),function(y){var E={};return r.forEach(b.outEdges(y),function(C){E[C.w]=(E[C.w]||0)+b.edge(C).weight}),E});return r.zipObject(b.nodes(),w)}function o(b){var w=r.map(b.nodes(),function(y){var E={};return r.forEach(b.inEdges(y),function(C){E[C.v]=(E[C.v]||0)+b.edge(C).weight}),E});return r.zipObject(b.nodes(),w)}function s(b,w){var y=b.x,E=b.y,C=w.x-y,S=w.y-E,R=b.width/2,_=b.height/2;if(!C&&!S)throw new Error("Not possible to find intersection inside of the rectangle");var A,P;return Math.abs(S)*R>Math.abs(C)*_?(S<0&&(_=-_),A=_*C/S,P=_):(C<0&&(R=-R),A=R,P=R*S/C),{x:y+A,y:E+P}}function u(b){var w=r.map(r.range(h(b)+1),function(){return[]});return r.forEach(b.nodes(),function(y){var E=b.node(y),C=E.rank;r.isUndefined(C)||(w[C][E.order]=y)}),w}function l(b){var w=r.min(r.map(b.nodes(),function(y){return b.node(y).rank}));r.forEach(b.nodes(),function(y){var E=b.node(y);r.has(E,"rank")&&(E.rank-=w)})}function f(b){var w=r.min(r.map(b.nodes(),function(S){return b.node(S).rank})),y=[];r.forEach(b.nodes(),function(S){var R=b.node(S).rank-w;y[R]||(y[R]=[]),y[R].push(S)});var E=0,C=b.graph().nodeRankFactor;r.forEach(y,function(S,R){r.isUndefined(S)&&R%C!==0?--E:E&&r.forEach(S,function(_){b.node(_).rank+=E})})}function d(b,w,y,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=y,C.order=E),t(b,"border",C,w)}function h(b){return r.max(r.map(b.nodes(),function(w){var y=b.node(w).rank;if(!r.isUndefined(y))return y}))}function g(b,w){var y={lhs:[],rhs:[]};return r.forEach(b,function(E){w(E)?y.lhs.push(E):y.rhs.push(E)}),y}function p(b,w){var y=r.now();try{return w()}finally{console.log(b+" time: "+(r.now()-y)+"ms")}}function x(b,w){return w()}return Wy}var Uy,M2;function DW(){if(M2)return Uy;M2=1;var r=qr(),e=Wt();Uy={run:t,undo:a};function t(i){i.graph().dummyChains=[],r.forEach(i.edges(),function(o){n(i,o)})}function n(i,o){var s=o.v,u=i.node(s).rank,l=o.w,f=i.node(l).rank,d=o.name,h=i.edge(o),g=h.labelRank;if(f!==u+1){i.removeEdge(o);var p,x,b;for(b=0,++u;u<f;++b,++u)h.points=[],x={width:0,height:0,edgeLabel:h,edgeObj:o,rank:u},p=e.addDummyNode(i,"edge",x,"_d"),u===g&&(x.width=h.width,x.height=h.height,x.dummy="edge-label",x.labelpos=h.labelpos),i.setEdge(s,p,{weight:h.weight},d),b===0&&i.graph().dummyChains.push(p),s=p;i.setEdge(s,l,{weight:h.weight},d)}}function a(i){r.forEach(i.graph().dummyChains,function(o){var s=i.node(o),u=s.edgeLabel,l;for(i.setEdge(s.edgeObj,u);s.dummy;)l=i.successors(o)[0],i.removeNode(o),u.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(u.x=s.x,u.y=s.y,u.width=s.width,u.height=s.height),o=l,s=i.node(o)})}return Uy}var Hy,L2;function hl(){if(L2)return Hy;L2=1;var r=qr();Hy={longestPath:e,slack:t};function e(n){var a={};function i(o){var s=n.node(o);if(r.has(a,o))return s.rank;a[o]=!0;var u=r.min(r.map(n.outEdges(o),function(l){return i(l.w)-n.edge(l).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),s.rank=u}r.forEach(n.sources(),i)}function t(n,a){return n.node(a.w).rank-n.node(a.v).rank-n.edge(a).minlen}return Hy}var Ky,O2;function bI(){if(O2)return Ky;O2=1;var r=qr(),e=Tn().Graph,t=hl().slack;Ky=n;function n(s){var u=new e({directed:!1}),l=s.nodes()[0],f=s.nodeCount();u.setNode(l,{});for(var d,h;a(u,s)<f;)d=i(u,s),h=u.hasNode(d.v)?t(s,d):-t(s,d),o(u,s,h);return u}function a(s,u){function l(f){r.forEach(u.nodeEdges(f),function(d){var h=d.v,g=f===h?d.w:h;!s.hasNode(g)&&!t(u,d)&&(s.setNode(g,{}),s.setEdge(f,g,{}),l(g))})}return r.forEach(s.nodes(),l),s.nodeCount()}function i(s,u){return r.minBy(u.edges(),function(l){if(s.hasNode(l.v)!==s.hasNode(l.w))return t(u,l)})}function o(s,u,l){r.forEach(s.nodes(),function(f){u.node(f).rank+=l})}return Ky}var jy,k2;function BW(){if(k2)return jy;k2=1;var r=qr(),e=bI(),t=hl().slack,n=hl().longestPath,a=Tn().alg.preorder,i=Tn().alg.postorder,o=Wt().simplify;jy=s,s.initLowLimValues=d,s.initCutValues=u,s.calcCutValue=f,s.leaveEdge=g,s.enterEdge=p,s.exchangeEdges=x;function s(E){E=o(E),n(E);var C=e(E);d(C),u(C,E);for(var S,R;S=g(C);)R=p(C,E,S),x(C,E,S,R)}function u(E,C){var S=i(E,E.nodes());S=S.slice(0,S.length-1),r.forEach(S,function(R){l(E,C,R)})}function l(E,C,S){var R=E.node(S),_=R.parent;E.edge(S,_).cutvalue=f(E,C,S)}function f(E,C,S){var R=E.node(S),_=R.parent,A=!0,P=C.edge(S,_),I=0;return P||(A=!1,P=C.edge(_,S)),I=P.weight,r.forEach(C.nodeEdges(S),function(D){var L=D.v===S,M=L?D.w:D.v;if(M!==_){var q=L===A,N=C.edge(D).weight;if(I+=q?N:-N,w(E,S,M)){var W=E.edge(S,M).cutvalue;I+=q?-W:W}}}),I}function d(E,C){arguments.length<2&&(C=E.nodes()[0]),h(E,{},1,C)}function h(E,C,S,R,_){var A=S,P=E.node(R);return C[R]=!0,r.forEach(E.neighbors(R),function(I){r.has(C,I)||(S=h(E,C,S,I,R))}),P.low=A,P.lim=S++,_?P.parent=_:delete P.parent,S}function g(E){return r.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function p(E,C,S){var R=S.v,_=S.w;C.hasEdge(R,_)||(R=S.w,_=S.v);var A=E.node(R),P=E.node(_),I=A,D=!1;A.lim>P.lim&&(I=P,D=!0);var L=r.filter(C.edges(),function(M){return D===y(E,E.node(M.v),I)&&D!==y(E,E.node(M.w),I)});return r.minBy(L,function(M){return t(C,M)})}function x(E,C,S,R){var _=S.v,A=S.w;E.removeEdge(_,A),E.setEdge(R.v,R.w,{}),d(E),u(E,C),b(E,C)}function b(E,C){var S=r.find(E.nodes(),function(_){return!C.node(_).parent}),R=a(E,S);R=R.slice(1),r.forEach(R,function(_){var A=E.node(_).parent,P=C.edge(_,A),I=!1;P||(P=C.edge(A,_),I=!0),C.node(_).rank=C.node(A).rank+(I?P.minlen:-P.minlen)})}function w(E,C,S){return E.hasEdge(C,S)}function y(E,C,S){return S.low<=C.lim&&C.lim<=S.lim}return jy}var Yy,q2;function MW(){if(q2)return Yy;q2=1;var r=hl(),e=r.longestPath,t=bI(),n=BW();Yy=a;function a(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":i(u);break;default:s(u)}}var i=e;function o(u){e(u),t(u)}function s(u){n(u)}return Yy}var Xy,N2;function LW(){if(N2)return Xy;N2=1;var r=qr();Xy=e;function e(a){var i=n(a);r.forEach(a.graph().dummyChains,function(o){for(var s=a.node(o),u=s.edgeObj,l=t(a,i,u.v,u.w),f=l.path,d=l.lca,h=0,g=f[h],p=!0;o!==u.w;){if(s=a.node(o),p){for(;(g=f[h])!==d&&a.node(g).maxRank<s.rank;)h++;g===d&&(p=!1)}if(!p){for(;h<f.length-1&&a.node(g=f[h+1]).minRank<=s.rank;)h++;g=f[h]}a.setParent(o,g),o=a.successors(o)[0]}})}function t(a,i,o,s){var u=[],l=[],f=Math.min(i[o].low,i[s].low),d=Math.max(i[o].lim,i[s].lim),h,g;h=o;do h=a.parent(h),u.push(h);while(h&&(i[h].low>f||d>i[h].lim));for(g=h,h=s;(h=a.parent(h))!==g;)l.push(h);return{path:u.concat(l.reverse()),lca:g}}function n(a){var i={},o=0;function s(u){var l=o;r.forEach(a.children(u),s),i[u]={low:l,lim:o++}}return r.forEach(a.children(),s),i}return Xy}var Zy,F2;function OW(){if(F2)return Zy;F2=1;var r=qr(),e=Wt();Zy={run:t,cleanup:o};function t(s){var u=e.addDummyNode(s,"root",{},"_root"),l=a(s),f=r.max(r.values(l))-1,d=2*f+1;s.graph().nestingRoot=u,r.forEach(s.edges(),function(g){s.edge(g).minlen*=d});var h=i(s)+1;r.forEach(s.children(),function(g){n(s,u,d,h,f,l,g)}),s.graph().nodeRankFactor=d}function n(s,u,l,f,d,h,g){var p=s.children(g);if(!p.length){g!==u&&s.setEdge(u,g,{weight:0,minlen:l});return}var x=e.addBorderNode(s,"_bt"),b=e.addBorderNode(s,"_bb"),w=s.node(g);s.setParent(x,g),w.borderTop=x,s.setParent(b,g),w.borderBottom=b,r.forEach(p,function(y){n(s,u,l,f,d,h,y);var E=s.node(y),C=E.borderTop?E.borderTop:y,S=E.borderBottom?E.borderBottom:y,R=E.borderTop?f:2*f,_=C!==S?1:d-h[g]+1;s.setEdge(x,C,{weight:R,minlen:_,nestingEdge:!0}),s.setEdge(S,b,{weight:R,minlen:_,nestingEdge:!0})}),s.parent(g)||s.setEdge(u,x,{weight:0,minlen:d+h[g]})}function a(s){var u={};function l(f,d){var h=s.children(f);h&&h.length&&r.forEach(h,function(g){l(g,d+1)}),u[f]=d}return r.forEach(s.children(),function(f){l(f,1)}),u}function i(s){return r.reduce(s.edges(),function(u,l){return u+s.edge(l).weight},0)}function o(s){var u=s.graph();s.removeNode(u.nestingRoot),delete u.nestingRoot,r.forEach(s.edges(),function(l){var f=s.edge(l);f.nestingEdge&&s.removeEdge(l)})}return Zy}var Qy,z2;function kW(){if(z2)return Qy;z2=1;var r=qr(),e=Wt();Qy=t;function t(a){function i(o){var s=a.children(o),u=a.node(o);if(s.length&&r.forEach(s,i),r.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var l=u.minRank,f=u.maxRank+1;l<f;++l)n(a,"borderLeft","_bl",o,u,l),n(a,"borderRight","_br",o,u,l)}}r.forEach(a.children(),i)}function n(a,i,o,s,u,l){var f={width:0,height:0,rank:l,borderType:i},d=u[i][l-1],h=e.addDummyNode(a,"border",f,o);u[i][l]=h,a.setParent(h,s),d&&a.setEdge(d,h,{weight:1})}return Qy}var Jy,$2;function qW(){if($2)return Jy;$2=1;var r=qr();Jy={adjust:e,undo:t};function e(l){var f=l.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&n(l)}function t(l){var f=l.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&i(l),(f==="lr"||f==="rl")&&(s(l),n(l))}function n(l){r.forEach(l.nodes(),function(f){a(l.node(f))}),r.forEach(l.edges(),function(f){a(l.edge(f))})}function a(l){var f=l.width;l.width=l.height,l.height=f}function i(l){r.forEach(l.nodes(),function(f){o(l.node(f))}),r.forEach(l.edges(),function(f){var d=l.edge(f);r.forEach(d.points,o),r.has(d,"y")&&o(d)})}function o(l){l.y=-l.y}function s(l){r.forEach(l.nodes(),function(f){u(l.node(f))}),r.forEach(l.edges(),function(f){var d=l.edge(f);r.forEach(d.points,u),r.has(d,"x")&&u(d)})}function u(l){var f=l.x;l.x=l.y,l.y=f}return Jy}var em,V2;function NW(){if(V2)return em;V2=1;var r=qr();em=e;function e(t){var n={},a=r.filter(t.nodes(),function(l){return!t.children(l).length}),i=r.max(r.map(a,function(l){return t.node(l).rank})),o=r.map(r.range(i+1),function(){return[]});function s(l){if(!r.has(n,l)){n[l]=!0;var f=t.node(l);o[f.rank].push(l),r.forEach(t.successors(l),s)}}var u=r.sortBy(a,function(l){return t.node(l).rank});return r.forEach(u,s),o}return em}var rm,G2;function FW(){if(G2)return rm;G2=1;var r=qr();rm=e;function e(n,a){for(var i=0,o=1;o<a.length;++o)i+=t(n,a[o-1],a[o]);return i}function t(n,a,i){for(var o=r.zipObject(i,r.map(i,function(h,g){return g})),s=r.flatten(r.map(a,function(h){return r.sortBy(r.map(n.outEdges(h),function(g){return{pos:o[g.w],weight:n.edge(g).weight}}),"pos")}),!0),u=1;u<i.length;)u<<=1;var l=2*u-1;u-=1;var f=r.map(new Array(l),function(){return 0}),d=0;return r.forEach(s.forEach(function(h){var g=h.pos+u;f[g]+=h.weight;for(var p=0;g>0;)g%2&&(p+=f[g+1]),g=g-1>>1,f[g]+=h.weight;d+=h.weight*p})),d}return rm}var tm,W2;function zW(){if(W2)return tm;W2=1;var r=qr();tm=e;function e(t,n){return r.map(n,function(a){var i=t.inEdges(a);if(i.length){var o=r.reduce(i,function(s,u){var l=t.edge(u),f=t.node(u.v);return{sum:s.sum+l.weight*f.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:a,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:a}})}return tm}var nm,U2;function $W(){if(U2)return nm;U2=1;var r=qr();nm=e;function e(a,i){var o={};r.forEach(a,function(u,l){var f=o[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:l};r.isUndefined(u.barycenter)||(f.barycenter=u.barycenter,f.weight=u.weight)}),r.forEach(i.edges(),function(u){var l=o[u.v],f=o[u.w];!r.isUndefined(l)&&!r.isUndefined(f)&&(f.indegree++,l.out.push(o[u.w]))});var s=r.filter(o,function(u){return!u.indegree});return t(s)}function t(a){var i=[];function o(l){return function(f){f.merged||(r.isUndefined(f.barycenter)||r.isUndefined(l.barycenter)||f.barycenter>=l.barycenter)&&n(l,f)}}function s(l){return function(f){f.in.push(l),--f.indegree===0&&a.push(f)}}for(;a.length;){var u=a.pop();i.push(u),r.forEach(u.in.reverse(),o(u)),r.forEach(u.out,s(u))}return r.map(r.filter(i,function(l){return!l.merged}),function(l){return r.pick(l,["vs","i","barycenter","weight"])})}function n(a,i){var o=0,s=0;a.weight&&(o+=a.barycenter*a.weight,s+=a.weight),i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=o/s,a.weight=s,a.i=Math.min(i.i,a.i),i.merged=!0}return nm}var am,H2;function VW(){if(H2)return am;H2=1;var r=qr(),e=Wt();am=t;function t(i,o){var s=e.partition(i,function(x){return r.has(x,"barycenter")}),u=s.lhs,l=r.sortBy(s.rhs,function(x){return-x.i}),f=[],d=0,h=0,g=0;u.sort(a(!!o)),g=n(f,l,g),r.forEach(u,function(x){g+=x.vs.length,f.push(x.vs),d+=x.barycenter*x.weight,h+=x.weight,g=n(f,l,g)});var p={vs:r.flatten(f,!0)};return h&&(p.barycenter=d/h,p.weight=h),p}function n(i,o,s){for(var u;o.length&&(u=r.last(o)).i<=s;)o.pop(),i.push(u.vs),s++;return s}function a(i){return function(o,s){return o.barycenter<s.barycenter?-1:o.barycenter>s.barycenter?1:i?s.i-o.i:o.i-s.i}}return am}var im,K2;function GW(){if(K2)return im;K2=1;var r=qr(),e=zW(),t=$W(),n=VW();im=a;function a(s,u,l,f){var d=s.children(u),h=s.node(u),g=h?h.borderLeft:void 0,p=h?h.borderRight:void 0,x={};g&&(d=r.filter(d,function(S){return S!==g&&S!==p}));var b=e(s,d);r.forEach(b,function(S){if(s.children(S.v).length){var R=a(s,S.v,l,f);x[S.v]=R,r.has(R,"barycenter")&&o(S,R)}});var w=t(b,l);i(w,x);var y=n(w,f);if(g&&(y.vs=r.flatten([g,y.vs,p],!0),s.predecessors(g).length)){var E=s.node(s.predecessors(g)[0]),C=s.node(s.predecessors(p)[0]);r.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+E.order+C.order)/(y.weight+2),y.weight+=2}return y}function i(s,u){r.forEach(s,function(l){l.vs=r.flatten(l.vs.map(function(f){return u[f]?u[f].vs:f}),!0)})}function o(s,u){r.isUndefined(s.barycenter)?(s.barycenter=u.barycenter,s.weight=u.weight):(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight)}return im}var om,j2;function WW(){if(j2)return om;j2=1;var r=qr(),e=Tn().Graph;om=t;function t(a,i,o){var s=n(a),u=new e({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(l){return a.node(l)});return r.forEach(a.nodes(),function(l){var f=a.node(l),d=a.parent(l);(f.rank===i||f.minRank<=i&&i<=f.maxRank)&&(u.setNode(l),u.setParent(l,d||s),r.forEach(a[o](l),function(h){var g=h.v===l?h.w:h.v,p=u.edge(g,l),x=r.isUndefined(p)?0:p.weight;u.setEdge(g,l,{weight:a.edge(h).weight+x})}),r.has(f,"minRank")&&u.setNode(l,{borderLeft:f.borderLeft[i],borderRight:f.borderRight[i]}))}),u}function n(a){for(var i;a.hasNode(i=r.uniqueId("_root")););return i}return om}var sm,Y2;function UW(){if(Y2)return sm;Y2=1;var r=qr();sm=e;function e(t,n,a){var i={},o;r.forEach(a,function(s){for(var u=t.parent(s),l,f;u;){if(l=t.parent(u),l?(f=i[l],i[l]=u):(f=o,o=u),f&&f!==u){n.setEdge(f,u);return}u=l}})}return sm}var um,X2;function HW(){if(X2)return um;X2=1;var r=qr(),e=NW(),t=FW(),n=GW(),a=WW(),i=UW(),o=Tn().Graph,s=Wt();um=u;function u(h){var g=s.maxRank(h),p=l(h,r.range(1,g+1),"inEdges"),x=l(h,r.range(g-1,-1,-1),"outEdges"),b=e(h);d(h,b);for(var w=Number.POSITIVE_INFINITY,y,E=0,C=0;C<4;++E,++C){f(E%2?p:x,E%4>=2),b=s.buildLayerMatrix(h);var S=t(h,b);S<w&&(C=0,y=r.cloneDeep(b),w=S)}d(h,y)}function l(h,g,p){return r.map(g,function(x){return a(h,x,p)})}function f(h,g){var p=new o;r.forEach(h,function(x){var b=x.graph().root,w=n(x,b,p,g);r.forEach(w.vs,function(y,E){x.node(y).order=E}),i(x,p,w.vs)})}function d(h,g){r.forEach(g,function(p){r.forEach(p,function(x,b){h.node(x).order=b})})}return um}var lm,Z2;function KW(){if(Z2)return lm;Z2=1;var r=qr(),e=Tn().Graph,t=Wt();lm={positionX:p,findType1Conflicts:n,findType2Conflicts:a,addConflict:o,hasConflict:s,verticalAlignment:u,horizontalCompaction:l,alignCoordinates:h,findSmallestWidthAlignment:d,balance:g};function n(w,y){var E={};function C(S,R){var _=0,A=0,P=S.length,I=r.last(R);return r.forEach(R,function(D,L){var M=i(w,D),q=M?w.node(M).order:P;(M||D===I)&&(r.forEach(R.slice(A,L+1),function(N){r.forEach(w.predecessors(N),function(W){var V=w.node(W),$=V.order;($<_||q<$)&&!(V.dummy&&w.node(N).dummy)&&o(E,W,N)})}),A=L+1,_=q)}),R}return r.reduce(y,C),E}function a(w,y){var E={};function C(R,_,A,P,I){var D;r.forEach(r.range(_,A),function(L){D=R[L],w.node(D).dummy&&r.forEach(w.predecessors(D),function(M){var q=w.node(M);q.dummy&&(q.order<P||q.order>I)&&o(E,M,D)})})}function S(R,_){var A=-1,P,I=0;return r.forEach(_,function(D,L){if(w.node(D).dummy==="border"){var M=w.predecessors(D);M.length&&(P=w.node(M[0]).order,C(_,I,L,A,P),I=L,A=P)}C(_,I,_.length,P,R.length)}),_}return r.reduce(y,S),E}function i(w,y){if(w.node(y).dummy)return r.find(w.predecessors(y),function(E){return w.node(E).dummy})}function o(w,y,E){if(y>E){var C=y;y=E,E=C}var S=w[y];S||(w[y]=S={}),S[E]=!0}function s(w,y,E){if(y>E){var C=y;y=E,E=C}return r.has(w[y],E)}function u(w,y,E,C){var S={},R={},_={};return r.forEach(y,function(A){r.forEach(A,function(P,I){S[P]=P,R[P]=P,_[P]=I})}),r.forEach(y,function(A){var P=-1;r.forEach(A,function(I){var D=C(I);if(D.length){D=r.sortBy(D,function(W){return _[W]});for(var L=(D.length-1)/2,M=Math.floor(L),q=Math.ceil(L);M<=q;++M){var N=D[M];R[I]===I&&P<_[N]&&!s(E,I,N)&&(R[N]=I,R[I]=S[I]=S[N],P=_[N])}}})}),{root:S,align:R}}function l(w,y,E,C,S){var R={},_=f(w,y,E,S),A=S?"borderLeft":"borderRight";function P(L,M){for(var q=_.nodes(),N=q.pop(),W={};N;)W[N]?L(N):(W[N]=!0,q.push(N),q=q.concat(M(N))),N=q.pop()}function I(L){R[L]=_.inEdges(L).reduce(function(M,q){return Math.max(M,R[q.v]+_.edge(q))},0)}function D(L){var M=_.outEdges(L).reduce(function(N,W){return Math.min(N,R[W.w]-_.edge(W))},Number.POSITIVE_INFINITY),q=w.node(L);M!==Number.POSITIVE_INFINITY&&q.borderType!==A&&(R[L]=Math.max(R[L],M))}return P(I,_.predecessors.bind(_)),P(D,_.successors.bind(_)),r.forEach(C,function(L){R[L]=R[E[L]]}),R}function f(w,y,E,C){var S=new e,R=w.graph(),_=x(R.nodesep,R.edgesep,C);return r.forEach(y,function(A){var P;r.forEach(A,function(I){var D=E[I];if(S.setNode(D),P){var L=E[P],M=S.edge(L,D);S.setEdge(L,D,Math.max(_(w,I,P),M||0))}P=I})}),S}function d(w,y){return r.minBy(r.values(y),function(E){var C=Number.NEGATIVE_INFINITY,S=Number.POSITIVE_INFINITY;return r.forIn(E,function(R,_){var A=b(w,_)/2;C=Math.max(R+A,C),S=Math.min(R-A,S)}),C-S})}function h(w,y){var E=r.values(y),C=r.min(E),S=r.max(E);r.forEach(["u","d"],function(R){r.forEach(["l","r"],function(_){var A=R+_,P=w[A],I;if(P!==y){var D=r.values(P);I=_==="l"?C-r.min(D):S-r.max(D),I&&(w[A]=r.mapValues(P,function(L){return L+I}))}})})}function g(w,y){return r.mapValues(w.ul,function(E,C){if(y)return w[y.toLowerCase()][C];var S=r.sortBy(r.map(w,C));return(S[1]+S[2])/2})}function p(w){var y=t.buildLayerMatrix(w),E=r.merge(n(w,y),a(w,y)),C={},S;r.forEach(["u","d"],function(_){S=_==="u"?y:r.values(y).reverse(),r.forEach(["l","r"],function(A){A==="r"&&(S=r.map(S,function(L){return r.values(L).reverse()}));var P=(_==="u"?w.predecessors:w.successors).bind(w),I=u(w,S,E,P),D=l(w,S,I.root,I.align,A==="r");A==="r"&&(D=r.mapValues(D,function(L){return-L})),C[_+A]=D})});var R=d(w,C);return h(C,R),g(C,w.graph().align)}function x(w,y,E){return function(C,S,R){var _=C.node(S),A=C.node(R),P=0,I;if(P+=_.width/2,r.has(_,"labelpos"))switch(_.labelpos.toLowerCase()){case"l":I=-_.width/2;break;case"r":I=_.width/2;break}if(I&&(P+=E?I:-I),I=0,P+=(_.dummy?y:w)/2,P+=(A.dummy?y:w)/2,P+=A.width/2,r.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":I=A.width/2;break;case"r":I=-A.width/2;break}return I&&(P+=E?I:-I),I=0,P}}function b(w,y){return w.node(y).width}return lm}var fm,Q2;function jW(){if(Q2)return fm;Q2=1;var r=qr(),e=Wt(),t=KW().positionX;fm=n;function n(i){i=e.asNonCompoundGraph(i),a(i),r.forEach(t(i),function(o,s){i.node(s).x=o})}function a(i){var o=e.buildLayerMatrix(i),s=i.graph().ranksep,u=0;r.forEach(o,function(l){var f=r.max(r.map(l,function(d){return i.node(d).height}));r.forEach(l,function(d){i.node(d).y=u+f/2}),u+=f+s})}return fm}var cm,J2;function YW(){if(J2)return cm;J2=1;var r=qr(),e=IW(),t=DW(),n=MW(),a=Wt().normalizeRanks,i=LW(),o=Wt().removeEmptyRanks,s=OW(),u=kW(),l=qW(),f=HW(),d=jW(),h=Wt(),g=Tn().Graph;cm=p;function p(G,z){var Y=z&&z.debugTiming?h.time:h.notime;Y("layout",function(){var te=Y(" buildLayoutGraph",function(){return P(G)});Y(" runLayout",function(){x(te,Y)}),Y(" updateInputGraph",function(){b(G,te)})})}function x(G,z){z(" makeSpaceForEdgeLabels",function(){I(G)}),z(" removeSelfEdges",function(){X(G)}),z(" acyclic",function(){e.run(G)}),z(" nestingGraph.run",function(){s.run(G)}),z(" rank",function(){n(h.asNonCompoundGraph(G))}),z(" injectEdgeLabelProxies",function(){D(G)}),z(" removeEmptyRanks",function(){o(G)}),z(" nestingGraph.cleanup",function(){s.cleanup(G)}),z(" normalizeRanks",function(){a(G)}),z(" assignRankMinMax",function(){L(G)}),z(" removeEdgeLabelProxies",function(){M(G)}),z(" normalize.run",function(){t.run(G)}),z(" parentDummyChains",function(){i(G)}),z(" addBorderSegments",function(){u(G)}),z(" order",function(){f(G)}),z(" insertSelfEdges",function(){ee(G)}),z(" adjustCoordinateSystem",function(){l.adjust(G)}),z(" position",function(){d(G)}),z(" positionSelfEdges",function(){K(G)}),z(" removeBorderNodes",function(){$(G)}),z(" normalize.undo",function(){t.undo(G)}),z(" fixupEdgeLabelCoords",function(){W(G)}),z(" undoCoordinateSystem",function(){l.undo(G)}),z(" translateGraph",function(){q(G)}),z(" assignNodeIntersects",function(){N(G)}),z(" reversePoints",function(){V(G)}),z(" acyclic.undo",function(){e.undo(G)})}function b(G,z){r.forEach(G.nodes(),function(Y){var te=G.node(Y),ue=z.node(Y);te&&(te.x=ue.x,te.y=ue.y,z.children(Y).length&&(te.width=ue.width,te.height=ue.height))}),r.forEach(G.edges(),function(Y){var te=G.edge(Y),ue=z.edge(Y);te.points=ue.points,r.has(ue,"x")&&(te.x=ue.x,te.y=ue.y)}),G.graph().width=z.graph().width,G.graph().height=z.graph().height}var w=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],S={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],_={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},A=["labelpos"];function P(G){var z=new g({multigraph:!0,compound:!0}),Y=fe(G.graph());return z.setGraph(r.merge({},y,j(Y,w),r.pick(Y,E))),r.forEach(G.nodes(),function(te){var ue=fe(G.node(te));z.setNode(te,r.defaults(j(ue,C),S)),z.setParent(te,G.parent(te))}),r.forEach(G.edges(),function(te){var ue=fe(G.edge(te));z.setEdge(te,r.merge({},_,j(ue,R),r.pick(ue,A)))}),z}function I(G){var z=G.graph();z.ranksep/=2,r.forEach(G.edges(),function(Y){var te=G.edge(Y);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function D(G){r.forEach(G.edges(),function(z){var Y=G.edge(z);if(Y.width&&Y.height){var te=G.node(z.v),ue=G.node(z.w),oe={rank:(ue.rank-te.rank)/2+te.rank,e:z};h.addDummyNode(G,"edge-proxy",oe,"_ep")}})}function L(G){var z=0;r.forEach(G.nodes(),function(Y){var te=G.node(Y);te.borderTop&&(te.minRank=G.node(te.borderTop).rank,te.maxRank=G.node(te.borderBottom).rank,z=r.max(z,te.maxRank))}),G.graph().maxRank=z}function M(G){r.forEach(G.nodes(),function(z){var Y=G.node(z);Y.dummy==="edge-proxy"&&(G.edge(Y.e).labelRank=Y.rank,G.removeNode(z))})}function q(G){var z=Number.POSITIVE_INFINITY,Y=0,te=Number.POSITIVE_INFINITY,ue=0,oe=G.graph(),Z=oe.marginx||0,Q=oe.marginy||0;function ie(de){var we=de.x,Ae=de.y,ve=de.width,le=de.height;z=Math.min(z,we-ve/2),Y=Math.max(Y,we+ve/2),te=Math.min(te,Ae-le/2),ue=Math.max(ue,Ae+le/2)}r.forEach(G.nodes(),function(de){ie(G.node(de))}),r.forEach(G.edges(),function(de){var we=G.edge(de);r.has(we,"x")&&ie(we)}),z-=Z,te-=Q,r.forEach(G.nodes(),function(de){var we=G.node(de);we.x-=z,we.y-=te}),r.forEach(G.edges(),function(de){var we=G.edge(de);r.forEach(we.points,function(Ae){Ae.x-=z,Ae.y-=te}),r.has(we,"x")&&(we.x-=z),r.has(we,"y")&&(we.y-=te)}),oe.width=Y-z+Z,oe.height=ue-te+Q}function N(G){r.forEach(G.edges(),function(z){var Y=G.edge(z),te=G.node(z.v),ue=G.node(z.w),oe,Z;Y.points?(oe=Y.points[0],Z=Y.points[Y.points.length-1]):(Y.points=[],oe=ue,Z=te),Y.points.unshift(h.intersectRect(te,oe)),Y.points.push(h.intersectRect(ue,Z))})}function W(G){r.forEach(G.edges(),function(z){var Y=G.edge(z);if(r.has(Y,"x"))switch((Y.labelpos==="l"||Y.labelpos==="r")&&(Y.width-=Y.labeloffset),Y.labelpos){case"l":Y.x-=Y.width/2+Y.labeloffset;break;case"r":Y.x+=Y.width/2+Y.labeloffset;break}})}function V(G){r.forEach(G.edges(),function(z){var Y=G.edge(z);Y.reversed&&Y.points.reverse()})}function $(G){r.forEach(G.nodes(),function(z){if(G.children(z).length){var Y=G.node(z),te=G.node(Y.borderTop),ue=G.node(Y.borderBottom),oe=G.node(r.last(Y.borderLeft)),Z=G.node(r.last(Y.borderRight));Y.width=Math.abs(Z.x-oe.x),Y.height=Math.abs(ue.y-te.y),Y.x=oe.x+Y.width/2,Y.y=te.y+Y.height/2}}),r.forEach(G.nodes(),function(z){G.node(z).dummy==="border"&&G.removeNode(z)})}function X(G){r.forEach(G.edges(),function(z){if(z.v===z.w){var Y=G.node(z.v);Y.selfEdges||(Y.selfEdges=[]),Y.selfEdges.push({e:z,label:G.edge(z)}),G.removeEdge(z)}})}function ee(G){var z=h.buildLayerMatrix(G);r.forEach(z,function(Y){var te=0;r.forEach(Y,function(ue,oe){var Z=G.node(ue);Z.order=oe+te,r.forEach(Z.selfEdges,function(Q){h.addDummyNode(G,"selfedge",{width:Q.label.width,height:Q.label.height,rank:Z.rank,order:oe+ ++te,e:Q.e,label:Q.label},"_se")}),delete Z.selfEdges})})}function K(G){r.forEach(G.nodes(),function(z){var Y=G.node(z);if(Y.dummy==="selfedge"){var te=G.node(Y.e.v),ue=te.x+te.width/2,oe=te.y,Z=Y.x-ue,Q=te.height/2;G.setEdge(Y.e,Y.label),G.removeNode(z),Y.label.points=[{x:ue+2*Z/3,y:oe-Q},{x:ue+5*Z/6,y:oe-Q},{x:ue+Z,y:oe},{x:ue+5*Z/6,y:oe+Q},{x:ue+2*Z/3,y:oe+Q}],Y.label.x=Y.x,Y.label.y=Y.y}})}function j(G,z){return r.mapValues(r.pick(G,z),Number)}function fe(G){var z={};return r.forEach(G,function(Y,te){z[te.toLowerCase()]=Y}),z}return cm}var dm,eR;function XW(){if(eR)return dm;eR=1;var r=qr(),e=Wt(),t=Tn().Graph;dm={debugOrdering:n};function n(a){var i=e.buildLayerMatrix(a),o=new t({compound:!0,multigraph:!0}).setGraph({});return r.forEach(a.nodes(),function(s){o.setNode(s,{label:s}),o.setParent(s,"layer"+a.node(s).rank)}),r.forEach(a.edges(),function(s){o.setEdge(s.v,s.w,{},s.name)}),r.forEach(i,function(s,u){var l="layer"+u;o.setNode(l,{rank:"same"}),r.reduce(s,function(f,d){return o.setEdge(f,d,{style:"invis"}),d})}),o}return dm}var vm,rR;function ZW(){return rR||(rR=1,vm="0.8.5"),vm}var hm,tR;function QW(){return tR||(tR=1,hm={graphlib:Tn(),layout:YW(),debug:XW(),util:{time:Wt().time,notime:Wt().notime},version:ZW()}),hm}var JW=Xu.exports,nR;function eU(){return nR||(nR=1,(function(r,e){(function(n,a){r.exports=a(QW())})(JW,function(t){return(function(n){var a={};function i(o){if(a[o])return a[o].exports;var s=a[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=n,i.c=a,i.d=function(o,s,u){i.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:u})},i.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},i.t=function(o,s){if(s&1&&(o=i(o)),s&8||s&4&&typeof o=="object"&&o&&o.__esModule)return o;var u=Object.create(null);if(i.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:o}),s&2&&typeof o!="string")for(var l in o)i.d(u,l,(function(f){return o[f]}).bind(null,l));return u},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=0)})([(function(n,a,i){var o=i(1),s=function(l){l&&l("layout","dagre",o)};typeof cytoscape<"u"&&s(cytoscape),n.exports=s}),(function(n,a,i){function o(h){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(p){return typeof p}:o=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},o(h)}var s=function(g){return typeof g=="function"},u=i(2),l=i(3),f=i(4);function d(h){this.options=l({},u,h)}d.prototype.run=function(){var h=this.options,g=this,p=h.cy,x=h.eles,b=function(K,j){return s(j)?j.apply(K,[K]):j},w=h.boundingBox||{x1:0,y1:0,w:p.width(),h:p.height()};w.x2===void 0&&(w.x2=w.x1+w.w),w.w===void 0&&(w.w=w.x2-w.x1),w.y2===void 0&&(w.y2=w.y1+w.h),w.h===void 0&&(w.h=w.y2-w.y1);var y=new f.graphlib.Graph({multigraph:!0,compound:!0}),E={},C=function(K,j){j!=null&&(E[K]=j)};C("nodesep",h.nodeSep),C("edgesep",h.edgeSep),C("ranksep",h.rankSep),C("rankdir",h.rankDir),C("align",h.align),C("ranker",h.ranker),C("acyclicer",h.acyclicer),y.setGraph(E),y.setDefaultEdgeLabel(function(){return{}}),y.setDefaultNodeLabel(function(){return{}});var S=x.nodes();s(h.sort)&&(S=S.sort(h.sort));for(var R=0;R<S.length;R++){var _=S[R],A=_.layoutDimensions(h);y.setNode(_.id(),{width:A.w,height:A.h,name:_.id()})}for(var P=0;P<S.length;P++){var I=S[P];I.isChild()&&y.setParent(I.id(),I.parent().id())}var D=x.edges().stdFilter(function(ee){return!ee.source().isParent()&&!ee.target().isParent()});s(h.sort)&&(D=D.sort(h.sort));for(var L=0;L<D.length;L++){var M=D[L];y.setEdge(M.source().id(),M.target().id(),{minlen:b(M,h.minLen),weight:b(M,h.edgeWeight),name:M.id()},M.id())}f.layout(y);for(var q=y.nodes(),N=0;N<q.length;N++){var W=q[N],V=y.node(W);p.getElementById(W).scratch().dagre=V}var $;h.boundingBox?($={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},S.forEach(function(ee){var K=ee.scratch().dagre;$.x1=Math.min($.x1,K.x),$.x2=Math.max($.x2,K.x),$.y1=Math.min($.y1,K.y),$.y2=Math.max($.y2,K.y)}),$.w=$.x2-$.x1,$.h=$.y2-$.y1):$=w;var X=function(K){if(h.boundingBox){var j=$.w===0?0:(K.x-$.x1)/$.w,fe=$.h===0?0:(K.y-$.y1)/$.h;return{x:w.x1+j*w.w,y:w.y1+fe*w.h}}else return K};return S.layoutPositions(g,h,function(ee){ee=o(ee)==="object"?ee:this;var K=ee.scratch().dagre;return X({x:K.x,y:K.y})}),this},n.exports=d}),(function(n,a){var i={nodeSep:void 0,edgeSep:void 0,rankSep:void 0,rankDir:void 0,align:void 0,acyclicer:void 0,ranker:void 0,minLen:function(s){return 1},edgeWeight:function(s){return 1},fit:!0,padding:30,spacingFactor:void 0,nodeDimensionsIncludeLabels:!1,animate:!1,animateFilter:function(s,u){return!0},animationDuration:500,animationEasing:void 0,boundingBox:void 0,transform:function(s,u){return u},ready:function(){},sort:void 0,stop:function(){}};n.exports=i}),(function(n,a){n.exports=Object.assign!=null?Object.assign.bind(Object):function(i){for(var o=arguments.length,s=new Array(o>1?o-1:0),u=1;u<o;u++)s[u-1]=arguments[u];return s.forEach(function(l){Object.keys(l).forEach(function(f){return i[f]=l[f]})}),i}}),(function(n,a){n.exports=t})])})})(Xu)),Xu.exports}var rU=eU();const tU=gl(rU);var Zu={exports:{}},gm,aR;function nU(){if(aR)return gm;aR=1;var r="Expected a function",e="__lodash_hash_undefined__",t="[object Function]",n="[object GeneratorFunction]",a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=typeof St=="object"&&St&&St.Object===Object&&St,s=typeof self=="object"&&self&&self.Object===Object&&self,u=o||s||Function("return this")();function l(ve,le){return ve==null?void 0:ve[le]}function f(ve){var le=!1;if(ve!=null&&typeof ve.toString!="function")try{le=!!(ve+"")}catch{}return le}var d=Array.prototype,h=Function.prototype,g=Object.prototype,p=u["__core-js_shared__"],x=(function(){var ve=/[^.]+$/.exec(p&&p.keys&&p.keys.IE_PROTO||"");return ve?"Symbol(src)_1."+ve:""})(),b=h.toString,w=g.hasOwnProperty,y=g.toString,E=RegExp("^"+b.call(w).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),C=d.splice,S=ue(u,"Map"),R=ue(Object,"create");function _(ve){var le=-1,Me=ve?ve.length:0;for(this.clear();++le<Me;){var Se=ve[le];this.set(Se[0],Se[1])}}function A(){this.__data__=R?R(null):{}}function P(ve){return this.has(ve)&&delete this.__data__[ve]}function I(ve){var le=this.__data__;if(R){var Me=le[ve];return Me===e?void 0:Me}return w.call(le,ve)?le[ve]:void 0}function D(ve){var le=this.__data__;return R?le[ve]!==void 0:w.call(le,ve)}function L(ve,le){var Me=this.__data__;return Me[ve]=R&&le===void 0?e:le,this}_.prototype.clear=A,_.prototype.delete=P,_.prototype.get=I,_.prototype.has=D,_.prototype.set=L;function M(ve){var le=-1,Me=ve?ve.length:0;for(this.clear();++le<Me;){var Se=ve[le];this.set(Se[0],Se[1])}}function q(){this.__data__=[]}function N(ve){var le=this.__data__,Me=z(le,ve);if(Me<0)return!1;var Se=le.length-1;return Me==Se?le.pop():C.call(le,Me,1),!0}function W(ve){var le=this.__data__,Me=z(le,ve);return Me<0?void 0:le[Me][1]}function V(ve){return z(this.__data__,ve)>-1}function $(ve,le){var Me=this.__data__,Se=z(Me,ve);return Se<0?Me.push([ve,le]):Me[Se][1]=le,this}M.prototype.clear=q,M.prototype.delete=N,M.prototype.get=W,M.prototype.has=V,M.prototype.set=$;function X(ve){var le=-1,Me=ve?ve.length:0;for(this.clear();++le<Me;){var Se=ve[le];this.set(Se[0],Se[1])}}function ee(){this.__data__={hash:new _,map:new(S||M),string:new _}}function K(ve){return te(this,ve).delete(ve)}function j(ve){return te(this,ve).get(ve)}function fe(ve){return te(this,ve).has(ve)}function G(ve,le){return te(this,ve).set(ve,le),this}X.prototype.clear=ee,X.prototype.delete=K,X.prototype.get=j,X.prototype.has=fe,X.prototype.set=G;function z(ve,le){for(var Me=ve.length;Me--;)if(de(ve[Me][0],le))return Me;return-1}function Y(ve){if(!Ae(ve)||Z(ve))return!1;var le=we(ve)||f(ve)?E:i;return le.test(Q(ve))}function te(ve,le){var Me=ve.__data__;return oe(le)?Me[typeof le=="string"?"string":"hash"]:Me.map}function ue(ve,le){var Me=l(ve,le);return Y(Me)?Me:void 0}function oe(ve){var le=typeof ve;return le=="string"||le=="number"||le=="symbol"||le=="boolean"?ve!=="__proto__":ve===null}function Z(ve){return!!x&&x in ve}function Q(ve){if(ve!=null){try{return b.call(ve)}catch{}try{return ve+""}catch{}}return""}function ie(ve,le){if(typeof ve!="function"||le&&typeof le!="function")throw new TypeError(r);var Me=function(){var Se=arguments,Ee=le?le.apply(this,Se):Se[0],re=Me.cache;if(re.has(Ee))return re.get(Ee);var ce=ve.apply(this,Se);return Me.cache=re.set(Ee,ce),ce};return Me.cache=new(ie.Cache||X),Me}ie.Cache=X;function de(ve,le){return ve===le||ve!==ve&&le!==le}function we(ve){var le=Ae(ve)?y.call(ve):"";return le==t||le==n}function Ae(ve){var le=typeof ve;return!!ve&&(le=="object"||le=="function")}return gm=ie,gm}var pm,iR;function aU(){if(iR)return pm;iR=1;var r="Expected a function",e=NaN,t="[object Symbol]",n=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,u=typeof St=="object"&&St&&St.Object===Object&&St,l=typeof self=="object"&&self&&self.Object===Object&&self,f=u||l||Function("return this")(),d=Object.prototype,h=d.toString,g=Math.max,p=Math.min,x=function(){return f.Date.now()};function b(R,_,A){var P,I,D,L,M,q,N=0,W=!1,V=!1,$=!0;if(typeof R!="function")throw new TypeError(r);_=S(_)||0,y(A)&&(W=!!A.leading,V="maxWait"in A,D=V?g(S(A.maxWait)||0,_):D,$="trailing"in A?!!A.trailing:$);function X(ue){var oe=P,Z=I;return P=I=void 0,N=ue,L=R.apply(Z,oe),L}function ee(ue){return N=ue,M=setTimeout(fe,_),W?X(ue):L}function K(ue){var oe=ue-q,Z=ue-N,Q=_-oe;return V?p(Q,D-Z):Q}function j(ue){var oe=ue-q,Z=ue-N;return q===void 0||oe>=_||oe<0||V&&Z>=D}function fe(){var ue=x();if(j(ue))return G(ue);M=setTimeout(fe,K(ue))}function G(ue){return M=void 0,$&&P?X(ue):(P=I=void 0,L)}function z(){M!==void 0&&clearTimeout(M),N=0,P=q=I=M=void 0}function Y(){return M===void 0?L:G(x())}function te(){var ue=x(),oe=j(ue);if(P=arguments,I=this,q=ue,oe){if(M===void 0)return ee(q);if(V)return M=setTimeout(fe,_),X(q)}return M===void 0&&(M=setTimeout(fe,_)),L}return te.cancel=z,te.flush=Y,te}function w(R,_,A){var P=!0,I=!0;if(typeof R!="function")throw new TypeError(r);return y(A)&&(P="leading"in A?!!A.leading:P,I="trailing"in A?!!A.trailing:I),b(R,_,{leading:P,maxWait:_,trailing:I})}function y(R){var _=typeof R;return!!R&&(_=="object"||_=="function")}function E(R){return!!R&&typeof R=="object"}function C(R){return typeof R=="symbol"||E(R)&&h.call(R)==t}function S(R){if(typeof R=="number")return R;if(C(R))return e;if(y(R)){var _=typeof R.valueOf=="function"?R.valueOf():R;R=y(_)?_+"":_}if(typeof R!="string")return R===0?R:+R;R=R.replace(n,"");var A=i.test(R);return A||o.test(R)?s(R.slice(2),A?2:8):a.test(R)?e:+R}return pm=w,pm}var iU=Zu.exports,oR;function oU(){return oR||(oR=1,(function(r,e){(function(n,a){r.exports=a(nU(),aU())})(iU,function(t,n){return(function(a){var i={};function o(s){if(i[s])return i[s].exports;var u=i[s]={i:s,l:!1,exports:{}};return a[s].call(u.exports,u,u.exports,o),u.l=!0,u.exports}return o.m=a,o.c=i,o.i=function(s){return s},o.d=function(s,u,l){o.o(s,u)||Object.defineProperty(s,u,{configurable:!1,enumerable:!0,get:l})},o.n=function(s){var u=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(u,"a",u),u},o.o=function(s,u){return Object.prototype.hasOwnProperty.call(s,u)},o.p="",o(o.s=12)})([(function(a,i,o){a.exports=Object.assign!=null?Object.assign.bind(Object):function(s){for(var u=arguments.length,l=Array(u>1?u-1:0),f=1;f<u;f++)l[f-1]=arguments[f];return l.filter(function(d){return d!=null}).forEach(function(d){Object.keys(d).forEach(function(h){return s[h]=d[h]})}),s}}),(function(a,i,o){var s=o(10),u=o(0);a.exports=function(l){var f=this;return new s(u({cy:f},l))}}),(function(a,i,o){function s(){if(this.saveGestureState(),this.cy.zoomingEnabled(!1).panningEnabled(!1).boxSelectionEnabled(!1),this.options.disableBrowserGestures){var f=this.windowListenerOptions;window.addEventListener("touchstart",this.preventDefault,f),window.addEventListener("touchmove",this.preventDefault,f),window.addEventListener("wheel",this.preventDefault,f)}return this}function u(){if(this.cy.zoomingEnabled(this.lastZoomingEnabled).panningEnabled(this.lastPanningEnabled).boxSelectionEnabled(this.lastBoxSelectionEnabled),this.options.disableBrowserGestures){var f=this.windowListenerOptions;window.removeEventListener("touchstart",this.preventDefault,f),window.removeEventListener("touchmove",this.preventDefault,f),window.removeEventListener("wheel",this.preventDefault,f)}return this}function l(){var f=this.cy;return this.lastPanningEnabled=f.panningEnabled(),this.lastZoomingEnabled=f.zoomingEnabled(),this.lastBoxSelectionEnabled=f.boxSelectionEnabled(),this}a.exports={disableGestures:s,resetGestures:u,saveGestureState:l}}),(function(a,i,o){function s(){var u=this,l=this.cy,f=this.options;return this.addListener(l,"drag",function(){return u.grabbingNode=!0}),this.addListener(l,"free",function(){return u.grabbingNode=!1}),this.addListener(l,"tapstart","node",function(d){var h=d.target;u.drawMode&&u.start(h)}),this.addListener(l,"tapdrag",function(d){u.update(d.position)}),this.addListener(l,"tapdragover","node",function(d){f.snap||u.preview(d.target)}),this.addListener(l,"tapdragout","node",function(d){f.snap||u.unpreview(d.target)}),this.addListener(l,"tapend",function(){u.stop()}),this}a.exports={addCytoscapeListeners:s}}),(function(a,i,o){var s={canConnect:function(l,f){return!l.same(f)},edgeParams:function(l,f){return{}},hoverDelay:150,snap:!0,snapThreshold:50,snapFrequency:15,noEdgeEventsInDraw:!0,disableBrowserGestures:!0};a.exports=s}),(function(a,i,o){function s(f){var d=this.cy;return this.drawMode=f??!this.drawMode,this.drawMode?(this.prevUngrabifyState=d.autoungrabify(),d.autoungrabify(!0),this.emit("drawon")):(d.autoungrabify(this.prevUngrabifyState),this.emit("drawoff")),this}function u(){return this.toggleDrawMode(!0)}function l(){return this.toggleDrawMode(!1)}a.exports={toggleDrawMode:s,enableDrawMode:u,disableDrawMode:l}}),(function(a,i,o){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},u=o(0),l=function(y){return(typeof y>"u"?"undefined":s(y))===s("")},f=function(y){return(typeof y>"u"?"undefined":s(y))===s([])&&y.length!=null};function d(w,y,E){var C={};return u(C,y,w),u(C.data,y.data,w.data),l(y.classes)?C.classes=y.classes+" "+E:f(y.classes)?C.classes=y.classes.join(" ")+" "+E:C.classes=E,C}function h(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,y=this.cy;this.options;var E=this.presumptiveTargets,C=this.previewEles,S=this.active,R=this.sourceNode,_=this.targetNode,A=w?"eh-preview":"",P=y.collection(),I=this.canConnect(_);if(S&&I){if(!_||_.size()===0){C.remove(),this.emit("cancel",this.mp(),R,E);return}if(!w){C.removeClass("eh-preview").style("events",""),this.emit("complete",this.mp(),R,_,C);return}var D=y.add(d({group:"edges",data:{source:R.id(),target:_.id()}},this.edgeParams(_),A));return P=P.merge(D),w?(this.previewEles=P,P.style("events","no")):(P.style("events",""),this.emit("complete",this.mp(),R,_,P)),this}}function g(){return this.makeEdges(!0),this}function p(){return this.previewEles.nonempty()&&this.previewEles.inside()}function x(){return this.previewShown()&&this.previewEles.remove(),this}function b(){var w=this,y=this.sourceNode,E=this.ghostNode,C=this.cy,S=this.mx,R=this.my,_=S,A=R,P=void 0,I=void 0;if(y)return(!E||E.length===0||E.removed())&&(I=this.ghostEles=C.collection(),C.batch(function(){E=w.ghostNode=C.add({group:"nodes",classes:"eh-ghost eh-ghost-node",position:{x:0,y:0}}),E.style({"background-color":"blue",width:1e-4,height:1e-4,opacity:0,events:"no"});var D={};P=C.add(u({},D,{group:"edges",data:u({},D.data,{source:y.id(),target:E.id()}),classes:"eh-ghost eh-ghost-edge"})),P.style({events:"no"})}),I.merge(E).merge(P)),E.position({x:_,y:A}),this}a.exports={makeEdges:h,makePreview:g,removePreview:x,previewShown:p,updateEdge:b}}),(function(a,i,o){function s(){return this.options.noEdgeEventsInDraw&&this.cy.edges().style("events","no"),this}function u(){return this.options.noEdgeEventsInDraw&&this.cy.edges().style("events",""),this}a.exports={disableEdgeEvents:s,enableEdgeEvents:u}}),(function(a,i,o){function s(){return this.enabled=!0,this.emit("enable"),this}function u(){return this.enabled=!1,this.emit("disable"),this}a.exports={enable:s,disable:u}}),(function(a,i,o){var s=o(13),u=Math.sqrt(2);function l(y){var E=this.previewEles,C=this.ghostEles,S=function(L){return E.anySame(L)},R=function(L){return C.anySame(L)},_=function(L){return S(L)||R(L)},A=this.enabled,P=this.active,I=this.grabbingNode;return A&&!P&&!I&&y!=null&&y.nonempty()&&!_(y)}function f(y){return this.canStartOn(y)&&this.drawMode}function d(y){return this.canStartOn(y)&&!this.drawMode}function h(y){var E=this;if(this.canStartOn(y)){this.active=!0,this.sourceNode=y,this.sourceNode.addClass("eh-source"),this.disableGestures(),this.disableEdgeEvents();var C=function(R){return R.id()};this.canConnect=s(function(S){return E.options.canConnect(E.sourceNode,S)},C),this.edgeParams=s(function(S){return E.options.edgeParams(E.sourceNode,S)},C),this.emit("start",this.hp(),y)}}function g(y){if(this.active){var E=y;return this.mx=E.x,this.my=E.y,this.updateEdge(),this.throttledSnap(),this}}function p(){if(!this.active||!this.options.snap)return!1;var y=this.cy,E=this.targetNode,C=this.options.snapThreshold,S=this.mp(),R=this.previewEles,_=this.ghostNode,A=function(z){return u*Math.max(z.outerWidth(),z.outerHeight())/2},P=function(z,Y,te,ue){var oe=te-z,Z=ue-Y;return oe*oe+Z*Z},I=function(z,Y){return P(z.x,z.y,Y.x,Y.y)},D=function(z){return I(z.position(),S)},L=function(z){var Y=A(z),te=Y+C;return te*te},M=function(z){return D(z)<=L(z)},q=function(z){var Y=z.position(),te=z.outerWidth()/2,ue=z.outerHeight()/2,oe=Y.x,Z=Y.y,Q=S.x,ie=S.y,de=oe-te,we=oe+te,Ae=Z-ue,ve=Z+ue,le=de<=Q&&Q<=we,Me=Ae<=ie&&ie<=ve;if(le&&Me)return 0;if(le){var Se=ie-Ae,Ee=ie-ve;return Math.min(Se*Se,Ee*Ee)}else if(Me){var re=Q-de,ce=Q-we;return Math.min(re*re,ce*ce)}else return Q<de&&ie<Ae?P(Q,ie,de,Ae):Q>we&&ie<Ae?P(Q,ie,we,Ae):Q<de&&ie>ve?P(Q,ie,de,ve):P(Q,ie,we,ve)},N=function(z,Y){return q(z)-q(Y)},W=N,V=!1,$=function(z){var Y=S,te=z.outerWidth(),ue=te/2,oe=z.outerHeight(),Z=oe/2,Q=z.position(),ie=Q.x-ue,de=Q.x+ue,we=Q.y-Z,Ae=Q.y+Z;return ie<=Y.x&&Y.x<=de&&we<=Y.y&&Y.y<=Ae},X=function(z){return z.same(R)||z.same(_)},ee=y.nodes(function(G){return!X(G)&&M(G)}).sort(W),K=!1;E.nonempty()&&!M(E)&&this.unpreview(E);for(var j=0;j<ee.length;j++){var fe=ee[j];if(!(fe.isParent()&&$(fe))&&!(fe.isChild()&&!$(fe.parent()))&&(fe.same(E)||this.preview(fe,V))){K=!0;break}}return K}function x(y){var E=this,C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,S=this.options,R=this.sourceNode,_=this.ghostNode,A=this.ghostEles,P=this.presumptiveTargets,I=this.previewEles,D=this.active,L=R,M=y.same(_),q=!this.canConnect(y),N=y.same(this.targetNode);if(!D||M||q||N)return!1;this.targetNode.nonempty()&&this.unpreview(this.targetNode),clearTimeout(this.previewTimeout);var W=function(){E.targetNode=y,P.merge(y),y.addClass("eh-presumptive-target"),y.addClass("eh-target"),E.emit("hoverover",E.mp(),L,y),y.addClass("eh-preview"),A.addClass("eh-preview-active"),R.addClass("eh-preview-active"),y.addClass("eh-preview-active"),E.makePreview(),E.emit("previewon",E.mp(),L,y,I)};return C&&S.hoverDelay>0?this.previewTimeout=setTimeout(W,S.hoverDelay):W(),!0}function b(y){if(this.active){var E=this.previewTimeout,C=this.sourceNode,S=this.previewEles,R=this.ghostEles,_=this.cy;clearTimeout(E),this.previewTimeout=null;var A=C;return y.removeClass("eh-preview eh-target eh-presumptive-target eh-preview-active"),R.removeClass("eh-preview-active"),C.removeClass("eh-preview-active"),this.targetNode=_.collection(),this.removePreview(A,y),this.emit("hoverout",this.mp(),A,y),this.emit("previewoff",this.mp(),A,y,S),this}}function w(){if(this.active){var y=this.sourceNode,E=this.targetNode,C=this.ghostEles,S=this.presumptiveTargets;return clearTimeout(this.previewTimeout),y.removeClass("eh-source eh-preview-active"),E.removeClass("eh-target eh-preview eh-hover eh-preview-active"),S.removeClass("eh-presumptive-target"),this.makeEdges(),C.remove(),this.clearCollections(),this.resetGestures(),this.enableEdgeEvents(),this.active=!1,this.emit("stop",this.mp(),y),this}}a.exports={start:h,update:g,preview:x,unpreview:b,stop:w,snap:p,canStartOn:l,canStartDrawModeOn:f,canStartNonDrawModeOn:d}}),(function(a,i,o){var s=o(4),u=o(0),l=o(14),f=o(2),d=o(3),h=o(5),g=o(6),p=o(8),x=o(9),b=o(11),w=o(7);function y(S){var R=S.cy;this.cy=R,this.listeners=[],this.enabled=!0,this.drawMode=!1,this.active=!1,this.grabbingNode=!1,this.clearCollections(),this.mx=0,this.my=0,this.options=u({},s,S),this.saveGestureState(),this.addListeners(),this.throttledSnap=l(this.snap.bind(this),1e3/S.snapFrequency),this.preventDefault=function(P){return P.preventDefault()},this.canConnect=function(){return!1};var _=!1;try{var A=Object.defineProperty({},"passive",{get:function(){_=!0}});window.addEventListener("test",null,A)}catch{}_?this.windowListenerOptions={capture:!0,passive:!1}:this.windowListenerOptions=!0}var E=y.prototype={},C=function(R){return u(E,R)};E.destroy=function(){this.removeListeners()},E.setOptions=function(S){u(this.options,S)},E.mp=function(){return{x:this.mx,y:this.my}},E.hp=function(){return{x:this.hx,y:this.hy}},E.clearCollections=function(){var S=this.cy;this.previewEles=S.collection(),this.ghostEles=S.collection(),this.ghostNode=S.collection(),this.sourceNode=S.collection(),this.targetNode=S.collection(),this.presumptiveTargets=S.collection()},[f,d,h,g,p,x,b,w].forEach(C),a.exports=y}),(function(a,i,o){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(x){return typeof x}:function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x};function u(){var x=this;return this.addCytoscapeListeners(),this.addListener(this.cy,"destroy",function(){return x.destroy()}),this}function l(){for(var x=this.listeners.length-1;x>=0;x--){var b=this.listeners[x];this.removeListener(b.target,b.event,b.selector,b.callback,b.options)}return this}function f(x,b,w,y,E){return(typeof w>"u"?"undefined":s(w))!==s("")&&(y=w,E=y,w=null),E==null&&(E=!1),{target:x,event:b,selector:w,callback:y,options:E}}function d(x){return x instanceof Element}function h(x,b,w,y,E){var C=f(x,b,w,y,E);return this.listeners.push(C),d(C.target)?C.target.addEventListener(C.event,C.callback,C.options):C.selector?C.target.addListener(C.event,C.selector,C.callback,C.options):C.target.addListener(C.event,C.callback,C.options),this}function g(x,b,w,y,E){for(var C=f(x,b,w,y,E),S=this.listeners.length-1;S>=0;S--){var R=this.listeners[S];if(C.target===R.target&&C.event===R.event&&(C.selector==null||C.selector===R.selector)&&(C.callback==null||C.callback===R.callback)){this.listeners.splice(S,1),d(C.target)?C.target.removeEventListener(C.event,C.callback,C.options):C.selector?C.target.removeListener(C.event,C.selector,C.callback,C.options):C.target.removeListener(C.event,C.callback,C.options);break}}return this}function p(x,b){for(var w=this.cy,y=arguments.length,E=Array(y>2?y-2:0),C=2;C<y;C++)E[C-2]=arguments[C];return w.emit({type:"eh"+x,position:b},E),this}a.exports={addListener:h,addListeners:u,removeListener:g,removeListeners:l,emit:p}}),(function(a,i,o){var s=o(1),u=function(f){f&&f("core","edgehandles",s)};typeof cytoscape<"u"&&u(cytoscape),a.exports=u}),(function(a,i){a.exports=t}),(function(a,i){a.exports=n})])})})(Zu)),Zu.exports}var sU=oU();const uU=gl(sU);var ym,sR;function lU(){if(sR)return ym;sR=1;class r{constructor(n,a={}){this._cy=n,this._params=a,this._node_dom={};let i=n.container();if(a.dom_container)this._nodes_dom_container=a.dom_container;else{let o=document.createElement("div");o.style.position="absolute",o.style.zIndex=10,i.querySelector("canvas").parentNode.appendChild(o),this._nodes_dom_container=o}this._resize_observer=new ResizeObserver(o=>{for(let s of o){let u=s.target,l=u.__cy_id;n.getElementById(l).style({width:u.offsetWidth,height:u.offsetHeight,shape:"rectangle"})}}),n.on("add","node",o=>{this._add_node(o.target)}),n.on("remove","node",o=>{this._remove_node(o.target)});for(let o of n.nodes())this._add_node(o);n.on("pan zoom",o=>{let s=n.pan(),u=n.zoom(),l="translate("+s.x+"px,"+s.y+"px) scale("+u+")";this._nodes_dom_container.style.msTransform=l,this._nodes_dom_container.style.transform=l}),n.on("position bounds","node",o=>{let s=o.target,u=s.id();if(!this._node_dom[u])return;let l=this._node_dom[u],f=`translate(-50%, -50%) translate(${s.position("x").toFixed(2)}px, ${s.position("y").toFixed(2)}px)`;l.style.webkitTransform=f,l.style.msTransform=f,l.style.transform=f,l.style.display="inline",l.style.position="absolute",l.style["z-index"]=10})}_add_node(n){let a=n.data();a.dom&&(a.skip_node_append!==!0&&this._nodes_dom_container.appendChild(a.dom),a.dom.__cy_id=n.id(),this._node_dom[n.id()]=a.dom,this._resize_observer.observe(a.dom))}_remove_node(n){let a=n.id(),i=this._node_dom[a];i&&(this._resize_observer.unobserve(i),i.parentNode===this._nodes_dom_container&&this._nodes_dom_container.removeChild(i),delete this._node_dom[a])}node_dom(n){return this._node_dom[n]}update(n,a){let i=this._cy.getElementById(n);if(!i){console.warn(`Node with id ${n} not found`);return}let o=this._node_dom[n];if(!o){console.warn(`DOM element for node ${n} not found`);return}a(o),i.data("dom",o),this._cy.trigger("position",["node",i])}remove(){for(let n in this._node_dom)this._resize_observer.unobserve(this._node_dom[n]);for(;this._nodes_dom_container.firstChild;)this._nodes_dom_container.removeChild(this._nodes_dom_container.firstChild);this._node_dom={},this._cy.removeListener("add","node"),this._cy.removeListener("remove","node"),this._cy.removeListener("pan zoom"),this._cy.removeListener("position bounds","node"),this._params.dom_container||this._nodes_dom_container.parentNode.removeChild(this._nodes_dom_container),this._cy=null,this._params=null,this._nodes_dom_container=null,this._resize_observer=null}}function e(t){t&&t("core","domNode",function(n,a){return new r(this,n,a)})}return typeof cytoscape<"u"&&e(cytoscape),ym=e,ym}var fU=lU();const cU=gl(fU);vn.prototype.hasInitialised||(vn.use(tU),vn.use(uU),vn.use(cU),vn.prototype.hasInitialised=!0);function dU({cyParams:r,cyInst:e,layoutParams:t,layoutDebounce:n=50,children:a,init:i=()=>{},onCyInit:o}){const[s,u]=xe.useState(!1),l=xe.useRef(null),f=xe.useRef(null),d=xe.useRef(null),h=xe.useRef(!0),g=xe.useRef(t);g.current=t;const p=xe.useCallback(()=>{var w;d.current!==null&&d.current.stop(),f.current&&(d.current=f.current.layout(g.current),(w=d.current)==null||w.run())},[]),x=xe.useMemo(()=>xw(p,n),[p,n]);xe.useEffect(()=>()=>{x.cancel()},[x]),xe.useEffect(()=>{var C;if(!l.current)return;const w=vn({container:l.current,...r}),y=(C=l.current.parentElement)==null?void 0:C.querySelector(".cytoscape-react-nodes-and-edges");if(y&&w.domNode({dom_container:y}),f.current=e||w,l.current&&(l.current.cy=f.current),o==null||o(f.current),i(w),l.current&&f.current){const S=l.current.parentElement;let R=0,_=0;S&&(R=S.clientHeight,_=S.clientWidth,R===0&&(R=window.innerHeight-S.getBoundingClientRect().top-100),_===0&&(_=window.innerWidth)),R>0&&_>0&&(l.current.style.width=`${_}px`,l.current.style.height=`${R}px`),f.current.resize(),r.zoom&&r.pan&&f.current.viewport({zoom:r.zoom,pan:r.pan})}u(!0);const E=new ResizeObserver(xw(()=>{if(l.current&&f.current){const S=l.current.parentElement;let R=0,_=0;S&&(R=S.clientHeight,_=S.clientWidth,R===0&&(R=window.innerHeight-S.getBoundingClientRect().top-100),_===0&&(_=window.innerWidth),R>0&&_>0&&(l.current.style.width=`${_}px`,l.current.style.height=`${R}px`));const A=f.current.zoom()!==void 0?{zoom:f.current.zoom(),pan:f.current.pan()}:null;f.current.resize(),A&&f.current.viewport(A)}},50));return l.current&&E.observe(l.current),()=>{E.disconnect();try{w.destroy()}catch{}f.current=null,u(!1)}},[]),xe.useEffect(()=>{h.current?(h.current=!1,p()):x()},[s,t,x,p]);const b=xe.useMemo(()=>{var w;return f.current!==null?((w=xe.Children.map(a,y=>{var E;return y?xe.cloneElement(y,{key:(E=y==null?void 0:y.props)==null?void 0:E.id,cytoInstance:f.current,layout:x}):null}))==null?void 0:w.filter(Boolean))||[]:[]},[a,s,x]);return H.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",background:"transparent"},children:[H.jsx("div",{ref:l,className:"cytoscape-react-cy-container",style:{width:"100%",height:"100%",position:"relative",background:"transparent"}}),H.jsx("div",{className:"cytoscape-react-nodes-and-edges",style:{pointerEvents:"none",position:"absolute",top:0,left:0,transformOrigin:"0 0",zIndex:10},children:b})]})}function vU({cytoInstance:r,id:e,parent:t,label:n,children:a,layout:i,classes:o,styleCallback:s,parentViewProps:u}){const l=xe.useRef(null),f=xe.useRef("");function d(p){s&&p.isParent()&&(p.style("shape","roundrectangle"),p.style(s(u)))}xe.useEffect(()=>{try{if(l.current){const p={id:e,dom:l.current};t&&(p.parent=t),n&&(p.label=n);const x=r.add({data:p,classes:o});d(x),i()}}catch{}return()=>{r.getElementById(e).remove(),i()}},[l,t,n]),xe.useEffect(()=>{const p=l.current;if(!p||typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{const b=`${p.offsetWidth}x${p.offsetHeight}`;b!==f.current&&(f.current=b,i())});return x.observe(p),()=>x.disconnect()},[i]),xe.useEffect(()=>{if(!s)return;const p=r.getElementById(e);p.length&&d(p)},[s,u]);function h(p){return xe.cloneElement(p,{cytoInstance:r,layout:i})}const g=xe.Children.map(a,h);return H.jsx("div",{ref:l,className:"cytoscape-react-node",children:g})}const wI=.4,hU=r=>[{selector:"node",style:{"outline-opacity":0,"background-opacity":0,"background-color":"transparent","border-color":"transparent",color:"transparent","border-opacity":0,"text-valign":"center","text-halign":"center","border-width":0,"outline-width":0,width:60,height:60}},{selector:"node:selected",style:{"overlay-opacity":0,"overlay-color":"transparent"}},{selector:"node:active",style:{"overlay-opacity":0,"overlay-color":"transparent"}},{selector:":parent",style:{shape:"round-rectangle","background-opacity":wI,"corner-radius":50,"line-color":r("light"),"background-color":r(),"border-color":r(),"border-width":6,"border-style":"solid","border-opacity":1,padding:"120px","text-valign":"top","font-size":"70px","font-weight":"bold","text-margin-y":90,"text-background-opacity":0,"text-background-padding":"45px","z-index":1e3,"compound-sizing-wrt-labels":"include",label:"data(label)"}},{selector:"edge",style:{width:6,label:"data(label)","z-index":-100,"control-point-step-size":10,"taxi-direction":"horizontal","curve-style":"round-taxi","edge-distances":"intersection","line-color":r("light"),color:r("light"),"text-rotation":"autorotate","target-arrow-color":r("light"),"source-arrow-color":r("light"),"target-arrow-shape":"triangle","arrow-scale":"3","text-background-color":r("dark"),"text-background-opacity":1,"text-background-padding":"15px","taxi-radius":500,"source-arrow-fill":"filled","target-arrow-fill":"filled","text-max-width":"200px","font-size":"45px","text-wrap":"wrap","text-margin-x":50,"transition-duration":"0.5s","source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","source-distance-from-node":80,"target-distance-from-node":80}},{selector:"edge:loop",style:{"curve-style":"bezier","control-point-step-size":350,"loop-direction":"-90deg","loop-sweep":"-60deg","source-distance-from-node":0,"target-distance-from-node":0}}],xI={padding:20,motionBlur:!1,compound:!0,pixelRatio:"auto",zoomingEnabled:!0,userZoomingEnabled:!0,dragpan:!0,avoidOverlap:!0,panningEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,selectionType:"additive",minZoom:.01,maxZoom:1.5,autoungrabify:!0,styleEnabled:!0,hideEdgesOnViewport:!1,hideLabelsOnViewport:!0,headless:!1,touchTapThreshold:8,desktopTapThreshold:4,touchHoldDuration:500,desktopHoldDuration:1e3,autolock:!1,autounselectify:!1,wheelPanEnabled:!0,wheelPanThreshold:1,wheelPanDebounce:10,wheelAction:"pan"},EI={...xI,pixelRatio:1,motionBlur:!0,textureOnViewport:!0,wheelPanDebounce:20},gU={...EI,hideEdgesOnViewport:!0,hideLabelsOnViewport:!0},pU={name:"dagre",rankDir:"LR",fit:!1,padding:20,spacingFactor:1.3,animate:!1,nodeDimensionsIncludeLabels:!0,ranker:"network-simplex",rankSep:10,nodeSep:5,edgeSep:10,avoidOverlap:!0,edgeWeight:function(r){return 1},minLen:function(r){return 1},useSimpleEdgeFunction:!0,edgeRouting:!0,controlPoints:!0},L0=({name:r,...e})=>{const[t,n]=xe.useState(null),[a,i]=xe.useState(!0),[o,s]=xe.useState(!1);return xe.useEffect(()=>{if(!r||r.length<2){n(null),i(!1);return}i(!0),s(!1),(async()=>{try{let l;if(r.startsWith("Md"))l="md";else if(r.startsWith("Fa"))l="fa6";else if(r.startsWith("Io5"))l="io5";else if(r.startsWith("Io"))l="io";else if(r.startsWith("Ti"))l="ti";else if(r.startsWith("Go"))l="go";else if(r.startsWith("Fi"))l="fi";else if(r.startsWith("Di"))l="di";else if(r.startsWith("Ai"))l="ai";else if(r.startsWith("Bs"))l="bs";else if(r.startsWith("Ri"))l="ri";else if(r.startsWith("Fc"))l="fc";else if(r.startsWith("Gi"))l="gi";else if(r.startsWith("Hi2"))l="hi2";else if(r.startsWith("Hi"))l="hi";else if(r.startsWith("Si"))l="si";else if(r.startsWith("Sl"))l="sl";else if(r.startsWith("Im"))l="im";else if(r.startsWith("Bi"))l="bi";else if(r.startsWith("Pi"))l="pi";else if(r.startsWith("Vsc"))l="vsc";else if(r.startsWith("Tb"))l="tb";else if(r.startsWith("Tfi"))l="tfi";else if(r.startsWith("Cg"))l="cg";else if(r.startsWith("Lia"))l="lia";else if(r.startsWith("Lu"))l="lu";else throw new Error(`Unknown library prefix for icon: ${r}`);let f;switch(l){case"md":f=await import("react-icons/md");break;case"fa6":f=await import("react-icons/fa6");break;case"io5":f=await import("react-icons/io5");break;case"io":f=await import("react-icons/io");break;case"ti":f=await import("react-icons/ti");break;case"go":f=await import("react-icons/go");break;case"fi":f=await import("react-icons/fi");break;case"di":f=await import("react-icons/di");break;case"ai":f=await import("react-icons/ai");break;case"bs":f=await import("react-icons/bs");break;case"ri":f=await import("react-icons/ri");break;case"fc":f=await import("react-icons/fc");break;case"gi":f=await import("react-icons/gi");break;case"hi2":f=await import("react-icons/hi2");break;case"hi":f=await import("react-icons/hi");break;case"si":f=await import("react-icons/si");break;case"sl":f=await import("react-icons/sl");break;case"im":f=await import("react-icons/im");break;case"bi":f=await import("react-icons/bi");break;case"pi":f=await import("react-icons/pi");break;case"vsc":f=await import("react-icons/vsc");break;case"tb":f=await import("react-icons/tb");break;case"tfi":f=await import("react-icons/tfi");break;case"cg":f=await import("react-icons/cg");break;case"lia":f=await import("react-icons/lia");break;case"lu":f=await import("react-icons/lu");break;default:throw new Error(`Unsupported library: ${l}`)}const d=f[r];if(!d)throw new Error(`Icon ${r} not found in library ${l}`);n(()=>d)}catch(l){console.warn(`Failed to load icon ${r}:`,l.message),s(!0),n(null)}finally{i(!1)}})()},[r]),a||!t?null:H.jsx(t,{...e})},uR=({icon:r,label:e,onClick:t,color:n,boxSize:a=6,...i})=>{const{background:o,border:s,colorText:u}=Rn();return H.jsxs(Re.Tooltip.Root,{positioning:{placement:i.placement||"top"},children:[H.jsx(Re.Tooltip.Trigger,{asChild:!0,children:H.jsx(Re.Flex,{children:H.jsx(Re.Icon,{as:r,boxSize:a,color:n,cursor:t?"pointer":void 0,onClick:t})})}),H.jsx(Re.Tooltip.Positioner,{children:H.jsx(Re.Tooltip.Content,{bgColor:i.bgColor||o,borderColor:i.borderColor||s,borderWidth:1,color:i.textColor||u,borderRadius:15,fontWeight:300,fontSize:"sm",p:2,px:4,shadow:"none",children:e})})]})},yU=({data:r,children:e,isInverted:t,isParent:n})=>{var W,V;const{selectedNodeIds:a,setSelectedNodeIds:i,setSelectedEdgeId:o,isMultiSelectMode:s,isPerformanceMode:u,cyRef:l,callbacks:f,config:d,themeColor:h,direction:g}=en(),{background:p,border:x,colorText:b}=Rn(),w=xe.useRef(null),y=xe.useRef(null),[E,C]=xe.useState(!1),[S,R]=xe.useState(!1),_=r==null?void 0:r.id,A=a.includes(_),P=d.nodeOverlayActions,I=d.renderNodeOverlay,D=(()=>{var $;try{const X=($=l.current)==null?void 0:$.zoom();return X!==void 0&&X<.08}catch{return!1}})(),L=xe.useCallback(()=>{var $,X,ee,K;if(!S)if(o(null),($=l.current)==null||$.edges(":selected").unselect(),s){const j=a.includes(_),fe=j?a.filter(G=>G!==_):[...a,_];i(fe),j?(X=f.onNodeDeselect)==null||X.call(f):(ee=f.onNodeSelect)==null||ee.call(f,_,r)}else i([_]),(K=f.onNodeSelect)==null||K.call(f,_,r)},[_,r,a,s,S,i,o,l,f]),M=xe.useCallback(()=>{var $;S||($=f.onNodeDoubleClick)==null||$.call(f,_,r)},[_,r,S,f]),q=xe.useCallback(()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>C(!0),100)},[]),N=xe.useCallback(()=>{y.current&&clearTimeout(y.current),C(!1)},[]);return n?H.jsxs(Re.Box,{ref:w,onClick:L,onDoubleClick:M,onMouseEnter:q,onMouseLeave:N,cursor:"pointer",position:"relative",children:[!u&&(I||P&&P.length>0)&&E&&!D&&H.jsxs(H.Fragment,{children:[H.jsx(Re.Box,{position:"absolute",top:-150,left:"0",right:"0",height:"150px",pointerEvents:"auto",onMouseEnter:()=>C(!0),onMouseLeave:N}),I?H.jsx(Re.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",onMouseEnter:()=>C(!0),onMouseLeave:N,willChange:"transform",children:I({nodeId:_,nodeData:r,isRoot:_==="root",isParent:!0,isHovered:E,setIsHovered:C})}):H.jsx(Re.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",bg:p,p:3,borderColor:x,borderWidth:1,borderRadius:15,pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",boxShadow:"lg",onMouseEnter:()=>C(!0),onMouseLeave:N,willChange:"transform",children:H.jsx(Re.HStack,{px:2,gap:2,children:P.map(($,X)=>H.jsxs(Re.Box,{display:"contents",children:[X>0&&H.jsx(Re.Box,{borderColor:x,height:5,borderRightWidth:1}),H.jsx(uR,{icon:$.icon,label:$.label,color:b,bgColor:p,borderColor:x,textColor:b,boxSize:5,onClick:ee=>{var K;ee.stopPropagation(),(K=f.onNodeHoverAction)==null||K.call(f,$.id,_,r)}})]},$.id))})})]}),e({id:_,data:r,isActive:A,isLowZoom:D,isEditing:S,onEditStart:()=>R(!0),onEditEnd:()=>R(!1)}),((W=r==null?void 0:r.config)==null?void 0:W.collapsed)!==void 0&&(()=>{var ee;const $=g==="TB"||g==="BT",X=t||g==="RL";return H.jsx(Re.IconButton,{position:"absolute",...$?{[g==="BT"?"top":"bottom"]:"-75px",left:"50%",transform:"translateX(-50%)"}:{right:X?void 0:"-75px",left:X?"-75px":void 0,top:"50%",transform:"translateY(-50%)"},"aria-label":r.config.collapsed?"Expand":"Collapse",onClick:K=>{var j;K.stopPropagation(),(j=f.onNodeCollapse)==null||j.call(f,_,!r.config.collapsed)},bgColor:zr(((ee=r==null?void 0:r.viewProps)==null?void 0:ee.bgColor)||h),size:"md",color:"gray.100",rounded:"full",mr:2,px:2,py:4,children:r.config.collapsed?H.jsx(rr.PiPlusBold,{size:30,color:"gray.800"}):H.jsx(rr.PiMinusBold,{size:30,color:"gray.800"})})})()]}):H.jsxs(Re.Box,{ref:w,onClick:L,onDoubleClick:M,onMouseEnter:q,onMouseLeave:N,cursor:"pointer",transition:"transform 0.1s ease",position:"relative",children:[!u&&(I||P&&P.length>0)&&E&&!D&&H.jsxs(H.Fragment,{children:[H.jsx(Re.Box,{position:"absolute",top:-150,left:"0",right:"0",height:"150px",pointerEvents:"auto",onMouseEnter:()=>C(!0),onMouseLeave:N}),I?H.jsx(Re.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",onMouseEnter:()=>C(!0),onMouseLeave:N,willChange:"transform",children:I({nodeId:_,nodeData:r,isRoot:_==="root",isParent:!!n,isHovered:E,setIsHovered:C})}):H.jsx(Re.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",bg:p,p:3,borderColor:x,borderWidth:1,borderRadius:15,pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",boxShadow:"lg",onMouseEnter:()=>C(!0),onMouseLeave:N,willChange:"transform",children:H.jsx(Re.HStack,{px:2,gap:2,children:P.map(($,X)=>H.jsxs(Re.Box,{display:"contents",children:[X>0&&H.jsx(Re.Box,{borderColor:x,height:5,borderRightWidth:1}),H.jsx(uR,{icon:$.icon,label:$.label,color:b,bgColor:p,borderColor:x,textColor:b,boxSize:5,onClick:ee=>{var K;ee.stopPropagation(),(K=f.onNodeHoverAction)==null||K.call(f,$.id,_,r)}})]},$.id))})})]}),H.jsxs(Re.Box,{position:"relative",display:"flex",h:"100%",w:"100%",children:[((V=r==null?void 0:r.config)==null?void 0:V.collapsed)!==void 0&&!n&&(()=>{var ee;const $=g==="TB"||g==="BT",X=t||g==="RL";return H.jsx(Re.IconButton,{position:"absolute",...$?{[g==="BT"?"top":"bottom"]:"-75px",left:"50%",transform:"translateX(-50%)"}:{right:X?void 0:"-75px",left:X?"-75px":void 0,alignSelf:"center"},"aria-label":r.config.collapsed?"Expand":"Collapse",onClick:K=>{var j;K.stopPropagation(),(j=f.onNodeCollapse)==null||j.call(f,_,!r.config.collapsed)},bgColor:zr(((ee=r==null?void 0:r.viewProps)==null?void 0:ee.bgColor)||h),size:"md",color:"gray.100",rounded:"full",mr:2,px:2,py:4,children:r.config.collapsed?H.jsx(rr.PiPlusBold,{size:30,color:"gray.800"}):H.jsx(rr.PiMinusBold,{size:30,color:"gray.800"})})})(),e({id:_,data:r,isActive:A,isLowZoom:D,isEditing:S,onEditStart:()=>R(!0),onEditEnd:()=>R(!1)})]})]})},ef=xe.memo(yU);function CI(r=!0){const e=xe.useRef(null);return xe.useEffect(()=>{if(!r||!e.current)return;const t=i=>{i.stopPropagation()},n=e.current,a=["mousedown","mouseup","click","dblclick","pointerdown","pointerup","wheel"];return a.forEach(i=>n.addEventListener(i,t)),()=>{a.forEach(i=>n.removeEventListener(i,t))}},[r]),e}const _I=({nodeId:r,label:e,color:t,fontWeight:n="bold",fontSize:a="5xl",isEditing:i,onEditStart:o,onEditEnd:s})=>{const{callbacks:u,config:l,readOnly:f}=en(),d=l.editable&&!f,[h,g]=xe.useState(e),p=xe.useRef(null),x=xe.useRef(!1),b=CI(i);xe.useEffect(()=>{i&&(x.current=!1,p.current&&(p.current.focus(),p.current.select()))},[i]);const w=()=>{var E;if(x.current)return;x.current=!0;const y=h.trim();y&&y!==e&&((E=u.onNodeLabelChange)==null||E.call(u,r,y)),s()};return!d||!i?H.jsx(Re.Text,{color:t,fontWeight:n,fontSize:a,onDoubleClick:d?y=>{y.stopPropagation(),g(e),o()}:void 0,cursor:d?"text":void 0,children:e}):H.jsx("div",{ref:b,children:H.jsx(Re.Input,{ref:p,value:h,onChange:y=>g(y.target.value),onBlur:w,onKeyDown:y=>{y.key==="Enter"&&w(),y.key==="Escape"&&s()},color:t,fontWeight:n,fontSize:a,bg:"transparent",borderWidth:0,p:0,h:"auto",lineHeight:"normal"})})},mU=({id:r,data:e,isActive:t,isEditing:n,onEditStart:a,onEditEnd:i})=>{var d,h,g;const{themeColor:o}=en(),{bgColor:s,borderColor:u,textColor:l}=bs(((d=e==null?void 0:e.viewProps)==null?void 0:d.bgColor)||o),f=zr(((h=e==null?void 0:e.viewProps)==null?void 0:h.textColor)||l);return H.jsx(Re.Box,{borderRadius:(g=e==null?void 0:e.viewProps)==null?void 0:g.borderRadius,bgColor:s,borderColor:t?"white":u,_hover:{borderColor:"white"},borderWidth:2,py:14,px:20,whiteSpace:"normal",children:H.jsx(Re.Flex,{justifyContent:"start",w:900,fontSize:"5xl",lineHeight:"normal",children:H.jsx(_I,{nodeId:r,label:(e==null?void 0:e.label)||(e==null?void 0:e.text)||"",color:f,isEditing:n,onEditStart:a,onEditEnd:i})})})},bU=({id:r,isActive:e,data:t,isEditing:n,onEditStart:a,onEditEnd:i})=>{var p,x,b,w;const{themeColor:o}=en(),s=((p=t==null?void 0:t.viewProps)==null?void 0:p.bgColor)||o,{borderColor:u,highlightColor:l,textColor:f}=bs(s),d=zr(((x=t==null?void 0:t.viewProps)==null?void 0:x.textColor)||f),h=zr(((b=t==null?void 0:t.viewProps)==null?void 0:b.borderColor)||u),g=s!=null&&s.startsWith("#")?s:zr(l);return H.jsx(Re.Flex,{align:"center",borderRadius:(w=t==null?void 0:t.viewProps)==null?void 0:w.borderRadius,bgColor:g,style:{backgroundColor:g},textTransform:"capitalize",borderColor:e?"white":h,_hover:{borderColor:"white"},borderWidth:2,px:50,whiteSpace:"nowrap",children:H.jsx(Re.Flex,{justifyContent:"start",py:14,fontSize:"5xl",lineHeight:"normal",w:900,children:H.jsx(_I,{nodeId:r,label:(t==null?void 0:t.label)||(t==null?void 0:t.text)||"",color:d,isEditing:n,onEditStart:a,onEditEnd:i})})})},SI=(r,e)=>{var u,l,f;const t=((u=r==null?void 0:r.viewProps)==null?void 0:u.bgColor)||e,[n]=t.split("."),a=bs(t),i=t!=null&&t.startsWith("#")?zr(t):zr(a.bgColor),o=zr(((l=r==null?void 0:r.viewProps)==null?void 0:l.textColor)||a.textColor),s=zr(((f=r==null?void 0:r.viewProps)==null?void 0:f.borderColor)||a.borderColor);return{...a,bg:t,wordBeforeDot:n,hexbgColor:i,hextextColor:o,hexborderColor:s}},wU=(r,e=350)=>`${String(r).substring(0,e)}${String(r).length>e?"...":""}`,TI=r=>r!=null&&r.includes("root")?r.replace("root","untitled"):r,xU=r=>{const e=Math.max(...Object.keys(r||{}).map(n=>n.length),0);return Math.max(e*28+30,200)},RI=r=>H.jsx(ef,{...r,children:e=>H.jsx(mU,{...e})}),AI=r=>H.jsx(ef,{...r,children:e=>H.jsx(bU,{...e})}),PI=r=>{const{themeColor:e}=en(),[t,n]=xe.useState(!1);return H.jsx(ef,{...r,children:({data:a,isActive:i,isLowZoom:o})=>{var h,g,p,x,b,w,y,E;const s=SI(a,e),u=Object.entries(a.description||{}).length>0,l=xU(a.description),f=(g=(h=r.data)==null?void 0:h.config)==null?void 0:g.icon,d=(x=(p=r.data)==null?void 0:p.config)==null?void 0:x.content;return H.jsx(Re.Flex,{justifyContent:"space-between",...a==null?void 0:a.viewProps,direction:"column",p:0,borderRadius:(b=a==null?void 0:a.viewProps)==null?void 0:b.borderRadius,overflow:"hidden",alignItems:"center",style:{backgroundColor:s.hexbgColor,transition:"border-color 0.2s ease-in-out"},width:"100%",borderColor:i?"white":s.hexborderColor,_hover:{borderColor:"white"},borderWidth:3,children:H.jsxs(Re.Flex,{width:"100%",direction:"column",borderRadius:(w=a==null?void 0:a.viewProps)==null?void 0:w.borderRadius,borderColor:s.hexborderColor,borderWidth:0,overflow:"hidden",children:[a.headerTitle&&H.jsxs(Re.Flex,{justify:"flex-start",direction:"row",p:Object.entries(a.description||{}).length?8:20,borderBottomWidth:1,minWidth:"max-content !important",width:"100%",textTransform:"capitalize",align:d?"left":"center",textOverflow:"ellipsis",alignItems:"center",fontWeight:"bold",color:s.propertyColor,bgColor:s.highlightColor,borderBottomColor:!u&&!d?"transparent":s.hexborderColor,children:[!!f&&H.jsx(Re.Box,{mr:8,justifyContent:"flex-start",height:"100%",w:50,alignItems:"center",rounded:"full",children:H.jsx(L0,{name:f,size:80,color:s.hextextColor},s.hextextColor)}),H.jsx(Re.Text,{fontSize:"5xl",lineClamp:2,textOverflow:"ellipsis",whiteSpace:"nowrap",color:(y=a==null?void 0:a.viewProps)==null?void 0:y.textColor,children:TI(a.headerTitle)}),!!d&&H.jsx(Re.Box,{ml:10,onClick:()=>n(!t),children:t?H.jsx(rr.PiGear,{size:30,style:{cursor:"pointer"}}):H.jsx(rr.PiNotepad,{size:30,style:{cursor:"pointer"}})})]}),d&&!t?H.jsx(Re.Flex,{w:"100%",overflow:"auto",justifyContent:"start",background:s.highlightColor,p:10,fontSize:"5xl",lineHeight:"normal",cursor:"text",children:H.jsx(Re.Text,{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis",color:(E=a==null?void 0:a.viewProps)==null?void 0:E.textColor,children:d})}):H.jsx(Re.Box,{children:Object.entries(a.description||{}).map(([C,S],R)=>{var P,I;const _=kn(s.wordBeforeDot)[typeof S],A=kn(s.wordBeforeDot).property;return H.jsxs(Re.Box,{children:[H.jsxs(Re.Flex,{flexWrap:"nowrap",overflow:"hidden",children:[H.jsx(Re.Flex,{justifyContent:"start",align:"center",background:s.highlightColor,width:`${l}px`,minWidth:`${l}px`,borderRightColor:s.hexborderColor,borderRightWidth:1,children:H.jsx(Re.Text,{py:5,px:10,w:"100%",whiteSpace:"nowrap",fontWeight:"bold",fontSize:"4xl",color:((P=a==null?void 0:a.viewProps)==null?void 0:P.textColor)||A,children:C})}),H.jsx(Re.Flex,{flex:1,justifyContent:"start",overflow:"hidden",p:4,background:s.hexbgColor,w:600,maxH:200,children:H.jsx(Re.Text,{overflow:"hidden",py:3,px:4,whiteSpace:"normal",textOverflow:"ellipsis",fontSize:"4xl",color:((I=a==null?void 0:a.viewProps)==null?void 0:I.textColor)||_,fontWeight:400,children:wU(S)})})]}),R!==Object.entries(a.description||{}).length-1&&H.jsx(Re.Box,{borderTopWidth:1,my:0,borderColor:s.hexborderColor})]},R)})})]})})}})},II=r=>{const{themeColor:e}=en();return H.jsx(ef,{...r,children:({data:t,isActive:n})=>{var o,s,u,l;const a=SI(t,e),i=(s=(o=r.data)==null?void 0:o.config)==null?void 0:s.icon;return H.jsx(Re.Flex,{justifyContent:"space-between",...t==null?void 0:t.viewProps,direction:"column",p:0,borderRadius:((u=t==null?void 0:t.viewProps)==null?void 0:u.borderRadius)||15,overflow:"hidden",bgColor:a.bgColor,position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",style:{backgroundColor:a.hexbgColor,transition:"border-color 0.2s ease-in-out"},borderColor:n?"white":a.hexborderColor,_hover:{borderColor:"white"},borderWidth:3,children:t.headerTitle&&H.jsxs(Re.Flex,{justify:"flex-start",direction:"row",p:20,borderBottomWidth:1,minWidth:"max-content !important",width:"100%",textTransform:"capitalize",align:"center",alignItems:"center",fontWeight:"bold",color:a.propertyColor,bgColor:a.highlightColor,borderBottomColor:a.hexborderColor,children:[!!i&&H.jsx(Re.Box,{mr:8,justifyContent:"flex-start",height:"100%",w:50,alignItems:"center",rounded:"full",children:H.jsx(L0,{name:i,size:80,color:a.hextextColor},a.hextextColor)}),H.jsx(Re.Text,{fontSize:"5xl",lineClamp:2,textOverflow:"ellipsis",whiteSpace:"nowrap",color:(l=t==null?void 0:t.viewProps)==null?void 0:l.textColor,children:TI(t.headerTitle)})]})})}})};RI.displayName="text";AI.displayName="arrayView";PI.displayName="NodeJsonObjectView";II.displayName="ParentContainerView";const EU={objectView:PI,arrayView:AI,text:RI,parentContainer:II},CU=({children:r,pattern:e="dot",backgroundColor:t})=>{const{colorMode:n}=en(),a=n==="dark",i=a?"--chakra-colors-gray-700":"--chakra-colors-gray-500",o=a?"--chakra-colors-gray-700":"--chakra-colors-gray-800";return e==="none"?H.jsx(Re.Box,{width:"100%",height:"100%",padding:0,bg:t,children:r}):H.jsxs(Re.Box,{position:"relative",width:"100%",height:"100%",padding:0,bg:t,children:[H.jsx(Re.Box,{position:"absolute",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",zIndex:0,pointerEvents:"none",style:{backgroundImage:e==="dot"?`radial-gradient(var(${i}) 8%, transparent 8%)`:e==="steel"?`repeating-linear-gradient(45deg, var(${o}) 0, var(${o}) 1px, transparent 1px, transparent 20px)`:`linear-gradient(var(${o}) 1px, transparent 1px), linear-gradient(90deg, var(${o}) 1px, transparent 1px)`,backgroundSize:"20px 20px",opacity:.3}}),H.jsx(Re.Box,{position:"relative",width:"100%",height:"100%",zIndex:1,padding:0,children:r})]})},_U=({nodes:r,edges:e})=>{const{themeColor:t,edgeColor:n,direction:a,parentNodeStyle:i,cyRef:o,callbacks:s,config:u,selectedNodeIds:l,setSelectedNodeIds:f,setSelectedEdgeId:d,setIsPerformanceMode:h,isZoomMode:g,setIsZoomMode:p,isMultiSelectMode:x,setIsMultiSelectMode:b,isDragMode:w,setIsDragMode:y,isEdgeHandlesEnabled:E,isArrayNodeMode:C}=en(),S=xe.useRef(null),R=xe.useRef(null),_=xe.useRef(C),A=r.length>200;xe.useEffect(()=>{h(A)},[A,h]);const{edgeSep:P,rankSep:I}=xe.useMemo(()=>aN(r.length),[r.length]),{bgColor:D}=bs(t),{canvas:L,borderSecondary:M}=Rn(),q=u.backgroundColor||L,N=xe.useCallback(re=>{if(re!=null&&re.includes("gray"))return"whitesmoke";if(!re)return zr(t);switch(re){case"dark":return zr(q);case"light":return zr(M);default:return zr(re)}},[t,q,M]),W=u.colorMode==="dark",V=xe.useMemo(()=>N(W?D:"light"),[W,D,N]),$=n?N(n):V,X=xe.useMemo(()=>hU(N),[N]),ee=u.initialViewport||{pan:{x:0,y:0},zoom:.01},K=xe.useMemo(()=>({...A?gU:r.length>100?EI:xI,style:X,zoom:ee.zoom,pan:ee.pan,minZoom:u.minZoom??.01,maxZoom:u.maxZoom??1.5}),[X,ee,r.length,u.minZoom,u.maxZoom]),j=xe.useRef(!1),fe=xe.useRef();xe.useEffect(()=>()=>{clearTimeout(fe.current)},[]);const G=a==="C"?"LR":a,z=xe.useMemo(()=>({...pU,...G&&{rankDir:G},edgeSep:P,rankSep:I,get animate(){return j.current&&!A},animationDuration:300,animationEasing:"ease-in-out-cubic",stop:()=>{o.current&&(j.current||setTimeout(()=>{var re;(re=o.current)==null||re.fit(void 0,50)},100),clearTimeout(fe.current),fe.current=setTimeout(()=>{j.current=!0},500))}}),[G,P,I,o,A]),Y=xe.useCallback(re=>{const ce={...i,...re};return{...ce,bgColor:ce.bgColor||t,bgOpacity:ce.bgOpacity??wI}},[i,t]),te=xe.useCallback(re=>{const ce=Y(re),_e=zr(ce.bgColor),me={shape:"round-rectangle","background-color":_e,"background-opacity":ce.bgOpacity,"border-color":ce.borderColor?zr(ce.borderColor):_e,color:ce.textColor?zr(ce.textColor):_e,"corner-radius":ce.borderRadius??50};return ce.borderWidth!==void 0&&(me["border-width"]=ce.borderWidth),ce.borderStyle&&(me["border-style"]=ce.borderStyle),ce.fontSize!==void 0&&(me["font-size"]=`${ce.fontSize}px`),ce.padding!==void 0&&(me.padding=`${ce.padding}px`),ce.labelPosition&&(me["text-valign"]=ce.labelPosition,me["text-margin-y"]=ce.labelPosition==="top"?90:ce.labelPosition==="bottom"?-90:0),me},[Y]),ue=xe.useMemo(()=>{var ce;const re=new Map;for(const _e of r)(ce=_e.data)!=null&&ce.id&&re.set(_e.data.id,_e);return re},[r]),oe=xe.useMemo(()=>{var _e,me;const re=new Map;for(const Te of e){const De=(_e=Te.data)==null?void 0:_e.source,Ne=(me=Te.data)==null?void 0:me.target;if(!De||!Ne||De===Ne)continue;const ze=De<Ne?`${De}|${Ne}`:`${Ne}|${De}`,$e=re.get(ze);$e?$e.push({id:Te.data.id,source:De}):re.set(ze,[{id:Te.data.id,source:De}])}const ce=new Map;for(const[Te,De]of re){if(De.length<2)continue;const Ne=Te.split("|")[0],ze=Math.min(20,70/De.length);De.forEach(({id:$e,source:ke},Oe)=>{const ye=50+(Oe-(De.length-1)/2)*ze;ce.set($e,`${ke===Ne?ye:100-ye}%`)})}return ce},[e]),Z=xe.useCallback((re,ce,_e,me)=>{var ke,Oe,ye,O,ne,he;let Te={};me!=null&&me.isInverted&&(me==null?void 0:me.source)===ce&&(Te["target-arrow-shape"]="none",Te["source-arrow-shape"]="triangle"),me!=null&&me.isEdgeAnimated?(Te["line-style"]="dashed",Te["line-dash-pattern"]=[32,18],Te["line-dash-offset"]=0):me!=null&&me.isEdgeDashed?(Te["line-style"]="dashed",Te["line-dash-pattern"]=[],Te["line-dash-offset"]=0):(Te["line-style"]="solid",Te["line-dash-pattern"]=[],Te["line-dash-offset"]=0),G==="TB"&&(Te["taxi-direction"]="downward"),G==="BT"&&(Te["taxi-direction"]="upward"),G==="LR"&&(Te["taxi-direction"]="rightward"),G==="RL"&&(Te["taxi-direction"]="leftward"),Te["taxi-turn"]=oe.get(me==null?void 0:me.id)??"50%";const De=me!=null&&me.color?zr(me.color):$;Te["line-color"]=De,Te.color=De,Te["target-arrow-color"]=De,Te["source-arrow-color"]=De;const Ne=N("dark");Te["text-background-color"]=Ne;const ze=(Oe=(ke=ue.get(me==null?void 0:me.source))==null?void 0:ke.data)==null?void 0:Oe.parent,$e=(O=(ye=ue.get(me==null?void 0:me.target))==null?void 0:ye.data)==null?void 0:O.parent;if(ze&&ze===$e){const ge=Y((he=(ne=ue.get(ze))==null?void 0:ne.data)==null?void 0:he.viewProps),be=Zq(Ne,zr(ge.bgColor),ge.bgOpacity);be&&(Te["text-background-color"]=be)}return Te},[$,G,oe,ue,Y,N]),Q=xe.useRef(ue);Q.current=ue;const ie=xe.useRef(te);ie.current=te,xe.useEffect(()=>{if(!o.current)return;const re=o.current,ce=Te=>{var Ne;const De=Q.current.get(Te.id());Te.style(ie.current((Ne=De==null?void 0:De.data)==null?void 0:Ne.viewProps))},_e=Te=>{const De=Te.target;if(!De.isNode())return;De.isParent()&&ce(De);const Ne=De.parent();Ne.length&&ce(Ne)},me=Te=>{const De=Te.target;De.isNode()&&De.isParent()&&De.style("shape")==="rectangle"&&ce(De)};return re.on("add",_e),re.on("style","node",me),()=>{re.off("add",_e),re.off("style","node",me)}},[]),xe.useEffect(()=>{if(!o.current)return;const re=o.current;re.startBatch(),re.nodes(":parent").forEach(ce=>{var me;const _e=ue.get(ce.id());ce.style(te((me=_e==null?void 0:_e.data)==null?void 0:me.viewProps))}),e.forEach(({data:ce})=>{const _e=re.getElementById(ce.id);_e!=null&&_e.length&&(_e.data({isEdgeAnimated:ce.isEdgeAnimated,isEdgeDashed:ce.isEdgeDashed}),_e.style(Z(_e,ce.source,ce.target,ce)))}),re.endBatch()},[ue,e,$,te,Z]);const de=xe.useRef(u);de.current=u;const we=xe.useRef(g);we.current=g;const Ae=xe.useRef(E);Ae.current=E,_.current=C,xe.useEffect(()=>{if(!o.current||!o.current.container)return;const re=o.current,ce=S.current;if(!ce)return;let _e=null,me=null,Te=0,De=0,Ne=0,ze=0,$e=0;const ke=Oe=>{Oe.preventDefault(),Oe.stopPropagation(),we.current||Oe.metaKey||Oe.ctrlKey?(Ne+=Oe.deltaY,ze=Oe.clientX,$e=Oe.clientY,me===null&&(me=requestAnimationFrame(()=>{me=null;const O=de.current,ne=re.zoom(),he=Ne;Ne=0;let ge=ne-he*.05/100;ge=Math.max(O.minZoom??.01,Math.min(O.maxZoom??1.5,ge));const be=ce.getBoundingClientRect();re.zoom({level:ge,renderedPosition:{x:ze-be.left,y:$e-be.top}})}))):(Te+=Oe.deltaX,De+=Oe.deltaY,_e===null&&(_e=requestAnimationFrame(()=>{_e=null;const O=re.pan(),ne=re.zoom(),he=.35,ge=Te,be=De;Te=0,De=0,re.pan({x:O.x+-ge*he/ne,y:O.y+-be*he/ne})})))};return ce.addEventListener("wheel",ke,{passive:!1}),()=>{ce.removeEventListener("wheel",ke),_e!==null&&cancelAnimationFrame(_e),me!==null&&cancelAnimationFrame(me)}},[o.current]),xe.useEffect(()=>{o.current&&o.current.userPanningEnabled(w)},[w]),xe.useEffect(()=>{if(!o.current)return;const re=o.current;re.boxSelectionEnabled(!!x),re.selectionType(x?"additive":"single"),re.userPanningEnabled(!x&&w)},[x,w]),xe.useEffect(()=>{R.current&&(E?R.current.enableDrawMode():R.current.disableDrawMode())},[E]);const ve=xe.useRef(l);ve.current=l,xe.useEffect(()=>{if(u.disableKeyboardShortcuts)return;const re=ce=>{var me,Te;const _e=ce.target;if(!(_e.tagName==="INPUT"||_e.tagName==="TEXTAREA"||_e.isContentEditable)&&((ce.key==="z"||ce.key==="Z")&&p(!we.current),(ce.key==="m"||ce.key==="M")&&b(!x),(ce.key==="d"||ce.key==="D")&&y(!w),(ce.key==="Delete"||ce.key==="Backspace")&&ve.current.length>0)){ce.preventDefault();const De=ve.current.filter(ze=>ze!=="root");if(De.length===0)return;const Ne=o.current;for(const ze of De){const $e=(me=Ne==null?void 0:Ne.getElementById(ze))==null?void 0:me.data();(Te=s.onNodeDelete)==null||Te.call(s,ze,$e||{})}f([])}};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[x,w,p,b,y,u.disableKeyboardShortcuts,s,f,o]),xe.useEffect(()=>()=>{if(o.current)try{o.current.removeAllListeners()}catch{}},[]);const le=xe.useMemo(()=>A?300:r.length>50?150:r.length>20?100:50,[r.length,A]),Me=xe.useMemo(()=>{var ce;const re=new Set;for(const _e of r)(ce=_e.data)!=null&&ce.parent&&re.add(_e.data.parent);return re},[r]),Se=xe.useMemo(()=>{var ce;const re=new Map;for(const _e of e)(ce=_e.data)!=null&&ce.source&&!re.has(_e.data.source)&&re.set(_e.data.source,_e.data);return re},[e]),Ee=u.backgroundPattern||"dot";return H.jsx(CU,{pattern:Ee,backgroundColor:q,children:H.jsx(Re.Box,{ref:S,className:E?"flow-draw-mode":void 0,padding:0,width:"100%",height:"100%",flex:1,position:"relative",children:H.jsxs(dU,{cyParams:K,layoutParams:z,layoutDebounce:le,onCyInit:re=>{var _e;o.current=re,(_e=s.onCyInit)==null||_e.call(s,re);let ce=null;if(re.on("zoom pan",()=>{ce===null&&(ce=requestAnimationFrame(()=>{var me;ce=null,(me=s.onViewportChange)==null||me.call(s,{zoom:re.zoom(),pan:re.pan()})}))}),re.on("select","edge",me=>{var De;const Te=me.target;ve.current.length&&f([]),d(Te.id()),(De=s.onEdgeSelect)==null||De.call(s,Te.id(),Te.data())}),re.on("unselect","edge",()=>{var me;d(null),(me=s.onEdgeDeselect)==null||me.call(s)}),re.on("remove","edge",me=>{var De;const Te=me.target;(De=s.onEdgeRemove)==null||De.call(s,Te.id(),Te.data())}),re.on("boxselect","node",me=>{var Ne;const Te=me.target.id(),De=ve.current;De.includes(Te)||(f([...De,Te]),(Ne=s.onNodeSelect)==null||Ne.call(s,Te,me.target.data()))}),re.on("tap",me=>{var Te;me.target===re&&ve.current.length&&(f([]),(Te=s.onNodeDeselect)==null||Te.call(s))}),re.on("tap",":parent",me=>{var De;const Te=me.target;f([Te.id()]),(De=s.onNodeSelect)==null||De.call(s,Te.id(),Te.data())}),u.edgeHandles!==!1){const me={canConnect:(ze,$e)=>!ze.same($e),edgeParams:(ze,$e)=>({data:{source:ze.id(),target:$e.id(),label:""}}),loopAllowed:()=>!1,hoverDelay:500,snap:!1,snapThreshold:10,snapFrequency:5,noEdgeEventsInDraw:!0,disableBrowserGestures:!0,handlePosition:"left",handleNodes:"node",handleSize:20,handleColor:t||"#0ea5e9",handleOutlineColor:"#B92020FF",handleOutlineWidth:2,handleLineType:"ghost",handleLineWidth:2,preview:!0,ghostEdgeParams:()=>({}),edgeType:()=>"flat",nodeParams:()=>({})},Te=re.edgehandles(me);R.current=Te,Ae.current&&Te.enableDrawMode();let De=null,Ne=null;re.on("ehstart",(ze,$e)=>{Ne=$e;const ke=ze.originalEvent||window.event;if(ke!=null&&ke.clientX&&(ke!=null&&ke.clientY))De={x:ke.clientX,y:ke.clientY};else{const Oe=$e.renderedPosition();De={x:Oe.x,y:Oe.y}}}),re.on("ehcancel",ze=>{if(!De||!Ne)return;const $e=ze.originalEvent||window.event,ke=$e==null?void 0:$e.clientX,Oe=$e==null?void 0:$e.clientY;if(ke&&Oe&&s.onNodeCreate){const ye=Math.abs(ke-De.x),O=Math.abs(Oe-De.y);if(Math.max(ye,O)>30){const ne=re.renderer().projectIntoViewport(ke,Oe);s.onNodeCreate({type:"text",sourceNodeId:Ne.id(),position:{x:ne[0],y:ne[1]},isArrayMode:_.current})}}De=null,Ne=null}),re.on("ehcomplete",(ze,$e,ke)=>{var Oe;(Oe=s.onEdgeCreate)==null||Oe.call(s,$e.id(),ke.id())}),re.on("ehstop",()=>{De=null,Ne=null})}},children:[(r||[]).map(re=>{var Ne,ze,$e,ke,Oe,ye,O,ne,he,ge;const ce=u.customViews||EU,_e=Me.has((Ne=re.data)==null?void 0:Ne.id)&&!((ze=re.data)!=null&&ze.parent),me=_e?(($e=re.data)==null?void 0:$e.label)||((ke=re.data)==null?void 0:ke.headerTitle)||"Container":void 0,Te=_e?ce.parentContainer:ce[re==null?void 0:re.data.type]||ce.text,De=Se.get((Oe=re.data)==null?void 0:Oe.id);return H.jsx(vU,{id:(ye=re.data)==null?void 0:ye.id,parent:(O=re.data)==null?void 0:O.parent,label:me,styleCallback:te,parentViewProps:(ne=re.data)==null?void 0:ne.viewProps,children:xe.createElement(Te,{...re,isInverted:De==null?void 0:De.isInverted,isParent:_e,key:`${(he=re.data)==null?void 0:he.id}-${t}`})},(ge=re.data)==null?void 0:ge.id)}),(e||[]).map(({data:re})=>H.jsx(sN,{id:re==null?void 0:re.id,source:re==null?void 0:re.source,target:re==null?void 0:re.target,label:re==null?void 0:re.label,isPerformanceMode:A,animated:!!(re!=null&&re.isEdgeAnimated),inverted:!!(re!=null&&re.isInverted),edgeData:re,styleCallback:Z},re==null?void 0:re.id))]})})})},SU=xe.memo(_U),TU=".cytoscape-react-nodes-and-edges{position:absolute!important;top:0!important;left:0!important;z-index:10!important;pointer-events:none!important;overflow:visible!important;transform-origin:0 0!important}.cytoscape-react-node{z-index:0!important;overflow:visible!important;pointer-events:auto!important;position:absolute!important;transform-origin:0 0!important}.cytoscape-react-node input,.cytoscape-react-node textarea{pointer-events:auto!important;user-select:text!important;cursor:text!important}.cytoscape-react-edge{overflow:visible!important;pointer-events:none!important}.cytoscape-react-cy-container{width:100%!important;height:100%!important;overflow:visible!important;position:relative!important;background:transparent!important}.cytoscape-react-cy-container canvas{display:inline!important;vertical-align:baseline!important;overflow:visible!important}.cytoscape-react-cy-container>div{overflow:visible!important}.flow-draw-mode .cytoscape-react-node{pointer-events:none!important}.flow-draw-mode .cytoscape-react-node input,.flow-draw-mode .cytoscape-react-node textarea{pointer-events:none!important}.flow-draw-mode .cytoscape-react-cy-container{cursor:crosshair}";let lR=!1;function RU(){if(lR||typeof document>"u")return;const r=document.createElement("style");r.setAttribute("data-flow-sdk",""),r.textContent=TU,document.head.appendChild(r),lR=!0}function AU({title:r="untitled",json:e,nodes:t,edges:n,config:a={},callbacks:i={},className:o,style:s,showBottomBar:u=!0}){RU();const l=a.direction==="C",f=xe.useMemo(()=>e?bR(e,{title:r,isCenter:l}):null,[e,r,l]),d=(f==null?void 0:f.nodes)??t??[],h=(f==null?void 0:f.edges)??n??[],g=xe.useMemo(()=>e&&f?wR(e,f.edges,i,i.onJsonChange):i,[e,f,i]);return H.jsx(Xq,{config:a,callbacks:g,nodes:d,edges:h,children:H.jsxs(Re.Box,{className:o,style:s,width:"100%",height:"100%",position:"relative",overflow:"hidden",children:[H.jsx(SU,{nodes:d,edges:h}),u&&H.jsx(nN,{})]})})}exports.DynamicIcon=L0;exports.FlowDiagram=AU;exports.addChild=gR;exports.addTargetEdge=yR;exports.addressToPath=fi;exports.applyCollapsed=jq;exports.bindSqueedCallbacks=wR;exports.compileSqueed=bR;exports.contentObjTheme=kn;exports.createFlowDiagram=li;exports.getChakraColorHex=zr;exports.getColorVariant=CR;exports.getDarkerHexColor=Ju;exports.getNode=mm;exports.removeEdge=mR;exports.removeNode=pR;exports.resolveEdgeOwner=ml;exports.setCollapsed=vR;exports.setEdgeProp=us;exports.setEdgeStyle=hR;exports.setNodeProp=no;exports.updateNode=pi;exports.useCustomColors=Rn;exports.useStopPropagation=CI;exports.useThemeContentColors=bs;
|
|
1
|
+
"use strict";var Dg=Object.create;var Mt=Object.defineProperty;var Bg=Object.getOwnPropertyDescriptor;var zg=Object.getOwnPropertyNames;var $g=Object.getPrototypeOf,Gg=Object.prototype.hasOwnProperty;var Wg=(e,t,r)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Hg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zg(t))!Gg.call(e,o)&&o!==r&&Mt(e,o,{get:()=>t[o],enumerable:!(n=Bg(t,o))||n.enumerable});return e};var _e=(e,t,r)=>(r=e!=null?Dg($g(e)):{},Hg(t||!e||!e.__esModule?Mt(r,"default",{value:e,enumerable:!0}):r,e));var hr=(e,t,r)=>Wg(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),N=require("@chakra-ui/react"),q=require("react"),Q=require("react-icons/pi"),Oe=[];for(let e=0;e<256;++e)Oe.push((e+256).toString(16).slice(1));function Vg(e,t=0){return(Oe[e[t+0]]+Oe[e[t+1]]+Oe[e[t+2]]+Oe[e[t+3]]+"-"+Oe[e[t+4]]+Oe[e[t+5]]+"-"+Oe[e[t+6]]+Oe[e[t+7]]+"-"+Oe[e[t+8]]+Oe[e[t+9]]+"-"+Oe[e[t+10]]+Oe[e[t+11]]+Oe[e[t+12]]+Oe[e[t+13]]+Oe[e[t+14]]+Oe[e[t+15]]).toLowerCase()}let Pt;const Ug=new Uint8Array(16);function Kg(){if(!Pt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Pt=crypto.getRandomValues.bind(crypto)}return Pt(Ug)}const Zg=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Iu={randomUUID:Zg};function dp(e,t,r){var o;if(Iu.randomUUID&&!e)return Iu.randomUUID();e=e||{};const n=e.random??((o=e.rng)==null?void 0:o.call(e))??Kg();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Vg(n)}var de=Array.isArray;const st={label:"Untitled",description:"",isTask:!1,isLocked:!1},tu={id:null,type:"text",data:{...st,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",borderColor:"transparent",borderRadius:25,borderWidth:0,boxShadow:"none",textOverflow:"ellipsis",fontWeight:"bold",textColor:"gray.800",textAlign:"center"}}},Tu={id:null,type:"objectView",data:{...st,headerTitle:null,viewProps:{width:"100%",borderWidth:2,borderRadius:25,height:"100%",justifyContent:"space-between",flexDirection:"row",textColor:"gray.900"}}},Yg={id:null,type:"arrayView",data:{...st,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",textAlign:"center",borderRadius:25,fontSize:"5xl",borderWidth:2,textOverflow:"ellipsis",wordBreak:"keep-all",fontWeight:"bold",textColor:"gray.900",placeholder:"Start Typing"}}},Au={id:null,type:"workflowStep",data:{...st,viewProps:{width:"max-content !important",maxWidth:350,minWidth:280,height:"100%",borderRadius:15,borderWidth:3}}},Ne=e=>typeof e=="object",fp=e=>Array.isArray(e),Xg=["order","position","selected","locked","grabbed","grabbable","scratch"],ar=e=>Object.entries(e).reduce((t,[r,n])=>(!Ne(n)&&!r.startsWith("$")&&(t[r]=n),t),{}),nu=(e,t)=>typeof e=="string"&&e.startsWith("$")?Ot(e,t):Ne(e)&&!fp(e)?Object.entries(e).reduce((r,[n,o])=>(typeof o=="string"&&o.startsWith("$")&&n==="..."?(delete r["..."],r[n]={...Ot(o,t),...e}):typeof o=="string"&&o.startsWith("$")?r[n]=Ot(o,t):r[n]=o,r),{}):e,sr=e=>Object.entries(e).reduce((t,[r,n])=>(Ne(n)&&r&&n&&!r.startsWith("$")&&(Xg.includes(r)&&(r=r+"#"),t[r]=n),t),{}),gr=(e,t,{label:r,parent:n=void 0},o,i=null)=>(i!==null&&(Ne(i)||fp(i))&&(i=JSON.stringify(i,null,2)),{data:{parent:n,...e.data,id:t,text:r||"",label:r,code:i||null,type:e.type,description:o}}),or=(e,t,r=null,n=null,o=null,i=!1,a=null)=>({data:{id:dp(),source:o?t:e,target:o?e:t,label:n||"",isInverted:o,isEdgeAnimated:i,parent:a}}),ur=(e,t=[])=>{const r={},n={};let o=[];if(e)for(const[i,a]of Object.entries(e))i.startsWith("$")&&i!=="$"?r[i.slice(1)]=a:i!=="$"?n[i]=a:i==="$"&&(o=a);return{newConfig:r,updatedObject:n,arrayObject:o}},wr=(e,t)=>{let r=Tu;const{view:n,borderColor:o,borderRadius:i,bgColor:a,textColor:s,fontSize:l,stepType:u}=t;e=n||e,u?r={...Au}:e==="object"?r=Tu:e==="text"?r=tu:e==="array"?r=Yg:e==="workflowStep"&&(r={...Au});const c=r.data.viewProps;return r.data.viewProps={...c,borderRadius:i||(u?15:53),bgColor:a,borderColor:o,textColor:s,fontSize:l},r.data.config=t,{config:r}},Wr=(e,t)=>(e=t.find(n=>n.data.id===e)?`${e}.#`:e,e),Ot=(e,{ids:t,jsnObjct:r})=>{if(typeof e=="string"&&(e!=null&&e.startsWith("$"))){const n=e.replace("$","").replace("*","");e==null||e.endsWith("*");const o=t.find(s=>s.split(".").slice(-1)[0]===n||n===s);if(!o)return e;const i=Jg(o,r);return JSON.stringify(i).includes(e)?e:i||e}return e},Jg=(e,t)=>{let r=e.split(".").splice(1);return r=r[r.length-1]==="#"||r[r.length-1].includes("{")?r.slice(0,-2):r,(i=>r.reduce((a,s)=>{s=s.replace("[","").replace("]","");const{arrayObject:l}=ur(a);return a=l.length?l:a,a[s]},i))(t)};function Er(e,t="root",r=[]){try{const{arrayObject:n}=ur(e);n.length&&(e=n);const o=ar(e),i=sr(e);return Ne(e)?(de(e)||de(e)&&t==="root"||!de(e)&&Object.keys(o).length||t==="root")&&r.push(t):r.push(t),Object.keys(i).length&&!de(e)?zr({chldPth:null,itrblObjct:i,nodes:r,path:t}):de(e)&&e.forEach((a,s)=>{const l=ar(a),u=sr(a),{newConfig:c,arrayObject:d}=ur(a);let f=`${t}.${s}`;Ne(a)?Object.keys(l).length?(Er(l,f,r),Object.keys(u).length&&!de(a)&&zr({chldPth:f,itrblObjct:u,nodes:r,path:t})):Object.keys(u).length&&!de(a)?zr({chldPth:f,itrblObjct:u,nodes:r,path:t}):de(a)&&hp({chldPth:f,item:a,nodes:r,path:t}):r.push(f)}),{nodes:r}}catch{return{nodes:r}}}const zr=({chldPth:e,itrblObjct:t,nodes:r,path:n})=>Object.entries(t).forEach(([o,i],a)=>{const s=ar(i),l=sr(i),{newConfig:u,arrayObject:c}=ur(i);c.length&&(i=c),n.split(".").slice(0,2).join(".");let d=e?`${e}.${o}`:`${n}.${o}`;if(Ne(i)&&!de(i)){const f=Object.keys(s).length===0;if(f&&(wr("array",u),r.push(d)),Object.keys(s).length){const p=de(i)?`${i.length||""}`:`{${Object.keys(i).length||""}}`;let x=d;f&&(x=`${d}.${p}`),Er(i,x,r)}else Object.keys(l).length&&!de(i)?zr({chldPth:d,itrblObjct:l,path:d,nodes:r}):Er(i,d,r)}else de(i)&&Er(i,d,r)}),hp=({chldPth:e,item:t,nodes:r,path:n})=>t.forEach((o,i)=>{let a=`${e}.${i}`;const s=sr(o),l=ar(o);Ne(o)?!de(o)&&Object.keys(l).length?Er(o,a,r):Object.keys(s).length&&!de(o)?zr({chldPth:a,itrblObjct:s,path:n,nodes:r}):de(o)&&hp({chldPth:a,item:o,nodes:r,path:n}):r.push(a)}),nt=[];let $r;function vr(e,t="root",r=[],n=[],o="untitled",i={hideDefaultObject:!1,sprtObjctKy:!1,isCntr:!1},a={}){if(!e||typeof e!="object")return console.error("Invalid object passed",e),{nodes:r,edges:n};const s=e;if(!$r){const{nodes:c}=Er(e);$r={ids:c,jsnObjct:e}}let{hideDefaultObject:l,sprtObjctKy:u}=i;try{t=Wr(t,r);const{newConfig:c,arrayObject:d}=ur(e),f=Object.keys(a).length>0?a:c;d.length&&(e=d);const p=ar(e),x=sr(e),{label:y,collapsed:g,parent:v}=f;if(!Ne(e))r.push(gr(tu,t,{label:y||t,parent:v},e,s));else if(de(e)||de(e)&&t==="root"){const{config:h}=wr("array",f),b=de(e)?`${e.length||""}`:`{${Object.keys(e).length||""}}`,_=t==="root"?o:`${o} ${b}`;r.push(gr(h,t,{label:y||_,parent:v},e,de(s)?{[o]:s}:s))}else if(!de(e)&&Object.keys(p).length||t==="root"){const{config:h}=wr(null,f),b=de(e)?`${e.length||""}`:`{${Object.keys(e).length||""}}`,_=t.split("."),w=_[_.length-1];let E=isNaN(Number(w))?null:Number(w)+1;const R=isNaN(Number(w))?w:_[_.length-2]+" "+E,I=t==="root"?o:R;let A=!1;Number.isNaN(Number(o))||(A=!0);const k=e;if(y){const{config:M}=wr("object",f);r.push(gr(M,t,{label:y||`${y} ${b}`,parent:v},p,k))}else h.data.headerTitle=I,r.push(gr(h,t,{label:y,parent:v},p,k))}return g||(Object.keys(x).length&&!de(e)?Gr({flowConfig:i,chldPth:null,edges:n,isInverted:null,itrblObjct:x,nodes:r,path:t,newConfig:f}):de(e)&&e.forEach((h,b)=>{h=nu(h,$r);const _=h,w=ar(h),E=sr(h),{newConfig:R,arrayObject:I}=ur(h);I.length&&(h=I);const{config:A}=wr(typeof h=="string"?"text":"array",R),{hideConfig:k,sourceLabel:M,label:z,isEdgeAnimated:G,parent:U}=R;l=l||k;const V=t==="root"&&i.isCntr,X=t.split(".").slice(0,2).join("."),he=nt.includes(X),ee=i.isCntr&&he||b%2===0&&V;let Y=`${t}.${b}`;Y=Wr(Y,r),ee&&nt.push(Y),Ne(h)?Object.keys(w).length&&!de(h)?(n.push(or(t,Y,null,M,ee,G)),vr(h,Y,r,n,z||b,i,R)):Object.keys(E).length&&!de(h)?Gr({flowConfig:i,chldPth:Y,isInverted:ee,edges:n,itrblObjct:E,nodes:r,path:t,newConfig:R,forceIsInverted:!0}):de(h)?pp({flowConfig:i,chldPth:Y,edges:n,isInverted:ee,item:h,nodes:r,path:t}):Ne(h)&&Gr({flowConfig:i,chldPth:Y,isInverted:ee,edges:n,itrblObjct:[h],nodes:r,path:t,newConfig:R}):(n.push(or(t,Y,null,M,ee,G)),r.push(gr(A,Y,{label:z||String(h),parent:U},h,_)))})),{nodes:r,edges:n}}catch{return{nodes:r,edges:n}}}const Gr=({chldPth:e,flowConfig:t,edges:r,itrblObjct:n,nodes:o,isInverted:i,path:a,newConfig:s,forceIsInverted:l=!1})=>{let{hideDefaultObject:u,sprtObjctKy:c}=t;return Object.entries(n).forEach(([d,f],p)=>{f=nu(f,$r);const x=f,y=ar(f),g=sr(f),{newConfig:v,arrayObject:h}=ur(f);h.length&&(f=h);const{hideConfig:b,sourceLabel:_,label:w,content:E,target:R,targetLabel:I,collapsed:A,isEdgeAnimated:k,parent:M}=v;u=u||b;const z=a==="root"&&t.isCntr,G=a.split(".").slice(0,2).join("."),U=nt.includes(G);l||(i=t.isCntr&&U||p%2===0&&z);let V=e?`${e}.${d}`:`${a}.${d}`;if(V=Wr(V,o),i&&nt.push(V),R&&r.push(or(V,R,null,I,i,k)),Ne(f)&&!de(f)){r.push(or(a,V,null,_,i,k));const X=c||Object.keys(y).length===0;if(X){const he=E?"object":"array",{config:ee}=wr(he,v);ee.data.headerTitle=E?w:null,o.push(gr(ee,V,{label:w||d,parent:M},f,x))}if(Object.keys(y).length&&!u){const he=de(f)?` ${f.length||""}`:`{${Object.keys(f).length||""}}`;let ee=V;X&&(ee=`${V}.${he}`,ee=Wr(ee,o),r.push(or(V,ee,null,_,i,k))),vr(f,ee,o,r,w||d,t,v)}else Object.keys(g).length&&!de(f)?Gr({chldPth:V,flowConfig:t,itrblObjct:g,path:V,edges:r,nodes:o,newConfig:v,isInverted:i}):vr(f,V,o,r,d,t,v)}else de(f)&&(r.push(or(a,V,null,_,i,k)),vr(f,V,o,r,d,t,v))})},pp=({flowConfig:e,chldPth:t,edges:r,isInverted:n,item:o,nodes:i,path:a})=>o.forEach((s,l)=>{let u=`${t}.${l}`;u=Wr(u,i);const c=s;s=nu(s,$r);const d=sr(s),f=ar(s),{newConfig:p}=ur(s),{collapsed:x,label:y,parent:g,sourceLabel:v,isEdgeAnimated:h,content:b}=p;Ne(s)?!de(s)&&Object.keys(f).length?(r.push(or(a,u,null,v,n,h)),vr(s,u,i,r,l,e,p)):Object.keys(d).length&&!de(s)&&!x?Gr({chldPth:u,flowConfig:e,itrblObjct:d,path:a,edges:r,nodes:i,isInverted:n,newConfig:p}):de(s)&&pp({flowConfig:e,chldPth:u,edges:r,isInverted:n,item:s,nodes:i,path:a}):(r.push(or(a,u,null,v,n,h)),i.push(gr(tu,u,{label:y||String(s),parent:g},s,c)))});function ut(e){if(!Array.isArray(e==null?void 0:e.$connections))return[];const t=new Map;return e.$connections.flatMap((r,n)=>{if(!r||typeof r!="object")return[];const o=r;if(typeof o.target!="string"||!/^root(?:\.|$)/.test(o.target))return[];if(o.sourceProperty!==void 0&&typeof o.sourceProperty!="string")return[];if(o.targetProperty!==void 0&&typeof o.targetProperty!="string")return[];const i=typeof o.id=="string"&&o.id?JSON.stringify(["id",o.id]):JSON.stringify(["ports",o.target,o.sourceProperty??null,o.targetProperty??null]),a=t.get(i)??0;return t.set(i,a+1),[{value:o,key:`${i}#${a}`,index:n}]})}function gp(e,t,r){const n=ut(e).find(l=>l.key===t);if(!n)return e;const o=r(n.value),i=e.$connections.flatMap((l,u)=>u===n.index?o?[o]:[]:[l]);if(i.length)return{...e,$connections:i};const{$connections:a,...s}=e;return s}function Qg(e){const t=[],r=(n,o)=>{if(!n||typeof n!="object")return n;if(Array.isArray(n))return n.map((i,a)=>r(i,`${o}.${a}`));for(const i of ut(n)){const a=i.value;t.push({data:{id:`connection:${JSON.stringify([o,i.key])}`,source:o,target:a.target,sourceProperty:a.sourceProperty,targetProperty:a.targetProperty,label:typeof a.label=="string"?a.label:void 0,color:typeof a.color=="string"?a.color:void 0,isEdgeDashed:a.style==="dashed",isEdgeAnimated:a.style==="animated",connection:{address:o,key:i.key}}})}return Object.fromEntries(Object.entries(n).filter(([i])=>i!=="$connections").map(([i,a])=>[i,i==="$"?r(a,o):i.startsWith("$")?a:r(a,`${o}.${i}`)]))};return{json:r(e,"root"),edges:t}}const ct="root",Mu=e=>e==="#"||e.startsWith("{")||/^\s\d*$/.test(e);function er(e){const t=e.split(".");for(t[0]===ct&&t.shift();t.length&&Mu(t[t.length-1]);)t.pop();return t.filter(r=>!Mu(r))}function lt(e){return e==null||typeof e!="object"?e:Array.isArray(e.$)?e.$:e}function ir(e,t){return er(t).reduce((r,n)=>{var o;if(r!=null)return(o=lt(r))==null?void 0:o[n]},e)}function ev(e){return Array.isArray(e)?[...e]:{...e}}function Je(e,t,r){const n=er(t),o=(i,a)=>{if(a===n.length)return r(i);const s=n[a],l=lt(i);if(l==null||typeof l!="object")return i;const u=o(l[s],a+1);if(Object.is(u,l[s]))return i;const c=ev(l);return c[s]=u,l!==i?{...i,$:c}:c};return o(e,0)}function Rr(e,t,r){const n=r===""||r===void 0||r===null;if(Array.isArray(e))return n?e:{[t]:r,$:[...e]};const o=e!=null&&typeof e=="object"?{...e}:{};return e!=null&&typeof e!="object"&&(o.$label=String(e)),n?delete o[t]:o[t]=r,o}function Sr(e,t,r,n){return Je(e,t,o=>r==="$label"&&typeof o=="string"&&typeof n=="string"&&n!==""?n:Rr(o,r,n))}const vp=(e,t,r)=>Sr(e,t,"$collapsed",r);function dt(e){if(e.connection)return{address:e.connection.address,kind:"connection"};const t=e.isInverted?e.target:e.source,r=e.isInverted?e.source:e.target,n=er(t).join("."),o=er(r).join(".");return o.startsWith(n?n+".":"")&&o!==n?{address:r,kind:"hierarchy"}:n.startsWith(o?o+".":"")&&n!==o?{address:t,kind:"hierarchy"}:{address:t,kind:"target"}}function Hr(e,t,r,n){if(t.connection){const s=t.connection;return Je(e,s.address,l=>gp(l,s.key,u=>{if(r==="$sourceLabel"||r==="$edgeColor")return Rr(u,r==="$sourceLabel"?"label":"color",n);const c=r==="$isEdgeAnimated"?"animated":"dashed";return n?{...u,style:c}:u.style===c?Rr(u,"style",void 0):u}))}const{address:o,kind:i}=dt(t),a=i==="target"&&r==="$sourceLabel"?"$targetLabel":r;return Je(e,o,s=>Rr(s,a,n))}const yp=(e,t,r)=>Hr(Hr(e,t,"$isEdgeAnimated",r==="animated"||void 0),t,"$isEdgeDashed",r==="dashed"||void 0);function bp(e,t,r,n){let o=n||"";const i=Je(e,t,s=>{const l=lt(s);if(Array.isArray(l)){o=String(l.length);const c=[...l,r];return l===s?c:{...s,$:c}}const u=s!=null&&typeof s=="object"&&!Array.isArray(s)?{...s}:s!=null&&typeof s!="object"?{$label:String(s)}:{};if(!o){let c=1;for(;`node_${c}`in u;)c++;o=`node_${c}`}return u[o]=r,u}),a=er(t);return{json:i,address:[ct,...a,o].join(".")}}function mp(e,t){const r=er(t);if(!r.length)return e;const n=r[r.length-1],o=[ct,...r.slice(0,-1)].join(".");return Je(e,o,i=>{const a=lt(i);if(a==null||typeof a!="object"||!Object.prototype.hasOwnProperty.call(a,n))return i;if(Array.isArray(a)){const u=a.filter((c,d)=>String(d)!==n);return a===i?u:{...i,$:u}}const{[n]:s,...l}=i;return l})}const xp=(e,t,r,n)=>Sr(n?Je(e,t,o=>Rr(o,"$targetLabel",n)):e,t,"$target",r);function _p(e,t,r){const n=ir(e,t);return ut(n).some(({value:i})=>i.target===r.target&&i.sourceProperty===r.sourceProperty&&i.targetProperty===r.targetProperty)?e:Je(e,t,i=>Rr(i,"$connections",[...Array.isArray(i==null?void 0:i.$connections)?i.$connections:[],{...r,id:r.id||dp()}]))}function wp(e,t){if(t.connection){const i=t.connection;return ut(ir(e,i.address)).some(a=>a.key===i.key)?{json:Je(e,i.address,a=>gp(a,i.key,()=>null)),removed:!0}:{json:e,removed:!1}}const{address:r,kind:n}=dt(t);return n!=="target"?{json:e,removed:!1}:{json:Je(e,r,i=>{const{$target:a,$targetLabel:s,...l}=i||{};return l}),removed:!0}}function Cp(e,t={}){const r=Qg(e),{nodes:n,edges:o}=vr(r.json,ct,[],[],t.title||"untitled",{hideDefaultObject:!!t.hideDefaultObject,sprtObjctKy:!!t.separateObjectKeys,isCntr:!!t.isCenter}),i=new Set(n.map(y=>y.data.id)),a=new Map;for(const y of n){const g=y.data.id;if(!g.endsWith(".0")||ir(e,g)!==void 0)continue;const v=g.slice(0,-2),h=ir(e,v);!i.has(v)&&h&&typeof h=="object"&&!Array.isArray(h)&&typeof h.$label=="string"&&Object.keys(h).every(b=>b.startsWith("$")&&b!=="$")&&a.set(g,v)}const s=y=>a.get(y)??y,l=n.map(y=>{var b;const g=s(y.data.id),v=ir(e,g);if(!v||typeof v!="object"||Array.isArray(v))return y;const h={...y.data,id:g};return h.parent&&(h.parent=s(h.parent)),typeof v.$label=="string"&&(h.label=v.$label,h.headerTitle=v.$label),(((b=h.config)==null?void 0:b.collapsed)!==void 0||v.$collapsed!==void 0||v.$icon!==void 0)&&(h.config={...h.config||{}},(v.$collapsed!==void 0||h.config.collapsed!==void 0)&&(h.config.collapsed=!!v.$collapsed),v.$icon!==void 0&&(h.config.icon=v.$icon)),{data:h}}),u=new Map,c=o.map(y=>{const g=s(y.data.source),v=s(y.data.target),h=`${g}->${v}`,b=u.get(h)??0;u.set(h,b+1);const _={...y.data,id:b?`${h}#${b}`:h,source:g,target:v},w=ir(e,dt(_).address);return w&&typeof w=="object"&&(w.$isEdgeAnimated!==void 0&&(_.isEdgeAnimated=!!w.$isEdgeAnimated),w.$isEdgeDashed!==void 0&&(_.isEdgeDashed=!!w.$isEdgeDashed),w.$edgeColor&&(_.color=w.$edgeColor)),{data:_}}),d=new Set(l.map(y=>y.data.id));c.push(...r.edges.filter(y=>d.has(y.data.source)&&d.has(y.data.target)));const f=l.filter(y=>{var g;return(g=y.data.config)==null?void 0:g.collapsed}).map(y=>er(y.data.id));if(!f.length)return{nodes:l,edges:c};const p=l.filter(y=>{const g=er(y.data.id);return!f.some(v=>v.length<g.length&&v.every((h,b)=>h===g[b]))}),x=new Set(p.map(y=>y.data.id));return{nodes:p,edges:c.filter(y=>x.has(y.data.source)&&x.has(y.data.target))}}function rv(e,t){const r=new Set(e.filter(i=>{var a,s;return(s=(a=i.data)==null?void 0:a.config)==null?void 0:s.collapsed}).map(i=>i.data.id));if(!r.size)return{nodes:e,edges:t};const n=new Map;for(const i of t){const a=i.data.isInverted?i.data.target:i.data.source,s=i.data.isInverted?i.data.source:i.data.target;(n.get(a)??n.set(a,[]).get(a)).push(s)}const o=new Set;for(const i of r){const a=[...n.get(i)||[]];for(;a.length;){const s=a.pop();r.has(s)||o.has(s)||(o.add(s),a.push(...n.get(s)||[]))}}return{nodes:e.filter(i=>!o.has(i.data.id)),edges:t.filter(i=>!o.has(i.data.source)&&!o.has(i.data.target))}}function tv(e,t){const r=o=>e&&typeof e=="object"&&o in e;let n=1;for(;r(`${t}_${n}`);)n++;return`${t}_${n}`}function Ep(e,t,r,n){const o=(a,s)=>{a!==e&&(e=a,n==null||n(a,s))},i=a=>{var l;const s=(l=t.find(u=>u.data.id===a))==null?void 0:l.data;return s&&{source:s.source,target:s.target,isInverted:s.isInverted,sourceProperty:s.sourceProperty,targetProperty:s.targetProperty,connection:s.connection}};return{...r,onNodeLabelChange:(a,s)=>{var l;(l=r.onNodeLabelChange)==null||l.call(r,a,s),o(Sr(e,a,"$label",s),{type:"nodeLabel",address:a,key:"$label",value:s})},onNodeColorChange:(a,s,l)=>{var c;(c=r.onNodeColorChange)==null||c.call(r,a,s,l);const u=s==="bg"?"$bgColor":"$textColor";o(Sr(e,a,u,l),{type:"nodeColor",address:a,key:u,value:l})},onNodeIconChange:(a,s)=>{var l;(l=r.onNodeIconChange)==null||l.call(r,a,s),o(Sr(e,a,"$icon",s),{type:"nodeIcon",address:a,key:"$icon",value:s})},onNodeCollapse:(a,s)=>{var l;(l=r.onNodeCollapse)==null||l.call(r,a,s),o(vp(e,a,s),{type:"nodeCollapse",address:a,key:"$collapsed",value:s})},onNodeCreate:a=>{var d;(d=r.onNodeCreate)==null||d.call(r,a);const s=a.sourceNodeId||"root",l=ir(e,s),u=tv(l,a.isArrayMode?"list":"node"),c=bp(e,s,a.isArrayMode?[]:{},u);o(c.json,{type:"nodeCreate",address:c.address,value:a.isArrayMode?"array":"set"})},onNodeDelete:(a,s)=>{var l;(l=r.onNodeDelete)==null||l.call(r,a,s),o(mp(e,a),{type:"nodeDelete",address:a})},onEdgeCreate:(a,s,l)=>{var c;(c=r.onEdgeCreate)==null||c.call(r,a,s,l);const u=l&&(l.sourceProperty!==void 0||l.targetProperty!==void 0)?{...l,target:s}:void 0;o(u?_p(e,a,u):xp(e,a,s),{type:"edgeCreate",address:a,key:u?"$connections":"$target",value:u??s})},onEdgeLabelChange:(a,s)=>{var u;(u=r.onEdgeLabelChange)==null||u.call(r,a,s);const l=i(a);l&&o(Hr(e,l,"$sourceLabel",s),{type:"edgeLabel",edge:l,key:l.connection?"$connections":"$sourceLabel",value:s})},onEdgeStyleChange:(a,s)=>{var u;(u=r.onEdgeStyleChange)==null||u.call(r,a,s);const l=i(a);l&&o(yp(e,l,s),{type:"edgeStyle",edge:l,value:s})},onEdgeColorChange:(a,s)=>{var u;(u=r.onEdgeColorChange)==null||u.call(r,a,s);const l=i(a);l&&o(Hr(e,l,"$edgeColor",s),{type:"edgeColor",edge:l,key:l.connection?"$connections":"$edgeColor",value:s})},onEdgeDelete:(a,s)=>{var c;(c=r.onEdgeDelete)==null||c.call(r,a,s);const l=i(a);if(!l)return;const u=wp(e,l);u.removed&&o(u.json,{type:"edgeDelete",edge:l,key:l.connection?"$connections":"$target"})}}}const Rp=q.createContext(null),Sp=q.createContext({nodeById:new Map,edgeById:new Map,parentIds:new Set});function ou(){return q.useContext(Sp)}function Le(){const e=q.useContext(Rp);if(!e)throw new Error("useFlowDiagramContext must be used within FlowDiagram");return e}function nv({config:e,callbacks:t,nodes:r=[],edges:n=[],children:o}){const i=q.useMemo(()=>{var re,ue,Ce;const F=new Map;for(const ie of r)(re=ie.data)!=null&&re.id&&F.set(ie.data.id,ie);const Z=new Map;for(const ie of n)(ue=ie.data)!=null&&ue.id&&Z.set(ie.data.id,ie);const ne=new Set;for(const ie of r)(Ce=ie.data)!=null&&Ce.parent&&ne.add(ie.data.parent);return{nodeById:F,edgeById:Z,parentIds:ne}},[r,n]),a=q.useRef(null),[s,l]=q.useState([]),[u,c]=q.useState(null),[d,f]=q.useState(!0),[p,x]=q.useState(!1),[y,g]=q.useState(!0),[v,h]=q.useState(e.edgeHandles===!0),[b,_]=q.useState(!1),[w,E]=q.useState(!0),[R,I]=q.useState(!1),A=q.useRef(t);A.current=t;const k=q.useMemo(()=>{const F=Z=>(...ne)=>{var re,ue;return(ue=(re=A.current)==null?void 0:re[Z])==null?void 0:ue.call(re,...ne)};return{onNodeSelect:F("onNodeSelect"),onNodeDeselect:F("onNodeDeselect"),onNodeDoubleClick:F("onNodeDoubleClick"),onNodeCreate:F("onNodeCreate"),onNodeDelete:F("onNodeDelete"),onNodeLabelChange:F("onNodeLabelChange"),onNodeCollapse:F("onNodeCollapse"),onNodeColorChange:F("onNodeColorChange"),onNodeIconChange:F("onNodeIconChange"),onNodeHoverAction:F("onNodeHoverAction"),onEdgeCreate:F("onEdgeCreate"),onEdgeSelect:F("onEdgeSelect"),onEdgeDeselect:F("onEdgeDeselect"),onEdgeRemove:F("onEdgeRemove"),onEdgeDelete:F("onEdgeDelete"),onEdgeColorChange:F("onEdgeColorChange"),onEdgeLabelChange:F("onEdgeLabelChange"),onEdgeStyleChange:F("onEdgeStyleChange"),onViewportChange:F("onViewportChange"),onDirectionChange:F("onDirectionChange"),onArrayModeChange:F("onArrayModeChange"),onInit:F("onInit"),onJsonChange:F("onJsonChange")}},[]),M=e.themeColor||"blue.500",z=e.edgeColor||"",G=e.colorMode||"light",U=e.direction||"LR",V=e.nodeAlignment??"center",X=e.edgeMode??"workflow",he=e.readOnly??!1,ee=JSON.stringify(e.parentNodeStyle??null),Y=q.useMemo(()=>e.parentNodeStyle,[ee]),oe=e.isZoomMode!==void 0?e.isZoomMode:d,pe=e.isMultiSelectMode!==void 0?e.isMultiSelectMode:p,fe=e.isEdgeHandlesEnabled!==void 0?e.isEdgeHandlesEnabled:v,ge=e.isDragMode!==void 0?e.isDragMode:y,S=q.useRef(e);S.current=e;const O=q.useMemo(()=>({get direction(){return S.current.direction},get nodeAlignment(){return S.current.nodeAlignment},get edgeMode(){return S.current.edgeMode},get themeColor(){return S.current.themeColor},get colorMode(){return S.current.colorMode},get readOnly(){return S.current.readOnly},get editable(){return S.current.editable},get minZoom(){return S.current.minZoom},get maxZoom(){return S.current.maxZoom},get backgroundPattern(){return S.current.backgroundPattern},get edgeColor(){return S.current.edgeColor},get parentNodeStyle(){return S.current.parentNodeStyle},get backgroundColor(){return S.current.backgroundColor},get edgeHandles(){return S.current.edgeHandles},get initialViewport(){return S.current.initialViewport},get nodeOverlayActions(){return S.current.nodeOverlayActions},get renderNodeOverlay(){return S.current.renderNodeOverlay},get renderSelectedNodeToolbar(){return S.current.renderSelectedNodeToolbar},get renderSelectedEdgeToolbar(){return S.current.renderSelectedEdgeToolbar},get renderBottomBar(){return S.current.renderBottomBar},get selectionToolbar(){return S.current.selectionToolbar},get customViews(){return S.current.customViews},get disableKeyboardShortcuts(){return S.current.disableKeyboardShortcuts},get isZoomMode(){return S.current.isZoomMode},get isMultiSelectMode(){return S.current.isMultiSelectMode},get isEdgeHandlesEnabled(){return S.current.isEdgeHandlesEnabled},get isDragMode(){return S.current.isDragMode}}),[]),D=q.useMemo(()=>({themeColor:M,edgeColor:z,colorMode:G,direction:U,nodeAlignment:V,edgeMode:X,parentNodeStyle:Y,selectedNodeIds:s,setSelectedNodeIds:l,selectedEdgeId:u,setSelectedEdgeId:c,isZoomMode:oe,setIsZoomMode:f,isMultiSelectMode:pe,setIsMultiSelectMode:x,isDragMode:ge,setIsDragMode:g,isEdgeHandlesEnabled:fe,setIsEdgeHandlesEnabled:h,isArrayNodeMode:b,setIsArrayNodeMode:_,isPinned:w,setIsPinned:E,isPerformanceMode:R,setIsPerformanceMode:I,engineRef:a,callbacks:k,config:O,readOnly:he}),[M,z,G,U,V,X,Y,s,u,oe,pe,ge,fe,b,w,R,he,e.edgeHandles,k,O]);return m.jsx(Rp.Provider,{value:D,children:m.jsx(Sp.Provider,{value:i,children:o})})}function ot(e,t=.2){const r=e.replace(/^#/,""),n=parseInt(r,16);let o=n>>16&255,i=n>>8&255,a=n&255;return o=Math.max(0,Math.floor(o*(1-t))),i=Math.max(0,Math.floor(i*(1-t))),a=Math.max(0,Math.floor(a*(1-t))),"#"+((1<<24)+(o<<16)+(i<<8)+a).toString(16).slice(1).toUpperCase()}function ov(e,t,r){const n=s=>{const l=/^#?([0-9a-f]{6})$/i.exec((s==null?void 0:s.trim())??"");return l?parseInt(l[1],16):null},o=n(e),i=n(t);if(o===null||i===null)return null;const a=s=>Math.round((o>>s&255)*(1-r)+(i>>s&255)*r);return"#"+((1<<24)+(a(16)<<16)+(a(8)<<8)+a(0)).toString(16).slice(1).toUpperCase()}const Ye=e=>e!=null&&e.startsWith("#")?{background:e,highlight:ot(e,.1),border:ot(e,.5),property:"gray.900",boolean:"green.200",string:"gray.900",number:"orange.800"}:e==="gray"?{background:"gray.950",highlight:"gray.800",border:"gray.700",property:"gray.200",boolean:"green.400",string:"gray.200",number:"orange.600"}:e==="white"?{background:"white",highlight:"gray.200",border:"gray.400",property:"gray.900",boolean:"green.400",string:"gray.900",number:"orange.600"}:{background:e+".100",highlight:e+".200",border:e+".700",property:"gray.900",boolean:"green.800",string:"gray.900",number:"orange.800"},qp=e=>{let t=e;if(t!=null&&t.startsWith("#"))return{secondary:ot(e)};let r=String(Number(e.slice(-3))+200);r=e.slice(0,-3).concat(r);let n=String(Number(e.slice(-3))-100);return n=e.slice(0,-3).concat(n),{primary:t,secondary:r,light:n}},Pu={red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#EBF8FF",100:"#BEE3F8",200:"#90CDF4",300:"#63B3ED",400:"#4299E1",500:"#3182CE",600:"#2B6CB0",700:"#2C5282",800:"#2A4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923",950:"#0d1117"}},Se=(e,t)=>{var i;if(e!=null&&e.startsWith("#"))return e;if(!e)return"whitesmoke";const r=e.replace(/\./g,"-");try{const s=getComputedStyle(document.documentElement).getPropertyValue(`--chakra-colors-${r}`).trim();if(s&&s!=="")return s}catch{}const[n,o]=e.split(".");return n&&o&&((i=Pu[n])!=null&&i[Number(o)])?Pu[n][Number(o)]:`var(--chakra-colors-${r})`};function Pe(e,t,r){return e?r:t}function Vr(e){const[t]=(e==null?void 0:e.split("."))||[],{secondary:r}=qp(e),n=Ye(t).background,o=Ye(t).highlight,i=Ye(t).border,a=Ye(t).property,s=Ye(t).property;let l=Ye(t).background,u=Ye(t).highlight;return l=Se(l)+50,u=Se(u)+20,{bgColor:n,highlightColor:o,borderColor:i,textColor:a,propertyColor:s,secondary:r,bgColorFaint:l,highlightColorFaint:u}}function $e(e=null){const{colorMode:t}=Le(),r=e==null?void 0:e.includes("gray"),n=t==="dark",o=Pe(n,"white","gray.900"),i=Pe(n,"gray.100","gray.800"),a=Pe(n,"gray.200","blackAlpha.400"),s=Pe(n,"gray.200","blackAlpha.600"),l=Pe(n,"gray.500","gray.700"),u=Pe(n,"gray.700","gray.700"),c=Pe(n,"gray.900","gray.900"),d=Pe(n,"gray.400","gray.500"),f=Pe(n,"gray.400","gray.700"),p=Pe(n,"gray.900","gray.200"),x=Pe(n,r?"gray.900":"gray.200",r?"gray.200":"gray.900"),y=Pe(n,"gray.900","gray.200"),g=Pe(n,e&&"#000000",e||"#ffffff"),v=Pe(n,e||"#ffffff",e?"#000000":"#ffffff"),h=u,b=Pe(n,"gray.300","gray.800"),_=Pe(n,"white","blackAlpha.400"),w=Pe(n,"green.100","green.700");return{canvas:o,background:i,backgroundSecondary:a,darkBackgroundSecondary:s,border:l,darkColor:c,backgroundWhiteColor:_,borderSecondary:u,colorActive:d,colorInactive:f,iconColor:y,moreIconColor:h,colorText:p,themedColorText:x,logoColor:g,logoColorSecondary:v,darkColorActive:b,greenColor:w}}var Nr=(e=>(e.TOP_DOWN="TB",e.BOTTOM_UP="BT",e.LEFT_RIGHT="LR",e.RIGHT_LEFT="RL",e.CENTER="C",e))(Nr||{});function Me({label:e,children:t}){if(!N.Tooltip.Root){const r=N.Tooltip;return m.jsx(r,{label:e,placement:"top",fontSize:"xs",children:t})}return m.jsxs(N.Tooltip.Root,{positioning:{placement:"top"},children:[m.jsx(N.Tooltip.Trigger,{asChild:!0,children:t}),m.jsx(N.Tooltip.Positioner,{children:m.jsx(N.Tooltip.Content,{fontSize:"xs",children:e})})]})}function je({icon:e,...t}){return m.jsx(N.IconButton,{...t,children:e})}const iv=["blue.500","teal.500","green.500","yellow.500","orange.500","red.500","purple.500","pink.500","gray.500"],av=["gray.900","gray.600","gray.200","white"];function Ip(){const{config:e}=Le(),t=e.selectionToolbar||{},r=new Set(t.hide||[]);return{palette:t.palette||iv,show:n=>!r.has(n)}}function Xe(){const{border:e}=$e();return m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:e})}function Tp({onClick:e}){const{colorText:t}=$e();return m.jsx(Me,{label:"Close",children:m.jsx(je,{"aria-label":"Close selection tools",icon:m.jsx(N.Icon,{as:Q.PiX,boxSize:5}),size:"sm",variant:"ghost",color:t,onClick:e})})}function eu({value:e,placeholder:t,ariaLabel:r,width:n="140px",onCommit:o}){const{colorText:i}=$e(),[a,s]=q.useState(e),l=q.useRef(!1);q.useEffect(()=>s(e),[e]);const u=()=>{if(l.current)return;l.current=!0;const c=a.trim();c!==e&&o(c)};return m.jsx(N.Input,{"aria-label":r,size:"xs",w:n,value:a,placeholder:t,color:i,borderWidth:0,_focusVisible:{boxShadow:"none",outline:"none"},borderRadius:"8px",onFocus:()=>{l.current=!1},onChange:c=>s(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&(u(),c.target.blur()),c.key==="Escape"&&(l.current=!0,s(e),c.target.blur())}})}function ru({colors:e,value:t,label:r,onPick:n,onReset:o}){const{colorInactive:i}=$e();return m.jsxs(N.HStack,{gap:1,"aria-label":r,role:"group",children:[e.map(a=>{const s=t===a;return m.jsx(Me,{label:`${r}: ${a}`,children:m.jsx(N.Box,{as:"button","aria-label":`${r} ${a}`,"aria-pressed":s,w:4,h:4,borderRadius:"full",cursor:"pointer",style:{backgroundColor:Se(a)},outline:s?"2px solid white":"none",outlineOffset:"1px",_hover:{transform:"scale(1.15)"},onClick:()=>n(a)})},a)}),o&&m.jsx(Me,{label:`Reset ${r.toLowerCase()}`,children:m.jsx(je,{"aria-label":`Reset ${r}`,icon:m.jsx(N.Icon,{as:Q.PiEraser,boxSize:4}),size:"xs",variant:"ghost",color:i,onClick:o})})]})}function sv({edgeId:e,onClose:t}){var d;const{callbacks:r,themeColor:n}=Le(),{colorInactive:o}=$e(),{edgeById:i}=ou(),{palette:a,show:s}=Ip(),l=(d=i.get(e))==null?void 0:d.data,u=l!=null&&l.isEdgeAnimated?"animated":l!=null&&l.isEdgeDashed?"dashed":"solid",c=[{key:"solid",icon:Q.PiLineSegment,label:"Solid"},{key:"dashed",icon:Q.PiLineSegments,label:"Dashed"},{key:"animated",icon:Q.PiFastForward,label:"Animated"}];return m.jsxs(m.Fragment,{children:[m.jsx(Tp,{onClick:t}),s("label")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(eu,{ariaLabel:"Edge label",placeholder:"Edge label",value:(l==null?void 0:l.label)||"",onCommit:f=>{var p;return(p=r.onEdgeLabelChange)==null?void 0:p.call(r,e,f)}})]}),s("style")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),c.map(f=>m.jsx(Me,{label:f.label,children:m.jsx(je,{"aria-label":`Edge style ${f.key}`,"aria-pressed":u===f.key,icon:m.jsx(N.Icon,{as:f.icon,boxSize:5}),size:"sm",variant:"ghost",color:u===f.key?n:o,onClick:()=>{var p;return(p=r.onEdgeStyleChange)==null?void 0:p.call(r,e,f.key)}})},f.key))]}),s("color")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(ru,{label:"Edge color",colors:a,value:l==null?void 0:l.color,onPick:f=>{var p;return(p=r.onEdgeColorChange)==null?void 0:p.call(r,e,f)},onReset:()=>{var f;return(f=r.onEdgeColorChange)==null?void 0:f.call(r,e,"")}})]}),s("delete")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(Me,{label:"Delete edge",children:m.jsx(je,{"aria-label":"Delete edge",icon:m.jsx(N.Icon,{as:Q.PiTrash,boxSize:5}),size:"sm",variant:"ghost",color:"red.400",onClick:()=>{var f;(f=r.onEdgeDelete)==null||f.call(r,e,l),t()}})})]})]})}function uv({ids:e,onClose:t}){var p,x,y,g,v;const{callbacks:r,colorMode:n}=Le(),{colorText:o,colorInactive:i}=$e(),{nodeById:a}=ou(),{palette:s,show:l}=Ip(),u=e.length===1,c=u?(p=a.get(e[0]))==null?void 0:p.data:void 0,d=(x=c==null?void 0:c.config)==null?void 0:x.collapsed,f=h=>e.forEach(h);return m.jsxs(m.Fragment,{children:[m.jsx(Tp,{onClick:t}),m.jsx(Xe,{}),u&&l("label")?m.jsx(eu,{ariaLabel:"Node label",placeholder:"Node label",value:(c==null?void 0:c.label)??(c==null?void 0:c.headerTitle)??"",onCommit:h=>{var b;return(b=r.onNodeLabelChange)==null?void 0:b.call(r,e[0],h)}}):m.jsxs(N.Text,{fontSize:"xs",color:o,whiteSpace:"nowrap",px:1,children:[e.length," selected"]}),l("color")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(ru,{label:"Background",colors:s,value:(y=c==null?void 0:c.viewProps)==null?void 0:y.bgColor,onPick:h=>f(b=>{var _;return(_=r.onNodeColorChange)==null?void 0:_.call(r,b,"bg",h)}),onReset:()=>f(h=>{var b;return(b=r.onNodeColorChange)==null?void 0:b.call(r,h,"bg","")})})]}),l("textColor")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(ru,{label:"Text color",colors:av,value:(g=c==null?void 0:c.viewProps)==null?void 0:g.textColor,onPick:h=>f(b=>{var _;return(_=r.onNodeColorChange)==null?void 0:_.call(r,b,"text",h)}),onReset:()=>f(h=>{var b;return(b=r.onNodeColorChange)==null?void 0:b.call(r,h,"text","")})})]}),u&&l("icon")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(eu,{ariaLabel:"Node icon",placeholder:"Icon (e.g. PiGear)",width:"120px",value:((v=c==null?void 0:c.config)==null?void 0:v.icon)||"",onCommit:h=>{var b;return(b=r.onNodeIconChange)==null?void 0:b.call(r,e[0],h)}})]}),u&&l("collapse")&&d!==void 0&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(Me,{label:d?"Expand":"Collapse",children:m.jsx(je,{"aria-label":d?"Expand node":"Collapse node",icon:m.jsx(N.Icon,{as:d?Q.PiArrowsOutLineVertical:Q.PiArrowsInLineVertical,boxSize:5}),size:"sm",variant:"ghost",color:i,onClick:()=>{var h;return(h=r.onNodeCollapse)==null?void 0:h.call(r,e[0],!d)}})})]}),l("delete")&&m.jsxs(m.Fragment,{children:[m.jsx(Xe,{}),m.jsx(Me,{label:u?"Delete node":`Delete ${e.length} nodes`,children:m.jsx(je,{"aria-label":"Delete selected nodes",icon:m.jsx(N.Icon,{as:Q.PiTrash,boxSize:5}),size:"sm",variant:"ghost",color:n==="dark"?"red.300":"red.500",onClick:()=>{f(h=>{var b,_;return(_=r.onNodeDelete)==null?void 0:_.call(r,h,((b=a.get(h))==null?void 0:b.data)||{id:h})}),t()}})})]})]})}const cv=[{value:"BT",label:"Bottom to Up",icon:Q.PiArrowUp,flowType:Nr.BOTTOM_UP},{value:"TB",label:"Top to Bottom",icon:Q.PiArrowDown,flowType:Nr.TOP_DOWN},{value:"LR",label:"Left to Right",icon:Q.PiArrowRight,flowType:Nr.LEFT_RIGHT},{value:"RL",label:"Right to Left",icon:Q.PiArrowLeft,flowType:Nr.RIGHT_LEFT}],Ap=()=>{const{engineRef:e,themeColor:t,direction:r,selectedNodeIds:n,setSelectedNodeIds:o,selectedEdgeId:i,setSelectedEdgeId:a,isZoomMode:s,setIsZoomMode:l,isMultiSelectMode:u,setIsMultiSelectMode:c,isDragMode:d,setIsDragMode:f,isEdgeHandlesEnabled:p,setIsEdgeHandlesEnabled:x,isArrayNodeMode:y,setIsArrayNodeMode:g,isPinned:v,setIsPinned:h,callbacks:b,config:_,readOnly:w}=Le(),{nodeById:E,edgeById:R,parentIds:I}=ou(),A=_.colorMode==="dark",{background:k,border:M,colorInactive:z,colorText:G,colorActive:U,darkBackgroundSecondary:V}=$e(),[X,he]=q.useState(!1),[ee,Y]=q.useState(!0),oe=q.useCallback(W=>{const ye=e.current;if(!ye)return;const K=_.minZoom??.01,we=_.maxZoom??1.5,Ae=.02;let Ie=ye.zoom();switch(W){case"increase":Ie=Math.min(we,Ie+Ae),ye.zoom(Ie),ye.center();break;case"decrease":Ie=Math.max(K,Ie-Ae),ye.zoom(Ie),ye.center();break;case"reset":ye.fit(50);break}},[e,_.minZoom,_.maxZoom]),pe=_.renderSelectedNodeToolbar,fe=n.length>0&&!!pe,ge=q.useMemo(()=>fe?n.map(W=>{var K;return{...((K=E.get(W))==null?void 0:K.data)??{id:W},isParent:I.has(W)}}):[],[fe,n,E,I]),S=q.useCallback(()=>{var W;o([]),(W=b.onNodeDeselect)==null||W.call(b)},[o,b]),O=_.renderSelectedEdgeToolbar,D=!!i&&!!O,F=q.useMemo(()=>{var W;return!D||!i?null:((W=R.get(i))==null?void 0:W.data)??{id:i}},[D,i,R]),Z=q.useCallback(()=>{var W;a(null),(W=b.onEdgeDeselect)==null||W.call(b)},[a,b]),ne=_.selectionToolbar!==!1&&!w,re=ne&&!!i&&!O,ue=ne&&!re&&n.length>0&&!pe,Ce=re||ue;q.useEffect(()=>{Ce&&h(!0)},[Ce,h]);const ie=v||X||Ce,ve=_.renderBottomBar;return ve?m.jsxs(m.Fragment,{children:[fe&&m.jsx(N.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:pe({selectedNodeIds:n,selectedNodeData:ge,onDeselect:S})}),D&&F&&m.jsx(N.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:O({edgeId:i,edgeData:F,onDeselect:Z})}),m.jsx(N.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",children:ve({zoomIn:()=>oe("increase"),zoomOut:()=>oe("decrease"),resetZoom:()=>oe("reset"),direction:r,isZoomMode:s,setIsZoomMode:l,isMultiSelectMode:u,setIsMultiSelectMode:c,isDragMode:d,setIsDragMode:f,isEdgeHandlesEnabled:p,setIsEdgeHandlesEnabled:x,isArrayNodeMode:y,setIsArrayNodeMode:g,selectedNodeIds:n,selectedNodeData:ge,selectedEdgeId:i,selectedEdgeData:F,onNodeDeselect:S,onEdgeDeselect:Z,callbacks:b})})]}):m.jsxs(m.Fragment,{children:[fe&&m.jsx(N.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:pe({selectedNodeIds:n,selectedNodeData:ge,onDeselect:S})}),D&&F&&m.jsx(N.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:O({edgeId:i,edgeData:F,onDeselect:Z})}),!v&&m.jsx(N.Box,{position:"absolute",bottom:5,left:0,zIndex:101,w:3,children:m.jsx(Me,{label:"Show Bottom Bar",children:m.jsx(N.chakra.button,{type:"button","aria-label":"Show Bottom Bar",display:"flex",alignItems:"center",bg:k,borderColor:M,borderWidth:1,py:6,px:0,w:4,h:50,borderRadius:"15px",borderLeftRadius:0,onMouseEnter:()=>h(!0),onClick:()=>h(!0),_hover:{bg:V},children:m.jsx(N.Icon,{ml:-1,as:Q.PiLineVerticalBold,boxSize:5,color:M})})})}),m.jsx(N.Box,{role:"toolbar","aria-label":"Diagram controls",position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",transition:"opacity 0.3s ease-in, transform 0.3s ease",transform:ie?"translateY(0)":"translateY(100%)",pointerEvents:ie?"auto":"none",visibility:ie?"visible":"hidden",opacity:ie?1:0,children:m.jsxs(N.Flex,{w:"100%",px:5,position:"absolute",bottom:5,flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[m.jsx(N.Box,{bg:k,alignContent:"center",h:50,borderColor:M,borderWidth:1,borderRadius:"15px",children:m.jsx(N.HStack,{px:2,gap:1,children:re?m.jsx(sv,{edgeId:i,onClose:Z}):ue?m.jsx(uv,{ids:n,onClose:S}):m.jsxs(m.Fragment,{children:[m.jsx(Me,{label:v?"Unpin":"Pin",children:m.jsx(je,{"aria-label":"Pin",icon:m.jsx(N.Icon,{as:v?Q.PiPushPinFill:Q.PiPushPin,boxSize:5}),size:"sm",variant:"ghost",color:v?t:z,onClick:()=>{h(!v),he(!1)}})}),m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:M}),m.jsx(Me,{label:"Zoom Out",children:m.jsx(je,{"aria-label":"Zoom out",icon:m.jsx(N.Icon,{as:Q.PiMinus,boxSize:5}),size:"sm",variant:"ghost",color:G,onClick:()=>oe("decrease")})}),m.jsx(Me,{label:"Zoom In",children:m.jsx(je,{"aria-label":"Zoom in",icon:m.jsx(N.Icon,{as:Q.PiPlus,boxSize:5}),size:"sm",variant:"ghost",color:G,onClick:()=>oe("increase")})}),m.jsx(Me,{label:"Reset Zoom",children:m.jsx(je,{"aria-label":"Reset zoom",icon:m.jsx(N.Icon,{as:Q.PiArrowCounterClockwise,boxSize:5}),size:"sm",variant:"ghost",color:G,onClick:()=>oe("reset")})}),!ee&&m.jsxs(m.Fragment,{children:[m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:M}),m.jsx(Me,{label:s?"Zoom Mode (z)":"Pan Mode (z)",children:m.jsx(je,{"aria-label":"Toggle zoom mode",icon:m.jsx(N.Icon,{as:s?Q.PiMagnifyingGlassPlus:Q.PiArrowsOutCardinal,boxSize:5}),size:"sm",variant:"ghost",color:s?t:z,onClick:()=>l(!s)})}),m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:M}),m.jsx(Me,{label:u?"Multi-Select On (m)":"Multi-Select Off (m)",children:m.jsx(je,{"aria-label":"Toggle multi-select",icon:m.jsx(N.Icon,{as:Q.PiSelectionPlus,boxSize:5}),size:"sm",variant:"ghost",color:u?t:z,onClick:()=>c(!u)})}),m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:M}),m.jsx(Me,{label:d?"Drag Mode On (d)":"Drag Mode Off (d)",children:m.jsx(je,{"aria-label":"Toggle drag mode",icon:m.jsx(N.Icon,{as:Q.PiHandGrabbing,boxSize:5}),size:"sm",variant:"ghost",color:d?t:z,onClick:()=>f(!d)})}),_.edgeHandles!==!1&&m.jsxs(m.Fragment,{children:[m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:M}),m.jsx(Me,{label:p?"Draw Mode On":"Draw Mode Off",children:m.jsx(je,{"aria-label":"Toggle draw mode",icon:m.jsx(N.Icon,{as:Q.PiPencilSimpleLine,boxSize:5}),size:"sm",variant:"ghost",color:p?t:z,onClick:()=>x(!p)})})]}),m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:M}),m.jsx(Me,{label:y?"Array Mode [ ]":"Set Mode { }",children:m.jsx(je,{"aria-label":"Toggle array mode",icon:m.jsx(N.Icon,{as:y?Q.PiBracketsSquare:Q.PiBracketsCurly,boxSize:5}),size:"sm",variant:"ghost",color:y?t:z,onClick:()=>{var ye;const W=!y;g(W),(ye=b.onArrayModeChange)==null||ye.call(b,W)}})})]}),m.jsx(N.Icon,{mx:-1,as:Q.PiLineVerticalThin,boxSize:5,color:M}),m.jsx(Me,{label:ee?"Expand toolbar":"Collapse toolbar",children:m.jsx(je,{"aria-label":"Toggle toolbar collapse",icon:m.jsx(N.Icon,{as:ee?Q.PiCaretRight:Q.PiCaretLeft,boxSize:5}),size:"sm",variant:"ghost",color:z,onClick:()=>Y(!ee)})})]})})}),!Ce&&m.jsxs(N.Box,{position:"relative",ml:"auto",children:[m.jsx(N.Box,{bg:k,borderWidth:1,borderColor:M,borderRadius:"15px",h:50,px:3,cursor:"pointer",onClick:()=>he(!X),children:m.jsxs(N.Flex,{align:"center",h:"100%",children:[m.jsx(Me,{label:"Flow Direction",children:m.jsx(je,{"aria-label":"Direction",icon:m.jsx(N.Icon,{as:Q.PiCaretUp,boxSize:5}),size:"sm",variant:"ghost",color:z})}),m.jsx(N.Text,{fontSize:"xs",color:A?"whiteAlpha.600":"blackAlpha.500",ml:1,children:r})]})}),X&&m.jsx(N.Box,{position:"absolute",bottom:"100%",right:0,pb:"10px",zIndex:200,children:m.jsxs(N.Box,{bg:k,borderWidth:1,borderColor:M,borderRadius:"15px",p:2,minW:"180px",shadow:"lg",children:[cv.map(W=>m.jsxs(N.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:A?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var ye;(ye=b.onDirectionChange)==null||ye.call(b,W.value),he(!1)},children:[m.jsx(N.Icon,{as:W.icon,boxSize:5,color:G}),m.jsx(N.Text,{fontSize:"sm",color:G,flex:1,whiteSpace:"nowrap",children:W.label}),r===W.value&&m.jsx(N.Icon,{as:Q.PiCheck,boxSize:4,color:U})]},W.value)),m.jsxs(N.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:A?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var W;(W=b.onDirectionChange)==null||W.call(b,"C"),he(!1)},children:[m.jsx(N.Icon,{as:Q.PiAlignCenterHorizontal,boxSize:5,color:G}),m.jsx(N.Text,{fontSize:"sm",color:G,flex:1,whiteSpace:"nowrap",children:"Center"}),r==="C"&&m.jsx(N.Icon,{as:Q.PiCheck,boxSize:4,color:U})]})]})})]})]})})]})};Ap.displayName="BottomBar";const lv=q.memo(Ap),dv=e=>{const n=1/(Math.cbrt(e)*.8);let o=Math.round(650*n),i=Math.round(350*n);return o=Math.max(40,Math.min(450,o)),i=Math.max(30,Math.min(300,i)),{edgeSep:o,rankSep:i}},ft='"Helvetica Neue", Helvetica, sans-serif';let kr;const Qr=new Map;function iu(e,t){const r=`${t}|${e}`,n=Qr.get(r);if(n!==void 0)return n;kr===void 0&&(kr=typeof document<"u"?document.createElement("canvas").getContext("2d"):null);let o;return kr?(kr.font=t,o=kr.measureText(e).width):o=e.length*(parseFloat(t)||16)*.55,Qr.size>5e3&&Qr.clear(),Qr.set(r,o),o}function fv(e,t,r){const n=[];for(const o of String(e).split(`
|
|
2
|
+
`)){const i=o.split(/\s+/).filter(Boolean);if(!i.length){n.push("");continue}let a="";for(const s of i){const l=a?`${a} ${s}`:s;!a||iu(l,t)<=r?a=l:(n.push(a),a=s)}n.push(a)}return n}const hv=e=>e.stopPropagation();function pv({id:e,rect:t,label:r,style:n,onSelect:o}){const i=t.x2-t.x1,a=t.y2-t.y1,s=n.borderWidth,l=n.borderStyle==="dashed"?`${s*4} ${s*2}`:n.borderStyle==="dotted"?`${s} ${s}`:void 0,u=t.x1+i/2,c=n.labelPosition==="top"?t.y1+n.labelMargin-n.fontSize/2:n.labelPosition==="bottom"?t.y2-n.labelMargin+n.fontSize/2:t.y1+a/2;return m.jsxs("g",{className:"flow-sdk-container","data-node-id":e,onPointerDown:hv,onClick:d=>{d.stopPropagation(),o==null||o(e)},children:[m.jsx("rect",{x:t.x1,y:t.y1,width:i,height:a,rx:n.borderRadius,ry:n.borderRadius,fill:n.bgColor,fillOpacity:n.bgOpacity,stroke:n.borderColor,strokeWidth:n.borderStyle==="double"?s/3:s,strokeDasharray:l}),n.borderStyle==="double"&&m.jsx("rect",{x:t.x1+s*2/3,y:t.y1+s*2/3,width:Math.max(0,i-s*4/3),height:Math.max(0,a-s*4/3),rx:Math.max(0,n.borderRadius-s*2/3),ry:Math.max(0,n.borderRadius-s*2/3),fill:"none",stroke:n.borderColor,strokeWidth:s/3}),r&&m.jsx("text",{x:u,y:c,fill:n.textColor,fontSize:n.fontSize,fontWeight:"bold",fontFamily:ft,textAnchor:"middle",dominantBaseline:"central",children:r})]})}const gv=q.memo(pv),qr=e=>({x1:e.x-e.w/2,y1:e.y-e.h/2,x2:e.x+e.w/2,y2:e.y+e.h/2}),vv=e=>({x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2,w:e.x2-e.x1,h:e.y2-e.y1});function yv(e){if(!e.length)return null;const t={...e[0]};for(let r=1;r<e.length;r++)t.x1=Math.min(t.x1,e[r].x1),t.y1=Math.min(t.y1,e[r].y1),t.x2=Math.max(t.x2,e[r].x2),t.y2=Math.max(t.y2,e[r].y2);return t}const bv=(e,t)=>e.x1<=t.x2&&e.x2>=t.x1&&e.y1<=t.y2&&e.y2>=t.y1,Ou=(e,t)=>e.x>=t.x1&&e.x<=t.x2&&e.y>=t.y1&&e.y<=t.y2,Cr=e=>(Math.round(e*10)/10).toString(),Be=e=>`${Cr(e.x)} ${Cr(e.y)}`,mv=e=>e>0?1:e<0?-1:0,ju=(e,t)=>e>0?Math.max(e-t,0):Math.min(e+t,0);function xv(e,t,r,n,o=10){const i=t.x-e.x,a=t.y-e.y,s=ju(i,(e.w+t.w)/2),l=ju(a,(e.h+t.h)/2),u=r==="downward"||r==="upward",c=u?l:s,d=u?a:i,f=mv(d),p=n*c,x=h=>Math.abs(h)<o||Math.abs(h)>=Math.abs(c),y=x(p)||x(Math.abs(c)-Math.abs(p));let g;if(y)if(u)if(Math.abs(d)<=e.h/2){const h=(e.x+t.x)/2;g=[h,e.y,h,t.y]}else if(Math.abs(i)<=t.w/2){const h=(e.y+t.y)/2;g=[e.x,h,t.x,h]}else g=[e.x,t.y];else if(Math.abs(d)<=e.w/2){const h=(e.y+t.y)/2;g=[e.x,h,t.x,h]}else if(Math.abs(a)<=t.h/2){const h=(e.x+t.x)/2;g=[h,e.y,h,t.y]}else g=[t.x,e.y];else if(u){const h=e.y+p+e.h/2*f;g=[e.x,h,t.x,h]}else{const h=e.x+p+e.w/2*f;g=[h,e.y,h,t.y]}const v=[{x:e.x,y:e.y}];for(let h=0;h<g.length;h+=2)v.push({x:g[h],y:g[h+1]});return v.push({x:t.x,y:t.y}),v}function it(e,t,r){const n=t.x-e.x,o=t.y-e.y,i=n>0?(r.x2-e.x)/n:n<0?(r.x1-e.x)/n:1/0,a=o>0?(r.y2-e.y)/o:o<0?(r.y1-e.y)/o:1/0,s=Math.min(i,a);return!Number.isFinite(s)||s>=1||s<0?null:{x:e.x+n*s,y:e.y+o*s}}function ze(e,t,r){const n=e.x-t.x,o=e.y-t.y,i=Math.hypot(n,o);if(!i)return e;let a=(i-r)/i;return a<0&&(a=1e-5),{x:t.x+a*n,y:t.y+a*o}}function Ir(e,t,r){const n=e.x-t.x,o=e.y-t.y,i=Math.hypot(n,o)||1,a=n/i,s=o/i,l=.3*r,u=.15*r,c=e.x-a*l,d=e.y-s*l;return`M${Be(e)} L${Cr(c-s*u)} ${Cr(d+a*u)} L${Cr(c+s*u)} ${Cr(d-a*u)} Z`}function Lr(e,t){let r=Math.atan(t/e);return e===0&&r<0&&(r=-r),Number.isFinite(r)||(r=0),r*180/Math.PI}function _v(e,t,r,n){const o={x:t.x-e.x,y:t.y-e.y},i={x:r.x-t.x,y:r.y-t.y},a=Math.hypot(o.x,o.y),s=Math.hypot(i.x,i.y),l=o.x*i.y-o.y*i.x;if(a<1e-6||s<1e-6||Math.abs(l)<1e-6)return{p1:t,b:t,p2:t,r:0};const u=Math.min(n,a/2,s/2);return{p1:{x:t.x-o.x/a*u,y:t.y-o.y/a*u},b:t,p2:{x:t.x+i.x/s*u,y:t.y+i.y/s*u},r:u}}function wv(e,t,r,n){const o=qr(t),i=qr(r);let a=-1,s=null;for(let g=0;g<e.length-1;g++){const v=it(e[g],e[g+1],o);if(v){a=g,s=v;break}}let l=-1,u=null;for(let g=e.length-1;g>0;g--){const v=it(e[g],e[g-1],i);if(v){l=g,u=v;break}}if(!s||!u||a>=l)return null;const c=e.slice(a+1,l),d=c[0]??u,f=c[c.length-1]??s;let p,x,y;if(n.arrowAt==="source"){const g=ze(s,d,n.srcDist);p=ze(s,d,n.srcDist+n.arrowGap),y=Ir(g,d,n.arrowSize)}else p=ze(s,d,n.srcDist);if(n.arrowAt==="target"){const g=ze(u,f,n.tgtDist);x=ze(u,f,n.tgtDist+n.arrowGap),y=Ir(g,f,n.arrowSize)}else x=ze(u,f,n.tgtDist);return Mp(p,c,x,y,n.radius)}function Mp(e,t,r,n,o){const i=[e,...t,r],a=[];let s=`M${Be(e)}`;for(let c=1;c<i.length-1;c++){const d=_v(i[c-1],i[c],i[c+1],o);a.push(d),d.r===0?s+=` L${Be(d.b)}`:s+=` L${Be(d.p1)} Q${Be(d.b)} ${Be(d.p2)}`}s+=` L${Be(r)}`;let l;const u=t.length;if(u===0)l={x:(e.x+r.x)/2,y:(e.y+r.y)/2,angle:Lr(r.x-e.x,r.y-e.y)};else if(u%2===0){const c=t[u/2-1],d=t[u/2];l={x:(c.x+d.x)/2,y:(c.y+d.y)/2,angle:Lr(d.x-c.x,d.y-c.y)}}else{const c=a[(u-1)/2];if(c.r===0){const d=i[(u-1)/2+2];l={x:c.b.x,y:c.b.y,angle:Lr(d.x-c.b.x,d.y-c.b.y)}}else l={x:.25*c.p1.x+.5*c.b.x+.25*c.p2.x,y:.25*c.p1.y+.5*c.b.y+.25*c.p2.y,angle:Lr(c.p2.x-c.p1.x,c.p2.y-c.p1.y)}}return{d:s,arrow:n,label:l}}function Cv(e,t,r,n,o,i,a){const s=r==="leftward"?-1:1,l={x:e.x+s*(e.w/2+a.srcDist),y:n??e.y},u={x:t.x-s*(t.w/2+a.tgtDist),y:o??t.y},c=Math.max(80,a.arrowGap+a.arrowSize*.3),d=l.x+s*c,f=u.x-s*c;let p;if(s*(f-d)>=0){const v=l.x+(u.x-l.x)*i,h=Math.max(Math.min(d,f),Math.min(Math.max(d,f),v));p=[{x:h,y:l.y},{x:h,y:u.y}]}else{const v=Math.min(e.y-e.h/2,t.y-t.h/2)-c*(1+i);p=[{x:d,y:l.y},{x:d,y:v},{x:f,y:v},{x:f,y:u.y}]}const x=a.arrowAt==="source"?ze(l,p[0],a.arrowGap):l,y=a.arrowAt==="target"?ze(u,p[p.length-1],a.arrowGap):u,g=a.arrowAt==="source"?Ir(l,p[0],a.arrowSize):a.arrowAt==="target"?Ir(u,p[p.length-1],a.arrowSize):void 0;return Mp(x,p,y,g,Math.min(a.radius,40))}function Ev(e,t,r,n,o){return wv(xv(e,t,r,n),e,t,o)}function Rv(e,t,r,n=-90,o=-60,i=350){const a=n*Math.PI/180,s=o*Math.PI/180,l=a-Math.PI/2,u=l-s/2,c=l+s/2,d=1.4*i*(t/3+1),f={x:e.x+Math.cos(u)*d,y:e.y+Math.sin(u)*d},p={x:e.x+Math.cos(c)*d,y:e.y+Math.sin(c)*d},x=qr(e),y={x:e.x,y:e.y},g=it(y,f,x),v=it(y,p,x);if(!g||!v)return null;const h={x:(f.x+p.x)/2,y:(f.y+p.y)/2};let b=ze(g,f,r.srcDist),_=ze(v,p,r.tgtDist),w;if(r.arrowAt==="target"){const R=_;_=ze(v,p,r.tgtDist+r.arrowGap),w=Ir(R,p,r.arrowSize)}else if(r.arrowAt==="source"){const R=b;b=ze(g,f,r.srcDist+r.arrowGap),w=Ir(R,f,r.arrowSize)}return{d:`M${Be(b)} Q${Be(f)} ${Be(h)} Q${Be(p)} ${Be(_)}`,arrow:w,label:{x:h.x,y:h.y,angle:Lr(p.x-f.x,p.y-f.y)}}}const au=6,Pp=3,Sv=Math.max(Math.pow(au*13.37,.9),29)*Pp,qv=au*Pp*2,ku=80,Iv=500,tt=45,Tv=200,et=15,Av=50,Nu=`${tt}px ${ft}`,Mv="32 18",Pv=e=>e.stopPropagation();function Ov({id:e,source:t,target:r,sourceProperty:n,targetProperty:o,sourceY:i,targetY:a,dir:s,turn:l,color:u,labelBg:c,label:d,dashed:f,animated:p,inverted:x,loopIndex:y=0,onSelect:g}){const v=q.useMemo(()=>{const E={srcDist:ku,tgtDist:ku,arrowGap:qv,arrowSize:Sv,radius:Iv,arrowAt:x?"source":"target"};return i!==void 0||a!==void 0?Cv(t,r,s,i,a,l,{...E,srcDist:18,tgtDist:18}):t.x===r.x&&t.y===r.y?Rv(t,y,{...E,srcDist:0,tgtDist:0}):Ev(t,r,s,l,E)},[t,r,i,a,s,l,x,y]),h=q.useMemo(()=>d?fv(d,Nu,Tv):[],[d]);if(!v)return null;const b=f||p?Mv:void 0,_=p?`flow-sdk-edge-anim${x?" flow-sdk-edge-anim-rev":""}`:void 0;let w=null;if(h.length){const E=Math.max(...h.map(I=>iu(I,Nu))),R=h.length*tt;w=m.jsxs("g",{className:"flow-sdk-edge-label",transform:`translate(${v.label.x} ${v.label.y}) rotate(${v.label.angle}) translate(${Av} 0)`,children:[m.jsx("rect",{x:-E/2-et,y:-R/2-et,width:E+2*et,height:R+2*et,fill:c}),m.jsx("text",{fill:u,fontSize:tt,fontFamily:ft,textAnchor:"middle",dominantBaseline:"central",children:h.map((I,A)=>m.jsx("tspan",{x:0,y:(A-(h.length-1)/2)*tt,children:I},A))})]})}return m.jsxs("g",{className:"flow-sdk-edge","data-edge-id":e,"data-source-property":n,"data-target-property":o,onPointerDown:Pv,onClick:E=>{E.stopPropagation(),g==null||g(e)},children:[m.jsx("path",{d:v.d,fill:"none",stroke:u,strokeWidth:au,strokeDasharray:b,className:_}),v.arrow&&m.jsx("path",{d:v.arrow,fill:u}),w,m.jsx("path",{className:"flow-sdk-edge-hit",d:v.d})]})}const Lu=q.memo(Ov);var rt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function su(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jt,Fu;function kv(){if(Fu)return jt;Fu=1;function e(){this.__data__=[],this.size=0}return jt=e,jt}var kt,Du;function Tr(){if(Du)return kt;Du=1;function e(t,r){return t===r||t!==t&&r!==r}return kt=e,kt}var Nt,Bu;function ht(){if(Bu)return Nt;Bu=1;var e=Tr();function t(r,n){for(var o=r.length;o--;)if(e(r[o][0],n))return o;return-1}return Nt=t,Nt}var Lt,zu;function Nv(){if(zu)return Lt;zu=1;var e=ht(),t=Array.prototype,r=t.splice;function n(o){var i=this.__data__,a=e(i,o);if(a<0)return!1;var s=i.length-1;return a==s?i.pop():r.call(i,a,1),--this.size,!0}return Lt=n,Lt}var Ft,$u;function Lv(){if($u)return Ft;$u=1;var e=ht();function t(r){var n=this.__data__,o=e(n,r);return o<0?void 0:n[o][1]}return Ft=t,Ft}var Dt,Gu;function Fv(){if(Gu)return Dt;Gu=1;var e=ht();function t(r){return e(this.__data__,r)>-1}return Dt=t,Dt}var Bt,Wu;function Dv(){if(Wu)return Bt;Wu=1;var e=ht();function t(r,n){var o=this.__data__,i=e(o,r);return i<0?(++this.size,o.push([r,n])):o[i][1]=n,this}return Bt=t,Bt}var zt,Hu;function pt(){if(Hu)return zt;Hu=1;var e=kv(),t=Nv(),r=Lv(),n=Fv(),o=Dv();function i(a){var s=-1,l=a==null?0:a.length;for(this.clear();++s<l;){var u=a[s];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,zt=i,zt}var $t,Vu;function Bv(){if(Vu)return $t;Vu=1;var e=pt();function t(){this.__data__=new e,this.size=0}return $t=t,$t}var Gt,Uu;function zv(){if(Uu)return Gt;Uu=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Gt=e,Gt}var Wt,Ku;function $v(){if(Ku)return Wt;Ku=1;function e(t){return this.__data__.get(t)}return Wt=e,Wt}var Ht,Zu;function Gv(){if(Zu)return Ht;Zu=1;function e(t){return this.__data__.has(t)}return Ht=e,Ht}var Vt,Yu;function Op(){if(Yu)return Vt;Yu=1;var e=typeof rt=="object"&&rt&&rt.Object===Object&&rt;return Vt=e,Vt}var Ut,Xu;function Ve(){if(Xu)return Ut;Xu=1;var e=Op(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ut=r,Ut}var Kt,Ju;function Ar(){if(Ju)return Kt;Ju=1;var e=Ve(),t=e.Symbol;return Kt=t,Kt}var Zt,Qu;function Wv(){if(Qu)return Zt;Qu=1;var e=Ar(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;function i(a){var s=r.call(a,o),l=a[o];try{a[o]=void 0;var u=!0}catch{}var c=n.call(a);return u&&(s?a[o]=l:delete a[o]),c}return Zt=i,Zt}var Yt,ec;function Hv(){if(ec)return Yt;ec=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Yt=r,Yt}var Xt,rc;function yr(){if(rc)return Xt;rc=1;var e=Ar(),t=Wv(),r=Hv(),n="[object Null]",o="[object Undefined]",i=e?e.toStringTag:void 0;function a(s){return s==null?s===void 0?o:n:i&&i in Object(s)?t(s):r(s)}return Xt=a,Xt}var Jt,tc;function Ge(){if(tc)return Jt;tc=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Jt=e,Jt}var Qt,nc;function Ur(){if(nc)return Qt;nc=1;var e=yr(),t=Ge(),r="[object AsyncFunction]",n="[object Function]",o="[object GeneratorFunction]",i="[object Proxy]";function a(s){if(!t(s))return!1;var l=e(s);return l==n||l==o||l==r||l==i}return Qt=a,Qt}var en,oc;function Vv(){if(oc)return en;oc=1;var e=Ve(),t=e["__core-js_shared__"];return en=t,en}var rn,ic;function Uv(){if(ic)return rn;ic=1;var e=Vv(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return rn=r,rn}var tn,ac;function jp(){if(ac)return tn;ac=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return tn=r,tn}var nn,sc;function Kv(){if(sc)return nn;sc=1;var e=Ur(),t=Uv(),r=Ge(),n=jp(),o=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,a=Function.prototype,s=Object.prototype,l=a.toString,u=s.hasOwnProperty,c=RegExp("^"+l.call(u).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(f){if(!r(f)||t(f))return!1;var p=e(f)?c:i;return p.test(n(f))}return nn=d,nn}var on,uc;function Zv(){if(uc)return on;uc=1;function e(t,r){return t==null?void 0:t[r]}return on=e,on}var an,cc;function br(){if(cc)return an;cc=1;var e=Kv(),t=Zv();function r(n,o){var i=t(n,o);return e(i)?i:void 0}return an=r,an}var sn,lc;function uu(){if(lc)return sn;lc=1;var e=br(),t=Ve(),r=e(t,"Map");return sn=r,sn}var un,dc;function gt(){if(dc)return un;dc=1;var e=br(),t=e(Object,"create");return un=t,un}var cn,fc;function Yv(){if(fc)return cn;fc=1;var e=gt();function t(){this.__data__=e?e(null):{},this.size=0}return cn=t,cn}var ln,hc;function Xv(){if(hc)return ln;hc=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return ln=e,ln}var dn,pc;function Jv(){if(pc)return dn;pc=1;var e=gt(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function o(i){var a=this.__data__;if(e){var s=a[i];return s===t?void 0:s}return n.call(a,i)?a[i]:void 0}return dn=o,dn}var fn,gc;function Qv(){if(gc)return fn;gc=1;var e=gt(),t=Object.prototype,r=t.hasOwnProperty;function n(o){var i=this.__data__;return e?i[o]!==void 0:r.call(i,o)}return fn=n,fn}var hn,vc;function ey(){if(vc)return hn;vc=1;var e=gt(),t="__lodash_hash_undefined__";function r(n,o){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=e&&o===void 0?t:o,this}return hn=r,hn}var pn,yc;function ry(){if(yc)return pn;yc=1;var e=Yv(),t=Xv(),r=Jv(),n=Qv(),o=ey();function i(a){var s=-1,l=a==null?0:a.length;for(this.clear();++s<l;){var u=a[s];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,pn=i,pn}var gn,bc;function ty(){if(bc)return gn;bc=1;var e=ry(),t=pt(),r=uu();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return gn=n,gn}var vn,mc;function ny(){if(mc)return vn;mc=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return vn=e,vn}var yn,xc;function vt(){if(xc)return yn;xc=1;var e=ny();function t(r,n){var o=r.__data__;return e(n)?o[typeof n=="string"?"string":"hash"]:o.map}return yn=t,yn}var bn,_c;function oy(){if(_c)return bn;_c=1;var e=vt();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return bn=t,bn}var mn,wc;function iy(){if(wc)return mn;wc=1;var e=vt();function t(r){return e(this,r).get(r)}return mn=t,mn}var xn,Cc;function ay(){if(Cc)return xn;Cc=1;var e=vt();function t(r){return e(this,r).has(r)}return xn=t,xn}var _n,Ec;function sy(){if(Ec)return _n;Ec=1;var e=vt();function t(r,n){var o=e(this,r),i=o.size;return o.set(r,n),this.size+=o.size==i?0:1,this}return _n=t,_n}var wn,Rc;function cu(){if(Rc)return wn;Rc=1;var e=ty(),t=oy(),r=iy(),n=ay(),o=sy();function i(a){var s=-1,l=a==null?0:a.length;for(this.clear();++s<l;){var u=a[s];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,wn=i,wn}var Cn,Sc;function uy(){if(Sc)return Cn;Sc=1;var e=pt(),t=uu(),r=cu(),n=200;function o(i,a){var s=this.__data__;if(s instanceof e){var l=s.__data__;if(!t||l.length<n-1)return l.push([i,a]),this.size=++s.size,this;s=this.__data__=new r(l)}return s.set(i,a),this.size=s.size,this}return Cn=o,Cn}var En,qc;function yt(){if(qc)return En;qc=1;var e=pt(),t=Bv(),r=zv(),n=$v(),o=Gv(),i=uy();function a(s){var l=this.__data__=new e(s);this.size=l.size}return a.prototype.clear=t,a.prototype.delete=r,a.prototype.get=n,a.prototype.has=o,a.prototype.set=i,En=a,En}var Rn,Ic;function lu(){if(Ic)return Rn;Ic=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o&&r(t[n],n,t)!==!1;);return t}return Rn=e,Rn}var Sn,Tc;function kp(){if(Tc)return Sn;Tc=1;var e=br(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Sn=t,Sn}var qn,Ac;function bt(){if(Ac)return qn;Ac=1;var e=kp();function t(r,n,o){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[n]=o}return qn=t,qn}var In,Mc;function mt(){if(Mc)return In;Mc=1;var e=bt(),t=Tr(),r=Object.prototype,n=r.hasOwnProperty;function o(i,a,s){var l=i[a];(!(n.call(i,a)&&t(l,s))||s===void 0&&!(a in i))&&e(i,a,s)}return In=o,In}var Tn,Pc;function Kr(){if(Pc)return Tn;Pc=1;var e=mt(),t=bt();function r(n,o,i,a){var s=!i;i||(i={});for(var l=-1,u=o.length;++l<u;){var c=o[l],d=a?a(i[c],n[c],c,i,n):void 0;d===void 0&&(d=n[c]),s?t(i,c,d):e(i,c,d)}return i}return Tn=r,Tn}var An,Oc;function cy(){if(Oc)return An;Oc=1;function e(t,r){for(var n=-1,o=Array(t);++n<t;)o[n]=r(n);return o}return An=e,An}var Mn,jc;function Qe(){if(jc)return Mn;jc=1;function e(t){return t!=null&&typeof t=="object"}return Mn=e,Mn}var Pn,kc;function ly(){if(kc)return Pn;kc=1;var e=yr(),t=Qe(),r="[object Arguments]";function n(o){return t(o)&&e(o)==r}return Pn=n,Pn}var On,Nc;function Zr(){if(Nc)return On;Nc=1;var e=ly(),t=Qe(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(a){return t(a)&&n.call(a,"callee")&&!o.call(a,"callee")};return On=i,On}var jn,Lc;function Te(){if(Lc)return jn;Lc=1;var e=Array.isArray;return jn=e,jn}var Fr={exports:{}},kn,Fc;function dy(){if(Fc)return kn;Fc=1;function e(){return!1}return kn=e,kn}Fr.exports;var Dc;function Mr(){return Dc||(Dc=1,(function(e,t){var r=Ve(),n=dy(),o=t&&!t.nodeType&&t,i=o&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===o,s=a?r.Buffer:void 0,l=s?s.isBuffer:void 0,u=l||n;e.exports=u})(Fr,Fr.exports)),Fr.exports}var Nn,Bc;function xt(){if(Bc)return Nn;Bc=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,o){var i=typeof n;return o=o??e,!!o&&(i=="number"||i!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<o}return Nn=r,Nn}var Ln,zc;function du(){if(zc)return Ln;zc=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Ln=t,Ln}var Fn,$c;function fy(){if($c)return Fn;$c=1;var e=yr(),t=du(),r=Qe(),n="[object Arguments]",o="[object Array]",i="[object Boolean]",a="[object Date]",s="[object Error]",l="[object Function]",u="[object Map]",c="[object Number]",d="[object Object]",f="[object RegExp]",p="[object Set]",x="[object String]",y="[object WeakMap]",g="[object ArrayBuffer]",v="[object DataView]",h="[object Float32Array]",b="[object Float64Array]",_="[object Int8Array]",w="[object Int16Array]",E="[object Int32Array]",R="[object Uint8Array]",I="[object Uint8ClampedArray]",A="[object Uint16Array]",k="[object Uint32Array]",M={};M[h]=M[b]=M[_]=M[w]=M[E]=M[R]=M[I]=M[A]=M[k]=!0,M[n]=M[o]=M[g]=M[i]=M[v]=M[a]=M[s]=M[l]=M[u]=M[c]=M[d]=M[f]=M[p]=M[x]=M[y]=!1;function z(G){return r(G)&&t(G.length)&&!!M[e(G)]}return Fn=z,Fn}var Dn,Gc;function _t(){if(Gc)return Dn;Gc=1;function e(t){return function(r){return t(r)}}return Dn=e,Dn}var Dr={exports:{}};Dr.exports;var Wc;function fu(){return Wc||(Wc=1,(function(e,t){var r=Op(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,i=o&&o.exports===n,a=i&&r.process,s=(function(){try{var l=o&&o.require&&o.require("util").types;return l||a&&a.binding&&a.binding("util")}catch{}})();e.exports=s})(Dr,Dr.exports)),Dr.exports}var Bn,Hc;function Yr(){if(Hc)return Bn;Hc=1;var e=fy(),t=_t(),r=fu(),n=r&&r.isTypedArray,o=n?t(n):e;return Bn=o,Bn}var zn,Vc;function Np(){if(Vc)return zn;Vc=1;var e=cy(),t=Zr(),r=Te(),n=Mr(),o=xt(),i=Yr(),a=Object.prototype,s=a.hasOwnProperty;function l(u,c){var d=r(u),f=!d&&t(u),p=!d&&!f&&n(u),x=!d&&!f&&!p&&i(u),y=d||f||p||x,g=y?e(u.length,String):[],v=g.length;for(var h in u)(c||s.call(u,h))&&!(y&&(h=="length"||p&&(h=="offset"||h=="parent")||x&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||o(h,v)))&&g.push(h);return g}return zn=l,zn}var $n,Uc;function wt(){if(Uc)return $n;Uc=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,o=typeof n=="function"&&n.prototype||e;return r===o}return $n=t,$n}var Gn,Kc;function Lp(){if(Kc)return Gn;Kc=1;function e(t,r){return function(n){return t(r(n))}}return Gn=e,Gn}var Wn,Zc;function hy(){if(Zc)return Wn;Zc=1;var e=Lp(),t=e(Object.keys,Object);return Wn=t,Wn}var Hn,Yc;function hu(){if(Yc)return Hn;Yc=1;var e=wt(),t=hy(),r=Object.prototype,n=r.hasOwnProperty;function o(i){if(!e(i))return t(i);var a=[];for(var s in Object(i))n.call(i,s)&&s!="constructor"&&a.push(s);return a}return Hn=o,Hn}var Vn,Xc;function rr(){if(Xc)return Vn;Xc=1;var e=Ur(),t=du();function r(n){return n!=null&&t(n.length)&&!e(n)}return Vn=r,Vn}var Un,Jc;function cr(){if(Jc)return Un;Jc=1;var e=Np(),t=hu(),r=rr();function n(o){return r(o)?e(o):t(o)}return Un=n,Un}var Kn,Qc;function py(){if(Qc)return Kn;Qc=1;var e=Kr(),t=cr();function r(n,o){return n&&e(o,t(o),n)}return Kn=r,Kn}var Zn,el;function gy(){if(el)return Zn;el=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return Zn=e,Zn}var Yn,rl;function vy(){if(rl)return Yn;rl=1;var e=Ge(),t=wt(),r=gy(),n=Object.prototype,o=n.hasOwnProperty;function i(a){if(!e(a))return r(a);var s=t(a),l=[];for(var u in a)u=="constructor"&&(s||!o.call(a,u))||l.push(u);return l}return Yn=i,Yn}var Xn,tl;function mr(){if(tl)return Xn;tl=1;var e=Np(),t=vy(),r=rr();function n(o){return r(o)?e(o,!0):t(o)}return Xn=n,Xn}var Jn,nl;function yy(){if(nl)return Jn;nl=1;var e=Kr(),t=mr();function r(n,o){return n&&e(o,t(o),n)}return Jn=r,Jn}var Br={exports:{}};Br.exports;var ol;function Fp(){return ol||(ol=1,(function(e,t){var r=Ve(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,i=o&&o.exports===n,a=i?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;function l(u,c){if(c)return u.slice();var d=u.length,f=s?s(d):new u.constructor(d);return u.copy(f),f}e.exports=l})(Br,Br.exports)),Br.exports}var Qn,il;function Dp(){if(il)return Qn;il=1;function e(t,r){var n=-1,o=t.length;for(r||(r=Array(o));++n<o;)r[n]=t[n];return r}return Qn=e,Qn}var eo,al;function Bp(){if(al)return eo;al=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,i=0,a=[];++n<o;){var s=t[n];r(s,n,t)&&(a[i++]=s)}return a}return eo=e,eo}var ro,sl;function zp(){if(sl)return ro;sl=1;function e(){return[]}return ro=e,ro}var to,ul;function pu(){if(ul)return to;ul=1;var e=Bp(),t=zp(),r=Object.prototype,n=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,i=o?function(a){return a==null?[]:(a=Object(a),e(o(a),function(s){return n.call(a,s)}))}:t;return to=i,to}var no,cl;function by(){if(cl)return no;cl=1;var e=Kr(),t=pu();function r(n,o){return e(n,t(n),o)}return no=r,no}var oo,ll;function gu(){if(ll)return oo;ll=1;function e(t,r){for(var n=-1,o=r.length,i=t.length;++n<o;)t[i+n]=r[n];return t}return oo=e,oo}var io,dl;function Ct(){if(dl)return io;dl=1;var e=Lp(),t=e(Object.getPrototypeOf,Object);return io=t,io}var ao,fl;function $p(){if(fl)return ao;fl=1;var e=gu(),t=Ct(),r=pu(),n=zp(),o=Object.getOwnPropertySymbols,i=o?function(a){for(var s=[];a;)e(s,r(a)),a=t(a);return s}:n;return ao=i,ao}var so,hl;function my(){if(hl)return so;hl=1;var e=Kr(),t=$p();function r(n,o){return e(n,t(n),o)}return so=r,so}var uo,pl;function Gp(){if(pl)return uo;pl=1;var e=gu(),t=Te();function r(n,o,i){var a=o(n);return t(n)?a:e(a,i(n))}return uo=r,uo}var co,gl;function Wp(){if(gl)return co;gl=1;var e=Gp(),t=pu(),r=cr();function n(o){return e(o,r,t)}return co=n,co}var lo,vl;function xy(){if(vl)return lo;vl=1;var e=Gp(),t=$p(),r=mr();function n(o){return e(o,r,t)}return lo=n,lo}var fo,yl;function _y(){if(yl)return fo;yl=1;var e=br(),t=Ve(),r=e(t,"DataView");return fo=r,fo}var ho,bl;function wy(){if(bl)return ho;bl=1;var e=br(),t=Ve(),r=e(t,"Promise");return ho=r,ho}var po,ml;function Hp(){if(ml)return po;ml=1;var e=br(),t=Ve(),r=e(t,"Set");return po=r,po}var go,xl;function Cy(){if(xl)return go;xl=1;var e=br(),t=Ve(),r=e(t,"WeakMap");return go=r,go}var vo,_l;function Pr(){if(_l)return vo;_l=1;var e=_y(),t=uu(),r=wy(),n=Hp(),o=Cy(),i=yr(),a=jp(),s="[object Map]",l="[object Object]",u="[object Promise]",c="[object Set]",d="[object WeakMap]",f="[object DataView]",p=a(e),x=a(t),y=a(r),g=a(n),v=a(o),h=i;return(e&&h(new e(new ArrayBuffer(1)))!=f||t&&h(new t)!=s||r&&h(r.resolve())!=u||n&&h(new n)!=c||o&&h(new o)!=d)&&(h=function(b){var _=i(b),w=_==l?b.constructor:void 0,E=w?a(w):"";if(E)switch(E){case p:return f;case x:return s;case y:return u;case g:return c;case v:return d}return _}),vo=h,vo}var yo,wl;function Ey(){if(wl)return yo;wl=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var o=n.length,i=new n.constructor(o);return o&&typeof n[0]=="string"&&t.call(n,"index")&&(i.index=n.index,i.input=n.input),i}return yo=r,yo}var bo,Cl;function Vp(){if(Cl)return bo;Cl=1;var e=Ve(),t=e.Uint8Array;return bo=t,bo}var mo,El;function vu(){if(El)return mo;El=1;var e=Vp();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return mo=t,mo}var xo,Rl;function Ry(){if(Rl)return xo;Rl=1;var e=vu();function t(r,n){var o=n?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return xo=t,xo}var _o,Sl;function Sy(){if(Sl)return _o;Sl=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return _o=t,_o}var wo,ql;function qy(){if(ql)return wo;ql=1;var e=Ar(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(o){return r?Object(r.call(o)):{}}return wo=n,wo}var Co,Il;function Up(){if(Il)return Co;Il=1;var e=vu();function t(r,n){var o=n?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Co=t,Co}var Eo,Tl;function Iy(){if(Tl)return Eo;Tl=1;var e=vu(),t=Ry(),r=Sy(),n=qy(),o=Up(),i="[object Boolean]",a="[object Date]",s="[object Map]",l="[object Number]",u="[object RegExp]",c="[object Set]",d="[object String]",f="[object Symbol]",p="[object ArrayBuffer]",x="[object DataView]",y="[object Float32Array]",g="[object Float64Array]",v="[object Int8Array]",h="[object Int16Array]",b="[object Int32Array]",_="[object Uint8Array]",w="[object Uint8ClampedArray]",E="[object Uint16Array]",R="[object Uint32Array]";function I(A,k,M){var z=A.constructor;switch(k){case p:return e(A);case i:case a:return new z(+A);case x:return t(A,M);case y:case g:case v:case h:case b:case _:case w:case E:case R:return o(A,M);case s:return new z;case l:case d:return new z(A);case u:return r(A);case c:return new z;case f:return n(A)}}return Eo=I,Eo}var Ro,Al;function Kp(){if(Al)return Ro;Al=1;var e=Ge(),t=Object.create,r=(function(){function n(){}return function(o){if(!e(o))return{};if(t)return t(o);n.prototype=o;var i=new n;return n.prototype=void 0,i}})();return Ro=r,Ro}var So,Ml;function Zp(){if(Ml)return So;Ml=1;var e=Kp(),t=Ct(),r=wt();function n(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return So=n,So}var qo,Pl;function Ty(){if(Pl)return qo;Pl=1;var e=Pr(),t=Qe(),r="[object Map]";function n(o){return t(o)&&e(o)==r}return qo=n,qo}var Io,Ol;function Ay(){if(Ol)return Io;Ol=1;var e=Ty(),t=_t(),r=fu(),n=r&&r.isMap,o=n?t(n):e;return Io=o,Io}var To,jl;function My(){if(jl)return To;jl=1;var e=Pr(),t=Qe(),r="[object Set]";function n(o){return t(o)&&e(o)==r}return To=n,To}var Ao,kl;function Py(){if(kl)return Ao;kl=1;var e=My(),t=_t(),r=fu(),n=r&&r.isSet,o=n?t(n):e;return Ao=o,Ao}var Mo,Nl;function Yp(){if(Nl)return Mo;Nl=1;var e=yt(),t=lu(),r=mt(),n=py(),o=yy(),i=Fp(),a=Dp(),s=by(),l=my(),u=Wp(),c=xy(),d=Pr(),f=Ey(),p=Iy(),x=Zp(),y=Te(),g=Mr(),v=Ay(),h=Ge(),b=Py(),_=cr(),w=mr(),E=1,R=2,I=4,A="[object Arguments]",k="[object Array]",M="[object Boolean]",z="[object Date]",G="[object Error]",U="[object Function]",V="[object GeneratorFunction]",X="[object Map]",he="[object Number]",ee="[object Object]",Y="[object RegExp]",oe="[object Set]",pe="[object String]",fe="[object Symbol]",ge="[object WeakMap]",S="[object ArrayBuffer]",O="[object DataView]",D="[object Float32Array]",F="[object Float64Array]",Z="[object Int8Array]",ne="[object Int16Array]",re="[object Int32Array]",ue="[object Uint8Array]",Ce="[object Uint8ClampedArray]",ie="[object Uint16Array]",ve="[object Uint32Array]",W={};W[A]=W[k]=W[S]=W[O]=W[M]=W[z]=W[D]=W[F]=W[Z]=W[ne]=W[re]=W[X]=W[he]=W[ee]=W[Y]=W[oe]=W[pe]=W[fe]=W[ue]=W[Ce]=W[ie]=W[ve]=!0,W[G]=W[U]=W[ge]=!1;function ye(K,we,Ae,Ie,Fe,xe){var qe,Ue=we&E,Ke=we&R,lr=we&I;if(Ae&&(qe=Fe?Ae(K,Ie,Fe,xe):Ae(K)),qe!==void 0)return qe;if(!h(K))return K;var _r=y(K);if(_r){if(qe=f(K),!Ue)return a(K,qe)}else{var Ze=d(K),dr=Ze==U||Ze==V;if(g(K))return i(K,Ue);if(Ze==ee||Ze==A||dr&&!Fe){if(qe=Ke||dr?{}:x(K),!Ue)return Ke?l(K,o(qe,K)):s(K,n(qe,K))}else{if(!W[Ze])return Fe?K:{};qe=p(K,Ze,Ue)}}xe||(xe=new e);var De=xe.get(K);if(De)return De;xe.set(K,qe),b(K)?K.forEach(function($){qe.add(ye($,we,Ae,$,K,xe))}):v(K)&&K.forEach(function($,L){qe.set(L,ye($,we,Ae,L,K,xe))});var jr=lr?Ke?c:u:Ke?w:_,fr=_r?void 0:jr(K);return t(fr||K,function($,L){fr&&(L=$,$=K[L]),r(qe,L,ye($,we,Ae,L,K,xe))}),qe}return Mo=ye,Mo}var Po,Ll;function Oy(){if(Ll)return Po;Ll=1;var e=Yp(),t=4;function r(n){return e(n,t)}return Po=r,Po}var Oo,Fl;function yu(){if(Fl)return Oo;Fl=1;function e(t){return function(){return t}}return Oo=e,Oo}var jo,Dl;function jy(){if(Dl)return jo;Dl=1;function e(t){return function(r,n,o){for(var i=-1,a=Object(r),s=o(r),l=s.length;l--;){var u=s[t?l:++i];if(n(a[u],u,a)===!1)break}return r}}return jo=e,jo}var ko,Bl;function bu(){if(Bl)return ko;Bl=1;var e=jy(),t=e();return ko=t,ko}var No,zl;function mu(){if(zl)return No;zl=1;var e=bu(),t=cr();function r(n,o){return n&&e(n,o,t)}return No=r,No}var Lo,$l;function ky(){if($l)return Lo;$l=1;var e=rr();function t(r,n){return function(o,i){if(o==null)return o;if(!e(o))return r(o,i);for(var a=o.length,s=n?a:-1,l=Object(o);(n?s--:++s<a)&&i(l[s],s,l)!==!1;);return o}}return Lo=t,Lo}var Fo,Gl;function Et(){if(Gl)return Fo;Gl=1;var e=mu(),t=ky(),r=t(e);return Fo=r,Fo}var Do,Wl;function xr(){if(Wl)return Do;Wl=1;function e(t){return t}return Do=e,Do}var Bo,Hl;function Xp(){if(Hl)return Bo;Hl=1;var e=xr();function t(r){return typeof r=="function"?r:e}return Bo=t,Bo}var zo,Vl;function Jp(){if(Vl)return zo;Vl=1;var e=lu(),t=Et(),r=Xp(),n=Te();function o(i,a){var s=n(i)?e:t;return s(i,r(a))}return zo=o,zo}var $o,Ul;function Qp(){return Ul||(Ul=1,$o=Jp()),$o}var Go,Kl;function Ny(){if(Kl)return Go;Kl=1;var e=Et();function t(r,n){var o=[];return e(r,function(i,a,s){n(i,a,s)&&o.push(i)}),o}return Go=t,Go}var Wo,Zl;function Ly(){if(Zl)return Wo;Zl=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Wo=t,Wo}var Ho,Yl;function Fy(){if(Yl)return Ho;Yl=1;function e(t){return this.__data__.has(t)}return Ho=e,Ho}var Vo,Xl;function eg(){if(Xl)return Vo;Xl=1;var e=cu(),t=Ly(),r=Fy();function n(o){var i=-1,a=o==null?0:o.length;for(this.__data__=new e;++i<a;)this.add(o[i])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,Vo=n,Vo}var Uo,Jl;function Dy(){if(Jl)return Uo;Jl=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(r(t[n],n,t))return!0;return!1}return Uo=e,Uo}var Ko,Ql;function rg(){if(Ql)return Ko;Ql=1;function e(t,r){return t.has(r)}return Ko=e,Ko}var Zo,ed;function tg(){if(ed)return Zo;ed=1;var e=eg(),t=Dy(),r=rg(),n=1,o=2;function i(a,s,l,u,c,d){var f=l&n,p=a.length,x=s.length;if(p!=x&&!(f&&x>p))return!1;var y=d.get(a),g=d.get(s);if(y&&g)return y==s&&g==a;var v=-1,h=!0,b=l&o?new e:void 0;for(d.set(a,s),d.set(s,a);++v<p;){var _=a[v],w=s[v];if(u)var E=f?u(w,_,v,s,a,d):u(_,w,v,a,s,d);if(E!==void 0){if(E)continue;h=!1;break}if(b){if(!t(s,function(R,I){if(!r(b,I)&&(_===R||c(_,R,l,u,d)))return b.push(I)})){h=!1;break}}else if(!(_===w||c(_,w,l,u,d))){h=!1;break}}return d.delete(a),d.delete(s),h}return Zo=i,Zo}var Yo,rd;function By(){if(rd)return Yo;rd=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o,i){n[++r]=[i,o]}),n}return Yo=e,Yo}var Xo,td;function xu(){if(td)return Xo;td=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o){n[++r]=o}),n}return Xo=e,Xo}var Jo,nd;function zy(){if(nd)return Jo;nd=1;var e=Ar(),t=Vp(),r=Tr(),n=tg(),o=By(),i=xu(),a=1,s=2,l="[object Boolean]",u="[object Date]",c="[object Error]",d="[object Map]",f="[object Number]",p="[object RegExp]",x="[object Set]",y="[object String]",g="[object Symbol]",v="[object ArrayBuffer]",h="[object DataView]",b=e?e.prototype:void 0,_=b?b.valueOf:void 0;function w(E,R,I,A,k,M,z){switch(I){case h:if(E.byteLength!=R.byteLength||E.byteOffset!=R.byteOffset)return!1;E=E.buffer,R=R.buffer;case v:return!(E.byteLength!=R.byteLength||!M(new t(E),new t(R)));case l:case u:case f:return r(+E,+R);case c:return E.name==R.name&&E.message==R.message;case p:case y:return E==R+"";case d:var G=o;case x:var U=A&a;if(G||(G=i),E.size!=R.size&&!U)return!1;var V=z.get(E);if(V)return V==R;A|=s,z.set(E,R);var X=n(G(E),G(R),A,k,M,z);return z.delete(E),X;case g:if(_)return _.call(E)==_.call(R)}return!1}return Jo=w,Jo}var Qo,od;function $y(){if(od)return Qo;od=1;var e=Wp(),t=1,r=Object.prototype,n=r.hasOwnProperty;function o(i,a,s,l,u,c){var d=s&t,f=e(i),p=f.length,x=e(a),y=x.length;if(p!=y&&!d)return!1;for(var g=p;g--;){var v=f[g];if(!(d?v in a:n.call(a,v)))return!1}var h=c.get(i),b=c.get(a);if(h&&b)return h==a&&b==i;var _=!0;c.set(i,a),c.set(a,i);for(var w=d;++g<p;){v=f[g];var E=i[v],R=a[v];if(l)var I=d?l(R,E,v,a,i,c):l(E,R,v,i,a,c);if(!(I===void 0?E===R||u(E,R,s,l,c):I)){_=!1;break}w||(w=v=="constructor")}if(_&&!w){var A=i.constructor,k=a.constructor;A!=k&&"constructor"in i&&"constructor"in a&&!(typeof A=="function"&&A instanceof A&&typeof k=="function"&&k instanceof k)&&(_=!1)}return c.delete(i),c.delete(a),_}return Qo=o,Qo}var ei,id;function Gy(){if(id)return ei;id=1;var e=yt(),t=tg(),r=zy(),n=$y(),o=Pr(),i=Te(),a=Mr(),s=Yr(),l=1,u="[object Arguments]",c="[object Array]",d="[object Object]",f=Object.prototype,p=f.hasOwnProperty;function x(y,g,v,h,b,_){var w=i(y),E=i(g),R=w?c:o(y),I=E?c:o(g);R=R==u?d:R,I=I==u?d:I;var A=R==d,k=I==d,M=R==I;if(M&&a(y)){if(!a(g))return!1;w=!0,A=!1}if(M&&!A)return _||(_=new e),w||s(y)?t(y,g,v,h,b,_):r(y,g,R,v,h,b,_);if(!(v&l)){var z=A&&p.call(y,"__wrapped__"),G=k&&p.call(g,"__wrapped__");if(z||G){var U=z?y.value():y,V=G?g.value():g;return _||(_=new e),b(U,V,v,h,_)}}return M?(_||(_=new e),n(y,g,v,h,b,_)):!1}return ei=x,ei}var ri,ad;function ng(){if(ad)return ri;ad=1;var e=Gy(),t=Qe();function r(n,o,i,a,s){return n===o?!0:n==null||o==null||!t(n)&&!t(o)?n!==n&&o!==o:e(n,o,i,a,r,s)}return ri=r,ri}var ti,sd;function Wy(){if(sd)return ti;sd=1;var e=yt(),t=ng(),r=1,n=2;function o(i,a,s,l){var u=s.length,c=u,d=!l;if(i==null)return!c;for(i=Object(i);u--;){var f=s[u];if(d&&f[2]?f[1]!==i[f[0]]:!(f[0]in i))return!1}for(;++u<c;){f=s[u];var p=f[0],x=i[p],y=f[1];if(d&&f[2]){if(x===void 0&&!(p in i))return!1}else{var g=new e;if(l)var v=l(x,y,p,i,a,g);if(!(v===void 0?t(y,x,r|n,l,g):v))return!1}}return!0}return ti=o,ti}var ni,ud;function og(){if(ud)return ni;ud=1;var e=Ge();function t(r){return r===r&&!e(r)}return ni=t,ni}var oi,cd;function Hy(){if(cd)return oi;cd=1;var e=og(),t=cr();function r(n){for(var o=t(n),i=o.length;i--;){var a=o[i],s=n[a];o[i]=[a,s,e(s)]}return o}return oi=r,oi}var ii,ld;function ig(){if(ld)return ii;ld=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return ii=e,ii}var ai,dd;function Vy(){if(dd)return ai;dd=1;var e=Wy(),t=Hy(),r=ig();function n(o){var i=t(o);return i.length==1&&i[0][2]?r(i[0][0],i[0][1]):function(a){return a===o||e(a,o,i)}}return ai=n,ai}var si,fd;function Or(){if(fd)return si;fd=1;var e=yr(),t=Qe(),r="[object Symbol]";function n(o){return typeof o=="symbol"||t(o)&&e(o)==r}return si=n,si}var ui,hd;function _u(){if(hd)return ui;hd=1;var e=Te(),t=Or(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function o(i,a){if(e(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||t(i)?!0:n.test(i)||!r.test(i)||a!=null&&i in Object(a)}return ui=o,ui}var ci,pd;function Uy(){if(pd)return ci;pd=1;var e=cu(),t="Expected a function";function r(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var i=function(){var a=arguments,s=o?o.apply(this,a):a[0],l=i.cache;if(l.has(s))return l.get(s);var u=n.apply(this,a);return i.cache=l.set(s,u)||l,u};return i.cache=new(r.Cache||e),i}return r.Cache=e,ci=r,ci}var li,gd;function Ky(){if(gd)return li;gd=1;var e=Uy(),t=500;function r(n){var o=e(n,function(a){return i.size===t&&i.clear(),a}),i=o.cache;return o}return li=r,li}var di,vd;function Zy(){if(vd)return di;vd=1;var e=Ky(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(o){var i=[];return o.charCodeAt(0)===46&&i.push(""),o.replace(t,function(a,s,l,u){i.push(l?u.replace(r,"$1"):s||a)}),i});return di=n,di}var fi,yd;function Rt(){if(yd)return fi;yd=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,i=Array(o);++n<o;)i[n]=r(t[n],n,t);return i}return fi=e,fi}var hi,bd;function Yy(){if(bd)return hi;bd=1;var e=Ar(),t=Rt(),r=Te(),n=Or(),o=e?e.prototype:void 0,i=o?o.toString:void 0;function a(s){if(typeof s=="string")return s;if(r(s))return t(s,a)+"";if(n(s))return i?i.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}return hi=a,hi}var pi,md;function ag(){if(md)return pi;md=1;var e=Yy();function t(r){return r==null?"":e(r)}return pi=t,pi}var gi,xd;function St(){if(xd)return gi;xd=1;var e=Te(),t=_u(),r=Zy(),n=ag();function o(i,a){return e(i)?i:t(i,a)?[i]:r(n(i))}return gi=o,gi}var vi,_d;function Xr(){if(_d)return vi;_d=1;var e=Or();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return vi=t,vi}var yi,wd;function qt(){if(wd)return yi;wd=1;var e=St(),t=Xr();function r(n,o){o=e(o,n);for(var i=0,a=o.length;n!=null&&i<a;)n=n[t(o[i++])];return i&&i==a?n:void 0}return yi=r,yi}var bi,Cd;function Xy(){if(Cd)return bi;Cd=1;var e=qt();function t(r,n,o){var i=r==null?void 0:e(r,n);return i===void 0?o:i}return bi=t,bi}var mi,Ed;function Jy(){if(Ed)return mi;Ed=1;function e(t,r){return t!=null&&r in Object(t)}return mi=e,mi}var xi,Rd;function sg(){if(Rd)return xi;Rd=1;var e=St(),t=Zr(),r=Te(),n=xt(),o=du(),i=Xr();function a(s,l,u){l=e(l,s);for(var c=-1,d=l.length,f=!1;++c<d;){var p=i(l[c]);if(!(f=s!=null&&u(s,p)))break;s=s[p]}return f||++c!=d?f:(d=s==null?0:s.length,!!d&&o(d)&&n(p,d)&&(r(s)||t(s)))}return xi=a,xi}var _i,Sd;function ug(){if(Sd)return _i;Sd=1;var e=Jy(),t=sg();function r(n,o){return n!=null&&t(n,o,e)}return _i=r,_i}var wi,qd;function Qy(){if(qd)return wi;qd=1;var e=ng(),t=Xy(),r=ug(),n=_u(),o=og(),i=ig(),a=Xr(),s=1,l=2;function u(c,d){return n(c)&&o(d)?i(a(c),d):function(f){var p=t(f,c);return p===void 0&&p===d?r(f,c):e(d,p,s|l)}}return wi=u,wi}var Ci,Id;function cg(){if(Id)return Ci;Id=1;function e(t){return function(r){return r==null?void 0:r[t]}}return Ci=e,Ci}var Ei,Td;function eb(){if(Td)return Ei;Td=1;var e=qt();function t(r){return function(n){return e(n,r)}}return Ei=t,Ei}var Ri,Ad;function rb(){if(Ad)return Ri;Ad=1;var e=cg(),t=eb(),r=_u(),n=Xr();function o(i){return r(i)?e(n(i)):t(i)}return Ri=o,Ri}var Si,Md;function tr(){if(Md)return Si;Md=1;var e=Vy(),t=Qy(),r=xr(),n=Te(),o=rb();function i(a){return typeof a=="function"?a:a==null?r:typeof a=="object"?n(a)?t(a[0],a[1]):e(a):o(a)}return Si=i,Si}var qi,Pd;function lg(){if(Pd)return qi;Pd=1;var e=Bp(),t=Ny(),r=tr(),n=Te();function o(i,a){var s=n(i)?e:t;return s(i,r(a,3))}return qi=o,qi}var Ii,Od;function tb(){if(Od)return Ii;Od=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n,o){return n!=null&&t.call(n,o)}return Ii=r,Ii}var Ti,jd;function dg(){if(jd)return Ti;jd=1;var e=tb(),t=sg();function r(n,o){return n!=null&&t(n,o,e)}return Ti=r,Ti}var Ai,kd;function nb(){if(kd)return Ai;kd=1;var e=hu(),t=Pr(),r=Zr(),n=Te(),o=rr(),i=Mr(),a=wt(),s=Yr(),l="[object Map]",u="[object Set]",c=Object.prototype,d=c.hasOwnProperty;function f(p){if(p==null)return!0;if(o(p)&&(n(p)||typeof p=="string"||typeof p.splice=="function"||i(p)||s(p)||r(p)))return!p.length;var x=t(p);if(x==l||x==u)return!p.size;if(a(p))return!e(p).length;for(var y in p)if(d.call(p,y))return!1;return!0}return Ai=f,Ai}var Mi,Nd;function fg(){if(Nd)return Mi;Nd=1;function e(t){return t===void 0}return Mi=e,Mi}var Pi,Ld;function hg(){if(Ld)return Pi;Ld=1;var e=Et(),t=rr();function r(n,o){var i=-1,a=t(n)?Array(n.length):[];return e(n,function(s,l,u){a[++i]=o(s,l,u)}),a}return Pi=r,Pi}var Oi,Fd;function pg(){if(Fd)return Oi;Fd=1;var e=Rt(),t=tr(),r=hg(),n=Te();function o(i,a){var s=n(i)?e:r;return s(i,t(a,3))}return Oi=o,Oi}var ji,Dd;function ob(){if(Dd)return ji;Dd=1;function e(t,r,n,o){var i=-1,a=t==null?0:t.length;for(o&&a&&(n=t[++i]);++i<a;)n=r(n,t[i],i,t);return n}return ji=e,ji}var ki,Bd;function ib(){if(Bd)return ki;Bd=1;function e(t,r,n,o,i){return i(t,function(a,s,l){n=o?(o=!1,a):r(n,a,s,l)}),n}return ki=e,ki}var Ni,zd;function gg(){if(zd)return Ni;zd=1;var e=ob(),t=Et(),r=tr(),n=ib(),o=Te();function i(a,s,l){var u=o(a)?e:n,c=arguments.length<3;return u(a,r(s,4),l,c,t)}return Ni=i,Ni}var Li,$d;function ab(){if($d)return Li;$d=1;var e=yr(),t=Te(),r=Qe(),n="[object String]";function o(i){return typeof i=="string"||!t(i)&&r(i)&&e(i)==n}return Li=o,Li}var Fi,Gd;function sb(){if(Gd)return Fi;Gd=1;var e=cg(),t=e("length");return Fi=t,Fi}var Di,Wd;function ub(){if(Wd)return Di;Wd=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,i="\\ufe0e\\ufe0f",a="\\u200d",s=RegExp("["+a+e+o+i+"]");function l(u){return s.test(u)}return Di=l,Di}var Bi,Hd;function cb(){if(Hd)return Bi;Hd=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,i="\\ufe0e\\ufe0f",a="["+e+"]",s="["+o+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+s+"|"+l+")",c="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",x=u+"?",y="["+i+"]?",g="(?:"+p+"(?:"+[c,d,f].join("|")+")"+y+x+")*",v=y+x+g,h="(?:"+[c+s+"?",s,d,f,a].join("|")+")",b=RegExp(l+"(?="+l+")|"+h+v,"g");function _(w){for(var E=b.lastIndex=0;b.test(w);)++E;return E}return Bi=_,Bi}var zi,Vd;function lb(){if(Vd)return zi;Vd=1;var e=sb(),t=ub(),r=cb();function n(o){return t(o)?r(o):e(o)}return zi=n,zi}var $i,Ud;function db(){if(Ud)return $i;Ud=1;var e=hu(),t=Pr(),r=rr(),n=ab(),o=lb(),i="[object Map]",a="[object Set]";function s(l){if(l==null)return 0;if(r(l))return n(l)?o(l):l.length;var u=t(l);return u==i||u==a?l.size:e(l).length}return $i=s,$i}var Gi,Kd;function fb(){if(Kd)return Gi;Kd=1;var e=lu(),t=Kp(),r=mu(),n=tr(),o=Ct(),i=Te(),a=Mr(),s=Ur(),l=Ge(),u=Yr();function c(d,f,p){var x=i(d),y=x||a(d)||u(d);if(f=n(f,4),p==null){var g=d&&d.constructor;y?p=x?new g:[]:l(d)?p=s(g)?t(o(d)):{}:p={}}return(y?e:r)(d,function(v,h,b){return f(p,v,h,b)}),p}return Gi=c,Gi}var Wi,Zd;function hb(){if(Zd)return Wi;Zd=1;var e=Ar(),t=Zr(),r=Te(),n=e?e.isConcatSpreadable:void 0;function o(i){return r(i)||t(i)||!!(n&&i&&i[n])}return Wi=o,Wi}var Hi,Yd;function wu(){if(Yd)return Hi;Yd=1;var e=gu(),t=hb();function r(n,o,i,a,s){var l=-1,u=n.length;for(i||(i=t),s||(s=[]);++l<u;){var c=n[l];o>0&&i(c)?o>1?r(c,o-1,i,a,s):e(s,c):a||(s[s.length]=c)}return s}return Hi=r,Hi}var Vi,Xd;function pb(){if(Xd)return Vi;Xd=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Vi=e,Vi}var Ui,Jd;function vg(){if(Jd)return Ui;Jd=1;var e=pb(),t=Math.max;function r(n,o,i){return o=t(o===void 0?n.length-1:o,0),function(){for(var a=arguments,s=-1,l=t(a.length-o,0),u=Array(l);++s<l;)u[s]=a[o+s];s=-1;for(var c=Array(o+1);++s<o;)c[s]=a[s];return c[o]=i(u),e(n,this,c)}}return Ui=r,Ui}var Ki,Qd;function gb(){if(Qd)return Ki;Qd=1;var e=yu(),t=kp(),r=xr(),n=t?function(o,i){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:r;return Ki=n,Ki}var Zi,ef;function vb(){if(ef)return Zi;ef=1;var e=800,t=16,r=Date.now;function n(o){var i=0,a=0;return function(){var s=r(),l=t-(s-a);if(a=s,l>0){if(++i>=e)return arguments[0]}else i=0;return o.apply(void 0,arguments)}}return Zi=n,Zi}var Yi,rf;function yg(){if(rf)return Yi;rf=1;var e=gb(),t=vb(),r=t(e);return Yi=r,Yi}var Xi,tf;function It(){if(tf)return Xi;tf=1;var e=xr(),t=vg(),r=yg();function n(o,i){return r(t(o,i,e),o+"")}return Xi=n,Xi}var Ji,nf;function bg(){if(nf)return Ji;nf=1;function e(t,r,n,o){for(var i=t.length,a=n+(o?1:-1);o?a--:++a<i;)if(r(t[a],a,t))return a;return-1}return Ji=e,Ji}var Qi,of;function yb(){if(of)return Qi;of=1;function e(t){return t!==t}return Qi=e,Qi}var ea,af;function bb(){if(af)return ea;af=1;function e(t,r,n){for(var o=n-1,i=t.length;++o<i;)if(t[o]===r)return o;return-1}return ea=e,ea}var ra,sf;function mb(){if(sf)return ra;sf=1;var e=bg(),t=yb(),r=bb();function n(o,i,a){return i===i?r(o,i,a):e(o,t,a)}return ra=n,ra}var ta,uf;function xb(){if(uf)return ta;uf=1;var e=mb();function t(r,n){var o=r==null?0:r.length;return!!o&&e(r,n,0)>-1}return ta=t,ta}var na,cf;function _b(){if(cf)return na;cf=1;function e(t,r,n){for(var o=-1,i=t==null?0:t.length;++o<i;)if(n(r,t[o]))return!0;return!1}return na=e,na}var oa,lf;function wb(){if(lf)return oa;lf=1;function e(){}return oa=e,oa}var ia,df;function Cb(){if(df)return ia;df=1;var e=Hp(),t=wb(),r=xu(),n=1/0,o=e&&1/r(new e([,-0]))[1]==n?function(i){return new e(i)}:t;return ia=o,ia}var aa,ff;function Eb(){if(ff)return aa;ff=1;var e=eg(),t=xb(),r=_b(),n=rg(),o=Cb(),i=xu(),a=200;function s(l,u,c){var d=-1,f=t,p=l.length,x=!0,y=[],g=y;if(c)x=!1,f=r;else if(p>=a){var v=u?null:o(l);if(v)return i(v);x=!1,f=n,g=new e}else g=u?[]:y;e:for(;++d<p;){var h=l[d],b=u?u(h):h;if(h=c||h!==0?h:0,x&&b===b){for(var _=g.length;_--;)if(g[_]===b)continue e;u&&g.push(b),y.push(h)}else f(g,b,c)||(g!==y&&g.push(b),y.push(h))}return y}return aa=s,aa}var sa,hf;function mg(){if(hf)return sa;hf=1;var e=rr(),t=Qe();function r(n){return t(n)&&e(n)}return sa=r,sa}var ua,pf;function Rb(){if(pf)return ua;pf=1;var e=wu(),t=It(),r=Eb(),n=mg(),o=t(function(i){return r(e(i,1,n,!0))});return ua=o,ua}var ca,gf;function Sb(){if(gf)return ca;gf=1;var e=Rt();function t(r,n){return e(n,function(o){return r[o]})}return ca=t,ca}var la,vf;function xg(){if(vf)return la;vf=1;var e=Sb(),t=cr();function r(n){return n==null?[]:e(n,t(n))}return la=r,la}var da,yf;function We(){if(yf)return da;yf=1;var e;if(typeof su=="function")try{e={clone:Oy(),constant:yu(),each:Qp(),filter:lg(),has:dg(),isArray:Te(),isEmpty:nb(),isFunction:Ur(),isUndefined:fg(),keys:cr(),map:pg(),reduce:gg(),size:db(),transform:fb(),union:Rb(),values:xg()}}catch{}return e||(e=window._),da=e,da}var fa,bf;function Cu(){if(bf)return fa;bf=1;var e=We();fa=o;var t="\0",r="\0",n="";function o(c){this._isDirected=e.has(c,"directed")?c.directed:!0,this._isMultigraph=e.has(c,"multigraph")?c.multigraph:!1,this._isCompound=e.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(c){return this._label=c,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultNodeLabelFn=c,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var c=this;return e.filter(this.nodes(),function(d){return e.isEmpty(c._in[d])})},o.prototype.sinks=function(){var c=this;return e.filter(this.nodes(),function(d){return e.isEmpty(c._out[d])})},o.prototype.setNodes=function(c,d){var f=arguments,p=this;return e.each(c,function(x){f.length>1?p.setNode(x,d):p.setNode(x)}),this},o.prototype.setNode=function(c,d){return e.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=d),this):(this._nodes[c]=arguments.length>1?d:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=r,this._children[c]={},this._children[r][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},o.prototype.node=function(c){return this._nodes[c]},o.prototype.hasNode=function(c){return e.has(this._nodes,c)},o.prototype.removeNode=function(c){var d=this;if(e.has(this._nodes,c)){var f=function(p){d.removeEdge(d._edgeObjs[p])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],e.each(this.children(c),function(p){d.setParent(p)}),delete this._children[c]),e.each(e.keys(this._in[c]),f),delete this._in[c],delete this._preds[c],e.each(e.keys(this._out[c]),f),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},o.prototype.setParent=function(c,d){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(d))d=r;else{d+="";for(var f=d;!e.isUndefined(f);f=this.parent(f))if(f===c)throw new Error("Setting "+d+" as parent of "+c+" would create a cycle");this.setNode(d)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=d,this._children[d][c]=!0,this},o.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},o.prototype.parent=function(c){if(this._isCompound){var d=this._parent[c];if(d!==r)return d}},o.prototype.children=function(c){if(e.isUndefined(c)&&(c=r),this._isCompound){var d=this._children[c];if(d)return e.keys(d)}else{if(c===r)return this.nodes();if(this.hasNode(c))return[]}},o.prototype.predecessors=function(c){var d=this._preds[c];if(d)return e.keys(d)},o.prototype.successors=function(c){var d=this._sucs[c];if(d)return e.keys(d)},o.prototype.neighbors=function(c){var d=this.predecessors(c);if(d)return e.union(d,this.successors(c))},o.prototype.isLeaf=function(c){var d;return this.isDirected()?d=this.successors(c):d=this.neighbors(c),d.length===0},o.prototype.filterNodes=function(c){var d=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});d.setGraph(this.graph());var f=this;e.each(this._nodes,function(y,g){c(g)&&d.setNode(g,y)}),e.each(this._edgeObjs,function(y){d.hasNode(y.v)&&d.hasNode(y.w)&&d.setEdge(y,f.edge(y))});var p={};function x(y){var g=f.parent(y);return g===void 0||d.hasNode(g)?(p[y]=g,g):g in p?p[g]:x(g)}return this._isCompound&&e.each(d.nodes(),function(y){d.setParent(y,x(y))}),d},o.prototype.setDefaultEdgeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultEdgeLabelFn=c,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(c,d){var f=this,p=arguments;return e.reduce(c,function(x,y){return p.length>1?f.setEdge(x,y,d):f.setEdge(x,y),y}),this},o.prototype.setEdge=function(){var c,d,f,p,x=!1,y=arguments[0];typeof y=="object"&&y!==null&&"v"in y?(c=y.v,d=y.w,f=y.name,arguments.length===2&&(p=arguments[1],x=!0)):(c=y,d=arguments[1],f=arguments[3],arguments.length>2&&(p=arguments[2],x=!0)),c=""+c,d=""+d,e.isUndefined(f)||(f=""+f);var g=s(this._isDirected,c,d,f);if(e.has(this._edgeLabels,g))return x&&(this._edgeLabels[g]=p),this;if(!e.isUndefined(f)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(d),this._edgeLabels[g]=x?p:this._defaultEdgeLabelFn(c,d,f);var v=l(this._isDirected,c,d,f);return c=v.v,d=v.w,Object.freeze(v),this._edgeObjs[g]=v,i(this._preds[d],c),i(this._sucs[c],d),this._in[d][g]=v,this._out[c][g]=v,this._edgeCount++,this},o.prototype.edge=function(c,d,f){var p=arguments.length===1?u(this._isDirected,arguments[0]):s(this._isDirected,c,d,f);return this._edgeLabels[p]},o.prototype.hasEdge=function(c,d,f){var p=arguments.length===1?u(this._isDirected,arguments[0]):s(this._isDirected,c,d,f);return e.has(this._edgeLabels,p)},o.prototype.removeEdge=function(c,d,f){var p=arguments.length===1?u(this._isDirected,arguments[0]):s(this._isDirected,c,d,f),x=this._edgeObjs[p];return x&&(c=x.v,d=x.w,delete this._edgeLabels[p],delete this._edgeObjs[p],a(this._preds[d],c),a(this._sucs[c],d),delete this._in[d][p],delete this._out[c][p],this._edgeCount--),this},o.prototype.inEdges=function(c,d){var f=this._in[c];if(f){var p=e.values(f);return d?e.filter(p,function(x){return x.v===d}):p}},o.prototype.outEdges=function(c,d){var f=this._out[c];if(f){var p=e.values(f);return d?e.filter(p,function(x){return x.w===d}):p}},o.prototype.nodeEdges=function(c,d){var f=this.inEdges(c,d);if(f)return f.concat(this.outEdges(c,d))};function i(c,d){c[d]?c[d]++:c[d]=1}function a(c,d){--c[d]||delete c[d]}function s(c,d,f,p){var x=""+d,y=""+f;if(!c&&x>y){var g=x;x=y,y=g}return x+n+y+n+(e.isUndefined(p)?t:p)}function l(c,d,f,p){var x=""+d,y=""+f;if(!c&&x>y){var g=x;x=y,y=g}var v={v:x,w:y};return p&&(v.name=p),v}function u(c,d){return s(c,d.v,d.w,d.name)}return fa}var ha,mf;function qb(){return mf||(mf=1,ha="2.1.8"),ha}var pa,xf;function Ib(){return xf||(xf=1,pa={Graph:Cu(),version:qb()}),pa}var ga,_f;function Tb(){if(_f)return ga;_f=1;var e=We(),t=Cu();ga={write:r,read:i};function r(a){var s={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:n(a),edges:o(a)};return e.isUndefined(a.graph())||(s.value=e.clone(a.graph())),s}function n(a){return e.map(a.nodes(),function(s){var l=a.node(s),u=a.parent(s),c={v:s};return e.isUndefined(l)||(c.value=l),e.isUndefined(u)||(c.parent=u),c})}function o(a){return e.map(a.edges(),function(s){var l=a.edge(s),u={v:s.v,w:s.w};return e.isUndefined(s.name)||(u.name=s.name),e.isUndefined(l)||(u.value=l),u})}function i(a){var s=new t(a.options).setGraph(a.value);return e.each(a.nodes,function(l){s.setNode(l.v,l.value),l.parent&&s.setParent(l.v,l.parent)}),e.each(a.edges,function(l){s.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),s}return ga}var va,wf;function Ab(){if(wf)return va;wf=1;var e=We();va=t;function t(r){var n={},o=[],i;function a(s){e.has(n,s)||(n[s]=!0,i.push(s),e.each(r.successors(s),a),e.each(r.predecessors(s),a))}return e.each(r.nodes(),function(s){i=[],a(s),i.length&&o.push(i)}),o}return va}var ya,Cf;function _g(){if(Cf)return ya;Cf=1;var e=We();ya=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var n=this._keyIndices[r];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,n){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var i=this._arr,a=i.length;return o[r]=a,i.push({key:r,priority:n}),this._decrease(a),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,n){var o=this._keyIndices[r];if(n>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+n);this._arr[o].priority=n,this._decrease(o)},t.prototype._heapify=function(r){var n=this._arr,o=2*r,i=o+1,a=r;o<n.length&&(a=n[o].priority<n[a].priority?o:a,i<n.length&&(a=n[i].priority<n[a].priority?i:a),a!==r&&(this._swap(r,a),this._heapify(a)))},t.prototype._decrease=function(r){for(var n=this._arr,o=n[r].priority,i;r!==0&&(i=r>>1,!(n[i].priority<o));)this._swap(r,i),r=i},t.prototype._swap=function(r,n){var o=this._arr,i=this._keyIndices,a=o[r],s=o[n];o[r]=s,o[n]=a,i[s.key]=r,i[a.key]=n},ya}var ba,Ef;function wg(){if(Ef)return ba;Ef=1;var e=We(),t=_g();ba=n;var r=e.constant(1);function n(i,a,s,l){return o(i,String(a),s||r,l||function(u){return i.outEdges(u)})}function o(i,a,s,l){var u={},c=new t,d,f,p=function(x){var y=x.v!==d?x.v:x.w,g=u[y],v=s(x),h=f.distance+v;if(v<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+v);h<g.distance&&(g.distance=h,g.predecessor=d,c.decrease(y,h))};for(i.nodes().forEach(function(x){var y=x===a?0:Number.POSITIVE_INFINITY;u[x]={distance:y},c.add(x,y)});c.size()>0&&(d=c.removeMin(),f=u[d],f.distance!==Number.POSITIVE_INFINITY);)l(d).forEach(p);return u}return ba}var ma,Rf;function Mb(){if(Rf)return ma;Rf=1;var e=wg(),t=We();ma=r;function r(n,o,i){return t.transform(n.nodes(),function(a,s){a[s]=e(n,s,o,i)},{})}return ma}var xa,Sf;function Cg(){if(Sf)return xa;Sf=1;var e=We();xa=t;function t(r){var n=0,o=[],i={},a=[];function s(l){var u=i[l]={onStack:!0,lowlink:n,index:n++};if(o.push(l),r.successors(l).forEach(function(f){e.has(i,f)?i[f].onStack&&(u.lowlink=Math.min(u.lowlink,i[f].index)):(s(f),u.lowlink=Math.min(u.lowlink,i[f].lowlink))}),u.lowlink===u.index){var c=[],d;do d=o.pop(),i[d].onStack=!1,c.push(d);while(l!==d);a.push(c)}}return r.nodes().forEach(function(l){e.has(i,l)||s(l)}),a}return xa}var _a,qf;function Pb(){if(qf)return _a;qf=1;var e=We(),t=Cg();_a=r;function r(n){return e.filter(t(n),function(o){return o.length>1||o.length===1&&n.hasEdge(o[0],o[0])})}return _a}var wa,If;function Ob(){if(If)return wa;If=1;var e=We();wa=r;var t=e.constant(1);function r(o,i,a){return n(o,i||t,a||function(s){return o.outEdges(s)})}function n(o,i,a){var s={},l=o.nodes();return l.forEach(function(u){s[u]={},s[u][u]={distance:0},l.forEach(function(c){u!==c&&(s[u][c]={distance:Number.POSITIVE_INFINITY})}),a(u).forEach(function(c){var d=c.v===u?c.w:c.v,f=i(c);s[u][d]={distance:f,predecessor:u}})}),l.forEach(function(u){var c=s[u];l.forEach(function(d){var f=s[d];l.forEach(function(p){var x=f[u],y=c[p],g=f[p],v=x.distance+y.distance;v<g.distance&&(g.distance=v,g.predecessor=y.predecessor)})})}),s}return wa}var Ca,Tf;function Eg(){if(Tf)return Ca;Tf=1;var e=We();Ca=t,t.CycleException=r;function t(n){var o={},i={},a=[];function s(l){if(e.has(i,l))throw new r;e.has(o,l)||(i[l]=!0,o[l]=!0,e.each(n.predecessors(l),s),delete i[l],a.push(l))}if(e.each(n.sinks(),s),e.size(o)!==n.nodeCount())throw new r;return a}function r(){}return r.prototype=new Error,Ca}var Ea,Af;function jb(){if(Af)return Ea;Af=1;var e=Eg();Ea=t;function t(r){try{e(r)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}return Ea}var Ra,Mf;function Rg(){if(Mf)return Ra;Mf=1;var e=We();Ra=t;function t(n,o,i){e.isArray(o)||(o=[o]);var a=(n.isDirected()?n.successors:n.neighbors).bind(n),s=[],l={};return e.each(o,function(u){if(!n.hasNode(u))throw new Error("Graph does not have node: "+u);r(n,u,i==="post",l,a,s)}),s}function r(n,o,i,a,s,l){e.has(a,o)||(a[o]=!0,i||l.push(o),e.each(s(o),function(u){r(n,u,i,a,s,l)}),i&&l.push(o))}return Ra}var Sa,Pf;function kb(){if(Pf)return Sa;Pf=1;var e=Rg();Sa=t;function t(r,n){return e(r,n,"post")}return Sa}var qa,Of;function Nb(){if(Of)return qa;Of=1;var e=Rg();qa=t;function t(r,n){return e(r,n,"pre")}return qa}var Ia,jf;function Lb(){if(jf)return Ia;jf=1;var e=We(),t=Cu(),r=_g();Ia=n;function n(o,i){var a=new t,s={},l=new r,u;function c(f){var p=f.v===u?f.w:f.v,x=l.priority(p);if(x!==void 0){var y=i(f);y<x&&(s[p]=u,l.decrease(p,y))}}if(o.nodeCount()===0)return a;e.each(o.nodes(),function(f){l.add(f,Number.POSITIVE_INFINITY),a.setNode(f)}),l.decrease(o.nodes()[0],0);for(var d=!1;l.size()>0;){if(u=l.removeMin(),e.has(s,u))a.setEdge(u,s[u]);else{if(d)throw new Error("Input graph is not connected: "+o);d=!0}o.nodeEdges(u).forEach(c)}return a}return Ia}var Ta,kf;function Fb(){return kf||(kf=1,Ta={components:Ab(),dijkstra:wg(),dijkstraAll:Mb(),findCycles:Pb(),floydWarshall:Ob(),isAcyclic:jb(),postorder:kb(),preorder:Nb(),prim:Lb(),tarjan:Cg(),topsort:Eg()}),Ta}var Aa,Nf;function Db(){if(Nf)return Aa;Nf=1;var e=Ib();return Aa={Graph:e.Graph,json:Tb(),alg:Fb(),version:e.version},Aa}var Ma,Lf;function He(){if(Lf)return Ma;Lf=1;var e;if(typeof su=="function")try{e=Db()}catch{}return e||(e=window.graphlib),Ma=e,Ma}var Pa,Ff;function Bb(){if(Ff)return Pa;Ff=1;var e=Yp(),t=1,r=4;function n(o){return e(o,t|r)}return Pa=n,Pa}var Oa,Df;function Tt(){if(Df)return Oa;Df=1;var e=Tr(),t=rr(),r=xt(),n=Ge();function o(i,a,s){if(!n(s))return!1;var l=typeof a;return(l=="number"?t(s)&&r(a,s.length):l=="string"&&a in s)?e(s[a],i):!1}return Oa=o,Oa}var ja,Bf;function zb(){if(Bf)return ja;Bf=1;var e=It(),t=Tr(),r=Tt(),n=mr(),o=Object.prototype,i=o.hasOwnProperty,a=e(function(s,l){s=Object(s);var u=-1,c=l.length,d=c>2?l[2]:void 0;for(d&&r(l[0],l[1],d)&&(c=1);++u<c;)for(var f=l[u],p=n(f),x=-1,y=p.length;++x<y;){var g=p[x],v=s[g];(v===void 0||t(v,o[g])&&!i.call(s,g))&&(s[g]=f[g])}return s});return ja=a,ja}var ka,zf;function $b(){if(zf)return ka;zf=1;var e=tr(),t=rr(),r=cr();function n(o){return function(i,a,s){var l=Object(i);if(!t(i)){var u=e(a,3);i=r(i),a=function(d){return u(l[d],d,l)}}var c=o(i,a,s);return c>-1?l[u?i[c]:c]:void 0}}return ka=n,ka}var Na,$f;function Gb(){if($f)return Na;$f=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Na=t,Na}var La,Gf;function Wb(){if(Gf)return La;Gf=1;var e=Gb(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return La=r,La}var Fa,Wf;function Hb(){if(Wf)return Fa;Wf=1;var e=Wb(),t=Ge(),r=Or(),n=NaN,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=t(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=e(u);var d=i.test(u);return d||a.test(u)?s(u.slice(2),d?2:8):o.test(u)?n:+u}return Fa=l,Fa}var Da,Hf;function Sg(){if(Hf)return Da;Hf=1;var e=Hb(),t=1/0,r=17976931348623157e292;function n(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var i=o<0?-1:1;return i*r}return o===o?o:0}return Da=n,Da}var Ba,Vf;function Vb(){if(Vf)return Ba;Vf=1;var e=Sg();function t(r){var n=e(r),o=n%1;return n===n?o?n-o:n:0}return Ba=t,Ba}var za,Uf;function Ub(){if(Uf)return za;Uf=1;var e=bg(),t=tr(),r=Vb(),n=Math.max;function o(i,a,s){var l=i==null?0:i.length;if(!l)return-1;var u=s==null?0:r(s);return u<0&&(u=n(l+u,0)),e(i,t(a,3),u)}return za=o,za}var $a,Kf;function Kb(){if(Kf)return $a;Kf=1;var e=$b(),t=Ub(),r=e(t);return $a=r,$a}var Ga,Zf;function qg(){if(Zf)return Ga;Zf=1;var e=wu();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return Ga=t,Ga}var Wa,Yf;function Zb(){if(Yf)return Wa;Yf=1;var e=bu(),t=Xp(),r=mr();function n(o,i){return o==null?o:e(o,t(i),r)}return Wa=n,Wa}var Ha,Xf;function Yb(){if(Xf)return Ha;Xf=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ha=e,Ha}var Va,Jf;function Xb(){if(Jf)return Va;Jf=1;var e=bt(),t=mu(),r=tr();function n(o,i){var a={};return i=r(i,3),t(o,function(s,l,u){e(a,l,i(s,l,u))}),a}return Va=n,Va}var Ua,Qf;function Eu(){if(Qf)return Ua;Qf=1;var e=Or();function t(r,n,o){for(var i=-1,a=r.length;++i<a;){var s=r[i],l=n(s);if(l!=null&&(u===void 0?l===l&&!e(l):o(l,u)))var u=l,c=s}return c}return Ua=t,Ua}var Ka,eh;function Jb(){if(eh)return Ka;eh=1;function e(t,r){return t>r}return Ka=e,Ka}var Za,rh;function Qb(){if(rh)return Za;rh=1;var e=Eu(),t=Jb(),r=xr();function n(o){return o&&o.length?e(o,r,t):void 0}return Za=n,Za}var Ya,th;function Ig(){if(th)return Ya;th=1;var e=bt(),t=Tr();function r(n,o,i){(i!==void 0&&!t(n[o],i)||i===void 0&&!(o in n))&&e(n,o,i)}return Ya=r,Ya}var Xa,nh;function em(){if(nh)return Xa;nh=1;var e=yr(),t=Ct(),r=Qe(),n="[object Object]",o=Function.prototype,i=Object.prototype,a=o.toString,s=i.hasOwnProperty,l=a.call(Object);function u(c){if(!r(c)||e(c)!=n)return!1;var d=t(c);if(d===null)return!0;var f=s.call(d,"constructor")&&d.constructor;return typeof f=="function"&&f instanceof f&&a.call(f)==l}return Xa=u,Xa}var Ja,oh;function Tg(){if(oh)return Ja;oh=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return Ja=e,Ja}var Qa,ih;function rm(){if(ih)return Qa;ih=1;var e=Kr(),t=mr();function r(n){return e(n,t(n))}return Qa=r,Qa}var es,ah;function tm(){if(ah)return es;ah=1;var e=Ig(),t=Fp(),r=Up(),n=Dp(),o=Zp(),i=Zr(),a=Te(),s=mg(),l=Mr(),u=Ur(),c=Ge(),d=em(),f=Yr(),p=Tg(),x=rm();function y(g,v,h,b,_,w,E){var R=p(g,h),I=p(v,h),A=E.get(I);if(A){e(g,h,A);return}var k=w?w(R,I,h+"",g,v,E):void 0,M=k===void 0;if(M){var z=a(I),G=!z&&l(I),U=!z&&!G&&f(I);k=I,z||G||U?a(R)?k=R:s(R)?k=n(R):G?(M=!1,k=t(I,!0)):U?(M=!1,k=r(I,!0)):k=[]:d(I)||i(I)?(k=R,i(R)?k=x(R):(!c(R)||u(R))&&(k=o(I))):M=!1}M&&(E.set(I,k),_(k,I,b,w,E),E.delete(I)),e(g,h,k)}return es=y,es}var rs,sh;function nm(){if(sh)return rs;sh=1;var e=yt(),t=Ig(),r=bu(),n=tm(),o=Ge(),i=mr(),a=Tg();function s(l,u,c,d,f){l!==u&&r(u,function(p,x){if(f||(f=new e),o(p))n(l,u,x,c,s,d,f);else{var y=d?d(a(l,x),p,x+"",l,u,f):void 0;y===void 0&&(y=p),t(l,x,y)}},i)}return rs=s,rs}var ts,uh;function om(){if(uh)return ts;uh=1;var e=It(),t=Tt();function r(n){return e(function(o,i){var a=-1,s=i.length,l=s>1?i[s-1]:void 0,u=s>2?i[2]:void 0;for(l=n.length>3&&typeof l=="function"?(s--,l):void 0,u&&t(i[0],i[1],u)&&(l=s<3?void 0:l,s=1),o=Object(o);++a<s;){var c=i[a];c&&n(o,c,a,l)}return o})}return ts=r,ts}var ns,ch;function im(){if(ch)return ns;ch=1;var e=nm(),t=om(),r=t(function(n,o,i){e(n,o,i)});return ns=r,ns}var os,lh;function Ag(){if(lh)return os;lh=1;function e(t,r){return t<r}return os=e,os}var is,dh;function am(){if(dh)return is;dh=1;var e=Eu(),t=Ag(),r=xr();function n(o){return o&&o.length?e(o,r,t):void 0}return is=n,is}var as,fh;function sm(){if(fh)return as;fh=1;var e=Eu(),t=tr(),r=Ag();function n(o,i){return o&&o.length?e(o,t(i,2),r):void 0}return as=n,as}var ss,hh;function um(){if(hh)return ss;hh=1;var e=Ve(),t=function(){return e.Date.now()};return ss=t,ss}var us,ph;function cm(){if(ph)return us;ph=1;var e=mt(),t=St(),r=xt(),n=Ge(),o=Xr();function i(a,s,l,u){if(!n(a))return a;s=t(s,a);for(var c=-1,d=s.length,f=d-1,p=a;p!=null&&++c<d;){var x=o(s[c]),y=l;if(x==="__proto__"||x==="constructor"||x==="prototype")return a;if(c!=f){var g=p[x];y=u?u(g,x,p):void 0,y===void 0&&(y=n(g)?g:r(s[c+1])?[]:{})}e(p,x,y),p=p[x]}return a}return us=i,us}var cs,gh;function lm(){if(gh)return cs;gh=1;var e=qt(),t=cm(),r=St();function n(o,i,a){for(var s=-1,l=i.length,u={};++s<l;){var c=i[s],d=e(o,c);a(d,c)&&t(u,r(c,o),d)}return u}return cs=n,cs}var ls,vh;function dm(){if(vh)return ls;vh=1;var e=lm(),t=ug();function r(n,o){return e(n,o,function(i,a){return t(n,a)})}return ls=r,ls}var ds,yh;function fm(){if(yh)return ds;yh=1;var e=qg(),t=vg(),r=yg();function n(o){return r(t(o,void 0,e),o+"")}return ds=n,ds}var fs,bh;function hm(){if(bh)return fs;bh=1;var e=dm(),t=fm(),r=t(function(n,o){return n==null?{}:e(n,o)});return fs=r,fs}var hs,mh;function pm(){if(mh)return hs;mh=1;var e=Math.ceil,t=Math.max;function r(n,o,i,a){for(var s=-1,l=t(e((o-n)/(i||1)),0),u=Array(l);l--;)u[a?l:++s]=n,n+=i;return u}return hs=r,hs}var ps,xh;function gm(){if(xh)return ps;xh=1;var e=pm(),t=Tt(),r=Sg();function n(o){return function(i,a,s){return s&&typeof s!="number"&&t(i,a,s)&&(a=s=void 0),i=r(i),a===void 0?(a=i,i=0):a=r(a),s=s===void 0?i<a?1:-1:r(s),e(i,a,s,o)}}return ps=n,ps}var gs,_h;function vm(){if(_h)return gs;_h=1;var e=gm(),t=e();return gs=t,gs}var vs,wh;function ym(){if(wh)return vs;wh=1;function e(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}return vs=e,vs}var ys,Ch;function bm(){if(Ch)return ys;Ch=1;var e=Or();function t(r,n){if(r!==n){var o=r!==void 0,i=r===null,a=r===r,s=e(r),l=n!==void 0,u=n===null,c=n===n,d=e(n);if(!u&&!d&&!s&&r>n||s&&l&&c&&!u&&!d||i&&l&&c||!o&&c||!a)return 1;if(!i&&!s&&!d&&r<n||d&&o&&a&&!i&&!s||u&&o&&a||!l&&a||!c)return-1}return 0}return ys=t,ys}var bs,Eh;function mm(){if(Eh)return bs;Eh=1;var e=bm();function t(r,n,o){for(var i=-1,a=r.criteria,s=n.criteria,l=a.length,u=o.length;++i<l;){var c=e(a[i],s[i]);if(c){if(i>=u)return c;var d=o[i];return c*(d=="desc"?-1:1)}}return r.index-n.index}return bs=t,bs}var ms,Rh;function xm(){if(Rh)return ms;Rh=1;var e=Rt(),t=qt(),r=tr(),n=hg(),o=ym(),i=_t(),a=mm(),s=xr(),l=Te();function u(c,d,f){d.length?d=e(d,function(y){return l(y)?function(g){return t(g,y.length===1?y[0]:y)}:y}):d=[s];var p=-1;d=e(d,i(r));var x=n(c,function(y,g,v){var h=e(d,function(b){return b(y)});return{criteria:h,index:++p,value:y}});return o(x,function(y,g){return a(y,g,f)})}return ms=u,ms}var xs,Sh;function _m(){if(Sh)return xs;Sh=1;var e=wu(),t=xm(),r=It(),n=Tt(),o=r(function(i,a){if(i==null)return[];var s=a.length;return s>1&&n(i,a[0],a[1])?a=[]:s>2&&n(a[0],a[1],a[2])&&(a=[a[0]]),t(i,e(a,1),[])});return xs=o,xs}var _s,qh;function wm(){if(qh)return _s;qh=1;var e=ag(),t=0;function r(n){var o=++t;return e(n)+o}return _s=r,_s}var ws,Ih;function Cm(){if(Ih)return ws;Ih=1;function e(t,r,n){for(var o=-1,i=t.length,a=r.length,s={};++o<i;){var l=o<a?r[o]:void 0;n(s,t[o],l)}return s}return ws=e,ws}var Cs,Th;function Em(){if(Th)return Cs;Th=1;var e=mt(),t=Cm();function r(n,o){return t(n||[],o||[],e)}return Cs=r,Cs}var Es,Ah;function Re(){if(Ah)return Es;Ah=1;var e;if(typeof su=="function")try{e={cloneDeep:Bb(),constant:yu(),defaults:zb(),each:Qp(),filter:lg(),find:Kb(),flatten:qg(),forEach:Jp(),forIn:Zb(),has:dg(),isUndefined:fg(),last:Yb(),map:pg(),mapValues:Xb(),max:Qb(),merge:im(),min:am(),minBy:sm(),now:um(),pick:hm(),range:vm(),reduce:gg(),sortBy:_m(),uniqueId:wm(),values:xg(),zipObject:Em()}}catch{}return e||(e=window._),Es=e,Es}var Rs,Mh;function Rm(){if(Mh)return Rs;Mh=1,Rs=e;function e(){var n={};n._next=n._prev=n,this._sentinel=n}e.prototype.dequeue=function(){var n=this._sentinel,o=n._prev;if(o!==n)return t(o),o},e.prototype.enqueue=function(n){var o=this._sentinel;n._prev&&n._next&&t(n),n._next=o._next,o._next._prev=n,o._next=n,n._prev=o},e.prototype.toString=function(){for(var n=[],o=this._sentinel,i=o._prev;i!==o;)n.push(JSON.stringify(i,r)),i=i._prev;return"["+n.join(", ")+"]"};function t(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function r(n,o){if(n!=="_next"&&n!=="_prev")return o}return Rs}var Ss,Ph;function Sm(){if(Ph)return Ss;Ph=1;var e=Re(),t=He().Graph,r=Rm();Ss=o;var n=e.constant(1);function o(u,c){if(u.nodeCount()<=1)return[];var d=s(u,c||n),f=i(d.graph,d.buckets,d.zeroIdx);return e.flatten(e.map(f,function(p){return u.outEdges(p.v,p.w)}),!0)}function i(u,c,d){for(var f=[],p=c[c.length-1],x=c[0],y;u.nodeCount();){for(;y=x.dequeue();)a(u,c,d,y);for(;y=p.dequeue();)a(u,c,d,y);if(u.nodeCount()){for(var g=c.length-2;g>0;--g)if(y=c[g].dequeue(),y){f=f.concat(a(u,c,d,y,!0));break}}}return f}function a(u,c,d,f,p){var x=p?[]:void 0;return e.forEach(u.inEdges(f.v),function(y){var g=u.edge(y),v=u.node(y.v);p&&x.push({v:y.v,w:y.w}),v.out-=g,l(c,d,v)}),e.forEach(u.outEdges(f.v),function(y){var g=u.edge(y),v=y.w,h=u.node(v);h.in-=g,l(c,d,h)}),u.removeNode(f.v),x}function s(u,c){var d=new t,f=0,p=0;e.forEach(u.nodes(),function(g){d.setNode(g,{v:g,in:0,out:0})}),e.forEach(u.edges(),function(g){var v=d.edge(g.v,g.w)||0,h=c(g),b=v+h;d.setEdge(g.v,g.w,b),p=Math.max(p,d.node(g.v).out+=h),f=Math.max(f,d.node(g.w).in+=h)});var x=e.range(p+f+3).map(function(){return new r}),y=f+1;return e.forEach(d.nodes(),function(g){l(x,y,d.node(g))}),{graph:d,buckets:x,zeroIdx:y}}function l(u,c,d){d.out?d.in?u[d.out-d.in+c].enqueue(d):u[u.length-1].enqueue(d):u[0].enqueue(d)}return Ss}var qs,Oh;function qm(){if(Oh)return qs;Oh=1;var e=Re(),t=Sm();qs={run:r,undo:o};function r(i){var a=i.graph().acyclicer==="greedy"?t(i,s(i)):n(i);e.forEach(a,function(l){var u=i.edge(l);i.removeEdge(l),u.forwardName=l.name,u.reversed=!0,i.setEdge(l.w,l.v,u,e.uniqueId("rev"))});function s(l){return function(u){return l.edge(u).weight}}}function n(i){var a=[],s={},l={};function u(c){e.has(l,c)||(l[c]=!0,s[c]=!0,e.forEach(i.outEdges(c),function(d){e.has(s,d.w)?a.push(d):u(d.w)}),delete s[c])}return e.forEach(i.nodes(),u),a}function o(i){e.forEach(i.edges(),function(a){var s=i.edge(a);if(s.reversed){i.removeEdge(a);var l=s.forwardName;delete s.reversed,delete s.forwardName,i.setEdge(a.w,a.v,s,l)}})}return qs}var Is,jh;function ke(){if(jh)return Is;jh=1;var e=Re(),t=He().Graph;Is={addDummyNode:r,simplify:n,asNonCompoundGraph:o,successorWeights:i,predecessorWeights:a,intersectRect:s,buildLayerMatrix:l,normalizeRanks:u,removeEmptyRanks:c,addBorderNode:d,maxRank:f,partition:p,time:x,notime:y};function r(g,v,h,b){var _;do _=e.uniqueId(b);while(g.hasNode(_));return h.dummy=v,g.setNode(_,h),_}function n(g){var v=new t().setGraph(g.graph());return e.forEach(g.nodes(),function(h){v.setNode(h,g.node(h))}),e.forEach(g.edges(),function(h){var b=v.edge(h.v,h.w)||{weight:0,minlen:1},_=g.edge(h);v.setEdge(h.v,h.w,{weight:b.weight+_.weight,minlen:Math.max(b.minlen,_.minlen)})}),v}function o(g){var v=new t({multigraph:g.isMultigraph()}).setGraph(g.graph());return e.forEach(g.nodes(),function(h){g.children(h).length||v.setNode(h,g.node(h))}),e.forEach(g.edges(),function(h){v.setEdge(h,g.edge(h))}),v}function i(g){var v=e.map(g.nodes(),function(h){var b={};return e.forEach(g.outEdges(h),function(_){b[_.w]=(b[_.w]||0)+g.edge(_).weight}),b});return e.zipObject(g.nodes(),v)}function a(g){var v=e.map(g.nodes(),function(h){var b={};return e.forEach(g.inEdges(h),function(_){b[_.v]=(b[_.v]||0)+g.edge(_).weight}),b});return e.zipObject(g.nodes(),v)}function s(g,v){var h=g.x,b=g.y,_=v.x-h,w=v.y-b,E=g.width/2,R=g.height/2;if(!_&&!w)throw new Error("Not possible to find intersection inside of the rectangle");var I,A;return Math.abs(w)*E>Math.abs(_)*R?(w<0&&(R=-R),I=R*_/w,A=R):(_<0&&(E=-E),I=E,A=E*w/_),{x:h+I,y:b+A}}function l(g){var v=e.map(e.range(f(g)+1),function(){return[]});return e.forEach(g.nodes(),function(h){var b=g.node(h),_=b.rank;e.isUndefined(_)||(v[_][b.order]=h)}),v}function u(g){var v=e.min(e.map(g.nodes(),function(h){return g.node(h).rank}));e.forEach(g.nodes(),function(h){var b=g.node(h);e.has(b,"rank")&&(b.rank-=v)})}function c(g){var v=e.min(e.map(g.nodes(),function(w){return g.node(w).rank})),h=[];e.forEach(g.nodes(),function(w){var E=g.node(w).rank-v;h[E]||(h[E]=[]),h[E].push(w)});var b=0,_=g.graph().nodeRankFactor;e.forEach(h,function(w,E){e.isUndefined(w)&&E%_!==0?--b:b&&e.forEach(w,function(R){g.node(R).rank+=b})})}function d(g,v,h,b){var _={width:0,height:0};return arguments.length>=4&&(_.rank=h,_.order=b),r(g,"border",_,v)}function f(g){return e.max(e.map(g.nodes(),function(v){var h=g.node(v).rank;if(!e.isUndefined(h))return h}))}function p(g,v){var h={lhs:[],rhs:[]};return e.forEach(g,function(b){v(b)?h.lhs.push(b):h.rhs.push(b)}),h}function x(g,v){var h=e.now();try{return v()}finally{console.log(g+" time: "+(e.now()-h)+"ms")}}function y(g,v){return v()}return Is}var Ts,kh;function Im(){if(kh)return Ts;kh=1;var e=Re(),t=ke();Ts={run:r,undo:o};function r(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(a){n(i,a)})}function n(i,a){var s=a.v,l=i.node(s).rank,u=a.w,c=i.node(u).rank,d=a.name,f=i.edge(a),p=f.labelRank;if(c!==l+1){i.removeEdge(a);var x,y,g;for(g=0,++l;l<c;++g,++l)f.points=[],y={width:0,height:0,edgeLabel:f,edgeObj:a,rank:l},x=t.addDummyNode(i,"edge",y,"_d"),l===p&&(y.width=f.width,y.height=f.height,y.dummy="edge-label",y.labelpos=f.labelpos),i.setEdge(s,x,{weight:f.weight},d),g===0&&i.graph().dummyChains.push(x),s=x;i.setEdge(s,u,{weight:f.weight},d)}}function o(i){e.forEach(i.graph().dummyChains,function(a){var s=i.node(a),l=s.edgeLabel,u;for(i.setEdge(s.edgeObj,l);s.dummy;)u=i.successors(a)[0],i.removeNode(a),l.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(l.x=s.x,l.y=s.y,l.width=s.width,l.height=s.height),a=u,s=i.node(a)})}return Ts}var As,Nh;function at(){if(Nh)return As;Nh=1;var e=Re();As={longestPath:t,slack:r};function t(n){var o={};function i(a){var s=n.node(a);if(e.has(o,a))return s.rank;o[a]=!0;var l=e.min(e.map(n.outEdges(a),function(u){return i(u.w)-n.edge(u).minlen}));return(l===Number.POSITIVE_INFINITY||l===void 0||l===null)&&(l=0),s.rank=l}e.forEach(n.sources(),i)}function r(n,o){return n.node(o.w).rank-n.node(o.v).rank-n.edge(o).minlen}return As}var Ms,Lh;function Mg(){if(Lh)return Ms;Lh=1;var e=Re(),t=He().Graph,r=at().slack;Ms=n;function n(s){var l=new t({directed:!1}),u=s.nodes()[0],c=s.nodeCount();l.setNode(u,{});for(var d,f;o(l,s)<c;)d=i(l,s),f=l.hasNode(d.v)?r(s,d):-r(s,d),a(l,s,f);return l}function o(s,l){function u(c){e.forEach(l.nodeEdges(c),function(d){var f=d.v,p=c===f?d.w:f;!s.hasNode(p)&&!r(l,d)&&(s.setNode(p,{}),s.setEdge(c,p,{}),u(p))})}return e.forEach(s.nodes(),u),s.nodeCount()}function i(s,l){return e.minBy(l.edges(),function(u){if(s.hasNode(u.v)!==s.hasNode(u.w))return r(l,u)})}function a(s,l,u){e.forEach(s.nodes(),function(c){l.node(c).rank+=u})}return Ms}var Ps,Fh;function Tm(){if(Fh)return Ps;Fh=1;var e=Re(),t=Mg(),r=at().slack,n=at().longestPath,o=He().alg.preorder,i=He().alg.postorder,a=ke().simplify;Ps=s,s.initLowLimValues=d,s.initCutValues=l,s.calcCutValue=c,s.leaveEdge=p,s.enterEdge=x,s.exchangeEdges=y;function s(b){b=a(b),n(b);var _=t(b);d(_),l(_,b);for(var w,E;w=p(_);)E=x(_,b,w),y(_,b,w,E)}function l(b,_){var w=i(b,b.nodes());w=w.slice(0,w.length-1),e.forEach(w,function(E){u(b,_,E)})}function u(b,_,w){var E=b.node(w),R=E.parent;b.edge(w,R).cutvalue=c(b,_,w)}function c(b,_,w){var E=b.node(w),R=E.parent,I=!0,A=_.edge(w,R),k=0;return A||(I=!1,A=_.edge(R,w)),k=A.weight,e.forEach(_.nodeEdges(w),function(M){var z=M.v===w,G=z?M.w:M.v;if(G!==R){var U=z===I,V=_.edge(M).weight;if(k+=U?V:-V,v(b,w,G)){var X=b.edge(w,G).cutvalue;k+=U?-X:X}}}),k}function d(b,_){arguments.length<2&&(_=b.nodes()[0]),f(b,{},1,_)}function f(b,_,w,E,R){var I=w,A=b.node(E);return _[E]=!0,e.forEach(b.neighbors(E),function(k){e.has(_,k)||(w=f(b,_,w,k,E))}),A.low=I,A.lim=w++,R?A.parent=R:delete A.parent,w}function p(b){return e.find(b.edges(),function(_){return b.edge(_).cutvalue<0})}function x(b,_,w){var E=w.v,R=w.w;_.hasEdge(E,R)||(E=w.w,R=w.v);var I=b.node(E),A=b.node(R),k=I,M=!1;I.lim>A.lim&&(k=A,M=!0);var z=e.filter(_.edges(),function(G){return M===h(b,b.node(G.v),k)&&M!==h(b,b.node(G.w),k)});return e.minBy(z,function(G){return r(_,G)})}function y(b,_,w,E){var R=w.v,I=w.w;b.removeEdge(R,I),b.setEdge(E.v,E.w,{}),d(b),l(b,_),g(b,_)}function g(b,_){var w=e.find(b.nodes(),function(R){return!_.node(R).parent}),E=o(b,w);E=E.slice(1),e.forEach(E,function(R){var I=b.node(R).parent,A=_.edge(R,I),k=!1;A||(A=_.edge(I,R),k=!0),_.node(R).rank=_.node(I).rank+(k?A.minlen:-A.minlen)})}function v(b,_,w){return b.hasEdge(_,w)}function h(b,_,w){return w.low<=_.lim&&_.lim<=w.lim}return Ps}var Os,Dh;function Am(){if(Dh)return Os;Dh=1;var e=at(),t=e.longestPath,r=Mg(),n=Tm();Os=o;function o(l){switch(l.graph().ranker){case"network-simplex":s(l);break;case"tight-tree":a(l);break;case"longest-path":i(l);break;default:s(l)}}var i=t;function a(l){t(l),r(l)}function s(l){n(l)}return Os}var js,Bh;function Mm(){if(Bh)return js;Bh=1;var e=Re();js=t;function t(o){var i=n(o);e.forEach(o.graph().dummyChains,function(a){for(var s=o.node(a),l=s.edgeObj,u=r(o,i,l.v,l.w),c=u.path,d=u.lca,f=0,p=c[f],x=!0;a!==l.w;){if(s=o.node(a),x){for(;(p=c[f])!==d&&o.node(p).maxRank<s.rank;)f++;p===d&&(x=!1)}if(!x){for(;f<c.length-1&&o.node(p=c[f+1]).minRank<=s.rank;)f++;p=c[f]}o.setParent(a,p),a=o.successors(a)[0]}})}function r(o,i,a,s){var l=[],u=[],c=Math.min(i[a].low,i[s].low),d=Math.max(i[a].lim,i[s].lim),f,p;f=a;do f=o.parent(f),l.push(f);while(f&&(i[f].low>c||d>i[f].lim));for(p=f,f=s;(f=o.parent(f))!==p;)u.push(f);return{path:l.concat(u.reverse()),lca:p}}function n(o){var i={},a=0;function s(l){var u=a;e.forEach(o.children(l),s),i[l]={low:u,lim:a++}}return e.forEach(o.children(),s),i}return js}var ks,zh;function Pm(){if(zh)return ks;zh=1;var e=Re(),t=ke();ks={run:r,cleanup:a};function r(s){var l=t.addDummyNode(s,"root",{},"_root"),u=o(s),c=e.max(e.values(u))-1,d=2*c+1;s.graph().nestingRoot=l,e.forEach(s.edges(),function(p){s.edge(p).minlen*=d});var f=i(s)+1;e.forEach(s.children(),function(p){n(s,l,d,f,c,u,p)}),s.graph().nodeRankFactor=d}function n(s,l,u,c,d,f,p){var x=s.children(p);if(!x.length){p!==l&&s.setEdge(l,p,{weight:0,minlen:u});return}var y=t.addBorderNode(s,"_bt"),g=t.addBorderNode(s,"_bb"),v=s.node(p);s.setParent(y,p),v.borderTop=y,s.setParent(g,p),v.borderBottom=g,e.forEach(x,function(h){n(s,l,u,c,d,f,h);var b=s.node(h),_=b.borderTop?b.borderTop:h,w=b.borderBottom?b.borderBottom:h,E=b.borderTop?c:2*c,R=_!==w?1:d-f[p]+1;s.setEdge(y,_,{weight:E,minlen:R,nestingEdge:!0}),s.setEdge(w,g,{weight:E,minlen:R,nestingEdge:!0})}),s.parent(p)||s.setEdge(l,y,{weight:0,minlen:d+f[p]})}function o(s){var l={};function u(c,d){var f=s.children(c);f&&f.length&&e.forEach(f,function(p){u(p,d+1)}),l[c]=d}return e.forEach(s.children(),function(c){u(c,1)}),l}function i(s){return e.reduce(s.edges(),function(l,u){return l+s.edge(u).weight},0)}function a(s){var l=s.graph();s.removeNode(l.nestingRoot),delete l.nestingRoot,e.forEach(s.edges(),function(u){var c=s.edge(u);c.nestingEdge&&s.removeEdge(u)})}return ks}var Ns,$h;function Om(){if($h)return Ns;$h=1;var e=Re(),t=ke();Ns=r;function r(o){function i(a){var s=o.children(a),l=o.node(a);if(s.length&&e.forEach(s,i),e.has(l,"minRank")){l.borderLeft=[],l.borderRight=[];for(var u=l.minRank,c=l.maxRank+1;u<c;++u)n(o,"borderLeft","_bl",a,l,u),n(o,"borderRight","_br",a,l,u)}}e.forEach(o.children(),i)}function n(o,i,a,s,l,u){var c={width:0,height:0,rank:u,borderType:i},d=l[i][u-1],f=t.addDummyNode(o,"border",c,a);l[i][u]=f,o.setParent(f,s),d&&o.setEdge(d,f,{weight:1})}return Ns}var Ls,Gh;function jm(){if(Gh)return Ls;Gh=1;var e=Re();Ls={adjust:t,undo:r};function t(u){var c=u.graph().rankdir.toLowerCase();(c==="lr"||c==="rl")&&n(u)}function r(u){var c=u.graph().rankdir.toLowerCase();(c==="bt"||c==="rl")&&i(u),(c==="lr"||c==="rl")&&(s(u),n(u))}function n(u){e.forEach(u.nodes(),function(c){o(u.node(c))}),e.forEach(u.edges(),function(c){o(u.edge(c))})}function o(u){var c=u.width;u.width=u.height,u.height=c}function i(u){e.forEach(u.nodes(),function(c){a(u.node(c))}),e.forEach(u.edges(),function(c){var d=u.edge(c);e.forEach(d.points,a),e.has(d,"y")&&a(d)})}function a(u){u.y=-u.y}function s(u){e.forEach(u.nodes(),function(c){l(u.node(c))}),e.forEach(u.edges(),function(c){var d=u.edge(c);e.forEach(d.points,l),e.has(d,"x")&&l(d)})}function l(u){var c=u.x;u.x=u.y,u.y=c}return Ls}var Fs,Wh;function km(){if(Wh)return Fs;Wh=1;var e=Re();Fs=t;function t(r){var n={},o=e.filter(r.nodes(),function(u){return!r.children(u).length}),i=e.max(e.map(o,function(u){return r.node(u).rank})),a=e.map(e.range(i+1),function(){return[]});function s(u){if(!e.has(n,u)){n[u]=!0;var c=r.node(u);a[c.rank].push(u),e.forEach(r.successors(u),s)}}var l=e.sortBy(o,function(u){return r.node(u).rank});return e.forEach(l,s),a}return Fs}var Ds,Hh;function Nm(){if(Hh)return Ds;Hh=1;var e=Re();Ds=t;function t(n,o){for(var i=0,a=1;a<o.length;++a)i+=r(n,o[a-1],o[a]);return i}function r(n,o,i){for(var a=e.zipObject(i,e.map(i,function(f,p){return p})),s=e.flatten(e.map(o,function(f){return e.sortBy(e.map(n.outEdges(f),function(p){return{pos:a[p.w],weight:n.edge(p).weight}}),"pos")}),!0),l=1;l<i.length;)l<<=1;var u=2*l-1;l-=1;var c=e.map(new Array(u),function(){return 0}),d=0;return e.forEach(s.forEach(function(f){var p=f.pos+l;c[p]+=f.weight;for(var x=0;p>0;)p%2&&(x+=c[p+1]),p=p-1>>1,c[p]+=f.weight;d+=f.weight*x})),d}return Ds}var Bs,Vh;function Lm(){if(Vh)return Bs;Vh=1;var e=Re();Bs=t;function t(r,n){return e.map(n,function(o){var i=r.inEdges(o);if(i.length){var a=e.reduce(i,function(s,l){var u=r.edge(l),c=r.node(l.v);return{sum:s.sum+u.weight*c.order,weight:s.weight+u.weight}},{sum:0,weight:0});return{v:o,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:o}})}return Bs}var zs,Uh;function Fm(){if(Uh)return zs;Uh=1;var e=Re();zs=t;function t(o,i){var a={};e.forEach(o,function(l,u){var c=a[l.v]={indegree:0,in:[],out:[],vs:[l.v],i:u};e.isUndefined(l.barycenter)||(c.barycenter=l.barycenter,c.weight=l.weight)}),e.forEach(i.edges(),function(l){var u=a[l.v],c=a[l.w];!e.isUndefined(u)&&!e.isUndefined(c)&&(c.indegree++,u.out.push(a[l.w]))});var s=e.filter(a,function(l){return!l.indegree});return r(s)}function r(o){var i=[];function a(u){return function(c){c.merged||(e.isUndefined(c.barycenter)||e.isUndefined(u.barycenter)||c.barycenter>=u.barycenter)&&n(u,c)}}function s(u){return function(c){c.in.push(u),--c.indegree===0&&o.push(c)}}for(;o.length;){var l=o.pop();i.push(l),e.forEach(l.in.reverse(),a(l)),e.forEach(l.out,s(l))}return e.map(e.filter(i,function(u){return!u.merged}),function(u){return e.pick(u,["vs","i","barycenter","weight"])})}function n(o,i){var a=0,s=0;o.weight&&(a+=o.barycenter*o.weight,s+=o.weight),i.weight&&(a+=i.barycenter*i.weight,s+=i.weight),o.vs=i.vs.concat(o.vs),o.barycenter=a/s,o.weight=s,o.i=Math.min(i.i,o.i),i.merged=!0}return zs}var $s,Kh;function Dm(){if(Kh)return $s;Kh=1;var e=Re(),t=ke();$s=r;function r(i,a){var s=t.partition(i,function(y){return e.has(y,"barycenter")}),l=s.lhs,u=e.sortBy(s.rhs,function(y){return-y.i}),c=[],d=0,f=0,p=0;l.sort(o(!!a)),p=n(c,u,p),e.forEach(l,function(y){p+=y.vs.length,c.push(y.vs),d+=y.barycenter*y.weight,f+=y.weight,p=n(c,u,p)});var x={vs:e.flatten(c,!0)};return f&&(x.barycenter=d/f,x.weight=f),x}function n(i,a,s){for(var l;a.length&&(l=e.last(a)).i<=s;)a.pop(),i.push(l.vs),s++;return s}function o(i){return function(a,s){return a.barycenter<s.barycenter?-1:a.barycenter>s.barycenter?1:i?s.i-a.i:a.i-s.i}}return $s}var Gs,Zh;function Bm(){if(Zh)return Gs;Zh=1;var e=Re(),t=Lm(),r=Fm(),n=Dm();Gs=o;function o(s,l,u,c){var d=s.children(l),f=s.node(l),p=f?f.borderLeft:void 0,x=f?f.borderRight:void 0,y={};p&&(d=e.filter(d,function(w){return w!==p&&w!==x}));var g=t(s,d);e.forEach(g,function(w){if(s.children(w.v).length){var E=o(s,w.v,u,c);y[w.v]=E,e.has(E,"barycenter")&&a(w,E)}});var v=r(g,u);i(v,y);var h=n(v,c);if(p&&(h.vs=e.flatten([p,h.vs,x],!0),s.predecessors(p).length)){var b=s.node(s.predecessors(p)[0]),_=s.node(s.predecessors(x)[0]);e.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+b.order+_.order)/(h.weight+2),h.weight+=2}return h}function i(s,l){e.forEach(s,function(u){u.vs=e.flatten(u.vs.map(function(c){return l[c]?l[c].vs:c}),!0)})}function a(s,l){e.isUndefined(s.barycenter)?(s.barycenter=l.barycenter,s.weight=l.weight):(s.barycenter=(s.barycenter*s.weight+l.barycenter*l.weight)/(s.weight+l.weight),s.weight+=l.weight)}return Gs}var Ws,Yh;function zm(){if(Yh)return Ws;Yh=1;var e=Re(),t=He().Graph;Ws=r;function r(o,i,a){var s=n(o),l=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(u){return o.node(u)});return e.forEach(o.nodes(),function(u){var c=o.node(u),d=o.parent(u);(c.rank===i||c.minRank<=i&&i<=c.maxRank)&&(l.setNode(u),l.setParent(u,d||s),e.forEach(o[a](u),function(f){var p=f.v===u?f.w:f.v,x=l.edge(p,u),y=e.isUndefined(x)?0:x.weight;l.setEdge(p,u,{weight:o.edge(f).weight+y})}),e.has(c,"minRank")&&l.setNode(u,{borderLeft:c.borderLeft[i],borderRight:c.borderRight[i]}))}),l}function n(o){for(var i;o.hasNode(i=e.uniqueId("_root")););return i}return Ws}var Hs,Xh;function $m(){if(Xh)return Hs;Xh=1;var e=Re();Hs=t;function t(r,n,o){var i={},a;e.forEach(o,function(s){for(var l=r.parent(s),u,c;l;){if(u=r.parent(l),u?(c=i[u],i[u]=l):(c=a,a=l),c&&c!==l){n.setEdge(c,l);return}l=u}})}return Hs}var Vs,Jh;function Gm(){if(Jh)return Vs;Jh=1;var e=Re(),t=km(),r=Nm(),n=Bm(),o=zm(),i=$m(),a=He().Graph,s=ke();Vs=l;function l(f){var p=s.maxRank(f),x=u(f,e.range(1,p+1),"inEdges"),y=u(f,e.range(p-1,-1,-1),"outEdges"),g=t(f);d(f,g);for(var v=Number.POSITIVE_INFINITY,h,b=0,_=0;_<4;++b,++_){c(b%2?x:y,b%4>=2),g=s.buildLayerMatrix(f);var w=r(f,g);w<v&&(_=0,h=e.cloneDeep(g),v=w)}d(f,h)}function u(f,p,x){return e.map(p,function(y){return o(f,y,x)})}function c(f,p){var x=new a;e.forEach(f,function(y){var g=y.graph().root,v=n(y,g,x,p);e.forEach(v.vs,function(h,b){y.node(h).order=b}),i(y,x,v.vs)})}function d(f,p){e.forEach(p,function(x){e.forEach(x,function(y,g){f.node(y).order=g})})}return Vs}var Us,Qh;function Wm(){if(Qh)return Us;Qh=1;var e=Re(),t=He().Graph,r=ke();Us={positionX:x,findType1Conflicts:n,findType2Conflicts:o,addConflict:a,hasConflict:s,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:f,findSmallestWidthAlignment:d,balance:p};function n(v,h){var b={};function _(w,E){var R=0,I=0,A=w.length,k=e.last(E);return e.forEach(E,function(M,z){var G=i(v,M),U=G?v.node(G).order:A;(G||M===k)&&(e.forEach(E.slice(I,z+1),function(V){e.forEach(v.predecessors(V),function(X){var he=v.node(X),ee=he.order;(ee<R||U<ee)&&!(he.dummy&&v.node(V).dummy)&&a(b,X,V)})}),I=z+1,R=U)}),E}return e.reduce(h,_),b}function o(v,h){var b={};function _(E,R,I,A,k){var M;e.forEach(e.range(R,I),function(z){M=E[z],v.node(M).dummy&&e.forEach(v.predecessors(M),function(G){var U=v.node(G);U.dummy&&(U.order<A||U.order>k)&&a(b,G,M)})})}function w(E,R){var I=-1,A,k=0;return e.forEach(R,function(M,z){if(v.node(M).dummy==="border"){var G=v.predecessors(M);G.length&&(A=v.node(G[0]).order,_(R,k,z,I,A),k=z,I=A)}_(R,k,R.length,A,E.length)}),R}return e.reduce(h,w),b}function i(v,h){if(v.node(h).dummy)return e.find(v.predecessors(h),function(b){return v.node(b).dummy})}function a(v,h,b){if(h>b){var _=h;h=b,b=_}var w=v[h];w||(v[h]=w={}),w[b]=!0}function s(v,h,b){if(h>b){var _=h;h=b,b=_}return e.has(v[h],b)}function l(v,h,b,_){var w={},E={},R={};return e.forEach(h,function(I){e.forEach(I,function(A,k){w[A]=A,E[A]=A,R[A]=k})}),e.forEach(h,function(I){var A=-1;e.forEach(I,function(k){var M=_(k);if(M.length){M=e.sortBy(M,function(X){return R[X]});for(var z=(M.length-1)/2,G=Math.floor(z),U=Math.ceil(z);G<=U;++G){var V=M[G];E[k]===k&&A<R[V]&&!s(b,k,V)&&(E[V]=k,E[k]=w[k]=w[V],A=R[V])}}})}),{root:w,align:E}}function u(v,h,b,_,w){var E={},R=c(v,h,b,w),I=w?"borderLeft":"borderRight";function A(z,G){for(var U=R.nodes(),V=U.pop(),X={};V;)X[V]?z(V):(X[V]=!0,U.push(V),U=U.concat(G(V))),V=U.pop()}function k(z){E[z]=R.inEdges(z).reduce(function(G,U){return Math.max(G,E[U.v]+R.edge(U))},0)}function M(z){var G=R.outEdges(z).reduce(function(V,X){return Math.min(V,E[X.w]-R.edge(X))},Number.POSITIVE_INFINITY),U=v.node(z);G!==Number.POSITIVE_INFINITY&&U.borderType!==I&&(E[z]=Math.max(E[z],G))}return A(k,R.predecessors.bind(R)),A(M,R.successors.bind(R)),e.forEach(_,function(z){E[z]=E[b[z]]}),E}function c(v,h,b,_){var w=new t,E=v.graph(),R=y(E.nodesep,E.edgesep,_);return e.forEach(h,function(I){var A;e.forEach(I,function(k){var M=b[k];if(w.setNode(M),A){var z=b[A],G=w.edge(z,M);w.setEdge(z,M,Math.max(R(v,k,A),G||0))}A=k})}),w}function d(v,h){return e.minBy(e.values(h),function(b){var _=Number.NEGATIVE_INFINITY,w=Number.POSITIVE_INFINITY;return e.forIn(b,function(E,R){var I=g(v,R)/2;_=Math.max(E+I,_),w=Math.min(E-I,w)}),_-w})}function f(v,h){var b=e.values(h),_=e.min(b),w=e.max(b);e.forEach(["u","d"],function(E){e.forEach(["l","r"],function(R){var I=E+R,A=v[I],k;if(A!==h){var M=e.values(A);k=R==="l"?_-e.min(M):w-e.max(M),k&&(v[I]=e.mapValues(A,function(z){return z+k}))}})})}function p(v,h){return e.mapValues(v.ul,function(b,_){if(h)return v[h.toLowerCase()][_];var w=e.sortBy(e.map(v,_));return(w[1]+w[2])/2})}function x(v){var h=r.buildLayerMatrix(v),b=e.merge(n(v,h),o(v,h)),_={},w;e.forEach(["u","d"],function(R){w=R==="u"?h:e.values(h).reverse(),e.forEach(["l","r"],function(I){I==="r"&&(w=e.map(w,function(z){return e.values(z).reverse()}));var A=(R==="u"?v.predecessors:v.successors).bind(v),k=l(v,w,b,A),M=u(v,w,k.root,k.align,I==="r");I==="r"&&(M=e.mapValues(M,function(z){return-z})),_[R+I]=M})});var E=d(v,_);return f(_,E),p(_,v.graph().align)}function y(v,h,b){return function(_,w,E){var R=_.node(w),I=_.node(E),A=0,k;if(A+=R.width/2,e.has(R,"labelpos"))switch(R.labelpos.toLowerCase()){case"l":k=-R.width/2;break;case"r":k=R.width/2;break}if(k&&(A+=b?k:-k),k=0,A+=(R.dummy?h:v)/2,A+=(I.dummy?h:v)/2,A+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":k=I.width/2;break;case"r":k=-I.width/2;break}return k&&(A+=b?k:-k),k=0,A}}function g(v,h){return v.node(h).width}return Us}var Ks,ep;function Hm(){if(ep)return Ks;ep=1;var e=Re(),t=ke(),r=Wm().positionX;Ks=n;function n(i){i=t.asNonCompoundGraph(i),o(i),e.forEach(r(i),function(a,s){i.node(s).x=a})}function o(i){var a=t.buildLayerMatrix(i),s=i.graph().ranksep,l=0;e.forEach(a,function(u){var c=e.max(e.map(u,function(d){return i.node(d).height}));e.forEach(u,function(d){i.node(d).y=l+c/2}),l+=c+s})}return Ks}var Zs,rp;function Vm(){if(rp)return Zs;rp=1;var e=Re(),t=qm(),r=Im(),n=Am(),o=ke().normalizeRanks,i=Mm(),a=ke().removeEmptyRanks,s=Pm(),l=Om(),u=jm(),c=Gm(),d=Hm(),f=ke(),p=He().Graph;Zs=x;function x(S,O){var D=O&&O.debugTiming?f.time:f.notime;D("layout",function(){var F=D(" buildLayoutGraph",function(){return A(S)});D(" runLayout",function(){y(F,D)}),D(" updateInputGraph",function(){g(S,F)})})}function y(S,O){O(" makeSpaceForEdgeLabels",function(){k(S)}),O(" removeSelfEdges",function(){Y(S)}),O(" acyclic",function(){t.run(S)}),O(" nestingGraph.run",function(){s.run(S)}),O(" rank",function(){n(f.asNonCompoundGraph(S))}),O(" injectEdgeLabelProxies",function(){M(S)}),O(" removeEmptyRanks",function(){a(S)}),O(" nestingGraph.cleanup",function(){s.cleanup(S)}),O(" normalizeRanks",function(){o(S)}),O(" assignRankMinMax",function(){z(S)}),O(" removeEdgeLabelProxies",function(){G(S)}),O(" normalize.run",function(){r.run(S)}),O(" parentDummyChains",function(){i(S)}),O(" addBorderSegments",function(){l(S)}),O(" order",function(){c(S)}),O(" insertSelfEdges",function(){oe(S)}),O(" adjustCoordinateSystem",function(){u.adjust(S)}),O(" position",function(){d(S)}),O(" positionSelfEdges",function(){pe(S)}),O(" removeBorderNodes",function(){ee(S)}),O(" normalize.undo",function(){r.undo(S)}),O(" fixupEdgeLabelCoords",function(){X(S)}),O(" undoCoordinateSystem",function(){u.undo(S)}),O(" translateGraph",function(){U(S)}),O(" assignNodeIntersects",function(){V(S)}),O(" reversePoints",function(){he(S)}),O(" acyclic.undo",function(){t.undo(S)})}function g(S,O){e.forEach(S.nodes(),function(D){var F=S.node(D),Z=O.node(D);F&&(F.x=Z.x,F.y=Z.y,O.children(D).length&&(F.width=Z.width,F.height=Z.height))}),e.forEach(S.edges(),function(D){var F=S.edge(D),Z=O.edge(D);F.points=Z.points,e.has(Z,"x")&&(F.x=Z.x,F.y=Z.y)}),S.graph().width=O.graph().width,S.graph().height=O.graph().height}var v=["nodesep","edgesep","ranksep","marginx","marginy"],h={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],_=["width","height"],w={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],R={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function A(S){var O=new p({multigraph:!0,compound:!0}),D=ge(S.graph());return O.setGraph(e.merge({},h,fe(D,v),e.pick(D,b))),e.forEach(S.nodes(),function(F){var Z=ge(S.node(F));O.setNode(F,e.defaults(fe(Z,_),w)),O.setParent(F,S.parent(F))}),e.forEach(S.edges(),function(F){var Z=ge(S.edge(F));O.setEdge(F,e.merge({},R,fe(Z,E),e.pick(Z,I)))}),O}function k(S){var O=S.graph();O.ranksep/=2,e.forEach(S.edges(),function(D){var F=S.edge(D);F.minlen*=2,F.labelpos.toLowerCase()!=="c"&&(O.rankdir==="TB"||O.rankdir==="BT"?F.width+=F.labeloffset:F.height+=F.labeloffset)})}function M(S){e.forEach(S.edges(),function(O){var D=S.edge(O);if(D.width&&D.height){var F=S.node(O.v),Z=S.node(O.w),ne={rank:(Z.rank-F.rank)/2+F.rank,e:O};f.addDummyNode(S,"edge-proxy",ne,"_ep")}})}function z(S){var O=0;e.forEach(S.nodes(),function(D){var F=S.node(D);F.borderTop&&(F.minRank=S.node(F.borderTop).rank,F.maxRank=S.node(F.borderBottom).rank,O=e.max(O,F.maxRank))}),S.graph().maxRank=O}function G(S){e.forEach(S.nodes(),function(O){var D=S.node(O);D.dummy==="edge-proxy"&&(S.edge(D.e).labelRank=D.rank,S.removeNode(O))})}function U(S){var O=Number.POSITIVE_INFINITY,D=0,F=Number.POSITIVE_INFINITY,Z=0,ne=S.graph(),re=ne.marginx||0,ue=ne.marginy||0;function Ce(ie){var ve=ie.x,W=ie.y,ye=ie.width,K=ie.height;O=Math.min(O,ve-ye/2),D=Math.max(D,ve+ye/2),F=Math.min(F,W-K/2),Z=Math.max(Z,W+K/2)}e.forEach(S.nodes(),function(ie){Ce(S.node(ie))}),e.forEach(S.edges(),function(ie){var ve=S.edge(ie);e.has(ve,"x")&&Ce(ve)}),O-=re,F-=ue,e.forEach(S.nodes(),function(ie){var ve=S.node(ie);ve.x-=O,ve.y-=F}),e.forEach(S.edges(),function(ie){var ve=S.edge(ie);e.forEach(ve.points,function(W){W.x-=O,W.y-=F}),e.has(ve,"x")&&(ve.x-=O),e.has(ve,"y")&&(ve.y-=F)}),ne.width=D-O+re,ne.height=Z-F+ue}function V(S){e.forEach(S.edges(),function(O){var D=S.edge(O),F=S.node(O.v),Z=S.node(O.w),ne,re;D.points?(ne=D.points[0],re=D.points[D.points.length-1]):(D.points=[],ne=Z,re=F),D.points.unshift(f.intersectRect(F,ne)),D.points.push(f.intersectRect(Z,re))})}function X(S){e.forEach(S.edges(),function(O){var D=S.edge(O);if(e.has(D,"x"))switch((D.labelpos==="l"||D.labelpos==="r")&&(D.width-=D.labeloffset),D.labelpos){case"l":D.x-=D.width/2+D.labeloffset;break;case"r":D.x+=D.width/2+D.labeloffset;break}})}function he(S){e.forEach(S.edges(),function(O){var D=S.edge(O);D.reversed&&D.points.reverse()})}function ee(S){e.forEach(S.nodes(),function(O){if(S.children(O).length){var D=S.node(O),F=S.node(D.borderTop),Z=S.node(D.borderBottom),ne=S.node(e.last(D.borderLeft)),re=S.node(e.last(D.borderRight));D.width=Math.abs(re.x-ne.x),D.height=Math.abs(Z.y-F.y),D.x=ne.x+D.width/2,D.y=F.y+D.height/2}}),e.forEach(S.nodes(),function(O){S.node(O).dummy==="border"&&S.removeNode(O)})}function Y(S){e.forEach(S.edges(),function(O){if(O.v===O.w){var D=S.node(O.v);D.selfEdges||(D.selfEdges=[]),D.selfEdges.push({e:O,label:S.edge(O)}),S.removeEdge(O)}})}function oe(S){var O=f.buildLayerMatrix(S);e.forEach(O,function(D){var F=0;e.forEach(D,function(Z,ne){var re=S.node(Z);re.order=ne+F,e.forEach(re.selfEdges,function(ue){f.addDummyNode(S,"selfedge",{width:ue.label.width,height:ue.label.height,rank:re.rank,order:ne+ ++F,e:ue.e,label:ue.label},"_se")}),delete re.selfEdges})})}function pe(S){e.forEach(S.nodes(),function(O){var D=S.node(O);if(D.dummy==="selfedge"){var F=S.node(D.e.v),Z=F.x+F.width/2,ne=F.y,re=D.x-Z,ue=F.height/2;S.setEdge(D.e,D.label),S.removeNode(O),D.label.points=[{x:Z+2*re/3,y:ne-ue},{x:Z+5*re/6,y:ne-ue},{x:Z+re,y:ne},{x:Z+5*re/6,y:ne+ue},{x:Z+2*re/3,y:ne+ue}],D.label.x=D.x,D.label.y=D.y}})}function fe(S,O){return e.mapValues(e.pick(S,O),Number)}function ge(S){var O={};return e.forEach(S,function(D,F){O[F.toLowerCase()]=D}),O}return Zs}var Ys,tp;function Um(){if(tp)return Ys;tp=1;var e=Re(),t=ke(),r=He().Graph;Ys={debugOrdering:n};function n(o){var i=t.buildLayerMatrix(o),a=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(s){a.setNode(s,{label:s}),a.setParent(s,"layer"+o.node(s).rank)}),e.forEach(o.edges(),function(s){a.setEdge(s.v,s.w,{},s.name)}),e.forEach(i,function(s,l){var u="layer"+l;a.setNode(u,{rank:"same"}),e.reduce(s,function(c,d){return a.setEdge(c,d,{style:"invis"}),d})}),a}return Ys}var Xs,np;function Km(){return np||(np=1,Xs="0.8.5"),Xs}var Js,op;function Zm(){return op||(op=1,Js={graphlib:He(),layout:Vm(),debug:Um(),util:{time:ke().time,notime:ke().notime},version:Km()}),Js}var Ym=Zm();const ip=jv(Ym);function Xm(e,t,r){const n=new Set(e.map(u=>u.id)),o=new Set;for(const u of e)u.parent&&n.has(u.parent)&&o.add(u.parent);const i=new ip.graphlib.Graph({multigraph:!0,compound:!0});i.setGraph({rankdir:r.rankDir,nodesep:r.nodeSep,edgesep:r.edgeSep,ranksep:r.rankSep,ranker:"network-simplex"}),i.setDefaultEdgeLabel(()=>({})),i.setDefaultNodeLabel(()=>({}));for(const u of e)i.setNode(u.id,{width:u.width+2,height:u.height+2});for(const u of e)u.parent&&n.has(u.parent)&&i.setParent(u.id,u.parent);for(const u of t)!n.has(u.source)||!n.has(u.target)||o.has(u.source)||o.has(u.target)||i.setEdge(u.source,u.target,{minlen:1,weight:1},u.id);ip.layout(i);const a=new Map;for(const u of e){if(o.has(u.id))continue;const c=i.node(u.id);c&&Number.isFinite(c.x)&&Number.isFinite(c.y)&&a.set(u.id,{x:c.x,y:c.y})}const s=r.spacingFactor;if(a.size){let u=1/0,c=1/0,d=-1/0,f=-1/0;a.forEach(y=>{u=Math.min(u,y.x),c=Math.min(c,y.y),d=Math.max(d,y.x),f=Math.max(f,y.y)});const p=(u+d)/2,x=(c+f)/2;a.forEach((y,g)=>a.set(g,{x:p+(y.x-p)*s,y:x+(y.y-x)*s}))}const l=r.nodeAlignment??"center";if(l!=="center"){const u=r.rankDir==="LR"||r.rankDir==="RL",c=u?"x":"y",d=u?"width":"height",f=r.rankDir==="RL"||r.rankDir==="BT"?-1:1,p=l==="leading"?-f:f,x=new Map;for(const y of e){const g=a.get(y.id);if(!g)continue;const v=g[c];x.set(v,Math.max(x.get(v)??0,y[d]))}for(const y of e){const g=a.get(y.id);if(!g)continue;const v=g[c],h=(x.get(v)-y[d])/2;a.set(y.id,{...g,[c]:v+p*h})}}return a}function Jm(e,t,r,n,o){const i=new Map,a=new Map(e.map(c=>[c.id,c]));for(const c of e){if(!c.parent||!a.has(c.parent))continue;const d=i.get(c.parent);d?d.push(c.id):i.set(c.parent,[c.id])}const s=(c,d=new Set)=>{var p;const f=(p=a.get(c))==null?void 0:p.parent;return!f||!a.has(f)||d.has(c)?0:(d.add(c),1+s(f,d))},l=[...i.keys()].sort((c,d)=>s(d)-s(c)),u=new Map;for(const c of l){let d=null;for(const x of i.get(c)||[]){let y=u.get(x);if(!y){const g=t.get(x);if(!g)continue;const v=r.get(x)||{w:60,h:60};y={x1:g.x-v.w/2,y1:g.y-v.h/2,x2:g.x+v.w/2,y2:g.y+v.h/2}}d=d?{x1:Math.min(d.x1,y.x1),y1:Math.min(d.y1,y.y1),x2:Math.max(d.x2,y.x2),y2:Math.max(d.y2,y.y2)}:{...y}}if(!d)continue;const f=n(c);d={x1:d.x1-f,y1:d.y1-f,x2:d.x2+f,y2:d.y2+f};const p=o(c);if(p){const x=d.x2-d.x1,y=d.y2-d.y1;if(p.w>x){const g=(p.w-x)/2;d.x1-=g,d.x2+=g}if(p.h>y){const g=(p.h-y)/2;d.y1-=g,d.y2+=g}}u.set(c,d)}return u}function Qm(e){const t=e.getBoundingClientRect(),r=t.height/e.offsetHeight;return!Number.isFinite(r)||r<=0?[]:[...e.querySelectorAll("[data-flow-property]")].flatMap(n=>{if(n.closest(".flow-sdk-node")!==e)return[];const o=n.getBoundingClientRect();return!o.width||!o.height?[]:[{property:n.getAttribute("data-flow-property"),top:Math.round((o.top-t.top)/r*1e3)/1e3,height:Math.round(o.height/r*1e3)/1e3}]})}function ex({id:e,x:t,y:r,placed:n,onMount:o,drawHandles:i,handleColor:a,propertyMode:s,reversePorts:l,onPropertyRows:u,children:c}){const d=q.useRef(null),[f,p]=q.useState([]);return q.useLayoutEffect(()=>(o(e,d.current),()=>o(e,null)),[e,o]),q.useLayoutEffect(()=>{const x=d.current;if(!x)return;let y="";const g=()=>{const _=s?Qm(x):[],w=JSON.stringify(_);w!==y&&(y=w,p(_),u==null||u(e,_))};if(g(),!s)return;const v=new ResizeObserver(g),h=()=>{v.disconnect(),v.observe(x),x.querySelectorAll("[data-flow-property]").forEach(_=>v.observe(_)),g()};h();const b=new MutationObserver(h);return b.observe(x,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["data-flow-property"]}),x.addEventListener("scroll",g,!0),()=>{v.disconnect(),b.disconnect(),x.removeEventListener("scroll",g,!0)}},[e,s,u]),m.jsxs("div",{ref:d,className:"flow-sdk-node","data-node-id":e,style:{transform:`translate(-50%, -50%) translate3d(${t.toFixed(2)}px, ${r.toFixed(2)}px, 0)`,visibility:n?void 0:"hidden"},children:[c,i&&s&&f.map(x=>["source","target"].map(y=>m.jsx("button",{type:"button",className:"flow-sdk-property-port","data-property":x.property,"data-port-role":y,"aria-label":`${y==="source"?"Connect":"Input"} ${x.property}`,title:`${y==="source"?"Connect":"Input"} ${x.property}`,style:{color:a,top:x.top+x.height/2,[y==="source"!=!!l?"right":"left"]:-16},onClick:g=>g.stopPropagation()},`${x.property}:${y}`))),i&&(!s||!f.length)&&m.jsx("button",{type:"button",className:"flow-sdk-handle","aria-label":"Draw edge",title:"Draw edge",style:{color:a},onClick:x=>x.stopPropagation(),children:m.jsx(Q.PiPlusBold,{size:24})})]})}const rx=q.memo(ex);class tx{constructor(t,r,n){hr(this,"_pan");hr(this,"_zoom");hr(this,"minZoom");hr(this,"maxZoom");hr(this,"size",{w:0,h:0});hr(this,"listeners",new Set);this.minZoom=r,this.maxZoom=n,this._pan={...t.pan},this._zoom=this.clamp(t.zoom)}get pan(){return{...this._pan}}get zoom(){return this._zoom}get state(){return{pan:this.pan,zoom:this._zoom}}clamp(t){return Number.isFinite(t)?Math.max(this.minZoom,Math.min(this.maxZoom,t)):this.minZoom}set(t,r){let n=!1;if(t&&(t.x!==this._pan.x||t.y!==this._pan.y)&&(this._pan={x:t.x,y:t.y},n=!0),r!==void 0){const o=this.clamp(r);o!==this._zoom&&(this._zoom=o,n=!0)}n&&this.emit()}zoomAt(t,r){const n=this.clamp(t),o=this._zoom;if(n===o)return;const i=n/o;this.set({x:r.x-(r.x-this._pan.x)*i,y:r.y-(r.y-this._pan.y)*i},n)}fit(t,r=0){const n=t.x2-t.x1,o=t.y2-t.y1;if(!(n>0)||!(o>0)||!this.size.w||!this.size.h)return;const i=this.clamp(Math.min((this.size.w-2*r)/n,(this.size.h-2*r)/o));this.set({x:(this.size.w-i*(t.x1+t.x2))/2,y:(this.size.h-i*(t.y1+t.y2))/2},i)}center(t){if(!this.size.w||!this.size.h)return;const r=this._zoom;this.set({x:(this.size.w-r*(t.x1+t.x2))/2,y:(this.size.h-r*(t.y1+t.y2))/2})}renderedToModel(t){return{x:(t.x-this._pan.x)/this._zoom,y:(t.y-this._pan.y)/this._zoom}}modelToRendered(t){return{x:t.x*this._zoom+this._pan.x,y:t.y*this._zoom+this._pan.y}}onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}emit(){const t=this.state;this.listeners.forEach(r=>r(t))}}const nx={LR:"rightward",RL:"leftward",TB:"downward",BT:"upward"},Qs={w:60,h:60},ap=4,ox=30,sp=300,ix=500,ax=45,sx=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function up(e){const[t,r]=[...e.values()];return!t||!r?null:{center:{x:(t.x+r.x)/2,y:(t.y+r.y)/2},distance:Math.max(1,Math.hypot(r.x-t.x,r.y-t.y))}}function ux(e){const{nodes:t,edges:r,direction:n,nodeAlignment:o="center",edgeMode:i="workflow",rankSep:a,edgeSep:s,minZoom:l,maxZoom:u,initialViewport:c,containerStyle:d,lineColor:f,drawMode:p,dragMode:x,multiSelect:y,isPerformanceMode:g}=e,v=q.useRef(e);v.current=e;const h=q.useRef(null),b=q.useRef(null),_=q.useRef(null),w=q.useMemo(()=>new tx(c,l,u),[]);q.useEffect(()=>{w.minZoom=l,w.maxZoom=u},[w,l,u]);const E=q.useRef(new Map),R=q.useRef(new Map),I=q.useRef(new Map),A=q.useRef(null),[k,M]=q.useState(new Map),z=q.useRef(k);z.current=k;const G=q.useCallback((C,T)=>{M(j=>{if(JSON.stringify(j.get(C)??[])===JSON.stringify(T))return j;const P=new Map(j);return T.length?P.set(C,T):P.delete(C),P})},[]),[U,V]=q.useState(()=>new Map),X=q.useRef(U);X.current=U;const he=q.useRef(!1),ee=q.useRef(),Y=q.useRef(),oe=q.useRef(null),pe=q.useRef(),fe=q.useRef(!1),ge=()=>{oe.current!==null&&cancelAnimationFrame(oe.current),oe.current=null,clearTimeout(pe.current)},S=()=>{!he.current&&v.current.fitOnInit!==!1&&(fe.current=!0),clearTimeout(Y.current),Y.current=setTimeout(()=>{he.current=!0},ix)},O=C=>{ge();const T=new Map(X.current),j=performance.now(),P=()=>{ge(),V(C),S()},B=J=>{const te=Math.min(1,(J-j)/sp);if(te>=1)return P();const be=sx(te),Ee=new Map;C.forEach((le,me)=>{const ae=T.get(me);Ee.set(me,ae?{x:ae.x+(le.x-ae.x)*be,y:ae.y+(le.y-ae.y)*be}:le)}),V(Ee),oe.current=requestAnimationFrame(B)};oe.current=requestAnimationFrame(B),pe.current=setTimeout(P,sp+100)},D=()=>{const C=v.current,T=C.nodes.map(P=>{const B=E.current.get(P.id)||Qs;return{id:P.id,parent:P.parent,width:B.w,height:B.h}});let j;try{j=Xm(T,C.edges,{rankDir:C.direction,nodeAlignment:C.nodeAlignment,rankSep:C.rankSep,edgeSep:C.edgeSep,nodeSep:5,spacingFactor:1.3})}catch(P){console.warn("[flow-sdk] layout failed",P);return}he.current&&!C.isPerformanceMode?O(j):(ge(),V(j),S())},F=q.useCallback(()=>{clearTimeout(ee.current),ee.current=setTimeout(D,v.current.layoutDebounce)},[]);q.useEffect(()=>{F()},[t,r,n,o,a,s,F]),q.useEffect(()=>()=>{clearTimeout(ee.current),clearTimeout(Y.current),ge()},[]);const Z=q.useCallback((C,T)=>{var j,P;if(!A.current&&typeof ResizeObserver<"u"&&(A.current=new ResizeObserver(B=>{let J=!1;for(const te of B){const be=I.current.get(te.target);if(!be)continue;const Ee=te.target,le=Ee.offsetWidth,me=Ee.offsetHeight;if(!le&&!me)continue;const ae=E.current.get(be);ae&&ae.w===le&&ae.h===me||(E.current.set(be,{w:le,h:me}),J=!0)}J&&F()})),T){R.current.set(C,T),I.current.set(T,C),(j=A.current)==null||j.observe(T);const B=T.offsetWidth,J=T.offsetHeight;(B||J)&&E.current.set(C,{w:B,h:J})}else{const B=R.current.get(C);B&&((P=A.current)==null||P.unobserve(B),I.current.delete(B)),R.current.delete(C),E.current.delete(C),z.current.has(C)&&G(C,[])}F()},[F,G]);q.useEffect(()=>()=>{var C;return(C=A.current)==null?void 0:C.disconnect()},[]);const ne=q.useMemo(()=>{const C=new Map;for(const T of t)T.label&&C.set(T.id,T.label);return C},[t]),re=q.useMemo(()=>Jm(t,U,E.current,C=>d(C).padding,C=>{const T=ne.get(C);if(!T)return;const j=d(C);return{w:iu(T,`bold ${j.fontSize}px ${ft}`)+2*ax,h:0}}),[t,U,d,ne]),ue=q.useRef(re);ue.current=re;const Ce=q.useCallback(C=>{const T=ue.current.get(C);if(T)return vv(T);const j=X.current.get(C);if(!j)return;const P=E.current.get(C)||Qs;return{x:j.x,y:j.y,w:P.w,h:P.h}},[]),ie=(C,T)=>{var B;if(i!=="properties"||T===void 0)return;const j=(B=k.get(C))==null?void 0:B.find(J=>J.property===T),P=Ce(C);return j&&P?P.y-P.h/2+j.top+j.height/2:void 0},ve=()=>{var T;const C=[];X.current.forEach((j,P)=>{if(ue.current.has(P))return;const B=E.current.get(P)||Qs;C.push(qr({x:j.x,y:j.y,w:B.w,h:B.h}))}),ue.current.forEach(j=>C.push(j));try{const j=(T=b.current)==null?void 0:T.getBBox();j&&j.width>0&&j.height>0&&C.push({x1:j.x,y1:j.y,x2:j.x+j.width,y2:j.y+j.height})}catch{}return yv(C)},W=()=>{var j;const{pan:C,zoom:T}=w;_.current&&(_.current.style.transform=`translate3d(${C.x}px, ${C.y}px, 0) scale(${T})`),(j=b.current)==null||j.setAttribute("transform",`translate(${C.x} ${C.y}) scale(${T})`)};q.useEffect(()=>{W();let C=null,T;const j=w.onChange(()=>{W();const P=h.current;P&&(P.classList.add("flow-sdk-busy"),clearTimeout(T),T=setTimeout(()=>P.classList.remove("flow-sdk-busy"),150)),C===null&&(C=requestAnimationFrame(()=>{var B,J;C=null,(J=(B=v.current).onViewportChange)==null||J.call(B,w.state)}))});return()=>{j(),clearTimeout(T),C!==null&&cancelAnimationFrame(C)}},[]),q.useLayoutEffect(()=>{const C=h.current;if(!C)return;const T=()=>{let P=C.clientWidth,B=C.clientHeight;B||(B=Math.max(0,window.innerHeight-C.getBoundingClientRect().top-100),B&&(C.style.height=`${B}px`)),P||(P=window.innerWidth,P&&(C.style.width=`${P}px`)),w.size={w:P,h:B}};if(T(),typeof ResizeObserver>"u")return;const j=new ResizeObserver(T);return j.observe(C),()=>j.disconnect()},[w]),q.useEffect(()=>{if(!fe.current)return;fe.current=!1;const C=ve();C&&w.fit(C,50)},[U]);const ye=q.useMemo(()=>{const C=(P=>{if(P===void 0)return w.zoom;w.set(void 0,P)}),T=(P=>{if(P===void 0)return w.pan;w.set(P)}),j=(P,B)=>{var te;const J=(te=h.current)==null?void 0:te.getBoundingClientRect();return{x:P-((J==null?void 0:J.left)??0),y:B-((J==null?void 0:J.top)??0)}};return{zoom:C,pan:T,zoomAt:(P,B)=>w.zoomAt(P,B),fit:(P=0)=>{const B=ve();B&&w.fit(B,P)},center:()=>{const P=ve();P&&w.center(P)},clientToModel:(P,B)=>w.renderedToModel(j(P,B)),modelToClient:P=>{var te;const B=(te=h.current)==null?void 0:te.getBoundingClientRect(),J=w.modelToRendered(P);return{x:J.x+((B==null?void 0:B.left)??0),y:J.y+((B==null?void 0:B.top)??0)}},getNodeBox:P=>Ce(P),onViewportChange:P=>w.onChange(P)}},[]);q.useEffect(()=>{var C,T;(T=(C=v.current).onInit)==null||T.call(C,ye)},[ye]);const K=q.useRef(null),we=q.useRef(new Map),Ae=q.useRef(!1),[Ie,Fe]=q.useState(null),[xe,qe]=q.useState(null),Ue=C=>{const T=h.current.getBoundingClientRect();return{x:C.clientX-T.left,y:C.clientY-T.top}},Ke=(C,T)=>{const j=v.current.nodes;for(let P=j.length-1;P>=0;P--){const B=j[P].id;if(B===T||ue.current.has(B))continue;const J=Ce(B);if(J&&Ou(C,qr(J)))return B}for(const[P,B]of ue.current)if(P!==T&&Ou(C,B))return P;return null},lr=(C,T)=>{if(v.current.edgeMode!=="properties")return null;const j=v.current.direction==="RL",P=Math.max(16,6/w.zoom);let B=null;for(const J of[...v.current.nodes].reverse()){const te=Ce(J.id),be=z.current.get(J.id);if(!te||!be||ue.current.has(J.id))continue;const Ee=te.x+(T==="source"!==j?1:-1)*te.w/2;for(const le of be){const me=te.y-te.h/2+le.top,ae=Math.hypot(C.x-Ee,C.y-me-le.height/2);if(C.x>=te.x-te.w/2&&C.x<=te.x+te.w/2&&C.y>=me&&C.y<=me+le.height)return{nodeId:J.id,property:le.property};ae<=P&&(!B||ae<B.distance)&&(B={nodeId:J.id,property:le.property,distance:ae})}}return B},_r=C=>{var te;if(C.button!==0||v.current.readOnly)return;const T=C.target;if(T.closest('input, textarea, select, [contenteditable="true"]'))return;const j=v.current,P=Ue(C);if(C.pointerType==="touch"){we.current.set(C.pointerId,P);const be=up(we.current);if(be){K.current={kind:"pinch",distance:be.distance,zoom:w.zoom,anchor:w.renderedToModel(be.center)},qe(null),Fe(null),Ae.current=!0;for(const Ee of we.current.keys())C.currentTarget.setPointerCapture(Ee);return}}if(K.current)return;Ae.current=!1;const B=j.drawHandles&&T.closest(".flow-sdk-handle"),J=j.edgeMode==="properties"&&j.drawHandles&&T.closest(".flow-sdk-property-port");if(!(J&&J.dataset.portRole!=="source")){if(j.drawMode||B||J){const be=w.renderedToModel(P),Ee=j.drawMode?lr(be,"source"):null,le=J||B,me=le?(te=le.closest("[data-node-id]"))==null?void 0:te.dataset.nodeId:(Ee==null?void 0:Ee.nodeId)??Ke(be),ae=J?J.dataset.property:Ee==null?void 0:Ee.property;if(me){K.current={kind:"draw",pointerId:C.pointerId,source:me,sourceProperty:ae,startClient:{x:C.clientX,y:C.clientY}},Ae.current=!0,qe({source:me,sourceProperty:ae,point:be,target:null}),C.currentTarget.setPointerCapture(C.pointerId);return}}T.closest(".flow-sdk-node, .flow-sdk-container, .flow-sdk-edge")||(j.multiSelect?K.current={kind:"box",pointerId:C.pointerId,start:P,current:P}:j.dragMode?K.current={kind:"pan",pointerId:C.pointerId,start:P,pan0:w.pan,moved:!1}:K.current={kind:"tap",pointerId:C.pointerId,start:P,moved:!1},C.currentTarget.setPointerCapture(C.pointerId))}},Ze=C=>{const T=K.current;if(!T||v.current.readOnly)return;const j=Ue(C);if(we.current.has(C.pointerId)&&we.current.set(C.pointerId,j),T.kind==="pinch"){const P=up(we.current);if(!P)return;const B=Math.max(w.minZoom,Math.min(w.maxZoom,T.zoom*P.distance/T.distance));w.set({x:P.center.x-T.anchor.x*B,y:P.center.y-T.anchor.y*B},B);return}if(T.pointerId===C.pointerId)switch(T.kind){case"pan":{const P=j.x-T.start.x,B=j.y-T.start.y;if(!T.moved&&Math.hypot(P,B)<=ap)return;T.moved=!0,Ae.current=!0,w.set({x:T.pan0.x+P,y:T.pan0.y+B});break}case"tap":{Math.hypot(j.x-T.start.x,j.y-T.start.y)>ap&&(T.moved=!0);break}case"box":{Ae.current=!0,T.current=j,Fe({x1:Math.min(T.start.x,j.x),y1:Math.min(T.start.y,j.y),x2:Math.max(T.start.x,j.x),y2:Math.max(T.start.y,j.y)});break}case"draw":{const P=w.renderedToModel(j),B=lr(P,"target");qe({source:T.source,sourceProperty:T.sourceProperty,point:P,target:(B==null?void 0:B.nodeId)??Ke(P,T.source),targetProperty:B==null?void 0:B.property});break}}},dr=(C,T)=>{var B,J,te,be,Ee;we.current.delete(C.pointerId);const j=K.current;if(!j)return;if(j.kind==="pinch"){const le=[...we.current][0];K.current=le&&v.current.dragMode&&!T?{kind:"pan",pointerId:le[0],start:le[1],pan0:w.pan,moved:!0}:null;return}if(j.pointerId!==C.pointerId)return;K.current=null;try{C.currentTarget.releasePointerCapture(C.pointerId)}catch{}const P=v.current;switch(T=T||!!P.readOnly,j.kind){case"pan":case"tap":!T&&!j.moved&&((B=P.onBackgroundTap)==null||B.call(P));break;case"box":{if(Fe(null),T)break;const le=w.renderedToModel(j.start),me=w.renderedToModel(j.current),ae={x1:Math.min(le.x,me.x),y1:Math.min(le.y,me.y),x2:Math.max(le.x,me.x),y2:Math.max(le.y,me.y)};if(ae.x2-ae.x1<1&&ae.y2-ae.y1<1){(J=P.onBackgroundTap)==null||J.call(P);break}const nr=[];for(const Su of P.nodes){const qu=Ce(Su.id);qu&&bv(qr(qu),ae)&&nr.push(Su.id)}nr.length&&((te=P.onBoxSelect)==null||te.call(P,nr));break}case"draw":{if(qe(null),T)break;const le=Ue(C),me=w.renderedToModel(le),ae=lr(me,"target"),nr=(ae==null?void 0:ae.nodeId)??Ke(me);if(nr===j.source&&(j.sourceProperty===void 0||(ae==null?void 0:ae.property)===void 0||ae.property===j.sourceProperty))break;nr?(be=P.onEdgeDraw)==null||be.call(P,j.source,nr,j.sourceProperty!==void 0||(ae==null?void 0:ae.property)!==void 0?{sourceProperty:j.sourceProperty,targetProperty:ae==null?void 0:ae.property}:void 0):j.sourceProperty===void 0&&Math.max(Math.abs(C.clientX-j.startClient.x),Math.abs(C.clientY-j.startClient.y))>ox&&((Ee=P.onDrawIntoSpace)==null||Ee.call(P,j.source,me));break}}},De=q.useCallback(()=>{var j;const C=K.current,T=[...we.current.keys()];C&&C.kind!=="pinch"&&T.push(C.pointerId),K.current=null,we.current.clear(),qe(null),Fe(null);for(const P of T)(j=h.current)!=null&&j.hasPointerCapture(P)&&h.current.releasePointerCapture(P)},[]);q.useEffect(()=>{const C=T=>{T.key==="Escape"&&De()};return window.addEventListener("keydown",C),window.addEventListener("blur",De),()=>{window.removeEventListener("keydown",C),window.removeEventListener("blur",De),K.current=null,we.current.clear()}},[De]),q.useEffect(()=>{De()},[p,x,y,i,n,e.drawHandles,e.readOnly,De]);const jr=q.useMemo(()=>{const C=new Map,T=new Map;for(const j of r){if(j.source!==j.target)continue;const P=C.get(j.source)??0;C.set(j.source,P+1),T.set(j.id,P)}return T},[r]),fr=nx[n],$=e.onEdgeSelect,L=e.onContainerSelect,H=xe?xe.target&&Ce(xe.target)||{x:xe.point.x,y:xe.point.y,w:1,h:1}:null,ce=xe?Ce(xe.source):null,se=["flow-sdk-canvas",p?"flow-sdk-draw":"",g?"flow-sdk-perf":""].filter(Boolean).join(" ");return m.jsxs("div",{ref:h,className:se,onPointerDownCapture:_r,onPointerMove:Ze,onPointerUp:C=>dr(C,!1),onPointerCancel:C=>dr(C,!0),onLostPointerCapture:C=>{const T=K.current;T&&(T.kind==="pinch"||T.pointerId===C.pointerId)&&De()},onClickCapture:C=>{(Ae.current||e.readOnly)&&(C.preventDefault(),C.stopPropagation())},children:[m.jsx("svg",{className:"flow-sdk-svg",children:m.jsxs("g",{ref:b,children:[m.jsx("g",{className:"flow-sdk-containers",children:[...re].map(([C,T])=>m.jsx(gv,{id:C,rect:T,label:ne.get(C),style:d(C),onSelect:L},C))}),m.jsx("g",{className:"flow-sdk-edges",children:r.map(C=>{const T=Ce(C.source),j=Ce(C.target);return!T||!j?null:m.jsx(Lu,{id:C.id,source:T,target:j,sourceProperty:C.sourceProperty,targetProperty:C.targetProperty,sourceY:ie(C.source,C.sourceProperty),targetY:ie(C.target,C.targetProperty),dir:fr,turn:C.turn,color:C.color,labelBg:C.labelBg,label:C.label,dashed:C.dashed,animated:C.animated&&!g,inverted:C.inverted,loopIndex:jr.get(C.id)??0,onSelect:$},C.id)})}),xe&&ce&&H&&m.jsx("g",{className:"flow-sdk-ghost",pointerEvents:"none",children:m.jsx(Lu,{id:"__flow-sdk-ghost",source:ce,target:H,sourceProperty:xe.sourceProperty,targetProperty:xe.targetProperty,sourceY:ie(xe.source,xe.sourceProperty),targetY:xe.target?ie(xe.target,xe.targetProperty):void 0,dir:fr,turn:.5,color:f,labelBg:f})})]})}),m.jsx("div",{ref:_,className:"flow-sdk-nodes",children:t.map(C=>{const T=U.get(C.id),j=re.get(C.id),P=(T==null?void 0:T.x)??(j?(j.x1+j.x2)/2:0),B=(T==null?void 0:T.y)??(j?(j.y1+j.y2)/2:0);return m.jsx(rx,{id:C.id,x:P,y:B,placed:!!T||!!j,onMount:Z,drawHandles:e.drawHandles&&!e.readOnly,handleColor:f,propertyMode:i==="properties",reversePorts:n==="RL",onPropertyRows:G,children:C.element},C.id)})}),Ie&&m.jsx("div",{className:"flow-sdk-box",style:{left:Ie.x1,top:Ie.y1,width:Ie.x2-Ie.x1,height:Ie.y2-Ie.y1}})]})}const cx=q.memo(ux),Jr=({name:e,...t})=>{const[r,n]=q.useState(null),[o,i]=q.useState(!0),[a,s]=q.useState(!1);return q.useEffect(()=>{if(!e||e.length<2){n(null),i(!1);return}i(!0),s(!1),(async()=>{try{let u;if(e.startsWith("Md"))u="md";else if(e.startsWith("Fa"))u="fa6";else if(e.startsWith("Io5"))u="io5";else if(e.startsWith("Io"))u="io";else if(e.startsWith("Ti"))u="ti";else if(e.startsWith("Go"))u="go";else if(e.startsWith("Fi"))u="fi";else if(e.startsWith("Di"))u="di";else if(e.startsWith("Ai"))u="ai";else if(e.startsWith("Bs"))u="bs";else if(e.startsWith("Ri"))u="ri";else if(e.startsWith("Fc"))u="fc";else if(e.startsWith("Gi"))u="gi";else if(e.startsWith("Hi2"))u="hi2";else if(e.startsWith("Hi"))u="hi";else if(e.startsWith("Si"))u="si";else if(e.startsWith("Sl"))u="sl";else if(e.startsWith("Im"))u="im";else if(e.startsWith("Bi"))u="bi";else if(e.startsWith("Pi"))u="pi";else if(e.startsWith("Vsc"))u="vsc";else if(e.startsWith("Tb"))u="tb";else if(e.startsWith("Tfi"))u="tfi";else if(e.startsWith("Cg"))u="cg";else if(e.startsWith("Lia"))u="lia";else if(e.startsWith("Lu"))u="lu";else throw new Error(`Unknown library prefix for icon: ${e}`);let c;switch(u){case"md":c=await import("react-icons/md");break;case"fa6":c=await import("react-icons/fa6");break;case"io5":c=await import("react-icons/io5");break;case"io":c=await import("react-icons/io");break;case"ti":c=await import("react-icons/ti");break;case"go":c=await import("react-icons/go");break;case"fi":c=await import("react-icons/fi");break;case"di":c=await import("react-icons/di");break;case"ai":c=await import("react-icons/ai");break;case"bs":c=await import("react-icons/bs");break;case"ri":c=await import("react-icons/ri");break;case"fc":c=await import("react-icons/fc");break;case"gi":c=await import("react-icons/gi");break;case"hi2":c=await import("react-icons/hi2");break;case"hi":c=await import("react-icons/hi");break;case"si":c=await import("react-icons/si");break;case"sl":c=await import("react-icons/sl");break;case"im":c=await import("react-icons/im");break;case"bi":c=await import("react-icons/bi");break;case"pi":c=await import("react-icons/pi");break;case"vsc":c=await import("react-icons/vsc");break;case"tb":c=await import("react-icons/tb");break;case"tfi":c=await import("react-icons/tfi");break;case"cg":c=await import("react-icons/cg");break;case"lia":c=await import("react-icons/lia");break;case"lu":c=await import("react-icons/lu");break;default:throw new Error(`Unsupported library: ${u}`)}const d=c[e];if(!d)throw new Error(`Icon ${e} not found in library ${u}`);n(()=>d)}catch(u){console.warn(`Failed to load icon ${e}:`,u.message),s(!0),n(null)}finally{i(!1)}})()},[e]),o||!r?null:m.jsx(r,{...t})};function Pg(e=!0){const t=q.useRef(null);return q.useEffect(()=>{if(!e||!t.current)return;const r=i=>{i.stopPropagation()},n=t.current,o=["mousedown","mouseup","click","dblclick","pointerdown","pointerup","wheel"];return o.forEach(i=>n.addEventListener(i,r)),()=>{o.forEach(i=>n.removeEventListener(i,r))}},[e]),t}const Ru=({nodeId:e,label:t,color:r,fontWeight:n="bold",fontSize:o="5xl",isEditing:i,onEditStart:a,onEditEnd:s})=>{const{callbacks:l,config:u,readOnly:c}=Le(),d=u.editable&&!c,[f,p]=q.useState(t),[x,y]=q.useState(),g=q.useRef(null),v=q.useRef(!1),h=Pg(i);q.useEffect(()=>{i&&(v.current=!1,g.current&&(g.current.focus(),g.current.select()))},[i]);const b=()=>{var w;if(v.current)return;v.current=!0;const _=f.trim();_&&_!==t&&((w=l.onNodeLabelChange)==null||w.call(l,e,_)),s()};return!d||!i?m.jsx(N.Text,{color:r,fontWeight:n,fontSize:o,minW:0,maxW:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",title:t,onDoubleClick:d?_=>{_.stopPropagation(),y({width:_.currentTarget.offsetWidth,height:_.currentTarget.offsetHeight}),p(t),a()}:void 0,cursor:d?"text":void 0,children:t}):m.jsx("div",{ref:h,style:x,children:m.jsx(N.Input,{ref:g,value:f,onChange:_=>p(_.target.value),onBlur:b,onKeyDown:_=>{_.key==="Enter"&&b(),_.key==="Escape"&&(v.current=!0,s())},color:r,fontWeight:n,fontSize:o,bg:"transparent",borderWidth:0,p:0,display:"block",w:"100%",h:"100%",minW:0,minH:0,lineHeight:"normal"})})},cp=({icon:e,label:t,onClick:r,color:n,boxSize:o=6,...i})=>{const{background:a,border:s,colorText:l}=$e();return m.jsxs(N.Tooltip.Root,{positioning:{placement:i.placement||"top"},children:[m.jsx(N.Tooltip.Trigger,{asChild:!0,children:m.jsx(N.Flex,{children:m.jsx(N.Icon,{as:e,boxSize:o,color:n,cursor:r?"pointer":void 0,onClick:r})})}),m.jsx(N.Tooltip.Positioner,{children:m.jsx(N.Tooltip.Content,{bgColor:i.bgColor||a,borderColor:i.borderColor||s,borderWidth:1,color:i.textColor||l,borderRadius:15,fontWeight:300,fontSize:"sm",p:2,px:4,shadow:"none",children:t})})]})},lx=({data:e,children:t,isInverted:r,isParent:n})=>{var he,ee;const{selectedNodeIds:o,setSelectedNodeIds:i,selectedEdgeId:a,setSelectedEdgeId:s,isMultiSelectMode:l,isPerformanceMode:u,engineRef:c,callbacks:d,config:f,themeColor:p,direction:x}=Le(),{background:y,border:g,colorText:v}=$e(),h=q.useRef(null),b=q.useRef(null),[_,w]=q.useState(!1),[E,R]=q.useState(!1),I=e==null?void 0:e.id,A=o.includes(I),k=f.nodeOverlayActions,M=f.renderNodeOverlay,z=(()=>{var Y;try{const oe=(Y=c.current)==null?void 0:Y.zoom();return oe!==void 0&&oe<.08}catch{return!1}})(),G=q.useCallback(()=>{var Y,oe,pe,fe;if(!(E||f.readOnly))if(a&&(s(null),(Y=d.onEdgeDeselect)==null||Y.call(d)),l){const ge=o.includes(I),S=ge?o.filter(O=>O!==I):[...o,I];i(S),ge?(oe=d.onNodeDeselect)==null||oe.call(d):(pe=d.onNodeSelect)==null||pe.call(d,I,e)}else i([I]),(fe=d.onNodeSelect)==null||fe.call(d,I,e)},[I,e,o,a,l,E,i,s,d,f]),U=q.useCallback(()=>{var Y;E||f.readOnly||(Y=d.onNodeDoubleClick)==null||Y.call(d,I,e)},[I,e,E,d,f]),V=q.useCallback(()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>w(!0),100)},[]),X=q.useCallback(()=>{b.current&&clearTimeout(b.current),w(!1)},[]);return n?m.jsxs(N.Box,{ref:h,onClick:G,onDoubleClick:U,onMouseEnter:V,onMouseLeave:X,cursor:"pointer",position:"relative",children:[!u&&(M||k&&k.length>0)&&_&&!z&&m.jsxs(m.Fragment,{children:[m.jsx(N.Box,{position:"absolute",top:-150,left:"0",right:"0",height:"150px",pointerEvents:"auto",onMouseEnter:()=>w(!0),onMouseLeave:X}),M?m.jsx(N.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",onMouseEnter:()=>w(!0),onMouseLeave:X,willChange:"transform",children:M({nodeId:I,nodeData:e,isRoot:I==="root",isParent:!0,isHovered:_,setIsHovered:w})}):m.jsx(N.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",bg:y,p:3,borderColor:g,borderWidth:1,borderRadius:15,pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",boxShadow:"lg",onMouseEnter:()=>w(!0),onMouseLeave:X,willChange:"transform",children:m.jsx(N.HStack,{px:2,gap:2,children:k.map((Y,oe)=>m.jsxs(N.Box,{display:"contents",children:[oe>0&&m.jsx(N.Box,{borderColor:g,height:5,borderRightWidth:1}),m.jsx(cp,{icon:Y.icon,label:Y.label,color:v,bgColor:y,borderColor:g,textColor:v,boxSize:5,onClick:pe=>{var fe;pe.stopPropagation(),(fe=d.onNodeHoverAction)==null||fe.call(d,Y.id,I,e)}})]},Y.id))})})]}),t({id:I,data:e,isActive:A,isLowZoom:z,isEditing:E,onEditStart:()=>R(!0),onEditEnd:()=>R(!1)}),((he=e==null?void 0:e.config)==null?void 0:he.collapsed)!==void 0&&(()=>{var pe;const Y=x==="TB"||x==="BT",oe=r||x==="RL";return m.jsx(N.IconButton,{position:"absolute",...Y?{[x==="BT"?"top":"bottom"]:"-75px",left:"50%",transform:"translateX(-50%)"}:{right:oe?void 0:"-75px",left:oe?"-75px":void 0,top:"50%",transform:"translateY(-50%)"},"aria-label":e.config.collapsed?"Expand":"Collapse",disabled:f.readOnly,onClick:fe=>{var ge;fe.stopPropagation(),(ge=d.onNodeCollapse)==null||ge.call(d,I,!e.config.collapsed)},bgColor:Se(((pe=e==null?void 0:e.viewProps)==null?void 0:pe.bgColor)||p),size:"md",color:"gray.100",rounded:"full",mr:2,px:2,py:4,children:e.config.collapsed?m.jsx(Q.PiPlusBold,{size:30,color:"gray.800"}):m.jsx(Q.PiMinusBold,{size:30,color:"gray.800"})})})()]}):m.jsxs(N.Box,{ref:h,onClick:G,onDoubleClick:U,onMouseEnter:V,onMouseLeave:X,cursor:"pointer",transition:"transform 0.1s ease",position:"relative",children:[!u&&(M||k&&k.length>0)&&_&&!z&&m.jsxs(m.Fragment,{children:[m.jsx(N.Box,{position:"absolute",top:-150,left:"0",right:"0",height:"150px",pointerEvents:"auto",onMouseEnter:()=>w(!0),onMouseLeave:X}),M?m.jsx(N.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",onMouseEnter:()=>w(!0),onMouseLeave:X,willChange:"transform",children:M({nodeId:I,nodeData:e,isRoot:I==="root",isParent:!!n,isHovered:_,setIsHovered:w})}):m.jsx(N.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",bg:y,p:3,borderColor:g,borderWidth:1,borderRadius:15,pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",boxShadow:"lg",onMouseEnter:()=>w(!0),onMouseLeave:X,willChange:"transform",children:m.jsx(N.HStack,{px:2,gap:2,children:k.map((Y,oe)=>m.jsxs(N.Box,{display:"contents",children:[oe>0&&m.jsx(N.Box,{borderColor:g,height:5,borderRightWidth:1}),m.jsx(cp,{icon:Y.icon,label:Y.label,color:v,bgColor:y,borderColor:g,textColor:v,boxSize:5,onClick:pe=>{var fe;pe.stopPropagation(),(fe=d.onNodeHoverAction)==null||fe.call(d,Y.id,I,e)}})]},Y.id))})})]}),m.jsxs(N.Box,{position:"relative",display:"flex",h:"100%",w:"100%",children:[((ee=e==null?void 0:e.config)==null?void 0:ee.collapsed)!==void 0&&!n&&(()=>{var pe;const Y=x==="TB"||x==="BT",oe=r||x==="RL";return m.jsx(N.IconButton,{position:"absolute",...Y?{[x==="BT"?"top":"bottom"]:"-75px",left:"50%",transform:"translateX(-50%)"}:{right:oe?void 0:"-75px",left:oe?"-75px":void 0,alignSelf:"center"},"aria-label":e.config.collapsed?"Expand":"Collapse",disabled:f.readOnly,onClick:fe=>{var ge;fe.stopPropagation(),(ge=d.onNodeCollapse)==null||ge.call(d,I,!e.config.collapsed)},bgColor:Se(((pe=e==null?void 0:e.viewProps)==null?void 0:pe.bgColor)||p),size:"md",color:"gray.100",rounded:"full",mr:2,px:2,py:4,children:e.config.collapsed?m.jsx(Q.PiPlusBold,{size:30,color:"gray.800"}):m.jsx(Q.PiMinusBold,{size:30,color:"gray.800"})})})(),t({id:I,data:e,isActive:A,isLowZoom:z,isEditing:E,onEditStart:()=>R(!0),onEditEnd:()=>R(!1)})]})]})},At=q.memo(lx),dx=({id:e,data:t,isActive:r,isEditing:n,onEditStart:o,onEditEnd:i})=>{var d,f,p,x;const{themeColor:a}=Le(),{bgColor:s,borderColor:l,textColor:u}=Vr(((d=t==null?void 0:t.viewProps)==null?void 0:d.bgColor)||a),c=Se(((f=t==null?void 0:t.viewProps)==null?void 0:f.textColor)||u);return m.jsx(N.Box,{borderRadius:(p=t==null?void 0:t.viewProps)==null?void 0:p.borderRadius,bgColor:s,borderColor:r?"white":l,_hover:{borderColor:"white"},borderWidth:2,py:14,px:20,whiteSpace:"nowrap",w:"fit-content",children:m.jsxs(N.Flex,{justifyContent:"start",alignItems:"center",gap:8,w:"fit-content",maxW:900,minW:0,fontSize:"5xl",lineHeight:"normal",children:[((x=t==null?void 0:t.config)==null?void 0:x.icon)&&m.jsx(N.Box,{flexShrink:0,children:m.jsx(Jr,{name:t.config.icon,size:80,color:c})}),m.jsx(Ru,{nodeId:e,label:(t==null?void 0:t.label)||(t==null?void 0:t.text)||"",color:c,isEditing:n,onEditStart:o,onEditEnd:i})]})})},fx=({id:e,isActive:t,data:r,isEditing:n,onEditStart:o,onEditEnd:i})=>{var h,b,_,w,E,R,I,A;const{themeColor:a}=Le(),{colorText:s}=$e(),l=((h=r==null?void 0:r.viewProps)==null?void 0:h.bgColor)==="transparent",u=!l&&((b=r==null?void 0:r.viewProps)==null?void 0:b.bgColor)||a,{borderColor:c,highlightColor:d,textColor:f}=Vr(u),p=Se(((_=r==null?void 0:r.viewProps)==null?void 0:_.textColor)||(l?s:f)),x=l&&!((w=r==null?void 0:r.viewProps)!=null&&w.borderColor)?"transparent":Se(((E=r==null?void 0:r.viewProps)==null?void 0:E.borderColor)||c),y=l?"transparent":u!=null&&u.startsWith("#")?u:Se(d),g=(R=r==null?void 0:r.config)==null?void 0:R.icon,v=(r==null?void 0:r.label)??(r==null?void 0:r.text)??"";return m.jsxs(N.Flex,{align:"center",borderRadius:(I=r==null?void 0:r.viewProps)==null?void 0:I.borderRadius,bgColor:y,style:{backgroundColor:y},textTransform:"capitalize",borderColor:t?"white":x,_hover:{borderColor:"white"},borderWidth:2,px:50,w:"fit-content",whiteSpace:"nowrap",children:[!!g&&m.jsx(N.Flex,{align:"center",py:14,mr:v?8:0,flexShrink:0,children:m.jsx(Jr,{name:g,size:(((A=r==null?void 0:r.viewProps)==null?void 0:A.fontSize)||1)*100,color:p},p)}),(v||!g)&&m.jsx(N.Flex,{justifyContent:"start",py:14,fontSize:"5xl",lineHeight:"normal",w:"fit-content",maxW:900,minW:0,children:m.jsx(Ru,{nodeId:e,label:v,color:p,isEditing:n,onEditStart:o,onEditEnd:i})})]})},Og=(e,t)=>{var l,u,c;const r=((l=e==null?void 0:e.viewProps)==null?void 0:l.bgColor)||t,[n]=r.split("."),o=Vr(r),i=r!=null&&r.startsWith("#")?Se(r):Se(o.bgColor),a=Se(((u=e==null?void 0:e.viewProps)==null?void 0:u.textColor)||o.textColor),s=Se(((c=e==null?void 0:e.viewProps)==null?void 0:c.borderColor)||o.borderColor);return{...o,bg:r,wordBeforeDot:n,hexbgColor:i,hextextColor:a,hexborderColor:s}},hx=(e,t=350)=>`${String(e).substring(0,t)}${String(e).length>t?"...":""}`,jg=e=>e!=null&&e.includes("root")?e.replace("root","untitled"):e,px=e=>{const t=Math.max(...Object.keys(e||{}).map(n=>n.length),0);return Math.max(t*28+30,200)},kg=e=>m.jsx(At,{...e,children:t=>m.jsx(dx,{...t})}),Ng=e=>m.jsx(At,{...e,children:t=>m.jsx(fx,{...t})}),Lg=e=>{const{themeColor:t}=Le(),[r,n]=q.useState(!1);return m.jsx(At,{...e,children:({id:o,data:i,isActive:a,isEditing:s,onEditStart:l,onEditEnd:u})=>{var g,v,h,b,_,w,E,R;const c=Og(i,t),d=i.label??i.headerTitle,f=Object.entries(i.description||{}).length>0,p=px(i.description),x=(v=(g=e.data)==null?void 0:g.config)==null?void 0:v.icon,y=(b=(h=e.data)==null?void 0:h.config)==null?void 0:b.content;return m.jsx(N.Flex,{justifyContent:"space-between",...i==null?void 0:i.viewProps,direction:"column",p:0,borderRadius:(_=i==null?void 0:i.viewProps)==null?void 0:_.borderRadius,overflow:"hidden",alignItems:"center",style:{backgroundColor:c.hexbgColor,transition:"border-color 0.2s ease-in-out"},width:"100%",borderColor:a?"white":c.hexborderColor,_hover:{borderColor:"white"},borderWidth:3,children:m.jsxs(N.Flex,{width:"100%",direction:"column",borderRadius:(w=i==null?void 0:i.viewProps)==null?void 0:w.borderRadius,borderColor:c.hexborderColor,borderWidth:0,overflow:"hidden",children:[d&&m.jsxs(N.Flex,{justify:"flex-start",direction:"row",p:Object.entries(i.description||{}).length?8:20,borderBottomWidth:1,minWidth:"max-content !important",width:"100%",textTransform:"capitalize",align:y?"left":"center",textOverflow:"ellipsis",alignItems:"center",fontWeight:"bold",color:c.propertyColor,bgColor:c.highlightColor,borderBottomColor:!f&&!y?"transparent":c.hexborderColor,children:[!!x&&m.jsx(N.Flex,{mr:6,alignItems:"center",flexShrink:0,children:m.jsx(Jr,{name:x,size:64,color:c.hextextColor},c.hextextColor)}),m.jsx(Ru,{nodeId:o,label:jg(d),color:((E=i==null?void 0:i.viewProps)==null?void 0:E.textColor)||c.propertyColor,isEditing:s,onEditStart:l,onEditEnd:u}),!!y&&m.jsx(N.Box,{ml:10,onClick:()=>n(!r),children:r?m.jsx(Q.PiGear,{size:30,style:{cursor:"pointer"}}):m.jsx(Q.PiNotepad,{size:30,style:{cursor:"pointer"}})})]}),y&&!r?m.jsx(N.Flex,{w:"100%",overflow:"auto",justifyContent:"start",background:c.highlightColor,p:10,fontSize:"5xl",lineHeight:"normal",cursor:"text",children:m.jsx(N.Text,{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis",color:(R=i==null?void 0:i.viewProps)==null?void 0:R.textColor,children:y})}):m.jsx(N.Box,{children:Object.entries(i.description||{}).map(([I,A],k)=>{var G,U;const M=Ye(c.wordBeforeDot)[typeof A],z=Ye(c.wordBeforeDot).property;return m.jsxs(N.Box,{"data-flow-property":I,children:[m.jsxs(N.Flex,{flexWrap:"nowrap",overflow:"hidden",children:[m.jsx(N.Flex,{justifyContent:"start",align:"center",background:c.highlightColor,width:`${p}px`,minWidth:`${p}px`,borderRightColor:c.hexborderColor,borderRightWidth:1,children:m.jsx(N.Text,{py:5,px:10,w:"100%",whiteSpace:"nowrap",fontWeight:"bold",fontSize:"4xl",color:((G=i==null?void 0:i.viewProps)==null?void 0:G.textColor)||z,children:I})}),m.jsx(N.Flex,{flex:1,justifyContent:"start",overflow:"hidden",p:4,background:c.hexbgColor,w:600,maxH:200,children:m.jsx(N.Text,{overflow:"hidden",py:3,px:4,whiteSpace:"normal",textOverflow:"ellipsis",fontSize:"4xl",color:((U=i==null?void 0:i.viewProps)==null?void 0:U.textColor)||M,fontWeight:400,children:hx(A)})})]}),k!==Object.entries(i.description||{}).length-1&&m.jsx(N.Box,{borderTopWidth:1,my:0,borderColor:c.hexborderColor})]},I)})})]})})}})},Fg=e=>{const{themeColor:t}=Le();return m.jsx(At,{...e,children:({data:r,isActive:n})=>{var a,s,l,u;const o=Og(r,t),i=(s=(a=e.data)==null?void 0:a.config)==null?void 0:s.icon;return m.jsx(N.Flex,{justifyContent:"space-between",...r==null?void 0:r.viewProps,direction:"column",p:0,borderRadius:((l=r==null?void 0:r.viewProps)==null?void 0:l.borderRadius)||15,overflow:"hidden",bgColor:o.bgColor,position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",style:{backgroundColor:o.hexbgColor,transition:"border-color 0.2s ease-in-out"},borderColor:n?"white":o.hexborderColor,_hover:{borderColor:"white"},borderWidth:3,children:r.headerTitle&&m.jsxs(N.Flex,{justify:"flex-start",direction:"row",p:20,borderBottomWidth:1,minWidth:"max-content !important",width:"100%",textTransform:"capitalize",align:"center",alignItems:"center",fontWeight:"bold",color:o.propertyColor,bgColor:o.highlightColor,borderBottomColor:o.hexborderColor,children:[!!i&&m.jsx(N.Box,{mr:8,justifyContent:"flex-start",height:"100%",w:50,alignItems:"center",rounded:"full",children:m.jsx(Jr,{name:i,size:80,color:o.hextextColor},o.hextextColor)}),m.jsx(N.Text,{fontSize:"5xl",lineClamp:2,textOverflow:"ellipsis",whiteSpace:"nowrap",color:(u=r==null?void 0:r.viewProps)==null?void 0:u.textColor,children:jg(r.headerTitle)})]})})}})};kg.displayName="text";Ng.displayName="arrayView";Lg.displayName="NodeJsonObjectView";Fg.displayName="ParentContainerView";const gx={objectView:Lg,arrayView:Ng,text:kg,parentContainer:Fg},vx=({children:e,pattern:t="dot",backgroundColor:r})=>{const{colorMode:n}=Le(),o=n==="dark",i=o?"--chakra-colors-gray-700":"--chakra-colors-gray-500",a=o?"--chakra-colors-gray-700":"--chakra-colors-gray-800";return t==="none"?m.jsx(N.Box,{width:"100%",height:"100%",padding:0,bg:r,children:e}):m.jsxs(N.Box,{position:"relative",width:"100%",height:"100%",padding:0,bg:r,children:[m.jsx(N.Box,{position:"absolute",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",zIndex:0,pointerEvents:"none",style:{backgroundImage:t==="dot"?`radial-gradient(var(${i}) 8%, transparent 8%)`:t==="steel"?`repeating-linear-gradient(45deg, var(${a}) 0, var(${a}) 1px, transparent 1px, transparent 20px)`:`linear-gradient(var(${a}) 1px, transparent 1px), linear-gradient(90deg, var(${a}) 1px, transparent 1px)`,backgroundSize:"20px 20px",opacity:.3}}),m.jsx(N.Box,{position:"relative",width:"100%",height:"100%",zIndex:1,padding:0,children:e})]})},yx=.4,pr={borderWidth:6,borderStyle:"solid",borderRadius:50,fontSize:70,padding:120,labelPosition:"top",labelMargin:90},bx=({nodes:e,edges:t})=>{const{themeColor:r,edgeColor:n,direction:o,nodeAlignment:i,edgeMode:a,parentNodeStyle:s,engineRef:l,callbacks:u,config:c,selectedNodeIds:d,setSelectedNodeIds:f,selectedEdgeId:p,setSelectedEdgeId:x,setIsPerformanceMode:y,isZoomMode:g,setIsZoomMode:v,isMultiSelectMode:h,setIsMultiSelectMode:b,isDragMode:_,setIsDragMode:w,isEdgeHandlesEnabled:E,isArrayNodeMode:R}=Le(),I=q.useRef(null),[A,k]=q.useState(null),M=e.length>200;q.useEffect(()=>{y(M)},[M,y]);const{edgeSep:z,rankSep:G}=q.useMemo(()=>dv(e.length),[e.length]),{bgColor:U}=Vr(r),{canvas:V,borderSecondary:X}=$e(),he=c.backgroundColor||V,ee=q.useCallback($=>{if($!=null&&$.includes("gray"))return"whitesmoke";if(!$)return Se(r);switch($){case"dark":return Se(he);case"light":return Se(X);default:return Se($)}},[r,he,X]),Y=c.colorMode==="dark",oe=q.useMemo(()=>ee(Y?U:"light"),[Y,U,ee]),pe=n?ee(n):oe,fe=q.useMemo(()=>c.initialViewport||{pan:{x:0,y:0},zoom:.01},[]),ge=o==="C"?"LR":o,S=q.useCallback($=>{const L={...s,...$};return{...L,bgColor:L.bgColor||r,bgOpacity:L.bgOpacity??yx}},[s,r]),O=q.useMemo(()=>{var L;const $=new Map;for(const H of e)(L=H.data)!=null&&L.id&&$.set(H.data.id,H);return $},[e]),D=q.useMemo(()=>{var L;const $=new Map;for(const H of t)(L=H.data)!=null&&L.id&&$.set(H.data.id,H);return $},[t]),F=q.useCallback($=>{var ce,se;const L=S((se=(ce=O.get($))==null?void 0:ce.data)==null?void 0:se.viewProps),H=Se(L.bgColor);return{bgColor:H,bgOpacity:L.bgOpacity,borderColor:L.borderColor?Se(L.borderColor):H,borderWidth:L.borderWidth??pr.borderWidth,borderStyle:L.borderStyle??pr.borderStyle,borderRadius:L.borderRadius??pr.borderRadius,textColor:L.textColor?Se(L.textColor):H,fontSize:L.fontSize??pr.fontSize,labelPosition:L.labelPosition??pr.labelPosition,labelMargin:pr.labelMargin,padding:L.padding??pr.padding}},[S,O]),Z=q.useMemo(()=>{var H,ce;const $=new Map;for(const se of t){const C=(H=se.data)==null?void 0:H.source,T=(ce=se.data)==null?void 0:ce.target;if(!C||!T||C===T)continue;const j=C<T?`${C}|${T}`:`${T}|${C}`,P=$.get(j);P?P.push({id:se.data.id,source:C}):$.set(j,[{id:se.data.id,source:C}])}const L=new Map;for(const[se,C]of $){if(C.length<2)continue;const T=se.split("|")[0],j=Math.min(20,70/C.length);C.forEach(({id:P,source:B},J)=>{const te=50+(J-(C.length-1)/2)*j;L.set(P,(B===T?te:100-te)/100)})}return L},[t]),ne=q.useMemo(()=>{const $=ee("dark");return t.filter(L=>{var H;return((H=L.data)==null?void 0:H.id)&&L.data.source&&L.data.target}).map(({data:L})=>{var C,T,j,P,B,J;let H=$;const ce=(T=(C=O.get(L.source))==null?void 0:C.data)==null?void 0:T.parent,se=(P=(j=O.get(L.target))==null?void 0:j.data)==null?void 0:P.parent;if(ce&&ce===se){const te=S((J=(B=O.get(ce))==null?void 0:B.data)==null?void 0:J.viewProps),be=ov($,Se(te.bgColor),te.bgOpacity);be&&(H=be)}return{id:L.id,source:L.source,target:L.target,sourceProperty:L.sourceProperty,targetProperty:L.targetProperty,label:L.label,color:L.color?Se(L.color):pe,labelBg:H,dashed:!!L.isEdgeDashed,animated:!!L.isEdgeAnimated,inverted:!!L.isInverted,turn:Z.get(L.id)??.5}})},[t,pe,Z,O,S,ee]),re=q.useMemo(()=>{var L;const $=new Set;for(const H of e)(L=H.data)!=null&&L.parent&&$.add(H.data.parent);return $},[e]),ue=q.useMemo(()=>{var L;const $=new Map;for(const H of t)(L=H.data)!=null&&L.source&&!$.has(H.data.source)&&$.set(H.data.source,H.data);return $},[t]),Ce=q.useMemo(()=>{const $=c.customViews||gx;return e.filter(L=>{var H;return(H=L.data)==null?void 0:H.id}).map(L=>{const H=re.has(L.data.id)&&!L.data.parent,ce=H?L.data.label||L.data.headerTitle||"Container":void 0,se=H?$.parentContainer:$[L.data.type]||$.text,C=ue.get(L.data.id);return{id:L.data.id,parent:L.data.parent,label:ce,element:q.createElement(se,{...L,isInverted:C==null?void 0:C.isInverted,isParent:H,key:`${L.data.id}-${r}`})}})},[e,re,ue,r,c.customViews]),ie=q.useMemo(()=>M?300:e.length>50?150:e.length>20?100:50,[e.length,M]),ve=q.useRef(c);ve.current=c;const W=q.useRef(g);W.current=g;const ye=q.useRef(R);ye.current=R;const K=q.useRef(d);K.current=d;const we=q.useRef(p);we.current=p;const Ae=q.useRef(h);Ae.current=h;const Ie=q.useRef(O);Ie.current=O;const Fe=q.useRef(D);Fe.current=D;const xe=q.useRef(new Map);q.useEffect(()=>{var H,ce;const $=new Map([...D].filter(([,se])=>O.has(se.data.source)&&O.has(se.data.target))),L=xe.current;xe.current=$;for(const[se,C]of L)$.has(se)||(we.current===se&&(x(null),(H=u.onEdgeDeselect)==null||H.call(u)),(ce=u.onEdgeRemove)==null||ce.call(u,se,C.data))},[D,O,u,x]),q.useEffect(()=>{const $=I.current;if(!A||!$)return;let L=null,H=null,ce=0,se=0,C=0,T=0,j=0;const P=B=>{if(ve.current.readOnly)return;B.preventDefault(),B.stopPropagation(),W.current||B.metaKey||B.ctrlKey?(C+=B.deltaY,T=B.clientX,j=B.clientY,H===null&&(H=requestAnimationFrame(()=>{H=null;const te=ve.current,be=A.zoom(),Ee=C;C=0;let le=be-Ee*.05/100;le=Math.max(te.minZoom??.01,Math.min(te.maxZoom??1.5,le));const me=$.getBoundingClientRect();A.zoomAt(le,{x:T-me.left,y:j-me.top})}))):(ce+=B.deltaX,se+=B.deltaY,L===null&&(L=requestAnimationFrame(()=>{L=null;const te=A.pan(),be=A.zoom(),Ee=.35,le=ce,me=se;ce=0,se=0,A.pan({x:te.x+-le*Ee/be,y:te.y+-me*Ee/be})})))};return $.addEventListener("wheel",P,{passive:!1}),()=>{$.removeEventListener("wheel",P),L!==null&&cancelAnimationFrame(L),H!==null&&cancelAnimationFrame(H)}},[A]),q.useEffect(()=>{if(c.disableKeyboardShortcuts)return;const $=L=>{var ce,se;if(ve.current.readOnly)return;const H=L.target;if(!(H.tagName==="INPUT"||H.tagName==="TEXTAREA"||H.isContentEditable)&&((L.key==="z"||L.key==="Z")&&v(!W.current),(L.key==="m"||L.key==="M")&&b(!h),(L.key==="d"||L.key==="D")&&w(!_),(L.key==="Delete"||L.key==="Backspace")&&K.current.length>0)){L.preventDefault();const C=K.current.filter(T=>T!=="root");if(C.length===0)return;for(const T of C){const j=(ce=Ie.current.get(T))==null?void 0:ce.data;(se=u.onNodeDelete)==null||se.call(u,T,j||{})}f([])}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[h,_,v,b,w,c.disableKeyboardShortcuts,u,f]);const qe=q.useCallback($=>{var L;l.current=$,k($),(L=u.onInit)==null||L.call(u,$)},[l,u]),Ue=q.useCallback($=>{var L;return(L=u.onViewportChange)==null?void 0:L.call(u,$)},[u]),Ke=q.useCallback($=>{var H,ce,se;const L=((H=Fe.current.get($))==null?void 0:H.data)??{id:$};if(we.current===$&&Ae.current){x(null),(ce=u.onEdgeDeselect)==null||ce.call(u);return}K.current.length&&f([]),x($),(se=u.onEdgeSelect)==null||se.call(u,$,L)},[u,x,f]),lr=q.useCallback(()=>{var $,L;K.current.length&&(f([]),($=u.onNodeDeselect)==null||$.call(u)),we.current&&(x(null),(L=u.onEdgeDeselect)==null||L.call(u))},[u,f,x]),_r=q.useCallback($=>{var ce,se;const L=K.current,H=$.filter(C=>!L.includes(C));if(H.length){f([...L,...H]);for(const C of H)(se=u.onNodeSelect)==null||se.call(u,C,((ce=Ie.current.get(C))==null?void 0:ce.data)??{id:C})}},[u,f]),Ze=q.useCallback($=>{var L,H;f([$]),(H=u.onNodeSelect)==null||H.call(u,$,((L=Ie.current.get($))==null?void 0:L.data)??{id:$})},[u,f]),dr=q.useCallback(($,L,H)=>{var ce;return(ce=u.onEdgeCreate)==null?void 0:ce.call(u,$,L,H)},[u]),De=q.useCallback(($,L)=>{var H;(H=u.onNodeCreate)==null||H.call(u,{type:"text",sourceNodeId:$,position:L,isArrayMode:ye.current})},[u]),jr=!c.readOnly&&E&&c.edgeHandles!==!1,fr=c.backgroundPattern||"dot";return m.jsx(vx,{pattern:fr,backgroundColor:he,children:m.jsx(N.Box,{ref:I,padding:0,width:"100%",height:"100%",flex:1,position:"relative",children:m.jsx(cx,{nodes:Ce,edges:ne,direction:ge,nodeAlignment:i,edgeMode:a,rankSep:G,edgeSep:z,layoutDebounce:ie,isPerformanceMode:M,minZoom:c.minZoom??.01,maxZoom:c.maxZoom??1.5,initialViewport:fe,fitOnInit:!c.initialViewport,readOnly:!!c.readOnly,containerStyle:F,lineColor:pe,drawMode:jr,drawHandles:!c.readOnly&&c.edgeHandles!==!1,dragMode:_,multiSelect:!!h,onInit:qe,onViewportChange:Ue,onBackgroundTap:lr,onBoxSelect:_r,onEdgeSelect:Ke,onContainerSelect:Ze,onEdgeDraw:dr,onDrawIntoSpace:De})})})},mx=q.memo(bx),xx=".flow-sdk-canvas{position:relative;width:100%;height:100%;overflow:hidden;user-select:none;-webkit-user-select:none;touch-action:none}.flow-sdk-svg{position:absolute;top:0;left:0;width:100%;height:100%;overflow:visible;display:block}.flow-sdk-nodes{position:absolute;top:0;left:0;transform-origin:0 0;pointer-events:none;will-change:transform;backface-visibility:hidden;z-index:10}.flow-sdk-node{position:absolute;top:0;left:0;transform-origin:0 0;pointer-events:auto;will-change:transform;backface-visibility:hidden;z-index:10}.flow-sdk-node input,.flow-sdk-node textarea{pointer-events:auto;user-select:text;-webkit-user-select:text;cursor:text}.flow-sdk-edge-hit{fill:none;stroke:transparent;stroke-width:24px;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:pointer}.flow-sdk-container{cursor:pointer}.flow-sdk-edge-anim{animation:flow-sdk-dash .5s linear infinite}.flow-sdk-edge-anim-rev{animation-direction:reverse}@keyframes flow-sdk-dash{to{stroke-dashoffset:-50}}.flow-sdk-draw{cursor:crosshair}.flow-sdk-draw .flow-sdk-node,.flow-sdk-draw .flow-sdk-node input,.flow-sdk-draw .flow-sdk-node textarea,.flow-sdk-draw .flow-sdk-edge,.flow-sdk-draw .flow-sdk-container{pointer-events:none}.flow-sdk-perf.flow-sdk-busy .flow-sdk-edges{display:none}.flow-sdk-box{position:absolute;border:1px solid rgba(170,170,170,.9);background:rgba(221,221,221,.25);pointer-events:none;z-index:20}";let lp=!1;function _x(){if(lp||typeof document>"u")return;const e=document.createElement("style");e.setAttribute("data-flow-sdk",""),e.textContent=xx+".flow-sdk-handle{position:absolute;left:-36px;top:50%;transform:translateY(-50%);width:36px;height:36px;display:grid;place-items:center;border:2px solid currentColor;border-radius:50%;background:white;cursor:crosshair;opacity:0;pointer-events:none}.flow-sdk-node:hover>.flow-sdk-handle,.flow-sdk-handle:focus-visible{opacity:1;pointer-events:auto}.flow-sdk-draw .flow-sdk-node *,.flow-sdk-draw .flow-sdk-edge *,.flow-sdk-draw .flow-sdk-container *,.flow-sdk-ghost *{pointer-events:none}",document.head.appendChild(e),e.textContent+='.flow-sdk-property-port{position:absolute;transform:translateY(-50%);width:32px;height:32px;margin:0;padding:0;border:3px solid currentColor;border-radius:50%;background:white;cursor:crosshair;pointer-events:auto;z-index:20}.flow-sdk-property-port[data-port-role="source"]{background:currentColor}.flow-sdk-property-port:hover{outline:3px solid currentColor;outline-offset:3px}.flow-sdk-draw .flow-sdk-node .flow-sdk-property-port{pointer-events:auto}',lp=!0}function wx({title:e="untitled",json:t,nodes:r,edges:n,config:o={},callbacks:i={},className:a,style:s,showBottomBar:l=!0}){_x();const u=o.direction==="C",c=q.useMemo(()=>t?Cp(t,{title:e,isCenter:u}):null,[t,e,u]),d=(c==null?void 0:c.nodes)??r??[],f=(c==null?void 0:c.edges)??n??[],p=q.useMemo(()=>t&&c?Ep(t,c.edges,i,i.onJsonChange):i,[t,c,i]);return m.jsx(nv,{config:o,callbacks:p,nodes:d,edges:f,children:m.jsxs(N.Box,{className:a,style:s,width:"100%",height:"100%",position:"relative",overflow:"hidden",children:[m.jsx(mx,{nodes:d,edges:f}),l&&m.jsx(lv,{})]})})}exports.DynamicIcon=Jr;exports.FlowDiagram=wx;exports.addChild=bp;exports.addConnection=_p;exports.addTargetEdge=xp;exports.addressToPath=er;exports.applyCollapsed=rv;exports.bindSqueedCallbacks=Ep;exports.compileSqueed=Cp;exports.contentObjTheme=Ye;exports.createFlowDiagram=vr;exports.getChakraColorHex=Se;exports.getColorVariant=qp;exports.getDarkerHexColor=ot;exports.getNode=ir;exports.removeEdge=wp;exports.removeNode=mp;exports.resolveEdgeOwner=dt;exports.setCollapsed=vp;exports.setEdgeProp=Hr;exports.setEdgeStyle=yp;exports.setNodeProp=Sr;exports.updateNode=Je;exports.useCustomColors=$e;exports.useStopPropagation=Pg;exports.useThemeContentColors=Vr;
|
|
358
3
|
//# sourceMappingURL=index.cjs.map
|