From 1c60b8a478000950a7eafe6e49f8d69e3fc94674 Mon Sep 17 00:00:00 2001 From: gregorbednov Date: Sat, 20 Jun 2026 13:29:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?frontend/dist/assets=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/dist/assets/index-CclG6ywK.js | 343 ++++++++++++++++++++++++ frontend/dist/assets/index-CrNuOWI7.css | 1 + 2 files changed, 344 insertions(+) create mode 100644 frontend/dist/assets/index-CclG6ywK.js create mode 100644 frontend/dist/assets/index-CrNuOWI7.css diff --git a/frontend/dist/assets/index-CclG6ywK.js b/frontend/dist/assets/index-CclG6ywK.js new file mode 100644 index 0000000..37d9654 --- /dev/null +++ b/frontend/dist/assets/index-CclG6ywK.js @@ -0,0 +1,343 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const s of l.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(i){if(i.ep)return;i.ep=!0;const l=r(i);fetch(i.href,l)}})();var Jo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function DN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Od={exports:{}},$l={};var _x;function MN(){if(_x)return $l;_x=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(a,i,l){var s=null;if(l!==void 0&&(s=""+l),i.key!==void 0&&(s=""+i.key),"key"in i){l={};for(var o in i)o!=="key"&&(l[o]=i[o])}else l=i;return i=l.ref,{$$typeof:t,type:a,key:s,ref:i!==void 0?i:null,props:l}}return $l.Fragment=e,$l.jsx=r,$l.jsxs=r,$l}var Ax;function ON(){return Ax||(Ax=1,Od.exports=MN()),Od.exports}var xe=ON(),Bd={exports:{}},Ze={};var Rx;function BN(){if(Rx)return Ze;Rx=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),s=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),p=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=p&&L[p]||L["@@iterator"],typeof L=="function"?L:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,E={};function S(L,H,Q){this.props=L,this.context=H,this.refs=E,this.updater=Q||b}S.prototype.isReactComponent={},S.prototype.setState=function(L,H){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,H,"setState")},S.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function T(){}T.prototype=S.prototype;function C(L,H,Q){this.props=L,this.context=H,this.refs=E,this.updater=Q||b}var _=C.prototype=new T;_.constructor=C,x(_,S.prototype),_.isPureReactComponent=!0;var R=Array.isArray;function M(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function B(L,H,Q){var F=Q.ref;return{$$typeof:t,type:L,key:H,ref:F!==void 0?F:null,props:Q}}function z(L,H){return B(L.type,H,L.props)}function N(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function k(L){var H={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(Q){return H[Q]})}var P=/\/+/g;function G(L,H){return typeof L=="object"&&L!==null&&L.key!=null?k(""+L.key):H.toString(36)}function j(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(M,M):(L.status="pending",L.then(function(H){L.status==="pending"&&(L.status="fulfilled",L.value=H)},function(H){L.status==="pending"&&(L.status="rejected",L.reason=H)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function q(L,H,Q,F,K){var X=typeof L;(X==="undefined"||X==="boolean")&&(L=null);var ee=!1;if(L===null)ee=!0;else switch(X){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(L.$$typeof){case t:case e:ee=!0;break;case d:return ee=L._init,q(ee(L._payload),H,Q,F,K)}}if(ee)return K=K(L),ee=F===""?"."+G(L,0):F,R(K)?(Q="",ee!=null&&(Q=ee.replace(P,"$&/")+"/"),q(K,H,Q,"",function(te){return te})):K!=null&&(N(K)&&(K=z(K,Q+(K.key==null||L&&L.key===K.key?"":(""+K.key).replace(P,"$&/")+"/")+ee)),H.push(K)),1;ee=0;var he=F===""?".":F+":";if(R(L))for(var ue=0;ue>>1,Z=q[J];if(0>>1;Ji(Q,Y))Fi(K,Q)?(q[J]=K,q[F]=Y,J=F):(q[J]=Q,q[H]=Y,J=H);else if(Fi(K,Y))q[J]=K,q[F]=Y,J=F;else break e}}return U}function i(q,U){var Y=q.sortIndex-U.sortIndex;return Y!==0?Y:q.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var s=Date,o=s.now();t.unstable_now=function(){return s.now()-o}}var v=[],c=[],d=1,g=null,p=3,y=!1,b=!1,x=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function _(q){for(var U=r(c);U!==null;){if(U.callback===null)a(c);else if(U.startTime<=q)a(c),U.sortIndex=U.expirationTime,e(v,U);else break;U=r(c)}}function R(q){if(x=!1,_(q),!b)if(r(v)!==null)b=!0,M||(M=!0,k());else{var U=r(c);U!==null&&j(R,U.startTime-q)}}var M=!1,A=-1,O=5,B=-1;function z(){return E?!0:!(t.unstable_now()-Bq&&z());){var J=g.callback;if(typeof J=="function"){g.callback=null,p=g.priorityLevel;var Z=J(g.expirationTime<=q);if(q=t.unstable_now(),typeof Z=="function"){g.callback=Z,_(q),U=!0;break t}g===r(v)&&a(v),_(q)}else a(v);g=r(v)}if(g!==null)U=!0;else{var L=r(c);L!==null&&j(R,L.startTime-q),U=!1}}break e}finally{g=null,p=Y,y=!1}U=void 0}}finally{U?k():M=!1}}}var k;if(typeof C=="function")k=function(){C(N)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,G=P.port2;P.port1.onmessage=N,k=function(){G.postMessage(null)}}else k=function(){S(N,0)};function j(q,U){A=S(function(){q(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125J?(q.sortIndex=Y,e(c,q),r(v)===null&&q===r(c)&&(x?(T(A),A=-1):x=!0,j(R,Y-J))):(q.sortIndex=Z,e(v,q),b||y||(b=!0,M||(M=!0,k()))),q},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(q){var U=p;return function(){var Y=p;p=U;try{return q.apply(this,arguments)}finally{p=Y}}}})(Nd)),Nd}var Ox;function zN(){return Ox||(Ox=1,zd.exports=qN()),zd.exports}var Ld={exports:{}},Tr={};var Bx;function NN(){if(Bx)return Tr;Bx=1;var t=Qb();function e(v){var c="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Ld.exports=NN(),Ld.exports}var zx;function kN(){if(zx)return Zl;zx=1;var t=zN(),e=Qb(),r=LN();function a(n){var u="https://react.dev/errors/"+n;if(1Z||(n.current=J[Z],J[Z]=null,Z--)}function Q(n,u){Z++,J[Z]=n.current,n.current=u}var F=L(null),K=L(null),X=L(null),ee=L(null);function he(n,u){switch(Q(X,u),Q(K,n),Q(F,null),u.nodeType){case 9:case 11:n=(n=u.documentElement)&&(n=n.namespaceURI)?$S(n):0;break;default:if(n=u.tagName,u=u.namespaceURI)u=$S(u),n=ZS(u,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}H(F),Q(F,n)}function ue(){H(F),H(K),H(X)}function te(n){n.memoizedState!==null&&Q(ee,n);var u=F.current,f=ZS(u,n.type);u!==f&&(Q(K,n),Q(F,f))}function ne(n){K.current===n&&(H(F),H(K)),ee.current===n&&(H(ee),jl._currentValue=Y)}var oe,de;function Ee(n){if(oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);oe=u&&u[1]||"",de=-1)":-1m||$[h]!==se[m]){var pe=` +`+$[h].replace(" at new "," at ");return n.displayName&&pe.includes("")&&(pe=pe.replace("",n.displayName)),pe}while(1<=h&&0<=m);break}}}finally{Se=!1,Error.prepareStackTrace=f}return(f=n?n.displayName||n.name:"")?Ee(f):""}function Te(n,u){switch(n.tag){case 26:case 27:case 5:return Ee(n.type);case 16:return Ee("Lazy");case 13:return n.child!==u&&u!==null?Ee("Suspense Fallback"):Ee("Suspense");case 19:return Ee("SuspenseList");case 0:case 15:return Ke(n.type,!1);case 11:return Ke(n.type.render,!1);case 1:return Ke(n.type,!0);case 31:return Ee("Activity");default:return""}}function Pe(n){try{var u="",f=null;do u+=Te(n,f),f=n,n=n.return;while(n);return u}catch(h){return` +Error generating stack: `+h.message+` +`+h.stack}}var Ne=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,qe=t.unstable_cancelCallback,Me=t.unstable_shouldYield,ke=t.unstable_requestPaint,Oe=t.unstable_now,Xe=t.unstable_getCurrentPriorityLevel,et=t.unstable_ImmediatePriority,ut=t.unstable_UserBlockingPriority,$e=t.unstable_NormalPriority,at=t.unstable_LowPriority,ye=t.unstable_IdlePriority,V=t.log,re=t.unstable_setDisableYieldValue,ie=null,fe=null;function ge(n){if(typeof V=="function"&&re(n),fe&&typeof fe.setStrictMode=="function")try{fe.setStrictMode(ie,n)}catch{}}var Re=Math.clz32?Math.clz32:Be,we=Math.log,Ae=Math.LN2;function Be(n){return n>>>=0,n===0?32:31-(we(n)/Ae|0)|0}var Ue=256,je=262144,Ye=4194304;function De(n){var u=n&42;if(u!==0)return u;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Qe(n,u,f){var h=n.pendingLanes;if(h===0)return 0;var m=0,w=n.suspendedLanes,D=n.pingedLanes;n=n.warmLanes;var I=h&134217727;return I!==0?(h=I&~w,h!==0?m=De(h):(D&=I,D!==0?m=De(D):f||(f=I&~n,f!==0&&(m=De(f))))):(I=h&~w,I!==0?m=De(I):D!==0?m=De(D):f||(f=h&~n,f!==0&&(m=De(f)))),m===0?0:u!==0&&u!==m&&(u&w)===0&&(w=m&-m,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:m}function tt(n,u){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&u)===0}function Zt(n,u){switch(n){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ot(){var n=Ye;return Ye<<=1,(Ye&62914560)===0&&(Ye=4194304),n}function Rr(n){for(var u=[],f=0;31>f;f++)u.push(n);return u}function Et(n,u){n.pendingLanes|=u,u!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Gt(n,u,f,h,m,w){var D=n.pendingLanes;n.pendingLanes=f,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=f,n.entangledLanes&=f,n.errorRecoveryDisabledLanes&=f,n.shellSuspendCounter=0;var I=n.entanglements,$=n.expirationTimes,se=n.hiddenUpdates;for(f=D&~f;0"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var xq=/[\n"\\]/g;function ia(n){return n.replace(xq,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function Cc(n,u,f,h,m,w,D,I){n.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?n.type=D:n.removeAttribute("type"),u!=null?D==="number"?(u===0&&n.value===""||n.value!=u)&&(n.value=""+Lr(u)):n.value!==""+Lr(u)&&(n.value=""+Lr(u)):D!=="submit"&&D!=="reset"||n.removeAttribute("value"),u!=null?_c(n,D,Lr(u)):f!=null?_c(n,D,Lr(f)):h!=null&&n.removeAttribute("value"),m==null&&w!=null&&(n.defaultChecked=!!w),m!=null&&(n.checked=m&&typeof m!="function"&&typeof m!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?n.name=""+Lr(I):n.removeAttribute("name")}function H1(n,u,f,h,m,w,D,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){Tc(n);return}f=f!=null?""+Lr(f):"",u=u!=null?""+Lr(u):f,I||u===n.value||(n.value=u),n.defaultValue=u}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,n.checked=I?n.checked:!!h,n.defaultChecked=!!h,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(n.name=D),Tc(n)}function _c(n,u,f){u==="number"&&Gs(n.ownerDocument)===n||n.defaultValue===""+f||(n.defaultValue=""+f)}function Zi(n,u,f,h){if(n=n.options,u){u={};for(var m=0;m"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oc=!1;if(Fa)try{var ol={};Object.defineProperty(ol,"passive",{get:function(){Oc=!0}}),window.addEventListener("test",ol,ol),window.removeEventListener("test",ol,ol)}catch{Oc=!1}var wn=null,Bc=null,Fs=null;function Z1(){if(Fs)return Fs;var n,u=Bc,f=u.length,h,m="value"in wn?wn.value:wn.textContent,w=m.length;for(n=0;n=vl),rw=" ",aw=!1;function nw(n,u){switch(n){case"keyup":return Qq.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iw(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var eu=!1;function Jq(n,u){switch(n){case"compositionend":return iw(u);case"keypress":return u.which!==32?null:(aw=!0,rw);case"textInput":return n=u.data,n===rw&&aw?null:n;default:return null}}function ez(n,u){if(eu)return n==="compositionend"||!kc&&nw(n,u)?(n=Z1(),Fs=Bc=wn=null,eu=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-n};n=h}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=dw(f)}}function gw(n,u){return n&&u?n===u?!0:n&&n.nodeType===3?!1:u&&u.nodeType===3?gw(n,u.parentNode):"contains"in n?n.contains(u):n.compareDocumentPosition?!!(n.compareDocumentPosition(u)&16):!1:!1}function pw(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var u=Gs(n.document);u instanceof n.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)n=u.contentWindow;else break;u=Gs(n.document)}return u}function Uc(n){var u=n&&n.nodeName&&n.nodeName.toLowerCase();return u&&(u==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||u==="textarea"||n.contentEditable==="true")}var sz=Fa&&"documentMode"in document&&11>=document.documentMode,tu=null,Vc=null,pl=null,Gc=!1;function yw(n,u,f){var h=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;Gc||tu==null||tu!==Gs(h)||(h=tu,"selectionStart"in h&&Uc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),pl&&gl(pl,h)||(pl=h,h=Po(Vc,"onSelect"),0>=D,m-=D,Ma=1<<32-Re(u)+m|f<Je?(st=Ie,Ie=null):st=Ie.sibling;var dt=ce(ae,Ie,le[Je],me);if(dt===null){Ie===null&&(Ie=st);break}n&&Ie&&dt.alternate===null&&u(ae,Ie),W=w(dt,W,Je),vt===null?Ge=dt:vt.sibling=dt,vt=dt,Ie=st}if(Je===le.length)return f(ae,Ie),ot&&Ya(ae,Je),Ge;if(Ie===null){for(;JeJe?(st=Ie,Ie=null):st=Ie.sibling;var Gn=ce(ae,Ie,dt.value,me);if(Gn===null){Ie===null&&(Ie=st);break}n&&Ie&&Gn.alternate===null&&u(ae,Ie),W=w(Gn,W,Je),vt===null?Ge=Gn:vt.sibling=Gn,vt=Gn,Ie=st}if(dt.done)return f(ae,Ie),ot&&Ya(ae,Je),Ge;if(Ie===null){for(;!dt.done;Je++,dt=le.next())dt=be(ae,dt.value,me),dt!==null&&(W=w(dt,W,Je),vt===null?Ge=dt:vt.sibling=dt,vt=dt);return ot&&Ya(ae,Je),Ge}for(Ie=h(Ie);!dt.done;Je++,dt=le.next())dt=ve(Ie,ae,Je,dt.value,me),dt!==null&&(n&&dt.alternate!==null&&Ie.delete(dt.key===null?Je:dt.key),W=w(dt,W,Je),vt===null?Ge=dt:vt.sibling=dt,vt=dt);return n&&Ie.forEach(function(RN){return u(ae,RN)}),ot&&Ya(ae,Je),Ge}function Tt(ae,W,le,me){if(typeof le=="object"&&le!==null&&le.type===x&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case y:e:{for(var Ge=le.key;W!==null;){if(W.key===Ge){if(Ge=le.type,Ge===x){if(W.tag===7){f(ae,W.sibling),me=m(W,le.props.children),me.return=ae,ae=me;break e}}else if(W.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===O&&Ti(Ge)===W.type){f(ae,W.sibling),me=m(W,le.props),Sl(me,le),me.return=ae,ae=me;break e}f(ae,W);break}else u(ae,W);W=W.sibling}le.type===x?(me=bi(le.props.children,ae.mode,me,le.key),me.return=ae,ae=me):(me=eo(le.type,le.key,le.props,null,ae.mode,me),Sl(me,le),me.return=ae,ae=me)}return D(ae);case b:e:{for(Ge=le.key;W!==null;){if(W.key===Ge)if(W.tag===4&&W.stateNode.containerInfo===le.containerInfo&&W.stateNode.implementation===le.implementation){f(ae,W.sibling),me=m(W,le.children||[]),me.return=ae,ae=me;break e}else{f(ae,W);break}else u(ae,W);W=W.sibling}me=$c(le,ae.mode,me),me.return=ae,ae=me}return D(ae);case O:return le=Ti(le),Tt(ae,W,le,me)}if(j(le))return Le(ae,W,le,me);if(k(le)){if(Ge=k(le),typeof Ge!="function")throw Error(a(150));return le=Ge.call(le),Fe(ae,W,le,me)}if(typeof le.then=="function")return Tt(ae,W,lo(le),me);if(le.$$typeof===C)return Tt(ae,W,ao(ae,le),me);so(ae,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,W!==null&&W.tag===6?(f(ae,W.sibling),me=m(W,le),me.return=ae,ae=me):(f(ae,W),me=Xc(le,ae.mode,me),me.return=ae,ae=me),D(ae)):f(ae,W)}return function(ae,W,le,me){try{El=0;var Ge=Tt(ae,W,le,me);return vu=null,Ge}catch(Ie){if(Ie===cu||Ie===io)throw Ie;var vt=Qr(29,Ie,null,ae.mode);return vt.lanes=me,vt.return=ae,vt}}}var _i=Uw(!0),Vw=Uw(!1),Cn=!1;function lv(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sv(n,u){n=n.updateQueue,u.updateQueue===n&&(u.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function _n(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function An(n,u,f){var h=n.updateQueue;if(h===null)return null;if(h=h.shared,(gt&2)!==0){var m=h.pending;return m===null?u.next=u:(u.next=m.next,m.next=u),h.pending=u,u=Js(n),Tw(n,null,f),u}return Ws(n,h,u,f),Js(n)}function xl(n,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var h=u.lanes;h&=n.pendingLanes,f|=h,u.lanes=f,Qt(n,f)}}function ov(n,u){var f=n.updateQueue,h=n.alternate;if(h!==null&&(h=h.updateQueue,f===h)){var m=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var D={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?m=w=D:w=w.next=D,f=f.next}while(f!==null);w===null?m=w=u:w=w.next=u}else m=w=u;f={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:w,shared:h.shared,callbacks:h.callbacks},n.updateQueue=f;return}n=f.lastBaseUpdate,n===null?f.firstBaseUpdate=u:n.next=u,f.lastBaseUpdate=u}var fv=!1;function Tl(){if(fv){var n=fu;if(n!==null)throw n}}function Cl(n,u,f,h){fv=!1;var m=n.updateQueue;Cn=!1;var w=m.firstBaseUpdate,D=m.lastBaseUpdate,I=m.shared.pending;if(I!==null){m.shared.pending=null;var $=I,se=$.next;$.next=null,D===null?w=se:D.next=se,D=$;var pe=n.alternate;pe!==null&&(pe=pe.updateQueue,I=pe.lastBaseUpdate,I!==D&&(I===null?pe.firstBaseUpdate=se:I.next=se,pe.lastBaseUpdate=$))}if(w!==null){var be=m.baseState;D=0,pe=se=$=null,I=w;do{var ce=I.lane&-536870913,ve=ce!==I.lane;if(ve?(lt&ce)===ce:(h&ce)===ce){ce!==0&&ce===ou&&(fv=!0),pe!==null&&(pe=pe.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Le=n,Fe=I;ce=u;var Tt=f;switch(Fe.tag){case 1:if(Le=Fe.payload,typeof Le=="function"){be=Le.call(Tt,be,ce);break e}be=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=Fe.payload,ce=typeof Le=="function"?Le.call(Tt,be,ce):Le,ce==null)break e;be=g({},be,ce);break e;case 2:Cn=!0}}ce=I.callback,ce!==null&&(n.flags|=64,ve&&(n.flags|=8192),ve=m.callbacks,ve===null?m.callbacks=[ce]:ve.push(ce))}else ve={lane:ce,tag:I.tag,payload:I.payload,callback:I.callback,next:null},pe===null?(se=pe=ve,$=be):pe=pe.next=ve,D|=ce;if(I=I.next,I===null){if(I=m.shared.pending,I===null)break;ve=I,I=ve.next,ve.next=null,m.lastBaseUpdate=ve,m.shared.pending=null}}while(!0);pe===null&&($=be),m.baseState=$,m.firstBaseUpdate=se,m.lastBaseUpdate=pe,w===null&&(m.shared.lanes=0),Bn|=D,n.lanes=D,n.memoizedState=be}}function Gw(n,u){if(typeof n!="function")throw Error(a(191,n));n.call(u)}function Hw(n,u){var f=n.callbacks;if(f!==null)for(n.callbacks=null,n=0;nw?w:8;var D=q.T,I={};q.T=I,Dv(n,!1,u,f);try{var $=m(),se=q.S;if(se!==null&&se(I,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var pe=yz($,h);Rl(n,u,pe,ra(n))}else Rl(n,u,h,ra(n))}catch(be){Rl(n,u,{then:function(){},status:"rejected",reason:be},ra())}finally{U.p=w,D!==null&&I.types!==null&&(D.types=I.types),q.T=D}}function xz(){}function Av(n,u,f,h){if(n.tag!==5)throw Error(a(476));var m=EE(n).queue;wE(n,m,u,Y,f===null?xz:function(){return SE(n),f(h)})}function EE(n){var u=n.memoizedState;if(u!==null)return u;u={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:Y},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:f},next:null},n.memoizedState=u,n=n.alternate,n!==null&&(n.memoizedState=u),u}function SE(n){var u=EE(n);u.next===null&&(u=n.alternate.memoizedState),Rl(n,u.next.queue,{},ra())}function Rv(){return yr(jl)}function xE(){return $t().memoizedState}function TE(){return $t().memoizedState}function Tz(n){for(var u=n.return;u!==null;){switch(u.tag){case 24:case 3:var f=ra();n=_n(f);var h=An(u,n,f);h!==null&&(Gr(h,u,f),xl(h,u,f)),u={cache:av()},n.payload=u;return}u=u.return}}function Cz(n,u,f){var h=ra();f={lane:h,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},bo(n)?_E(u,f):(f=Yc(n,u,f,h),f!==null&&(Gr(f,n,h),AE(f,u,h)))}function CE(n,u,f){var h=ra();Rl(n,u,f,h)}function Rl(n,u,f,h){var m={lane:h,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(bo(n))_E(u,m);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var D=u.lastRenderedState,I=w(D,f);if(m.hasEagerState=!0,m.eagerState=I,Zr(I,D))return Ws(n,u,m,0),At===null&&Qs(),!1}catch{}if(f=Yc(n,u,m,h),f!==null)return Gr(f,n,h),AE(f,u,h),!0}return!1}function Dv(n,u,f,h){if(h={lane:2,revertLane:ld(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},bo(n)){if(u)throw Error(a(479))}else u=Yc(n,f,h,2),u!==null&&Gr(u,n,2)}function bo(n){var u=n.alternate;return n===We||u!==null&&u===We}function _E(n,u){hu=co=!0;var f=n.pending;f===null?u.next=u:(u.next=f.next,f.next=u),n.pending=u}function AE(n,u,f){if((f&4194048)!==0){var h=u.lanes;h&=n.pendingLanes,f|=h,u.lanes=f,Qt(n,f)}}var Dl={readContext:yr,use:go,useCallback:Ft,useContext:Ft,useEffect:Ft,useImperativeHandle:Ft,useLayoutEffect:Ft,useInsertionEffect:Ft,useMemo:Ft,useReducer:Ft,useRef:Ft,useState:Ft,useDebugValue:Ft,useDeferredValue:Ft,useTransition:Ft,useSyncExternalStore:Ft,useId:Ft,useHostTransitionStatus:Ft,useFormState:Ft,useActionState:Ft,useOptimistic:Ft,useMemoCache:Ft,useCacheRefresh:Ft};Dl.useEffectEvent=Ft;var RE={readContext:yr,use:go,useCallback:function(n,u){return Dr().memoizedState=[n,u===void 0?null:u],n},useContext:yr,useEffect:cE,useImperativeHandle:function(n,u,f){f=f!=null?f.concat([n]):null,yo(4194308,4,gE.bind(null,u,n),f)},useLayoutEffect:function(n,u){return yo(4194308,4,n,u)},useInsertionEffect:function(n,u){yo(4,2,n,u)},useMemo:function(n,u){var f=Dr();u=u===void 0?null:u;var h=n();if(Ai){ge(!0);try{n()}finally{ge(!1)}}return f.memoizedState=[h,u],h},useReducer:function(n,u,f){var h=Dr();if(f!==void 0){var m=f(u);if(Ai){ge(!0);try{f(u)}finally{ge(!1)}}}else m=u;return h.memoizedState=h.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},h.queue=n,n=n.dispatch=Cz.bind(null,We,n),[h.memoizedState,n]},useRef:function(n){var u=Dr();return n={current:n},u.memoizedState=n},useState:function(n){n=Sv(n);var u=n.queue,f=CE.bind(null,We,u);return u.dispatch=f,[n.memoizedState,f]},useDebugValue:Cv,useDeferredValue:function(n,u){var f=Dr();return _v(f,n,u)},useTransition:function(){var n=Sv(!1);return n=wE.bind(null,We,n.queue,!0,!1),Dr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,u,f){var h=We,m=Dr();if(ot){if(f===void 0)throw Error(a(407));f=f()}else{if(f=u(),At===null)throw Error(a(349));(lt&127)!==0||$w(h,u,f)}m.memoizedState=f;var w={value:f,getSnapshot:u};return m.queue=w,cE(Qw.bind(null,h,w,n),[n]),h.flags|=2048,pu(9,{destroy:void 0},Zw.bind(null,h,w,f,u),null),f},useId:function(){var n=Dr(),u=At.identifierPrefix;if(ot){var f=Oa,h=Ma;f=(h&~(1<<32-Re(h)-1)).toString(32)+f,u="_"+u+"R_"+f,f=vo++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof h.is=="string"?D.createElement("select",{is:h.is}):D.createElement("select"),h.multiple?w.multiple=!0:h.size&&(w.size=h.size);break;default:w=typeof h.is=="string"?D.createElement(m,{is:h.is}):D.createElement(m)}}w[Bt]=u,w[mt]=h;e:for(D=u.child;D!==null;){if(D.tag===5||D.tag===6)w.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===u)break e;for(;D.sibling===null;){if(D.return===null||D.return===u)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}u.stateNode=w;e:switch(br(w,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Wa(u)}}return zt(u),Hv(u,u.type,n===null?null:n.memoizedProps,u.pendingProps,f),null;case 6:if(n&&u.stateNode!=null)n.memoizedProps!==h&&Wa(u);else{if(typeof h!="string"&&u.stateNode===null)throw Error(a(166));if(n=X.current,lu(u)){if(n=u.stateNode,f=u.memoizedProps,h=null,m=pr,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}n[Bt]=u,n=!!(n.nodeValue===f||h!==null&&h.suppressHydrationWarning===!0||KS(n.nodeValue,f)),n||xn(u,!0)}else n=Io(n).createTextNode(h),n[Bt]=u,u.stateNode=n}return zt(u),null;case 31:if(f=u.memoizedState,n===null||n.memoizedState!==null){if(h=lu(u),f!==null){if(n===null){if(!h)throw Error(a(318));if(n=u.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[Bt]=u}else wi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;zt(u),n=!1}else f=Jc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=f),n=!0;if(!n)return u.flags&256?(Jr(u),u):(Jr(u),null);if((u.flags&128)!==0)throw Error(a(558))}return zt(u),null;case 13:if(h=u.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=lu(u),h!==null&&h.dehydrated!==null){if(n===null){if(!m)throw Error(a(318));if(m=u.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(a(317));m[Bt]=u}else wi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;zt(u),m=!1}else m=Jc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return u.flags&256?(Jr(u),u):(Jr(u),null)}return Jr(u),(u.flags&128)!==0?(u.lanes=f,u):(f=h!==null,n=n!==null&&n.memoizedState!==null,f&&(h=u.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),w=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(w=h.memoizedState.cachePool.pool),w!==m&&(h.flags|=2048)),f!==n&&f&&(u.child.flags|=8192),To(u,u.updateQueue),zt(u),null);case 4:return ue(),n===null&&cd(u.stateNode.containerInfo),zt(u),null;case 10:return Xa(u.type),zt(u),null;case 19:if(H(Xt),h=u.memoizedState,h===null)return zt(u),null;if(m=(u.flags&128)!==0,w=h.rendering,w===null)if(m)Ol(h,!1);else{if(jt!==0||n!==null&&(n.flags&128)!==0)for(n=u.child;n!==null;){if(w=fo(n),w!==null){for(u.flags|=128,Ol(h,!1),n=w.updateQueue,u.updateQueue=n,To(u,n),u.subtreeFlags=0,n=f,f=u.child;f!==null;)Cw(f,n),f=f.sibling;return Q(Xt,Xt.current&1|2),ot&&Ya(u,h.treeForkCount),u.child}n=n.sibling}h.tail!==null&&Oe()>Do&&(u.flags|=128,m=!0,Ol(h,!1),u.lanes=4194304)}else{if(!m)if(n=fo(w),n!==null){if(u.flags|=128,m=!0,n=n.updateQueue,u.updateQueue=n,To(u,n),Ol(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!ot)return zt(u),null}else 2*Oe()-h.renderingStartTime>Do&&f!==536870912&&(u.flags|=128,m=!0,Ol(h,!1),u.lanes=4194304);h.isBackwards?(w.sibling=u.child,u.child=w):(n=h.last,n!==null?n.sibling=w:u.child=w,h.last=w)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=Oe(),n.sibling=null,f=Xt.current,Q(Xt,m?f&1|2:f&1),ot&&Ya(u,h.treeForkCount),n):(zt(u),null);case 22:case 23:return Jr(u),vv(),h=u.memoizedState!==null,n!==null?n.memoizedState!==null!==h&&(u.flags|=8192):h&&(u.flags|=8192),h?(f&536870912)!==0&&(u.flags&128)===0&&(zt(u),u.subtreeFlags&6&&(u.flags|=8192)):zt(u),f=u.updateQueue,f!==null&&To(u,f.retryQueue),f=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(f=n.memoizedState.cachePool.pool),h=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(h=u.memoizedState.cachePool.pool),h!==f&&(u.flags|=2048),n!==null&&H(xi),null;case 24:return f=null,n!==null&&(f=n.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Xa(Jt),zt(u),null;case 25:return null;case 30:return null}throw Error(a(156,u.tag))}function Mz(n,u){switch(Qc(u),u.tag){case 1:return n=u.flags,n&65536?(u.flags=n&-65537|128,u):null;case 3:return Xa(Jt),ue(),n=u.flags,(n&65536)!==0&&(n&128)===0?(u.flags=n&-65537|128,u):null;case 26:case 27:case 5:return ne(u),null;case 31:if(u.memoizedState!==null){if(Jr(u),u.alternate===null)throw Error(a(340));wi()}return n=u.flags,n&65536?(u.flags=n&-65537|128,u):null;case 13:if(Jr(u),n=u.memoizedState,n!==null&&n.dehydrated!==null){if(u.alternate===null)throw Error(a(340));wi()}return n=u.flags,n&65536?(u.flags=n&-65537|128,u):null;case 19:return H(Xt),null;case 4:return ue(),null;case 10:return Xa(u.type),null;case 22:case 23:return Jr(u),vv(),n!==null&&H(xi),n=u.flags,n&65536?(u.flags=n&-65537|128,u):null;case 24:return Xa(Jt),null;case 25:return null;default:return null}}function WE(n,u){switch(Qc(u),u.tag){case 3:Xa(Jt),ue();break;case 26:case 27:case 5:ne(u);break;case 4:ue();break;case 31:u.memoizedState!==null&&Jr(u);break;case 13:Jr(u);break;case 19:H(Xt);break;case 10:Xa(u.type);break;case 22:case 23:Jr(u),vv(),n!==null&&H(xi);break;case 24:Xa(Jt)}}function Bl(n,u){try{var f=u.updateQueue,h=f!==null?f.lastEffect:null;if(h!==null){var m=h.next;f=m;do{if((f.tag&n)===n){h=void 0;var w=f.create,D=f.inst;h=w(),D.destroy=h}f=f.next}while(f!==m)}}catch(I){wt(u,u.return,I)}}function Mn(n,u,f){try{var h=u.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var w=m.next;h=w;do{if((h.tag&n)===n){var D=h.inst,I=D.destroy;if(I!==void 0){D.destroy=void 0,m=u;var $=f,se=I;try{se()}catch(pe){wt(m,$,pe)}}}h=h.next}while(h!==w)}}catch(pe){wt(u,u.return,pe)}}function JE(n){var u=n.updateQueue;if(u!==null){var f=n.stateNode;try{Hw(u,f)}catch(h){wt(n,n.return,h)}}}function eS(n,u,f){f.props=Ri(n.type,n.memoizedProps),f.state=n.memoizedState;try{f.componentWillUnmount()}catch(h){wt(n,u,h)}}function ql(n,u){try{var f=n.ref;if(f!==null){switch(n.tag){case 26:case 27:case 5:var h=n.stateNode;break;case 30:h=n.stateNode;break;default:h=n.stateNode}typeof f=="function"?n.refCleanup=f(h):f.current=h}}catch(m){wt(n,u,m)}}function Ba(n,u){var f=n.ref,h=n.refCleanup;if(f!==null)if(typeof h=="function")try{h()}catch(m){wt(n,u,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(m){wt(n,u,m)}else f.current=null}function tS(n){var u=n.type,f=n.memoizedProps,h=n.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&h.focus();break e;case"img":f.src?h.src=f.src:f.srcSet&&(h.srcset=f.srcSet)}}catch(m){wt(n,n.return,m)}}function Fv(n,u,f){try{var h=n.stateNode;Wz(h,n.type,f,u),h[mt]=u}catch(m){wt(n,n.return,m)}}function rS(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&kn(n.type)||n.tag===4}function jv(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||rS(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&kn(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Yv(n,u,f){var h=n.tag;if(h===5||h===6)n=n.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(n,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(n),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=Ha));else if(h!==4&&(h===27&&kn(n.type)&&(f=n.stateNode,u=null),n=n.child,n!==null))for(Yv(n,u,f),n=n.sibling;n!==null;)Yv(n,u,f),n=n.sibling}function Co(n,u,f){var h=n.tag;if(h===5||h===6)n=n.stateNode,u?f.insertBefore(n,u):f.appendChild(n);else if(h!==4&&(h===27&&kn(n.type)&&(f=n.stateNode),n=n.child,n!==null))for(Co(n,u,f),n=n.sibling;n!==null;)Co(n,u,f),n=n.sibling}function aS(n){var u=n.stateNode,f=n.memoizedProps;try{for(var h=n.type,m=u.attributes;m.length;)u.removeAttributeNode(m[0]);br(u,h,f),u[Bt]=n,u[mt]=f}catch(w){wt(n,n.return,w)}}var Ja=!1,rr=!1,Kv=!1,nS=typeof WeakSet=="function"?WeakSet:Set,vr=null;function Oz(n,u){if(n=n.containerInfo,hd=Yo,n=pw(n),Uc(n)){if("selectionStart"in n)var f={start:n.selectionStart,end:n.selectionEnd};else e:{f=(f=n.ownerDocument)&&f.defaultView||window;var h=f.getSelection&&f.getSelection();if(h&&h.rangeCount!==0){f=h.anchorNode;var m=h.anchorOffset,w=h.focusNode;h=h.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var D=0,I=-1,$=-1,se=0,pe=0,be=n,ce=null;t:for(;;){for(var ve;be!==f||m!==0&&be.nodeType!==3||(I=D+m),be!==w||h!==0&&be.nodeType!==3||($=D+h),be.nodeType===3&&(D+=be.nodeValue.length),(ve=be.firstChild)!==null;)ce=be,be=ve;for(;;){if(be===n)break t;if(ce===f&&++se===m&&(I=D),ce===w&&++pe===h&&($=D),(ve=be.nextSibling)!==null)break;be=ce,ce=be.parentNode}be=ve}f=I===-1||$===-1?null:{start:I,end:$}}else f=null}f=f||{start:0,end:0}}else f=null;for(gd={focusedElem:n,selectionRange:f},Yo=!1,vr=u;vr!==null;)if(u=vr,n=u.child,(u.subtreeFlags&1028)!==0&&n!==null)n.return=u,vr=n;else for(;vr!==null;){switch(u=vr,w=u.alternate,n=u.flags,u.tag){case 0:if((n&4)!==0&&(n=u.updateQueue,n=n!==null?n.events:null,n!==null))for(f=0;f title"))),br(w,h,f),w[Bt]=n,Wt(w),h=w;break e;case"link":var D=fx("link","href",m).get(h+(f.href||""));if(D){for(var I=0;ITt&&(D=Tt,Tt=Fe,Fe=D);var ae=hw(I,Fe),W=hw(I,Tt);if(ae&&W&&(ve.rangeCount!==1||ve.anchorNode!==ae.node||ve.anchorOffset!==ae.offset||ve.focusNode!==W.node||ve.focusOffset!==W.offset)){var le=be.createRange();le.setStart(ae.node,ae.offset),ve.removeAllRanges(),Fe>Tt?(ve.addRange(le),ve.extend(W.node,W.offset)):(le.setEnd(W.node,W.offset),ve.addRange(le))}}}}for(be=[],ve=I;ve=ve.parentNode;)ve.nodeType===1&&be.push({element:ve,left:ve.scrollLeft,top:ve.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,q.T=null,f=ed,ed=null;var w=zn,D=nn;if(ur=0,Eu=zn=null,nn=0,(gt&6)!==0)throw Error(a(331));var I=gt;if(gt|=4,gS(w.current),vS(w,w.current,D,f),gt=I,Il(0,!1),fe&&typeof fe.onPostCommitFiberRoot=="function")try{fe.onPostCommitFiberRoot(ie,w)}catch{}return!0}finally{U.p=m,q.T=h,qS(n,u)}}function NS(n,u,f){u=la(f,u),u=qv(n.stateNode,u,2),n=An(n,u,2),n!==null&&(Et(n,2),qa(n))}function wt(n,u,f){if(n.tag===3)NS(n,n,f);else for(;u!==null;){if(u.tag===3){NS(u,n,f);break}else if(u.tag===1){var h=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(qn===null||!qn.has(h))){n=la(f,n),f=LE(2),h=An(u,f,2),h!==null&&(kE(f,h,u,n),Et(h,2),qa(h));break}}u=u.return}}function nd(n,u,f){var h=n.pingCache;if(h===null){h=n.pingCache=new zz;var m=new Set;h.set(u,m)}else m=h.get(u),m===void 0&&(m=new Set,h.set(u,m));m.has(f)||(Zv=!0,m.add(f),n=Iz.bind(null,n,u,f),u.then(n,n))}function Iz(n,u,f){var h=n.pingCache;h!==null&&h.delete(u),n.pingedLanes|=n.suspendedLanes&f,n.warmLanes&=~f,At===n&&(lt&f)===f&&(jt===4||jt===3&&(lt&62914560)===lt&&300>Oe()-Ro?(gt&2)===0&&Su(n,0):Qv|=f,wu===lt&&(wu=0)),qa(n)}function LS(n,u){u===0&&(u=Ot()),n=mi(n,u),n!==null&&(Et(n,u),qa(n))}function Uz(n){var u=n.memoizedState,f=0;u!==null&&(f=u.retryLane),LS(n,f)}function Vz(n,u){var f=0;switch(n.tag){case 31:case 13:var h=n.stateNode,m=n.memoizedState;m!==null&&(f=m.retryLane);break;case 19:h=n.stateNode;break;case 22:h=n.stateNode._retryCache;break;default:throw Error(a(314))}h!==null&&h.delete(u),LS(n,f)}function Gz(n,u){return _e(n,u)}var No=null,Tu=null,id=!1,Lo=!1,ud=!1,Ln=0;function qa(n){n!==Tu&&n.next===null&&(Tu===null?No=Tu=n:Tu=Tu.next=n),Lo=!0,id||(id=!0,Fz())}function Il(n,u){if(!ud&&Lo){ud=!0;do for(var f=!1,h=No;h!==null;){if(n!==0){var m=h.pendingLanes;if(m===0)var w=0;else{var D=h.suspendedLanes,I=h.pingedLanes;w=(1<<31-Re(42|n)+1)-1,w&=m&~(D&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,US(h,w))}else w=lt,w=Qe(h,h===At?w:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(w&3)===0||tt(h,w)||(f=!0,US(h,w));h=h.next}while(f);ud=!1}}function Hz(){kS()}function kS(){Lo=id=!1;var n=0;Ln!==0&&eN()&&(n=Ln);for(var u=Oe(),f=null,h=No;h!==null;){var m=h.next,w=PS(h,u);w===0?(h.next=null,f===null?No=m:f.next=m,m===null&&(Tu=f)):(f=h,(n!==0||(w&3)!==0)&&(Lo=!0)),h=m}ur!==0&&ur!==5||Il(n),Ln!==0&&(Ln=0)}function PS(n,u){for(var f=n.suspendedLanes,h=n.pingedLanes,m=n.expirationTimes,w=n.pendingLanes&-62914561;0I)break;var pe=$.transferSize,be=$.initiatorType;pe&&XS(be)&&($=$.responseEnd,D+=pe*($"u"?null:document;function ux(n,u,f){var h=Cu;if(h&&typeof u=="string"&&u){var m=ia(u);m='link[rel="'+n+'"][href="'+m+'"]',typeof f=="string"&&(m+='[crossorigin="'+f+'"]'),ix.has(m)||(ix.add(m),n={rel:n,crossOrigin:f,href:u},h.querySelector(m)===null&&(u=h.createElement("link"),br(u,"link",n),Wt(u),h.head.appendChild(u)))}}function oN(n){un.D(n),ux("dns-prefetch",n,null)}function fN(n,u){un.C(n,u),ux("preconnect",n,u)}function cN(n,u,f){un.L(n,u,f);var h=Cu;if(h&&n&&u){var m='link[rel="preload"][as="'+ia(u)+'"]';u==="image"&&f&&f.imageSrcSet?(m+='[imagesrcset="'+ia(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(m+='[imagesizes="'+ia(f.imageSizes)+'"]')):m+='[href="'+ia(n)+'"]';var w=m;switch(u){case"style":w=_u(n);break;case"script":w=Au(n)}da.has(w)||(n=g({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:n,as:u},f),da.set(w,n),h.querySelector(m)!==null||u==="style"&&h.querySelector(Hl(w))||u==="script"&&h.querySelector(Fl(w))||(u=h.createElement("link"),br(u,"link",n),Wt(u),h.head.appendChild(u)))}}function vN(n,u){un.m(n,u);var f=Cu;if(f&&n){var h=u&&typeof u.as=="string"?u.as:"script",m='link[rel="modulepreload"][as="'+ia(h)+'"][href="'+ia(n)+'"]',w=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Au(n)}if(!da.has(w)&&(n=g({rel:"modulepreload",href:n},u),da.set(w,n),f.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Fl(w)))return}h=f.createElement("link"),br(h,"link",n),Wt(h),f.head.appendChild(h)}}}function dN(n,u,f){un.S(n,u,f);var h=Cu;if(h&&n){var m=mn(h).hoistableStyles,w=_u(n);u=u||"default";var D=m.get(w);if(!D){var I={loading:0,preload:null};if(D=h.querySelector(Hl(w)))I.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":u},f),(f=da.get(w))&&Sd(n,f);var $=D=h.createElement("link");Wt($),br($,"link",n),$._p=new Promise(function(se,pe){$.onload=se,$.onerror=pe}),$.addEventListener("load",function(){I.loading|=1}),$.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Vo(D,u,h)}D={type:"stylesheet",instance:D,count:1,state:I},m.set(w,D)}}}function hN(n,u){un.X(n,u);var f=Cu;if(f&&n){var h=mn(f).hoistableScripts,m=Au(n),w=h.get(m);w||(w=f.querySelector(Fl(m)),w||(n=g({src:n,async:!0},u),(u=da.get(m))&&xd(n,u),w=f.createElement("script"),Wt(w),br(w,"link",n),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},h.set(m,w))}}function gN(n,u){un.M(n,u);var f=Cu;if(f&&n){var h=mn(f).hoistableScripts,m=Au(n),w=h.get(m);w||(w=f.querySelector(Fl(m)),w||(n=g({src:n,async:!0,type:"module"},u),(u=da.get(m))&&xd(n,u),w=f.createElement("script"),Wt(w),br(w,"link",n),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},h.set(m,w))}}function lx(n,u,f,h){var m=(m=X.current)?Uo(m):null;if(!m)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=_u(f.href),f=mn(m).hoistableStyles,h=f.get(u),h||(h={type:"style",instance:null,count:0,state:null},f.set(u,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){n=_u(f.href);var w=mn(m).hoistableStyles,D=w.get(n);if(D||(m=m.ownerDocument||m,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,D),(w=m.querySelector(Hl(n)))&&!w._p&&(D.instance=w,D.state.loading=5),da.has(n)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},da.set(n,f),w||pN(m,n,f,D.state))),u&&h===null)throw Error(a(528,""));return D}if(u&&h!==null)throw Error(a(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=Au(f),f=mn(m).hoistableScripts,h=f.get(u),h||(h={type:"script",instance:null,count:0,state:null},f.set(u,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,n))}}function _u(n){return'href="'+ia(n)+'"'}function Hl(n){return'link[rel="stylesheet"]['+n+"]"}function sx(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function pN(n,u,f,h){n.querySelector('link[rel="preload"][as="style"]['+u+"]")?h.loading=1:(u=n.createElement("link"),h.preload=u,u.addEventListener("load",function(){return h.loading|=1}),u.addEventListener("error",function(){return h.loading|=2}),br(u,"link",f),Wt(u),n.head.appendChild(u))}function Au(n){return'[src="'+ia(n)+'"]'}function Fl(n){return"script[async]"+n}function ox(n,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var h=n.querySelector('style[data-href~="'+ia(f.href)+'"]');if(h)return u.instance=h,Wt(h),h;var m=g({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return h=(n.ownerDocument||n).createElement("style"),Wt(h),br(h,"style",m),Vo(h,f.precedence,n),u.instance=h;case"stylesheet":m=_u(f.href);var w=n.querySelector(Hl(m));if(w)return u.state.loading|=4,u.instance=w,Wt(w),w;h=sx(f),(m=da.get(m))&&Sd(h,m),w=(n.ownerDocument||n).createElement("link"),Wt(w);var D=w;return D._p=new Promise(function(I,$){D.onload=I,D.onerror=$}),br(w,"link",h),u.state.loading|=4,Vo(w,f.precedence,n),u.instance=w;case"script":return w=Au(f.src),(m=n.querySelector(Fl(w)))?(u.instance=m,Wt(m),m):(h=f,(m=da.get(w))&&(h=g({},f),xd(h,m)),n=n.ownerDocument||n,m=n.createElement("script"),Wt(m),br(m,"link",h),n.head.appendChild(m),u.instance=m);case"void":return null;default:throw Error(a(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(h=u.instance,u.state.loading|=4,Vo(h,f.precedence,n));return u.instance}function Vo(n,u,f){for(var h=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,w=m,D=0;D title"):null)}function yN(n,u,f){if(f===1||u.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;return u.rel==="stylesheet"?(n=u.disabled,typeof u.precedence=="string"&&n==null):!0;case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function vx(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function mN(n,u,f,h){if(f.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var m=_u(h.href),w=u.querySelector(Hl(m));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(n.count++,n=Ho.bind(n),u.then(n,n)),f.state.loading|=4,f.instance=w,Wt(w);return}w=u.ownerDocument||u,h=sx(h),(m=da.get(m))&&Sd(h,m),w=w.createElement("link"),Wt(w);var D=w;D._p=new Promise(function(I,$){D.onload=I,D.onerror=$}),br(w,"link",h),f.instance=w}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(n.count++,f=Ho.bind(n),u.addEventListener("load",f),u.addEventListener("error",f))}}var Td=0;function bN(n,u){return n.stylesheets&&n.count===0&&jo(n,n.stylesheets),0Td?50:800)+u);return n.unsuspend=f,function(){n.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function Ho(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jo(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Fo=null;function jo(n,u){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Fo=new Map,u.forEach(wN,n),Fo=null,Ho.call(n))}function wN(n,u){if(!(u.state.loading&4)){var f=Fo.get(n);if(f)var h=f.get(null);else{f=new Map,Fo.set(n,f);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),qd.exports=kN(),qd.exports}var IN=PN();const UN=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),OM=(...t)=>t.filter((e,r,a)=>!!e&&e.trim()!==""&&a.indexOf(e)===r).join(" ").trim();var VN={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const GN=kt.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:i="",children:l,iconNode:s,...o},v)=>kt.createElement("svg",{ref:v,...VN,width:e,height:e,stroke:t,strokeWidth:a?Number(r)*24/Number(e):r,className:OM("lucide",i),...o},[...s.map(([c,d])=>kt.createElement(c,d)),...Array.isArray(l)?l:[l]]));const Aa=(t,e)=>{const r=kt.forwardRef(({className:a,...i},l)=>kt.createElement(GN,{ref:l,iconNode:e,className:OM(`lucide-${UN(t)}`,a),...i}));return r.displayName=`${t}`,r};const HN=Aa("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const FN=Aa("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);const jN=Aa("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const YN=Aa("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);const KN=Aa("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const XN=Aa("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);const $N=Aa("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const ZN=Aa("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);const QN=Aa("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const WN=Aa("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);const JN=Aa("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function Ob(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(v){throw v},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,s=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var v=r.next();return s=v.done,v},e:function(v){o=!0,l=v},f:function(){try{s||r.return==null||r.return()}finally{if(o)throw l}}}}function BM(t,e,r){return(e=qM(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function aL(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function nL(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,i,l,s,o=[],v=!0,c=!1;try{if(l=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;v=!1}else for(;!(v=(a=l.call(r)).done)&&(o.push(a.value),o.length!==e);v=!0);}catch(d){c=!0,i=d}finally{try{if(!v&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return o}}function iL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uL(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nr(t,e){return eL(t)||nL(t,e)||Wb(t,e)||iL()}function _f(t){return tL(t)||aL(t)||Wb(t)||uL()}function lL(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function qM(t){var e=lL(t,"string");return typeof e=="symbol"?e:e+""}function or(t){"@babel/helpers - typeof";return or=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},or(t)}function Wb(t,e){if(t){if(typeof t=="string")return Ob(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ob(t,e):void 0}}var lr=typeof window>"u"?null:window,Lx=lr?lr.navigator:null;lr&&lr.document;var sL=or(""),zM=or({}),oL=or(function(){}),fL=typeof HTMLElement>"u"?"undefined":or(HTMLElement),xs=function(e){return e&&e.instanceString&&Vt(e.instanceString)?e.instanceString():null},Ve=function(e){return e!=null&&or(e)==sL},Vt=function(e){return e!=null&&or(e)===oL},Rt=function(e){return!aa(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},ct=function(e){return e!=null&&or(e)===zM&&!Rt(e)&&e.constructor===Object},cL=function(e){return e!=null&&or(e)===zM},Ce=function(e){return e!=null&&or(e)===or(1)&&!isNaN(e)},vL=function(e){return Ce(e)&&Math.floor(e)===e},Af=function(e){if(fL!=="undefined")return e!=null&&e instanceof HTMLElement},aa=function(e){return Ts(e)||NM(e)},Ts=function(e){return xs(e)==="collection"&&e._private.single},NM=function(e){return xs(e)==="collection"&&!e._private.single},Jb=function(e){return xs(e)==="core"},LM=function(e){return xs(e)==="stylesheet"},dL=function(e){return xs(e)==="event"},Wn=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},hL=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},gL=function(e){return ct(e)&&Ce(e.x1)&&Ce(e.x2)&&Ce(e.y1)&&Ce(e.y2)},pL=function(e){return cL(e)&&Vt(e.then)},yL=function(){return Lx&&Lx.userAgent.match(/msie|trident|edge/i)},ju=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var l=[],s=0;sr?1:0},TL=function(e,r){return-1*PM(e,r)},He=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r1&&(E-=1),E<1/6?b+(x-b)*6*E:E<1/2?x:E<2/3?b+(x-b)*(2/3-E)*6:b}var g=new RegExp("^"+wL+"$").exec(e);if(g){if(a=parseInt(g[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,i=parseFloat(g[2]),i<0||i>100||(i=i/100,l=parseFloat(g[3]),l<0||l>100)||(l=l/100,s=g[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(i===0)o=v=c=Math.round(l*255);else{var p=l<.5?l*(1+i):l+i-l*i,y=2*l-p;o=Math.round(255*d(y,p,a+1/3)),v=Math.round(255*d(y,p,a)),c=Math.round(255*d(y,p,a-1/3))}r=[o,v,c,s]}return r},AL=function(e){var r,a=new RegExp("^"+mL+"$").exec(e);if(a){r=[];for(var i=[],l=1;l<=3;l++){var s=a[l];if(s[s.length-1]==="%"&&(i[l]=!0),s=parseFloat(s),i[l]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=i[1]||i[2]||i[3],v=i[1]&&i[2]&&i[3];if(o&&!v)return;var c=a[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;r.push(c)}}return r},RL=function(e){return DL[e.toLowerCase()]},IM=function(e){return(Rt(e)?e:null)||RL(e)||CL(e)||AL(e)||_L(e)},DL={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]},UM=function(e){for(var r=e.map,a=e.keys,i=a.length,l=0;l=v||G<0||T&&j>=p}function O(){var P=e();if(A(P))return B(P);b=setTimeout(O,M(P))}function B(P){return b=void 0,C&&d?_(P):(d=g=void 0,y)}function z(){b!==void 0&&clearTimeout(b),E=0,d=x=g=b=void 0}function N(){return b===void 0?y:B(e())}function k(){var P=e(),G=A(P);if(d=arguments,g=this,x=P,G){if(b===void 0)return R(x);if(T)return clearTimeout(b),b=setTimeout(O,v),_(x)}return b===void 0&&(b=setTimeout(O,v)),y}return k.cancel=z,k.flush=N,k}return Zd=s,Zd}var IL=PL(),Rs=Cs(IL),Qd=lr?lr.performance:null,HM=Qd&&Qd.now?function(){return Qd.now()}:function(){return Date.now()},UL=(function(){if(lr){if(lr.requestAnimationFrame)return function(t){lr.requestAnimationFrame(t)};if(lr.mozRequestAnimationFrame)return function(t){lr.mozRequestAnimationFrame(t)};if(lr.webkitRequestAnimationFrame)return function(t){lr.webkitRequestAnimationFrame(t)};if(lr.msRequestAnimationFrame)return function(t){lr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(HM())},1e3/60)}})(),Rf=function(e){return UL(e)},fn=HM,Ni=9261,FM=65599,ku=5381,jM=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ni,a=r,i;i=e.next(),!i.done;)a=a*FM+i.value|0;return a},ds=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ni;return r*FM+e|0},hs=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ku;return(r<<5)+r+e|0},VL=function(e,r){return e*2097152+r},Hn=function(e){return e[0]*2097152+e[1]},tf=function(e,r){return[ds(e[0],r[0]),hs(e[1],r[1])]},Wx=function(e,r){var a={value:0,done:!1},i=0,l=e.length,s={next:function(){return i=0;i--)e[i]===r&&e.splice(i,1)},n1=function(e){e.splice(0,e.length)},QL=function(e,r){for(var a=0;a"u"?"undefined":or(Set))!==JL?Set:ek,Hf=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Jb(e)){Pt("An element must have a core reference and parameters set");return}var i=r.group;if(i==null&&(r.data&&r.data.source!=null&&r.data.target!=null?i="edges":i="nodes"),i!=="nodes"&&i!=="edges"){Pt("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var l=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?i==="edges":!!r.pannable,active:!1,classes:new Xu,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.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(l.position.x==null&&(l.position.x=0),l.position.y==null&&(l.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),v=e.zoom();l.position={x:(s.x-o.x)/v,y:(s.y-o.y)/v}}var c=[];Rt(r.classes)?c=r.classes:Ve(r.classes)&&(c=r.classes.split(/\s+/));for(var d=0,g=c.length;dT?1:0},d=function(S,T,C,_,R){var M;if(C==null&&(C=0),R==null&&(R=a),C<0)throw new Error("lo must be non-negative");for(_==null&&(_=S.length);C<_;)M=i((C+_)/2),R(T,S[M])<0?_=M:C=M+1;return[].splice.apply(S,[C,C-C].concat(T)),T},o=function(S,T,C){return C==null&&(C=a),S.push(T),x(S,0,S.length-1,C)},s=function(S,T){var C,_;return T==null&&(T=a),C=S.pop(),S.length?(_=S[0],S[0]=C,E(S,0,T)):_=C,_},c=function(S,T,C){var _;return C==null&&(C=a),_=S[0],S[0]=T,E(S,0,C),_},v=function(S,T,C){var _;return C==null&&(C=a),S.length&&C(S[0],T)<0&&(_=[S[0],T],T=_[0],S[0]=_[1],E(S,0,C)),T},l=function(S,T){var C,_,R,M,A,O;for(T==null&&(T=a),M=(function(){O=[];for(var B=0,z=i(S.length/2);0<=z?Bz;0<=z?B++:B--)O.push(B);return O}).apply(this).reverse(),A=[],_=0,R=M.length;_N;0<=N?++O:--O)k.push(s(S,C));return k},x=function(S,T,C,_){var R,M,A;for(_==null&&(_=a),R=S[C];C>T;){if(A=C-1>>1,M=S[A],_(R,M)<0){S[C]=M,C=A;continue}break}return S[C]=R},E=function(S,T,C){var _,R,M,A,O;for(C==null&&(C=a),R=S.length,O=T,M=S[T],_=2*T+1;_0;){var M=T.pop(),A=E(M),O=M.id();if(p[O]=A,A!==1/0)for(var B=M.neighborhood().intersect(b),z=0;z0)for(Y.unshift(U);g[Z];){var L=g[Z];Y.unshift(L.edge),Y.unshift(L.node),J=L.node,Z=J.id()}return o.spawn(Y)}}}},lk={kruskal:function(e){e=e||function(C){return 1};for(var r=this.byGroup(),a=r.nodes,i=r.edges,l=a.length,s=new Array(l),o=a,v=function(_){for(var R=0;R0;){if(R(),A++,_===d){for(var O=[],B=l,z=d,N=S[z];O.unshift(B),N!=null&&O.unshift(N),B=E[z],B!=null;)z=B.id(),N=S[z];return{found:!0,distance:g[_],path:this.spawn(O),steps:A}}y[_]=!0;for(var k=C._private.edges,P=0;PN&&(b[z]=N,T[z]=B,C[z]=R),!l){var k=B*d+O;!l&&b[k]>N&&(b[k]=N,T[k]=O,C[k]=R)}}}for(var P=0;P1&&arguments[1]!==void 0?arguments[1]:s,_e=C(Pe),qe=[],Me=_e;;){if(Me==null)return r.spawn();var ke=T(Me),Oe=ke.edge,Xe=ke.pred;if(qe.unshift(Me[0]),Me.same(Ne)&&qe.length>0)break;Oe!=null&&qe.unshift(Oe),Me=Xe}return v.spawn(qe)},M=0;M=0;d--){var g=c[d],p=g[1],y=g[2];(r[p]===o&&r[y]===v||r[p]===v&&r[y]===o)&&c.splice(d,1)}for(var b=0;bi;){var l=Math.floor(Math.random()*r.length);r=gk(l,e,r),a--}return r},pk={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,i=r.edges;i.unmergeBy(function(Y){return Y.isLoop()});var l=a.length,s=i.length,o=Math.ceil(Math.pow(Math.log(l)/Math.LN2,2)),v=Math.floor(l/hk);if(l<2){Pt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var c=[],d=0;d1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,l=r;l1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,l=r;l1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,l=0,s=r;s1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(r,a):(a0&&e.splice(0,r));for(var o=0,v=e.length-1;v>=0;v--){var c=e[v];s?isFinite(c)||(e[v]=-1/0,o++):e.splice(v,1)}l&&e.sort(function(p,y){return p-y});var d=e.length,g=Math.floor(d/2);return d%2!==0?e[g+1+o]:(e[g-1+o]+e[g+o])/2},Sk=function(e){return Math.PI*e/180},rf=function(e,r){return Math.atan2(r,e)-Math.PI/2},i1=Math.log2||function(t){return Math.log(t)/Math.log(2)},u1=function(e){return e>0?1:e<0?-1:0},Ii=function(e,r){return Math.sqrt(qi(e,r))},qi=function(e,r){var a=r.x-e.x,i=r.y-e.y;return a*a+i*i},xk=function(e){for(var r=e.length,a=0,i=0;i=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}}},Ck=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},_k=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Ak=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},WM=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},gf=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},pf=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,i,l,s;if(r.length===1)a=i=l=s=r[0];else if(r.length===2)a=l=r[0],s=i=r[1];else if(r.length===4){var o=nr(r,4);a=o[0],i=o[1],l=o[2],s=o[3]}return e.x1-=s,e.x2+=i,e.y1-=a,e.y2+=l,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},n2=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},l1=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2r.y2||r.y1>e.y2)},Kn=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},i2=function(e,r){return Kn(e,r.x,r.y)},JM=function(e,r){return Kn(e,r.x1,r.y1)&&Kn(e,r.x2,r.y2)},Rk=(eh=Math.hypot)!==null&&eh!==void 0?eh:function(t,e){return Math.sqrt(t*t+e*e)};function Dk(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(O,B){return{x:O.x+B.x,y:O.y+B.y}},a=function(O,B){return{x:O.x-B.x,y:O.y-B.y}},i=function(O,B){return{x:O.x*B,y:O.y*B}},l=function(O,B){return O.x*B.y-O.y*B.x},s=function(O){var B=Rk(O.x,O.y);return B===0?{x:0,y:0}:{x:O.x/B,y:O.y/B}},o=function(O){for(var B=0,z=0;z7&&arguments[7]!==void 0?arguments[7]:"auto",c=v==="auto"?ei(l,s):v,d=l/2,g=s/2;c=Math.min(c,d,g);var p=c!==d,y=c!==g,b;if(p){var x=a-d+c-o,E=i-g-o,S=a+d-c+o,T=E;if(b=Xn(e,r,a,i,x,E,S,T,!1),b.length>0)return b}if(y){var C=a+d+o,_=i-g+c-o,R=C,M=i+g-c+o;if(b=Xn(e,r,a,i,C,_,R,M,!1),b.length>0)return b}if(p){var A=a-d+c-o,O=i+g+o,B=a+d-c+o,z=O;if(b=Xn(e,r,a,i,A,O,B,z,!1),b.length>0)return b}if(y){var N=a-d-o,k=i-g+c-o,P=N,G=i+g-c+o;if(b=Xn(e,r,a,i,N,k,P,G,!1),b.length>0)return b}var j;{var q=a-d+c,U=i-g+c;if(j=ns(e,r,a,i,q,U,c+o),j.length>0&&j[0]<=q&&j[1]<=U)return[j[0],j[1]]}{var Y=a+d-c,J=i-g+c;if(j=ns(e,r,a,i,Y,J,c+o),j.length>0&&j[0]>=Y&&j[1]<=J)return[j[0],j[1]]}{var Z=a+d-c,L=i+g-c;if(j=ns(e,r,a,i,Z,L,c+o),j.length>0&&j[0]>=Z&&j[1]>=L)return[j[0],j[1]]}{var H=a-d+c,Q=i+g-c;if(j=ns(e,r,a,i,H,Q,c+o),j.length>0&&j[0]<=H&&j[1]>=Q)return[j[0],j[1]]}return[]},Ok=function(e,r,a,i,l,s,o){var v=o,c=Math.min(a,l),d=Math.max(a,l),g=Math.min(i,s),p=Math.max(i,s);return c-v<=e&&e<=d+v&&g-v<=r&&r<=p+v},Bk=function(e,r,a,i,l,s,o,v,c){var d={x1:Math.min(a,o,l)-c,x2:Math.max(a,o,l)+c,y1:Math.min(i,v,s)-c,y2:Math.max(i,v,s)+c};return!(ed.x2||rd.y2)},qk=function(e,r,a,i){a-=i;var l=r*r-4*e*a;if(l<0)return[];var s=Math.sqrt(l),o=2*e,v=(-r+s)/o,c=(-r-s)/o;return[v,c]},zk=function(e,r,a,i,l){var s=1e-5;e===0&&(e=s),r/=e,a/=e,i/=e;var o,v,c,d,g,p,y,b;if(v=(3*a-r*r)/9,c=-(27*i)+r*(9*a-2*(r*r)),c/=54,o=v*v*v+c*c,l[1]=0,y=r/3,o>0){g=c+Math.sqrt(o),g=g<0?-Math.pow(-g,1/3):Math.pow(g,1/3),p=c-Math.sqrt(o),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),l[0]=-y+g+p,y+=(g+p)/2,l[4]=l[2]=-y,y=Math.sqrt(3)*(-p+g)/2,l[3]=y,l[5]=-y;return}if(l[5]=l[3]=0,o===0){b=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),l[0]=-y+2*b,l[4]=l[2]=-(b+y);return}v=-v,d=v*v*v,d=Math.acos(c/Math.sqrt(d)),b=2*Math.sqrt(v),l[0]=-y+b*Math.cos(d/3),l[2]=-y+b*Math.cos((d+2*Math.PI)/3),l[4]=-y+b*Math.cos((d+4*Math.PI)/3)},Nk=function(e,r,a,i,l,s,o,v){var c=1*a*a-4*a*l+2*a*o+4*l*l-4*l*o+o*o+i*i-4*i*s+2*i*v+4*s*s-4*s*v+v*v,d=9*a*l-3*a*a-3*a*o-6*l*l+3*l*o+9*i*s-3*i*i-3*i*v-6*s*s+3*s*v,g=3*a*a-6*a*l+a*o-a*e+2*l*l+2*l*e-o*e+3*i*i-6*i*s+i*v-i*r+2*s*s+2*s*r-v*r,p=1*a*l-a*a+a*e-l*e+i*s-i*i+i*r-s*r,y=[];zk(c,d,g,p,y);for(var b=1e-7,x=[],E=0;E<6;E+=2)Math.abs(y[E+1])=0&&y[E]<=1&&x.push(y[E]);x.push(1),x.push(0);for(var S=-1,T,C,_,R=0;R=0?_c?(e-l)*(e-l)+(r-s)*(r-s):d-p},Fr=function(e,r,a){for(var i,l,s,o,v,c=0,d=0;d=e&&e>=s||i<=e&&e<=s)v=(e-i)/(s-i)*(o-l)+l,v>r&&c++;else continue;return c%2!==0},cn=function(e,r,a,i,l,s,o,v,c){var d=new Array(a.length),g;v[0]!=null?(g=Math.atan(v[1]/v[0]),v[0]<0?g=g+Math.PI/2:g=-g-Math.PI/2):g=v;for(var p=Math.cos(-g),y=Math.sin(-g),b=0;b0){var E=Of(d,-c);x=Mf(E)}else x=d;return Fr(e,r,x)},kk=function(e,r,a,i,l,s,o,v){for(var c=new Array(a.length*2),d=0;d=0&&E<=1&&T.push(E),S>=0&&S<=1&&T.push(S),T.length===0)return[];var C=T[0]*v[0]+e,_=T[0]*v[1]+r;if(T.length>1){if(T[0]==T[1])return[C,_];var R=T[1]*v[0]+e,M=T[1]*v[1]+r;return[C,_,R,M]}else return[C,_]},th=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Xn=function(e,r,a,i,l,s,o,v,c){var d=e-l,g=a-e,p=o-l,y=r-s,b=i-r,x=v-s,E=p*y-x*d,S=g*y-b*d,T=x*g-p*b;if(T!==0){var C=E/T,_=S/T,R=.001,M=0-R,A=1+R;return M<=C&&C<=A&&M<=_&&_<=A?[e+C*g,r+C*b]:c?[e+C*g,r+C*b]:[]}else return E===0||S===0?th(e,a,o)===o?[o,v]:th(e,a,l)===l?[l,s]:th(l,o,a)===a?[a,i]:[]:[]},Ik=function(e,r,a,i,l){var s=[],o=i/2,v=l/2,c=r,d=a;s.push({x:c+o*e[0],y:d+v*e[1]});for(var g=1;g0){var x=Of(g,-v);y=Mf(x)}else y=g}else y=a;for(var E,S,T,C,_=0;_2){for(var b=[d[0],d[1]],x=Math.pow(b[0]-e,2)+Math.pow(b[1]-r,2),E=1;Ed&&(d=_)},get:function(C){return c[C]}},p=0;p0?j=G.edgesTo(P)[0]:j=P.edgesTo(G)[0];var q=i(j);P=P.id(),A[P]>A[N]+q&&(A[P]=A[N]+q,O.nodes.indexOf(P)<0?O.push(P):O.updateItem(P),M[P]=0,R[P]=[]),A[P]==A[N]+q&&(M[P]=M[P]+M[N],R[P].push(N))}else for(var U=0;U0;){for(var L=_.pop(),H=0;H0&&o.push(a[v]);o.length!==0&&l.push(i.collection(o))}return l},e5=function(e,r){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:a5,o=i,v,c,d=0;d=2?Ql(e,r,a,0,f2,n5):Ql(e,r,a,0,o2)},squaredEuclidean:function(e,r,a){return Ql(e,r,a,0,f2)},manhattan:function(e,r,a){return Ql(e,r,a,0,o2)},max:function(e,r,a){return Ql(e,r,a,-1/0,i5)}};Yu["squared-euclidean"]=Yu.squaredEuclidean;Yu.squaredeuclidean=Yu.squaredEuclidean;function jf(t,e,r,a,i,l){var s;return Vt(t)?s=t:s=Yu[t]||Yu.euclidean,e===0&&Vt(t)?s(i,l):s(e,r,a,i,l)}var u5=Sr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),o1=function(e){return u5(e)},Bf=function(e,r,a,i,l){var s=l!=="kMedoids",o=s?function(g){return a[g]}:function(g){return i[g](a)},v=function(p){return i[p](r)},c=a,d=r;return jf(e,i.length,o,v,c,d)},ah=function(e,r,a){for(var i=a.length,l=new Array(i),s=new Array(i),o=new Array(r),v=null,c=0;ca)return!1}return!0},o5=function(e,r,a){for(var i=0;io&&(o=r[c][d],v=d);l[v].push(e[c])}for(var g=0;g=l.threshold||l.mode==="dendrogram"&&e.length===1)return!1;var b=r[s],x=r[i[s]],E;l.mode==="dendrogram"?E={left:b,right:x,key:b.key}:E={value:b.value.concat(x.value),key:b.key},e[b.index]=E,e.splice(x.index,1),r[b.key]=E;for(var S=0;Sa[x.key][T.key]&&(v=a[x.key][T.key])):l.linkage==="max"?(v=a[b.key][T.key],a[b.key][T.key]0&&i.push(l);return i},p2=function(e,r,a){for(var i=[],l=0;lo&&(s=c,o=r[l*e+c])}s>0&&i.push(s)}for(var d=0;dc&&(v=d,c=g)}a[l]=s[v]}return i=p2(e,r,a),i},y2=function(e){for(var r=this.cy(),a=this.nodes(),i=E5(e),l={},s=0;s=N?(k=N,N=G,P=j):G>k&&(k=G);for(var q=0;q0?1:0;A[B%i.minIterations*o+H]=Q,L+=Q}if(L>0&&(B>=i.minIterations-1||B==i.maxIterations-1)){for(var F=0,K=0;K1||M>1)&&(o=!0),g[C]=[],T.outgoers().forEach(function(O){O.isEdge()&&g[C].push(O.id())})}else p[C]=[void 0,T.target().id()]}):s.forEach(function(T){var C=T.id();if(T.isNode()){var _=T.degree(!0);_%2&&(v?c?o=!0:c=C:v=C),g[C]=[],T.connectedEdges().forEach(function(R){return g[C].push(R.id())})}else p[C]=[T.source().id(),T.target().id()]});var y={found:!1,trail:void 0};if(o)return y;if(c&&v)if(l){if(d&&c!=d)return y;d=c}else{if(d&&c!=d&&v!=d)return y;d||(d=c)}else d||(d=s[0].id());var b=function(C){for(var _=C,R=[C],M,A,O;g[_].length;)M=g[_].shift(),A=p[M][0],O=p[M][1],_!=O?(g[O]=g[O].filter(function(B){return B!=M}),_=O):!l&&_!=A&&(g[A]=g[A].filter(function(B){return B!=M}),_=A),R.unshift(M),R.unshift(_);return R},x=[],E=[];for(E=b(d);E.length!=1;)g[E[0]].length==0?(x.unshift(s.getElementById(E.shift())),x.unshift(s.getElementById(E.shift()))):E=b(E.shift()).concat(E);x.unshift(s.getElementById(E.shift()));for(var S in g)if(g[S].length)return y;return y.found=!0,y.trail=this.spawn(x,!0),y}},nf=function(){var e=this,r={},a=0,i=0,l=[],s=[],o={},v=function(p,y){for(var b=s.length-1,x=[],E=e.spawn();s[b].x!=p||s[b].y!=y;)x.push(s.pop().edge),b--;x.push(s.pop().edge),x.forEach(function(S){var T=S.connectedNodes().intersection(e);E.merge(S),T.forEach(function(C){var _=C.id(),R=C.connectedEdges().intersection(e);E.merge(C),r[_].cutVertex?E.merge(R.filter(function(M){return M.isLoop()})):E.merge(R)})}),l.push(E)},c=function(p,y,b){p===b&&(i+=1),r[y]={id:a,low:a++,cutVertex:!1};var x=e.getElementById(y).connectedEdges().intersection(e);if(x.size()===0)l.push(e.spawn(e.getElementById(y)));else{var E,S,T,C;x.forEach(function(_){E=_.source().id(),S=_.target().id(),T=E===y?S:E,T!==b&&(C=_.id(),o[C]||(o[C]=!0,s.push({x:y,y:T,edge:_})),T in r?r[y].low=Math.min(r[y].low,r[T].id):(c(p,T,y),r[y].low=Math.min(r[y].low,r[T].low),r[y].id<=r[T].low&&(r[y].cutVertex=!0,v(y,T))))})}};e.forEach(function(g){if(g.isNode()){var p=g.id();p in r||(i=0,c(p,p),r[p].cutVertex=i>1)}});var d=Object.keys(r).filter(function(g){return r[g].cutVertex}).map(function(g){return e.getElementById(g)});return{cut:e.spawn(d),components:l}},D5={hopcroftTarjanBiconnected:nf,htbc:nf,htb:nf,hopcroftTarjanBiconnectedComponents:nf},uf=function(){var e=this,r={},a=0,i=[],l=[],s=e.spawn(e),o=function(c){l.push(c),r[c]={index:a,low:a++,explored:!1};var d=e.getElementById(c).connectedEdges().intersection(e);if(d.forEach(function(x){var E=x.target().id();E!==c&&(E in r||o(E),r[E].explored||(r[c].low=Math.min(r[c].low,r[E].low)))}),r[c].index===r[c].low){for(var g=e.spawn();;){var p=l.pop();if(g.merge(e.getElementById(p)),r[p].low=r[c].index,r[p].explored=!0,p===c)break}var y=g.edgesWith(g),b=g.merge(y);i.push(b),s=s.difference(b)}};return e.forEach(function(v){if(v.isNode()){var c=v.id();c in r||o(c)}}),{cut:s,components:i}},M5={tarjanStronglyConnected:uf,tsc:uf,tscc:uf,tarjanStronglyConnectedComponents:uf},lO={};[gs,uk,lk,ok,ck,dk,pk,Hk,Gu,Hu,zb,r5,g5,b5,_5,R5,D5,M5].forEach(function(t){He(lO,t)});var sO=0,oO=1,fO=2,Ca=function(e){if(!(this instanceof Ca))return new Ca(e);this.id="Thenable/1.0.7",this.state=sO,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))};Ca.prototype={fulfill:function(e){return m2(this,oO,"fulfillValue",e)},reject:function(e){return m2(this,fO,"rejectReason",e)},then:function(e,r){var a=this,i=new Ca;return a.onFulfilled.push(w2(e,i,"fulfill")),a.onRejected.push(w2(r,i,"reject")),cO(a),i.proxy}};var m2=function(e,r,a,i){return e.state===sO&&(e.state=r,e[a]=i,cO(e)),e},cO=function(e){e.state===oO?b2(e,"onFulfilled",e.fulfillValue):e.state===fO&&b2(e,"onRejected",e.rejectReason)},b2=function(e,r,a){if(e[r].length!==0){var i=e[r];e[r]=[];var l=function(){for(var o=0;o0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,i=a?r:[r],l=this._private.cy||this;if(!l.styleEnabled())return this;for(var s=0;s-1}return Ch=e,Ch}var _h,H2;function $5(){if(H2)return _h;H2=1;var t=Xf();function e(r,a){var i=this.__data__,l=t(i,r);return l<0?(++this.size,i.push([r,a])):i[l][1]=a,this}return _h=e,_h}var Ah,F2;function Z5(){if(F2)return Ah;F2=1;var t=j5(),e=Y5(),r=K5(),a=X5(),i=$5();function l(s){var o=-1,v=s==null?0:s.length;for(this.clear();++o-1&&a%1==0&&a0&&this.spawn(i).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){Rt(e)||(e=e.match(/\S+/g)||[]);for(var a=this,i=r===void 0,l=[],s=0,o=a.length;s0&&this.spawn(l).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};yf.className=yf.classNames=yf.classes;var ft={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:sr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};ft.variable="(?:[\\w-.]|(?:\\\\"+ft.metaChar+"))+";ft.className="(?:[\\w-]|(?:\\\\"+ft.metaChar+"))+";ft.value=ft.string+"|"+ft.number;ft.id=ft.variable;(function(){var t,e,r;for(t=ft.comparatorOp.split("|"),r=0;r=0)&&e!=="="&&(ft.comparatorOp+="|\\!"+e)})();var Ct=function(){return{checks:[]}},ze={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},Pb=[{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(t,e){return TL(t.selector,e.selector)}),A3=(function(){for(var t={},e,r=0;r0&&d.edgeCount>0)return yt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(d.edgeCount>1)return yt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;d.edgeCount===1&&yt("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},q3=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(d){return d??""},r=function(d){return Ve(d)?'"'+d+'"':e(d)},a=function(d){return" "+d+" "},i=function(d,g){var p=d.type,y=d.value;switch(p){case ze.GROUP:{var b=e(y);return b.substring(0,b.length-1)}case ze.DATA_COMPARE:{var x=d.field,E=d.operator;return"["+x+a(e(E))+r(y)+"]"}case ze.DATA_BOOL:{var S=d.operator,T=d.field;return"["+e(S)+T+"]"}case ze.DATA_EXIST:{var C=d.field;return"["+C+"]"}case ze.META_COMPARE:{var _=d.operator,R=d.field;return"[["+R+a(e(_))+r(y)+"]]"}case ze.STATE:return y;case ze.ID:return"#"+y;case ze.CLASS:return"."+y;case ze.PARENT:case ze.CHILD:return l(d.parent,g)+a(">")+l(d.child,g);case ze.ANCESTOR:case ze.DESCENDANT:return l(d.ancestor,g)+" "+l(d.descendant,g);case ze.COMPOUND_SPLIT:{var M=l(d.left,g),A=l(d.subject,g),O=l(d.right,g);return M+(M.length>0?" ":"")+A+O}case ze.TRUE:return""}},l=function(d,g){return d.checks.reduce(function(p,y,b){return p+(g===d&&b===0?"$":"")+i(y,g)},"")},s="",o=0;o1&&o=0&&(r=r.replace("!",""),g=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),d=!0),(l||o||d)&&(v=!l&&!s?"":""+e,c=""+a),d&&(e=v=v.toLowerCase(),a=c=c.toLowerCase()),r){case"*=":i=v.indexOf(c)>=0;break;case"$=":i=v.indexOf(c,v.length-c.length)>=0;break;case"^=":i=v.indexOf(c)===0;break;case"=":i=e===a;break;case">":p=!0,i=e>a;break;case">=":p=!0,i=e>=a;break;case"<":p=!0,i=e0;){var d=i.shift();e(d),l.add(d.id()),o&&a(i,l,d)}return t}function bO(t,e,r){if(r.isParent())for(var a=r._private.children,i=0;i1&&arguments[1]!==void 0?arguments[1]:!0;return d1(this,t,e,bO)};function wO(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Ku.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return d1(this,t,e,wO)};function V3(t,e,r){wO(t,e,r),bO(t,e,r)}Ku.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return d1(this,t,e,V3)};Ku.ancestors=Ku.parents;var ms,EO;ms=EO={data:pt.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:pt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:pt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:pt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:pt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:pt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ms.attr=ms.data;ms.removeAttr=ms.removeData;var G3=EO,Zf={};function tg(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,i=r[0],l=i._private.edges,s=0;se}),minIndegree:Mu("indegree",function(t,e){return te}),minOutdegree:Mu("outdegree",function(t,e){return te})});He(Zf,{totalDegree:function(e){for(var r=0,a=this.nodes(),i=0;i0,p=g;g&&(d=d[0]);var y=p?d.position():{x:0,y:0};r!==void 0?c.position(e,r+y[e]):l!==void 0&&c.position({x:l.x+y.x,y:l.y+y.y})}else{var b=a.position(),x=o?a.parent():null,E=x&&x.length>0,S=E;E&&(x=x[0]);var T=S?x.position():{x:0,y:0};return l={x:b.x-T.x,y:b.y-T.y},e===void 0?l:l[e]}else if(!s)return;return this}};Ta.modelPosition=Ta.point=Ta.position;Ta.modelPositions=Ta.points=Ta.positions;Ta.renderedPoint=Ta.renderedPosition;Ta.relativePoint=Ta.relativePosition;var H3=SO,Fu,li;Fu=li={};li.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),i=r.pan(),l=e.x1*a+i.x,s=e.x2*a+i.x,o=e.y1*a+i.y,v=e.y2*a+i.y;return{x1:l,x2:s,y1:o,y2:v,w:s-l,h:v-o}};li.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};li.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,v=s.children(),c=s.pstyle("compound-sizing-wrt-labels").value==="include",d={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},g=v.boundingBox({includeLabels:c,includeOverlays:!1,useCache:!1}),p=o.position;(g.w===0||g.h===0)&&(g={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},g.x1=p.x-g.w/2,g.x2=p.x+g.w/2,g.y1=p.y-g.h/2,g.y2=p.y+g.h/2);function y(B,z,N){var k=0,P=0,G=z+N;return B>0&&G>0&&(k=z/G*B,P=N/G*B),{biasDiff:k,biasComplementDiff:P}}function b(B,z,N,k){if(N.units==="%")switch(k){case"width":return B>0?N.pfValue*B:0;case"height":return z>0?N.pfValue*z:0;case"average":return B>0&&z>0?N.pfValue*(B+z)/2:0;case"min":return B>0&&z>0?B>z?N.pfValue*z:N.pfValue*B:0;case"max":return B>0&&z>0?B>z?N.pfValue*B:N.pfValue*z:0;default:return 0}else return N.units==="px"?N.pfValue:0}var x=d.width.left.value;d.width.left.units==="px"&&d.width.val>0&&(x=x*100/d.width.val);var E=d.width.right.value;d.width.right.units==="px"&&d.width.val>0&&(E=E*100/d.width.val);var S=d.height.top.value;d.height.top.units==="px"&&d.height.val>0&&(S=S*100/d.height.val);var T=d.height.bottom.value;d.height.bottom.units==="px"&&d.height.val>0&&(T=T*100/d.height.val);var C=y(d.width.val-g.w,x,E),_=C.biasDiff,R=C.biasComplementDiff,M=y(d.height.val-g.h,S,T),A=M.biasDiff,O=M.biasComplementDiff;o.autoPadding=b(g.w,g.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(g.w,d.width.val),p.x=(-_+g.x1+g.x2+R)/2,o.autoHeight=Math.max(g.h,d.height.val),p.y=(-A+g.y1+g.y2+O)/2}for(var a=0;ae.x2?i:e.x2,e.y1=ae.y2?l:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},jn=function(e,r){return r==null?e:xa(e,r.x1,r.y1,r.x2,r.y2)},Wl=function(e,r,a){return Hr(e,r,a)},lf=function(e,r,a){if(!r.cy().headless()){var i=r._private,l=i.rstyle,s=l.arrowWidth/2,o=r.pstyle(a+"-arrow-shape").value,v,c;if(o!=="none"){a==="source"?(v=l.srcX,c=l.srcY):a==="target"?(v=l.tgtX,c=l.tgtY):(v=l.midX,c=l.midY);var d=i.arrowBounds=i.arrowBounds||{},g=d[a]=d[a]||{};g.x1=v-s,g.y1=c-s,g.x2=v+s,g.y2=c+s,g.w=g.x2-g.x1,g.h=g.y2-g.y1,gf(g,1),xa(e,g.x1,g.y1,g.x2,g.y2)}}},rg=function(e,r,a){if(!r.cy().headless()){var i;a?i=a+"-":i="";var l=r._private,s=l.rstyle,o=r.pstyle(i+"label").strValue;if(o){var v=r.pstyle("text-halign"),c=r.pstyle("text-valign"),d=Wl(s,"labelWidth",a),g=Wl(s,"labelHeight",a),p=Wl(s,"labelX",a),y=Wl(s,"labelY",a),b=r.pstyle(i+"text-margin-x").pfValue,x=r.pstyle(i+"text-margin-y").pfValue,E=r.isEdge(),S=r.pstyle(i+"text-rotation"),T=r.pstyle("text-outline-width").pfValue,C=r.pstyle("text-border-width").pfValue,_=C/2,R=r.pstyle("text-background-padding").pfValue,M=2,A=g,O=d,B=O/2,z=A/2,N,k,P,G;if(E)N=p-B,k=p+B,P=y-z,G=y+z;else{switch(v.value){case"left":N=p-O,k=p;break;case"center":N=p-B,k=p+B;break;case"right":N=p,k=p+O;break}switch(c.value){case"top":P=y-A,G=y;break;case"center":P=y-z,G=y+z;break;case"bottom":P=y,G=y+A;break}}var j=b-Math.max(T,_)-R-M,q=b+Math.max(T,_)+R+M,U=x-Math.max(T,_)-R-M,Y=x+Math.max(T,_)+R+M;N+=j,k+=q,P+=U,G+=Y;var J=a||"main",Z=l.labelBounds,L=Z[J]=Z[J]||{};L.x1=N,L.y1=P,L.x2=k,L.y2=G,L.w=k-N,L.h=G-P,L.leftPad=j,L.rightPad=q,L.topPad=U,L.botPad=Y;var H=E&&S.strValue==="autorotate",Q=S.pfValue!=null&&S.pfValue!==0;if(H||Q){var F=H?Wl(l.rstyle,"labelAngle",a):S.pfValue,K=Math.cos(F),X=Math.sin(F),ee=(N+k)/2,he=(P+G)/2;if(!E){switch(v.value){case"left":ee=k;break;case"right":ee=N;break}switch(c.value){case"top":he=G;break;case"bottom":he=P;break}}var ue=function(Te,Pe){return Te=Te-ee,Pe=Pe-he,{x:Te*K-Pe*X+ee,y:Te*X+Pe*K+he}},te=ue(N,P),ne=ue(N,G),oe=ue(k,P),de=ue(k,G);N=Math.min(te.x,ne.x,oe.x,de.x),k=Math.max(te.x,ne.x,oe.x,de.x),P=Math.min(te.y,ne.y,oe.y,de.y),G=Math.max(te.y,ne.y,oe.y,de.y)}var Ee=J+"Rot",Se=Z[Ee]=Z[Ee]||{};Se.x1=N,Se.y1=P,Se.x2=k,Se.y2=G,Se.w=k-N,Se.h=G-P,xa(e,N,P,k,G),xa(l.labelBounds.all,N,P,k,G)}return e}},bT=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,l=r.pstyle("outline-offset").value,s=i+l;TO(e,r,a,s,"outside",s/2)}},TO=function(e,r,a,i,l,s){if(!(a===0||i<=0||l==="inside")){var o=r.cy(),v=o.renderer(),c=v.nodeShapes[v.getNodeShape(r)];if(c){var d=r.position(),g=d.x,p=d.y,y=r.width(),b=r.height();if(c.hasMiterBounds){l==="center"&&(i/=2);var x=c.miterBounds(g,p,y,b,i);jn(e,x)}else s!=null&&s>0&&pf(e,[s,s,s,s])}}},F3=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,l=r.pstyle("border-position").value;TO(e,r,a,i,l)}},j3=function(e,r){var a=e._private.cy,i=a.styleEnabled(),l=a.headless(),s=Or(),o=e._private,v=e.isNode(),c=e.isEdge(),d,g,p,y,b,x,E=o.rstyle,S=v&&i?e.pstyle("bounds-expansion").pfValue:[0],T=function(Ke){return Ke.pstyle("display").value!=="none"},C=!i||T(e)&&(!c||T(e.source())&&T(e.target()));if(C){var _=0,R=0;i&&r.includeOverlays&&(_=e.pstyle("overlay-opacity").value,_!==0&&(R=e.pstyle("overlay-padding").value));var M=0,A=0;i&&r.includeUnderlays&&(M=e.pstyle("underlay-opacity").value,M!==0&&(A=e.pstyle("underlay-padding").value));var O=Math.max(R,A),B=0,z=0;if(i&&(B=e.pstyle("width").pfValue,z=B/2),v&&r.includeNodes){var N=e.position();b=N.x,x=N.y;var k=e.outerWidth(),P=k/2,G=e.outerHeight(),j=G/2;d=b-P,g=b+P,p=x-j,y=x+j,xa(s,d,p,g,y),i&&bT(s,e),i&&r.includeOutlines&&!l&&bT(s,e),i&&F3(s,e)}else if(c&&r.includeEdges)if(i&&!l){var q=e.pstyle("curve-style").strValue;if(d=Math.min(E.srcX,E.midX,E.tgtX),g=Math.max(E.srcX,E.midX,E.tgtX),p=Math.min(E.srcY,E.midY,E.tgtY),y=Math.max(E.srcY,E.midY,E.tgtY),d-=z,g+=z,p-=z,y+=z,xa(s,d,p,g,y),q==="haystack"){var U=E.haystackPts;if(U&&U.length===2){if(d=U[0].x,p=U[0].y,g=U[1].x,y=U[1].y,d>g){var Y=d;d=g,g=Y}if(p>y){var J=p;p=y,y=J}xa(s,d-z,p-z,g+z,y+z)}}else if(q==="bezier"||q==="unbundled-bezier"||Yn(q,"segments")||Yn(q,"taxi")){var Z;switch(q){case"bezier":case"unbundled-bezier":Z=E.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":Z=E.linePts;break}if(Z!=null)for(var L=0;Lg){var ee=d;d=g,g=ee}if(p>y){var he=p;p=y,y=he}d-=z,g+=z,p-=z,y+=z,xa(s,d,p,g,y)}if(i&&r.includeEdges&&c&&(lf(s,e,"mid-source"),lf(s,e,"mid-target"),lf(s,e,"source"),lf(s,e,"target")),i){var ue=e.pstyle("ghost").value==="yes";if(ue){var te=e.pstyle("ghost-offset-x").pfValue,ne=e.pstyle("ghost-offset-y").pfValue;xa(s,s.x1+te,s.y1+ne,s.x2+te,s.y2+ne)}}var oe=o.bodyBounds=o.bodyBounds||{};n2(oe,s),pf(oe,S),gf(oe,1),i&&(d=s.x1,g=s.x2,p=s.y1,y=s.y2,xa(s,d-O,p-O,g+O,y+O));var de=o.overlayBounds=o.overlayBounds||{};n2(de,s),pf(de,S),gf(de,1);var Ee=o.labelBounds=o.labelBounds||{};Ee.all!=null?_k(Ee.all):Ee.all=Or(),i&&r.includeLabels&&(r.includeMainLabels&&rg(s,e,null),c&&(r.includeSourceLabels&&rg(s,e,"source"),r.includeTargetLabels&&rg(s,e,"target")))}return s.x1=ga(s.x1),s.y1=ga(s.y1),s.x2=ga(s.x2),s.y2=ga(s.y2),s.w=ga(s.x2-s.x1),s.h=ga(s.y2-s.y1),s.w>0&&s.h>0&&C&&(pf(s,S),gf(s,1)),s},CO=function(e){var r=0,a=function(s){return(s?1:0)<0&&arguments[0]!==void 0?arguments[0]:u4,e=arguments.length>1?arguments[1]:void 0,r=0;r=0;o--)s(o);return this};ai.removeAllListeners=function(){return this.removeListener("*")};ai.emit=ai.trigger=function(t,e,r){var a=this.listeners,i=a.length;return this.emitting++,Rt(e)||(e=[e]),l4(this,function(l,s){r!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],i=a.length);for(var o=function(){var d=a[v];if(d.type===s.type&&(!d.namespace||d.namespace===s.namespace||d.namespace===i4)&&l.eventMatches(l.context,d,s)){var g=[s];e!=null&&QL(g,e),l.beforeEmit(l.context,d,s),d.conf&&d.conf.one&&(l.listeners=l.listeners.filter(function(b){return b!==d}));var p=l.callbackContext(l.context,d,s),y=d.callback.apply(p,g);l.afterEmit(l.context,d,s),y===!1&&(s.stopPropagation(),s.preventDefault())}},v=0;v1&&!s){var o=this.length-1,v=this[o],c=v._private.data.id;this[o]=void 0,this[e]=v,l.set(c,{ele:v,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,i=r.map,l=i.get(a);if(!l)return this;var s=l.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Ve(e)){var a=e;e=r.mutableElements().filter(a)}for(var i=0;i=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],i=this,l=0;la&&(a=v,i=o)}return{value:a,ele:i}},min:function(e,r){for(var a=1/0,i,l=this,s=0;s=0&&l"u"?"undefined":or(Symbol))!=e&&or(Symbol.iterator)!=e;r&&(qf[Symbol.iterator]=function(){var a=this,i={value:void 0,done:!1},l=0,s=this.length;return BM({next:function(){return l1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],i=a.cy();if(i.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,i.style().apply(a));var l=a._private.style[e];return l??(r?i.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var i=!1,l=a.style();if(ct(e)){var s=e;l.applyBypass(this,s,i),this.emitAndNotify("style")}else if(Ve(e))if(r===void 0){var o=this[0];return o?l.getStylePropertyValue(o,e):void 0}else l.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var v=this[0];return v?l.getRawStyle(v):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,i=r.style(),l=this;if(e===void 0)for(var s=0;s0&&e.push(d[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});Cr.neighbourhood=Cr.neighborhood;Cr.closedNeighbourhood=Cr.closedNeighborhood;Cr.openNeighbourhood=Cr.openNeighborhood;He(Cr,{source:pa(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:pa(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:MT({attr:"source"}),targets:MT({attr:"target"})});function MT(t){return function(r){for(var a=[],i=0;i0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Cr.componentsOf=Cr.components;var Er=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Pt("A collection must have a reference to the core");return}var l=new on,s=!1;if(!r)r=[];else if(r.length>0&&ct(r[0])&&!Ts(r[0])){s=!0;for(var o=[],v=new Xu,c=0,d=r.length;c0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),i=a._private,l=[],s=[],o,v=0,c=r.length;v0){for(var J=o.length===r.length?r:new Er(a,o),Z=0;Z0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],i={},l=r._private.cy;function s(G){for(var j=G._private.edges,q=0;q0&&(t?N.emitAndNotify("remove"):e&&N.emit("remove"));for(var k=0;k0?k=G:N=G;while(Math.abs(P)>s&&++j=l?T(z,j):q===0?j:_(z,N,N+c)}var M=!1;function A(){M=!0,(t!==e||r!==a)&&C()}var O=function(N){return M||A(),t===e&&r===a?N:N===0?0:N===1?1:E(R(N),e,a)};O.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var B="generateBezier("+[t,e,r,a]+")";return O.toString=function(){return B},O}var m4=(function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,i,l){var s={x:a.x+l.dx*i,v:a.v+l.dv*i,tension:a.tension,friction:a.friction};return{dx:s.v,dv:t(s)}}function r(a,i){var l={dx:a.v,dv:t(a)},s=e(a,i*.5,l),o=e(a,i*.5,s),v=e(a,i,o),c=1/6*(l.dx+2*(s.dx+o.dx)+v.dx),d=1/6*(l.dv+2*(s.dv+o.dv)+v.dv);return a.x=a.x+c*i,a.v=a.v+d*i,a}return function a(i,l,s){var o={x:-1,v:0,tension:null,friction:null},v=[0],c=0,d=1/1e4,g=16/1e3,p,y,b;for(i=parseFloat(i)||500,l=parseFloat(l)||20,s=s||null,o.tension=i,o.friction=l,p=s!==null,p?(c=a(i,l),y=c/s*g):y=g;b=r(b||o,y),v.push(1+b.x),c+=16,Math.abs(b.x)>d&&Math.abs(b.v)>d;);return p?function(x){return v[x*(v.length-1)|0]}:c}})(),Dt=function(e,r,a,i){var l=y4(e,r,a,i);return function(s,o,v){return s+(o-s)*l(v)}},bf={linear:function(e,r,a){return e+(r-e)*a},ease:Dt(.25,.1,.25,1),"ease-in":Dt(.42,0,1,1),"ease-out":Dt(0,0,.58,1),"ease-in-out":Dt(.42,0,.58,1),"ease-in-sine":Dt(.47,0,.745,.715),"ease-out-sine":Dt(.39,.575,.565,1),"ease-in-out-sine":Dt(.445,.05,.55,.95),"ease-in-quad":Dt(.55,.085,.68,.53),"ease-out-quad":Dt(.25,.46,.45,.94),"ease-in-out-quad":Dt(.455,.03,.515,.955),"ease-in-cubic":Dt(.55,.055,.675,.19),"ease-out-cubic":Dt(.215,.61,.355,1),"ease-in-out-cubic":Dt(.645,.045,.355,1),"ease-in-quart":Dt(.895,.03,.685,.22),"ease-out-quart":Dt(.165,.84,.44,1),"ease-in-out-quart":Dt(.77,0,.175,1),"ease-in-quint":Dt(.755,.05,.855,.06),"ease-out-quint":Dt(.23,1,.32,1),"ease-in-out-quint":Dt(.86,0,.07,1),"ease-in-expo":Dt(.95,.05,.795,.035),"ease-out-expo":Dt(.19,1,.22,1),"ease-in-out-expo":Dt(1,0,0,1),"ease-in-circ":Dt(.6,.04,.98,.335),"ease-out-circ":Dt(.075,.82,.165,1),"ease-in-out-circ":Dt(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return bf.linear;var i=m4(e,r,a);return function(l,s,o){return l+(s-l)*i(o)}},"cubic-bezier":Dt};function qT(t,e,r,a,i){if(a===1||e===r)return r;var l=i(e,r,a);return t==null||((t.roundValue||t.color)&&(l=Math.round(l)),t.min!==void 0&&(l=Math.max(l,t.min)),t.max!==void 0&&(l=Math.min(l,t.max))),l}function zT(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Ou(t,e,r,a,i){var l=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var s=zT(t,i),o=zT(e,i);if(Ce(s)&&Ce(o))return qT(l,s,o,r,a);if(Rt(s)&&Rt(o)){for(var v=[],c=0;c0?(y==="spring"&&b.push(s.duration),s.easingImpl=bf[y].apply(null,b)):s.easingImpl=bf[y]}var x=s.easingImpl,E;if(s.duration===0?E=1:E=(r-v)/s.duration,s.applying&&(E=s.progress),E<0?E=0:E>1&&(E=1),s.delay==null){var S=s.startPosition,T=s.position;if(T&&i&&!t.locked()){var C={};es(S.x,T.x)&&(C.x=Ou(S.x,T.x,E,x)),es(S.y,T.y)&&(C.y=Ou(S.y,T.y,E,x)),t.position(C)}var _=s.startPan,R=s.pan,M=l.pan,A=R!=null&&a;A&&(es(_.x,R.x)&&(M.x=Ou(_.x,R.x,E,x)),es(_.y,R.y)&&(M.y=Ou(_.y,R.y,E,x)),t.emit("pan"));var O=s.startZoom,B=s.zoom,z=B!=null&&a;z&&(es(O,B)&&(l.zoom=ps(l.minZoom,Ou(O,B,E,x),l.maxZoom)),t.emit("zoom")),(A||z)&&t.emit("viewport");var N=s.style;if(N&&N.length>0&&i){for(var k=0;k=0;A--){var O=M[A];O()}M.splice(0,M.length)},T=y.length-1;T>=0;T--){var C=y[T],_=C._private;if(_.stopped){y.splice(T,1),_.hooked=!1,_.playing=!1,_.started=!1,S(_.frames);continue}!_.playing&&!_.applying||(_.playing&&_.applying&&(_.applying=!1),_.started||w4(d,C,t),b4(d,C,t,g),_.applying&&(_.applying=!1),S(_.frames),_.step!=null&&_.step(t),C.completed()&&(y.splice(T,1),_.hooked=!1,_.playing=!1,_.started=!1,S(_.completes)),x=!0)}return!g&&y.length===0&&b.length===0&&a.push(d),x}for(var l=!1,s=0;s0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var E4={animate:pt.animate(),animation:pt.animation(),animated:pt.animated(),clearQueue:pt.clearQueue(),delay:pt.delay(),delayAnimation:pt.delayAnimation(),stop:pt.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&Rf(function(l){NT(l,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(l,s){NT(s,e)},a.beforeRenderPriorities.animations):r()}},S4={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var i=r.qualifier;return i!=null?e!==a.target&&Ts(a.target)&&i.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},ff=function(e){return Ve(e)?new ti(e):e},LO={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Qf(S4,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,ff(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,ff(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,ff(r),a),this},once:function(e,r,a){return this.emitter().one(e,ff(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};pt.eventAliasesOn(LO);var Ub={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};Ub.jpeg=Ub.jpg;var wf={layout:function(e){var r=this;if(e==null){Pt("Layout options must be specified to make a layout");return}if(e.name==null){Pt("A `name` must be specified to make a layout");return}var a=e.name,i=r.extension("layout",a);if(i==null){Pt("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var l;Ve(e.eles)?l=r.$(e.eles):l=e.eles!=null?e.eles:r.$();var s=new i(He({},e,{cy:r,eles:l}));return s}};wf.createLayout=wf.makeLayout=wf.layout;var x4={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var i=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&i.merge(r);return}if(a.notificationsEnabled){var l=this.renderer();this.destroyed()||!l||l.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.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 r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var i=e.batchNotifications[a];i.empty()?r.notify(a):r.notify(a,i)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),i=0;i0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var i=a._private;i.rscratch={},i.rstyle={},i.animation.current=[],i.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Vb.invalidateDimensions=Vb.resize;var Ef={collection:function(e,r){return Ve(e)?this.$(e):aa(e)?e.collection():Rt(e)?(r||(r={}),new Er(this,e,r.unique,r.removed)):new Er(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};Ef.elements=Ef.filter=Ef.$;var gr={},fs="t",C4="f";gr.apply=function(t){for(var e=this,r=e._private,a=r.cy,i=a.collection(),l=0;l0;if(p||g&&y){var b=void 0;p&&y||p?b=c.properties:y&&(b=c.mappedProperties);for(var x=0;x1&&(_=1),o.color){var M=a.valueMin[0],A=a.valueMax[0],O=a.valueMin[1],B=a.valueMax[1],z=a.valueMin[2],N=a.valueMax[2],k=a.valueMin[3]==null?1:a.valueMin[3],P=a.valueMax[3]==null?1:a.valueMax[3],G=[Math.round(M+(A-M)*_),Math.round(O+(B-O)*_),Math.round(z+(N-z)*_),Math.round(k+(P-k)*_)];l={bypass:a.bypass,name:a.name,value:G,strValue:"rgb("+G[0]+", "+G[1]+", "+G[2]+")"}}else if(o.number){var j=a.valueMin+(a.valueMax-a.valueMin)*_;l=this.parse(a.name,j,a.bypass,p)}else return!1;if(!l)return x(),!1;l.mapping=a,a=l;break}case s.data:{for(var q=a.field.split("."),U=g.data,Y=0;Y0&&l>0){for(var o={},v=!1,c=0;c0?t.delayAnimation(s).play().promise().then(C):C()}).then(function(){return t.animation({style:o,duration:l,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,i),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,i),t.emitAndNotify("style"),a.transitioning=!1)};gr.checkTrigger=function(t,e,r,a,i,l){var s=this.properties[e],o=i(s);t.removed()||o!=null&&o(r,a,t)&&l(s)};gr.checkZOrderTrigger=function(t,e,r,a){var i=this;this.checkTrigger(t,e,r,a,function(l){return l.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};gr.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};gr.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(l){l.dirtyBoundingBoxCache()})})};gr.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(l){l.dirtyBoundingBoxCache()})})};gr.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var Os={};Os.applyBypass=function(t,e,r,a){var i=this,l=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;oi.length?a=a.substr(i.length):a=""}function v(){l.length>s.length?l=l.substr(s.length):l=""}for(;;){var c=a.match(/^\s*$/);if(c)break;var d=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){yt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}i=d[0];var g=d[1];if(g!=="core"){var p=new ti(g);if(p.invalid){yt("Skipping parsing of block: Invalid selector found in string stylesheet: "+g),o();continue}}var y=d[2],b=!1;l=y;for(var x=[];;){var E=l.match(/^\s*$/);if(E)break;var S=l.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!S){yt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+y),b=!0;break}s=S[0];var T=S[1],C=S[2],_=e.properties[T];if(!_){yt("Skipping property: Invalid property name in: "+s),v();continue}var R=r.parse(T,C);if(!R){yt("Skipping property: Invalid property definition in: "+s),v();continue}x.push({name:T,val:C}),v()}if(b){o();break}r.selector(g);for(var M=0;M=7&&e[0]==="d"&&(d=new RegExp(o.data.regex).exec(e))){if(r)return!1;var p=o.data;return{name:t,value:d,strValue:""+e,mapped:p,field:d[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(g=new RegExp(o.mapData.regex).exec(e))){if(r||c.multiple)return!1;var y=o.mapData;if(!(c.color||c.number))return!1;var b=this.parse(t,g[4]);if(!b||b.mapped)return!1;var x=this.parse(t,g[5]);if(!x||x.mapped)return!1;if(b.pfValue===x.pfValue||b.strValue===x.strValue)return yt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+b.strValue+"`"),this.parse(t,b.strValue);if(c.color){var E=b.value,S=x.value,T=E[0]===S[0]&&E[1]===S[1]&&E[2]===S[2]&&(E[3]===S[3]||(E[3]==null||E[3]===1)&&(S[3]==null||S[3]===1));if(T)return!1}return{name:t,value:g,strValue:""+e,mapped:y,field:g[1],fieldMin:parseFloat(g[2]),fieldMax:parseFloat(g[3]),valueMin:b.value,valueMax:x.value,bypass:r}}}if(c.multiple&&a!=="multiple"){var C;if(v?C=e.split(/\s+/):Rt(e)?C=e:C=[e],c.evenMultiple&&C.length%2!==0)return null;for(var _=[],R=[],M=[],A="",O=!1,B=0;B0?" ":"")+z.strValue}return c.validate&&!c.validate(_,R)?null:c.singleEnum&&O?_.length===1&&Ve(_[0])?{name:t,value:_[0],strValue:_[0],bypass:r}:null:{name:t,value:_,pfValue:M,strValue:A,bypass:r,units:R}}var N=function(){for(var ue=0;uec.max||c.strictMax&&e===c.max))return null;var q={name:t,value:e,strValue:""+e+(k||""),units:k,bypass:r};return c.unitless||k!=="px"&&k!=="em"?q.pfValue=e:q.pfValue=k==="px"||!k?e:this.getEmSizeInPixels()*e,(k==="ms"||k==="s")&&(q.pfValue=k==="ms"?e:1e3*e),(k==="deg"||k==="rad")&&(q.pfValue=k==="rad"?e:Sk(e)),k==="%"&&(q.pfValue=e/100),q}else if(c.propList){var U=[],Y=""+e;if(Y!=="none"){for(var J=Y.split(/\s*,\s*|\s+/),Z=0;Z0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){v=Math.min((s-2*r)/a.w,(o-2*r)/a.h),v=v>this._private.maxZoom?this._private.maxZoom:v,v=v=a.minZoom&&(a.maxZoom=r),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 r=this._private,a=r.pan,i=r.zoom,l,s,o=!1;if(r.zoomingEnabled||(o=!0),Ce(e)?s=e:ct(e)&&(s=e.level,e.position!=null?l=Ff(e.position,i,a):e.renderedPosition!=null&&(l=e.renderedPosition),l!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=sr.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=v,l.push("zoom"))}if(i&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var c=e.pan;Ce(c.x)&&(r.pan.x=c.x,o=!1),Ce(c.y)&&(r.pan.y=c.y,o=!1),o||l.push("pan")}return l.length>0&&(l.push("viewport"),this.emit(l.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(Ve(e)){var a=e;e=this.mutableElements().filter(a)}else aa(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),l=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(l-r*(i.x1+i.x2))/2,y:(s-r*(i.y1+i.y2))/2};return o}}},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,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?(function(){var i=a.window().getComputedStyle(r),l=function(o){return parseFloat(i.getPropertyValue(o))};return{width:r.clientWidth-l("padding-left")-l("padding-right"),height:r.clientHeight-l("padding-top")-l("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,r=this._private.zoom,a=this.renderedExtent(),i={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Vi.centre=Vi.center;Vi.autolockNodes=Vi.autolock;Vi.autoungrabifyNodes=Vi.autoungrabify;var ws={data:pt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:pt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:pt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:pt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ws.attr=ws.data;ws.removeAttr=ws.removeData;var Es=function(e){var r=this;e=He({},e);var a=e.container;a&&!Af(a)&&Af(a[0])&&(a=a[0]);var i=a?a._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var l=i.readies=i.readies||[];a&&(a._cyreg=i),i.cy=r;var s=lr!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=He({name:s?"grid":"null"},o.layout),o.renderer=He({name:s?"canvas":"null"},o.renderer);var v=function(b,x,E){return x!==void 0?x:E!==void 0?E:b},c=this._private={container:a,ready:!1,options:o,elements:new Er(this),listeners:[],aniEles:new Er(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:v(!0,o.zoomingEnabled),userZoomingEnabled:v(!0,o.userZoomingEnabled),panningEnabled:v(!0,o.panningEnabled),userPanningEnabled:v(!0,o.userPanningEnabled),boxSelectionEnabled:v(!0,o.boxSelectionEnabled),autolock:v(!1,o.autolock,o.autolockNodes),autoungrabify:v(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:v(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:Ce(o.zoom)?o.zoom:1,pan:{x:ct(o.pan)&&Ce(o.pan.x)?o.pan.x:0,y:ct(o.pan)&&Ce(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:v(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var d=function(b,x){var E=b.some(pL);if(E)return $u.all(b).then(x);x(b)};c.styleEnabled&&r.setStyle([]);var g=He({},o,o.renderer);r.initRenderer(g);var p=function(b,x,E){r.notifications(!1);var S=r.mutableElements();S.length>0&&S.remove(),b!=null&&(ct(b)||Rt(b))&&r.add(b),r.one("layoutready",function(C){r.notifications(!0),r.emit(C),r.one("load",x),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",E),r.emit("done")});var T=He({},r._private.options.layout);T.eles=r.elements(),r.layout(T).run()};d([o.style,o.elements],function(y){var b=y[0],x=y[1];c.styleEnabled&&r.style().append(b),p(x,function(){r.startAnimationLoop(),c.ready=!0,Vt(o.ready)&&r.on("ready",o.ready);for(var E=0;E0,o=!!t.boundingBox,v=Or(o?t.boundingBox:structuredClone(e.extent())),c;if(aa(t.roots))c=t.roots;else if(Rt(t.roots)){for(var d=[],g=0;g0;){var G=P(),j=B(G,N);if(j)G.outgoers().filter(function(Ne){return Ne.isNode()&&r.has(Ne)}).forEach(k);else if(j===null){yt("Detected double maximal shift for node `"+G.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var q=0;if(t.avoidOverlap)for(var U=0;U0&&S[0].length<=3?Oe/2:0),et=2*Math.PI/S[Me].length*ke;return Me===0&&S[0].length===1&&(Xe=1),{x:oe.x+Xe*Math.cos(et),y:oe.y+Xe*Math.sin(et)}}else{var ut=S[Me].length,$e=Math.max(ut===1?0:o?(v.w-t.padding*2-de.w)/((t.grid?Se:ut)-1):(v.w-t.padding*2-de.w)/((t.grid?Se:ut)+1),q),at={x:oe.x+(ke+1-(ut+1)/2)*$e,y:oe.y+(Me+1-(K+1)/2)*Ee};return at}},Te={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Te).indexOf(t.direction)===-1&&Pt("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Te).join(", ")));var Pe=function(_e){return jL(Ke(_e),v,Te[t.direction])};return r.nodes().layoutPositions(this,t,Pe),this};var M4={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function PO(t){this.options=He({},M4,t)}PO.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,l=a.nodes().not(":parent");e.sort&&(l=l.sort(e.sort));for(var s=Or(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},v=e.sweep===void 0?2*Math.PI-2*Math.PI/l.length:e.sweep,c=v/Math.max(1,l.length-1),d,g=0,p=0;p1&&e.avoidOverlap){g*=1.75;var S=Math.cos(c)-Math.cos(0),T=Math.sin(c)-Math.sin(0),C=Math.sqrt(g*g/(S*S+T*T));d=Math.max(C,d)}var _=function(M,A){var O=e.startAngle+A*c*(i?1:-1),B=d*Math.cos(O),z=d*Math.sin(O),N={x:o.x+B,y:o.y+z};return N};return a.nodes().layoutPositions(this,e,_),this};var O4={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function IO(t){this.options=He({},O4,t)}IO.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,i=e.eles,l=i.nodes().not(":parent"),s=Or(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},v=[],c=0,d=0;d0){var R=Math.abs(T[0].value-_.value);R>=E&&(T=[],S.push(T))}T.push(_)}var M=c+e.minNodeSpacing;if(!e.avoidOverlap){var A=S.length>0&&S[0].length>1,O=Math.min(s.w,s.h)/2-M,B=O/(S.length+A?1:0);M=Math.min(M,B)}for(var z=0,N=0;N1&&e.avoidOverlap){var j=Math.cos(G)-Math.cos(0),q=Math.sin(G)-Math.sin(0),U=Math.sqrt(M*M/(j*j+q*q));z=Math.max(U,z)}k.r=z,z+=M}if(e.equidistant){for(var Y=0,J=0,Z=0;Z=t.numIter||(P4(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature=t.animationThreshold&&l(),Rf(d)}};d()}else{for(;c;)c=s(v),v++;PT(a,t),o()}return this};rc.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};rc.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var q4=function(e,r,a){for(var i=a.eles.edges(),l=a.eles.nodes(),s=Or(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:l.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},v=a.eles.components(),c={},d=0;d0){o.graphSet.push(O);for(var d=0;di.count?0:i.graph},UO=function(e,r,a,i){var l=i.graphSet[a];if(-10)var g=i.nodeOverlap*d,p=Math.sqrt(o*o+v*v),y=g*o/p,b=g*v/p;else var x=Nf(e,o,v),E=Nf(r,-1*o,-1*v),S=E.x-x.x,T=E.y-x.y,C=S*S+T*T,p=Math.sqrt(C),g=(e.nodeRepulsion+r.nodeRepulsion)/C,y=g*S/p,b=g*T/p;e.isLocked||(e.offsetX-=y,e.offsetY-=b),r.isLocked||(r.offsetX+=y,r.offsetY+=b)}},V4=function(e,r,a,i){if(a>0)var l=e.maxX-r.minX;else var l=r.maxX-e.minX;if(i>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return l>=0&&s>=0?Math.sqrt(l*l+s*s):0},Nf=function(e,r,a){var i=e.positionX,l=e.positionY,s=e.height||1,o=e.width||1,v=a/r,c=s/o,d={};return r===0&&0a?(d.x=i,d.y=l+s/2,d):0r&&-1*c<=v&&v<=c?(d.x=i-o/2,d.y=l-o*a/2/r,d):0=c)?(d.x=i+s*r/2/a,d.y=l+s/2,d):(0>a&&(v<=-1*c||v>=c)&&(d.x=i-s*r/2/a,d.y=l-s/2),d)},G4=function(e,r){for(var a=0;aa){var E=r.gravity*y/x,S=r.gravity*b/x;p.offsetX+=E,p.offsetY+=S}}}}},F4=function(e,r){var a=[],i=0,l=-1;for(a.push.apply(a,e.graphSet[0]),l+=e.graphSet[0].length;i<=l;){var s=a[i++],o=e.idToIndex[s],v=e.layoutNodes[o],c=v.children;if(0a)var l={x:a*e/i,y:a*r/i};else var l={x:e,y:r};return l},GO=function(e,r){var a=e.parentId;if(a!=null){var i=r.layoutNodes[r.idToIndex[a]],l=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,l=!0),(i.minX==null||e.minX-i.padLefti.maxY)&&(i.maxY=e.maxY+i.padBottom,l=!0),(i.minY==null||e.minY-i.padTopS&&(b+=E+r.componentSpacing,y=0,x=0,E=0)}}},K4={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function HO(t){this.options=He({},K4,t)}HO.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));var l=Or(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(l.h===0||l.w===0)a.nodes().layoutPositions(this,e,function(Q){return{x:l.x1,y:l.y1}});else{var s=i.size(),o=Math.sqrt(s*l.h/l.w),v=Math.round(o),c=Math.round(l.w/l.h*o),d=function(F){if(F==null)return Math.min(v,c);var K=Math.min(v,c);K==v?v=F:c=F},g=function(F){if(F==null)return Math.max(v,c);var K=Math.max(v,c);K==v?v=F:c=F},p=e.rows,y=e.cols!=null?e.cols:e.columns;if(p!=null&&y!=null)v=p,c=y;else if(p!=null&&y==null)v=p,c=Math.ceil(s/v);else if(p==null&&y!=null)c=y,v=Math.ceil(s/c);else if(c*v>s){var b=d(),x=g();(b-1)*x>=s?d(b-1):(x-1)*b>=s&&g(x-1)}else for(;c*v=s?g(S+1):d(E+1)}var T=l.w/c,C=l.h/v;if(e.condense&&(T=0,C=0),e.avoidOverlap)for(var _=0;_=c&&(j=0,G++)},U={},Y=0;Y(j=Lk(t,e,q[U],q[U+1],q[U+2],q[U+3])))return E(A,j),!0}else if(B.edgeType==="bezier"||B.edgeType==="multibezier"||B.edgeType==="self"||B.edgeType==="compound"){for(var q=B.allpts,U=0;U+5(j=Nk(t,e,q[U],q[U+1],q[U+2],q[U+3],q[U+4],q[U+5])))return E(A,j),!0}for(var Y=Y||O.source,J=J||O.target,Z=i.getArrowWidth(z,N),L=[{name:"source",x:B.arrowStartX,y:B.arrowStartY,angle:B.srcArrowAngle},{name:"target",x:B.arrowEndX,y:B.arrowEndY,angle:B.tgtArrowAngle},{name:"mid-source",x:B.midX,y:B.midY,angle:B.midsrcArrowAngle},{name:"mid-target",x:B.midX,y:B.midY,angle:B.midtgtArrowAngle}],U=0;U0&&(S(Y),S(J))}function C(A,O,B){return Hr(A,O,B)}function _(A,O){var B=A._private,z=p,N;O?N=O+"-":N="",A.boundingBox();var k=B.labelBounds[O||"main"],P=A.pstyle(N+"label").value,G=A.pstyle("text-events").strValue==="yes";if(!(!G||!P)){var j=C(B.rscratch,"labelX",O),q=C(B.rscratch,"labelY",O),U=C(B.rscratch,"labelAngle",O),Y=A.pstyle(N+"text-margin-x").pfValue,J=A.pstyle(N+"text-margin-y").pfValue,Z=k.x1-z-Y,L=k.x2+z-Y,H=k.y1-z-J,Q=k.y2+z-J;if(U){var F=Math.cos(U),K=Math.sin(U),X=function(de,Ee){return de=de-j,Ee=Ee-q,{x:de*F-Ee*K+j,y:de*K+Ee*F+q}},ee=X(Z,H),he=X(Z,Q),ue=X(L,H),te=X(L,Q),ne=[ee.x+Y,ee.y+J,ue.x+Y,ue.y+J,te.x+Y,te.y+J,he.x+Y,he.y+J];if(Fr(t,e,ne))return E(A),!0}else if(Kn(k,t,e))return E(A),!0}}for(var R=s.length-1;R>=0;R--){var M=s[R];M.isNode()?S(M)||_(M):T(M)||_(M)||_(M,"source")||_(M,"target")}return o};Hi.getAllInBox=function(t,e,r,a){var i=this.getCachedZSortedEles().interactive,l=this.cy.zoom(),s=2/l,o=[],v=Math.min(t,r),c=Math.max(t,r),d=Math.min(e,a),g=Math.max(e,a);t=v,r=c,e=d,a=g;var p=Or({x1:t,y1:e,x2:r,y2:a}),y=[{x:p.x1,y:p.y1},{x:p.x2,y:p.y1},{x:p.x2,y:p.y2},{x:p.x1,y:p.y2}],b=[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]],[y[3],y[0]]];function x(de,Ee,Se){return Hr(de,Ee,Se)}function E(de,Ee){var Se=de._private,Ke=s,Te="";de.boundingBox();var Pe=Se.labelBounds.main;if(!Pe)return null;var Ne=x(Se.rscratch,"labelX",Ee),_e=x(Se.rscratch,"labelY",Ee),qe=x(Se.rscratch,"labelAngle",Ee),Me=de.pstyle(Te+"text-margin-x").pfValue,ke=de.pstyle(Te+"text-margin-y").pfValue,Oe=Pe.x1-Ke-Me,Xe=Pe.x2+Ke-Me,et=Pe.y1-Ke-ke,ut=Pe.y2+Ke-ke;if(qe){var $e=Math.cos(qe),at=Math.sin(qe),ye=function(re,ie){return re=re-Ne,ie=ie-_e,{x:re*$e-ie*at+Ne,y:re*at+ie*$e+_e}};return[ye(Oe,et),ye(Xe,et),ye(Xe,ut),ye(Oe,ut)]}else return[{x:Oe,y:et},{x:Xe,y:et},{x:Xe,y:ut},{x:Oe,y:ut}]}function S(de,Ee,Se,Ke){function Te(Pe,Ne,_e){return(_e.y-Pe.y)*(Ne.x-Pe.x)>(Ne.y-Pe.y)*(_e.x-Pe.x)}return Te(de,Se,Ke)!==Te(Ee,Se,Ke)&&Te(de,Ee,Se)!==Te(de,Ee,Ke)}for(var T=0;T0?-(Math.PI-e.ang):Math.PI+e.ang},J4=function(e,r,a,i,l){if(e!==HT?FT(r,e,La):W4(ha,La),FT(r,a,ha),VT=La.nx*ha.ny-La.ny*ha.nx,GT=La.nx*ha.nx-La.ny*-ha.ny,ln=Math.asin(Math.max(-1,Math.min(1,VT))),Math.abs(ln)<1e-6){Gb=r.x,Hb=r.y,zi=qu=0;return}Li=1,Sf=!1,GT<0?ln<0?ln=Math.PI+ln:(ln=Math.PI-ln,Li=-1,Sf=!0):ln>0&&(Li=-1,Sf=!0),r.radius!==void 0?qu=r.radius:qu=i,Oi=ln/2,cf=Math.min(La.len/2,ha.len/2),l?(za=Math.abs(Math.cos(Oi)*qu/Math.sin(Oi)),za>cf?(za=cf,zi=Math.abs(za*Math.sin(Oi)/Math.cos(Oi))):zi=qu):(za=Math.min(cf,qu),zi=Math.abs(za*Math.sin(Oi)/Math.cos(Oi))),Fb=r.x+ha.nx*za,jb=r.y+ha.ny*za,Gb=Fb-ha.ny*zi*Li,Hb=jb+ha.nx*zi*Li,KO=r.x+La.nx*za,XO=r.y+La.ny*za,HT=r};function $O(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function b1(t,e,r,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===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}:(J4(t,e,r,a,i),{cx:Gb,cy:Hb,radius:zi,startX:KO,startY:XO,stopX:Fb,stopY:jb,startAngle:La.ang+Math.PI/2*Li,endAngle:ha.ang-Math.PI/2*Li,counterClockwise:Sf})}var Ss=.01,eP=Math.sqrt(2*Ss),Ar={};Ar.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,i=e.vectorNormInverse,l,s=t.pstyle("source-endpoint"),o=t.pstyle("target-endpoint"),v=s.units!=null&&o.units!=null,c=function(R,M,A,O){var B=O-M,z=A-R,N=Math.sqrt(z*z+B*B);return{x:-B/N,y:z/N}},d=t.pstyle("edge-distances").value;switch(d){case"node-position":l=r;break;case"intersection":l=a;break;case"endpoints":{if(v){var g=this.manualEndptToPx(t.source()[0],s),p=nr(g,2),y=p[0],b=p[1],x=this.manualEndptToPx(t.target()[0],o),E=nr(x,2),S=E[0],T=E[1],C={x1:y,y1:b,x2:S,y2:T};i=c(y,b,S,T),l=C}else yt("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),l=a;break}}return{midptPts:l,vectorNormInverse:i}};Ar.findHaystackPoints=function(t){for(var e=0;e0?Math.max(ie-fe,0):Math.min(ie+fe,0)},P=k(z,O),G=k(N,B),j=!1;T===c?S=Math.abs(P)>Math.abs(G)?i:a:T===v||T===o?(S=a,j=!0):(T===l||T===s)&&(S=i,j=!0);var q=S===a,U=q?G:P,Y=q?N:z,J=u1(Y),Z=!1;!(j&&(_||M))&&(T===o&&Y<0||T===v&&Y>0||T===l&&Y>0||T===s&&Y<0)&&(J*=-1,U=J*Math.abs(U),Z=!0);var L;if(_){var H=R<0?1+R:R;L=H*U}else{var Q=R<0?U:0;L=Q+R*J}var F=function(ie){return Math.abs(ie)=Math.abs(U)},K=F(L),X=F(Math.abs(U)-Math.abs(L)),ee=K||X;if(ee&&!Z)if(q){var he=Math.abs(Y)<=p/2,ue=Math.abs(z)<=y/2;if(he){var te=(d.x1+d.x2)/2,ne=d.y1,oe=d.y2;r.segpts=[te,ne,te,oe]}else if(ue){var de=(d.y1+d.y2)/2,Ee=d.x1,Se=d.x2;r.segpts=[Ee,de,Se,de]}else r.segpts=[d.x1,d.y2]}else{var Ke=Math.abs(Y)<=g/2,Te=Math.abs(N)<=b/2;if(Ke){var Pe=(d.y1+d.y2)/2,Ne=d.x1,_e=d.x2;r.segpts=[Ne,Pe,_e,Pe]}else if(Te){var qe=(d.x1+d.x2)/2,Me=d.y1,ke=d.y2;r.segpts=[qe,Me,qe,ke]}else r.segpts=[d.x2,d.y1]}else if(q){var Oe=d.y1+L+(E?p/2*J:0),Xe=d.x1,et=d.x2;r.segpts=[Xe,Oe,et,Oe]}else{var ut=d.x1+L+(E?g/2*J:0),$e=d.y1,at=d.y2;r.segpts=[ut,$e,ut,at]}if(r.isRound){var ye=t.pstyle("taxi-radius").value,V=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ye),r.isArcRadius=new Array(r.segpts.length/2).fill(V)}};Ar.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,i=e.tgtPos,l=e.srcW,s=e.srcH,o=e.tgtW,v=e.tgtH,c=e.srcShape,d=e.tgtShape,g=e.srcCornerRadius,p=e.tgtCornerRadius,y=e.srcRs,b=e.tgtRs,x=!Ce(r.startX)||!Ce(r.startY),E=!Ce(r.arrowStartX)||!Ce(r.arrowStartY),S=!Ce(r.endX)||!Ce(r.endY),T=!Ce(r.arrowEndX)||!Ce(r.arrowEndY),C=3,_=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,R=C*_,M=Ii({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),A=MY.poolIndex()){var J=U;U=Y,Y=J}var Z=P.srcPos=U.position(),L=P.tgtPos=Y.position(),H=P.srcW=U.outerWidth(),Q=P.srcH=U.outerHeight(),F=P.tgtW=Y.outerWidth(),K=P.tgtH=Y.outerHeight(),X=P.srcShape=r.nodeShapes[e.getNodeShape(U)],ee=P.tgtShape=r.nodeShapes[e.getNodeShape(Y)],he=P.srcCornerRadius=U.pstyle("corner-radius").value==="auto"?"auto":U.pstyle("corner-radius").pfValue,ue=P.tgtCornerRadius=Y.pstyle("corner-radius").value==="auto"?"auto":Y.pstyle("corner-radius").pfValue,te=P.tgtRs=Y._private.rscratch,ne=P.srcRs=U._private.rscratch;P.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var oe=0;oe=eP||(et=Math.sqrt(Math.max(Xe*Xe,Ss)+Math.max(Oe*Oe,Ss)));var ut=P.vector={x:Xe,y:Oe},$e=P.vectorNorm={x:ut.x/et,y:ut.y/et},at={x:-$e.y,y:$e.x};P.nodesOverlap=!Ce(et)||ee.checkPoint(Pe[0],Pe[1],0,F,K,L.x,L.y,ue,te)||X.checkPoint(_e[0],_e[1],0,H,Q,Z.x,Z.y,he,ne),P.vectorNormInverse=at,G={nodesOverlap:P.nodesOverlap,dirCounts:P.dirCounts,calculatedIntersection:!0,hasBezier:P.hasBezier,hasUnbundled:P.hasUnbundled,eles:P.eles,srcPos:L,srcRs:te,tgtPos:Z,tgtRs:ne,srcW:F,srcH:K,tgtW:H,tgtH:Q,srcIntn:qe,tgtIntn:Ne,srcShape:ee,tgtShape:X,posPts:{x1:ke.x2,y1:ke.y2,x2:ke.x1,y2:ke.y1},intersectionPts:{x1:Me.x2,y1:Me.y2,x2:Me.x1,y2:Me.y1},vector:{x:-ut.x,y:-ut.y},vectorNorm:{x:-$e.x,y:-$e.y},vectorNormInverse:{x:-at.x,y:-at.y}}}var ye=Te?G:P;Ee.nodesOverlap=ye.nodesOverlap,Ee.srcIntn=ye.srcIntn,Ee.tgtIntn=ye.tgtIntn,Ee.isRound=Se.startsWith("round"),i&&(U.isParent()||U.isChild()||Y.isParent()||Y.isChild())&&(U.parents().anySame(Y)||Y.parents().anySame(U)||U.same(Y)&&U.isParent())?e.findCompoundLoopPoints(de,ye,oe,Ke):U===Y?e.findLoopPoints(de,ye,oe,Ke):Se.endsWith("segments")?e.findSegmentsPoints(de,ye):Se.endsWith("taxi")?e.findTaxiPoints(de,ye):Se==="straight"||!Ke&&P.eles.length%2===1&&oe===Math.floor(P.eles.length/2)?e.findStraightEdgePoints(de):e.findBezierPoints(de,ye,oe,Ke,Te),e.findEndpoints(de),e.tryToCorrectInvalidPoints(de,ye),e.checkForInvalidEdgeWarning(de),e.storeAllpts(de),e.storeEdgeProjections(de),e.calculateArrowAngles(de),e.recalculateEdgeLabelProjections(de),e.calculateLabelAngles(de)}},A=0;A0){var Pe=c,Ne=qi(Pe,Pu(s)),_e=qi(Pe,Pu(Te)),qe=Ne;if(_e2){var Me=qi(Pe,{x:Te[2],y:Te[3]});Me0){var ge=d,Re=qi(ge,Pu(s)),we=qi(ge,Pu(fe)),Ae=Re;if(we2){var Be=qi(ge,{x:fe[2],y:fe[3]});Be=b||A){E={cp:_,segment:M};break}}if(E)break}var O=E.cp,B=E.segment,z=(b-S)/B.length,N=B.t1-B.t0,k=y?B.t0+N*z:B.t1-N*z;k=ps(0,k,1),e=Vu(O.p0,O.p1,O.p2,k),p=rP(O.p0,O.p1,O.p2,k);break}case"straight":case"segments":case"haystack":{for(var P=0,G,j,q,U,Y=a.allpts.length,J=0;J+3=b));J+=2);var Z=b-j,L=Z/G;L=ps(0,L,1),e=Tk(q,U,L),p=WO(q,U);break}}s("labelX",g,e.x),s("labelY",g,e.y),s("labelAutoAngle",g,p)}};c("source"),c("target"),this.applyLabelDimensions(t)}};Ia.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Ia.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),i=Pi(a,t._private.labelDimsKey);if(Hr(r.rscratch,"prefixedLabelDimsKey",e)!==i){sn(r.rscratch,"prefixedLabelDimsKey",e,i);var l=this.calculateLabelDimensions(t,a),s=t.pstyle("line-height").pfValue,o=t.pstyle("text-wrap").strValue,v=Hr(r.rscratch,"labelWrapCachedLines",e)||[],c=o!=="wrap"?1:Math.max(v.length,1),d=l.height/c,g=d*s,p=l.width,y=l.height+(c-1)*(s-1)*d;sn(r.rstyle,"labelWidth",e,p),sn(r.rscratch,"labelWidth",e,p),sn(r.rstyle,"labelHeight",e,y),sn(r.rscratch,"labelHeight",e,y),sn(r.rscratch,"labelLineHeight",e,g)}};Ia.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",i=t.pstyle(a+"label").strValue,l=t.pstyle("text-transform").value,s=function(Q,F){return F?(sn(r.rscratch,Q,e,F),F):Hr(r.rscratch,Q,e)};if(!i)return"";l=="none"||(l=="uppercase"?i=i.toUpperCase():l=="lowercase"&&(i=i.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var v=s("labelKey");if(v!=null&&s("labelWrapKey")===v)return s("labelWrapCachedText");for(var c="​",d=i.split(` +`),g=t.pstyle("text-max-width").pfValue,p=t.pstyle("text-overflow-wrap").value,y=p==="anywhere",b=[],x=/[\s\u200b]+|$/g,E=0;Eg){var R=S.matchAll(x),M="",A=0,O=jr(R),B;try{for(O.s();!(B=O.n()).done;){var z=B.value,N=z[0],k=S.substring(A,z.index);A=z.index+N.length;var P=M.length===0?k:M+k+N,G=this.calculateLabelDimensions(t,P),j=G.width;j<=g?M+=k+N:(M&&b.push(M),M=k+N)}}catch(H){O.e(H)}finally{O.f()}M.match(/^[\s\u200b]+$/)||b.push(M)}else b.push(S)}s("labelWrapCachedLines",b),i=s("labelWrapCachedText",b.join(` +`)),s("labelWrapKey",v)}else if(o==="ellipsis"){var q=t.pstyle("text-max-width").pfValue,U="",Y="…",J=!1;if(this.calculateLabelDimensions(t,i).widthq)break;U+=i[Z],Z===i.length-1&&(J=!0)}return J||(U+=Y),U}return i};Ia.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Ia.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),i=a.document,l=0,s=t.pstyle("font-style").strValue,o=t.pstyle("font-size").pfValue,v=t.pstyle("font-family").strValue,c=t.pstyle("font-weight").strValue,d=this.labelCalcCanvas,g=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=i.createElement("canvas"),g=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}g.font="".concat(s," ").concat(c," ").concat(o,"px ").concat(v);for(var y=0,b=0,x=e.split(` +`),E=0;E1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var v=0;v=t.desktopTapThreshold2}var Qt=l(V);Zt&&(t.hoverData.tapholdCancelled=!0);var Kr=function(){var zr=t.hoverData.dragDelta=t.hoverData.dragDelta||[];zr.length===0?(zr.push(Qe[0]),zr.push(Qe[1])):(zr[0]+=Qe[0],zr[1]+=Qe[1])};ie=!0,i(je,["mousemove","vmousemove","tapdrag"],V,{x:we[0],y:we[1]});var _t=function(zr){return{originalEvent:V,type:zr,position:{x:we[0],y:we[1]}}},Xr=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||fe.emit(_t("boxstart")),Ue[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Zt){var qr=_t("cxtdrag");De?De.emit(qr):fe.emit(qr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||je!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(_t("cxtdragout")),t.hoverData.cxtOver=je,je&&je.emit(_t("cxtdragover")))}}else if(t.hoverData.dragging){if(ie=!0,fe.panningEnabled()&&fe.userPanningEnabled()){var ba;if(t.hoverData.justStartedPan){var $r=t.hoverData.mdownPos;ba={x:(we[0]-$r[0])*ge,y:(we[1]-$r[1])*ge},t.hoverData.justStartedPan=!1}else ba={x:Qe[0]*ge,y:Qe[1]*ge};fe.panBy(ba),fe.emit(_t("dragpan")),t.hoverData.dragged=!0}we=t.projectIntoViewport(V.clientX,V.clientY)}else if(Ue[4]==1&&(De==null||De.pannable())){if(Zt){if(!t.hoverData.dragging&&fe.boxSelectionEnabled()&&(Qt||!fe.panningEnabled()||!fe.userPanningEnabled()))Xr();else if(!t.hoverData.selecting&&fe.panningEnabled()&&fe.userPanningEnabled()){var Bt=s(De,t.hoverData.downs);Bt&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ue[4]=0,t.data.bgActivePosistion=Pu(Ae),t.redrawHint("select",!0),t.redraw())}De&&De.pannable()&&De.active()&&De.unactivate()}}else{if(De&&De.pannable()&&De.active()&&De.unactivate(),(!De||!De.grabbed())&&je!=Ye&&(Ye&&i(Ye,["mouseout","tapdragout"],V,{x:we[0],y:we[1]}),je&&i(je,["mouseover","tapdragover"],V,{x:we[0],y:we[1]}),t.hoverData.last=je),De)if(Zt){if(fe.boxSelectionEnabled()&&Qt)De&&De.grabbed()&&(x(tt),De.emit(_t("freeon")),tt.emit(_t("free")),t.dragData.didDrag&&(De.emit(_t("dragfreeon")),tt.emit(_t("dragfree")))),Xr();else if(De&&De.grabbed()&&t.nodeIsDraggable(De)){var mt=!t.dragData.didDrag;mt&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||y(tt,{inDragLayer:!0});var Ut={x:0,y:0};if(Ce(Qe[0])&&Ce(Qe[1])&&(Ut.x+=Qe[0],Ut.y+=Qe[1],mt)){var cr=t.hoverData.dragDelta;cr&&Ce(cr[0])&&Ce(cr[1])&&(Ut.x+=cr[0],Ut.y+=cr[1])}t.hoverData.draggingEles=!0,tt.silentShift(Ut).emit(_t("position")).emit(_t("drag")),t.redrawHint("drag",!0),t.redraw()}}else Kr();ie=!0}if(Ue[2]=we[0],Ue[3]=we[1],ie)return V.stopPropagation&&V.stopPropagation(),V.preventDefault&&V.preventDefault(),!1}},!1);var z,N,k;t.registerBinding(e,"mouseup",function(V){if(!(t.hoverData.which===1&&V.which!==1&&t.hoverData.capture)){var re=t.hoverData.capture;if(re){t.hoverData.capture=!1;var ie=t.cy,fe=t.projectIntoViewport(V.clientX,V.clientY),ge=t.selection,Re=t.findNearestElement(fe[0],fe[1],!0,!1),we=t.dragData.possibleDragElements,Ae=t.hoverData.down,Be=l(V);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,Ae&&Ae.unactivate();var Ue=function(Ot){return{originalEvent:V,type:Ot,position:{x:fe[0],y:fe[1]}}};if(t.hoverData.which===3){var je=Ue("cxttapend");if(Ae?Ae.emit(je):ie.emit(je),!t.hoverData.cxtDragged){var Ye=Ue("cxttap");Ae?Ae.emit(Ye):ie.emit(Ye)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(Re,["mouseup","tapend","vmouseup"],V,{x:fe[0],y:fe[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(Ae,["click","tap","vclick"],V,{x:fe[0],y:fe[1]}),N=!1,V.timeStamp-k<=ie.multiClickDebounceTime()?(z&&clearTimeout(z),N=!0,k=null,i(Ae,["dblclick","dbltap","vdblclick"],V,{x:fe[0],y:fe[1]})):(z=setTimeout(function(){N||i(Ae,["oneclick","onetap","voneclick"],V,{x:fe[0],y:fe[1]})},ie.multiClickDebounceTime()),k=V.timeStamp)),Ae==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!l(V)&&(ie.$(r).unselect(["tapunselect"]),we.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=we=ie.collection()),Re==Ae&&!t.dragData.didDrag&&!t.hoverData.selecting&&Re!=null&&Re._private.selectable&&(t.hoverData.dragging||(ie.selectionType()==="additive"||Be?Re.selected()?Re.unselect(["tapunselect"]):Re.select(["tapselect"]):Be||(ie.$(r).unmerge(Re).unselect(["tapunselect"]),Re.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var De=ie.collection(t.getAllInBox(ge[0],ge[1],ge[2],ge[3]));t.redrawHint("select",!0),De.length>0&&t.redrawHint("eles",!0),ie.emit(Ue("boxend"));var Qe=function(Ot){return Ot.selectable()&&!Ot.selected()};ie.selectionType()==="additive"||Be||ie.$(r).unmerge(De).unselect(),De.emit(Ue("box")).stdFilter(Qe).select().emit(Ue("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!ge[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var tt=Ae&&Ae.grabbed();x(we),tt&&(Ae.emit(Ue("freeon")),we.emit(Ue("free")),t.dragData.didDrag&&(Ae.emit(Ue("dragfreeon")),we.emit(Ue("dragfree"))))}}ge[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var P=[],G=4,j,q=1e5,U=function(V,re){for(var ie=0;ie=G){var fe=P;if(j=U(fe,5),!j){var ge=Math.abs(fe[0]);j=Y(fe)&&ge>5}if(j)for(var Re=0;Re5&&(ie=u1(ie)*5),Ye=ie/-250,j&&(Ye/=q,Ye*=3),Ye=Ye*t.wheelSensitivity;var De=V.deltaMode===1;De&&(Ye*=33);var Qe=we.zoom()*Math.pow(10,Ye);V.type==="gesturechange"&&(Qe=t.gestureStartZoom*V.scale),we.zoom({level:Qe,renderedPosition:{x:je[0],y:je[1]}}),we.emit({type:V.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:V,position:{x:Ue[0],y:Ue[1]}})}}}};t.registerBinding(t.container,"wheel",J,!0),t.registerBinding(e,"scroll",function(V){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(V){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||V.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(ye){t.hasTouchStarted||J(ye)},!0),t.registerBinding(t.container,"mouseout",function(V){var re=t.projectIntoViewport(V.clientX,V.clientY);t.cy.emit({originalEvent:V,type:"mouseout",position:{x:re[0],y:re[1]}})},!1),t.registerBinding(t.container,"mouseover",function(V){var re=t.projectIntoViewport(V.clientX,V.clientY);t.cy.emit({originalEvent:V,type:"mouseover",position:{x:re[0],y:re[1]}})},!1);var Z,L,H,Q,F,K,X,ee,he,ue,te,ne,oe,de=function(V,re,ie,fe){return Math.sqrt((ie-V)*(ie-V)+(fe-re)*(fe-re))},Ee=function(V,re,ie,fe){return(ie-V)*(ie-V)+(fe-re)*(fe-re)},Se;t.registerBinding(t.container,"touchstart",Se=function(V){if(t.hasTouchStarted=!0,!!O(V)){S(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var re=t.cy,ie=t.touchData.now,fe=t.touchData.earlier;if(V.touches[0]){var ge=t.projectIntoViewport(V.touches[0].clientX,V.touches[0].clientY);ie[0]=ge[0],ie[1]=ge[1]}if(V.touches[1]){var ge=t.projectIntoViewport(V.touches[1].clientX,V.touches[1].clientY);ie[2]=ge[0],ie[3]=ge[1]}if(V.touches[2]){var ge=t.projectIntoViewport(V.touches[2].clientX,V.touches[2].clientY);ie[4]=ge[0],ie[5]=ge[1]}var Re=function(Qt){return{originalEvent:V,type:Qt,position:{x:ie[0],y:ie[1]}}};if(V.touches[1]){t.touchData.singleTouchMoved=!0,x(t.dragData.touchDragEles);var we=t.findContainerClientCoords();he=we[0],ue=we[1],te=we[2],ne=we[3],Z=V.touches[0].clientX-he,L=V.touches[0].clientY-ue,H=V.touches[1].clientX-he,Q=V.touches[1].clientY-ue,oe=0<=Z&&Z<=te&&0<=H&&H<=te&&0<=L&&L<=ne&&0<=Q&&Q<=ne;var Ae=re.pan(),Be=re.zoom();F=de(Z,L,H,Q),K=Ee(Z,L,H,Q),X=[(Z+H)/2,(L+Q)/2],ee=[(X[0]-Ae.x)/Be,(X[1]-Ae.y)/Be];var Ue=200,je=Ue*Ue;if(K=1){for(var Rr=t.touchData.startPosition=[null,null,null,null,null,null],Et=0;Et=t.touchTapThreshold2}if(re&&t.touchData.cxt){V.preventDefault();var Et=V.touches[0].clientX-he,Gt=V.touches[0].clientY-ue,Ht=V.touches[1].clientX-he,Qt=V.touches[1].clientY-ue,Kr=Ee(Et,Gt,Ht,Qt),_t=Kr/K,Xr=150,qr=Xr*Xr,ba=1.5,$r=ba*ba;if(_t>=$r||Kr>=qr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Bt=Be("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Bt),t.touchData.start=null):fe.emit(Bt)}}if(re&&t.touchData.cxt){var Bt=Be("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Bt):fe.emit(Bt),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var mt=t.findNearestElement(ge[0],ge[1],!0,!0);(!t.touchData.cxtOver||mt!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(Be("cxtdragout")),t.touchData.cxtOver=mt,mt&&mt.emit(Be("cxtdragover")))}else if(re&&V.touches[2]&&fe.boxSelectionEnabled())V.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||fe.emit(Be("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,ie[4]=1,!ie||ie.length===0||ie[0]===void 0?(ie[0]=(ge[0]+ge[2]+ge[4])/3,ie[1]=(ge[1]+ge[3]+ge[5])/3,ie[2]=(ge[0]+ge[2]+ge[4])/3+1,ie[3]=(ge[1]+ge[3]+ge[5])/3+1):(ie[2]=(ge[0]+ge[2]+ge[4])/3,ie[3]=(ge[1]+ge[3]+ge[5])/3),t.redrawHint("select",!0),t.redraw();else if(re&&V.touches[1]&&!t.touchData.didSelect&&fe.zoomingEnabled()&&fe.panningEnabled()&&fe.userZoomingEnabled()&&fe.userPanningEnabled()){V.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ut=t.dragData.touchDragEles;if(Ut){t.redrawHint("drag",!0);for(var cr=0;cr0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Te;t.registerBinding(e,"touchcancel",Te=function(V){var re=t.touchData.start;t.touchData.capture=!1,re&&re.unactivate()});var Pe,Ne,_e,qe;if(t.registerBinding(e,"touchend",Pe=function(V){var re=t.touchData.start,ie=t.touchData.capture;if(ie)V.touches.length===0&&(t.touchData.capture=!1),V.preventDefault();else return;var fe=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var ge=t.cy,Re=ge.zoom(),we=t.touchData.now,Ae=t.touchData.earlier;if(V.touches[0]){var Be=t.projectIntoViewport(V.touches[0].clientX,V.touches[0].clientY);we[0]=Be[0],we[1]=Be[1]}if(V.touches[1]){var Be=t.projectIntoViewport(V.touches[1].clientX,V.touches[1].clientY);we[2]=Be[0],we[3]=Be[1]}if(V.touches[2]){var Be=t.projectIntoViewport(V.touches[2].clientX,V.touches[2].clientY);we[4]=Be[0],we[5]=Be[1]}var Ue=function(qr){return{originalEvent:V,type:qr,position:{x:we[0],y:we[1]}}};re&&re.unactivate();var je;if(t.touchData.cxt){if(je=Ue("cxttapend"),re?re.emit(je):ge.emit(je),!t.touchData.cxtDragged){var Ye=Ue("cxttap");re?re.emit(Ye):ge.emit(Ye)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!V.touches[2]&&ge.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var De=ge.collection(t.getAllInBox(fe[0],fe[1],fe[2],fe[3]));fe[0]=void 0,fe[1]=void 0,fe[2]=void 0,fe[3]=void 0,fe[4]=0,t.redrawHint("select",!0),ge.emit(Ue("boxend"));var Qe=function(qr){return qr.selectable()&&!qr.selected()};De.emit(Ue("box")).stdFilter(Qe).select().emit(Ue("boxselect")),De.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(re?.unactivate(),V.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!V.touches[1]){if(!V.touches[0]){if(!V.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var tt=t.dragData.touchDragEles;if(re!=null){var Zt=re._private.grabbed;x(tt),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Zt&&(re.emit(Ue("freeon")),tt.emit(Ue("free")),t.dragData.didDrag&&(re.emit(Ue("dragfreeon")),tt.emit(Ue("dragfree")))),i(re,["touchend","tapend","vmouseup","tapdragout"],V,{x:we[0],y:we[1]}),re.unactivate(),t.touchData.start=null}else{var Ot=t.findNearestElement(we[0],we[1],!0,!0);i(Ot,["touchend","tapend","vmouseup","tapdragout"],V,{x:we[0],y:we[1]})}var Rr=t.touchData.startPosition[0]-we[0],Et=Rr*Rr,Gt=t.touchData.startPosition[1]-we[1],Ht=Gt*Gt,Qt=Et+Ht,Kr=Qt*Re*Re;t.touchData.singleTouchMoved||(re||ge.$(":selected").unselect(["tapunselect"]),i(re,["tap","vclick"],V,{x:we[0],y:we[1]}),Ne=!1,V.timeStamp-qe<=ge.multiClickDebounceTime()?(_e&&clearTimeout(_e),Ne=!0,qe=null,i(re,["dbltap","vdblclick"],V,{x:we[0],y:we[1]})):(_e=setTimeout(function(){Ne||i(re,["onetap","voneclick"],V,{x:we[0],y:we[1]})},ge.multiClickDebounceTime()),qe=V.timeStamp)),re!=null&&!t.dragData.didDrag&&re._private.selectable&&Kr"u"){var Me=[],ke=function(V){return{clientX:V.clientX,clientY:V.clientY,force:1,identifier:V.pointerId,pageX:V.pageX,pageY:V.pageY,radiusX:V.width/2,radiusY:V.height/2,screenX:V.screenX,screenY:V.screenY,target:V.target}},Oe=function(V){return{event:V,touch:ke(V)}},Xe=function(V){Me.push(Oe(V))},et=function(V){for(var re=0;re0)return H[0]}return null},b=Object.keys(p),x=0;x0?y:eO(l,s,e,r,a,i,o,v)},checkPoint:function(e,r,a,i,l,s,o,v){v=v==="auto"?ei(i,l):v;var c=2*v;if(cn(e,r,this.points,s,o,i,l-c,[0,-1],a)||cn(e,r,this.points,s,o,i-c,l,[0,-1],a))return!0;var d=i/2+2*a,g=l/2+2*a,p=[s-d,o-g,s-d,o,s+d,o,s+d,o-g];return!!(Fr(e,r,p)||ki(e,r,c,c,s+i/2-v,o+l/2-v,a)||ki(e,r,c,c,s-i/2+v,o+l/2-v,a))}}};vn.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Mr(3,0)),this.generateRoundPolygon("round-triangle",Mr(3,0)),this.generatePolygon("rectangle",Mr(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",Mr(5,0)),this.generateRoundPolygon("round-pentagon",Mr(5,0)),this.generatePolygon("hexagon",Mr(6,0)),this.generateRoundPolygon("round-hexagon",Mr(6,0)),this.generatePolygon("heptagon",Mr(7,0)),this.generateRoundPolygon("round-heptagon",Mr(7,0)),this.generatePolygon("octagon",Mr(8,0)),this.generateRoundPolygon("round-octagon",Mr(8,0));var a=new Array(20);{var i=Bb(5,0),l=Bb(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*_)break}else if(c){if(T>=e.deqCost*y||T>=e.deqAvgCost*p)break}else if(C>=e.deqNoDrawCost*ig)break;var R=e.deq(a,E,x);if(R.length>0)for(var M=0;M0&&(e.onDeqd(a,b),!c&&e.shouldRedraw(a,b,E,x)&&l())},o=e.priority||a1;i.beforeRender(s,o(a))}}}},uP=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Df;ii(this,t),this.idsByKey=new on,this.keyForId=new on,this.cachesByLvl=new on,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return ui(t,[{key:"getIdsFor",value:function(r){r==null&&Pt("Can not get id list for null key");var a=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Xu,a.set(r,i)),i}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),i=this.keyForId.get(a),l=this.getKey(r);this.deleteIdForKey(i,a),this.addIdForKey(l,a),this.keyForId.set(a,l)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),i=this.keyForId.get(a);this.deleteIdForKey(i,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),i=this.keyForId.get(a),l=this.getKey(r);return i!==l}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,i=this.lvls,l=a.get(r);return l||(l=new on,a.set(r,l),i.push(r)),l}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var i=this.getKey(r),l=this.getCache(i,a);return l!=null&&this.updateKeyMappingFor(r),l}},{key:"getForCachedKey",value:function(r,a){var i=this.keyForId.get(r.id()),l=this.getCache(i,a);return l}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var i=this.getKey(r);return this.hasCache(i,a)}},{key:"setCache",value:function(r,a,i){i.key=r,this.getCachesAt(a).set(r,i)}},{key:"set",value:function(r,a,i){var l=this.getKey(r);this.setCache(l,a,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var i=this.getKey(r);this.deleteCache(i,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(i){return a.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var a=r.id(),i=this.keyForId.get(a);this.deleteKeyMappingFor(r);var l=this.doesEleInvalidateKey(r);return l&&this.invalidateKey(i),l||this.getNumberOfIdsForKey(i)===0}}])})(),XT=25,vf=50,xf=-4,Yb=3,iB=7.99,lP=8,sP=1024,oP=1024,fP=1024,cP=.2,vP=.8,dP=10,hP=.15,gP=.1,pP=.9,yP=.9,mP=100,bP=1,Uu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},wP=Sr({getKey:null,doesEleInvalidateKey:Df,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:KM,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),us=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var i=wP(r);He(a,i),a.lookup=new uP(i.getKey,i.doesEleInvalidateKey),a.setupDequeueing()},fr=us.prototype;fr.reasons=Uu;fr.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};fr.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};fr.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Ds(function(r,a){return a.reqs-r.reqs});return e};fr.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};fr.getElement=function(t,e,r,a,i){var l=this,s=this.renderer,o=s.cy.zoom(),v=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!l.allowEdgeTxrCaching&&t.isEdge()||!l.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(i1(o*r))),a=iB||a>Yb)return null;var c=Math.pow(2,a),d=e.h*c,g=e.w*c,p=s.eleTextBiggerThanMin(t,c);if(!this.isVisible(t,p))return null;var y=v.get(t,a);if(y&&y.invalidated&&(y.invalidated=!1,y.texture.invalidatedWidth-=y.width),y)return y;var b;if(d<=XT?b=XT:d<=vf?b=vf:b=Math.ceil(d/vf)*vf,d>fP||g>oP)return null;var x=l.getTextureQueue(b),E=x[x.length-2],S=function(){return l.recycleTexture(b,g)||l.addTexture(b,g)};E||(E=x[x.length-1]),E||(E=S()),E.width-E.usedWidtha;N--)B=l.getElement(t,e,r,N,Uu.downscale);z()}else return l.queueElement(t,M.level-1),M;else{var k;if(!C&&!_&&!R)for(var P=a-1;P>=xf;P--){var G=v.get(t,P);if(G){k=G;break}}if(T(k))return l.queueElement(t,a),k;E.context.translate(E.usedWidth,0),E.context.scale(c,c),this.drawElement(E.context,t,e,p,!1),E.context.scale(1/c,1/c),E.context.translate(-E.usedWidth,0)}return y={x:E.usedWidth,texture:E,level:a,scale:c,width:g,height:d,scaledLabelShown:p},E.usedWidth+=Math.ceil(g+lP),E.eleCaches.push(y),v.set(t,a,y),l.checkTextureFullness(E),y};fr.invalidateElements=function(t){for(var e=0;e=cP*t.width&&this.retireTexture(t)};fr.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>vP&&t.fullnessChecks>=dP?Jn(r,t):t.fullnessChecks++};fr.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),i=this.lookup;Jn(a,t),t.retired=!0;for(var l=t.eleCaches,s=0;s=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,n1(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),Jn(i,s),a.push(s),s}};fr.queueElement=function(t,e){var r=this,a=r.getElementQueue(),i=r.getElementKeyToQueue(),l=this.getKey(t),s=i[l];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,a.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:l};a.push(o),i[l]=o}};fr.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=[],l=e.lookup,s=0;s0;s++){var o=r.pop(),v=o.key,c=o.eles[0],d=l.hasCache(c,o.level);if(a[v]=null,d)continue;i.push(o);var g=e.getBoundingBox(c);e.getElement(c,g,t,o.level,Uu.dequeue)}return i};fr.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=this.getKey(t),l=a[i];l!=null&&(l.eles.length===1?(l.reqs=r1,r.updateItem(l),r.pop(),a[i]=null):l.eles.unmerge(t))};fr.onDequeue=function(t){this.onDequeues.push(t)};fr.offDequeue=function(t){Jn(this.onDequeues,t)};fr.setupDequeueing=nB.setupDequeueing({deqRedrawThreshold:mP,deqCost:hP,deqAvgCost:gP,deqNoDrawCost:pP,deqFastCost:yP,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a=SP||r>kf)return null}a.validateLayersElesOrdering(r,t);var v=a.layersByLevel,c=Math.pow(2,r),d=v[r]=v[r]||[],g,p=a.levelIsComplete(r,t),y,b=function(){var z=function(j){if(a.validateLayersElesOrdering(j,t),a.levelIsComplete(j,t))return y=v[j],!0},N=function(j){if(!y)for(var q=r+j;cs<=q&&q<=kf&&!z(q);q+=j);};N(1),N(-1);for(var k=d.length-1;k>=0;k--){var P=d[k];P.invalid&&Jn(d,P)}};if(!p)b();else return d;var x=function(){if(!g){g=Or();for(var z=0;zZT||P>ZT)return null;var G=k*P;if(G>MP)return null;var j=a.makeLayer(g,r);if(N!=null){var q=d.indexOf(N)+1;d.splice(q,0,j)}else(z.insert===void 0||z.insert)&&d.unshift(j);return j};if(a.skipping&&!o)return null;for(var S=null,T=t.length/EP,C=!o,_=0;_=T||!JM(S.bb,R.boundingBox()))&&(S=E({insert:!0,after:S}),!S))return null;y||C?a.queueLayer(S,R):a.drawEleInLayer(S,R,r,e),S.eles.push(R),A[r]=S}return y||(C?null:d)};xr.getEleLevelForLayerLevel=function(t,e){return t};xr.drawEleInLayer=function(t,e,r,a){var i=this,l=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,a),l.setImgSmoothing(s,!1),l.drawCachedElement(s,e,null,null,r,OP),l.setImgSmoothing(s,!0))};xr.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var i=0,l=0;l0||s.invalid)return!1;i+=s.eles.length}return i===e.length};xr.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a0){e=!0;break}}return e};xr.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=fn(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,i,l){e.invalidateLayer(a)}))};xr.invalidateLayer=function(t){if(this.lastInvalidationTime=fn(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];Jn(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(l&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var v;r&&(v=r,t.translate(-v.x1,-v.y1));var c=l?e.pstyle("opacity").value:1,d=l?e.pstyle("line-opacity").value:1,g=e.pstyle("curve-style").value,p=e.pstyle("line-style").value,y=e.pstyle("width").pfValue,b=e.pstyle("line-cap").value,x=e.pstyle("line-outline-width").value,E=e.pstyle("line-outline-color").value,S=c*d,T=c*d,C=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;g==="straight-triangle"?(s.eleStrokeStyle(t,e,j),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=y,t.lineCap=b,s.eleStrokeStyle(t,e,j),s.drawEdgePath(e,t,o.allpts,p),t.lineCap="butt")},_=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;if(t.lineWidth=y+x,t.lineCap=b,x>0)s.colorStrokeStyle(t,E[0],E[1],E[2],j);else{t.lineCap="butt";return}g==="straight-triangle"?s.drawEdgeTrianglePath(e,t,o.allpts):(s.drawEdgePath(e,t,o.allpts,p),t.lineCap="butt")},R=function(){i&&s.drawEdgeOverlay(t,e)},M=function(){i&&s.drawEdgeUnderlay(t,e)},A=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;s.drawArrowheads(t,e,j)},O=function(){s.drawElementText(t,e,null,a)};t.lineJoin="round";var B=e.pstyle("ghost").value==="yes";if(B){var z=e.pstyle("ghost-offset-x").pfValue,N=e.pstyle("ghost-offset-y").pfValue,k=e.pstyle("ghost-opacity").value,P=S*k;t.translate(z,N),C(P),A(P),t.translate(-z,-N)}else _();M(),C(),A(),R(),O(),r&&t.translate(v.x1,v.y1)}};var sB=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var i=a.pstyle("".concat(e,"-opacity")).value;if(i!==0){var l=this,s=l.usePaths(),o=a._private.rscratch,v=a.pstyle("".concat(e,"-padding")).pfValue,c=2*v,d=a.pstyle("".concat(e,"-color")).value;r.lineWidth=c,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",l.colorStrokeStyle(r,d[0],d[1],d[2],i),l.drawEdgePath(a,r,o.allpts,"solid")}}}};dn.drawEdgeOverlay=sB("overlay");dn.drawEdgeUnderlay=sB("underlay");dn.drawEdgePath=function(t,e,r,a){var i=t._private.rscratch,l=e,s,o=!1,v=this.usePaths(),c=t.pstyle("line-dash-pattern").pfValue,d=t.pstyle("line-dash-offset").pfValue;if(v){var g=r.join("$"),p=i.pathCacheKey&&i.pathCacheKey===g;p?(s=e=i.pathCache,o=!0):(s=e=new Path2D,i.pathCacheKey=g,i.pathCache=s)}if(l.setLineDash)switch(a){case"dotted":l.setLineDash([1,1]);break;case"dashed":l.setLineDash(c),l.lineDashOffset=d;break;case"solid":l.setLineDash([]);break}if(!o&&!i.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var y=2;y+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(l&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var v=s.getLabelJustification(e);t.textAlign=v,t.textBaseline="bottom"}else{var c=e.element()._private.rscratch.badLine,d=e.pstyle("label"),g=e.pstyle("source-label"),p=e.pstyle("target-label");if(c||(!d||!d.value)&&(!g||!g.value)&&(!p||!p.value))return;t.textAlign="center",t.textBaseline="bottom"}var y=!r,b;r&&(b=r,t.translate(-b.x1,-b.y1)),i==null?(s.drawText(t,e,null,y,l),e.isEdge()&&(s.drawText(t,e,"source",y,l),s.drawText(t,e,"target",y,l))):s.drawText(t,e,i,y,l),r&&t.translate(b.x1,b.y1)};Fi.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue+"px",l=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,v=e.pstyle("text-outline-opacity").value*o,c=e.pstyle("color").value,d=e.pstyle("text-outline-color").value;t.font=a+" "+s+" "+i+" "+l,t.lineJoin="round",this.colorFillStyle(t,c[0],c[1],c[2],o),this.colorStrokeStyle(t,d[0],d[1],d[2],v)};function GP(t,e,r,a,i){var l=Math.min(a,i),s=l/2,o=e+a/2,v=r+i/2;t.beginPath(),t.arc(o,v,s,0,Math.PI*2),t.closePath()}function eC(t,e,r,a,i){var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(l,a/2,i/2);t.beginPath(),t.moveTo(e+s,r),t.lineTo(e+a-s,r),t.quadraticCurveTo(e+a,r,e+a,r+s),t.lineTo(e+a,r+i-s),t.quadraticCurveTo(e+a,r+i,e+a-s,r+i),t.lineTo(e+s,r+i),t.quadraticCurveTo(e,r+i,e,r+i-s),t.lineTo(e,r+s),t.quadraticCurveTo(e,r,e+s,r),t.closePath()}Fi.getTextAngle=function(t,e){var r,a=t._private,i=a.rscratch,l=e?e+"-":"",s=t.pstyle(l+"text-rotation");if(s.strValue==="autorotate"){var o=Hr(i,"labelAngle",e);r=t.isEdge()?o:0}else s.strValue==="none"?r=0:r=s.pfValue;return r};Fi.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=e._private,s=l.rscratch,o=i?e.effectiveOpacity():1;if(!(i&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var v=Hr(s,"labelX",r),c=Hr(s,"labelY",r),d,g,p=this.getLabelText(e,r);if(p!=null&&p!==""&&!isNaN(v)&&!isNaN(c)){this.setupTextStyle(t,e,i);var y=r?r+"-":"",b=Hr(s,"labelWidth",r),x=Hr(s,"labelHeight",r),E=e.pstyle(y+"text-margin-x").pfValue,S=e.pstyle(y+"text-margin-y").pfValue,T=e.isEdge(),C=e.pstyle("text-halign").value,_=e.pstyle("text-valign").value;T&&(C="center",_="center"),v+=E,c+=S;var R;switch(a?R=this.getTextAngle(e,r):R=0,R!==0&&(d=v,g=c,t.translate(d,g),t.rotate(R),v=0,c=0),_){case"top":break;case"center":c+=x/2;break;case"bottom":c+=x;break}var M=e.pstyle("text-background-opacity").value,A=e.pstyle("text-border-opacity").value,O=e.pstyle("text-border-width").pfValue,B=e.pstyle("text-background-padding").pfValue,z=e.pstyle("text-background-shape").strValue,N=z==="round-rectangle"||z==="roundrectangle",k=z==="circle",P=2;if(M>0||O>0&&A>0){var G=t.fillStyle,j=t.strokeStyle,q=t.lineWidth,U=e.pstyle("text-background-color").value,Y=e.pstyle("text-border-color").value,J=e.pstyle("text-border-style").value,Z=M>0,L=O>0&&A>0,H=v-B;switch(C){case"left":H-=b;break;case"center":H-=b/2;break}var Q=c-x-B,F=b+2*B,K=x+2*B;if(Z&&(t.fillStyle="rgba(".concat(U[0],",").concat(U[1],",").concat(U[2],",").concat(M*o,")")),L&&(t.strokeStyle="rgba(".concat(Y[0],",").concat(Y[1],",").concat(Y[2],",").concat(A*o,")"),t.lineWidth=O,t.setLineDash))switch(J){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=O/4,t.setLineDash([]);break;default:t.setLineDash([]);break}if(N?(t.beginPath(),eC(t,H,Q,F,K,P)):k?(t.beginPath(),GP(t,H,Q,F,K)):(t.beginPath(),t.rect(H,Q,F,K)),Z&&t.fill(),L&&t.stroke(),L&&J==="double"){var X=O/2;t.beginPath(),N?eC(t,H+X,Q+X,F-2*X,K-2*X,P):t.rect(H+X,Q+X,F-2*X,K-2*X),t.stroke()}t.fillStyle=G,t.strokeStyle=j,t.lineWidth=q,t.setLineDash&&t.setLineDash([])}var ee=2*e.pstyle("text-outline-width").pfValue;if(ee>0&&(t.lineWidth=ee),e.pstyle("text-wrap").value==="wrap"){var he=Hr(s,"labelWrapCachedLines",r),ue=Hr(s,"labelLineHeight",r),te=b/2,ne=this.getLabelJustification(e);switch(ne==="auto"||(C==="left"?ne==="left"?v+=-b:ne==="center"&&(v+=-te):C==="center"?ne==="left"?v+=-te:ne==="right"&&(v+=te):C==="right"&&(ne==="center"?v+=te:ne==="right"&&(v+=b))),_){case"top":c-=(he.length-1)*ue;break;case"center":case"bottom":c-=(he.length-1)*ue;break}for(var oe=0;oe0&&t.strokeText(he[oe],v,c),t.fillText(he[oe],v,c),c+=ue}else ee>0&&t.strokeText(p,v,c),t.fillText(p,v,c);R!==0&&(t.rotate(-R),t.translate(-d,-g))}}};var si={};si.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,v,c=e._private,d=c.rscratch,g=e.position();if(!(!Ce(g.x)||!Ce(g.y))&&!(l&&!e.visible())){var p=l?e.effectiveOpacity():1,y=s.usePaths(),b,x=!1,E=e.padding();o=e.width()+2*E,v=e.height()+2*E;var S;r&&(S=r,t.translate(-S.x1,-S.y1));for(var T=e.pstyle("background-image"),C=T.value,_=new Array(C.length),R=new Array(C.length),M=0,A=0;A0&&arguments[0]!==void 0?arguments[0]:P;s.eleFillStyle(t,e,V)},ue=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L;s.colorStrokeStyle(t,G[0],G[1],G[2],V)},te=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;s.colorStrokeStyle(t,Q[0],Q[1],Q[2],V)},ne=function(V,re,ie,fe){var ge=s.nodePathCache=s.nodePathCache||[],Re=YM(ie==="polygon"?ie+","+fe.join(","):ie,""+re,""+V,""+ee),we=ge[Re],Ae,Be=!1;return we!=null?(Ae=we,Be=!0,d.pathCache=Ae):(Ae=new Path2D,ge[Re]=d.pathCache=Ae),{path:Ae,cacheHit:Be}},oe=e.pstyle("shape").strValue,de=e.pstyle("shape-polygon-points").pfValue;if(y){t.translate(g.x,g.y);var Ee=ne(o,v,oe,de);b=Ee.path,x=Ee.cacheHit}var Se=function(){if(!x){var V=g;y&&(V={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(b||t,V.x,V.y,o,v,ee,d)}y?t.fill(b):t.fill()},Ke=function(){for(var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ie=c.backgrounding,fe=0,ge=0;ge0&&arguments[0]!==void 0?arguments[0]:!1,re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;s.hasPie(e)&&(s.drawPie(t,e,re),V&&(y||s.nodeShapes[s.getNodeShape(e)].draw(t,g.x,g.y,o,v,ee,d)))},Pe=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;s.hasStripe(e)&&(t.save(),y?t.clip(d.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(t,g.x,g.y,o,v,ee,d),t.clip()),s.drawStripe(t,e,re),t.restore(),V&&(y||s.nodeShapes[s.getNodeShape(e)].draw(t,g.x,g.y,o,v,ee,d)))},Ne=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,re=(N>0?N:-N)*V,ie=N>0?0:255;N!==0&&(s.colorFillStyle(t,ie,ie,ie,re),y?t.fill(b):t.fill())},_e=function(){if(k>0){if(t.lineWidth=k,t.lineCap=U,t.lineJoin=q,t.setLineDash)switch(j){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(J),t.lineDashOffset=Z;break;case"solid":case"double":t.setLineDash([]);break}if(Y!=="center"){if(t.save(),t.lineWidth*=2,Y==="inside")y?t.clip(b):t.clip();else{var V=new Path2D;V.rect(-o/2-k,-v/2-k,o+2*k,v+2*k),V.addPath(b),t.clip(V,"evenodd")}y?t.stroke(b):t.stroke(),t.restore()}else y?t.stroke(b):t.stroke();if(j==="double"){t.lineWidth=k/3;var re=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(b):t.stroke(),t.globalCompositeOperation=re}t.setLineDash&&t.setLineDash([])}},qe=function(){if(H>0){if(t.lineWidth=H,t.lineCap="butt",t.setLineDash)switch(F){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var V=g;y&&(V={x:0,y:0});var re=s.getNodeShape(e),ie=k;Y==="inside"&&(ie=0),Y==="outside"&&(ie*=2);var fe=(o+ie+(H+X))/o,ge=(v+ie+(H+X))/v,Re=o*fe,we=v*ge,Ae=s.nodeShapes[re].points,Be;if(y){var Ue=ne(Re,we,re,Ae);Be=Ue.path}if(re==="ellipse")s.drawEllipsePath(Be||t,V.x,V.y,Re,we);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(re)){var je=0,Ye=0,De=0;re==="round-diamond"?je=(ie+X+H)*1.4:re==="round-heptagon"?(je=(ie+X+H)*1.075,De=-(ie/2+X+H)/35):re==="round-hexagon"?je=(ie+X+H)*1.12:re==="round-pentagon"?(je=(ie+X+H)*1.13,De=-(ie/2+X+H)/15):re==="round-tag"?(je=(ie+X+H)*1.12,Ye=(ie/2+H+X)*.07):re==="round-triangle"&&(je=(ie+X+H)*(Math.PI/2),De=-(ie+X/2+H)/Math.PI),je!==0&&(fe=(o+je)/o,Re=o*fe,["round-hexagon","round-tag"].includes(re)||(ge=(v+je)/v,we=v*ge)),ee=ee==="auto"?rO(Re,we):ee;for(var Qe=Re/2,tt=we/2,Zt=ee+(ie+H+X)/2,Ot=new Array(Ae.length/2),Rr=new Array(Ae.length/2),Et=0;Et0){if(i=i||a.position(),l==null||s==null){var y=a.padding();l=a.width()+2*y,s=a.height()+2*y}o.colorFillStyle(r,d[0],d[1],d[2],c),o.nodeShapes[g].draw(r,i.x,i.y,l+v*2,s+v*2,p),r.fill()}}}};si.drawNodeOverlay=oB("overlay");si.drawNodeUnderlay=oB("underlay");si.hasPie=function(t){return t=t[0],t._private.hasPie};si.hasStripe=function(t){return t=t[0],t._private.hasStripe};si.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),l=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,v=a.x,c=a.y,d=e.width(),g=e.height(),p=Math.min(d,g)/2,y,b=0,x=this.usePaths();if(x&&(v=0,c=0),l.units==="%"?p=p*l.pfValue:l.pfValue!==void 0&&(p=l.pfValue/2),s.units==="%"?y=p*s.pfValue:s.pfValue!==void 0&&(y=s.pfValue/2),!(y>=p))for(var E=1;E<=i.pieBackgroundN;E++){var S=e.pstyle("pie-"+E+"-background-size").value,T=e.pstyle("pie-"+E+"-background-color").value,C=e.pstyle("pie-"+E+"-background-opacity").value*r,_=S/100;_+b>1&&(_=1-b);var R=1.5*Math.PI+2*Math.PI*b;R+=o;var M=2*Math.PI*_,A=R+M;S===0||b>=1||b+_>1||(y===0?(t.beginPath(),t.moveTo(v,c),t.arc(v,c,p,R,A),t.closePath()):(t.beginPath(),t.arc(v,c,p,R,A),t.arc(v,c,y,A,R,!0),t.closePath()),this.colorFillStyle(t,T[0],T[1],T[2],C),t.fill(),b+=_)}};si.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),l=a.x,s=a.y,o=e.width(),v=e.height(),c=0,d=this.usePaths();t.save();var g=e.pstyle("stripe-direction").value,p=e.pstyle("stripe-size");switch(g){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var y=o,b=v;p.units==="%"?(y=y*p.pfValue,b=b*p.pfValue):p.pfValue!==void 0&&(y=p.pfValue,b=p.pfValue),d&&(l=0,s=0),s-=y/2,l-=b/2;for(var x=1;x<=i.stripeBackgroundN;x++){var E=e.pstyle("stripe-"+x+"-background-size").value,S=e.pstyle("stripe-"+x+"-background-color").value,T=e.pstyle("stripe-"+x+"-background-opacity").value*r,C=E/100;C+c>1&&(C=1-c),!(E===0||c>=1||c+C>1)&&(t.beginPath(),t.rect(l,s+b*c,y,b*C),t.closePath(),this.colorFillStyle(t,S[0],S[1],S[2],T),t.fill(),c+=C)}t.restore()};var Br={},HP=100;Br.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};Br.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,i=0;ie.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!g&&(d[e.NODE]=!0,d[e.SELECT_BOX]=!0);var T=r.style(),C=r.zoom(),_=s!==void 0?s:C,R=r.pan(),M={x:R.x,y:R.y},A={zoom:C,pan:{x:R.x,y:R.y}},O=e.prevViewport,B=O===void 0||A.zoom!==O.zoom||A.pan.x!==O.pan.x||A.pan.y!==O.pan.y;!B&&!(x&&!b)&&(e.motionBlurPxRatio=1),o&&(M=o),_*=v,M.x*=v,M.y*=v;var z=e.getCachedZSortedEles();function N(ue,te,ne,oe,de){var Ee=ue.globalCompositeOperation;ue.globalCompositeOperation="destination-out",e.colorFillStyle(ue,255,255,255,e.motionBlurTransparency),ue.fillRect(te,ne,oe,de),ue.globalCompositeOperation=Ee}function k(ue,te){var ne,oe,de,Ee;!e.clearingMotionBlur&&(ue===c.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||ue===c.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(ne={x:R.x*y,y:R.y*y},oe=C*y,de=e.canvasWidth*y,Ee=e.canvasHeight*y):(ne=M,oe=_,de=e.canvasWidth,Ee=e.canvasHeight),ue.setTransform(1,0,0,1,0,0),te==="motionBlur"?N(ue,0,0,de,Ee):!a&&(te===void 0||te)&&ue.clearRect(0,0,de,Ee),i||(ue.translate(ne.x,ne.y),ue.scale(oe,oe)),o&&ue.translate(o.x,o.y),s&&ue.scale(s,s)}if(g||(e.textureDrawLastFrame=!1),g){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var P=e.data.bufferContexts[e.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:v*e.textureMult});var A=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};A.mpan={x:(0-A.pan.x)/A.zoom,y:(0-A.pan.y)/A.zoom}}d[e.DRAG]=!1,d[e.NODE]=!1;var G=c.contexts[e.NODE],j=e.textureCache.texture,A=e.textureCache.viewport;G.setTransform(1,0,0,1,0,0),p?N(G,0,0,A.width,A.height):G.clearRect(0,0,A.width,A.height);var q=T.core("outside-texture-bg-color").value,U=T.core("outside-texture-bg-opacity").value;e.colorFillStyle(G,q[0],q[1],q[2],U),G.fillRect(0,0,A.width,A.height);var C=r.zoom();k(G,!1),G.clearRect(A.mpan.x,A.mpan.y,A.width/A.zoom/v,A.height/A.zoom/v),G.drawImage(j,A.mpan.x,A.mpan.y,A.width/A.zoom/v,A.height/A.zoom/v)}else e.textureOnViewport&&!a&&(e.textureCache=null);var Y=r.extent(),J=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),Z=e.hideEdgesOnViewport&&J,L=[];if(L[e.NODE]=!d[e.NODE]&&p&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,L[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),L[e.DRAG]=!d[e.DRAG]&&p&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,L[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),d[e.NODE]||i||l||L[e.NODE]){var H=p&&!L[e.NODE]&&y!==1,G=a||(H?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:c.contexts[e.NODE]),Q=p&&!H?"motionBlur":void 0;k(G,Q),Z?e.drawCachedNodes(G,z.nondrag,v,Y):e.drawLayeredElements(G,z.nondrag,v,Y),e.debug&&e.drawDebugPoints(G,z.nondrag),!i&&!p&&(d[e.NODE]=!1)}if(!l&&(d[e.DRAG]||i||L[e.DRAG])){var H=p&&!L[e.DRAG]&&y!==1,G=a||(H?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:c.contexts[e.DRAG]);k(G,p&&!H?"motionBlur":void 0),Z?e.drawCachedNodes(G,z.drag,v,Y):e.drawCachedElements(G,z.drag,v,Y),e.debug&&e.drawDebugPoints(G,z.drag),!i&&!p&&(d[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,k),p&&y!==1){var F=c.contexts[e.NODE],K=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],X=c.contexts[e.DRAG],ee=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],he=function(te,ne,oe){te.setTransform(1,0,0,1,0,0),oe||!S?te.clearRect(0,0,e.canvasWidth,e.canvasHeight):N(te,0,0,e.canvasWidth,e.canvasHeight);var de=y;te.drawImage(ne,0,0,e.canvasWidth*de,e.canvasHeight*de,0,0,e.canvasWidth,e.canvasHeight)};(d[e.NODE]||L[e.NODE])&&(he(F,K,L[e.NODE]),d[e.NODE]=!1),(d[e.DRAG]||L[e.DRAG])&&(he(X,ee,L[e.DRAG]),d[e.DRAG]=!1)}e.prevViewport=A,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),p&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!g,e.mbFrames=0,d[e.NODE]=!0,d[e.DRAG]=!0,e.redraw()},HP)),a||r.emit("render")};var ts;Br.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,i=r.data,l=a.style(),s=t.drawOnlyNodeLayer,o=t.drawAllLayers,v=i.canvasNeedsRedraw,c=t.forcedContext;if(r.showFps||!s&&v[r.SELECT_BOX]&&!o){var d=c||i.contexts[r.SELECT_BOX];if(e(d),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var g=r.cy.zoom(),p=l.core("selection-box-border-width").value/g;d.lineWidth=p,d.fillStyle="rgba("+l.core("selection-box-color").value[0]+","+l.core("selection-box-color").value[1]+","+l.core("selection-box-color").value[2]+","+l.core("selection-box-opacity").value+")",d.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),p>0&&(d.strokeStyle="rgba("+l.core("selection-box-border-color").value[0]+","+l.core("selection-box-border-color").value[1]+","+l.core("selection-box-border-color").value[2]+","+l.core("selection-box-opacity").value+")",d.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var g=r.cy.zoom(),y=i.bgActivePosistion;d.fillStyle="rgba("+l.core("active-bg-color").value[0]+","+l.core("active-bg-color").value[1]+","+l.core("active-bg-color").value[2]+","+l.core("active-bg-opacity").value+")",d.beginPath(),d.arc(y.x,y.y,l.core("active-bg-size").pfValue/g,0,2*Math.PI),d.fill()}var b=r.lastRedrawTime;if(r.showFps&&b){b=Math.round(b);var x=Math.round(1e3/b),E="1 frame = "+b+" ms = "+x+" fps";if(d.setTransform(1,0,0,1,0,0),d.fillStyle="rgba(255, 0, 0, 0.75)",d.strokeStyle="rgba(255, 0, 0, 0.75)",d.font="30px Arial",!ts){var S=d.measureText(E);ts=S.actualBoundingBoxAscent}d.fillText(E,0,ts);var T=60;d.strokeRect(0,ts+10,250,20),d.fillRect(0,ts+10,250*Math.min(x/T,1),20)}o||(v[r.SELECT_BOX]=!1)}};function tC(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function FP(t,e,r){var a=tC(t,t.VERTEX_SHADER,e),i=tC(t,t.FRAGMENT_SHADER,r),l=t.createProgram();if(t.attachShader(l,a),t.attachShader(l,i),t.linkProgram(l),!t.getProgramParameter(l,t.LINK_STATUS))throw new Error("Could not initialize shaders");return l}function jP(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),i=a.context=a.getContext("2d");return a.clear=function(){return i.clearRect(0,0,a.width,a.height)},a.clear(),a}function S1(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function YP(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function KP(t,e,r,a,i){var l=a*r+e.x,s=i*r+e.y;return s=Math.round(t.canvasHeight-s),[l,s]}function XP(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function $P(t,e){if(t.length!==e.length)return!1;for(var r=0;r>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function ZP(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function QP(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function fB(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function cB(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function WP(t,e,r,a,i,l){switch(e){case t.FLOAT:return new Float32Array(r.buffer,l*a,i);case t.INT:return new Int32Array(r.buffer,l*a,i)}}function JP(t,e,r,a){var i=fB(t,e),l=nr(i,2),s=l[0],o=l[1],v=cB(t,o,a),c=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,v,t.STATIC_DRAW),o===t.FLOAT?t.vertexAttribPointer(r,s,o,!1,0,0):o===t.INT&&t.vertexAttribIPointer(r,s,o,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),c}function Na(t,e,r,a){var i=fB(t,r),l=nr(i,3),s=l[0],o=l[1],v=l[2],c=cB(t,o,e*s),d=s*v,g=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,g),t.bufferData(t.ARRAY_BUFFER,e*d,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),o===t.FLOAT?t.vertexAttribPointer(a,s,o,!1,d,0):o===t.INT&&t.vertexAttribIPointer(a,s,o,d,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var p=new Array(e),y=0;ys&&(o=s/a,v=a*o,c=i*o),{scale:o,texW:v,texH:c}}},{key:"draw",value:function(r,a,i){var l=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,v=this.texHeight,c=this.getScale(a),d=c.scale,g=c.texW,p=c.texH,y=function(C,_){if(i&&_){var R=_.context,M=C.x,A=C.row,O=M,B=v*A;R.save(),R.translate(O,B),R.scale(d,d),i(R,a),R.restore()}},b=[null,null],x=function(){y(l.freePointer,l.canvas),b[0]={x:l.freePointer.x,y:l.freePointer.row*v,w:g,h:p},b[1]={x:l.freePointer.x+g,y:l.freePointer.row*v,w:0,h:p},l.freePointer.x+=g,l.freePointer.x==s&&(l.freePointer.x=0,l.freePointer.row++)},E=function(){var C=l.scratch,_=l.canvas;C.clear(),y({x:0,row:0},C);var R=s-l.freePointer.x,M=g-R,A=v;{var O=l.freePointer.x,B=l.freePointer.row*v,z=R;_.context.drawImage(C,0,0,z,A,O,B,z,A),b[0]={x:O,y:B,w:z,h:p}}{var N=R,k=(l.freePointer.row+1)*v,P=M;_&&_.context.drawImage(C,N,0,P,A,0,k,P,A),b[1]={x:0,y:k,w:P,h:p}}l.freePointer.x=M,l.freePointer.row++},S=function(){l.freePointer.x=0,l.freePointer.row++};if(this.freePointer.x+g<=s)x();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(S(),x()):this.enableWrapping?E():(S(),x())}return this.keyToLocation.set(r,b),this.needsBuffer=!0,b}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,i=this.texRows,l=this.getScale(r),s=l.texW;return this.freePointer.x+s>a?this.freePointer.row1&&arguments[1]!==void 0?arguments[1]:{},l=i.forceRedraw,s=l===void 0?!1:l,o=i.filterEle,v=o===void 0?function(){return!0}:o,c=i.filterType,d=c===void 0?function(){return!0}:c,g=!1,p=!1,y=jr(r),b;try{for(y.s();!(b=y.n()).done;){var x=b.value;if(v(x)){var E=jr(this.renderTypes.values()),S;try{var T=function(){var _=S.value,R=_.type;if(d(R)){var M=a.collections.get(_.collection),A=_.getKey(x),O=Array.isArray(A)?A:[A];if(s)O.forEach(function(k){return M.markKeyForGC(k)}),p=!0;else{var B=_.getID?_.getID(x):x.id(),z=a._key(R,B),N=a.typeAndIdToKey.get(z);N!==void 0&&!$P(O,N)&&(g=!0,a.typeAndIdToKey.delete(z),N.forEach(function(k){return M.markKeyForGC(k)}))}}};for(E.s();!(S=E.n()).done;)T()}catch(C){E.e(C)}finally{E.f()}}}}catch(C){y.e(C)}finally{y.f()}return p&&(this.gc(),g=!1),g}},{key:"gc",value:function(){var r=jr(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var i=a.value;i.gc()}}catch(l){r.e(l)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,i,l){var s=this.renderTypes.get(a),o=this.collections.get(s.collection),v=!1,c=o.draw(l,i,function(p){s.drawClipped?(p.save(),p.beginPath(),p.rect(0,0,i.w,i.h),p.clip(),s.drawElement(p,r,i,!0,!0),p.restore()):s.drawElement(p,r,i,!0,!0),v=!0});if(v){var d=s.getID?s.getID(r):r.id(),g=this._key(a,d);this.typeAndIdToKey.has(g)?this.typeAndIdToKey.get(g).push(l):this.typeAndIdToKey.set(g,[l])}return c}},{key:"getAtlasInfo",value:function(r,a){var i=this,l=this.renderTypes.get(a),s=l.getKey(r),o=Array.isArray(s)?s:[s];return o.map(function(v){var c=l.getBoundingBox(r,v),d=i.getOrCreateAtlas(r,a,c,v),g=d.getOffsets(v),p=nr(g,2),y=p[0],b=p[1];return{atlas:d,tex:y,tex1:y,tex2:b,bb:c}})}},{key:"getDebugInfo",value:function(){var r=[],a=jr(this.collections),i;try{for(a.s();!(i=a.n()).done;){var l=nr(i.value,2),s=l[0],o=l[1],v=o.getCounts(),c=v.keyCount,d=v.atlasCount;r.push({type:s,keyCount:c,atlasCount:d})}}catch(g){a.e(g)}finally{a.f()}return r}}])})(),sI=(function(){function t(e){ii(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ui(t,[{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(r,a){return a})}},{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(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])})(),oI=` + float circleSD(vec2 p, float r) { + return distance(vec2(0), p) - r; // signed distance + } +`,fI=` + float rectangleSD(vec2 p, vec2 b) { + vec2 d = abs(p)-b; + return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0); + } +`,cI=` + float roundRectangleSD(vec2 p, vec2 b, vec4 cr) { + cr.xy = (p.x > 0.0) ? cr.xy : cr.zw; + cr.x = (p.y > 0.0) ? cr.x : cr.y; + vec2 q = abs(p) - b + cr.x; + return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x; + } +`,vI=` + float ellipseSD(vec2 p, vec2 ab) { + p = abs( p ); // symmetry + + // find root with Newton solver + vec2 q = ab*(p-ab); + float w = (q.x1.0) ? d : -d; + } +`,vs={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Pf={IGNORE:1,USE_BB:2},sg=0,iC=1,uC=2,og=3,Nu=4,df=5,rs=6,as=7,dI=(function(){function t(e,r,a){ii(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=jP,this.atlasManager=new lI(e,a),this.batchManager=new sI(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(vs.SCREEN),this.pickingProgram=this._createShaderProgram(vs.PICKING),this.vao=this._createVAO()}return ui(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.type,l=this.atlasManager;return i?l.invalidate(r,{filterType:function(o){return o===i},forceRedraw:!0}):l.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,i=`#version 300 es + precision highp float; + + uniform mat3 uPanZoomMatrix; + uniform int uAtlasSize; + + // instanced + in vec2 aPosition; // a vertex from the unit square + + in mat3 aTransform; // used to transform verticies, eg into a bounding box + in int aVertType; // the type of thing we are rendering + + // the z-index that is output when using picking mode + in vec4 aIndex; + + // For textures + in int aAtlasId; // which shader unit/atlas to use + in vec4 aTex; // x/y/w/h of texture in atlas + + // for edges + in vec4 aPointAPointB; + in vec4 aPointCPointD; + in vec2 aLineWidth; // also used for node border width + + // simple shapes + in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left] + in vec4 aColor; // also used for edges + in vec4 aBorderColor; // aLineWidth is used for border width + + // output values passed to the fragment shader + out vec2 vTexCoord; + out vec4 vColor; + out vec2 vPosition; + // flat values are not interpolated + flat out int vAtlasId; + flat out int vVertType; + flat out vec2 vTopRight; + flat out vec2 vBotLeft; + flat out vec4 vCornerRadius; + flat out vec4 vBorderColor; + flat out vec2 vBorderWidth; + flat out vec4 vIndex; + + void main(void) { + int vid = gl_VertexID; + vec2 position = aPosition; // TODO make this a vec3, simplifies some code below + + if(aVertType == `.concat(sg,`) { + float texX = aTex.x; // texture coordinates + float texY = aTex.y; + float texW = aTex.z; + float texH = aTex.w; + + if(vid == 1 || vid == 2 || vid == 4) { + texX += texW; + } + if(vid == 2 || vid == 4 || vid == 5) { + texY += texH; + } + + float d = float(uAtlasSize); + vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1 + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat(Nu," || aVertType == ").concat(as,` + || aVertType == `).concat(df," || aVertType == ").concat(rs,`) { // simple shapes + + // the bounding box is needed by the fragment shader + vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat + vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat + vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated + + // calculations are done in the fragment shader, just pass these along + vColor = aColor; + vCornerRadius = aCornerRadius; + vBorderColor = aBorderColor; + vBorderWidth = aLineWidth; + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat(iC,`) { + vec2 source = aPointAPointB.xy; + vec2 target = aPointAPointB.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + // stretch the unit square into a long skinny rectangle + vec2 xBasis = target - source; + vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x)); + vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y; + + gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0); + vColor = aColor; + } + else if(aVertType == `).concat(uC,`) { + vec2 pointA = aPointAPointB.xy; + vec2 pointB = aPointAPointB.zw; + vec2 pointC = aPointCPointD.xy; + vec2 pointD = aPointCPointD.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + vec2 p0, p1, p2, pos; + if(position.x == 0.0) { // The left side of the unit square + p0 = pointA; + p1 = pointB; + p2 = pointC; + pos = position; + } else { // The right side of the unit square, use same approach but flip the geometry upside down + p0 = pointD; + p1 = pointC; + p2 = pointB; + pos = vec2(0.0, -position.y); + } + + vec2 p01 = p1 - p0; + vec2 p12 = p2 - p1; + vec2 p21 = p1 - p2; + + // Find the normal vector. + vec2 tangent = normalize(normalize(p12) + normalize(p01)); + vec2 normal = vec2(-tangent.y, tangent.x); + + // Find the vector perpendicular to p0 -> p1. + vec2 p01Norm = normalize(vec2(-p01.y, p01.x)); + + // Determine the bend direction. + float sigma = sign(dot(p01 + p21, normal)); + float width = aLineWidth[0]; + + if(sign(pos.y) == -sigma) { + // This is an intersecting vertex. Adjust the position so that there's no overlap. + vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } else { + // This is a non-intersecting vertex. Treat it like a mitre join. + vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } + + vColor = aColor; + } + else if(aVertType == `).concat(og,` && vid < 3) { + // massage the first triangle into an edge arrow + if(vid == 0) + position = vec2(-0.15, -0.3); + if(vid == 1) + position = vec2( 0.0, 0.0); + if(vid == 2) + position = vec2( 0.15, -0.3); + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + vColor = aColor; + } + else { + gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space + } + + vAtlasId = aAtlasId; + vVertType = aVertType; + vIndex = aIndex; + } + `),l=this.batchManager.getIndexArray(),s=`#version 300 es + precision highp float; + + // declare texture unit for each texture atlas in the batch + `.concat(l.map(function(c){return"uniform sampler2D uTexture".concat(c,";")}).join(` + `),` + + uniform vec4 uBGColor; + uniform float uZoom; + + in vec2 vTexCoord; + in vec4 vColor; + in vec2 vPosition; // model coordinates + + flat in int vAtlasId; + flat in vec4 vIndex; + flat in int vVertType; + flat in vec2 vTopRight; + flat in vec2 vBotLeft; + flat in vec4 vCornerRadius; + flat in vec4 vBorderColor; + flat in vec2 vBorderWidth; + + out vec4 outColor; + + `).concat(oI,` + `).concat(fI,` + `).concat(cI,` + `).concat(vI,` + + vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha + return vec4( + top.rgb + (bot.rgb * (1.0 - top.a)), + top.a + (bot.a * (1.0 - top.a)) + ); + } + + vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance + // scale to the zoom level so that borders don't look blurry when zoomed in + // note 1.5 is an aribitrary value chosen because it looks good + return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); + } + + void main(void) { + if(vVertType == `).concat(sg,`) { + // look up the texel from the texture unit + `).concat(l.map(function(c){return"if(vAtlasId == ".concat(c,") outColor = texture(uTexture").concat(c,", vTexCoord);")}).join(` + else `),` + } + else if(vVertType == `).concat(og,`) { + // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out'; + outColor = blend(vColor, uBGColor); + outColor.a = 1.0; // make opaque, masks out line under arrow + } + else if(vVertType == `).concat(Nu,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border + outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done + } + else if(vVertType == `).concat(Nu," || vVertType == ").concat(as,` + || vVertType == `).concat(df," || vVertType == ").concat(rs,`) { // use SDF + + float outerBorder = vBorderWidth[0]; + float innerBorder = vBorderWidth[1]; + float borderPadding = outerBorder * 2.0; + float w = vTopRight.x - vBotLeft.x - borderPadding; + float h = vTopRight.y - vBotLeft.y - borderPadding; + vec2 b = vec2(w/2.0, h/2.0); // half width, half height + vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center + + float d; // signed distance + if(vVertType == `).concat(Nu,`) { + d = rectangleSD(p, b); + } else if(vVertType == `).concat(as,` && w == h) { + d = circleSD(p, b.x); // faster than ellipse + } else if(vVertType == `).concat(as,`) { + d = ellipseSD(p, b); + } else { + d = roundRectangleSD(p, b, vCornerRadius.wzyx); + } + + // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling + // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box + if(d > 0.0) { + if(d > outerBorder) { + discard; + } else { + outColor = distInterp(vBorderColor, vec4(0), d - outerBorder); + } + } else { + if(d > innerBorder) { + vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor; + vec4 innerBorderColor = blend(vBorderColor, vColor); + outColor = distInterp(innerBorderColor, outerColor, d); + } + else { + vec4 outerColor; + if(innerBorder == 0.0 && outerBorder == 0.0) { + outerColor = vec4(0); + } else if(innerBorder == 0.0) { + outerColor = vBorderColor; + } else { + outerColor = blend(vBorderColor, vColor); + } + outColor = distInterp(vColor, outerColor, d - innerBorder); + } + } + } + else { + outColor = vColor; + } + + `).concat(r.picking?`if(outColor.a == 0.0) discard; + else outColor = vIndex;`:"",` + } + `),o=FP(a,i,s);o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aTransform=a.getAttribLocation(o,"aTransform"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex=a.getAttribLocation(o,"aTex"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aColor=a.getAttribLocation(o,"aColor"),o.aCornerRadius=a.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=a.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uZoom=a.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var v=0;v1&&arguments[1]!==void 0?arguments[1]:vs.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,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(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,i){var l=this.atlasManager,s=this.batchManager,o=l.getRenderTypeOpts(i);if(this._isVisible(r,o)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&o.getTexPickingMode){var v=o.getTexPickingMode(r);if(v===Pf.IGNORE)return;if(v==Pf.USE_BB){this.drawPickingRectangle(r,a,i);return}}var c=l.getAtlasInfo(r,i),d=jr(c),g;try{for(d.s();!(g=d.n()).done;){var p=g.value,y=p.atlas,b=p.tex1,x=p.tex2;s.canAddToCurrentBatch(y)||this.endBatch();for(var E=s.getAtlasIndexForBatch(y),S=0,T=[[b,!0],[x,!1]];S=this.maxInstances&&this.endBatch()}}}}catch(N){d.e(N)}finally{d.f()}}}},{key:"setTransformMatrix",value:function(r,a,i,l){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(i.shapeProps&&i.shapeProps.padding&&(o=r.pstyle(i.shapeProps.padding).pfValue),l){var v=l.bb,c=l.tex1,d=l.tex2,g=c.w/(c.w+d.w);s||(g=1-g);var p=this._getAdjustedBB(v,o,s,g);this._applyTransformMatrix(a,p,i,r)}else{var y=i.getBoundingBox(r),b=this._getAdjustedBB(y,o,!0,1);this._applyTransformMatrix(a,b,i,r)}}},{key:"_applyTransformMatrix",value:function(r,a,i,l){var s,o;aC(r);var v=i.getRotation?i.getRotation(l):0;if(v!==0){var c=i.getRotationPoint(l),d=c.x,g=c.y;Tf(r,r,[d,g]),nC(r,r,v);var p=i.getRotationOffset(l);s=p.x+(a.xOffset||0),o=p.y+(a.yOffset||0)}else s=a.x1,o=a.y1;Tf(r,r,[s,o]),Kb(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,i,l){var s=r.x1,o=r.y1,v=r.w,c=r.h,d=r.yOffset;a&&(s-=a,o-=a,v+=2*a,c+=2*a);var g=0,p=v*l;return i&&l<1?v=p:!i&&l<1&&(g=v-p,s+=g,v=p),{x1:s,y1:o,w:v,h:c,xOffset:g,yOffset:d}}},{key:"drawPickingRectangle",value:function(r,a,i){var l=this.atlasManager.getRenderTypeOpts(i),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=Nu;var o=this.indexBuffer.getView(s);zu(a,o);var v=this.colorBuffer.getView(s);Bi([0,0,0],1,v);var c=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(r,c,l),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,i){var l=this.simpleShapeOptions.get(i);if(this._isVisible(r,l)){var s=l.shapeProps,o=this._getVertTypeForShape(r,s.shape);if(o===void 0||l.isSimple&&!l.isSimple(r,this.renderTarget)){this.drawTexture(r,a,i);return}var v=this.instanceCount;if(this.vertTypeBuffer.getView(v)[0]=o,o===df||o===rs){var c=l.getBoundingBox(r),d=this._getCornerRadius(r,s.radius,c),g=this.cornerRadiusBuffer.getView(v);g[0]=d,g[1]=d,g[2]=d,g[3]=d,o===rs&&(g[0]=0,g[2]=0)}var p=this.indexBuffer.getView(v);zu(a,p);var y=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,b=this.renderTarget.picking?1:r.pstyle(s.opacity).value*y,x=r.pstyle(s.color).value,E=this.colorBuffer.getView(v);Bi(x,b,E);var S=this.lineWidthBuffer.getView(v);if(S[0]=0,S[1]=0,s.border){var T=r.pstyle("border-width").value;if(T>0){var C=r.pstyle("border-color").value,_=y*r.pstyle("border-opacity").value,R=this.borderColorBuffer.getView(v);Bi(C,_,R);var M=r.pstyle("border-position").value;if(M==="inside")S[0]=0,S[1]=-T;else if(M==="outside")S[0]=T,S[1]=0;else{var A=T/2;S[0]=A,S[1]=-A}}}var O=this.transformBuffer.getMatrixView(v);this.setTransformMatrix(r,O,l),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var i=r.pstyle(a).value;switch(i){case"rectangle":return Nu;case"ellipse":return as;case"roundrectangle":case"round-rectangle":return df;case"bottom-round-rectangle":return rs;default:return}}},{key:"_getCornerRadius",value:function(r,a,i){var l=i.w,s=i.h;if(r.pstyle(a).value==="auto")return ei(l,s);var o=r.pstyle(a).pfValue,v=l/2,c=s/2;return Math.min(o,c,v)}},{key:"drawEdgeArrow",value:function(r,a,i){if(r.visible()){var l=r._private.rscratch,s,o,v;if(i==="source"?(s=l.arrowStartX,o=l.arrowStartY,v=l.srcArrowAngle):(s=l.arrowEndX,o=l.arrowEndY,v=l.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(v)||v==null)){var c=r.pstyle(i+"-arrow-shape").value;if(c!=="none"){var d=r.pstyle(i+"-arrow-color").value,g=r.pstyle("opacity").value,p=r.pstyle("line-opacity").value,y=g*p,b=r.pstyle("width").pfValue,x=r.pstyle("arrow-scale").value,E=this.r.getArrowWidth(b,x),S=this.instanceCount,T=this.transformBuffer.getMatrixView(S);aC(T),Tf(T,T,[s,o]),Kb(T,T,[E,E]),nC(T,T,v),this.vertTypeBuffer.getView(S)[0]=og;var C=this.indexBuffer.getView(S);zu(a,C);var _=this.colorBuffer.getView(S);Bi(d,y,_),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var i=this._getEdgePoints(r);if(i){var l=r.pstyle("opacity").value,s=r.pstyle("line-opacity").value,o=r.pstyle("width").pfValue,v=r.pstyle("line-color").value,c=l*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=iC;var g=this.indexBuffer.getView(d);zu(a,g);var p=this.colorBuffer.getView(d);Bi(v,c,p);var y=this.lineWidthBuffer.getView(d);y[0]=o;var b=this.pointAPointBBuffer.getView(d);b[0]=i[0],b[1]=i[1],b[2]=i[2],b[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var x=0;x=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var i=a.allpts;if(i.length==4)return i;var l=this._getNumSegments(r);return this._getCurveSegmentPoints(i,l)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var i=Array((a+1)*2),l=0;l<=a;l++)if(l==0)i[0]=r[0],i[1]=r[1];else if(l==a)i[l*2]=r[r.length-2],i[l*2+1]=r[r.length-1];else{var s=l/a;this._setCurvePoint(r,s,i,l*2)}return i}},{key:"_setCurvePoint",value:function(r,a,i,l){if(r.length<=2)i[l]=r[0],i[l+1]=r[1];else{for(var s=Array(r.length-2),o=0;o0}},o=function(g){var p=g.pstyle("text-events").strValue==="yes";return p?Pf.USE_BB:Pf.IGNORE},v=function(g){var p=g.position(),y=p.x,b=p.y,x=g.outerWidth(),E=g.outerHeight();return{w:x,h:E,x1:y-x/2,y1:b-E/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:v,isSimple:XP,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:v,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:v,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:fg(e.getLabelKey,null),getBoundingBox:cg(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:l("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:fg(e.getSourceLabelKey,"source"),getBoundingBox:cg(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:l("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:fg(e.getTargetLabelKey,"target"),getBoundingBox:cg(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:l("target-label")});var c=Rs(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(d,g){var p=!1;g&&g.length>0&&(p|=r.drawing.invalidate(g)),p&&c()}),gI(r)};function hI(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return IM(r)}function dB(t,e){var r=t._private.rscratch;return Hr(r,"labelWrapCachedLines",e)||[]}var fg=function(e,r){return function(a){var i=e(a),l=dB(a,r);return l.length>1?l.map(function(s,o){return"".concat(i,"_").concat(o)}):i}},cg=function(e,r){return function(a,i){var l=e(a);if(typeof i=="string"){var s=i.indexOf("_");if(s>0){var o=Number(i.substring(s+1)),v=dB(a,r),c=l.h/v.length,d=c*o,g=l.y1+d;return{x1:l.x1,w:l.w,y1:g,h:c,yOffset:d}}}return l}};function gI(t){{var e=t.render;t.render=function(l){l=l||{};var s=t.cy;t.webgl&&(s.zoom()>iB?(pI(t),e.call(t,l)):(yI(t),gB(t,l,vs.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(l){r.call(t,l),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(l,s,o,v){return xI(t,l,s)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(l,s){i.call(t,l,s),l==="viewport"||l==="bounds"?t.pickingFrameBuffer.needsDraw=!0:l==="background"&&t.drawing.invalidate(s,{type:"node-body"})}}}function pI(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function yI(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function mI(t){var e=t.canvasWidth,r=t.canvasHeight,a=S1(t),i=a.pan,l=a.zoom,s=lg();Tf(s,s,[i.x,i.y]),Kb(s,s,[l,l]);var o=lg();aI(o,e,r);var v=lg();return rI(v,o,s),v}function hB(t,e){var r=t.canvasWidth,a=t.canvasHeight,i=S1(t),l=i.pan,s=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(l.x,l.y),e.scale(s,s)}function bI(t,e){t.drawSelectionRectangle(e,function(r){return hB(t,r)})}function wI(t){var e=t.data.contexts[t.NODE];e.save(),hB(t,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 EI(t){var e=function(i,l,s){for(var o=i.atlasManager.getAtlasCollection(l),v=t.data.contexts[t.NODE],c=o.atlases,d=0;d=0&&_.add(A)}return _}function xI(t,e,r){var a=SI(t,e,r),i=t.getCachedZSortedEles(),l,s,o=jr(a),v;try{for(o.s();!(v=o.n()).done;){var c=v.value,d=i[c];if(!l&&d.isNode()&&(l=d),!s&&d.isEdge()&&(s=d),l&&s)break}}catch(g){o.e(g)}finally{o.f()}return[l,s].filter(Boolean)}function vg(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function gB(t,e,r){var a;t.webglDebug&&(a=performance.now());var i=t.drawing,l=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&bI(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var s=t.data.contexts[t.WEBGL];r.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=mI(t),v=t.getCachedZSortedEles();if(l=v.length,i.startFrame(o,r),r.screen){for(var c=0;c0&&s>0){y.clearRect(0,0,l,s),y.globalCompositeOperation="source-over";var b=this.getCachedZSortedEles();if(t.full)y.translate(-a.x1*c,-a.y1*c),y.scale(c,c),this.drawElements(y,b),y.scale(1/c,1/c),y.translate(a.x1*c,a.y1*c);else{var x=e.pan(),E={x:x.x*c,y:x.y*c};c*=e.zoom(),y.translate(E.x,E.y),y.scale(c,c),this.drawElements(y,b),y.scale(1/c,1/c),y.translate(-E.x,-E.y)}t.bg&&(y.globalCompositeOperation="destination-over",y.fillStyle=t.bg,y.rect(0,0,l,s),y.fill())}return p};function TI(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),i=new Uint8Array(a),l=0;l"u"?"undefined":or(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),i=a.document;r=i.createElement("canvas"),r.width=t,r.height=e}return r};[lB,Ua,dn,E1,Fi,si,Br,vB,oi,zs,mB].forEach(function(t){He(rt,t)});var AI=[{name:"null",impl:YO},{name:"base",impl:aB},{name:"canvas",impl:CI}],RI=[{type:"layout",extensions:Q4},{type:"renderer",extensions:AI}],wB={},EB={};function SB(t,e,r){var a=r,i=function(O){yt("Can not register `"+e+"` for `"+t+"` since `"+O+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Es.prototype[e])return i(e);Es.prototype[e]=r}else if(t==="collection"){if(Er.prototype[e])return i(e);Er.prototype[e]=r}else if(t==="layout"){for(var l=function(O){this.options=O,r.call(this,O),ct(this._private)||(this._private={}),this._private.cy=O.cy,this._private.listeners=[],this.createEmitter()},s=l.prototype=Object.create(r.prototype),o=[],v=0;v-1}return mg=e,mg}var bg,pC;function LI(){if(pC)return bg;pC=1;var t=ic();function e(r,a){var i=this.__data__,l=t(i,r);return l<0?(++this.size,i.push([r,a])):i[l][1]=a,this}return bg=e,bg}var wg,yC;function uc(){if(yC)return wg;yC=1;var t=BI(),e=qI(),r=zI(),a=NI(),i=LI();function l(s){var o=-1,v=s==null?0:s.length;for(this.clear();++o-1&&a%1==0&&a-1&&r%1==0&&r<=t}return gp=e,gp}var pp,h_;function o6(){if(h_)return pp;h_=1;var t=ji(),e=A1(),r=Va(),a="[object Arguments]",i="[object Array]",l="[object Boolean]",s="[object Date]",o="[object Error]",v="[object Function]",c="[object Map]",d="[object Number]",g="[object Object]",p="[object RegExp]",y="[object Set]",b="[object String]",x="[object WeakMap]",E="[object ArrayBuffer]",S="[object DataView]",T="[object Float32Array]",C="[object Float64Array]",_="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",A="[object Uint8Array]",O="[object Uint8ClampedArray]",B="[object Uint16Array]",z="[object Uint32Array]",N={};N[T]=N[C]=N[_]=N[R]=N[M]=N[A]=N[O]=N[B]=N[z]=!0,N[a]=N[i]=N[E]=N[l]=N[S]=N[s]=N[o]=N[v]=N[c]=N[d]=N[g]=N[p]=N[y]=N[b]=N[x]=!1;function k(P){return r(P)&&e(P.length)&&!!N[t(P)]}return pp=k,pp}var yp,g_;function dc(){if(g_)return yp;g_=1;function t(e){return function(r){return e(r)}}return yp=t,yp}var ss={exports:{}};ss.exports;var p_;function R1(){return p_||(p_=1,(function(t,e){var r=TB(),a=e&&!e.nodeType&&e,i=a&&!0&&t&&!t.nodeType&&t,l=i&&i.exports===a,s=l&&r.process,o=(function(){try{var v=i&&i.require&&i.require("util").types;return v||s&&s.binding&&s.binding("util")}catch{}})();t.exports=o})(ss,ss.exports)),ss.exports}var mp,y_;function Ps(){if(y_)return mp;y_=1;var t=o6(),e=dc(),r=R1(),a=r&&r.isTypedArray,i=a?e(a):t;return mp=i,mp}var bp,m_;function AB(){if(m_)return bp;m_=1;var t=u6(),e=ks(),r=ir(),a=rl(),i=vc(),l=Ps(),s=Object.prototype,o=s.hasOwnProperty;function v(c,d){var g=r(c),p=!g&&e(c),y=!g&&!p&&a(c),b=!g&&!p&&!y&&l(c),x=g||p||y||b,E=x?t(c.length,String):[],S=E.length;for(var T in c)(d||o.call(c,T))&&!(x&&(T=="length"||y&&(T=="offset"||T=="parent")||b&&(T=="buffer"||T=="byteLength"||T=="byteOffset")||i(T,S)))&&E.push(T);return E}return bp=v,bp}var wp,b_;function hc(){if(b_)return wp;b_=1;var t=Object.prototype;function e(r){var a=r&&r.constructor,i=typeof a=="function"&&a.prototype||t;return r===i}return wp=e,wp}var Ep,w_;function RB(){if(w_)return Ep;w_=1;function t(e,r){return function(a){return e(r(a))}}return Ep=t,Ep}var Sp,E_;function f6(){if(E_)return Sp;E_=1;var t=RB(),e=t(Object.keys,Object);return Sp=e,Sp}var xp,S_;function D1(){if(S_)return xp;S_=1;var t=hc(),e=f6(),r=Object.prototype,a=r.hasOwnProperty;function i(l){if(!t(l))return e(l);var s=[];for(var o in Object(l))a.call(l,o)&&o!="constructor"&&s.push(o);return s}return xp=i,xp}var Tp,x_;function hn(){if(x_)return Tp;x_=1;var t=Ns(),e=A1();function r(a){return a!=null&&e(a.length)&&!t(a)}return Tp=r,Tp}var Cp,T_;function fi(){if(T_)return Cp;T_=1;var t=AB(),e=D1(),r=hn();function a(i){return r(i)?t(i):e(i)}return Cp=a,Cp}var _p,C_;function c6(){if(C_)return _p;C_=1;var t=Ls(),e=fi();function r(a,i){return a&&t(i,e(i),a)}return _p=r,_p}var Ap,__;function v6(){if(__)return Ap;__=1;function t(e){var r=[];if(e!=null)for(var a in Object(e))r.push(a);return r}return Ap=t,Ap}var Rp,A_;function d6(){if(A_)return Rp;A_=1;var t=ya(),e=hc(),r=v6(),a=Object.prototype,i=a.hasOwnProperty;function l(s){if(!t(s))return r(s);var o=e(s),v=[];for(var c in s)c=="constructor"&&(o||!i.call(s,c))||v.push(c);return v}return Rp=l,Rp}var Dp,R_;function Ki(){if(R_)return Dp;R_=1;var t=AB(),e=d6(),r=hn();function a(i){return r(i)?t(i,!0):e(i)}return Dp=a,Dp}var Mp,D_;function h6(){if(D_)return Mp;D_=1;var t=Ls(),e=Ki();function r(a,i){return a&&t(i,e(i),a)}return Mp=r,Mp}var os={exports:{}};os.exports;var M_;function DB(){return M_||(M_=1,(function(t,e){var r=Ra(),a=e&&!e.nodeType&&e,i=a&&!0&&t&&!t.nodeType&&t,l=i&&i.exports===a,s=l?r.Buffer:void 0,o=s?s.allocUnsafe:void 0;function v(c,d){if(d)return c.slice();var g=c.length,p=o?o(g):new c.constructor(g);return c.copy(p),p}t.exports=v})(os,os.exports)),os.exports}var Op,O_;function MB(){if(O_)return Op;O_=1;function t(e,r){var a=-1,i=e.length;for(r||(r=Array(i));++ay))return!1;var x=g.get(s),E=g.get(o);if(x&&E)return x==o&&E==s;var S=-1,T=!0,C=v&i?new t:void 0;for(g.set(s,o),g.set(o,s);++S0&&l(d)?i>1?r(d,i-1,l,s,o):t(o,d):s||(o[o.length]=d)}return o}return Sm=r,Sm}var xm,xR;function cU(){if(xR)return xm;xR=1;function t(e,r,a){switch(a.length){case 0:return e.call(r);case 1:return e.call(r,a[0]);case 2:return e.call(r,a[0],a[1]);case 3:return e.call(r,a[0],a[1],a[2])}return e.apply(r,a)}return xm=t,xm}var Tm,TR;function lq(){if(TR)return Tm;TR=1;var t=cU(),e=Math.max;function r(a,i,l){return i=e(i===void 0?a.length-1:i,0),function(){for(var s=arguments,o=-1,v=e(s.length-i,0),c=Array(v);++o0){if(++l>=t)return arguments[0]}else l=0;return i.apply(void 0,arguments)}}return _m=a,_m}var Am,AR;function sq(){if(AR)return Am;AR=1;var t=vU(),e=dU(),r=e(t);return Am=r,Am}var Rm,RR;function wc(){if(RR)return Rm;RR=1;var t=Xi(),e=lq(),r=sq();function a(i,l){return r(e(i,l,t),i+"")}return Rm=a,Rm}var Dm,DR;function oq(){if(DR)return Dm;DR=1;function t(e,r,a,i){for(var l=e.length,s=a+(i?1:-1);i?s--:++s-1}return qm=e,qm}var zm,zR;function mU(){if(zR)return zm;zR=1;function t(e,r,a){for(var i=-1,l=e==null?0:e.length;++i=s){var S=c?null:i(v);if(S)return l(S);b=!1,p=a,E=new t}else E=c?[]:x;e:for(;++g1?y.setNode(b,g):y.setNode(b)}),this},i.prototype.setNode=function(d,g){return t.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=g),this):(this._nodes[d]=arguments.length>1?g:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},i.prototype.node=function(d){return this._nodes[d]},i.prototype.hasNode=function(d){return t.has(this._nodes,d)},i.prototype.removeNode=function(d){var g=this;if(t.has(this._nodes,d)){var p=function(y){g.removeEdge(g._edgeObjs[y])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],t.each(this.children(d),function(y){g.setParent(y)}),delete this._children[d]),t.each(t.keys(this._in[d]),p),delete this._in[d],delete this._preds[d],t.each(t.keys(this._out[d]),p),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},i.prototype.setParent=function(d,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(g))g=r;else{g+="";for(var p=g;!t.isUndefined(p);p=this.parent(p))if(p===d)throw new Error("Setting "+g+" as parent of "+d+" would create a cycle");this.setNode(g)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=g,this._children[g][d]=!0,this},i.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},i.prototype.parent=function(d){if(this._isCompound){var g=this._parent[d];if(g!==r)return g}},i.prototype.children=function(d){if(t.isUndefined(d)&&(d=r),this._isCompound){var g=this._children[d];if(g)return t.keys(g)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},i.prototype.predecessors=function(d){var g=this._preds[d];if(g)return t.keys(g)},i.prototype.successors=function(d){var g=this._sucs[d];if(g)return t.keys(g)},i.prototype.neighbors=function(d){var g=this.predecessors(d);if(g)return t.union(g,this.successors(d))},i.prototype.isLeaf=function(d){var g;return this.isDirected()?g=this.successors(d):g=this.neighbors(d),g.length===0},i.prototype.filterNodes=function(d){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var p=this;t.each(this._nodes,function(x,E){d(E)&&g.setNode(E,x)}),t.each(this._edgeObjs,function(x){g.hasNode(x.v)&&g.hasNode(x.w)&&g.setEdge(x,p.edge(x))});var y={};function b(x){var E=p.parent(x);return E===void 0||g.hasNode(E)?(y[x]=E,E):E in y?y[E]:b(E)}return this._isCompound&&t.each(g.nodes(),function(x){g.setParent(x,b(x))}),g},i.prototype.setDefaultEdgeLabel=function(d){return t.isFunction(d)||(d=t.constant(d)),this._defaultEdgeLabelFn=d,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return t.values(this._edgeObjs)},i.prototype.setPath=function(d,g){var p=this,y=arguments;return t.reduce(d,function(b,x){return y.length>1?p.setEdge(b,x,g):p.setEdge(b,x),x}),this},i.prototype.setEdge=function(){var d,g,p,y,b=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(d=x.v,g=x.w,p=x.name,arguments.length===2&&(y=arguments[1],b=!0)):(d=x,g=arguments[1],p=arguments[3],arguments.length>2&&(y=arguments[2],b=!0)),d=""+d,g=""+g,t.isUndefined(p)||(p=""+p);var E=o(this._isDirected,d,g,p);if(t.has(this._edgeLabels,E))return b&&(this._edgeLabels[E]=y),this;if(!t.isUndefined(p)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(g),this._edgeLabels[E]=b?y:this._defaultEdgeLabelFn(d,g,p);var S=v(this._isDirected,d,g,p);return d=S.v,g=S.w,Object.freeze(S),this._edgeObjs[E]=S,l(this._preds[g],d),l(this._sucs[d],g),this._in[g][E]=S,this._out[d][E]=S,this._edgeCount++,this},i.prototype.edge=function(d,g,p){var y=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,d,g,p);return this._edgeLabels[y]},i.prototype.hasEdge=function(d,g,p){var y=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,d,g,p);return t.has(this._edgeLabels,y)},i.prototype.removeEdge=function(d,g,p){var y=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,d,g,p),b=this._edgeObjs[y];return b&&(d=b.v,g=b.w,delete this._edgeLabels[y],delete this._edgeObjs[y],s(this._preds[g],d),s(this._sucs[d],g),delete this._in[g][y],delete this._out[d][y],this._edgeCount--),this},i.prototype.inEdges=function(d,g){var p=this._in[d];if(p){var y=t.values(p);return g?t.filter(y,function(b){return b.v===g}):y}},i.prototype.outEdges=function(d,g){var p=this._out[d];if(p){var y=t.values(p);return g?t.filter(y,function(b){return b.w===g}):y}},i.prototype.nodeEdges=function(d,g){var p=this.inEdges(d,g);if(p)return p.concat(this.outEdges(d,g))};function l(d,g){d[g]?d[g]++:d[g]=1}function s(d,g){--d[g]||delete d[g]}function o(d,g,p,y){var b=""+g,x=""+p;if(!d&&b>x){var E=b;b=x,x=E}return b+a+x+a+(t.isUndefined(y)?e:y)}function v(d,g,p,y){var b=""+g,x=""+p;if(!d&&b>x){var E=b;b=x,x=E}var S={v:b,w:x};return y&&(S.name=y),S}function c(d,g){return o(d,g.v,g.w,g.name)}return Hm}var Fm,FR;function TU(){return FR||(FR=1,Fm="2.1.8"),Fm}var jm,jR;function CU(){return jR||(jR=1,jm={Graph:I1(),version:TU()}),jm}var Ym,YR;function _U(){if(YR)return Ym;YR=1;var t=ma(),e=I1();Ym={write:r,read:l};function r(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:a(s),edges:i(s)};return t.isUndefined(s.graph())||(o.value=t.clone(s.graph())),o}function a(s){return t.map(s.nodes(),function(o){var v=s.node(o),c=s.parent(o),d={v:o};return t.isUndefined(v)||(d.value=v),t.isUndefined(c)||(d.parent=c),d})}function i(s){return t.map(s.edges(),function(o){var v=s.edge(o),c={v:o.v,w:o.w};return t.isUndefined(o.name)||(c.name=o.name),t.isUndefined(v)||(c.value=v),c})}function l(s){var o=new e(s.options).setGraph(s.value);return t.each(s.nodes,function(v){o.setNode(v.v,v.value),v.parent&&o.setParent(v.v,v.parent)}),t.each(s.edges,function(v){o.setEdge({v:v.v,w:v.w,name:v.name},v.value)}),o}return Ym}var Km,KR;function AU(){if(KR)return Km;KR=1;var t=ma();Km=e;function e(r){var a={},i=[],l;function s(o){t.has(a,o)||(a[o]=!0,l.push(o),t.each(r.successors(o),s),t.each(r.predecessors(o),s))}return t.each(r.nodes(),function(o){l=[],s(o),l.length&&i.push(l)}),i}return Km}var Xm,XR;function vq(){if(XR)return Xm;XR=1;var t=ma();Xm=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(r){return r.key})},e.prototype.has=function(r){return t.has(this._keyIndices,r)},e.prototype.priority=function(r){var a=this._keyIndices[r];if(a!==void 0)return this._arr[a].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(r,a){var i=this._keyIndices;if(r=String(r),!t.has(i,r)){var l=this._arr,s=l.length;return i[r]=s,l.push({key:r,priority:a}),this._decrease(s),!0}return!1},e.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},e.prototype.decrease=function(r,a){var i=this._keyIndices[r];if(a>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+a);this._arr[i].priority=a,this._decrease(i)},e.prototype._heapify=function(r){var a=this._arr,i=2*r,l=i+1,s=r;i>1,!(a[l].priority0&&(g=d.removeMin(),p=c[g],p.distance!==Number.POSITIVE_INFINITY);)v(g).forEach(y);return c}return $m}var Zm,ZR;function RU(){if(ZR)return Zm;ZR=1;var t=dq(),e=ma();Zm=r;function r(a,i,l){return e.transform(a.nodes(),function(s,o){s[o]=t(a,o,i,l)},{})}return Zm}var Qm,QR;function hq(){if(QR)return Qm;QR=1;var t=ma();Qm=e;function e(r){var a=0,i=[],l={},s=[];function o(v){var c=l[v]={onStack:!0,lowlink:a,index:a++};if(i.push(v),r.successors(v).forEach(function(p){t.has(l,p)?l[p].onStack&&(c.lowlink=Math.min(c.lowlink,l[p].index)):(o(p),c.lowlink=Math.min(c.lowlink,l[p].lowlink))}),c.lowlink===c.index){var d=[],g;do g=i.pop(),l[g].onStack=!1,d.push(g);while(v!==g);s.push(d)}}return r.nodes().forEach(function(v){t.has(l,v)||o(v)}),s}return Qm}var Wm,WR;function DU(){if(WR)return Wm;WR=1;var t=ma(),e=hq();Wm=r;function r(a){return t.filter(e(a),function(i){return i.length>1||i.length===1&&a.hasEdge(i[0],i[0])})}return Wm}var Jm,JR;function MU(){if(JR)return Jm;JR=1;var t=ma();Jm=r;var e=t.constant(1);function r(i,l,s){return a(i,l||e,s||function(o){return i.outEdges(o)})}function a(i,l,s){var o={},v=i.nodes();return v.forEach(function(c){o[c]={},o[c][c]={distance:0},v.forEach(function(d){c!==d&&(o[c][d]={distance:Number.POSITIVE_INFINITY})}),s(c).forEach(function(d){var g=d.v===c?d.w:d.v,p=l(d);o[c][g]={distance:p,predecessor:c}})}),v.forEach(function(c){var d=o[c];v.forEach(function(g){var p=o[g];v.forEach(function(y){var b=p[c],x=d[y],E=p[y],S=b.distance+x.distance;S0;){if(c=v.removeMin(),t.has(o,c))s.setEdge(c,o[c]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(c).forEach(d)}return s}return i0}var u0,uD;function NU(){return uD||(uD=1,u0={components:AU(),dijkstra:dq(),dijkstraAll:RU(),findCycles:DU(),floydWarshall:MU(),isAcyclic:OU(),postorder:BU(),preorder:qU(),prim:zU(),tarjan:hq(),topsort:gq()}),u0}var l0,lD;function LU(){if(lD)return l0;lD=1;var t=CU();return l0={Graph:t.Graph,json:_U(),alg:NU(),version:t.version},l0}var s0,sD;function _a(){if(sD)return s0;sD=1;var t;if(typeof x1=="function")try{t=LU()}catch{}return t||(t=window.graphlib),s0=t,s0}var o0,oD;function kU(){if(oD)return o0;oD=1;var t=VB(),e=1,r=4;function a(i){return t(i,e|r)}return o0=a,o0}var f0,fD;function Ec(){if(fD)return f0;fD=1;var t=el(),e=hn(),r=vc(),a=ya();function i(l,s,o){if(!a(o))return!1;var v=typeof s;return(v=="number"?e(o)&&r(s,o.length):v=="string"&&s in o)?t(o[s],l):!1}return f0=i,f0}var c0,cD;function PU(){if(cD)return c0;cD=1;var t=wc(),e=el(),r=Ec(),a=Ki(),i=Object.prototype,l=i.hasOwnProperty,s=t(function(o,v){o=Object(o);var c=-1,d=v.length,g=d>2?v[2]:void 0;for(g&&r(v[0],v[1],g)&&(d=1);++c-1?v[c?l[d]:d]:void 0}}return v0=a,v0}var d0,dD;function UU(){if(dD)return d0;dD=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return d0=e,d0}var h0,hD;function VU(){if(hD)return h0;hD=1;var t=UU(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return h0=r,h0}var g0,gD;function GU(){if(gD)return g0;gD=1;var t=VU(),e=ya(),r=nl(),a=NaN,i=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function v(c){if(typeof c=="number")return c;if(r(c))return a;if(e(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=e(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=t(c);var g=l.test(c);return g||s.test(c)?o(c.slice(2),g?2:8):i.test(c)?a:+c}return g0=v,g0}var p0,pD;function yq(){if(pD)return p0;pD=1;var t=GU(),e=1/0,r=17976931348623157e292;function a(i){if(!i)return i===0?i:0;if(i=t(i),i===e||i===-e){var l=i<0?-1:1;return l*r}return i===i?i:0}return p0=a,p0}var y0,yD;function HU(){if(yD)return y0;yD=1;var t=yq();function e(r){var a=t(r),i=a%1;return a===a?i?a-i:a:0}return y0=e,y0}var m0,mD;function FU(){if(mD)return m0;mD=1;var t=oq(),e=gn(),r=HU(),a=Math.max;function i(l,s,o){var v=l==null?0:l.length;if(!v)return-1;var c=o==null?0:r(o);return c<0&&(c=a(v+c,0)),t(l,e(s,3),c)}return m0=i,m0}var b0,bD;function jU(){if(bD)return b0;bD=1;var t=IU(),e=FU(),r=t(e);return b0=r,b0}var w0,wD;function mq(){if(wD)return w0;wD=1;var t=P1();function e(r){var a=r==null?0:r.length;return a?t(r,1):[]}return w0=e,w0}var E0,ED;function YU(){if(ED)return E0;ED=1;var t=z1(),e=GB(),r=Ki();function a(i,l){return i==null?i:t(i,e(l),r)}return E0=a,E0}var S0,SD;function KU(){if(SD)return S0;SD=1;function t(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}return S0=t,S0}var x0,xD;function XU(){if(xD)return x0;xD=1;var t=fc(),e=N1(),r=gn();function a(i,l){var s={};return l=r(l,3),e(i,function(o,v,c){t(s,v,l(o,v,c))}),s}return x0=a,x0}var T0,TD;function U1(){if(TD)return T0;TD=1;var t=nl();function e(r,a,i){for(var l=-1,s=r.length;++lr}return C0=t,C0}var _0,_D;function ZU(){if(_D)return _0;_D=1;var t=U1(),e=$U(),r=Xi();function a(i){return i&&i.length?t(i,r,e):void 0}return _0=a,_0}var A0,AD;function bq(){if(AD)return A0;AD=1;var t=fc(),e=el();function r(a,i,l){(l!==void 0&&!e(a[i],l)||l===void 0&&!(i in a))&&t(a,i,l)}return A0=r,A0}var R0,RD;function QU(){if(RD)return R0;RD=1;var t=ji(),e=gc(),r=Va(),a="[object Object]",i=Function.prototype,l=Object.prototype,s=i.toString,o=l.hasOwnProperty,v=s.call(Object);function c(d){if(!r(d)||t(d)!=a)return!1;var g=e(d);if(g===null)return!0;var p=o.call(g,"constructor")&&g.constructor;return typeof p=="function"&&p instanceof p&&s.call(p)==v}return R0=c,R0}var D0,DD;function wq(){if(DD)return D0;DD=1;function t(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}return D0=t,D0}var M0,MD;function WU(){if(MD)return M0;MD=1;var t=Ls(),e=Ki();function r(a){return t(a,e(a))}return M0=r,M0}var O0,OD;function JU(){if(OD)return O0;OD=1;var t=bq(),e=DB(),r=PB(),a=MB(),i=UB(),l=ks(),s=ir(),o=fq(),v=rl(),c=Ns(),d=ya(),g=QU(),p=Ps(),y=wq(),b=WU();function x(E,S,T,C,_,R,M){var A=y(E,T),O=y(S,T),B=M.get(O);if(B){t(E,T,B);return}var z=R?R(A,O,T+"",E,S,M):void 0,N=z===void 0;if(N){var k=s(O),P=!k&&v(O),G=!k&&!P&&p(O);z=O,k||P||G?s(A)?z=A:o(A)?z=a(A):P?(N=!1,z=e(O,!0)):G?(N=!1,z=r(O,!0)):z=[]:g(O)||l(O)?(z=A,l(A)?z=b(A):(!d(A)||c(A))&&(z=i(O))):N=!1}N&&(M.set(O,z),_(z,O,C,R,M),M.delete(O)),t(E,T,z)}return O0=x,O0}var B0,BD;function e8(){if(BD)return B0;BD=1;var t=oc(),e=bq(),r=z1(),a=JU(),i=ya(),l=Ki(),s=wq();function o(v,c,d,g,p){v!==c&&r(c,function(y,b){if(p||(p=new t),i(y))a(v,c,b,d,o,g,p);else{var x=g?g(s(v,b),y,b+"",v,c,p):void 0;x===void 0&&(x=y),e(v,b,x)}},l)}return B0=o,B0}var q0,qD;function t8(){if(qD)return q0;qD=1;var t=wc(),e=Ec();function r(a){return t(function(i,l){var s=-1,o=l.length,v=o>1?l[o-1]:void 0,c=o>2?l[2]:void 0;for(v=a.length>3&&typeof v=="function"?(o--,v):void 0,c&&e(l[0],l[1],c)&&(v=o<3?void 0:v,o=1),i=Object(i);++sa||o&&v&&d&&!c&&!g||l&&v&&d||!i&&d||!s)return 1;if(!l&&!o&&!g&&r=c)return d;var g=i[l];return d*(g=="desc"?-1:1)}}return r.index-a.index}return $0=e,$0}var Z0,ZD;function y8(){if(ZD)return Z0;ZD=1;var t=yc(),e=bc(),r=gn(),a=nq(),i=h8(),l=dc(),s=p8(),o=Xi(),v=ir();function c(d,g,p){g.length?g=t(g,function(x){return v(x)?function(E){return e(E,x.length===1?x[0]:x)}:x}):g=[o];var y=-1;g=t(g,l(r));var b=a(d,function(x,E,S){var T=t(g,function(C){return C(x)});return{criteria:T,index:++y,value:x}});return i(b,function(x,E){return s(x,E,p)})}return Z0=c,Z0}var Q0,QD;function m8(){if(QD)return Q0;QD=1;var t=P1(),e=y8(),r=wc(),a=Ec(),i=r(function(l,s){if(l==null)return[];var o=s.length;return o>1&&a(l,s[0],s[1])?s=[]:o>2&&a(s[0],s[1],s[2])&&(s=[s[0]]),e(l,t(s,1),[])});return Q0=i,Q0}var W0,WD;function b8(){if(WD)return W0;WD=1;var t=QB(),e=0;function r(a){var i=++e;return t(a)+i}return W0=r,W0}var J0,JD;function w8(){if(JD)return J0;JD=1;function t(e,r,a){for(var i=-1,l=e.length,s=r.length,o={};++i0;--E)if(x=d[E].dequeue(),x){p=p.concat(s(c,d,g,x,!0));break}}}return p}function s(c,d,g,p,y){var b=y?[]:void 0;return t.forEach(c.inEdges(p.v),function(x){var E=c.edge(x),S=c.node(x.v);y&&b.push({v:x.v,w:x.w}),S.out-=E,v(d,g,S)}),t.forEach(c.outEdges(p.v),function(x){var E=c.edge(x),S=x.w,T=c.node(S);T.in-=E,v(d,g,T)}),c.removeNode(p.v),b}function o(c,d){var g=new e,p=0,y=0;t.forEach(c.nodes(),function(E){g.setNode(E,{v:E,in:0,out:0})}),t.forEach(c.edges(),function(E){var S=g.edge(E.v,E.w)||0,T=d(E),C=S+T;g.setEdge(E.v,E.w,C),y=Math.max(y,g.node(E.v).out+=T),p=Math.max(p,g.node(E.w).in+=T)});var b=t.range(y+p+3).map(function(){return new r}),x=p+1;return t.forEach(g.nodes(),function(E){v(b,x,g.node(E))}),{graph:g,buckets:b,zeroIdx:x}}function v(c,d,g){g.out?g.in?c[g.out-g.in+d].enqueue(g):c[c.length-1].enqueue(g):c[0].enqueue(g)}return ab}var nb,nM;function T8(){if(nM)return nb;nM=1;var t=It(),e=x8();nb={run:r,undo:i};function r(l){var s=l.graph().acyclicer==="greedy"?e(l,o(l)):a(l);t.forEach(s,function(v){var c=l.edge(v);l.removeEdge(v),c.forwardName=v.name,c.reversed=!0,l.setEdge(v.w,v.v,c,t.uniqueId("rev"))});function o(v){return function(c){return v.edge(c).weight}}}function a(l){var s=[],o={},v={};function c(d){t.has(v,d)||(v[d]=!0,o[d]=!0,t.forEach(l.outEdges(d),function(g){t.has(o,g.w)?s.push(g):c(g.w)}),delete o[d])}return t.forEach(l.nodes(),c),s}function i(l){t.forEach(l.edges(),function(s){var o=l.edge(s);if(o.reversed){l.removeEdge(s);var v=o.forwardName;delete o.reversed,delete o.forwardName,l.setEdge(s.w,s.v,o,v)}})}return nb}var ib,iM;function Yr(){if(iM)return ib;iM=1;var t=It(),e=_a().Graph;ib={addDummyNode:r,simplify:a,asNonCompoundGraph:i,successorWeights:l,predecessorWeights:s,intersectRect:o,buildLayerMatrix:v,normalizeRanks:c,removeEmptyRanks:d,addBorderNode:g,maxRank:p,partition:y,time:b,notime:x};function r(E,S,T,C){var _;do _=t.uniqueId(C);while(E.hasNode(_));return T.dummy=S,E.setNode(_,T),_}function a(E){var S=new e().setGraph(E.graph());return t.forEach(E.nodes(),function(T){S.setNode(T,E.node(T))}),t.forEach(E.edges(),function(T){var C=S.edge(T.v,T.w)||{weight:0,minlen:1},_=E.edge(T);S.setEdge(T.v,T.w,{weight:C.weight+_.weight,minlen:Math.max(C.minlen,_.minlen)})}),S}function i(E){var S=new e({multigraph:E.isMultigraph()}).setGraph(E.graph());return t.forEach(E.nodes(),function(T){E.children(T).length||S.setNode(T,E.node(T))}),t.forEach(E.edges(),function(T){S.setEdge(T,E.edge(T))}),S}function l(E){var S=t.map(E.nodes(),function(T){var C={};return t.forEach(E.outEdges(T),function(_){C[_.w]=(C[_.w]||0)+E.edge(_).weight}),C});return t.zipObject(E.nodes(),S)}function s(E){var S=t.map(E.nodes(),function(T){var C={};return t.forEach(E.inEdges(T),function(_){C[_.v]=(C[_.v]||0)+E.edge(_).weight}),C});return t.zipObject(E.nodes(),S)}function o(E,S){var T=E.x,C=E.y,_=S.x-T,R=S.y-C,M=E.width/2,A=E.height/2;if(!_&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var O,B;return Math.abs(R)*M>Math.abs(_)*A?(R<0&&(A=-A),O=A*_/R,B=A):(_<0&&(M=-M),O=M,B=M*R/_),{x:T+O,y:C+B}}function v(E){var S=t.map(t.range(p(E)+1),function(){return[]});return t.forEach(E.nodes(),function(T){var C=E.node(T),_=C.rank;t.isUndefined(_)||(S[_][C.order]=T)}),S}function c(E){var S=t.min(t.map(E.nodes(),function(T){return E.node(T).rank}));t.forEach(E.nodes(),function(T){var C=E.node(T);t.has(C,"rank")&&(C.rank-=S)})}function d(E){var S=t.min(t.map(E.nodes(),function(R){return E.node(R).rank})),T=[];t.forEach(E.nodes(),function(R){var M=E.node(R).rank-S;T[M]||(T[M]=[]),T[M].push(R)});var C=0,_=E.graph().nodeRankFactor;t.forEach(T,function(R,M){t.isUndefined(R)&&M%_!==0?--C:C&&t.forEach(R,function(A){E.node(A).rank+=C})})}function g(E,S,T,C){var _={width:0,height:0};return arguments.length>=4&&(_.rank=T,_.order=C),r(E,"border",_,S)}function p(E){return t.max(t.map(E.nodes(),function(S){var T=E.node(S).rank;if(!t.isUndefined(T))return T}))}function y(E,S){var T={lhs:[],rhs:[]};return t.forEach(E,function(C){S(C)?T.lhs.push(C):T.rhs.push(C)}),T}function b(E,S){var T=t.now();try{return S()}finally{console.log(E+" time: "+(t.now()-T)+"ms")}}function x(E,S){return S()}return ib}var ub,uM;function C8(){if(uM)return ub;uM=1;var t=It(),e=Yr();ub={run:r,undo:i};function r(l){l.graph().dummyChains=[],t.forEach(l.edges(),function(s){a(l,s)})}function a(l,s){var o=s.v,v=l.node(o).rank,c=s.w,d=l.node(c).rank,g=s.name,p=l.edge(s),y=p.labelRank;if(d!==v+1){l.removeEdge(s);var b,x,E;for(E=0,++v;vB.lim&&(z=B,N=!0);var k=t.filter(_.edges(),function(P){return N===T(C,C.node(P.v),z)&&N!==T(C,C.node(P.w),z)});return t.minBy(k,function(P){return r(_,P)})}function x(C,_,R,M){var A=R.v,O=R.w;C.removeEdge(A,O),C.setEdge(M.v,M.w,{}),g(C),v(C,_),E(C,_)}function E(C,_){var R=t.find(C.nodes(),function(A){return!_.node(A).parent}),M=i(C,R);M=M.slice(1),t.forEach(M,function(A){var O=C.node(A).parent,B=_.edge(A,O),z=!1;B||(B=_.edge(O,A),z=!0),_.node(A).rank=_.node(O).rank+(z?B.minlen:-B.minlen)})}function S(C,_,R){return C.hasEdge(_,R)}function T(C,_,R){return R.low<=_.lim&&_.lim<=R.lim}return ob}var fb,fM;function A8(){if(fM)return fb;fM=1;var t=Uf(),e=t.longestPath,r=Sq(),a=_8();fb=i;function i(v){switch(v.graph().ranker){case"network-simplex":o(v);break;case"tight-tree":s(v);break;case"longest-path":l(v);break;default:o(v)}}var l=e;function s(v){e(v),r(v)}function o(v){a(v)}return fb}var cb,cM;function R8(){if(cM)return cb;cM=1;var t=It();cb=e;function e(i){var l=a(i);t.forEach(i.graph().dummyChains,function(s){for(var o=i.node(s),v=o.edgeObj,c=r(i,l,v.v,v.w),d=c.path,g=c.lca,p=0,y=d[p],b=!0;s!==v.w;){if(o=i.node(s),b){for(;(y=d[p])!==g&&i.node(y).maxRankd||g>l[p].lim));for(y=p,p=o;(p=i.parent(p))!==y;)c.push(p);return{path:v.concat(c.reverse()),lca:y}}function a(i){var l={},s=0;function o(v){var c=s;t.forEach(i.children(v),o),l[v]={low:c,lim:s++}}return t.forEach(i.children(),o),l}return cb}var vb,vM;function D8(){if(vM)return vb;vM=1;var t=It(),e=Yr();vb={run:r,cleanup:s};function r(o){var v=e.addDummyNode(o,"root",{},"_root"),c=i(o),d=t.max(t.values(c))-1,g=2*d+1;o.graph().nestingRoot=v,t.forEach(o.edges(),function(y){o.edge(y).minlen*=g});var p=l(o)+1;t.forEach(o.children(),function(y){a(o,v,g,p,d,c,y)}),o.graph().nodeRankFactor=g}function a(o,v,c,d,g,p,y){var b=o.children(y);if(!b.length){y!==v&&o.setEdge(v,y,{weight:0,minlen:c});return}var x=e.addBorderNode(o,"_bt"),E=e.addBorderNode(o,"_bb"),S=o.node(y);o.setParent(x,y),S.borderTop=x,o.setParent(E,y),S.borderBottom=E,t.forEach(b,function(T){a(o,v,c,d,g,p,T);var C=o.node(T),_=C.borderTop?C.borderTop:T,R=C.borderBottom?C.borderBottom:T,M=C.borderTop?d:2*d,A=_!==R?1:g-p[y]+1;o.setEdge(x,_,{weight:M,minlen:A,nestingEdge:!0}),o.setEdge(R,E,{weight:M,minlen:A,nestingEdge:!0})}),o.parent(y)||o.setEdge(v,x,{weight:0,minlen:g+p[y]})}function i(o){var v={};function c(d,g){var p=o.children(d);p&&p.length&&t.forEach(p,function(y){c(y,g+1)}),v[d]=g}return t.forEach(o.children(),function(d){c(d,1)}),v}function l(o){return t.reduce(o.edges(),function(v,c){return v+o.edge(c).weight},0)}function s(o){var v=o.graph();o.removeNode(v.nestingRoot),delete v.nestingRoot,t.forEach(o.edges(),function(c){var d=o.edge(c);d.nestingEdge&&o.removeEdge(c)})}return vb}var db,dM;function M8(){if(dM)return db;dM=1;var t=It(),e=Yr();db=r;function r(i){function l(s){var o=i.children(s),v=i.node(s);if(o.length&&t.forEach(o,l),t.has(v,"minRank")){v.borderLeft=[],v.borderRight=[];for(var c=v.minRank,d=v.maxRank+1;c0;)y%2&&(b+=d[y+1]),y=y-1>>1,d[y]+=p.weight;g+=p.weight*b})),g}return pb}var yb,yM;function z8(){if(yM)return yb;yM=1;var t=It();yb=e;function e(r,a){return t.map(a,function(i){var l=r.inEdges(i);if(l.length){var s=t.reduce(l,function(o,v){var c=r.edge(v),d=r.node(v.v);return{sum:o.sum+c.weight*d.order,weight:o.weight+c.weight}},{sum:0,weight:0});return{v:i,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:i}})}return yb}var mb,mM;function N8(){if(mM)return mb;mM=1;var t=It();mb=e;function e(i,l){var s={};t.forEach(i,function(v,c){var d=s[v.v]={indegree:0,in:[],out:[],vs:[v.v],i:c};t.isUndefined(v.barycenter)||(d.barycenter=v.barycenter,d.weight=v.weight)}),t.forEach(l.edges(),function(v){var c=s[v.v],d=s[v.w];!t.isUndefined(c)&&!t.isUndefined(d)&&(d.indegree++,c.out.push(s[v.w]))});var o=t.filter(s,function(v){return!v.indegree});return r(o)}function r(i){var l=[];function s(c){return function(d){d.merged||(t.isUndefined(d.barycenter)||t.isUndefined(c.barycenter)||d.barycenter>=c.barycenter)&&a(c,d)}}function o(c){return function(d){d.in.push(c),--d.indegree===0&&i.push(d)}}for(;i.length;){var v=i.pop();l.push(v),t.forEach(v.in.reverse(),s(v)),t.forEach(v.out,o(v))}return t.map(t.filter(l,function(c){return!c.merged}),function(c){return t.pick(c,["vs","i","barycenter","weight"])})}function a(i,l){var s=0,o=0;i.weight&&(s+=i.barycenter*i.weight,o+=i.weight),l.weight&&(s+=l.barycenter*l.weight,o+=l.weight),i.vs=l.vs.concat(i.vs),i.barycenter=s/o,i.weight=o,i.i=Math.min(l.i,i.i),l.merged=!0}return mb}var bb,bM;function L8(){if(bM)return bb;bM=1;var t=It(),e=Yr();bb=r;function r(l,s){var o=e.partition(l,function(x){return t.has(x,"barycenter")}),v=o.lhs,c=t.sortBy(o.rhs,function(x){return-x.i}),d=[],g=0,p=0,y=0;v.sort(i(!!s)),y=a(d,c,y),t.forEach(v,function(x){y+=x.vs.length,d.push(x.vs),g+=x.barycenter*x.weight,p+=x.weight,y=a(d,c,y)});var b={vs:t.flatten(d,!0)};return p&&(b.barycenter=g/p,b.weight=p),b}function a(l,s,o){for(var v;s.length&&(v=t.last(s)).i<=o;)s.pop(),l.push(v.vs),o++;return o}function i(l){return function(s,o){return s.barycentero.barycenter?1:l?o.i-s.i:s.i-o.i}}return bb}var wb,wM;function k8(){if(wM)return wb;wM=1;var t=It(),e=z8(),r=N8(),a=L8();wb=i;function i(o,v,c,d){var g=o.children(v),p=o.node(v),y=p?p.borderLeft:void 0,b=p?p.borderRight:void 0,x={};y&&(g=t.filter(g,function(R){return R!==y&&R!==b}));var E=e(o,g);t.forEach(E,function(R){if(o.children(R.v).length){var M=i(o,R.v,c,d);x[R.v]=M,t.has(M,"barycenter")&&s(R,M)}});var S=r(E,c);l(S,x);var T=a(S,d);if(y&&(T.vs=t.flatten([y,T.vs,b],!0),o.predecessors(y).length)){var C=o.node(o.predecessors(y)[0]),_=o.node(o.predecessors(b)[0]);t.has(T,"barycenter")||(T.barycenter=0,T.weight=0),T.barycenter=(T.barycenter*T.weight+C.order+_.order)/(T.weight+2),T.weight+=2}return T}function l(o,v){t.forEach(o,function(c){c.vs=t.flatten(c.vs.map(function(d){return v[d]?v[d].vs:d}),!0)})}function s(o,v){t.isUndefined(o.barycenter)?(o.barycenter=v.barycenter,o.weight=v.weight):(o.barycenter=(o.barycenter*o.weight+v.barycenter*v.weight)/(o.weight+v.weight),o.weight+=v.weight)}return wb}var Eb,EM;function P8(){if(EM)return Eb;EM=1;var t=It(),e=_a().Graph;Eb=r;function r(i,l,s){var o=a(i),v=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(c){return i.node(c)});return t.forEach(i.nodes(),function(c){var d=i.node(c),g=i.parent(c);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(v.setNode(c),v.setParent(c,g||o),t.forEach(i[s](c),function(p){var y=p.v===c?p.w:p.v,b=v.edge(y,c),x=t.isUndefined(b)?0:b.weight;v.setEdge(y,c,{weight:i.edge(p).weight+x})}),t.has(d,"minRank")&&v.setNode(c,{borderLeft:d.borderLeft[l],borderRight:d.borderRight[l]}))}),v}function a(i){for(var l;i.hasNode(l=t.uniqueId("_root")););return l}return Eb}var Sb,SM;function I8(){if(SM)return Sb;SM=1;var t=It();Sb=e;function e(r,a,i){var l={},s;t.forEach(i,function(o){for(var v=r.parent(o),c,d;v;){if(c=r.parent(v),c?(d=l[c],l[c]=v):(d=s,s=v),d&&d!==v){a.setEdge(d,v);return}v=c}})}return Sb}var xb,xM;function U8(){if(xM)return xb;xM=1;var t=It(),e=B8(),r=q8(),a=k8(),i=P8(),l=I8(),s=_a().Graph,o=Yr();xb=v;function v(p){var y=o.maxRank(p),b=c(p,t.range(1,y+1),"inEdges"),x=c(p,t.range(y-1,-1,-1),"outEdges"),E=e(p);g(p,E);for(var S=Number.POSITIVE_INFINITY,T,C=0,_=0;_<4;++C,++_){d(C%2?b:x,C%4>=2),E=o.buildLayerMatrix(p);var R=r(p,E);Rz)&&s(C,P,N)})})}function R(M,A){var O=-1,B,z=0;return t.forEach(A,function(N,k){if(S.node(N).dummy==="border"){var P=S.predecessors(N);P.length&&(B=S.node(P[0]).order,_(A,z,k,O,B),z=k,O=B)}_(A,z,A.length,B,M.length)}),A}return t.reduce(T,R),C}function l(S,T){if(S.node(T).dummy)return t.find(S.predecessors(T),function(C){return S.node(C).dummy})}function s(S,T,C){if(T>C){var _=T;T=C,C=_}var R=S[T];R||(S[T]=R={}),R[C]=!0}function o(S,T,C){if(T>C){var _=T;T=C,C=_}return t.has(S[T],C)}function v(S,T,C,_){var R={},M={},A={};return t.forEach(T,function(O){t.forEach(O,function(B,z){R[B]=B,M[B]=B,A[B]=z})}),t.forEach(T,function(O){var B=-1;t.forEach(O,function(z){var N=_(z);if(N.length){N=t.sortBy(N,function(q){return A[q]});for(var k=(N.length-1)/2,P=Math.floor(k),G=Math.ceil(k);P<=G;++P){var j=N[P];M[z]===z&&B1?s-1:0),v=1;v{this.store.setSelectedNode(a.target.id())}),this.cy.on("tap",a=>{a.target===this.cy&&this.store.setSelectedNode(void 0)}),this.unsubscribe=this.store.subscribe(a=>this.sync(a))}store;cy;unsubscribe;topologyVersion=-1;flashTimers=new Map;fit(){this.cy.animate({fit:{eles:this.cy.elements(),padding:48},duration:180})}zoomIn(){this.zoomBy(1.18)}zoomOut(){this.zoomBy(.85)}relayout(){this.runLayout()}exportPng(){return this.cy.png({full:!0,scale:2,bg:"#fbfcfd"})}destroy(){for(const e of this.flashTimers.values())window.clearTimeout(e);this.unsubscribe(),this.cy.destroy()}sync(e){const r=e.topologyVersion!==this.topologyVersion;this.cy.batch(()=>{this.syncNodes(e.nodes),this.syncEdges(e),this.syncSelection(e.selectedNode)}),r&&(this.topologyVersion=e.topologyVersion,this.runLayout());const a=e.recentFrames.at(-1);a?.changed.length&&this.flashChangedNodes(a.changed.map(i=>i.node))}syncNodes(e){const r=new Set(e.map(a=>a.id));for(const a of this.cy.nodes())r.has(a.id())||a.remove();for(const a of e){const i=this.cy.$id(a.id),l=this.nodeLabel(a);i.empty()?this.cy.add({group:"nodes",data:{id:a.id,label:l,value:a.primaryValue}}):i.data({...i.data(),label:l,value:a.primaryValue}),this.applyTone(this.cy.$id(a.id),a.primaryValue)}}syncEdges(e){const r=new Set(e.edges.map(a=>a.id));for(const a of this.cy.edges())r.has(a.id())||a.remove();for(const a of e.edges){const i=this.cy.$id(a.id);i.empty()?this.cy.add({group:"edges",data:{id:a.id,source:a.source,target:a.target,label:a.label}}):i.data({...i.data(),source:a.source,target:a.target,label:a.label})}}syncSelection(e){if(this.cy.elements().removeClass("highlighted dim"),!e)return;const r=this.cy.$id(e);if(r.empty())return;const a=r.union(r.neighborhood());a.addClass("highlighted"),this.cy.elements().not(a).addClass("dim")}runLayout(){this.cy.layout({name:"dagre",rankDir:"LR",nodeSep:48,edgeSep:18,rankSep:88,padding:36,animate:!0,animationDuration:260,fit:!0}).run()}zoomBy(e){const r=this.cy.zoom();this.cy.animate({zoom:{level:r*e,position:{x:this.cy.width()/2,y:this.cy.height()/2}},duration:120})}applyTone(e,r){e.removeClass(W8.join(" ")),e.addClass(`value-${Q8(r)}`)}flashChangedNodes(e){for(const r of new Set(e)){const a=this.cy.$id(r);if(a.empty())continue;a.addClass("changed");const i=this.flashTimers.get(r);i!==void 0&&window.clearTimeout(i);const l=window.setTimeout(()=>{this.cy.$id(r).removeClass("changed"),this.flashTimers.delete(r)},520);this.flashTimers.set(r,l)}}nodeLabel(e){const r=e.pins.map(a=>`${a.id}: ${a.value}`).join(` +`);return`${e.label} +${r}`}}function eV({store:t,onReady:e}){const r=kt.useRef(null);return kt.useEffect(()=>{if(!r.current)return;const a=new J8(r.current,t);return e(a),()=>{a.destroy(),e(void 0)}},[e,t]),xe.jsx("div",{ref:r,className:"graph-canvas","aria-label":"Graph visualization"})}const Mb="0";class tV{nodes=new Map;edges=[];listeners=new Set;frame=0;time;recentFrames=[];selectedNode;topologyVersion=0;subscribe(e){return this.listeners.add(e),e(this.snapshot()),()=>{this.listeners.delete(e)}}applyTopology(e){this.nodes.clear(),this.frame=0,this.time=void 0,this.recentFrames=[],this.selectedNode=void 0;for(const r of e.nodes){const a=new Map,i=e.values?.[r.id]??r.value;if(typeof i=="object"&&i!==null)for(const[l,s]of Object.entries(i))a.set(l,$n(s));for(const l of r.pins??[Mb])a.has(l)||a.set(l,$n(typeof i=="string"?i:r.value));a.size===0&&a.set(Mb,"N"),this.nodes.set(r.id,{id:r.id,label:r.label??r.id,pins:a})}this.edges=e.edges.map((r,a)=>({id:r.id??`${r.source}->${r.target}:${a}`,source:r.source,target:r.target,label:r.label??""})),this.topologyVersion+=1,this.emit()}applyFrame(e){const r={frame:e.frame,time:typeof e.time=="number"?e.time:void 0,changed:e.changed.map(a=>this.applyChange(a))};this.frame=r.frame,this.time=r.time,this.recentFrames=[...this.recentFrames,r].slice(-200),this.emit()}setSelectedNode(e){e!==void 0&&!this.nodes.has(e)||(this.selectedNode=e,this.emit())}snapshot(){return{frame:this.frame,time:this.time,nodes:Array.from(this.nodes.values()).map(e=>this.nodeViewModel(e)),edges:this.edges,recentFrames:this.recentFrames,selectedNode:this.selectedNode,topologyVersion:this.topologyVersion}}applyChange(e){const r=this.ensureNode(e.node),a=$n(e.from),i=$n(e.to);return r.pins.set(e.pin,i),{node:e.node,pin:e.pin,from:a,to:i}}ensureNode(e){const r=this.nodes.get(e);if(r)return r;const a={id:e,label:e,pins:new Map([[Mb,"N"]])};return this.nodes.set(e,a),this.topologyVersion+=1,a}nodeViewModel(e){const r=Array.from(e.pins.entries()).map(([a,i])=>({id:a,value:i}));return{id:e.id,label:e.label,pins:r,primaryValue:r[0]?.value??"N"}}emit(){const e=this.snapshot();for(const r of this.listeners)r(e)}}class V1 extends Error{constructor(e,r){super(`${e} at ${r}`),this.position=r}position}function rV(t,e="Imported graph"){return new nV(aV(t),e).parse()}function aV(t){const e=[];let r=0;for(;r",r)){e.push({kind:"arrow",value:"->",position:r}),r+=2;continue}if("{}[]=,;".includes(a)){e.push({kind:"punct",value:a,position:r}),r+=1;continue}if(a==='"'){const s=r;r+=1;let o="";for(;r",r);)l+=t[r],r+=1;if(!l)throw new V1(`Unexpected character "${a}"`,r);e.push({kind:"id",value:l,position:i})}return e.push({kind:"eof",value:"",position:t.length}),e}class nV{constructor(e,r){this.tokens=e,this.graphName=r}tokens;index=0;nodes=new Map;values={};edges=[];graphName;parse(){this.acceptId("strict");const e=this.readId();if(!e||!["digraph","graph"].includes(e.toLowerCase()))throw this.error("Expected digraph");if(!this.peekPunct("{")){const r=this.readIdOrString();r&&(this.graphName=r)}for(this.expectPunct("{");!this.peekPunct("}")&&!this.peek("eof");)this.parseStatement(),this.acceptPunct(";");return this.expectPunct("}"),{name:this.graphName,graph:{nodes:Array.from(this.nodes.values()),edges:this.edges,values:this.values}}}parseStatement(){if(this.acceptPunct(";"),this.peekPunct("}")||this.peek("eof"))return;const e=this.readIdOrString();if(!e)throw this.error("Expected statement");if(["graph","node","edge"].includes(e.toLowerCase())&&this.peekPunct("[")){this.readAttrs();return}if(this.peek("arrow")){this.parseEdgeStatement(e);return}const r=this.peekPunct("[")?this.readAttrs():{};this.upsertNode({id:e,attrs:r})}parseEdgeStatement(e){const r=[e];for(;this.accept("arrow");){const i=this.readIdOrString();if(!i)throw this.error("Expected edge target");r.push(i)}const a=this.peekPunct("[")?this.readAttrs():{};for(let i=0;i${s}:${this.edges.length}`,source:l,target:s,label:a.label??a.pin??""})}}upsertNode(e){const r=this.ensureNode(e.id);r.label=e.attrs.label??r.label;const a=iV(e.attrs);a.length&&(r.pins=a);const i=e.attrs.value??e.attrs.state;i!==void 0&&((r.pins?.length??0)>1?this.values[r.id]=Object.fromEntries((r.pins??["0"]).map(l=>[l,$n(i)])):this.values[r.id]=$n(i),r.value=$n(i))}ensureNode(e){const r=this.nodes.get(e);if(r)return r;const a={id:e,label:e,pins:["0"],value:"N"};return this.nodes.set(e,a),this.values[e]="N",a}readAttrs(){const e={};for(this.expectPunct("[");!this.peekPunct("]")&&!this.peek("eof");){const r=this.readIdOrString();if(!r)throw this.error("Expected attribute key");let a="true";this.acceptPunct("=")&&(a=this.readIdOrString()??""),e[r]=a,this.acceptPunct(","),this.acceptPunct(";")}return this.expectPunct("]"),e}readId(){if(this.peek("id"))return this.tokens[this.index++].value}readIdOrString(){if(this.peek("id")||this.peek("string"))return this.tokens[this.index++].value}accept(e){return this.peek(e)?(this.index+=1,!0):!1}acceptId(e){return this.peek("id")&&this.tokens[this.index].value.toLowerCase()===e.toLowerCase()?(this.index+=1,!0):!1}acceptPunct(e){return this.peekPunct(e)?(this.index+=1,!0):!1}expectPunct(e){if(!this.acceptPunct(e))throw this.error(`Expected "${e}"`)}peek(e){return this.tokens[this.index]?.kind===e}peekPunct(e){const r=this.tokens[this.index];return r?.kind==="punct"&&r.value===e}error(e){return new V1(e,this.tokens[this.index]?.position??0)}}function iV(t){const e=t.pins??t.pin;return e?e.split(/[,\s]+/).map(r=>r.trim()).filter(Boolean):[]}const uV={state:"idle",paused:!1,buffered:0};class lV{constructor(e,r=""){this.store=e,this.apiBase=r}store;apiBase;eventSource;statusListeners=new Set;status=uV;paused=!1;bufferedFrames=[];connectionGeneration=0;sessionId="simpy";subscribe(e){return this.statusListeners.add(e),e(this.status),()=>{this.statusListeners.delete(e)}}async connect(e=this.sessionId){const r=this.connectionGeneration+1;this.connectionGeneration=r,this.sessionId=e,this.bufferedFrames=[],this.updateStatus({state:"connecting",message:void 0});try{const a=await this.fetchTopology(e);if(r!==this.connectionGeneration)return;this.store.applyTopology(a),this.openEventSource(r,e)}catch(a){if(r!==this.connectionGeneration)return;this.updateStatus({state:"error",message:a instanceof Error?a.message:"Cannot connect to graph stream"})}}pause(){this.paused=!0,this.updateStatus({paused:!0})}resume(){this.paused=!1;for(const e of this.bufferedFrames.splice(0))this.store.applyFrame(e);this.updateStatus({paused:!1,buffered:0})}close(){this.connectionGeneration+=1,this.eventSource?.close(),this.eventSource=void 0,this.updateStatus({state:"disconnected"})}async listSessions(){const e=await fetch(`${this.apiBase}/api/sessions`);if(!e.ok)throw new Error(`Session list request failed: ${e.status}`);return(await e.json()).sessions}async createSession(e,r){const a=await fetch(`${this.apiBase}/api/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,graph:r})});if(!a.ok)throw new Error(`Create session request failed: ${a.status}`);return await a.json()}async setValue(e,r,a){const i=await fetch(`${this.apiBase}/api/sessions/${encodeURIComponent(this.sessionId)}/values`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({node:e,pin:r,value:a})});if(!i.ok)throw new Error(`Value update request failed: ${i.status}`)}async step(e=this.sessionId){const r=await fetch(`${this.apiBase}/api/sessions/${encodeURIComponent(e)}/step`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Step request failed: ${r.status}`)}currentSessionId(){return this.sessionId}async fetchTopology(e){const r=await fetch(`${this.apiBase}/api/sessions/${encodeURIComponent(e)}/graph`);if(!r.ok)throw new Error(`Graph topology request failed: ${r.status}`);return await r.json()}openEventSource(e,r){this.eventSource?.close(),this.eventSource=new EventSource(`${this.apiBase}/api/sessions/${encodeURIComponent(r)}/events`),this.eventSource.onopen=()=>{e===this.connectionGeneration&&this.updateStatus({state:"connected",message:void 0})},this.eventSource.onerror=()=>{e===this.connectionGeneration&&this.updateStatus({state:"disconnected",message:"Waiting for graph stream"})},this.eventSource.addEventListener("frame",a=>{e===this.connectionGeneration&&this.acceptFrame(JSON.parse(a.data))})}acceptFrame(e){if(this.paused){this.bufferedFrames.push(e),this.updateStatus({buffered:this.bufferedFrames.length});return}this.store.applyFrame(e)}updateStatus(e){this.status={...this.status,...e,paused:e.paused??this.paused,buffered:e.buffered??this.bufferedFrames.length};for(const r of this.statusListeners)r(this.status)}}const sV={state:"idle",paused:!1,buffered:0},oV=`digraph Sim { + A [value="0"]; + B [value="+"]; + + A -> 3 [label="0"]; + A -> 1 [label="+"]; + 1 -> 2 [label="0"]; + 1 -> B [label="+"]; + 2 -> 3 [label="0"]; + 2 -> C [label="+"]; +}`,fV=["0","N","+"];function cV(){const t=kt.useMemo(()=>new tV,[]),e=kt.useMemo(()=>new lV(t),[t]),r=kt.useRef(void 0),[a,i]=kt.useState(()=>t.snapshot()),[l,s]=kt.useState(sV),[o,v]=kt.useState([]),[c,d]=kt.useState("simpy"),[g,p]=kt.useState("Imported graph"),[y,b]=kt.useState(oV),[x,E]=kt.useState(),[S,T]=kt.useState(!1);kt.useEffect(()=>t.subscribe(i),[t]);const C=kt.useCallback(async()=>{const q=await e.listSessions();v(q)},[e]),_=kt.useCallback(async q=>{d(q),await e.connect(q)},[e]);kt.useEffect(()=>{const q=e.subscribe(s);return(async()=>{try{await C(),await e.connect(c)}catch(U){E(U instanceof Error?U.message:"Cannot initialize graph UI")}})(),()=>{q(),e.close()}},[e,C]);const R=kt.useCallback(q=>{r.current=q},[]),M=()=>{l.paused?e.resume():e.pause()},A=async()=>{E(void 0);try{await e.step(c)}catch(q){E(q instanceof Error?q.message:"Cannot step simulation")}},O=()=>{const q=r.current?.exportPng();if(!q)return;const U=document.createElement("a");U.href=q,U.download=`tern-graph-${c}-frame-${a.frame}.png`,U.click()},B=async q=>{await _(q.target.value)},z=async q=>{const U=q.target.files?.[0];U&&(b(await U.text()),p(U.name.replace(/\.[^.]+$/,"")||"Imported graph"),q.target.value="")},N=async()=>{T(!0),E(void 0);try{const q=rV(y,g),U=await e.createSession(g.trim()||q.name,q.graph);await C(),await _(U.session.id)}catch(q){q instanceof V1?E(q.message):E(q instanceof Error?q.message:"Cannot create graph session")}finally{T(!1)}},k=async(q,U,Y)=>{E(void 0);try{await e.setValue(q,U,Y)}catch(J){E(J instanceof Error?J.message:"Cannot update value")}},P=a.nodes.find(q=>q.id===a.selectedNode),G=o.find(q=>q.id===c),j=a.recentFrames.slice(-12).reverse();return xe.jsxs("div",{className:"app-shell",children:[xe.jsxs("header",{className:"topbar",children:[xe.jsxs("div",{className:"brand",children:[xe.jsx(XN,{size:18,"aria-hidden":"true"}),xe.jsx("span",{children:"SimPy Terns Graph"})]}),xe.jsx("select",{className:"session-select",value:c,onChange:B,"aria-label":"Session",children:o.map(q=>xe.jsx("option",{value:q.id,children:q.name},q.id))}),xe.jsx("button",{className:"icon-button",type:"button",onClick:()=>{C()},title:"Refresh sessions",children:xe.jsx($N,{size:18})}),xe.jsxs("div",{className:`connection-pill status-${l.state}`,children:[xe.jsx("span",{className:"status-dot"}),xe.jsx("span",{children:l.paused?"paused":l.state}),l.buffered>0?xe.jsx("strong",{children:l.buffered}):null]}),xe.jsxs("div",{className:"metric",children:[xe.jsx("span",{children:"frame"}),xe.jsx("strong",{children:a.frame})]}),typeof a.time=="number"?xe.jsxs("div",{className:"metric",children:[xe.jsx("span",{children:"t"}),xe.jsx("strong",{children:a.time.toFixed(1)})]}):null,xe.jsxs("div",{className:"toolbar",role:"toolbar","aria-label":"Graph controls",children:[xe.jsx("button",{className:"icon-button",type:"button",onClick:M,title:l.paused?"Resume stream":"Pause stream",children:l.paused?xe.jsx(KN,{size:18}):xe.jsx(YN,{size:18})}),xe.jsx("button",{className:"icon-button",type:"button",onClick:()=>{A()},disabled:!G?.steppable,title:G?.steppable?"Step simulation":"Session is not steppable",children:xe.jsx(ZN,{size:18})}),xe.jsx("button",{className:"icon-button",type:"button",onClick:()=>r.current?.fit(),title:"Fit graph",children:xe.jsx(FN,{size:18})}),xe.jsx("button",{className:"icon-button",type:"button",onClick:()=>r.current?.relayout(),title:"Run layout",children:xe.jsx(jN,{size:18})}),xe.jsx("button",{className:"icon-button",type:"button",onClick:()=>r.current?.zoomOut(),title:"Zoom out",children:xe.jsx(JN,{size:18})}),xe.jsx("button",{className:"icon-button",type:"button",onClick:()=>r.current?.zoomIn(),title:"Zoom in",children:xe.jsx(WN,{size:18})}),xe.jsx("button",{className:"icon-button",type:"button",onClick:O,title:"Export PNG",children:xe.jsx(HN,{size:18})})]})]}),xe.jsxs("main",{className:"workspace",children:[xe.jsx("section",{className:"graph-stage",children:xe.jsx(eV,{store:t,onReady:R})}),xe.jsxs("aside",{className:"side-panel",children:[xe.jsxs("section",{className:"panel-section",children:[xe.jsx("h2",{children:"Session"}),G?xe.jsxs("div",{className:"session-summary",children:[xe.jsx("strong",{children:G.name}),xe.jsx("span",{children:G.kind}),xe.jsxs("span",{children:[G.nodeCount," nodes"]}),xe.jsxs("span",{children:[G.edgeCount," edges"]})]}):xe.jsx("p",{className:"muted",children:"loading"})]}),xe.jsxs("section",{className:"panel-section",children:[xe.jsx("h2",{children:"Import Graphviz"}),xe.jsxs("div",{className:"import-form",children:[xe.jsx("input",{value:g,onChange:q=>p(q.target.value),"aria-label":"Graph name"}),xe.jsx("textarea",{value:y,onChange:q=>b(q.target.value),spellCheck:!1,"aria-label":"Graphviz DOT"}),xe.jsxs("div",{className:"import-actions",children:[xe.jsxs("label",{className:"file-button",children:[xe.jsx(QN,{size:16,"aria-hidden":"true"}),xe.jsx("span",{children:"DOT"}),xe.jsx("input",{type:"file",accept:".dot,.gv,text/vnd.graphviz,text/plain",onChange:z})]}),xe.jsx("button",{className:"primary-button",type:"button",onClick:N,disabled:S,children:"Create session"})]}),x?xe.jsx("p",{className:"error-text",children:x}):null]})]}),xe.jsxs("section",{className:"panel-section",children:[xe.jsx("h2",{children:"Selection"}),P?xe.jsxs("div",{className:"node-details",children:[xe.jsx("strong",{children:P.label}),P.pins.map(q=>xe.jsxs("div",{className:"pin-edit-row",children:[xe.jsx("span",{children:q.id}),xe.jsx("div",{className:"segmented",role:"group","aria-label":`${P.label} ${q.id}`,children:fV.map(U=>xe.jsx("button",{className:q.value===U?"active":"",type:"button",onClick:()=>{k(P.id,q.id,U)},children:U},U))})]},q.id))]}):xe.jsx("p",{className:"muted",children:"none"})]}),xe.jsxs("section",{className:"panel-section",children:[xe.jsx("h2",{children:"Recent Changes"}),xe.jsx("div",{className:"change-list",children:j.length?j.map(q=>xe.jsxs("article",{className:"change-frame",children:[xe.jsxs("header",{children:[xe.jsxs("strong",{children:["#",q.frame]}),typeof q.time=="number"?xe.jsxs("span",{children:["t=",q.time.toFixed(1)]}):null]}),q.changed.map(U=>xe.jsxs("div",{className:"change-row",children:[xe.jsx("span",{children:U.node}),xe.jsx("code",{children:U.pin}),xe.jsx("b",{children:U.from}),xe.jsx("i",{}),xe.jsx("b",{children:U.to})]},`${q.frame}-${U.node}-${U.pin}-${U.to}`))]},q.frame)):xe.jsx("p",{className:"muted",children:"waiting"})})]})]})]})]})}IN.createRoot(document.getElementById("root")).render(xe.jsx(kt.StrictMode,{children:xe.jsx(cV,{})})); diff --git a/frontend/dist/assets/index-CrNuOWI7.css b/frontend/dist/assets/index-CrNuOWI7.css new file mode 100644 index 0000000..3d219bb --- /dev/null +++ b/frontend/dist/assets/index-CrNuOWI7.css @@ -0,0 +1 @@ +:root{color-scheme:light;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;background:#f5f7fa;color:#17202a}*{box-sizing:border-box}body{margin:0;min-width:320px;min-height:100vh}button,code{font:inherit}.app-shell{display:grid;grid-template-rows:54px minmax(0,1fr);height:100vh;background:#f5f7fa}.topbar{display:flex;align-items:center;gap:12px;min-width:0;padding:0 14px;border-bottom:1px solid #d9e0e8;background:#fff}.brand{display:inline-flex;align-items:center;gap:8px;min-width:170px;font-size:14px;font-weight:760}.session-select{min-width:150px;max-width:230px;height:34px;padding:0 32px 0 10px;border:1px solid #c8d1dc;border-radius:8px;background:#fff;color:#263241;font:inherit;font-size:13px}.connection-pill,.metric{display:inline-flex;align-items:center;gap:7px;height:30px;padding:0 10px;border:1px solid #ccd5df;border-radius:8px;background:#f8fafc;font-size:12px;white-space:nowrap}.connection-pill strong{min-width:19px;height:19px;padding:1px 5px;border-radius:999px;background:#263241;color:#fff;text-align:center}.status-dot{width:8px;height:8px;border-radius:999px;background:#8a96a3}.status-connected .status-dot{background:#1d9b5b}.status-connecting .status-dot{background:#c48a13}.status-error .status-dot,.status-disconnected .status-dot{background:#c44235}.metric span{color:#657181}.metric strong{font-variant-numeric:tabular-nums}.toolbar{display:inline-flex;align-items:center;gap:6px;margin-left:auto}.icon-button{display:inline-grid;place-items:center;width:34px;height:34px;border:1px solid #c8d1dc;border-radius:8px;background:#fff;color:#263241;cursor:pointer}.icon-button:hover{border-color:#7d8794;background:#f1f4f8}.icon-button:active{transform:translateY(1px)}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 380px;min-height:0}.graph-stage{position:relative;min-width:0;min-height:0;overflow:hidden;background:#fbfcfd}.graph-canvas{position:absolute;inset:0}.side-panel{display:flex;min-width:0;min-height:0;flex-direction:column;overflow:auto;border-left:1px solid #d9e0e8;background:#fff}.panel-section{padding:16px;border-bottom:1px solid #e5eaf0}.panel-section h2{margin:0 0 12px;color:#4b5563;font-size:12px;font-weight:760;letter-spacing:0;text-transform:uppercase}.node-details{display:grid;gap:10px}.node-details>strong{font-size:18px}.pin-row,.pin-edit-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;min-height:34px;padding:7px 9px;border:1px solid #d9e0e8;border-radius:8px}.pin-row span,.pin-edit-row span{overflow:hidden;color:#657181;text-overflow:ellipsis}.session-summary{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;font-size:13px}.session-summary strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-summary span{color:#657181}.import-form{display:grid;gap:10px}.import-form input,.import-form textarea{width:100%;border:1px solid #ccd5df;border-radius:8px;background:#fff;color:#17202a;font:inherit}.import-form input{height:34px;padding:0 10px}.import-form textarea{min-height:180px;resize:vertical;padding:10px;font-family:SFMono-Regular,Consolas,Liberation Mono,monospace;font-size:12px;line-height:1.45}.import-actions{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px}.file-button,.primary-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:34px;border-radius:8px;font-size:13px;cursor:pointer}.file-button{position:relative;padding:0 11px;border:1px solid #c8d1dc;background:#fff}.file-button input{position:absolute;inset:0;opacity:0;cursor:pointer}.primary-button{border:1px solid #1f5fc8;background:#2c6bed;color:#fff;font-weight:700}.primary-button:disabled{cursor:not-allowed;opacity:.62}.error-text{margin:0;color:#b42318;font-size:13px}.segmented{display:inline-grid;grid-template-columns:repeat(3,34px);height:30px;overflow:hidden;border:1px solid #c8d1dc;border-radius:8px}.segmented button{border:0;border-right:1px solid #c8d1dc;background:#fff;color:#263241;cursor:pointer;font-family:SFMono-Regular,Consolas,Liberation Mono,monospace;font-size:12px}.segmented button:last-child{border-right:0}.segmented button.active{background:#263241;color:#fff}code{display:inline-grid;min-width:28px;min-height:24px;place-items:center;border-radius:6px;background:#eef2f6;color:#17202a;font-family:SFMono-Regular,Consolas,Liberation Mono,monospace;font-size:12px}.muted{margin:0;color:#7d8794}.change-list{display:grid;gap:10px}.change-frame{display:grid;gap:7px;padding:10px;border:1px solid #d9e0e8;border-radius:8px;background:#fbfcfd}.change-frame header{display:flex;align-items:center;justify-content:space-between;gap:8px;color:#4b5563;font-size:12px}.change-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto 16px auto;align-items:center;gap:7px;min-height:28px;font-size:13px}.change-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.change-row b{font-size:12px;font-variant-numeric:tabular-nums}.change-row i{display:block;width:16px;height:1px;background:#8a96a3}@media(max-width:860px){.app-shell{grid-template-rows:auto minmax(0,1fr)}.topbar{flex-wrap:wrap;min-height:54px;padding:8px}.brand{min-width:min(100%,180px)}.toolbar{width:100%;margin-left:0}.workspace{grid-template-columns:1fr;grid-template-rows:minmax(320px,1fr) 260px}.side-panel{border-top:1px solid #d9e0e8;border-left:0}}